From b032bbd0ccff3b43c8a3bb984a25fb8b53474ae2 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 30 Jan 2019 16:34:29 -0500 Subject: [PATCH 0001/1117] Roll src/third_party/skia 70ebd9ca0616..9c8ad0316147 (9 commits) (#7646) https://skia.googlesource.com/skia.git/%2Blog/70ebd9ca0616..9c8ad0316147 git log 70ebd9ca0616f54450a38d4f0f952810595a441b..9c8ad031614760e8256d4e2eb97ebdef8c067cd2 --date=short --no-merges --format=%ad %ae %s 2019-01-30 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader cda0cf9d8112..ddcbdc51f2aa (1 commits) 2019-01-30 jvanverth@google.com Fix screen invalidation on MacOS 2019-01-30 mtklein@google.com remove shadeSpan4f() 2019-01-30 herb@google.com Revert "make third_party() static libraries" 2019-01-30 mtklein@google.com remove Sk4x4f.h -- dead code 2019-01-30 robertphillips@google.com Add outline of new GrContext hierarchy 2019-01-30 mtklein@google.com remove burst mode in SkRPBlitter 2019-01-30 bsalomon@google.com Remove legacy texture-backed promise image interface. 2019-01-30 mtklein@google.com add Leon's gradient to p3 GM The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 1beaadf2c53b7..2064b431866d9 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': '70ebd9ca0616f54450a38d4f0f952810595a441b', + 'skia_revision': '9c8ad031614760e8256d4e2eb97ebdef8c067cd2', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 841dd181669a1..92aacf67ddab2 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 9fbc0d30a3a9de96a9a329b406654e52 +Signature: eeafbd18a447691d6b04247ac2d41ecc UNUSED LICENSES: @@ -1334,7 +1334,6 @@ FILE: ../../../third_party/skia/src/compute/skc/styling.c FILE: ../../../third_party/skia/src/compute/skc/styling.h FILE: ../../../third_party/skia/src/compute/skc/styling_types.h FILE: ../../../third_party/skia/src/compute/skc/tile.h -FILE: ../../../third_party/skia/src/core/Sk4x4f.h FILE: ../../../third_party/skia/src/core/SkATrace.cpp FILE: ../../../third_party/skia/src/core/SkATrace.h FILE: ../../../third_party/skia/src/core/SkAnnotationKeys.h @@ -5033,9 +5032,18 @@ ORIGIN: ../../../third_party/skia/gm/skbug_8664.cpp + ../../../third_party/skia/ TYPE: LicenseType.bsd FILE: ../../../third_party/skia/gm/skbug_8664.cpp FILE: ../../../third_party/skia/include/gpu/GrContextThreadSafeProxy.h +FILE: ../../../third_party/skia/include/private/GrContext_Base.h +FILE: ../../../third_party/skia/include/private/GrImageContext.h +FILE: ../../../third_party/skia/include/private/GrRecordingContext.h FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp +FILE: ../../../third_party/skia/src/gpu/GrBaseContextPriv.h FILE: ../../../third_party/skia/src/gpu/GrContextThreadSafeProxy.cpp +FILE: ../../../third_party/skia/src/gpu/GrContext_Base.cpp +FILE: ../../../third_party/skia/src/gpu/GrImageContext.cpp +FILE: ../../../third_party/skia/src/gpu/GrImageContextPriv.h +FILE: ../../../third_party/skia/src/gpu/GrRecordingContext.cpp +FILE: ../../../third_party/skia/src/gpu/GrRecordingContextPriv.h FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.h FILE: ../../../third_party/skia/src/sksl/SkSLDefines.h From e7eb1c8bf65531195fc76ba96c8fc8478ac5f554 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 30 Jan 2019 13:56:44 -0800 Subject: [PATCH 0002/1117] Update the verify_exported script to include the symbols for ICU data (#7647) --- testing/symbols/pubspec.yaml | 1 + testing/symbols/verify_exported.dart | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/testing/symbols/pubspec.yaml b/testing/symbols/pubspec.yaml index cfea098886fd4..a45a4a0b79afb 100644 --- a/testing/symbols/pubspec.yaml +++ b/testing/symbols/pubspec.yaml @@ -1,3 +1,4 @@ name: verify_exported dependencies: path: 1.6.2 + collection: 1.14.11 diff --git a/testing/symbols/verify_exported.dart b/testing/symbols/verify_exported.dart index e2c61e0ba1267..95a9982b0f3e6 100644 --- a/testing/symbols/verify_exported.dart +++ b/testing/symbols/verify_exported.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'dart:io'; import 'package:path/path.dart' as p; +import 'package:collection/collection.dart' show MapEquality; // This script verifies that the release binaries only export the expected // symbols. @@ -92,16 +93,19 @@ int _checkAndroid(String outPath, String nmPath, Iterable builds) { continue; } final Iterable entries = NmEntry.parse(nmResult.stdout); - if (entries.isEmpty) { - print('ERROR: $libFlutter exports no symbol'); - print(' Expected exactly one symbol "JNI_OnLoad" of type "T", but got none.'); - failures++; - } else if (entries.length > 1 || entries.first.type != 'T' || entries.first.name != 'JNI_OnLoad') { - print('ERROR: $libFlutter exports unexpected symbols.'); - print(' Expected exactly one symbol "JNI_OnLoad" of type "T", but got instead:'); - print(entries.fold('', (String previous, NmEntry entry) { - return '${previous == '' ? '' : '$previous\n'} ${entry.type} ${entry.name}'; - })); + final Map entryMap = Map.fromIterable( + entries, + key: (entry) => entry.name, + value: (entry) => entry.type); + final Map expectedSymbols = { + 'JNI_OnLoad': 'T', + '_binary_icudtl_dat_size': 'A', + '_binary_icudtl_dat_start': 'D', + }; + if (!MapEquality().equals(entryMap, expectedSymbols)) { + print('ERROR: $libFlutter exports the wrong symbols'); + print(' Expected $expectedSymbols'); + print(' Library has $entryMap.'); failures++; } else { print('OK: $libFlutter'); From 64e17076c1bbca92e9a79ab94fcf3414d971a751 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 30 Jan 2019 16:13:00 -0800 Subject: [PATCH 0003/1117] Document make_resource_current on FlutterOpenGLRendererConfig and warn if the callback is not set. (#7648) --- shell/platform/embedder/embedder.h | 6 ++++++ shell/platform/embedder/embedder_surface_gl.cc | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 6f039675855bf..d613ab3ec05aa 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -91,6 +91,12 @@ typedef struct { BoolCallback clear_current; BoolCallback present; UIntCallback fbo_callback; + // This is an optional callback. Flutter will ask the emebdder to create a GL + // context current on a background thread. If the embedder is able to do so, + // Flutter will assume that this context is in the same sharegroup as the main + // rendering context and use this context for asynchronous texture uploads. + // Though optional, it is recommended that all embedders set this callback as + // it will lead to better performance in texture handling. BoolCallback make_resource_current; // By default, the renderer config assumes that the FBO does not change for // the duration of the engine run. If this argument is true, the diff --git a/shell/platform/embedder/embedder_surface_gl.cc b/shell/platform/embedder/embedder_surface_gl.cc index 7e43a1066cfcd..8abb87fd3d896 100644 --- a/shell/platform/embedder/embedder_surface_gl.cc +++ b/shell/platform/embedder/embedder_surface_gl.cc @@ -80,9 +80,16 @@ std::unique_ptr EmbedderSurfaceGL::CreateGPUSurface() { sk_sp EmbedderSurfaceGL::CreateResourceContext() const { auto callback = gl_dispatch_table_.gl_make_resource_current_callback; if (callback && callback()) { - return IOManager::CreateCompatibleResourceLoadingContext( - GrBackend::kOpenGL_GrBackend); + if (auto context = IOManager::CreateCompatibleResourceLoadingContext( + GrBackend::kOpenGL_GrBackend)) { + return context; + } } + + FML_LOG(ERROR) + << "Could not create a resource context for async texture uploads. " + "Expect degraded performance. Set a valid make_resource_current " + "callback on FlutterOpenGLRendererConfig."; return nullptr; } From b94e759b256819fb33cb9d2b41565fc137cac733 Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Wed, 30 Jan 2019 16:22:45 -0800 Subject: [PATCH 0004/1117] Expose the Flutter engine, Dart and Skia versions to Dart. (#7634) - Moved versions from shell to common - versions singleton contains all the required versions. --- ci/licenses_golden/licenses_flutter | 7 +++-- {shell => common}/version/BUILD.gn | 6 ++--- {shell => common}/version/version.cc | 12 ++++----- {shell => common}/version/version.gni | 24 ++++++++--------- {shell => common}/version/version.h | 10 ++++---- lib/ui/BUILD.gn | 3 +++ lib/ui/dart_ui.cc | 2 ++ lib/ui/dart_ui.gni | 1 + lib/ui/ui.dart | 1 + lib/ui/versions.cc | 31 ++++++++++++++++++++++ lib/ui/versions.dart | 37 +++++++++++++++++++++++++++ lib/ui/versions.h | 21 +++++++++++++++ shell/common/BUILD.gn | 2 +- shell/common/engine.cc | 1 + shell/common/persistent_cache.cc | 2 +- shell/common/switches.cc | 9 ++++--- testing/dart/versions_test.dart | 35 +++++++++++++++++++++++++ 17 files changed, 170 insertions(+), 34 deletions(-) rename {shell => common}/version/BUILD.gn (67%) rename {shell => common}/version/version.cc (60%) rename {shell => common}/version/version.gni (68%) rename {shell => common}/version/version.h (61%) create mode 100644 lib/ui/versions.cc create mode 100644 lib/ui/versions.dart create mode 100644 lib/ui/versions.h create mode 100644 testing/dart/versions_test.dart diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 4df1c866548c1..f917817ff677e 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -23,6 +23,8 @@ FILE: ../../../flutter/common/settings.cc FILE: ../../../flutter/common/settings.h FILE: ../../../flutter/common/task_runners.cc FILE: ../../../flutter/common/task_runners.h +FILE: ../../../flutter/common/version/version.cc +FILE: ../../../flutter/common/version/version.h FILE: ../../../flutter/flow/compositor_context.cc FILE: ../../../flutter/flow/compositor_context.h FILE: ../../../flutter/flow/debug_print.cc @@ -307,6 +309,9 @@ 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/versions.cc +FILE: ../../../flutter/lib/ui/versions.dart +FILE: ../../../flutter/lib/ui/versions.h FILE: ../../../flutter/lib/ui/window.dart FILE: ../../../flutter/lib/ui/window/platform_message.cc FILE: ../../../flutter/lib/ui/window/platform_message.h @@ -570,8 +575,6 @@ 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 diff --git a/shell/version/BUILD.gn b/common/version/BUILD.gn similarity index 67% rename from shell/version/BUILD.gn rename to common/version/BUILD.gn index ca9ee7d1bf84e..d34928de8afaa 100644 --- a/shell/version/BUILD.gn +++ b/common/version/BUILD.gn @@ -11,9 +11,9 @@ source_set("version") { ] defines = [ - "SHELL_FLUTTER_ENGINE_VERSION=\"$shell_engine_version\"", - "SHELL_SKIA_VERSION=\"$shell_skia_version\"", - "SHELL_DART_VERSION=\"$shell_dart_version\"", + "FLUTTER_ENGINE_VERSION=\"$engine_version\"", + "SKIA_VERSION=\"$skia_version\"", + "DART_VERSION=\"$dart_version\"", ] public_configs = [ "$flutter_root:config" ] diff --git a/shell/version/version.cc b/common/version/version.cc similarity index 60% rename from shell/version/version.cc rename to common/version/version.cc index 4fac6a1043c92..e1d1c57d3baa8 100644 --- a/shell/version/version.cc +++ b/common/version/version.cc @@ -2,20 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/shell/version/version.h" +#include "flutter/common/version/version.h" -namespace shell { +namespace blink { const char* GetFlutterEngineVersion() { - return SHELL_FLUTTER_ENGINE_VERSION; + return FLUTTER_ENGINE_VERSION; } const char* GetSkiaVersion() { - return SHELL_SKIA_VERSION; + return SKIA_VERSION; } const char* GetDartVersion() { - return SHELL_DART_VERSION; + return DART_VERSION; } -} // namespace shell +} // namespace blink diff --git a/shell/version/version.gni b/common/version/version.gni similarity index 68% rename from shell/version/version.gni rename to common/version/version.gni index f06a89b8d555f..a4520c410006c 100644 --- a/shell/version/version.gni +++ b/common/version/version.gni @@ -3,42 +3,42 @@ # found in the LICENSE file. declare_args() { - shell_engine_version = "" + engine_version = "" - shell_skia_version = "" + skia_version = "" - shell_dart_version = "" + dart_version = "" } -if (shell_engine_version == "") { - shell_engine_version_lines = +if (engine_version == "") { + engine_version_lines = exec_script("$flutter_root/build/git_revision.py", [ "--repository", rebase_path(flutter_root, "", flutter_root), ], "list lines") - shell_engine_version = shell_engine_version_lines[0] + engine_version = engine_version_lines[0] } -if (shell_skia_version == "") { - shell_skia_version_lines = +if (skia_version == "") { + skia_version_lines = exec_script("$flutter_root/build/git_revision.py", [ "--repository", rebase_path("//third_party/skia", "", flutter_root), ], "list lines") - shell_skia_version = shell_skia_version_lines[0] + skia_version = skia_version_lines[0] } -if (shell_dart_version == "") { - shell_dart_version_lines = +if (dart_version == "") { + dart_version_lines = exec_script("$flutter_root/build/git_revision.py", [ "--repository", rebase_path("//third_party/dart", "", flutter_root), ], "list lines") - shell_dart_version = shell_dart_version_lines[0] + dart_version = dart_version_lines[0] } diff --git a/shell/version/version.h b/common/version/version.h similarity index 61% rename from shell/version/version.h rename to common/version/version.h index ce2647e0bddb6..d9ca8aa3f17e3 100644 --- a/shell/version/version.h +++ b/common/version/version.h @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_SHELL_COMMON_VERSION_H_ -#define FLUTTER_SHELL_COMMON_VERSION_H_ +#ifndef FLUTTER_COMMON_VERSION_VERSION_H_ +#define FLUTTER_COMMON_VERSION_VERSION_H_ -namespace shell { +namespace blink { const char* GetFlutterEngineVersion(); @@ -13,6 +13,6 @@ const char* GetSkiaVersion(); const char* GetDartVersion(); -} // namespace shell +} // namespace blink -#endif // FLUTTER_SHELL_COMMON_VERSION_H_ +#endif // FLUTTER_COMMON_VERSION_VERSION_H_ diff --git a/lib/ui/BUILD.gn b/lib/ui/BUILD.gn index 940b377bad8de..cba7632ce0b60 100644 --- a/lib/ui/BUILD.gn +++ b/lib/ui/BUILD.gn @@ -83,6 +83,8 @@ source_set("ui") { "text/text_box.h", "ui_dart_state.cc", "ui_dart_state.h", + "versions.cc", + "versions.h", "window/platform_message.cc", "window/platform_message.h", "window/platform_message_response.cc", @@ -104,6 +106,7 @@ source_set("ui") { deps = [ "$flutter_root/assets", "$flutter_root/common", + "$flutter_root/common/version", "$flutter_root/flow", "$flutter_root/fml", "$flutter_root/runtime:test_font", diff --git a/lib/ui/dart_ui.cc b/lib/ui/dart_ui.cc index 7256a183cb2e8..f6aa54c1cb946 100644 --- a/lib/ui/dart_ui.cc +++ b/lib/ui/dart_ui.cc @@ -27,6 +27,7 @@ #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/versions.h" #include "flutter/lib/ui/window/window.h" #include "third_party/tonic/converter/dart_converter.h" #include "third_party/tonic/logging/dart_error.h" @@ -87,6 +88,7 @@ void DartUI::InitForGlobal() { SceneHost::RegisterNatives(g_natives); SemanticsUpdate::RegisterNatives(g_natives); SemanticsUpdateBuilder::RegisterNatives(g_natives); + Versions::RegisterNatives(g_natives); Vertices::RegisterNatives(g_natives); Window::RegisterNatives(g_natives); diff --git a/lib/ui/dart_ui.gni b/lib/ui/dart_ui.gni index c52a9f025f231..67246f6ef8498 100644 --- a/lib/ui/dart_ui.gni +++ b/lib/ui/dart_ui.gni @@ -16,6 +16,7 @@ dart_ui_files = [ "$flutter_root/lib/ui/semantics.dart", "$flutter_root/lib/ui/text.dart", "$flutter_root/lib/ui/ui.dart", + "$flutter_root/lib/ui/versions.dart", "$flutter_root/lib/ui/window.dart", ] diff --git a/lib/ui/ui.dart b/lib/ui/ui.dart index cef4db81cee0e..5730f4e1378fa 100644 --- a/lib/ui/ui.dart +++ b/lib/ui/ui.dart @@ -34,4 +34,5 @@ part 'plugins.dart'; part 'pointer.dart'; part 'semantics.dart'; part 'text.dart'; +part 'versions.dart'; part 'window.dart'; diff --git a/lib/ui/versions.cc b/lib/ui/versions.cc new file mode 100644 index 0000000000000..37c18613240c8 --- /dev/null +++ b/lib/ui/versions.cc @@ -0,0 +1,31 @@ +// Copyright 2013 The Flutter 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/versions.h" +#include "flutter/common/version/version.h" +#include "third_party/tonic/converter/dart_converter.h" +#include "third_party/tonic/dart_library_natives.h" + +#include +#include + +using tonic::DartConverter; + +namespace blink { + +// returns a vector with 3 versions. +// Dart, Skia and Flutter engine versions in this order. +void GetVersions(Dart_NativeArguments args) { + const std::vector versions_list = { + GetDartVersion(), GetSkiaVersion(), GetFlutterEngineVersion()}; + Dart_Handle dart_val = + DartConverter>::ToDart(versions_list); + Dart_SetReturnValue(args, dart_val); +} + +void Versions::RegisterNatives(tonic::DartLibraryNatives* natives) { + natives->Register({{"Versions_getVersions", GetVersions, 1, true}}); +} + +} // namespace blink diff --git a/lib/ui/versions.dart b/lib/ui/versions.dart new file mode 100644 index 0000000000000..9121234856082 --- /dev/null +++ b/lib/ui/versions.dart @@ -0,0 +1,37 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of dart.ui; + +/// Wraps version information for Dart, Skia and Flutter. +class Versions { + + /// Builds a versions object using the information + /// we get from calling the native getVersions. + factory Versions._internal() { + final List versions = _getVersions(); + return Versions._(versions[0], versions[1], versions[2]); + } + + /// Private constructor to capture the versions. + Versions._( + this.dartVersion, + this.skiaVersion, + this.flutterEngineVersion + ) : assert(dartVersion != null), + assert(skiaVersion != null), + assert(flutterEngineVersion != null); + + /// returns a vector with 3 versions. + /// Dart, Skia and Flutter engine versions in this order. + static List _getVersions() native 'Versions_getVersions'; + + final String dartVersion; + final String skiaVersion; + final String flutterEngineVersion; +} + +/// [Versions] singleton. This object exposes Dart, Skia and +/// Flutter engine versions. +final Versions versions = Versions._internal(); diff --git a/lib/ui/versions.h b/lib/ui/versions.h new file mode 100644 index 0000000000000..84737e5eb68e6 --- /dev/null +++ b/lib/ui/versions.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_VERSIONS_H_ +#define FLUTTER_LIB_UI_VERSIONS_H_ + +namespace tonic { +class DartLibraryNatives; +} // namespace tonic + +namespace blink { + +class Versions final { + public: + static void RegisterNatives(tonic::DartLibraryNatives* natives); +}; + +} // namespace blink + +#endif // FLUTTER_LIB_UI_VERSIONS_H_ diff --git a/shell/common/BUILD.gn b/shell/common/BUILD.gn index c17dd8b60bd39..aa22968662c3b 100644 --- a/shell/common/BUILD.gn +++ b/shell/common/BUILD.gn @@ -105,7 +105,7 @@ source_set("common") { ] public_deps = [ - "$flutter_root/shell/version", + "$flutter_root/common/version", "$flutter_root/third_party/txt", "//third_party/rapidjson", "//third_party/tonic", diff --git a/shell/common/engine.cc b/shell/common/engine.cc index 4e084fa9079c7..c0aec58ee9900 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -10,6 +10,7 @@ #include #include "flutter/common/settings.h" +#include "flutter/common/version/version.h" #include "flutter/fml/eintr_wrapper.h" #include "flutter/fml/file.h" #include "flutter/fml/make_copyable.h" diff --git a/shell/common/persistent_cache.cc b/shell/common/persistent_cache.cc index d6d027ffab25e..95d2b6f9ecfab 100644 --- a/shell/common/persistent_cache.cc +++ b/shell/common/persistent_cache.cc @@ -7,13 +7,13 @@ #include #include +#include "flutter/common/version/version.h" #include "flutter/fml/base32.h" #include "flutter/fml/file.h" #include "flutter/fml/make_copyable.h" #include "flutter/fml/mapping.h" #include "flutter/fml/paths.h" #include "flutter/fml/trace_event.h" -#include "flutter/shell/version/version.h" namespace shell { diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 5b4f1abe2d566..dc25956fca9d6 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -9,10 +9,10 @@ #include #include +#include "flutter/common/version/version.h" #include "flutter/fml/native_library.h" #include "flutter/fml/paths.h" #include "flutter/fml/string_view.h" -#include "flutter/shell/version/version.h" // Include once for the default enum definition. #include "flutter/shell/common/switches.h" @@ -46,11 +46,12 @@ void PrintUsage(const std::string& executable_name) { std::cerr << "Versions: " << std::endl << std::endl; - std::cerr << "Flutter Engine Version: " << GetFlutterEngineVersion() + std::cerr << "Flutter Engine Version: " << blink::GetFlutterEngineVersion() << std::endl; - std::cerr << "Skia Version: " << GetSkiaVersion() << std::endl; + std::cerr << "Skia Version: " << blink::GetSkiaVersion() << std::endl; - std::cerr << "Dart Version: " << GetDartVersion() << std::endl << std::endl; + std::cerr << "Dart Version: " << blink::GetDartVersion() << std::endl + << std::endl; std::cerr << "Available Flags:" << std::endl; diff --git a/testing/dart/versions_test.dart b/testing/dart/versions_test.dart new file mode 100644 index 0000000000000..4de21ef252966 --- /dev/null +++ b/testing/dart/versions_test.dart @@ -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. + +// HACK: pretend to be dart.ui in order to access its internals +library dart.ui; + +import 'package:test/test.dart'; + +part '../../lib/ui/versions.dart'; + +bool _isNotEmpty(String s) { + if (s == null || s.isEmpty) { + return false; + } else { + return true; + } +} + +void main() { + test('dartVersion should not be empty', () { + final String dartVersion = versions.dartVersion; + expect(_isNotEmpty(dartVersion), equals(true)); + }); + + test('skiaVersion should not be empty', () { + final String skiaVersion = versions.skiaVersion; + expect(_isNotEmpty(skiaVersion), equals(true)); + }); + + test('flutterEngineVersion should not be empty', () { + final String flutterEngineVersion = versions.flutterEngineVersion; + expect(_isNotEmpty(flutterEngineVersion), equals(true)); + }); +} From e9419bf6db8392d52f0a0a551896564bc4b9a21b Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 30 Jan 2019 20:07:29 -0500 Subject: [PATCH 0005/1117] Roll src/third_party/skia 9c8ad0316147..b7af275ebbf5 (3 commits) (#7650) https://skia.googlesource.com/skia.git/%2Blog/9c8ad0316147..b7af275ebbf5 git log 9c8ad031614760e8256d4e2eb97ebdef8c067cd2..b7af275ebbf55b6c79cf361bcf87612b328ea50a --date=short --no-merges --format=%ad %ae %s 2019-01-30 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader b08c5e928317..77630f1e7d12 (1 commits) 2019-01-30 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader ddcbdc51f2aa..b08c5e928317 (1 commits) 2019-01-30 scroggo@google.com Fix bug in sampling rotated decodes The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 2064b431866d9..7d25c3bb80457 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': '9c8ad031614760e8256d4e2eb97ebdef8c067cd2', + 'skia_revision': 'b7af275ebbf55b6c79cf361bcf87612b328ea50a', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 92aacf67ddab2..94447464c50fd 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: eeafbd18a447691d6b04247ac2d41ecc +Signature: 5b33ea5f6a7e1e09a65ad9184e872823 UNUSED LICENSES: From 7fa77ef03a1647d831ea0fa6427e083a53dc7e18 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 30 Jan 2019 18:11:08 -0800 Subject: [PATCH 0006/1117] Fix two typos in embedder docs (#7649) --- shell/platform/embedder/embedder.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index d613ab3ec05aa..c2cc35669ca72 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -109,7 +109,7 @@ typedef struct { ProcResolver gl_proc_resolver; // When the embedder specifies that a texture has a frame available, the // engine will call this method (on an internal engine managed thread) so that - // external texture details can be suppplied to the engine for subsequent + // external texture details can be supplied to the engine for subsequent // composition. TextureFrameCallback gl_external_texture_frame_callback; } FlutterOpenGLRendererConfig; @@ -249,7 +249,7 @@ typedef struct { // documentation on the Wiki at // https://github.com/flutter/flutter/wiki/Flutter-engine-operation-in-AOT-Mode const uint8_t* isolate_snapshot_instructions; - // The size of the isoalte snapshot instructions buffer. + // The size of the isolate snapshot instructions buffer. size_t isolate_snapshot_instructions_size; } FlutterProjectArgs; From 28339c864885b5607a949ce020a254ca333427d8 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 30 Jan 2019 23:40:21 -0500 Subject: [PATCH 0007/1117] Roll src/third_party/skia b7af275ebbf5..8a484d0203d9 (3 commits) (#7652) https://skia.googlesource.com/skia.git/%2Blog/b7af275ebbf5..8a484d0203d9 git log b7af275ebbf55b6c79cf361bcf87612b328ea50a..8a484d0203d954a5ac4c7deb0f774dbe6a6fa9be --date=short --no-merges --format=%ad %ae %s 2019-01-31 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 97fa6e4bdf7b..5d360ebe1581 (482 commits) 2019-01-31 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 77630f1e7d12..787f953343b0 (1 commits) 2019-01-31 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 fa7ca18f44ed..783809808ec0 (3 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 7d25c3bb80457..39ec3064efb36 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': 'b7af275ebbf55b6c79cf361bcf87612b328ea50a', + 'skia_revision': '8a484d0203d954a5ac4c7deb0f774dbe6a6fa9be', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 94447464c50fd..aafc6cd0e174d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 5b33ea5f6a7e1e09a65ad9184e872823 +Signature: ac5d42d5f02cbc67ee3e8e81d55c64c4 UNUSED LICENSES: From ef1a7f8ce4d114fe458c303cfc9a13ae8943f8df Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 31 Jan 2019 03:11:28 -0500 Subject: [PATCH 0008/1117] Roll src/third_party/skia 8a484d0203d9..e9742a5a0db1 (2 commits) (#7653) https://skia.googlesource.com/skia.git/%2Blog/8a484d0203d9..e9742a5a0db1 git log 8a484d0203d954a5ac4c7deb0f774dbe6a6fa9be..e9742a5a0db1e86f1b548d74c025404690eaed63 --date=short --no-merges --format=%ad %ae %s 2019-01-30 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-01-31 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 39ec3064efb36..ee12027080813 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': '8a484d0203d954a5ac4c7deb0f774dbe6a6fa9be', + 'skia_revision': 'e9742a5a0db1e86f1b548d74c025404690eaed63', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index aafc6cd0e174d..dc00043e96324 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ac5d42d5f02cbc67ee3e8e81d55c64c4 +Signature: b364c984b25e17770a60e15cf094db1e UNUSED LICENSES: From 4f5e1709be7750b66589bd391e3fc5f221465f16 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 31 Jan 2019 06:45:59 -0500 Subject: [PATCH 0009/1117] Roll src/third_party/skia e9742a5a0db1..ea2dc6a6bc11 (1 commits) (#7654) https://skia.googlesource.com/skia.git/%2Blog/e9742a5a0db1..ea2dc6a6bc11 git log e9742a5a0db1e86f1b548d74c025404690eaed63..ea2dc6a6bc114d92181fc0825b75b5524e4b0e67 --date=short --no-merges --format=%ad %ae %s 2019-01-31 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 783809808ec0..794364ebd51c (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index ee12027080813..3687cdd550e7d 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': 'e9742a5a0db1e86f1b548d74c025404690eaed63', + 'skia_revision': 'ea2dc6a6bc114d92181fc0825b75b5524e4b0e67', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index dc00043e96324..09af9e34257c6 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b364c984b25e17770a60e15cf094db1e +Signature: 9d4654873fc70d8b5c7bdd5e3fa9e276 UNUSED LICENSES: From e71daf6cf8d944ed9f8515fb4ca0c4a8d07aaeb6 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 31 Jan 2019 10:16:50 -0500 Subject: [PATCH 0010/1117] Roll src/third_party/skia ea2dc6a6bc11..1bd245b91801 (1 commits) (#7655) https://skia.googlesource.com/skia.git/%2Blog/ea2dc6a6bc11..1bd245b91801 git log ea2dc6a6bc114d92181fc0825b75b5524e4b0e67..1bd245b9180147d85b6ead60a04116e0333ad37f --date=short --no-merges --format=%ad %ae %s 2019-01-31 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 787f953343b0..5ebd2c0fafca (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 3687cdd550e7d..6efe808257be9 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': 'ea2dc6a6bc114d92181fc0825b75b5524e4b0e67', + 'skia_revision': '1bd245b9180147d85b6ead60a04116e0333ad37f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 09af9e34257c6..32b0a9530cbb8 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 9d4654873fc70d8b5c7bdd5e3fa9e276 +Signature: 2b63dcfcce51383860e5d143033bfdee UNUSED LICENSES: From 54f5467155241ce098339db85b08ff5f9649d8a4 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 31 Jan 2019 13:50:56 -0500 Subject: [PATCH 0011/1117] Roll src/third_party/skia 1bd245b91801..5b257abb87d2 (5 commits) (#7656) https://skia.googlesource.com/skia.git/%2Blog/1bd245b91801..5b257abb87d2 git log 1bd245b9180147d85b6ead60a04116e0333ad37f..5b257abb87d2085b7f36fd5bc8f4a78a73942b2a --date=short --no-merges --format=%ad %ae %s 2019-01-30 reed@google.com change measureText impl to first convert to glyphs 2019-01-30 egdaniel@google.com Add hardware buffer unit test from old skqp to skia. 2019-01-31 bsalomon@google.com Update Metal unit test blacklist after adding new promise image tests 2019-01-30 bsalomon@google.com Add option to skip intermediate release/fulfill calls for promise images. 2019-01-30 michaelludwig@google.com Add new thin anti-aliasing demo The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 6efe808257be9..abd3960432f25 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': '1bd245b9180147d85b6ead60a04116e0333ad37f', + 'skia_revision': '5b257abb87d2085b7f36fd5bc8f4a78a73942b2a', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 32b0a9530cbb8..901656fd7752b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2b63dcfcce51383860e5d143033bfdee +Signature: 922dfed5a65815e76f694eaba4265b33 UNUSED LICENSES: @@ -5036,6 +5036,7 @@ FILE: ../../../third_party/skia/include/private/GrContext_Base.h FILE: ../../../third_party/skia/include/private/GrImageContext.h FILE: ../../../third_party/skia/include/private/GrRecordingContext.h FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h +FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp FILE: ../../../third_party/skia/src/gpu/GrBaseContextPriv.h FILE: ../../../third_party/skia/src/gpu/GrContextThreadSafeProxy.cpp From 93452747fcb791d73c9c548e74db382fcc39d772 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Thu, 31 Jan 2019 14:14:43 -0800 Subject: [PATCH 0012/1117] Initial import of FDE macOS framework (#7642) Merges the current flutter-desktop-embedding macOS framework into the engine. Notable changes: - All channel/codec related code is eliminated in favor of using the existing iOS implementations. - All .m files renamed to .mm for consistency with the iOS code. - Some minor code changes to fix new warnings in Objective-C++ mode. - License headers, basic format (e.g., clang-format changes) updated to use repo style. - Xcode project is not included; instead adds GN build rules to create an integrated framework that combines what was the FDE library with what is present in FlutterEmbedder.framework. Other changes are left as follow-ups, including: - Moving shared code out of ios/ into common/. - Potentially improving sharing between iOS and macOS BUILD.gn. - Class renaming; the FLE prefix will be eliminated, but that API surface isn't stable yet, so that can be changed later. --- ci/licenses_golden/licenses_flutter | 16 + shell/platform/darwin/BUILD.gn | 23 + shell/platform/darwin/framework_shared.gni | 14 + .../Headers/FlutterBinaryMessenger.h | 5 +- .../ios/framework/Headers/FlutterChannels.h | 11 +- shell/platform/darwin/macos/BUILD.gn | 196 ++++++++ .../Headers/FLEOpenGLContextHandling.h | 29 ++ .../macos/framework/Headers/FLEPlugin.h | 52 ++ .../framework/Headers/FLEPluginRegistrar.h | 48 ++ .../framework/Headers/FLEReshapeListener.h | 23 + .../darwin/macos/framework/Headers/FLEView.h | 28 ++ .../framework/Headers/FLEViewController.h | 64 +++ .../darwin/macos/framework/Headers/Flutter.h | 14 + .../darwin/macos/framework/Info.plist | 24 + .../framework/Source/FLETextInputModel.h | 69 +++ .../framework/Source/FLETextInputModel.mm | 123 +++++ .../framework/Source/FLETextInputPlugin.h | 26 + .../framework/Source/FLETextInputPlugin.mm | 309 ++++++++++++ .../darwin/macos/framework/Source/FLEView.mm | 42 ++ .../framework/Source/FLEViewController.mm | 474 ++++++++++++++++++ .../Source/FLEViewController_Internal.h | 20 + .../darwin/macos/framework/module.modulemap | 6 + 22 files changed, 1613 insertions(+), 3 deletions(-) create mode 100644 shell/platform/darwin/framework_shared.gni create mode 100644 shell/platform/darwin/macos/BUILD.gn create mode 100644 shell/platform/darwin/macos/framework/Headers/FLEOpenGLContextHandling.h create mode 100644 shell/platform/darwin/macos/framework/Headers/FLEPlugin.h create mode 100644 shell/platform/darwin/macos/framework/Headers/FLEPluginRegistrar.h create mode 100644 shell/platform/darwin/macos/framework/Headers/FLEReshapeListener.h create mode 100644 shell/platform/darwin/macos/framework/Headers/FLEView.h create mode 100644 shell/platform/darwin/macos/framework/Headers/FLEViewController.h create mode 100644 shell/platform/darwin/macos/framework/Headers/Flutter.h create mode 100644 shell/platform/darwin/macos/framework/Info.plist create mode 100644 shell/platform/darwin/macos/framework/Source/FLETextInputModel.h create mode 100644 shell/platform/darwin/macos/framework/Source/FLETextInputModel.mm create mode 100644 shell/platform/darwin/macos/framework/Source/FLETextInputPlugin.h create mode 100644 shell/platform/darwin/macos/framework/Source/FLETextInputPlugin.mm create mode 100644 shell/platform/darwin/macos/framework/Source/FLEView.mm create mode 100644 shell/platform/darwin/macos/framework/Source/FLEViewController.mm create mode 100644 shell/platform/darwin/macos/framework/Source/FLEViewController_Internal.h create mode 100644 shell/platform/darwin/macos/framework/module.modulemap diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index f917817ff677e..b2ed5bab64c99 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -557,6 +557,22 @@ 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/darwin/macos/framework/Headers/FLEOpenGLContextHandling.h +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FLEPlugin.h +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FLEPluginRegistrar.h +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FLEReshapeListener.h +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FLEView.h +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FLEViewController.h +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/Flutter.h +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Info.plist +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FLETextInputModel.h +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FLETextInputModel.mm +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FLETextInputPlugin.h +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FLETextInputPlugin.mm +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FLEView.mm +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FLEViewController.mm +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FLEViewController_Internal.h +FILE: ../../../flutter/shell/platform/darwin/macos/framework/module.modulemap FILE: ../../../flutter/shell/platform/embedder/assets/EmbedderInfo.plist FILE: ../../../flutter/shell/platform/embedder/assets/embedder.modulemap FILE: ../../../flutter/shell/platform/embedder/embedder.cc diff --git a/shell/platform/darwin/BUILD.gn b/shell/platform/darwin/BUILD.gn index 0dba0a457e448..3231560745489 100644 --- a/shell/platform/darwin/BUILD.gn +++ b/shell/platform/darwin/BUILD.gn @@ -4,12 +4,19 @@ assert(is_mac || is_ios) +import("framework_shared.gni") + group("darwin") { if (is_ios) { deps = [ "ios:flutter_framework", ] } + if (is_mac) { + deps = [ + "macos:flutter_framework", + ] + } } source_set("flutter_channels") { @@ -40,6 +47,22 @@ source_set("flutter_channels") { public_configs = [ "$flutter_root:config" ] } +# Framework code shared between iOS and macOS. +source_set("framework_shared") { + set_sources_assignment_filter([]) + sources = [ + "ios/framework/Source/FlutterChannels.mm", + "ios/framework/Source/FlutterCodecs.mm", + "ios/framework/Source/FlutterStandardCodec.mm", + "ios/framework/Source/FlutterStandardCodec_Internal.h", + ] + + public = framework_shared_headers + set_sources_assignment_filter(sources_assignment_filter) + + defines = [ "FLUTTER_FRAMEWORK" ] +} + executable("flutter_channels_unittests") { testonly = true diff --git a/shell/platform/darwin/framework_shared.gni b/shell/platform/darwin/framework_shared.gni new file mode 100644 index 0000000000000..7ca4b2d068017 --- /dev/null +++ b/shell/platform/darwin/framework_shared.gni @@ -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. + +framework_shared_headers = get_path_info( + [ + # TODO: Move these files, and their implementations, to a shared + # location. + "ios/framework/Headers/FlutterMacros.h", + "ios/framework/Headers/FlutterBinaryMessenger.h", + "ios/framework/Headers/FlutterChannels.h", + "ios/framework/Headers/FlutterCodecs.h", + ], + "abspath") diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h b/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h index 2c35fd42599c4..07815c6494411 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h @@ -61,7 +61,10 @@ FLUTTER_EXPORT */ - (void)sendOnChannel:(NSString*)channel message:(NSData* _Nullable)message - binaryReply:(FlutterBinaryReply _Nullable)callback; + binaryReply:(FlutterBinaryReply _Nullable)callback + // TODO: Add macOS support for replies once + // https://github.com/flutter/flutter/issues/18852 is fixed. + API_UNAVAILABLE(macos); /** * Registers a message handler for incoming binary messages from the Flutter side diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h b/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h index d582ce46dc6bb..9245d79a8ec6c 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h @@ -103,7 +103,11 @@ FLUTTER_EXPORT * @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; +- (void)sendMessage:(id _Nullable)message + reply:(FlutterReply _Nullable)callback + // TODO: Add macOS support for replies once + // https://github.com/flutter/flutter/issues/18852 is fixed. + API_UNAVAILABLE(macos); /** * Registers a message handler with this channel. @@ -234,7 +238,10 @@ FLUTTER_EXPORT */ - (void)invokeMethod:(NSString*)method arguments:(id _Nullable)arguments - result:(FlutterResult _Nullable)callback; + result:(FlutterResult _Nullable)callback + // TODO: Add macOS support for replies once + // https://github.com/flutter/flutter/issues/18852 is fixed. + API_UNAVAILABLE(macos); /** * Registers a handler for method calls from the Flutter side. diff --git a/shell/platform/darwin/macos/BUILD.gn b/shell/platform/darwin/macos/BUILD.gn new file mode 100644 index 0000000000000..29fcb9f1f1fe5 --- /dev/null +++ b/shell/platform/darwin/macos/BUILD.gn @@ -0,0 +1,196 @@ +# Copyright 2013 The Flutter 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_mac) + +import("//build/config/mac/mac_sdk.gni") +import("$flutter_root/common/config.gni") +import("$flutter_root/shell/platform/darwin/framework_shared.gni") + +_flutter_framework_name = "Flutter" +_flutter_framework_out_dir_subpath = "macos/$_flutter_framework_name.framework" +_flutter_framework_dir = "$root_out_dir/$_flutter_framework_out_dir_subpath" + +# The headers that will be copied to the Flutter.framework and be accessed +# from outside the Flutter engine source root. +_flutter_framework_headers = [ + "framework/Headers/Flutter.h", + "framework/Headers/FLEOpenGLContextHandling.h", + "framework/Headers/FLEPlugin.h", + "framework/Headers/FLEPluginRegistrar.h", + "framework/Headers/FLEReshapeListener.h", + "framework/Headers/FLEView.h", + "framework/Headers/FLEViewController.h", +] + +_flutter_framework_headers_copy_dir = + "$_flutter_framework_dir/Versions/A/Headers" + +shared_library("create_flutter_framework_dylib") { + visibility = [ ":*" ] + + output_name = "$_flutter_framework_name" + + sources = [ + "framework/Source/FLETextInputModel.h", + "framework/Source/FLETextInputModel.mm", + "framework/Source/FLETextInputPlugin.h", + "framework/Source/FLETextInputPlugin.mm", + "framework/Source/FLEView.mm", + "framework/Source/FLEViewController.mm", + "framework/Source/FLEViewController_Internal.h", + ] + + sources += _flutter_framework_headers + + deps = [ + "$flutter_root/shell/platform/darwin:framework_shared", + "$flutter_root/shell/platform/embedder:embedder", + ] + + public_configs = [ "$flutter_root:config" ] + + defines = [ "FLUTTER_FRAMEWORK" ] + + cflags_objcc = [ "-fobjc-arc" ] + + libs = [ "Cocoa.framework" ] +} + +copy("copy_framework_dylib") { + visibility = [ ":*" ] + + sources = [ + "$root_out_dir/lib$_flutter_framework_name.dylib", + ] + outputs = [ + "$_flutter_framework_dir/Versions/A/$_flutter_framework_name", + ] + + deps = [ + ":create_flutter_framework_dylib", + ] +} + +action("copy_dylib_and_update_framework_install_name") { + visibility = [ ":*" ] + stamp_file = "$root_out_dir/flutter_install_name_stamp" + script = "$flutter_root/sky/tools/change_install_name.py" + + inputs = [ + "$_flutter_framework_dir/Versions/A/$_flutter_framework_name", + ] + outputs = [ + stamp_file, + ] + + args = [ + "--dylib", + rebase_path("$_flutter_framework_dir/Versions/A/$_flutter_framework_name"), + "--install_name", + "@rpath/$_flutter_framework_name.framework/Versions/A/$_flutter_framework_name", + "--stamp", + rebase_path(stamp_file), + ] + + deps = [ + ":copy_framework_dylib", + ] +} + +copy("copy_framework_info_plist") { + visibility = [ ":*" ] + sources = [ + "framework/Info.plist", + ] + outputs = [ + "$_flutter_framework_dir/Versions/A/Resources/Info.plist", + ] +} + +copy("copy_framework_module_map") { + visibility = [ ":*" ] + sources = [ + "framework/module.modulemap", + ] + outputs = [ + "$_flutter_framework_dir/Versions/A/Modules/module.modulemap", + ] +} + +action("copy_framework_headers") { + script = "$flutter_root/sky/tools/install_framework_headers.py" + visibility = [ ":*" ] + set_sources_assignment_filter([]) + sources = get_path_info(_flutter_framework_headers, "abspath") + + framework_shared_headers + outputs = [] + foreach(header, sources) { + header_basename = get_path_info(header, "file") + outputs += [ "$_flutter_framework_headers_copy_dir/$header_basename" ] + } + args = [ + "--location", + rebase_path("$_flutter_framework_headers_copy_dir"), + "--headers", + ] + rebase_path(sources, "", "//") + set_sources_assignment_filter(sources_assignment_filter) +} + +copy("copy_framework_icu") { + visibility = [ ":*" ] + set_sources_assignment_filter([]) + sources = [ + "//third_party/icu/flutter/icudtl.dat", + ] + set_sources_assignment_filter(sources_assignment_filter) + outputs = [ + "$_flutter_framework_dir/Versions/A/Resources/{{source_file_part}}", + ] +} + +copy("copy_license") { + visibility = [ ":*" ] + sources = [ + "//LICENSE", + ] + outputs = [ + "$root_out_dir/LICENSE", + ] +} + +action("_generate_symlinks") { + visibility = [ ":*" ] + script = "//build/config/mac/package_framework.py" + outputs = [ + "$root_build_dir/$_flutter_framework_name.stamp", + ] + args = [ + "--framework", + "$_flutter_framework_out_dir_subpath", + "--version", + "A", + "--contents", + "$_flutter_framework_name", + "Resources", + "Headers", + "Modules", + "--stamp", + "$_flutter_framework_name.stamp", + ] + deps = [ + ":copy_dylib_and_update_framework_install_name", + ":copy_framework_headers", + ":copy_framework_icu", + ":copy_framework_info_plist", + ":copy_framework_module_map", + ":copy_license", + ] +} + +group("flutter_framework") { + deps = [ + ":_generate_symlinks", + ] +} diff --git a/shell/platform/darwin/macos/framework/Headers/FLEOpenGLContextHandling.h b/shell/platform/darwin/macos/framework/Headers/FLEOpenGLContextHandling.h new file mode 100644 index 0000000000000..bd4a7f48b0efd --- /dev/null +++ b/shell/platform/darwin/macos/framework/Headers/FLEOpenGLContextHandling.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. + +#if defined(FLUTTER_FRAMEWORK) +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h" +#else +#import "FlutterMacros.h" +#endif + +/** + * Protocol for views owned by FLEViewController to handle context changes, specifically relating to + * OpenGL context changes. + */ +FLUTTER_EXPORT +@protocol FLEOpenGLContextHandling + +/** + * Sets the receiver as the current context object. + */ +- (void)makeCurrentContext; + +/** + * Called when the display is updated. In an NSOpenGLView this is best handled via a flushBuffer + * call. + */ +- (void)onPresent; + +@end diff --git a/shell/platform/darwin/macos/framework/Headers/FLEPlugin.h b/shell/platform/darwin/macos/framework/Headers/FLEPlugin.h new file mode 100644 index 0000000000000..830ac84b19451 --- /dev/null +++ b/shell/platform/darwin/macos/framework/Headers/FLEPlugin.h @@ -0,0 +1,52 @@ +// Copyright 2013 The Flutter 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 + +#if defined(FLUTTER_FRAMEWORK) +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h" +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h" +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h" +#else +#import "FlutterChannels.h" +#import "FlutterCodecs.h" +#import "FlutterMacros.h" +#endif + +@protocol FLEPluginRegistrar; + +/** + * Implemented by the platform side 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. + * + * Currently FLEPlugin has very limited functionality, but is expected to expand over time to + * more closely match the functionality of FlutterPlugin. + */ +FLUTTER_EXPORT +@protocol FLEPlugin + +/** + * Creates an instance of the plugin to register with |registrar| using the desired + * FLEPluginRegistrar methods. + */ ++ (void)registerWithRegistrar:(nonnull id)registrar; + +@optional + +/** + * Called when a message is sent from Flutter on a channel that a plugin instance has subscribed + * to via -[FLEPluginRegistrar addMethodCallDelegate:channel:]. + * + * The |result| callback must be called exactly once, with one of: + * - FlutterMethodNotImplemented, if the method call is unknown. + * - A FlutterError, if the method call was understood but there was a + * problem handling it. + * - Any other value (including nil) to indicate success. The value will + * be returned to the Flutter caller, and must be serializable to JSON. + */ +- (void)handleMethodCall:(nonnull FlutterMethodCall*)call result:(nonnull FlutterResult)result; + +@end diff --git a/shell/platform/darwin/macos/framework/Headers/FLEPluginRegistrar.h b/shell/platform/darwin/macos/framework/Headers/FLEPluginRegistrar.h new file mode 100644 index 0000000000000..b9f7ac99b2a2a --- /dev/null +++ b/shell/platform/darwin/macos/framework/Headers/FLEPluginRegistrar.h @@ -0,0 +1,48 @@ +// Copyright 2013 The Flutter 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 "FLEPlugin.h" + +#if defined(FLUTTER_FRAMEWORK) +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h" +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h" +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h" +#else +#import "FlutterBinaryMessenger.h" +#import "FlutterChannels.h" +#import "FlutterMacros.h" +#endif + +/** + * The protocol for an object managing registration for a plugin. It provides access to application + * context, as as allowing registering for callbacks for handling various conditions. + * + * Currently FLEPluginRegistrar has very limited functionality, but is expected to expand over time + * to more closely match the functionality of FlutterPluginRegistrar. + */ +FLUTTER_EXPORT +@protocol FLEPluginRegistrar + +/** + * The binary messenger used for creating channels to communicate with the Flutter engine. + */ +@property(nonnull, readonly) id messenger; + +/** + * The view displaying Flutter content. + * + * WARNING: If/when multiple Flutter views within the same application are supported (#98), this + * API will change. + */ +@property(nullable, readonly) NSView* view; + +/** + * Registers |delegate| to receive handleMethodCall:result: callbacks for the given |channel|. + */ +- (void)addMethodCallDelegate:(nonnull id)delegate + channel:(nonnull FlutterMethodChannel*)channel; + +@end diff --git a/shell/platform/darwin/macos/framework/Headers/FLEReshapeListener.h b/shell/platform/darwin/macos/framework/Headers/FLEReshapeListener.h new file mode 100644 index 0000000000000..db64cbea13044 --- /dev/null +++ b/shell/platform/darwin/macos/framework/Headers/FLEReshapeListener.h @@ -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. + +#import + +#if defined(FLUTTER_FRAMEWORK) +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h" +#else +#import "FlutterMacros.h" +#endif + +/** + * Protocol for listening to reshape events on this FlutterView. + * Used to notify the underlying Flutter engine of the new screen dimensions. + * Reflected from [NSOpenGLView.reshape]. + */ +FLUTTER_EXPORT +@protocol FLEReshapeListener + +- (void)viewDidReshape:(nonnull NSOpenGLView*)view; + +@end diff --git a/shell/platform/darwin/macos/framework/Headers/FLEView.h b/shell/platform/darwin/macos/framework/Headers/FLEView.h new file mode 100644 index 0000000000000..4ba69daad5897 --- /dev/null +++ b/shell/platform/darwin/macos/framework/Headers/FLEView.h @@ -0,0 +1,28 @@ +// Copyright 2013 The Flutter 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 "FLEOpenGLContextHandling.h" +#import "FLEReshapeListener.h" + +#if defined(FLUTTER_FRAMEWORK) +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h" +#else +#import "FlutterMacros.h" +#endif + +/** + * View capable of acting as a rendering target and input source for the Flutter + * engine. + */ +FLUTTER_EXPORT +@interface FLEView : NSOpenGLView + +/** + * Listener for reshape events. See protocol description. + */ +@property(nonatomic, weak, nullable) IBOutlet id reshapeListener; + +@end diff --git a/shell/platform/darwin/macos/framework/Headers/FLEViewController.h b/shell/platform/darwin/macos/framework/Headers/FLEViewController.h new file mode 100644 index 0000000000000..246ae2040a2aa --- /dev/null +++ b/shell/platform/darwin/macos/framework/Headers/FLEViewController.h @@ -0,0 +1,64 @@ +// Copyright 2013 The Flutter 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 "FLEOpenGLContextHandling.h" +#import "FLEPluginRegistrar.h" +#import "FLEReshapeListener.h" + +#if defined(FLUTTER_FRAMEWORK) +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h" +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h" +#else +#import "FlutterBinaryMessenger.h" +#import "FlutterMacros.h" +#endif + +/** + * Controls embedder plugins and communication with the underlying Flutter engine, managing a view + * intended to handle key inputs and drawing protocols (see |view|). + * + * Can be launched headless (no managed view), at which point a Dart executable will be run on the + * Flutter engine in non-interactive mode, or with a drawable Flutter canvas. + */ +FLUTTER_EXPORT +@interface FLEViewController + : NSViewController + +/** + * The view this controller manages when launched in interactive mode (headless set to false). Must + * be capable of handling text input events, and the OpenGL context handling protocols. + */ +@property(nullable) NSView* view; + +/** + * Launches the Flutter engine with the provided configuration. + * + * @param assets The path to the flutter_assets folder for the Flutter application to be run. + * @param arguments Arguments to pass to the Flutter engine. See + * https://github.com/flutter/engine/blob/master/shell/common/switches.h + * for details. Not all arguments will apply to embedding mode. + * Note: This API layer will likely abstract arguments in the future, instead of + * providing a direct passthrough. + * @return YES if the engine launched successfully. + */ +- (BOOL)launchEngineWithAssetsPath:(nonnull NSURL*)assets + commandLineArguments:(nullable NSArray*)arguments; + +/** + * Launches the Flutter engine in headless mode with the provided configuration. In headless mode, + * this controller's view should not be displayed. + * + * See launcheEngineWithAssetsPath:commandLineArguments: for details. + */ +- (BOOL)launchHeadlessEngineWithAssetsPath:(nonnull NSURL*)assets + commandLineArguments:(nullable NSArray*)arguments; + +/** + * Returns the FLEPluginRegistrar that should be used to register the plugin with the given name. + */ +- (nonnull id)registrarForPlugin:(nonnull NSString*)pluginName; + +@end diff --git a/shell/platform/darwin/macos/framework/Headers/Flutter.h b/shell/platform/darwin/macos/framework/Headers/Flutter.h new file mode 100644 index 0000000000000..55f949119e0b8 --- /dev/null +++ b/shell/platform/darwin/macos/framework/Headers/Flutter.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. + +#import "FLEOpenGLContextHandling.h" +#import "FLEPlugin.h" +#import "FLEPluginRegistrar.h" +#import "FLEReshapeListener.h" +#import "FLEView.h" +#import "FLEViewController.h" +#import "FlutterBinaryMessenger.h" +#import "FlutterChannels.h" +#import "FlutterCodecs.h" +#import "FlutterMacros.h" diff --git a/shell/platform/darwin/macos/framework/Info.plist b/shell/platform/darwin/macos/framework/Info.plist new file mode 100644 index 0000000000000..a4f200a190429 --- /dev/null +++ b/shell/platform/darwin/macos/framework/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + Flutter + CFBundleIdentifier + io.flutter.flutter + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Flutter + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + NSPrincipalClass + + + diff --git a/shell/platform/darwin/macos/framework/Source/FLETextInputModel.h b/shell/platform/darwin/macos/framework/Source/FLETextInputModel.h new file mode 100644 index 0000000000000..126d9e80f24c8 --- /dev/null +++ b/shell/platform/darwin/macos/framework/Source/FLETextInputModel.h @@ -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. + +#import + +/** + * The affinity of the current cursor position. If the cursor is at a position representing + * a line break, the cursor may be drawn either at the end of the current line (upstream) + * or at the beginning of the next (downstream). + */ +typedef NS_ENUM(NSUInteger, FLETextAffinity) { FLETextAffinityUpstream, FLETextAffinityDownstream }; + +/** + * Data model representing text input state during an editing session. + */ +@interface FLETextInputModel : NSObject + +/** + * The full text being edited. + */ +@property(nonnull, copy) NSMutableString* text; +/** + * The range of text currently selected. This may have length zero to represent a single + * cursor position. + */ +@property NSRange selectedRange; +/** + * The affinity for the current cursor position. + */ +@property FLETextAffinity textAffinity; +/** + * The range of text that is marked for edit, i.e. under the effects of a multi-keystroke input + * combination. + */ +@property NSRange markedRange; + +/** + * Representation of the model's data as a state dictionary suitable for interchange with the + * Flutter Dart layer. + */ +@property(nonnull) NSDictionary* state; + +/** + * ID of the text input client. + */ +@property(nonatomic, readonly, nonnull) NSNumber* clientID; + +/** + * Keyboard type of the client. See available options: + * https://docs.flutter.io/flutter/services/TextInputType-class.html + */ +@property(nonatomic, readonly, nonnull) NSString* inputType; + +/** + * An action requested by the user on the input client. See available options: + * https://docs.flutter.io/flutter/services/TextInputAction-class.html + */ +@property(nonatomic, readonly, nonnull) NSString* inputAction; + +- (nullable instancetype)init NS_UNAVAILABLE; + +/** + * Initializes a text input model with a [clientId] and [config] arguments. [config] arguments + * provide information on the text input connection. + */ +- (nullable instancetype)initWithClientID:(nonnull NSNumber*)clientID + configuration:(nonnull NSDictionary*)config; +@end diff --git a/shell/platform/darwin/macos/framework/Source/FLETextInputModel.mm b/shell/platform/darwin/macos/framework/Source/FLETextInputModel.mm new file mode 100644 index 0000000000000..79a5cda5e138f --- /dev/null +++ b/shell/platform/darwin/macos/framework/Source/FLETextInputModel.mm @@ -0,0 +1,123 @@ +// Copyright 2013 The Flutter 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/macos/framework/Source/FLETextInputModel.h" + +static NSString* const kTextAffinityDownstream = @"TextAffinity.downstream"; +static NSString* const kTextAffinityUpstream = @"TextAffinity.upstream"; + +static NSString* const kTextInputAction = @"inputAction"; +static NSString* const kTextInputType = @"inputType"; +static NSString* const kTextInputTypeName = @"name"; + +static NSString* const kSelectionBaseKey = @"selectionBase"; +static NSString* const kSelectionExtentKey = @"selectionExtent"; +static NSString* const kSelectionAffinityKey = @"selectionAffinity"; +static NSString* const kSelectionIsDirectionalKey = @"selectionIsDirectional"; +static NSString* const kComposingBaseKey = @"composingBase"; +static NSString* const kComposingExtentKey = @"composingExtent"; +static NSString* const kTextKey = @"text"; + +/** + * These three static methods are necessary because Cocoa and Flutter have different idioms for + * signalling an empty range: Flutter uses {-1, -1} while Cocoa uses {NSNotFound, 0}. Also, + * despite the name, the "extent" fields are actually end indices, not lengths. + */ + +/** + * Updates a range given base and extent fields. + */ +static NSRange UpdateRangeFromBaseExtent(NSNumber* base, NSNumber* extent, NSRange range) { + if (base == nil || extent == nil) { + return range; + } + if (base.intValue == -1 && extent.intValue == -1) { + range.location = NSNotFound; + range.length = 0; + } else { + range.location = [base unsignedLongValue]; + range.length = [extent unsignedLongValue] - range.location; + } + return range; +} + +/** + * Returns the appropriate base field for a given range. + */ +static long GetBaseForRange(NSRange range) { + if (range.location == NSNotFound) { + return -1; + } + return range.location; +} + +/** + * Returns the appropriate extent field for a given range. + */ +static long GetExtentForRange(NSRange range) { + if (range.location == NSNotFound) { + return -1; + } + return range.location + range.length; +} + +@implementation FLETextInputModel + +- (instancetype)initWithClientID:(NSNumber*)clientID configuration:(NSDictionary*)config { + self = [super init]; + if (self != nil) { + _clientID = clientID; + _inputAction = config[kTextInputAction]; + // There's more information that can be used from this dictionary. + // Add more as needed. + NSDictionary* inputTypeInfo = config[kTextInputType]; + _inputType = inputTypeInfo[kTextInputTypeName]; + if (!_clientID || !_inputAction || !_inputType) { + NSLog(@"Missing arguments for %@ init.", [self class]); + return nil; + } + + _text = [[NSMutableString alloc] init]; + _selectedRange = NSMakeRange(NSNotFound, 0); + _markedRange = NSMakeRange(NSNotFound, 0); + _textAffinity = FLETextAffinityUpstream; + } + return self; +} + +- (NSDictionary*)state { + NSString* const textAffinity = + (_textAffinity == FLETextAffinityUpstream) ? kTextAffinityUpstream : kTextAffinityDownstream; + NSDictionary* state = @{ + kSelectionBaseKey : @(GetBaseForRange(_selectedRange)), + kSelectionExtentKey : @(GetExtentForRange(_selectedRange)), + kSelectionAffinityKey : textAffinity, + kSelectionIsDirectionalKey : @NO, + kComposingBaseKey : @(GetBaseForRange(_markedRange)), + kComposingExtentKey : @(GetExtentForRange(_markedRange)), + kTextKey : _text + }; + return state; +} + +- (void)setState:(NSDictionary*)state { + if (state == nil) + return; + + _selectedRange = UpdateRangeFromBaseExtent(state[kSelectionBaseKey], state[kSelectionExtentKey], + _selectedRange); + NSString* selectionAffinity = state[kSelectionAffinityKey]; + if (selectionAffinity != nil) { + _textAffinity = [selectionAffinity isEqualToString:kTextAffinityUpstream] + ? FLETextAffinityUpstream + : FLETextAffinityDownstream; + } + _markedRange = + UpdateRangeFromBaseExtent(state[kComposingBaseKey], state[kComposingExtentKey], _markedRange); + NSString* text = state[kTextKey]; + if (text != nil) + [_text setString:text]; +} + +@end diff --git a/shell/platform/darwin/macos/framework/Source/FLETextInputPlugin.h b/shell/platform/darwin/macos/framework/Source/FLETextInputPlugin.h new file mode 100644 index 0000000000000..c4e1a33af37f4 --- /dev/null +++ b/shell/platform/darwin/macos/framework/Source/FLETextInputPlugin.h @@ -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. + +#import + +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h" +#import "flutter/shell/platform/darwin/macos/framework/Headers/FLEViewController.h" + +/** + * A plugin to handle text input. + * + * Responsible for bridging the native macOS text input system with the Flutter framework text + * editing classes, via system channels. + * + * This is not an FLEPlugin since it needs access to FLEViewController internals, so needs to be + * managed differently. + */ +@interface FLETextInputPlugin : NSResponder + +/** + * Initializes a text input plugin that coordinates key event handling with |viewController|. + */ +- (instancetype)initWithViewController:(FLEViewController*)viewController; + +@end diff --git a/shell/platform/darwin/macos/framework/Source/FLETextInputPlugin.mm b/shell/platform/darwin/macos/framework/Source/FLETextInputPlugin.mm new file mode 100644 index 0000000000000..25079d565c07f --- /dev/null +++ b/shell/platform/darwin/macos/framework/Source/FLETextInputPlugin.mm @@ -0,0 +1,309 @@ +// Copyright 2013 The Flutter 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/macos/framework/Source/FLETextInputPlugin.h" + +#import + +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h" +#import "flutter/shell/platform/darwin/macos/framework/Source/FLETextInputModel.h" +#import "flutter/shell/platform/darwin/macos/framework/Source/FLEViewController_Internal.h" + +static NSString* const kTextInputChannel = @"flutter/textinput"; + +// See https://docs.flutter.io/flutter/services/SystemChannels/textInput-constant.html +static NSString* const kSetClientMethod = @"TextInput.setClient"; +static NSString* const kShowMethod = @"TextInput.show"; +static NSString* const kHideMethod = @"TextInput.hide"; +static NSString* const kClearClientMethod = @"TextInput.clearClient"; +static NSString* const kSetEditingStateMethod = @"TextInput.setEditingState"; +static NSString* const kUpdateEditStateResponseMethod = @"TextInputClient.updateEditingState"; +static NSString* const kPerformAction = @"TextInputClient.performAction"; +static NSString* const kMultilineInputType = @"TextInputType.multiline"; + +/** + * Private properties of FlutterTextInputPlugin. + */ +@interface FLETextInputPlugin () + +/** + * A text input context, representing a connection to the Cocoa text input system. + */ +@property(nonatomic) NSTextInputContext* textInputContext; + +/** + * A dictionary of text input models, one per client connection, keyed + * by the client connection ID. + */ +@property(nonatomic) NSMutableDictionary* textInputModels; + +/** + * The currently active client connection ID. + */ +@property(nonatomic, nullable) NSNumber* activeClientID; + +/** + * The currently active text input model. + */ +@property(nonatomic, readonly, nullable) FLETextInputModel* activeModel; + +/** + * The channel used to communicate with Flutter. + */ +@property(nonatomic) FlutterMethodChannel* channel; + +/** + * The FLEViewController to manage input for. + */ +@property(nonatomic, weak) FLEViewController* flutterViewController; + +/** + * Handles a Flutter system message on the text input channel. + */ +- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result; + +@end + +@implementation FLETextInputPlugin + +- (instancetype)initWithViewController:(FLEViewController*)viewController { + self = [super init]; + if (self != nil) { + _flutterViewController = viewController; + _channel = [FlutterMethodChannel methodChannelWithName:kTextInputChannel + binaryMessenger:viewController + codec:[FlutterJSONMethodCodec sharedInstance]]; + __weak FLETextInputPlugin* weakSelf = self; + [_channel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { + [weakSelf handleMethodCall:call result:result]; + }]; + _textInputModels = [[NSMutableDictionary alloc] init]; + _textInputContext = [[NSTextInputContext alloc] initWithClient:self]; + } + return self; +} + +#pragma mark - Private + +- (FLETextInputModel*)activeModel { + return (_activeClientID == nil) ? nil : _textInputModels[_activeClientID]; +} + +- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { + BOOL handled = YES; + NSString* method = call.method; + if ([method isEqualToString:kSetClientMethod]) { + if (!call.arguments[0] || !call.arguments[1]) { + result([FlutterError + errorWithCode:@"error" + message:@"Missing arguments" + details:@"Missing arguments while trying to set a text input client"]); + return; + } + NSNumber* clientID = call.arguments[0]; + if (clientID != nil && + (_activeClientID == nil || ![_activeClientID isEqualToNumber:clientID])) { + _activeClientID = clientID; + // TODO: Do we need to preserve state across setClient calls? + FLETextInputModel* inputModel = + [[FLETextInputModel alloc] initWithClientID:clientID configuration:call.arguments[1]]; + if (!inputModel) { + result([FlutterError errorWithCode:@"error" + message:@"Failed to create an input model" + details:@"Configuration arguments might be missing"]); + return; + } + _textInputModels[_activeClientID] = inputModel; + } + } else if ([method isEqualToString:kShowMethod]) { + [self.flutterViewController addKeyResponder:self]; + [_textInputContext activate]; + } else if ([method isEqualToString:kHideMethod]) { + [self.flutterViewController removeKeyResponder:self]; + [_textInputContext deactivate]; + } else if ([method isEqualToString:kClearClientMethod]) { + _activeClientID = nil; + } else if ([method isEqualToString:kSetEditingStateMethod]) { + NSDictionary* state = call.arguments; + self.activeModel.state = state; + } else { + handled = NO; + NSLog(@"Unhandled text input method '%@'", method); + } + result(handled ? nil : FlutterMethodNotImplemented); +} + +/** + * Informs the Flutter framework of changes to the text input model's state. + */ +- (void)updateEditState { + if (self.activeModel == nil) { + return; + } + + [_channel invokeMethod:kUpdateEditStateResponseMethod + arguments:@[ _activeClientID, _textInputModels[_activeClientID].state ]]; +} + +#pragma mark - +#pragma mark NSResponder + +/** + * Note, the Apple docs suggest that clients should override essentially all the + * mouse and keyboard event-handling methods of NSResponder. However, experimentation + * indicates that only key events are processed by the native layer; Flutter processes + * mouse events. Additionally, processing both keyUp and keyDown results in duplicate + * processing of the same keys. So for now, limit processing to just keyDown. + */ +- (void)keyDown:(NSEvent*)event { + [_textInputContext handleEvent:event]; +} + +#pragma mark - +#pragma mark NSStandardKeyBindingMethods + +/** + * Note, experimentation indicates that moveRight and moveLeft are called rather + * than the supposedly more RTL-friendly moveForward and moveBackward. + */ +- (void)moveLeft:(nullable id)sender { + NSRange selection = self.activeModel.selectedRange; + if (selection.length == 0) { + if (selection.location > 0) { + // Move to previous location + self.activeModel.selectedRange = NSMakeRange(selection.location - 1, 0); + [self updateEditState]; + } + } else { + // Collapse current selection + self.activeModel.selectedRange = NSMakeRange(selection.location, 0); + [self updateEditState]; + } +} + +- (void)moveRight:(nullable id)sender { + NSRange selection = self.activeModel.selectedRange; + if (selection.length == 0) { + if (selection.location < self.activeModel.text.length) { + // Move to next location + self.activeModel.selectedRange = NSMakeRange(selection.location + 1, 0); + [self updateEditState]; + } + } else { + // Collapse current selection + self.activeModel.selectedRange = NSMakeRange(selection.location + selection.length, 0); + [self updateEditState]; + } +} + +- (void)deleteBackward:(id)sender { + NSRange selection = self.activeModel.selectedRange; + if (selection.location == 0) + return; + NSRange range = selection; + if (selection.length == 0) { + NSUInteger location = (selection.location == NSNotFound) ? self.activeModel.text.length - 1 + : selection.location - 1; + range = NSMakeRange(location, 1); + } + self.activeModel.selectedRange = NSMakeRange(range.location, 0); + [self insertText:@"" replacementRange:range]; // Updates edit state +} + +#pragma mark - +#pragma mark NSTextInputClient + +- (void)insertText:(id)string replacementRange:(NSRange)range { + if (self.activeModel != nil) { + if (range.location == NSNotFound && range.length == 0) { + // Use selection + range = self.activeModel.selectedRange; + } + if (range.location > self.activeModel.text.length) + range.location = self.activeModel.text.length; + if (range.length > (self.activeModel.text.length - range.location)) + range.length = self.activeModel.text.length - range.location; + [self.activeModel.text replaceCharactersInRange:range withString:string]; + self.activeModel.selectedRange = NSMakeRange(range.location + ((NSString*)string).length, 0); + [self updateEditState]; + } +} + +- (void)doCommandBySelector:(SEL)selector { + if ([self respondsToSelector:selector]) { + // Note: The more obvious [self performSelector...] doesn't give ARC enough information to + // handle retain semantics properly. See https://stackoverflow.com/questions/7017281/ for more + // information. + IMP imp = [self methodForSelector:selector]; + void (*func)(id, SEL, id) = reinterpret_cast(imp); + func(self, selector, nil); + } +} + +- (void)insertNewline:(id)sender { + if ([self.activeModel.inputType isEqualToString:kMultilineInputType]) { + [self insertText:@"\n" replacementRange:self.activeModel.selectedRange]; + } + [_channel invokeMethod:kPerformAction + arguments:@[ _activeClientID, self.activeModel.inputAction ]]; +} + +- (void)setMarkedText:(id)string + selectedRange:(NSRange)selectedRange + replacementRange:(NSRange)replacementRange { + if (self.activeModel != nil) { + [self.activeModel.text replaceCharactersInRange:replacementRange withString:string]; + self.activeModel.selectedRange = selectedRange; + [self updateEditState]; + } +} + +- (void)unmarkText { + if (self.activeModel != nil) { + self.activeModel.markedRange = NSMakeRange(NSNotFound, 0); + [self updateEditState]; + } +} + +- (NSRange)selectedRange { + return (self.activeModel == nil) ? NSMakeRange(NSNotFound, 0) : self.activeModel.selectedRange; +} + +- (NSRange)markedRange { + return (self.activeModel == nil) ? NSMakeRange(NSNotFound, 0) : self.activeModel.markedRange; +} + +- (BOOL)hasMarkedText { + return (self.activeModel == nil) ? NO : self.activeModel.markedRange.location != NSNotFound; +} + +- (NSAttributedString*)attributedSubstringForProposedRange:(NSRange)range + actualRange:(NSRangePointer)actualRange { + if (self.activeModel) { + if (actualRange != nil) + *actualRange = range; + NSString* substring = [self.activeModel.text substringWithRange:range]; + return [[NSAttributedString alloc] initWithString:substring attributes:nil]; + } else { + return nil; + } +} + +- (NSArray*)validAttributesForMarkedText { + return @[]; +} + +- (NSRect)firstRectForCharacterRange:(NSRange)range actualRange:(NSRangePointer)actualRange { + // TODO: Implement. + // Note: This function can't easily be implemented under the system-message architecture. + return CGRectZero; +} + +- (NSUInteger)characterIndexForPoint:(NSPoint)point { + // TODO: Implement. + // Note: This function can't easily be implemented under the system-message architecture. + return 0; +} + +@end diff --git a/shell/platform/darwin/macos/framework/Source/FLEView.mm b/shell/platform/darwin/macos/framework/Source/FLEView.mm new file mode 100644 index 0000000000000..5ce7ddb8ffc78 --- /dev/null +++ b/shell/platform/darwin/macos/framework/Source/FLEView.mm @@ -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. + +#import "flutter/shell/platform/darwin/macos/framework/Headers/FLEView.h" + +@implementation FLEView + +#pragma mark - +#pragma mark FLEContextHandlingProtocol + +- (void)makeCurrentContext { + [self.openGLContext makeCurrentContext]; +} + +- (void)onPresent { + [self.openGLContext flushBuffer]; +} + +#pragma mark - +#pragma mark Implementation + +/** + * Declares that the view uses a flipped coordinate system, consistent with Flutter conventions. + */ +- (BOOL)isFlipped { + return YES; +} + +- (BOOL)isOpaque { + return YES; +} + +- (void)reshape { + [_reshapeListener viewDidReshape:self]; +} + +- (BOOL)acceptsFirstResponder { + return YES; +} + +@end diff --git a/shell/platform/darwin/macos/framework/Source/FLEViewController.mm b/shell/platform/darwin/macos/framework/Source/FLEViewController.mm new file mode 100644 index 0000000000000..faf982dff1a9f --- /dev/null +++ b/shell/platform/darwin/macos/framework/Source/FLEViewController.mm @@ -0,0 +1,474 @@ +// Copyright 2013 The Flutter 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/macos/framework/Headers/FLEViewController.h" +#import "flutter/shell/platform/darwin/macos/framework/Source/FLEViewController_Internal.h" + +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h" +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h" +#import "flutter/shell/platform/darwin/macos/framework/Headers/FLEReshapeListener.h" +#import "flutter/shell/platform/darwin/macos/framework/Headers/FLEView.h" +#import "flutter/shell/platform/darwin/macos/framework/Source/FLETextInputPlugin.h" +#import "flutter/shell/platform/embedder/embedder.h" + +static NSString* const kICUBundlePath = @"icudtl.dat"; + +static const int kDefaultWindowFramebuffer = 0; + +// Android KeyEvent constants from https://developer.android.com/reference/android/view/KeyEvent +static const int kAndroidMetaStateShift = 1 << 0; +static const int kAndroidMetaStateAlt = 1 << 1; +static const int kAndroidMetaStateCtrl = 1 << 12; +static const int kAndroidMetaStateMeta = 1 << 16; + +#pragma mark - Private interface declaration. + +/** + * Private interface declaration for FLEViewController. + */ +@interface FLEViewController () + +/** + * A list of additional responders to keyboard events. Keybord events are forwarded to all of them. + */ +@property NSMutableOrderedSet* additionalKeyResponders; + +/** + * Creates and registers plugins used by this view controller. + */ +- (void)addInternalPlugins; + +/** + * Shared implementation of the regular and headless public APIs. + */ +- (BOOL)launchEngineInternalWithAssetsPath:(nonnull NSURL*)assets + headless:(BOOL)headless + commandLineArguments:(nullable NSArray*)arguments; + +/** + * Creates a render config with callbacks based on whether the embedder is being run as a headless + * server. + */ ++ (FlutterRendererConfig)createRenderConfigHeadless:(BOOL)headless; + +/** + * Creates the OpenGL context used as the resource context by the engine. + */ +- (void)createResourceContext; + +/** + * Makes the OpenGL context used by the engine for rendering optimization the + * current context. + */ +- (void)makeResourceContextCurrent; + +/** + * Responds to system messages sent to this controller from the Flutter engine. + */ +- (void)handlePlatformMessage:(const FlutterPlatformMessage*)message; + +/** + * Converts |event| to a FlutterPointerEvent with the given phase, and sends it to the engine. + */ +- (void)dispatchMouseEvent:(nonnull NSEvent*)event phase:(FlutterPointerPhase)phase; + +/** + * Converts |event| to a key event channel message, and sends it to the engine. + */ +- (void)dispatchKeyEvent:(NSEvent*)event ofType:(NSString*)type; + +@end + +#pragma mark - Static methods provided to engine configuration + +/** + * Makes the owned FlutterView the current context. + */ +static bool OnMakeCurrent(FLEViewController* controller) { + [controller.view makeCurrentContext]; + return true; +} + +/** + * Clears the current context. + */ +static bool OnClearCurrent(FLEViewController* controller) { + [NSOpenGLContext clearCurrentContext]; + return true; +} + +/** + * Flushes the GL context as part of the Flutter rendering pipeline. + */ +static bool OnPresent(FLEViewController* controller) { + [controller.view onPresent]; + return true; +} + +/** + * Returns the framebuffer object whose color attachment the engine should render into. + */ +static uint32_t OnFBO(FLEViewController* controller) { + return kDefaultWindowFramebuffer; +} + +/** + * Handles the given platform message by dispatching to the controller. + */ +static void OnPlatformMessage(const FlutterPlatformMessage* message, + FLEViewController* controller) { + [controller handlePlatformMessage:message]; +} + +/** + * Makes the resource context the current context. + */ +static bool OnMakeResourceCurrent(FLEViewController* controller) { + [controller makeResourceContextCurrent]; + return true; +} + +#pragma mark Static methods provided for headless engine configuration + +static bool HeadlessOnMakeCurrent(FLEViewController* controller) { + return false; +} + +static bool HeadlessOnClearCurrent(FLEViewController* controller) { + return false; +} + +static bool HeadlessOnPresent(FLEViewController* controller) { + return false; +} + +static uint32_t HeadlessOnFBO(FLEViewController* controller) { + return kDefaultWindowFramebuffer; +} + +static bool HeadlessOnMakeResourceCurrent(FLEViewController* controller) { + return false; +} + +#pragma mark - FLEViewController implementation. + +@implementation FLEViewController { + FlutterEngine _engine; + + // The additional context provided to the Flutter engine for resource loading. + NSOpenGLContext* _resourceContext; + + // A mapping of channel names to the registered handlers for those channels. + NSMutableDictionary* _messageHandlers; + + // The plugin used to handle text input. This is not an FLEPlugin, so must be owned separately. + FLETextInputPlugin* _textInputPlugin; + + // A message channel for passing key events to the Flutter engine. This should be replaced with + // an embedding API; see Issue #47. + FlutterBasicMessageChannel* _keyEventChannel; +} + +@dynamic view; + +/** + * Performs initialization that's common between the different init paths. + */ +static void CommonInit(FLEViewController* controller) { + controller->_messageHandlers = [[NSMutableDictionary alloc] init]; + controller->_additionalKeyResponders = [[NSMutableOrderedSet alloc] init]; +} + +- (instancetype)initWithCoder:(NSCoder*)coder { + self = [super initWithCoder:coder]; + if (self != nil) { + CommonInit(self); + } + return self; +} + +- (instancetype)initWithNibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil { + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self != nil) { + CommonInit(self); + } + return self; +} + +- (void)dealloc { + if (FlutterEngineShutdown(_engine) == kSuccess) { + _engine = NULL; + } +} + +- (void)loadView { + self.view = [[FLEView alloc] init]; +} + +#pragma mark - Public methods + +- (BOOL)launchEngineWithAssetsPath:(NSURL*)assets + commandLineArguments:(NSArray*)arguments { + return [self launchEngineInternalWithAssetsPath:assets + headless:NO + commandLineArguments:arguments]; +} + +- (BOOL)launchHeadlessEngineWithAssetsPath:(NSURL*)assets + commandLineArguments:(NSArray*)arguments { + return [self launchEngineInternalWithAssetsPath:assets + headless:YES + commandLineArguments:arguments]; +} + +- (id)registrarForPlugin:(NSString*)pluginName { + // Currently, the view controller acts as the registrar for all plugins, so the + // name is ignored. It is part of the API to reduce churn in the future when + // aligning more closely with the Flutter registrar system. + return self; +} + +#pragma mark - Framework-internal methods + +- (void)addKeyResponder:(NSResponder*)responder { + [self.additionalKeyResponders addObject:responder]; +} + +- (void)removeKeyResponder:(NSResponder*)responder { + [self.additionalKeyResponders removeObject:responder]; +} + +#pragma mark - Private methods + +- (void)addInternalPlugins { + _textInputPlugin = [[FLETextInputPlugin alloc] initWithViewController:self]; + _keyEventChannel = + [FlutterBasicMessageChannel messageChannelWithName:@"flutter/keyevent" + binaryMessenger:self + codec:[FlutterJSONMessageCodec sharedInstance]]; +} + +- (BOOL)launchEngineInternalWithAssetsPath:(NSURL*)assets + headless:(BOOL)headless + commandLineArguments:(NSArray*)arguments { + if (_engine != NULL) { + return NO; + } + + // Set up the resource context. This is done here rather than in viewDidLoad as there's no + // guarantee that viewDidLoad will be called before the engine is started, and the context must + // be valid by that point. + [self createResourceContext]; + + const FlutterRendererConfig config = [FLEViewController createRenderConfigHeadless:headless]; + + // Register internal plugins before starting the engine. + [self addInternalPlugins]; + + // FlutterProjectArgs is expecting a full argv, so when processing it for flags the first + // item is treated as the executable and ignored. Add a dummy value so that all provided arguments + // are used. + const unsigned long argc = arguments.count + 1; + const char** argv = (const char**)malloc(argc * sizeof(const char*)); + argv[0] = "placeholder"; + for (NSUInteger i = 0; i < arguments.count; ++i) { + argv[i + 1] = [arguments[i] UTF8String]; + } + + NSString* icuData = [[NSBundle bundleForClass:[self class]] pathForResource:kICUBundlePath + ofType:nil]; + + FlutterProjectArgs flutterArguments = {}; + flutterArguments.struct_size = sizeof(FlutterProjectArgs); + flutterArguments.assets_path = assets.fileSystemRepresentation; + flutterArguments.icu_data_path = icuData.UTF8String; + flutterArguments.command_line_argc = (int)(argc); + flutterArguments.command_line_argv = argv; + flutterArguments.platform_message_callback = (FlutterPlatformMessageCallback)OnPlatformMessage; + + FlutterEngineResult result = FlutterEngineRun(FLUTTER_ENGINE_VERSION, &config, &flutterArguments, + (__bridge void*)(self), &_engine); + free(argv); + if (result != kSuccess) { + NSLog(@"Failed to start Flutter engine: error %d", result); + return NO; + } + return YES; +} + ++ (FlutterRendererConfig)createRenderConfigHeadless:(BOOL)headless { + if (headless) { + const FlutterRendererConfig config = { + .type = kOpenGL, + .open_gl.struct_size = sizeof(FlutterOpenGLRendererConfig), + .open_gl.make_current = (BoolCallback)HeadlessOnMakeCurrent, + .open_gl.clear_current = (BoolCallback)HeadlessOnClearCurrent, + .open_gl.present = (BoolCallback)HeadlessOnPresent, + .open_gl.fbo_callback = (UIntCallback)HeadlessOnFBO, + .open_gl.make_resource_current = (BoolCallback)HeadlessOnMakeResourceCurrent}; + return config; + } else { + const FlutterRendererConfig config = { + .type = kOpenGL, + .open_gl.struct_size = sizeof(FlutterOpenGLRendererConfig), + .open_gl.make_current = (BoolCallback)OnMakeCurrent, + .open_gl.clear_current = (BoolCallback)OnClearCurrent, + .open_gl.present = (BoolCallback)OnPresent, + .open_gl.fbo_callback = (UIntCallback)OnFBO, + .open_gl.make_resource_current = (BoolCallback)OnMakeResourceCurrent}; + return config; + } +} + +- (void)createResourceContext { + NSOpenGLContext* viewContext = ((NSOpenGLView*)self.view).openGLContext; + _resourceContext = [[NSOpenGLContext alloc] initWithFormat:viewContext.pixelFormat + shareContext:viewContext]; +} + +- (void)makeResourceContextCurrent { + [_resourceContext makeCurrentContext]; +} + +- (void)handlePlatformMessage:(const FlutterPlatformMessage*)message { + NSData* messageData = [NSData dataWithBytesNoCopy:(void*)message->message + length:message->message_size + freeWhenDone:NO]; + NSString* channel = @(message->channel); + __block const FlutterPlatformMessageResponseHandle* responseHandle = message->response_handle; + + FlutterBinaryReply binaryResponseHandler = ^(NSData* response) { + if (responseHandle) { + FlutterEngineSendPlatformMessageResponse(self->_engine, responseHandle, + static_cast(response.bytes), + response.length); + responseHandle = NULL; + } else { + NSLog(@"Error: Message responses can be sent only once. Ignoring duplicate response " + "on channel '%@'.", + channel); + } + }; + + FlutterBinaryMessageHandler channelHandler = _messageHandlers[channel]; + if (channelHandler) { + channelHandler(messageData, binaryResponseHandler); + } else { + binaryResponseHandler(nil); + } +} + +- (void)dispatchMouseEvent:(NSEvent*)event phase:(FlutterPointerPhase)phase { + NSPoint locationInView = [self.view convertPoint:event.locationInWindow fromView:nil]; + NSPoint locationInBackingCoordinates = [self.view convertPointToBacking:locationInView]; + const FlutterPointerEvent flutterEvent = { + .struct_size = sizeof(flutterEvent), + .phase = phase, + .x = locationInBackingCoordinates.x, + .y = -locationInBackingCoordinates.y, // convertPointToBacking makes this negative. + .timestamp = static_cast(event.timestamp * NSEC_PER_MSEC), + }; + FlutterEngineSendPointerEvent(_engine, &flutterEvent, 1); +} + +- (void)dispatchKeyEvent:(NSEvent*)event ofType:(NSString*)type { + [_keyEventChannel sendMessage:@{ + @"keymap" : @"android", + @"type" : type, + @"keyCode" : @(event.keyCode), + @"metaState" : + @(((event.modifierFlags & NSEventModifierFlagShift) ? kAndroidMetaStateShift : 0) | + ((event.modifierFlags & NSEventModifierFlagOption) ? kAndroidMetaStateAlt : 0) | + ((event.modifierFlags & NSEventModifierFlagControl) ? kAndroidMetaStateCtrl : 0) | + ((event.modifierFlags & NSEventModifierFlagCommand) ? kAndroidMetaStateMeta : 0)) + }]; +} + +#pragma mark - FLEReshapeListener + +/** + * Responds to view reshape by notifying the engine of the change in dimensions. + */ +- (void)viewDidReshape:(NSOpenGLView*)view { + CGRect scaledBounds = [view convertRectToBacking:view.bounds]; + const FlutterWindowMetricsEvent event = { + .struct_size = sizeof(event), + .width = static_cast(scaledBounds.size.width), + .height = static_cast(scaledBounds.size.height), + .pixel_ratio = scaledBounds.size.width / view.bounds.size.width, + }; + FlutterEngineSendWindowMetricsEvent(_engine, &event); +} + +#pragma mark - FlutterBinaryMessenger + +- (void)sendOnChannel:(nonnull NSString*)channel message:(nullable NSData*)message { + FlutterPlatformMessage platformMessage = { + .struct_size = sizeof(FlutterPlatformMessage), + .channel = [channel UTF8String], + .message = static_cast(message.bytes), + .message_size = message.length, + }; + + FlutterEngineResult result = FlutterEngineSendPlatformMessage(_engine, &platformMessage); + if (result != kSuccess) { + NSLog(@"Failed to send message to Flutter engine on channel '%@' (%d).", channel, result); + } +} + +- (void)setMessageHandlerOnChannel:(nonnull NSString*)channel + binaryMessageHandler:(nullable FlutterBinaryMessageHandler)handler { + _messageHandlers[channel] = [handler copy]; +} + +#pragma mark - FLEPluginRegistrar + +- (id)messenger { + return self; +} + +- (void)addMethodCallDelegate:(nonnull id)delegate + channel:(nonnull FlutterMethodChannel*)channel { + [channel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { + [delegate handleMethodCall:call result:result]; + }]; +} + +#pragma mark - NSResponder + +- (BOOL)acceptsFirstResponder { + return YES; +} + +- (void)keyDown:(NSEvent*)event { + [self dispatchKeyEvent:event ofType:@"keydown"]; + for (NSResponder* responder in self.additionalKeyResponders) { + if ([responder respondsToSelector:@selector(keyDown:)]) { + [responder keyDown:event]; + } + } +} + +- (void)keyUp:(NSEvent*)event { + [self dispatchKeyEvent:event ofType:@"keyup"]; + for (NSResponder* responder in self.additionalKeyResponders) { + if ([responder respondsToSelector:@selector(keyUp:)]) { + [responder keyUp:event]; + } + } +} + +- (void)mouseDown:(NSEvent*)event { + [self dispatchMouseEvent:event phase:kDown]; +} + +- (void)mouseUp:(NSEvent*)event { + [self dispatchMouseEvent:event phase:kUp]; +} + +- (void)mouseDragged:(NSEvent*)event { + [self dispatchMouseEvent:event phase:kMove]; +} + +@end diff --git a/shell/platform/darwin/macos/framework/Source/FLEViewController_Internal.h b/shell/platform/darwin/macos/framework/Source/FLEViewController_Internal.h new file mode 100644 index 0000000000000..8fd3fb26519c8 --- /dev/null +++ b/shell/platform/darwin/macos/framework/Source/FLEViewController_Internal.h @@ -0,0 +1,20 @@ +// Copyright 2013 The Flutter 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/macos/framework/Headers/FLEViewController.h" + +@interface FLEViewController () + +/** + * Adds a responder for keyboard events. Key up and key down events are forwarded to all added + * responders. + */ +- (void)addKeyResponder:(nonnull NSResponder*)responder; + +/** + * Removes a responder for keyboard events. + */ +- (void)removeKeyResponder:(nonnull NSResponder*)responder; + +@end diff --git a/shell/platform/darwin/macos/framework/module.modulemap b/shell/platform/darwin/macos/framework/module.modulemap new file mode 100644 index 0000000000000..bf81c8a86519f --- /dev/null +++ b/shell/platform/darwin/macos/framework/module.modulemap @@ -0,0 +1,6 @@ +framework module Flutter { + umbrella header "Flutter.h" + + export * + module * { export * } +} From 5dcf3cfd2f5904b29283fa36f84e206f91f87b4e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 31 Jan 2019 17:24:14 -0500 Subject: [PATCH 0013/1117] Roll src/third_party/skia 5b257abb87d2..88bfed46ab6e (8 commits) (#7657) https://skia.googlesource.com/skia.git/%2Blog/5b257abb87d2..88bfed46ab6e git log 5b257abb87d2085b7f36fd5bc8f4a78a73942b2a..88bfed46ab6e0e4aec5416092a349e394c72ba59 --date=short --no-merges --format=%ad %ae %s 2019-01-31 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 794364ebd51c..258398020826 (1 commits) 2019-01-31 egdaniel@google.com Fix type in Andoird string. 2019-01-31 reed@google.com fix tiler to handle large float rects 2019-01-31 brianosman@google.com Update tracing docs slightly 2019-01-31 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms cd2260c9f528..0c0f6dee2779 (1 commits) 2019-01-31 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 5ebd2c0fafca..ebe5f7fad064 (1 commits) 2019-01-31 rmistry@google.com [cq.cfg] Remove cq.cfg. 2019-01-31 kjlubick@google.com Make cmake copy_directory instead of just files The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index abd3960432f25..26e399c2937f1 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': '5b257abb87d2085b7f36fd5bc8f4a78a73942b2a', + 'skia_revision': '88bfed46ab6e0e4aec5416092a349e394c72ba59', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 901656fd7752b..ed7f523b60c68 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 922dfed5a65815e76f694eaba4265b33 +Signature: ac98185e7cc03c1dfdfe89363247082c UNUSED LICENSES: @@ -2541,7 +2541,6 @@ FILE: ../../../third_party/skia/infra/bots/test_skia_bundled.isolate FILE: ../../../third_party/skia/infra/bots/tools/luci-go/linux64/isolate.sha1 FILE: ../../../third_party/skia/infra/bots/tools/luci-go/mac64/isolate.sha1 FILE: ../../../third_party/skia/infra/bots/tools/luci-go/win64/isolate.exe.sha1 -FILE: ../../../third_party/skia/infra/branch-config/cq.cfg FILE: ../../../third_party/skia/infra/config/recipes.cfg FILE: ../../../third_party/skia/infra/cts/whitelist_devices.json FILE: ../../../third_party/skia/infra/lottiecap/docker/gold-lottie-web-puppeteer/Dockerfile From fac24d938ad9c73035c3b28367b89ba8a4d361b2 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 31 Jan 2019 20:56:02 -0500 Subject: [PATCH 0014/1117] Roll src/third_party/skia 88bfed46ab6e..95b014790f93 (3 commits) (#7661) https://skia.googlesource.com/skia.git/%2Blog/88bfed46ab6e..95b014790f93 git log 88bfed46ab6e0e4aec5416092a349e394c72ba59..95b014790f93856d66da760d7a68ccc2e448a5f7 --date=short --no-merges --format=%ad %ae %s 2019-01-31 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-01-31 reed@google.com remove (dead) legacy measuretext 2019-01-31 kjlubick@google.com Add CMake bot The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 26e399c2937f1..baa88a95cb3c7 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': '88bfed46ab6e0e4aec5416092a349e394c72ba59', + 'skia_revision': '95b014790f93856d66da760d7a68ccc2e448a5f7', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index ed7f523b60c68..2492c430d5f47 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ac98185e7cc03c1dfdfe89363247082c +Signature: aecb9267437d920910219a31d2528626 UNUSED LICENSES: @@ -2171,6 +2171,7 @@ FILE: ../../../third_party/skia/animations/redcross#1.jpg 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/cmake-release/Dockerfile 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 @@ -2316,6 +2317,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-Debian9-Clang-x86_64-Debug-SafeStack.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Debug-Tidy.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-CMake.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-NoDEPS.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Release-Static.json From 4889c743c5f063f3767ca64bf7964841205c9409 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 1 Feb 2019 00:27:13 -0500 Subject: [PATCH 0015/1117] Roll src/third_party/skia 95b014790f93..ae64f52786b3 (3 commits) (#7662) https://skia.googlesource.com/skia.git/%2Blog/95b014790f93..ae64f52786b3 git log 95b014790f93856d66da760d7a68ccc2e448a5f7..ae64f52786b31fdfeeee0c2891a11a05814818c1 --date=short --no-merges --format=%ad %ae %s 2019-02-01 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 5d360ebe1581..10b73e92900a (473 commits) 2019-02-01 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader ebe5f7fad064..debaacab10b5 (1 commits) 2019-01-31 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index baa88a95cb3c7..cf04b9e57c97b 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': '95b014790f93856d66da760d7a68ccc2e448a5f7', + 'skia_revision': 'ae64f52786b31fdfeeee0c2891a11a05814818c1', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2492c430d5f47..d4979354f9d27 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: aecb9267437d920910219a31d2528626 +Signature: 5e257c6b5c383dd993a9d8759eb2c2e1 UNUSED LICENSES: From 80db23fb778778f060ba1907c57ad73e7bad118d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 1 Feb 2019 03:55:42 -0500 Subject: [PATCH 0016/1117] Roll src/third_party/skia ae64f52786b3..72a0e3347cdf (2 commits) (#7663) https://skia.googlesource.com/skia.git/%2Blog/ae64f52786b3..72a0e3347cdf git log ae64f52786b31fdfeeee0c2891a11a05814818c1..72a0e3347cdfcaeb5f85c128e370e58e1cf7cd18 --date=short --no-merges --format=%ad %ae %s 2019-02-01 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 258398020826..cf9383ed325c (3 commits) 2019-02-01 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index cf04b9e57c97b..fddd5b4f26380 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': 'ae64f52786b31fdfeeee0c2891a11a05814818c1', + 'skia_revision': '72a0e3347cdfcaeb5f85c128e370e58e1cf7cd18', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index d4979354f9d27..3cb85d4b3541d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 5e257c6b5c383dd993a9d8759eb2c2e1 +Signature: 7ea8a1b6a913a9bfd6797ff7dcde9e33 UNUSED LICENSES: From 44245c8e78653a4587b64d9d2d8d78705cd8a295 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 1 Feb 2019 07:23:20 -0500 Subject: [PATCH 0017/1117] Roll src/third_party/skia 72a0e3347cdf..569dda7216cd (1 commits) (#7664) https://skia.googlesource.com/skia.git/%2Blog/72a0e3347cdf..569dda7216cd git log 72a0e3347cdfcaeb5f85c128e370e58e1cf7cd18..569dda7216cda3f096677df29ee787e44ddb0be0 --date=short --no-merges --format=%ad %ae %s 2019-02-01 reed@google.com hide SkFont::containsText The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index fddd5b4f26380..5ac8dce0b5f79 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': '72a0e3347cdfcaeb5f85c128e370e58e1cf7cd18', + 'skia_revision': '569dda7216cda3f096677df29ee787e44ddb0be0', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3cb85d4b3541d..771078cf912f5 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 7ea8a1b6a913a9bfd6797ff7dcde9e33 +Signature: f867a1b671acb1f1421f91dafca3c167 UNUSED LICENSES: From 377e665e427b40cdb56e3c33f34fff09162b89a6 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 1 Feb 2019 10:51:35 -0500 Subject: [PATCH 0018/1117] Roll src/third_party/skia 569dda7216cd..5892553ad020 (5 commits) (#7665) https://skia.googlesource.com/skia.git/%2Blog/569dda7216cd..5892553ad020 git log 569dda7216cda3f096677df29ee787e44ddb0be0..5892553ad0205a2644d9567b7b1c64e402b47c55 --date=short --no-merges --format=%ad %ae %s 2019-01-30 reed@google.com delete orphaned sample 2019-02-01 reed@google.com remove breakText, and all utf cache accessors 2019-02-01 reed@google.com skip huge allocation in test on 32bit devices 2019-01-31 robertphillips@google.com Remove destination GrRenderTargetProxy from GrPipeline 2019-01-31 michaelludwig@google.com Narrow clear-as-draw workaround on D3D11 ANGLE The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 5ac8dce0b5f79..4b070246163e6 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': '569dda7216cda3f096677df29ee787e44ddb0be0', + 'skia_revision': '5892553ad0205a2644d9567b7b1c64e402b47c55', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 771078cf912f5..7463355d76642 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f867a1b671acb1f1421f91dafca3c167 +Signature: 4dc6b3b7a6077731857dac95e5daaef0 UNUSED LICENSES: @@ -3001,7 +3001,6 @@ FILE: ../../../third_party/skia/samplecode/SampleClip.cpp FILE: ../../../third_party/skia/samplecode/SampleColorFilter.cpp FILE: ../../../third_party/skia/samplecode/SampleComplexClip.cpp FILE: ../../../third_party/skia/samplecode/SampleConcavePaths.cpp -FILE: ../../../third_party/skia/samplecode/SampleDash.cpp FILE: ../../../third_party/skia/samplecode/SampleDegenerateTwoPtRadials.cpp FILE: ../../../third_party/skia/samplecode/SampleEffects.cpp FILE: ../../../third_party/skia/samplecode/SampleEmboss.cpp From 1cf606148cd8f36bac5475fd2d3e2be30e244917 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 1 Feb 2019 14:19:37 -0500 Subject: [PATCH 0019/1117] Roll src/third_party/skia 5892553ad020..3ed198faf93a (3 commits) (#7666) https://skia.googlesource.com/skia.git/%2Blog/5892553ad020..3ed198faf93a git log 5892553ad0205a2644d9567b7b1c64e402b47c55..3ed198faf93ad040b4d5a55e3efdbf1b9b2a227c --date=short --no-merges --format=%ad %ae %s 2019-02-01 reed@google.com remove docs for containsText 2019-02-01 robertphillips@google.com Rename GrContext::uniqueID to contextID and hide it 2019-02-01 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 cf9383ed325c..a54104803d72 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4b070246163e6..b506f687b015e 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': '5892553ad0205a2644d9567b7b1c64e402b47c55', + 'skia_revision': '3ed198faf93ad040b4d5a55e3efdbf1b9b2a227c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 7463355d76642..16aa5ff717143 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 4dc6b3b7a6077731857dac95e5daaef0 +Signature: f94cccd796ac32bf9cd02e14712320b1 UNUSED LICENSES: From 1b657855e38f0d17a18543a0c361275f846c30dd Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Fri, 1 Feb 2019 12:25:33 -0800 Subject: [PATCH 0020/1117] Add kernel-worker and dart2js to BUILD.gn (#7660) --- BUILD.gn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BUILD.gn b/BUILD.gn index 9bfa135468c01..89a6c0b863d22 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -23,6 +23,8 @@ group("flutter") { public_deps += [ "$flutter_root/frontend_server", "//third_party/dart:create_sdk", + "//third_party/dart:dart2js", + "//third_party/dart/utils/bazel:kernel_worker", ] } } From 637fadba7127dc99a846ba38eb0dd320815981ef Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 1 Feb 2019 17:49:58 -0500 Subject: [PATCH 0021/1117] Roll src/third_party/skia 3ed198faf93a..8f5aeebdd8eb (8 commits) (#7667) https://skia.googlesource.com/skia.git/%2Blog/3ed198faf93a..8f5aeebdd8eb git log 3ed198faf93ad040b4d5a55e3efdbf1b9b2a227c..8f5aeebdd8eb77b624a9d802eac49c3c1de8deba --date=short --no-merges --format=%ad %ae %s 2019-02-01 michaelludwig@google.com Revert "Narrow clear-as-draw workaround on D3D11 ANGLE" 2019-02-01 robertphillips@google.com Add isTextureable parameter to GrContextThreadSafeProxy::createCharacterization 2019-02-01 brianosman@google.com Remove SkColorSpaceTransferFn 2019-02-01 kjlubick@google.com Revert "Revert "make third_party() static libraries"" 2019-02-01 brianosman@google.com Remove SkICC::WriteToICC 2019-02-01 bsalomon@google.com Make GrMesh hold regular ref on GrBuffers. 2019-02-01 reed@google.com remove unneeded friends/includes in SkPaint.h 2019-02-01 kjlubick@google.com CMake: distinguish between file and dir copies by presence of '.' in src path The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index b506f687b015e..c64149b1f982e 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': '3ed198faf93ad040b4d5a55e3efdbf1b9b2a227c', + 'skia_revision': '8f5aeebdd8eb77b624a9d802eac49c3c1de8deba', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 16aa5ff717143..58a79c256d4ec 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f94cccd796ac32bf9cd02e14712320b1 +Signature: 5873488737afbf3a1ae693663cc32910 UNUSED LICENSES: @@ -1841,11 +1841,11 @@ 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.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 From 1b6f1397c8cbc5c53742619709fe90795bbcd0f1 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 1 Feb 2019 21:23:40 -0500 Subject: [PATCH 0022/1117] Roll src/third_party/skia 8f5aeebdd8eb..72c687807f5e (3 commits) (#7668) https://skia.googlesource.com/skia.git/%2Blog/8f5aeebdd8eb..72c687807f5e git log 8f5aeebdd8eb77b624a9d802eac49c3c1de8deba..72c687807f5e96c9b3797d4200eb0af411f8a7cc --date=short --no-merges --format=%ad %ae %s 2019-02-01 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader debaacab10b5..cd610c9a9dbc (1 commits) 2019-02-01 robertphillips@google.com Revert "Add isTextureable parameter to GrContextThreadSafeProxy::createCharacterization" 2019-02-01 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c64149b1f982e..749d171da0583 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': '8f5aeebdd8eb77b624a9d802eac49c3c1de8deba', + 'skia_revision': '72c687807f5e96c9b3797d4200eb0af411f8a7cc', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 58a79c256d4ec..472241f942bc0 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 5873488737afbf3a1ae693663cc32910 +Signature: b65a917e8de3e169f25cb660e6a4d771 UNUSED LICENSES: From b00c7c87f5494bef694db99e221eb93cb0d1ab3e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 2 Feb 2019 01:06:59 -0500 Subject: [PATCH 0023/1117] Roll src/third_party/skia 72c687807f5e..8ec9a60bdb6f (2 commits) (#7669) https://skia.googlesource.com/skia.git/%2Blog/72c687807f5e..8ec9a60bdb6f git log 72c687807f5e96c9b3797d4200eb0af411f8a7cc..8ec9a60bdb6f63e7d0d1a7d994f25bf82cc40859 --date=short --no-merges --format=%ad %ae %s 2019-02-01 fmalita@chromium.org [skottie] Initial repeater support 2019-02-01 reed@google.com remove legacy forward declares The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 749d171da0583..b4d586215a5bf 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': '72c687807f5e96c9b3797d4200eb0af411f8a7cc', + 'skia_revision': '8ec9a60bdb6f63e7d0d1a7d994f25bf82cc40859', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 472241f942bc0..ec3c2fd3f2283 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b65a917e8de3e169f25cb660e6a4d771 +Signature: 0130ec2b086b4b6c350f061836d1c5a9 UNUSED LICENSES: From 3f4ac2bac5b15c9da4a5bc694af1e9f6753c9a9d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 2 Feb 2019 04:52:29 -0500 Subject: [PATCH 0024/1117] Roll src/third_party/skia 8ec9a60bdb6f..d6a45a8aee6e (2 commits) (#7670) https://skia.googlesource.com/skia.git/%2Blog/8ec9a60bdb6f..d6a45a8aee6e git log 8ec9a60bdb6f63e7d0d1a7d994f25bf82cc40859..d6a45a8aee6e8dfee484287c814e30a39799f93a --date=short --no-merges --format=%ad %ae %s 2019-02-02 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-02-02 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 10b73e92900a..c5cbca79da09 (339 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index b4d586215a5bf..0343c19ab5117 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': '8ec9a60bdb6f63e7d0d1a7d994f25bf82cc40859', + 'skia_revision': 'd6a45a8aee6e8dfee484287c814e30a39799f93a', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index ec3c2fd3f2283..0742d1e12c1e6 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 0130ec2b086b4b6c350f061836d1c5a9 +Signature: 2e4da9d845df14d2e843566c110accf6 UNUSED LICENSES: From 7f9d59cb0e07fe15ee73612d42494075c6ed6b1c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 2 Feb 2019 08:32:55 -0500 Subject: [PATCH 0025/1117] Roll src/third_party/skia d6a45a8aee6e..48913465db5f (1 commits) (#7671) https://skia.googlesource.com/skia.git/%2Blog/d6a45a8aee6e..48913465db5f git log d6a45a8aee6e8dfee484287c814e30a39799f93a..48913465db5f6077be48a7333c56e03e77b107a1 --date=short --no-merges --format=%ad %ae %s 2019-02-02 reed@google.com Revert "remove legacy forward declares" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 0343c19ab5117..3b9bada827d0d 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': 'd6a45a8aee6e8dfee484287c814e30a39799f93a', + 'skia_revision': '48913465db5f6077be48a7333c56e03e77b107a1', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 0742d1e12c1e6..c0ea21a97b2ec 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2e4da9d845df14d2e843566c110accf6 +Signature: e5239ca53529ee6fc25fc0180b3986e8 UNUSED LICENSES: From 48055b102d25957d8cbf2a8c6d3ff7bedc23ab82 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 2 Feb 2019 14:01:00 -0500 Subject: [PATCH 0026/1117] Roll src/third_party/skia 48913465db5f..0d84e805c30c (1 commits) (#7672) https://skia.googlesource.com/skia.git/%2Blog/48913465db5f..0d84e805c30c git log 48913465db5f6077be48a7333c56e03e77b107a1..0d84e805c30c5228c9cc1c01df54578ee1fd96aa --date=short --no-merges --format=%ad %ae %s 2019-01-24 reed@google.com move experimental header out of public includes The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (borenet@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index 3b9bada827d0d..fe04a6684a6bd 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': '48913465db5f6077be48a7333c56e03e77b107a1', + 'skia_revision': '0d84e805c30c5228c9cc1c01df54578ee1fd96aa', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index c0ea21a97b2ec..87b2612019843 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: e5239ca53529ee6fc25fc0180b3986e8 +Signature: 452c543111e004790a6ed7b4d423e68a UNUSED LICENSES: @@ -1357,7 +1357,6 @@ FILE: ../../../third_party/skia/src/core/SkICCPriv.h FILE: ../../../third_party/skia/src/core/SkImageFilterCache.cpp FILE: ../../../third_party/skia/src/core/SkImageFilterCache.h FILE: ../../../third_party/skia/src/core/SkLRUCache.h -FILE: ../../../third_party/skia/src/core/SkLights.cpp FILE: ../../../third_party/skia/src/core/SkLiteDL.cpp FILE: ../../../third_party/skia/src/core/SkLiteDL.h FILE: ../../../third_party/skia/src/core/SkLiteRecorder.cpp @@ -1512,6 +1511,7 @@ FILE: ../../../third_party/skia/src/ports/SkImageGeneratorCG.cpp FILE: ../../../third_party/skia/src/ports/SkImageGeneratorWIC.cpp FILE: ../../../third_party/skia/src/shaders/SkColorFilterShader.h FILE: ../../../third_party/skia/src/shaders/SkColorShader.cpp +FILE: ../../../third_party/skia/src/shaders/SkLights.cpp FILE: ../../../third_party/skia/src/shaders/gradients/Sk4fGradientBase.cpp FILE: ../../../third_party/skia/src/shaders/gradients/Sk4fGradientBase.h FILE: ../../../third_party/skia/src/shaders/gradients/Sk4fGradientPriv.h @@ -3753,7 +3753,6 @@ FILE: ../../../third_party/skia/include/codec/SkAndroidCodec.h FILE: ../../../third_party/skia/include/codec/SkCodec.h FILE: ../../../third_party/skia/include/core/SkEncodedImageFormat.h FILE: ../../../third_party/skia/include/core/SkFilterQuality.h -FILE: ../../../third_party/skia/include/core/SkLights.h FILE: ../../../third_party/skia/include/core/SkPixmap.h FILE: ../../../third_party/skia/include/core/SkPngChunkReader.h FILE: ../../../third_party/skia/include/core/SkPoint3.h @@ -4040,6 +4039,7 @@ FILE: ../../../third_party/skia/src/shaders/SkImageShader.cpp FILE: ../../../third_party/skia/src/shaders/SkImageShader.h FILE: ../../../third_party/skia/src/shaders/SkLightingShader.cpp FILE: ../../../third_party/skia/src/shaders/SkLightingShader.h +FILE: ../../../third_party/skia/src/shaders/SkLights.h FILE: ../../../third_party/skia/src/svg/SkSVGCanvas.cpp FILE: ../../../third_party/skia/src/svg/SkSVGDevice.cpp FILE: ../../../third_party/skia/src/svg/SkSVGDevice.h From 94ec2c55ccc706648a8bd653eb83309f978a06c4 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 3 Feb 2019 02:17:29 -0500 Subject: [PATCH 0027/1117] Roll src/third_party/skia 0d84e805c30c..d396dd0347d3 (1 commits) (#7673) https://skia.googlesource.com/skia.git/%2Blog/0d84e805c30c..d396dd0347d3 git log 0d84e805c30c5228c9cc1c01df54578ee1fd96aa..d396dd0347d35c83c278f9dbbc698f3f2fccec2f --date=short --no-merges --format=%ad %ae %s 2019-02-03 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src c5cbca79da09..ccf3465732e5 (35 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index fe04a6684a6bd..90524d7d24396 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': '0d84e805c30c5228c9cc1c01df54578ee1fd96aa', + 'skia_revision': 'd396dd0347d35c83c278f9dbbc698f3f2fccec2f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 87b2612019843..3858a6055ba31 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 452c543111e004790a6ed7b4d423e68a +Signature: 043ea30bafcb20c4cde2b347978c3862 UNUSED LICENSES: From 6266da8e6d3ed2c4aa29f0902a7e6c0fdea05217 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 3 Feb 2019 05:55:06 -0500 Subject: [PATCH 0028/1117] Roll src/third_party/skia d396dd0347d3..71e434dc9dea (1 commits) (#7674) https://skia.googlesource.com/skia.git/%2Blog/d396dd0347d3..71e434dc9dea git log d396dd0347d35c83c278f9dbbc698f3f2fccec2f..71e434dc9dea94e8f4ccb2bd78aa14a9418d599f --date=short --no-merges --format=%ad %ae %s 2019-02-03 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update SKP version The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 90524d7d24396..f65bee9365787 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': 'd396dd0347d35c83c278f9dbbc698f3f2fccec2f', + 'skia_revision': '71e434dc9dea94e8f4ccb2bd78aa14a9418d599f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3858a6055ba31..0d16ce3e3f420 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 043ea30bafcb20c4cde2b347978c3862 +Signature: 607b22beb61bf16d65e863ce7e2ad95d UNUSED LICENSES: From 0a9dadb0441af3781eaf05d989f73bdf1d067876 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 3 Feb 2019 09:38:12 -0500 Subject: [PATCH 0029/1117] Roll src/third_party/skia 71e434dc9dea..32d8cce070dd (1 commits) (#7675) https://skia.googlesource.com/skia.git/%2Blog/71e434dc9dea..32d8cce070dd git log 71e434dc9dea94e8f4ccb2bd78aa14a9418d599f..32d8cce070dd5a14b0ceae326b26d5e16c6194bd --date=short --no-merges --format=%ad %ae %s 2019-02-02 reed@google.com Revert "Revert "remove legacy forward declares"" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f65bee9365787..5d516fa259a07 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': '71e434dc9dea94e8f4ccb2bd78aa14a9418d599f', + 'skia_revision': '32d8cce070dd5a14b0ceae326b26d5e16c6194bd', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 0d16ce3e3f420..82a450cb32eef 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 607b22beb61bf16d65e863ce7e2ad95d +Signature: d5bbeff861d40c455521f6ba3785986a UNUSED LICENSES: From 940b42030bddad4c8e203c69a84aa43320e7780d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 3 Feb 2019 13:26:08 -0500 Subject: [PATCH 0030/1117] Roll src/third_party/skia 32d8cce070dd..9c7a006a8e2d (1 commits) (#7677) https://skia.googlesource.com/skia.git/%2Blog/32d8cce070dd..9c7a006a8e2d git log 32d8cce070dd5a14b0ceae326b26d5e16c6194bd..9c7a006a8e2da4ae3158d12f2fee6bfee2a8ad14 --date=short --no-merges --format=%ad %ae %s 2019-02-01 bsalomon@google.com Remove NoPendingIO flags from buffer creations. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 5d516fa259a07..ebda1820101b9 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': '32d8cce070dd5a14b0ceae326b26d5e16c6194bd', + 'skia_revision': '9c7a006a8e2da4ae3158d12f2fee6bfee2a8ad14', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 82a450cb32eef..15c8a319f1f44 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: d5bbeff861d40c455521f6ba3785986a +Signature: 6649fbd936962b4d13d55ca8f62afacc UNUSED LICENSES: From 26b83393b9ece566a9e6be7fd9437a8e8606aa46 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 3 Feb 2019 18:51:27 -0500 Subject: [PATCH 0031/1117] Roll src/third_party/skia 9c7a006a8e2d..b45f47dc3ef5 (1 commits) (#7679) https://skia.googlesource.com/skia.git/%2Blog/9c7a006a8e2d..b45f47dc3ef5 git log 9c7a006a8e2da4ae3158d12f2fee6bfee2a8ad14..b45f47dc3ef5cf8e6d4e81943892808798cccd59 --date=short --no-merges --format=%ad %ae %s 2019-02-03 robertphillips@google.com Add isTextureable parameter to GrContextThreadSafeProxy::createCharacterization (take 2) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index ebda1820101b9..c24956b53ec33 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': '9c7a006a8e2da4ae3158d12f2fee6bfee2a8ad14', + 'skia_revision': 'b45f47dc3ef5cf8e6d4e81943892808798cccd59', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 15c8a319f1f44..191933764651c 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 6649fbd936962b4d13d55ca8f62afacc +Signature: 537b6056394c9a7b0abd927089f12cd1 UNUSED LICENSES: From cc349a36eef03781f8d4c6d36708388855ff66e0 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 4 Feb 2019 01:48:20 -0500 Subject: [PATCH 0032/1117] Roll src/third_party/skia b45f47dc3ef5..21ca3702f8eb (1 commits) (#7680) https://skia.googlesource.com/skia.git/%2Blog/b45f47dc3ef5..21ca3702f8eb git log b45f47dc3ef5cf8e6d4e81943892808798cccd59..21ca3702f8eb965a219fd697318d04ecd824cf70 --date=short --no-merges --format=%ad %ae %s 2019-02-01 csmartdalton@google.com Remove GM::onDrawBackground The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c24956b53ec33..b52ed8f348ed6 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': 'b45f47dc3ef5cf8e6d4e81943892808798cccd59', + 'skia_revision': '21ca3702f8eb965a219fd697318d04ecd824cf70', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 191933764651c..57b6813f3530f 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 537b6056394c9a7b0abd927089f12cd1 +Signature: 91c5d7eb1fb48ab66dda2feb20b23048 UNUSED LICENSES: From 482e43faff4c365be1118ff97a1bf2b49b6c7c6b Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 4 Feb 2019 05:30:00 -0500 Subject: [PATCH 0033/1117] Roll src/third_party/skia 21ca3702f8eb..69130631e23d (2 commits) (#7681) https://skia.googlesource.com/skia.git/%2Blog/21ca3702f8eb..69130631e23d git log 21ca3702f8eb965a219fd697318d04ecd824cf70..69130631e23d13d980ceb1151fa656ebb2577eef --date=short --no-merges --format=%ad %ae %s 2019-02-04 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src ccf3465732e5..950d2f4a3353 (57 commits) 2019-02-04 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index b52ed8f348ed6..c2e4cb4348c88 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': '21ca3702f8eb965a219fd697318d04ecd824cf70', + 'skia_revision': '69130631e23d13d980ceb1151fa656ebb2577eef', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 57b6813f3530f..9d5273bf878fe 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 91c5d7eb1fb48ab66dda2feb20b23048 +Signature: fe3d646e074966fdf0a36c120c6152ea UNUSED LICENSES: From 615ca598da18f680d188b9c0d3c909282557a21e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 4 Feb 2019 09:59:09 -0500 Subject: [PATCH 0034/1117] Roll src/third_party/skia 69130631e23d..8c14038e56c3 (1 commits) (#7682) https://skia.googlesource.com/skia.git/%2Blog/69130631e23d..8c14038e56c3 git log 69130631e23d13d980ceb1151fa656ebb2577eef..8c14038e56c37e5b41c066c1b1825fe32c257d01 --date=short --no-merges --format=%ad %ae %s 2019-02-03 reed@google.com hide getMetaData() The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c2e4cb4348c88..53957c36f2f6a 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': '69130631e23d13d980ceb1151fa656ebb2577eef', + 'skia_revision': '8c14038e56c37e5b41c066c1b1825fe32c257d01', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 9d5273bf878fe..82d4313e0f8eb 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: fe3d646e074966fdf0a36c120c6152ea +Signature: b282d702baeeda6d0f1c176ca7bb29c4 UNUSED LICENSES: From 74839e207b482e7a47eae8af73ffa1e23f8e8355 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 4 Feb 2019 13:33:19 -0500 Subject: [PATCH 0035/1117] Roll src/third_party/skia 8c14038e56c3..d7a5a1d27e1d (5 commits) (#7683) https://skia.googlesource.com/skia.git/%2Blog/8c14038e56c3..d7a5a1d27e1d git log 8c14038e56c37e5b41c066c1b1825fe32c257d01..d7a5a1d27e1d3ecc1ef4dfa1cef38195daf99f67 --date=short --no-merges --format=%ad %ae %s 2019-02-04 csmartdalton@google.com Add a central skiagm::GM::DrawFailureMessage for error messages 2019-02-04 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader cd610c9a9dbc..3f5a479280cc (1 commits) 2019-02-04 scroggo@google.com Remove temporarily_sanitize 2019-02-04 mtklein@google.com use std::underlying_type 2019-02-04 reed@google.com remove legacy includes The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 53957c36f2f6a..785beddeecc73 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': '8c14038e56c37e5b41c066c1b1825fe32c257d01', + 'skia_revision': 'd7a5a1d27e1d3ecc1ef4dfa1cef38195daf99f67', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 82d4313e0f8eb..d6deaf25072a1 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b282d702baeeda6d0f1c176ca7bb29c4 +Signature: f062937692335a9be503b3b81928e6ba UNUSED LICENSES: From 85492c3e804a6f6bf06275ed49c103ac6548be87 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 4 Feb 2019 13:05:40 -0800 Subject: [PATCH 0036/1117] Roll src/third_party/dart 71bee8f05e..3e5ed47777 (83 commits) 3e5ed47777 Implement 'completion.getSuggestionDetails'. 38aadd71df Rework DecoratedType substitution. 087c6e3eb7 Add associatedErrorCodes API to AssistKind 8a45b5eb57 Move environment handling into the front-end constant evaluator. 8010fad320 [infra] Fix incorrect shell function syntax 1bfc3816d8 [infra] Extend 3head patching to apply patches for flutter/flutter depending on pinned engine commit e4b809f0e6 Add unit testing of (some) invoke dynamic specializers 0fd1679620 Sort named parameters in native methods by declaration. 8c891ec25e Include type parameters into suggested code completions. 2efd22271e Use included suggestions only when free standing identifiers are allowed. 0d075031fa allow custom analysis options in lint driving f89acfa374 Issue 35621. Part files should use their own transitive signatures. 133d83eede Protect against override completion outside workspace. 849285276d Extract and migrate ElementLocator tests. d45a6ec893 Split Variables class into two interface classes and create DecoratedType.forElement constructor. b9c89c9fb5 More test cases for the migration prototype. a6e7361fa8 Add documentation comments to the migration prototype. 67ff7a6ef3 Remove unused import 53ba159aa4 Add assists to convert to list, map and set literals a9c84ab887 Verify nullability of dynamic in DecoratedType constructor. eaeffd2695 Rename ConstraintsTest to match the class it's testing af303a277c Add some assists for the code-as-ui features c4dcd85b3a Tests for control flow collections. fe585471e3 Add DartFileEditBuilder.importLibraryElement(). 460d69d08f Update 'Convert to StatefulWidget' to create private State classes. 509ac0648c Update non-nullability migration algorithm to handle missing types b01697ba5a [vm/compiler] Continued graph checker development 00c6f6b584 Document InheritanceManager deprecations. 3802a6d7eb Experimental prototype of a non-nullability migration algorithm. 931051814c Partial implementation of the 'available suggestion sets' protocol. 1c173c2ce7 Enhance dartfix to allow including and excluding specific fixes 971733a08b [kernel] Add a class to track variance of type parameters 967b5fbac3 Finish implementing IsFunctionSubtypeOf 0d7bdd734a Ensure that top types are equivalent. d44724d0af Compute default type arguments in Fasta types. d55f95e344 Add Types.isSameTypeKernel 7fa0376af7 Implement subtype rules for Null in Fasta types d9072d5272 Re-issue all problems in the incremental compiler b6dc18e21e Remove legacyMode parameter and delete obsolete version of test 33f167b039 Complete the implemention of IsInterfaceSubtypeOf. 534825020a Check intersection types in subtype tests ea0d98d98a Check FutureOr in subtype tests 014124e763 (Some) DiagnosticMessages can be serialized to/from json. eb956a2516 Add synthetic bit to Library flags e9597684fe Fix for incremental compiler swallowing certain errors 68d110ac2a Add test for codegen of optional parameters on native functions. 5737b452b8 [vm/gc] Update initial TLAB size calculation. 37a1f79360 [dart2js] Move letBindings to StackFrame ec343169e7 Skip the spread tests on platforms that aren't using the new test workflow. 598515f031 [vm/compiler] Fix another missing incremental DOM update d6f9d2da6f Add pkg/analysis_server/pubspec.yaml so that it is identified as a pub package. 9f8a9dc9f4 First stab at tests for "Spread Collections". 2c25cf016d [vm, gc] Use work stealing for the slices of the root set. 9308cac681 [vm] Simplify VirtualMemory::Truncate e717ecdc92 [vm] Maintain view-ness of bytecode instructions in snapshots. d4b8e0696d Add the capability in analysis server protocol for clients to express interest in receiving not yet imported code completions from specific packages and libraries. 7a95930bee Add a "summary-deps-output" option to build mode. aaf97448b0 Extract EnumListParameter values before checking for matches 20fc81470e Fix override_on_non_overriding_method hint ca4978e363 Add pkg:analysis_tool as an SDK-only set of utils e5164be27e Issue 35127. Fixes for mixin implements / overrides. fdd477721d [infra] Run co19_2 tests on DDC Linux and Windows builders c31627b778 Remove the unused TypeOverrideManager 485a41bb12 Include superclass constraints into mixin type suggestions. 8f12035f36 Clean up the diagnostic tests 14b2255584 Status update after c3c5250 c3c525079b Demonstrate bug for the VMs way of doing initializers in face of mixins d6608f19c0 Check function types in subtype tests a6a9d4854b Start checking type arguments in subtype tests dd70ecd5c0 Substitute type variables when computing class hierarchy 85c5082cf4 Support Kernel classes in ClassHierarchyBuilder 18ff842341 Start testing Fasta types implementation db44a727e5 Extend the edit.dartfix protocol 40fca03d07 [vm/compiler] fix assert failure on minint64 6c96d8fdaf Fix crashing analysis_server with some defensive null checks 3b5c1012e9 Update CodeChecker to handle the code-as-ui features b8fc017778 Replace convertAbsolutePathToUri() with toUriStr(). f903ee6dc0 Don't crash on formal parameters without name, exclude private SDK lbiraries. 118bdcc1f6 backlink to language docs for customized analysis bc2a5a6789 Generate some of the code-as-ui diagnostics; implement more resolution e8a0a209e3 Include into Declaration data that we will need for pre-cached suggestions. 0bb1aee3ff AstBuilder cleanup ec13e61df3 Move `question` getter from GenericFunctionType and NamedType to their common base class. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 785beddeecc73..a038313e5336b 100644 --- a/DEPS +++ b/DEPS @@ -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': '71bee8f05eb40e2f3b49ed57b8f46421f4432179', + 'dart_revision': '3e5ed477777b576bd451d19735f53ee9a5e749fe', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 63057ac7e3dff..ba3437e8647ee 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 8c93c6ef0de9e89d30fad2c99c899a75 +Signature: fb54646f5c94d18c6fe5c3e645d0bf05 UNUSED LICENSES: From 194608290eee2f09cc9f60ddd4a41e57d8708e51 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Mon, 4 Feb 2019 13:29:53 -0800 Subject: [PATCH 0037/1117] Move Brightness definition to dart:ui (#27479) (#7678) --- lib/ui/window.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/ui/window.dart b/lib/ui/window.dart index b9c8298c2c76c..72046ff85928d 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -924,6 +924,21 @@ class AccessibilityFeatures { int get hashCode => _index.hashCode; } +/// Describes the contrast of a theme or color palette. +enum Brightness { + /// The color is dark and will require a light text color to achieve readable + /// contrast. + /// + /// For example, the color might be dark grey, requiring white text. + dark, + + /// The color is light and will require a dark text color to achieve readable + /// contrast. + /// + /// For example, the color might be bright white, requiring black text. + light, +} + /// The [Window] singleton. This object exposes the size of the display, the /// core scheduler API, the input event callback, the graphics drawing API, and /// other such core services. From eaae8a67bc5dc2357bbabf2a01b9d77200340dd0 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Mon, 4 Feb 2019 13:31:10 -0800 Subject: [PATCH 0038/1117] Retained rendering in Fuchsia PhysicalShapeLayer (#6558) For flutter/flutter#23535 When this lands/rolls into Fuchsia, a manual roll with https://fuchsia-review.googlesource.com/c/topaz/+/241557 is needed. --- flow/layers/physical_shape_layer.cc | 16 ++++++- flow/scene_update_context.cc | 61 ++++++++++++++---------- flow/scene_update_context.h | 73 ++++++++++++++++++++++++----- 3 files changed, 113 insertions(+), 37 deletions(-) diff --git a/flow/layers/physical_shape_layer.cc b/flow/layers/physical_shape_layer.cc index fc156802840b1..841ae4cf6a076 100644 --- a/flow/layers/physical_shape_layer.cc +++ b/flow/layers/physical_shape_layer.cc @@ -66,7 +66,21 @@ void PhysicalShapeLayer::Preroll(PrerollContext* context, void PhysicalShapeLayer::UpdateScene(SceneUpdateContext& context) { FML_DCHECK(needs_system_composite()); - SceneUpdateContext::Frame frame(context, frameRRect_, color_, elevation_); + // Retained rendering: speedup by reusing a retained entity node if possible. + // When an entity node is reused, no paint layer is added to the frame so we + // won't call PhysicalShapeLayer::Paint. + LayerRasterCacheKey key(this, context.Matrix()); + if (context.HasRetainedNode(key)) { + const scenic::EntityNode& retained_node = context.GetRetainedNode(key); + FML_DCHECK(context.top_entity()); + FML_DCHECK(retained_node.session() == context.session()); + context.top_entity()->entity_node().AddChild(retained_node); + return; + } + + // If we can't find an existing retained surface, create one. + SceneUpdateContext::Frame frame(context, frameRRect_, color_, elevation_, + this); for (auto& layer : layers()) { if (layer->needs_painting()) { frame.AddPaintLayer(layer.get()); diff --git a/flow/scene_update_context.cc b/flow/scene_update_context.cc index e5e4bac42cfad..bebe2ef67fb9e 100644 --- a/flow/scene_update_context.cc +++ b/flow/scene_update_context.cc @@ -40,13 +40,15 @@ void SceneUpdateContext::RemoveExportNode(ExportNode* export_node) { export_nodes_.erase(export_node); } -void SceneUpdateContext::CreateFrame(scenic::EntityNode& entity_node, - const SkRRect& rrect, - SkColor color, - const SkRect& paint_bounds, - std::vector paint_layers) { +void SceneUpdateContext::CreateFrame( + std::unique_ptr entity_node, + const SkRRect& rrect, + SkColor color, + const SkRect& paint_bounds, + std::vector paint_layers, + Layer* layer) { // Frames always clip their children. - entity_node.SetClip(0u, true /* clip to self */); + entity_node->SetClip(0u, true /* clip to self */); // We don't need a shape if the frame is zero size. if (rrect.isEmpty()) @@ -70,7 +72,7 @@ void SceneUpdateContext::CreateFrame(scenic::EntityNode& entity_node, shape_node.SetTranslation(shape_bounds.width() * 0.5f + shape_bounds.left(), shape_bounds.height() * 0.5f + shape_bounds.top(), 0.f); - entity_node.AddPart(shape_node); + entity_node->AddPart(shape_node); // Check whether the painted layers will be visible. if (paint_bounds.isEmpty() || !paint_bounds.intersects(shape_bounds)) @@ -83,8 +85,8 @@ void SceneUpdateContext::CreateFrame(scenic::EntityNode& entity_node, } // Apply current metrics and transformation scale factors. - const float scale_x = metrics_->scale_x * top_scale_x_; - const float scale_y = metrics_->scale_y * top_scale_y_; + const float scale_x = ScaleX(); + const float scale_y = ScaleY(); // If the painted area only covers a portion of the frame then we can // reduce the texture size by drawing just that smaller area. @@ -100,15 +102,17 @@ void SceneUpdateContext::CreateFrame(scenic::EntityNode& entity_node, inner_node.SetTranslation(inner_bounds.width() * 0.5f + inner_bounds.left(), inner_bounds.height() * 0.5f + inner_bounds.top(), 0.f); - entity_node.AddPart(inner_node); + entity_node->AddPart(inner_node); SetShapeTextureOrColor(inner_node, color, scale_x, scale_y, inner_bounds, - std::move(paint_layers)); + std::move(paint_layers), layer, + std::move(entity_node)); return; } // Apply a texture to the whole shape. SetShapeTextureOrColor(shape_node, color, scale_x, scale_y, shape_bounds, - std::move(paint_layers)); + std::move(paint_layers), layer, + std::move(entity_node)); } void SceneUpdateContext::SetShapeTextureOrColor( @@ -117,9 +121,12 @@ void SceneUpdateContext::SetShapeTextureOrColor( SkScalar scale_x, SkScalar scale_y, const SkRect& paint_bounds, - std::vector paint_layers) { + std::vector paint_layers, + Layer* layer, + std::unique_ptr entity_node) { scenic::Image* image = GenerateImageIfNeeded( - color, scale_x, scale_y, paint_bounds, std::move(paint_layers)); + color, scale_x, scale_y, paint_bounds, std::move(paint_layers), layer, + std::move(entity_node)); if (image != nullptr) { scenic::Material material(session_); material.SetTexture(*image); @@ -146,7 +153,9 @@ scenic::Image* SceneUpdateContext::GenerateImageIfNeeded( SkScalar scale_x, SkScalar scale_y, const SkRect& paint_bounds, - std::vector paint_layers) { + std::vector paint_layers, + Layer* layer, + std::unique_ptr entity_node) { // Bail if there's nothing to paint. if (paint_layers.empty()) return nullptr; @@ -158,7 +167,10 @@ scenic::Image* SceneUpdateContext::GenerateImageIfNeeded( return nullptr; // Acquire a surface from the surface producer and register the paint tasks. - auto surface = surface_producer_->ProduceSurface(physical_size); + std::unique_ptr surface = + surface_producer_->ProduceSurface(physical_size, + LayerRasterCacheKey(layer, Matrix()), + std::move(entity_node)); if (!surface) { FML_LOG(ERROR) << "Could not acquire a surface from the surface producer " @@ -210,11 +222,10 @@ SceneUpdateContext::ExecutePaintTasks(CompositorContext::ScopedFrame& frame) { } SceneUpdateContext::Entity::Entity(SceneUpdateContext& context) - : context_(context), - previous_entity_(context.top_entity_), - entity_node_(context.session()) { + : context_(context), previous_entity_(context.top_entity_) { + entity_node_ptr_ = std::make_unique(context.session()); if (previous_entity_) - previous_entity_->entity_node_.AddChild(entity_node_); + previous_entity_->entity_node_ptr_->AddChild(*entity_node_ptr_); context.top_entity_ = this; } @@ -292,18 +303,20 @@ SceneUpdateContext::Transform::~Transform() { SceneUpdateContext::Frame::Frame(SceneUpdateContext& context, const SkRRect& rrect, SkColor color, - float elevation) + float elevation, + Layer* layer) : Entity(context), rrect_(rrect), color_(color), - paint_bounds_(SkRect::MakeEmpty()) { + paint_bounds_(SkRect::MakeEmpty()), + layer_(layer) { if (elevation != 0.0) entity_node().SetTranslation(0.f, 0.f, elevation); } SceneUpdateContext::Frame::~Frame() { - context().CreateFrame(entity_node(), rrect_, color_, paint_bounds_, - std::move(paint_layers_)); + context().CreateFrame(std::move(entity_node_ptr()), rrect_, color_, + paint_bounds_, std::move(paint_layers_), layer_); } void SceneUpdateContext::Frame::AddPaintLayer(Layer* layer) { diff --git a/flow/scene_update_context.h b/flow/scene_update_context.h index 22e39e63ac195..378af4211d507 100644 --- a/flow/scene_update_context.h +++ b/flow/scene_update_context.h @@ -10,6 +10,7 @@ #include #include "flutter/flow/compositor_context.h" +#include "flutter/flow/raster_cache_key.h" #include "flutter/fml/build_config.h" #include "flutter/fml/compiler_specific.h" #include "flutter/fml/logging.h" @@ -50,8 +51,19 @@ class SceneUpdateContext { public: virtual ~SurfaceProducer() = default; + // The produced surface owns the entity_node and has a layer_key for + // retained rendering. The surface will only be retained if the layer_key + // has a non-null layer pointer (layer_key.id()). virtual std::unique_ptr ProduceSurface( - const SkISize& size) = 0; + const SkISize& size, + const LayerRasterCacheKey& layer_key, + std::unique_ptr entity_node) = 0; + + // Query a retained entity node (owned by a retained surface) for retained + // rendering. + virtual bool HasRetainedNode(const LayerRasterCacheKey& key) const = 0; + virtual const scenic::EntityNode& GetRetainedNode( + const LayerRasterCacheKey& key) = 0; virtual void SubmitSurface( std::unique_ptr surface) = 0; @@ -63,13 +75,16 @@ class SceneUpdateContext { ~Entity(); SceneUpdateContext& context() { return context_; } - scenic::EntityNode& entity_node() { return entity_node_; } + scenic::EntityNode& entity_node() { return *entity_node_ptr_; } + std::unique_ptr& entity_node_ptr() { + return entity_node_ptr_; + } private: SceneUpdateContext& context_; Entity* const previous_entity_; - scenic::EntityNode entity_node_; + std::unique_ptr entity_node_ptr_; }; class Clip : public Entity { @@ -96,10 +111,15 @@ class SceneUpdateContext { class Frame : public Entity { public: + // When layer is not nullptr, the frame is associated with a layer subtree + // rooted with that layer. The frame may then create a surface that will be + // retained for that layer. Frame(SceneUpdateContext& context, const SkRRect& rrect, SkColor color, - float elevation); + float elevation, + Layer* layer = nullptr); + ~Frame(); void AddPaintLayer(Layer* layer); @@ -110,6 +130,7 @@ class SceneUpdateContext { std::vector paint_layers_; SkRect paint_bounds_; + Layer* layer_; }; SceneUpdateContext(scenic::Session* session, @@ -119,6 +140,8 @@ class SceneUpdateContext { scenic::Session* session() { return session_; } + Entity* top_entity() { return top_entity_; } + bool has_metrics() const { return !!metrics_; } void set_metrics(fuchsia::ui::gfx::MetricsPtr metrics) { metrics_ = std::move(metrics); @@ -147,6 +170,20 @@ class SceneUpdateContext { std::vector> ExecutePaintTasks( CompositorContext::ScopedFrame& frame); + float ScaleX() const { return metrics_->scale_x * top_scale_x_; } + float ScaleY() const { return metrics_->scale_y * top_scale_y_; } + + // The transformation matrix of the current context. It's used to construct + // the LayerRasterCacheKey for a given layer. + SkMatrix Matrix() const { return SkMatrix::MakeScale(ScaleX(), ScaleY()); } + + bool HasRetainedNode(const LayerRasterCacheKey& key) const { + return surface_producer_->HasRetainedNode(key); + } + const scenic::EntityNode& GetRetainedNode(const LayerRasterCacheKey& key) { + return surface_producer_->GetRetainedNode(key); + } + private: struct PaintTask { std::unique_ptr surface; @@ -158,23 +195,35 @@ class SceneUpdateContext { std::vector layers; }; - void CreateFrame(scenic::EntityNode& entity_node, + // Setup the entity_node as a frame that materialize all the paint_layers. In + // most cases, this creates a VulkanSurface (SurfaceProducerSurface) by + // calling SetShapeTextureOrColor and GenerageImageIfNeeded. Such surface will + // own the associated entity_node. If the layer pointer isn't nullptr, the + // surface (and thus the entity_node) will be retained for that layer to + // improve the performance. + void CreateFrame(std::unique_ptr entity_node, const SkRRect& rrect, SkColor color, const SkRect& paint_bounds, - std::vector paint_layers); + std::vector paint_layers, + Layer* layer); void SetShapeTextureOrColor(scenic::ShapeNode& shape_node, SkColor color, SkScalar scale_x, SkScalar scale_y, const SkRect& paint_bounds, - std::vector paint_layers); + std::vector paint_layers, + Layer* layer, + std::unique_ptr entity_node); void SetShapeColor(scenic::ShapeNode& shape_node, SkColor color); - scenic::Image* GenerateImageIfNeeded(SkColor color, - SkScalar scale_x, - SkScalar scale_y, - const SkRect& paint_bounds, - std::vector paint_layers); + scenic::Image* GenerateImageIfNeeded( + SkColor color, + SkScalar scale_x, + SkScalar scale_y, + const SkRect& paint_bounds, + std::vector paint_layers, + Layer* layer, + std::unique_ptr entity_node); Entity* top_entity_ = nullptr; float top_scale_x_ = 1.f; From 4812a2af115ce81c0ad1dec8680fdf9ea7dd4fc4 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Mon, 4 Feb 2019 13:31:21 -0800 Subject: [PATCH 0039/1117] DCHECK that clip layer's behavior isn't none (#7659) This will further guard that the framework won't forget to set the clip behavior. This has been tested with the flutter/flutter framework `flutter test --local-engine=host_debug_unopt` to ensure a successful engine roll. --- flow/layers/clip_path_layer.cc | 4 +++- flow/layers/clip_rect_layer.cc | 4 +++- flow/layers/clip_rrect_layer.cc | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/flow/layers/clip_path_layer.cc b/flow/layers/clip_path_layer.cc index c6259de22aa53..a8b23ee4903b8 100644 --- a/flow/layers/clip_path_layer.cc +++ b/flow/layers/clip_path_layer.cc @@ -13,7 +13,9 @@ namespace flow { ClipPathLayer::ClipPathLayer(Clip clip_behavior) - : clip_behavior_(clip_behavior) {} + : clip_behavior_(clip_behavior) { + FML_DCHECK(clip_behavior != Clip::none); +} ClipPathLayer::~ClipPathLayer() = default; diff --git a/flow/layers/clip_rect_layer.cc b/flow/layers/clip_rect_layer.cc index 3f39daca244c2..9e4d06df8b18e 100644 --- a/flow/layers/clip_rect_layer.cc +++ b/flow/layers/clip_rect_layer.cc @@ -7,7 +7,9 @@ namespace flow { ClipRectLayer::ClipRectLayer(Clip clip_behavior) - : clip_behavior_(clip_behavior) {} + : clip_behavior_(clip_behavior) { + FML_DCHECK(clip_behavior != Clip::none); +} ClipRectLayer::~ClipRectLayer() = default; diff --git a/flow/layers/clip_rrect_layer.cc b/flow/layers/clip_rrect_layer.cc index 896ec1ae27f10..b4b968bb3960f 100644 --- a/flow/layers/clip_rrect_layer.cc +++ b/flow/layers/clip_rrect_layer.cc @@ -7,7 +7,9 @@ namespace flow { ClipRRectLayer::ClipRRectLayer(Clip clip_behavior) - : clip_behavior_(clip_behavior) {} + : clip_behavior_(clip_behavior) { + FML_DCHECK(clip_behavior != Clip::none); +} ClipRRectLayer::~ClipRRectLayer() = default; From fde59006da245dc90503919ea9091b9a56d74fb2 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 4 Feb 2019 17:02:15 -0500 Subject: [PATCH 0040/1117] Roll src/third_party/skia d7a5a1d27e1d..50ea3c06b80f (9 commits) (#7688) https://skia.googlesource.com/skia.git/%2Blog/d7a5a1d27e1d..50ea3c06b80f git log d7a5a1d27e1d3ecc1ef4dfa1cef38195daf99f67..50ea3c06b80f7322c64fd99926edcdd7ea398213 --date=short --no-merges --format=%ad %ae %s 2019-02-04 brianosman@google.com Add support for MSVC run-time checks (and control flow guard) 2019-02-04 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-04 halcanary@google.com SkPDF to use aliased em bounds. 2019-02-04 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3f5a479280cc..612345523a8d (2 commits) 2019-02-04 reed@google.com templatize drawString 2019-02-04 egdaniel@google.com Minor clean ups to vulkan hardware buffer test. 2019-02-04 robertphillips@google.com Move GrContextOptions to GrContext_Base and make GrContextThreadSafeProxy be derived from GrContext_Base 2019-02-04 reed@google.com remove metadata from canvas 2019-01-31 herb@google.com Benchmark for charToGlyph The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index a038313e5336b..9ee0ee243ec9d 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': 'd7a5a1d27e1d3ecc1ef4dfa1cef38195daf99f67', + 'skia_revision': '50ea3c06b80f7322c64fd99926edcdd7ea398213', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index d6deaf25072a1..4eef3159e9ead 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f062937692335a9be503b3b81928e6ba +Signature: 36c4a454b9ac0cbe7ed95735c8186d70 UNUSED LICENSES: @@ -1678,6 +1678,7 @@ 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/bench/TypefaceBench.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 From 2f18c32862bc7a9092850c43a21c5282a95edf00 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Mon, 4 Feb 2019 14:56:13 -0800 Subject: [PATCH 0041/1117] Lower the threshold to raster cache pictures (#7687) After removing clips by default, the OpCount of a picture drops significantly. That makes our old threshold suboptimal. The new threshold reflects the clip change and will improve our scroll performance by ~10% for complex_layout and flutter_gallery scroll benchmarks: (flutter_gallery) home_scroll_perf frame raster time: average 9.1ms -> 7.4ms 90th_percentile 11.3ms -> 9.2ms 99th_percentile 45ms -> 38ms complex_layout_scroll_perf frame raster time: average 4.8 -> 4.4ms 90th_percentile 7.8ms -> 5.4ms 99th_percentile 19ms -> 17ms This should also help mitigate issues like https://github.com/flutter/flutter/issues/24782 --- flow/raster_cache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index 0827a2de405e9..94e518e60124a 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -84,7 +84,7 @@ static bool IsPictureWorthRasterizing(SkPicture* picture, // TODO(abarth): We should find a better heuristic here that lets us avoid // wasting memory on trivial layers that are easy to re-rasterize every frame. - return picture->approximateOpCount() > 10; + return picture->approximateOpCount() > 5; } static RasterCacheResult Rasterize( From 174b73c21af8b1f61865d0fa855a6b0ddc81c953 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 4 Feb 2019 16:04:09 -0800 Subject: [PATCH 0042/1117] Roll src/third_party/dart 3e5ed47777..b53dceadaa (5 commits) b53dceadaa Update pubspec for dev_compiler and sourcemap_testing eefc18dc82 Add a hook to AnalysisDriver on the current session to be discarded. cda43dabda Use findNode.simple in migration test bd51d6f120 [vm] Build scopes for implicit getters of static const fields b876d12f03 Revert "[vm/compiler] Continued graph checker development" --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 9ee0ee243ec9d..ebc8c4021d14f 100644 --- a/DEPS +++ b/DEPS @@ -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': '3e5ed477777b576bd451d19735f53ee9a5e749fe', + 'dart_revision': 'b53dceadaa12672954f8f128ba486f578a03f8ff', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index ba3437e8647ee..da6c135f76f9f 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: fb54646f5c94d18c6fe5c3e645d0bf05 +Signature: 3780931f44f0da4df096746e2a33a1b2 UNUSED LICENSES: From f38f03fc883c8006f0896f61ff91acd9171e4453 Mon Sep 17 00:00:00 2001 From: Yunyu Lin Date: Mon, 4 Feb 2019 19:59:12 -0500 Subject: [PATCH 0043/1117] Replace hb_face_reference_table with hb_ot_color_has_png in isColorBitmapFont (#7686) --- third_party/txt/src/minikin/Layout.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/third_party/txt/src/minikin/Layout.cpp b/third_party/txt/src/minikin/Layout.cpp index fa30e1ab50a53..857c744b939fa 100644 --- a/third_party/txt/src/minikin/Layout.cpp +++ b/third_party/txt/src/minikin/Layout.cpp @@ -286,8 +286,7 @@ hb_font_funcs_t* getHbFontFuncs(bool forColorBitmapFont) { static bool isColorBitmapFont(hb_font_t* font) { hb_face_t* face = hb_font_get_face(font); - HbBlob cbdt(hb_face_reference_table(face, HB_TAG('C', 'B', 'D', 'T'))); - return cbdt.size() > 0; + return hb_ot_color_has_png(face); } static float HBFixedToFloat(hb_position_t v) { From 93aa035dd46999353d8f7fe4be61e6599c794b4b Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Mon, 4 Feb 2019 17:04:08 -0800 Subject: [PATCH 0044/1117] Don't warn for Async texture uploads on Fuchsia (#7691) --- shell/common/io_manager.cc | 2 ++ shell/common/platform_view.cc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/shell/common/io_manager.cc b/shell/common/io_manager.cc index b5393831cdb72..996b14ed3d974 100644 --- a/shell/common/io_manager.cc +++ b/shell/common/io_manager.cc @@ -53,9 +53,11 @@ IOManager::IOManager(sk_sp resource_context, fml::TimeDelta::FromMilliseconds(250))), weak_factory_(this) { if (!resource_context_) { +#ifndef OS_FUCHSIA FML_DLOG(WARNING) << "The IO manager was initialized without a resource " "context. Async texture uploads will be disabled. " "Expect performance degradation."; +#endif // OS_FUCHSIA } } diff --git a/shell/common/platform_view.cc b/shell/common/platform_view.cc index 4a4e7df074248..7c7c1dc258aad 100644 --- a/shell/common/platform_view.cc +++ b/shell/common/platform_view.cc @@ -68,8 +68,10 @@ void PlatformView::NotifyDestroyed() { } sk_sp PlatformView::CreateResourceContext() const { +#ifndef OS_FUCHSIA FML_DLOG(WARNING) << "This platform does not setup the resource " "context on the IO thread for async texture uploads."; +#endif // OS_FUCHSIA return nullptr; } From 8b5fa65c43a4a540d1b41feadd0c40090a6f2f71 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 4 Feb 2019 20:40:30 -0500 Subject: [PATCH 0045/1117] Roll src/third_party/skia 50ea3c06b80f..2d35a1c87553 (6 commits) (#7693) https://skia.googlesource.com/skia.git/%2Blog/50ea3c06b80f..2d35a1c87553 git log 50ea3c06b80f7322c64fd99926edcdd7ea398213..2d35a1c875539b744631a75a037f2b5d2e72c31f --date=short --no-merges --format=%ad %ae %s 2019-02-01 egdaniel@google.com Move texture release proc to GrSurface so that render targets can also have releases. 2019-02-04 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-04 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 612345523a8d..049ff3873334 (1 commits) 2019-02-04 bungeman@google.com Extend GetAlphaTextureBounds workaround. 2019-02-04 bungeman@google.com Make HR* macros statements. 2019-02-04 robertphillips@google.com Rename GrContext::contextPriv to priv The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index ebc8c4021d14f..bd164f1e26d89 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': '50ea3c06b80f7322c64fd99926edcdd7ea398213', + 'skia_revision': '2d35a1c875539b744631a75a037f2b5d2e72c31f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 4eef3159e9ead..324b87dd3ab55 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 36c4a454b9ac0cbe7ed95735c8186d70 +Signature: 9c973b58e35bf1b511604299a4ac4ef9 UNUSED LICENSES: From ec5e6f6ef90485037ad069860d27d41ae772ff49 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Mon, 4 Feb 2019 17:48:52 -0800 Subject: [PATCH 0046/1117] Ensure dart2js and kernel worker snapshots are copied out of gen dir (#7692) --- BUILD.gn | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 89a6c0b863d22..366cccad20196 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -4,6 +4,18 @@ import("$flutter_root/common/config.gni") +# Temporary snapshot copy rules until we can use the full SDK. +_flutter_sdk_snapshots = [ + [ + "dart2js", + "//third_party/dart/utils/compiler:dart2js", + ], + [ + "kernel_worker", + "//third_party/dart/utils/bazel:kernel_worker", + ], +] + group("flutter") { testonly = true @@ -23,9 +35,10 @@ group("flutter") { public_deps += [ "$flutter_root/frontend_server", "//third_party/dart:create_sdk", - "//third_party/dart:dart2js", - "//third_party/dart/utils/bazel:kernel_worker", ] + foreach(snapshot, _flutter_sdk_snapshots) { + public_deps += [ ":copy_flutter_${snapshot[0]}_snapshot" ] + } } } @@ -63,3 +76,17 @@ group("dist") { "$flutter_root/sky/dist", ] } + +foreach(snapshot, _flutter_sdk_snapshots) { + copy("copy_flutter_${snapshot[0]}_snapshot") { + deps = [ + snapshot[1], + ] + sources = [ + "$root_gen_dir/${snapshot[0]}.dart.snapshot", + ] + outputs = [ + "$root_out_dir/dart-sdk/bin/snapshots/flutter_{{source_file_part}}", + ] + } +} From 9c05cbcfb1cb3fad9026d750f1cc52c5af1c953d Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 4 Feb 2019 19:08:08 -0800 Subject: [PATCH 0047/1117] Roll src/third_party/dart b53dceadaa..5823be65af (5 commits) 5823be65af [vm/compiler] Continued graph checker development (reland) 8231cdb7a3 [gardening] Update status for issue 35854 db7f848632 [vm] Remove dead BigInt code. 35ab1755f4 Support more type propagation for code-as-ui features 569ee07f91 [vm] Cleanup class finalization checks --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index bd164f1e26d89..b0547afe5f0ac 100644 --- a/DEPS +++ b/DEPS @@ -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': 'b53dceadaa12672954f8f128ba486f578a03f8ff', + 'dart_revision': '5823be65af2662b359c04528756798f5441c7305', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index da6c135f76f9f..fa3dffc69341a 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 3780931f44f0da4df096746e2a33a1b2 +Signature: d3ce948332650c24d861ffe66f05086a UNUSED LICENSES: From cc27cafb840f6fd57b86a36a3e7ed5461575f10a Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Mon, 4 Feb 2019 19:30:15 -0800 Subject: [PATCH 0048/1117] Implemented Dark Mode for Android (#25525) (#7488) --- ci/licenses_golden/licenses_flutter | 3 + lib/ui/hooks.dart | 6 + lib/ui/window.dart | 22 ++ shell/platform/android/BUILD.gn | 3 + .../io/flutter/app/FlutterActivity.java | 6 +- .../flutter/app/FlutterActivityDelegate.java | 6 +- .../embedding/engine/dart/DartExecutor.java | 277 ++++++++++++++++++ .../embedding/engine/dart/DartMessenger.java | 109 +++++++ .../systemchannels/SettingsChannel.java | 68 +++++ .../android/io/flutter/view/FlutterView.java | 30 +- .../dart/window_hooks_integration_test.dart | 20 ++ 11 files changed, 537 insertions(+), 13 deletions(-) create mode 100644 shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java create mode 100644 shell/platform/android/io/flutter/embedding/engine/dart/DartMessenger.java create mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/SettingsChannel.java diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index b2ed5bab64c99..91d15b8fcdc38 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -423,9 +423,12 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterFragmentActi FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterPluginRegistry.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/dart/DartExecutor.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartMessenger.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/engine/systemchannels/SettingsChannel.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 diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index 424028b391c11..3f536d2fa1196 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -86,6 +86,7 @@ void _updateUserSettingsData(String jsonData) { } _updateTextScaleFactor(data['textScaleFactor'].toDouble()); _updateAlwaysUse24HourFormat(data['alwaysUse24HourFormat']); + _updatePlatformBrightness(data['platformBrightness']); } void _updateTextScaleFactor(double textScaleFactor) { @@ -97,6 +98,11 @@ void _updateAlwaysUse24HourFormat(bool alwaysUse24HourFormat) { window._alwaysUse24HourFormat = alwaysUse24HourFormat; } +void _updatePlatformBrightness(String brightnessName) { + window._platformBrightness = brightnessName == 'dark' ? Brightness.dark : Brightness.light; + _invoke(window.onPlatformBrightnessChanged, window._onPlatformBrightnessChangedZone); +} + @pragma('vm:entry-point') // ignore: unused_element void _updateSemanticsEnabled(bool enabled) { diff --git a/lib/ui/window.dart b/lib/ui/window.dart index 72046ff85928d..16dc145a06fdd 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -590,6 +590,28 @@ class Window { _onTextScaleFactorChangedZone = Zone.current; } + /// The setting indicating the current brightness mode of the host platform. + /// If the platform has no preference, [platformBrightness] defaults to [Brightness.light]. + Brightness get platformBrightness => _platformBrightness; + Brightness _platformBrightness = Brightness.light; + + /// A callback that is invoked whenever [platformBrightness] changes value. + /// + /// The framework invokes this callback in the same zone in which the + /// callback was set. + /// + /// See also: + /// + /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to + /// observe when this callback is invoked. + VoidCallback get onPlatformBrightnessChanged => _onPlatformBrightnessChanged; + VoidCallback _onPlatformBrightnessChanged; + Zone _onPlatformBrightnessChangedZone; + set onPlatformBrightnessChanged(VoidCallback callback) { + _onPlatformBrightnessChanged = callback; + _onPlatformBrightnessChangedZone = Zone.current; + } + /// A callback that is invoked to notify the application that it is an /// appropriate time to provide a scene using the [SceneBuilder] API and the /// [render] method. When possible, this is driven by the hardware VSync diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index e9d2a961f81a6..1b49602f25d0a 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -108,9 +108,12 @@ java_library("flutter_shell_java") { "io/flutter/app/FlutterPluginRegistry.java", "io/flutter/embedding/engine/FlutterEngine.java", "io/flutter/embedding/engine/FlutterJNI.java", + "io/flutter/embedding/engine/dart/DartExecutor.java", + "io/flutter/embedding/engine/dart/DartMessenger.java", "io/flutter/embedding/engine/dart/PlatformMessageHandler.java", "io/flutter/embedding/engine/renderer/FlutterRenderer.java", "io/flutter/embedding/engine/renderer/OnFirstFrameRenderedListener.java", + "io/flutter/embedding/engine/systemchannels/SettingsChannel.java", "io/flutter/plugin/common/ActivityLifecycleListener.java", "io/flutter/plugin/common/BasicMessageChannel.java", "io/flutter/plugin/common/BinaryCodec.java", diff --git a/shell/platform/android/io/flutter/app/FlutterActivity.java b/shell/platform/android/io/flutter/app/FlutterActivity.java index 33c7e75d1772d..7b8052b261df4 100644 --- a/shell/platform/android/io/flutter/app/FlutterActivity.java +++ b/shell/platform/android/io/flutter/app/FlutterActivity.java @@ -9,6 +9,8 @@ import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; +import android.support.annotation.NonNull; +import android.util.Log; import io.flutter.app.FlutterActivityDelegate.ViewFactory; import io.flutter.plugin.common.PluginRegistry; import io.flutter.view.FlutterNativeView; @@ -18,6 +20,8 @@ * Base class for activities that use Flutter. */ public class FlutterActivity extends Activity implements FlutterView.Provider, PluginRegistry, ViewFactory { + private static final String TAG = "FlutterActivity"; + private final FlutterActivityDelegate delegate = new FlutterActivityDelegate(this, this); // These aliases ensure that the methods we forward to the delegate adhere @@ -129,7 +133,7 @@ protected void onPostResume() { } // @Override - added in API level 23 - public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { eventDelegate.onRequestPermissionsResult(requestCode, permissions, grantResults); } diff --git a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java index 5f566993605b4..4230208eb4608 100644 --- a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java +++ b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java @@ -8,6 +8,7 @@ import android.animation.AnimatorListenerAdapter; import android.app.Activity; import android.app.Application; +import android.app.UiModeManager; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; @@ -283,8 +284,7 @@ public void onLowMemory() { } @Override - public void onConfigurationChanged(Configuration newConfig) { - } + public void onConfigurationChanged(Configuration newConfig) {} private static String[] getArgsFromIntent(Intent intent) { // Before adding more entries to this list, consider that arbitrary @@ -399,7 +399,7 @@ private Drawable getLaunchScreenDrawableFromActivityTheme() { if (!activity.getTheme().resolveAttribute( android.R.attr.windowBackground, typedValue, - true)) {; + true)) { return null; } if (typedValue.resourceId == 0) { diff --git a/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java b/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java new file mode 100644 index 0000000000000..28d6f52772016 --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java @@ -0,0 +1,277 @@ +// Copyright 2013 The Flutter 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.AssetManager; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.util.Log; + +import java.nio.ByteBuffer; + +import io.flutter.embedding.engine.FlutterJNI; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.view.FlutterCallbackInformation; + +/** + * Configures, bootstraps, and starts executing Dart code. + *

+ * WARNING: THIS CLASS IS EXPERIMENTAL. DO NOT SHIP A DEPENDENCY ON THIS CODE. + * IF YOU USE IT, WE WILL BREAK YOU. + *

+ * To specify a top-level Dart function to execute, use a {@link DartEntrypoint} to tell + * {@link DartExecutor} where to find the Dart code to execute, and which Dart function to use as + * the entrypoint. To execute the entrypoint, pass the {@link DartEntrypoint} to + * {@link #executeDartEntrypoint(DartEntrypoint)}. + *

+ * To specify a Dart callback to execute, use a {@link DartCallback}. A given Dart callback must + * be registered with the Dart VM to be invoked by a {@link DartExecutor}. To execute the callback, + * pass the {@link DartCallback} to {@link #executeDartCallback(DartCallback)}. + * TODO(mattcarroll): add a reference to docs about background/plugin execution + *

+ * Once started, a {@link DartExecutor} cannot be stopped. The associated Dart code will execute + * until it completes, or until the {@link io.flutter.embedding.engine.FlutterEngine} that owns + * this {@link DartExecutor} is destroyed. + */ +public class DartExecutor implements BinaryMessenger { + private static final String TAG = "DartExecutor"; + + private final FlutterJNI flutterJNI; + private final DartMessenger messenger; + private boolean isApplicationRunning = false; + + public DartExecutor(@NonNull FlutterJNI flutterJNI) { + this.flutterJNI = flutterJNI; + this.messenger = new DartMessenger(flutterJNI); + } + + /** + * Invoked when the {@link io.flutter.embedding.engine.FlutterEngine} that owns this + * {@link DartExecutor} attaches to JNI. + *

+ * When attached to JNI, this {@link DartExecutor} begins handling 2-way communication to/from + * the Dart execution context. This communication is facilitate via 2 APIs: + * - {@link BinaryMessenger}, which sends messages to Dart + * - {@link PlatformMessageHandler}, which receives messages from Dart + */ + public void onAttachedToJNI() { + flutterJNI.setPlatformMessageHandler(messenger); + } + + /** + * Invoked when the {@link io.flutter.embedding.engine.FlutterEngine} that owns this + * {@link DartExecutor} detaches from JNI. + *

+ * When detached from JNI, this {@link DartExecutor} stops handling 2-way communication to/from + * the Dart execution context. + */ + public void onDetachedFromJNI() { + flutterJNI.setPlatformMessageHandler(null); + } + + /** + * Is this {@link DartExecutor} currently executing Dart code? + * + * @return true if Dart code is being executed, false otherwise + */ + public boolean isExecutingDart() { + return isApplicationRunning; + } + + /** + * Starts executing Dart code based on the given {@code dartEntrypoint}. + *

+ * See {@link DartEntrypoint} for configuration options. + * + * @param dartEntrypoint specifies which Dart function to run, and where to find it + */ + public void executeDartEntrypoint(DartEntrypoint dartEntrypoint) { + if (isApplicationRunning) { + Log.w(TAG, "Attempted to run a DartExecutor that is already running."); + return; + } + + flutterJNI.runBundleAndSnapshotFromLibrary( + new String[]{ + dartEntrypoint.pathToPrimaryBundle, + dartEntrypoint.pathToFallbackBundle + }, + dartEntrypoint.dartEntrypointFunctionName, + null, + dartEntrypoint.androidAssetManager + ); + + isApplicationRunning = true; + } + + /** + * Starts executing Dart code based on the given {@code dartCallback}. + *

+ * See {@link DartCallback} for configuration options. + * + * @param dartCallback specifies which Dart callback to run, and where to find it + */ + public void executeDartCallback(DartCallback dartCallback) { + if (isApplicationRunning) { + Log.w(TAG, "Attempted to run a DartExecutor that is already running."); + return; + } + + flutterJNI.runBundleAndSnapshotFromLibrary( + new String[]{ + dartCallback.pathToPrimaryBundle, + dartCallback.pathToFallbackBundle + }, + dartCallback.callbackHandle.callbackName, + dartCallback.callbackHandle.callbackLibraryPath, + dartCallback.androidAssetManager + ); + + isApplicationRunning = true; + } + + //------ START BinaryMessenger ----- + + /** + * Sends the given {@code message} from Android to Dart over the given {@code channel}. + * + * @param channel the name of the logical channel used for the message. + * @param message the message payload, a direct-allocated {@link ByteBuffer} with the message bytes + */ + @Override + public void send(String channel, ByteBuffer message) { + messenger.send(channel, message, null); + } + + /** + * Sends the given {@code messages} from Android to Dart over the given {@code channel} and + * then has the provided {@code callback} invoked when the Dart side responds. + * + * @param channel the name of the logical channel used for the message. + * @param message the message payload, a direct-allocated {@link ByteBuffer} with the message bytes + * between position zero and current position, or null. + * @param callback a callback invoked when the Dart application responds to the message + */ + @Override + public void send(String channel, ByteBuffer message, BinaryMessenger.BinaryReply callback) { + messenger.send(channel, message, callback); + } + + /** + * Sets the given {@link io.flutter.plugin.common.BinaryMessenger.BinaryMessageHandler} as the + * singular handler for all incoming messages received from the Dart side of this Dart execution + * context. + * + * @param channel the name of the channel. + * @param handler a {@link BinaryMessageHandler} to be invoked on incoming messages, or null. + */ + @Override + public void setMessageHandler(String channel, BinaryMessenger.BinaryMessageHandler handler) { + messenger.setMessageHandler(channel, handler); + } + //------ END BinaryMessenger ----- + + /** + * Configuration options that specify which Dart entrypoint function is executed and where + * to find that entrypoint and other assets required for Dart execution. + */ + public static class DartEntrypoint { + /** + * Standard Android AssetManager, provided from some {@code Context} or {@code Resources}. + */ + public final AssetManager androidAssetManager; + + /** + * The first place that Dart will look for a given function or asset. + */ + public final String pathToPrimaryBundle; + + /** + * A secondary fallback location that Dart will look for a given function or asset. + */ + public final String pathToFallbackBundle; + + /** + * The name of a Dart function to execute. + */ + public final String dartEntrypointFunctionName; + + public DartEntrypoint( + @NonNull AssetManager androidAssetManager, + @NonNull String pathToBundle, + @NonNull String dartEntrypointFunctionName + ) { + this( + androidAssetManager, + pathToBundle, + null, + dartEntrypointFunctionName + ); + } + + public DartEntrypoint( + @NonNull AssetManager androidAssetManager, + @NonNull String pathToPrimaryBundle, + @Nullable String pathToFallbackBundle, + @NonNull String dartEntrypointFunctionName + ) { + this.androidAssetManager = androidAssetManager; + this.pathToPrimaryBundle = pathToPrimaryBundle; + this.pathToFallbackBundle = pathToFallbackBundle; + this.dartEntrypointFunctionName = dartEntrypointFunctionName; + } + } + + /** + * Configuration options that specify which Dart callback function is executed and where + * to find that callback and other assets required for Dart execution. + */ + public static class DartCallback { + /** + * Standard Android AssetManager, provided from some {@code Context} or {@code Resources}. + */ + public final AssetManager androidAssetManager; + + /** + * The first place that Dart will look for a given function or asset. + */ + public final String pathToPrimaryBundle; + + /** + * A secondary fallback location that Dart will look for a given function or asset. + */ + public final String pathToFallbackBundle; + + /** + * A Dart callback that was previously registered with the Dart VM. + */ + public final FlutterCallbackInformation callbackHandle; + + public DartCallback( + @NonNull AssetManager androidAssetManager, + @NonNull String pathToPrimaryBundle, + @NonNull FlutterCallbackInformation callbackHandle + ) { + this( + androidAssetManager, + pathToPrimaryBundle, + null, + callbackHandle + ); + } + + public DartCallback( + @NonNull AssetManager androidAssetManager, + @NonNull String pathToPrimaryBundle, + @Nullable String pathToFallbackBundle, + @NonNull FlutterCallbackInformation callbackHandle + ) { + this.androidAssetManager = androidAssetManager; + this.pathToPrimaryBundle = pathToPrimaryBundle; + this.pathToFallbackBundle = pathToFallbackBundle; + this.callbackHandle = callbackHandle; + } + } +} \ No newline at end of file diff --git a/shell/platform/android/io/flutter/embedding/engine/dart/DartMessenger.java b/shell/platform/android/io/flutter/embedding/engine/dart/DartMessenger.java new file mode 100644 index 0000000000000..16a6b10b8a267 --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/dart/DartMessenger.java @@ -0,0 +1,109 @@ +// Copyright 2013 The Flutter 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.support.annotation.NonNull; +import android.util.Log; + +import java.nio.ByteBuffer; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; + +import io.flutter.embedding.engine.FlutterJNI; +import io.flutter.plugin.common.BinaryMessenger; + +/** + * Message conduit for 2-way communication between Android and Dart. + *

+ * WARNING: THIS CLASS IS EXPERIMENTAL. DO NOT SHIP A DEPENDENCY ON THIS CODE. + * IF YOU USE IT, WE WILL BREAK YOU. + *

+ * See {@link BinaryMessenger}, which sends messages from Android to Dart + * See {@link PlatformMessageHandler}, which handles messages to Android from Dart + */ +class DartMessenger implements BinaryMessenger, PlatformMessageHandler { + private static final String TAG = "DartMessenger"; + + private final FlutterJNI flutterJNI; + private final Map messageHandlers; + private final Map mPendingReplies = new HashMap<>(); + private int mNextReplyId = 1; + + DartMessenger(@NonNull FlutterJNI flutterJNI) { + this.flutterJNI = flutterJNI; + this.messageHandlers = new HashMap<>(); + } + + @Override + public void setMessageHandler(String channel, BinaryMessenger.BinaryMessageHandler handler) { + if (handler == null) { + messageHandlers.remove(channel); + } else { + messageHandlers.put(channel, handler); + } + } + + @Override + public void send(String channel, ByteBuffer message) { + send(channel, message, null); + } + + @Override + public void send(String channel, ByteBuffer message, BinaryMessenger.BinaryReply callback) { + int replyId = 0; + if (callback != null) { + replyId = mNextReplyId++; + mPendingReplies.put(replyId, callback); + } + if (message == null) { + flutterJNI.dispatchEmptyPlatformMessage(channel, replyId); + } else { + flutterJNI.dispatchPlatformMessage(channel, message, message.position(), replyId); + } + } + + @Override + public void handlePlatformMessage(final String channel, byte[] message, final int replyId) { + BinaryMessenger.BinaryMessageHandler handler = messageHandlers.get(channel); + if (handler != null) { + try { + final ByteBuffer buffer = (message == null ? null : ByteBuffer.wrap(message)); + handler.onMessage(buffer, new BinaryMessenger.BinaryReply() { + private final AtomicBoolean done = new AtomicBoolean(false); + + @Override + public void reply(ByteBuffer reply) { + if (done.getAndSet(true)) { + throw new IllegalStateException("Reply already submitted"); + } + if (reply == null) { + flutterJNI.invokePlatformMessageEmptyResponseCallback(replyId); + } else { + flutterJNI.invokePlatformMessageResponseCallback(replyId, reply, reply.position()); + } + } + }); + } catch (Exception ex) { + Log.e(TAG, "Uncaught exception in binary message listener", ex); + flutterJNI.invokePlatformMessageEmptyResponseCallback(replyId); + } + return; + } + flutterJNI.invokePlatformMessageEmptyResponseCallback(replyId); + } + + @Override + public void handlePlatformMessageResponse(int replyId, byte[] reply) { + BinaryMessenger.BinaryReply callback = mPendingReplies.remove(replyId); + if (callback != null) { + try { + callback.reply(reply == null ? null : ByteBuffer.wrap(reply)); + } catch (Exception ex) { + Log.e(TAG, "Uncaught exception in binary message reply handler", ex); + } + } + } +} \ No newline at end of file diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/SettingsChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/SettingsChannel.java new file mode 100644 index 0000000000000..612fe8fe49a44 --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/SettingsChannel.java @@ -0,0 +1,68 @@ +package io.flutter.embedding.engine.systemchannels; + +import android.support.annotation.NonNull; +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.plugin.common.BasicMessageChannel; +import io.flutter.plugin.common.JSONMessageCodec; + +import java.util.HashMap; +import java.util.Map; + +public class SettingsChannel { + public static final String CHANNEL_NAME = "flutter/settings"; + + public final BasicMessageChannel channel; + + public SettingsChannel(@NonNull DartExecutor dartExecutor) { + this.channel = new BasicMessageChannel<>(dartExecutor, CHANNEL_NAME, JSONMessageCodec.INSTANCE); + } + + public MessageBuilder startMessage() { + return new MessageBuilder(channel); + } + + public static class MessageBuilder { + private final BasicMessageChannel channel; + private Map message = new HashMap<>(); + + MessageBuilder(@NonNull BasicMessageChannel channel) { + this.channel = channel; + } + + public MessageBuilder setTextScaleFactor(float textScaleFactor) { + message.put("textScaleFactor", textScaleFactor); + return this; + } + + public MessageBuilder setUse24HourFormat(boolean use24HourFormat) { + message.put("alwaysUse24HourFormat", use24HourFormat); + return this; + } + + public MessageBuilder setPlatformBrightness(@NonNull PlatformBrightness brightness) { + message.put("platformBrightness", brightness.name); + return this; + } + + public void send() { + channel.send(message); + } + } + + /** + * The brightness mode of the host platform. + * + * The {@code name} property is the serialized representation of each + * brightness mode when communicated via message channel. + */ + public enum PlatformBrightness { + light("light"), + dark("dark"); + + public String name; + + PlatformBrightness(@NonNull String name) { + this.name = name; + } + } +} \ No newline at end of file diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index a5aa0d532aff1..e7d8c74ac6ddb 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -26,6 +26,8 @@ import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; import io.flutter.app.FlutterPluginRegistry; +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.embedding.engine.systemchannels.SettingsChannel; import io.flutter.plugin.common.*; import io.flutter.plugin.editing.TextInputPlugin; import io.flutter.plugin.platform.PlatformPlugin; @@ -78,6 +80,7 @@ static final class ViewportMetrics { int physicalViewInsetLeft = 0; } + private final DartExecutor dartExecutor; private final InputMethodManager mImm; private final TextInputPlugin mTextInputPlugin; private final SurfaceHolder.Callback mSurfaceCallback; @@ -88,7 +91,7 @@ static final class ViewportMetrics { private final BasicMessageChannel mFlutterKeyEventChannel; private final BasicMessageChannel mFlutterLifecycleChannel; private final BasicMessageChannel mFlutterSystemChannel; - private final BasicMessageChannel mFlutterSettingsChannel; + private final SettingsChannel settingsChannel; private final List mActivityLifecycleListeners; private final List mFirstFrameListeners; private final AtomicLong nextTextureId = new AtomicLong(0L); @@ -114,6 +117,7 @@ public FlutterView(Context context, AttributeSet attrs, FlutterNativeView native } else { mNativeView = nativeView; } + dartExecutor = new DartExecutor(mNativeView.getFlutterJNI()); mIsSoftwareRenderingEnabled = mNativeView.getFlutterJNI().nativeGetIsSoftwareRenderingEnabled(); mAnimationScaleObserver = new AnimationScaleObserver(new Handler()); mMetrics = new ViewportMetrics(); @@ -155,7 +159,7 @@ public void surfaceDestroyed(SurfaceHolder holder) { mFlutterKeyEventChannel = new BasicMessageChannel<>(this, "flutter/keyevent", JSONMessageCodec.INSTANCE); mFlutterLifecycleChannel = new BasicMessageChannel<>(this, "flutter/lifecycle", StringCodec.INSTANCE); mFlutterSystemChannel = new BasicMessageChannel<>(this, "flutter/system", JSONMessageCodec.INSTANCE); - mFlutterSettingsChannel = new BasicMessageChannel<>(this, "flutter/settings", JSONMessageCodec.INSTANCE); + settingsChannel = new SettingsChannel(dartExecutor); PlatformPlugin platformPlugin = new PlatformPlugin(activity); MethodChannel flutterPlatformChannel = new MethodChannel(this, "flutter/platform", JSONMethodCodec.INSTANCE); @@ -166,7 +170,7 @@ public void surfaceDestroyed(SurfaceHolder holder) { setLocales(getResources().getConfiguration()); - setUserSettings(); + sendUserPlatformSettingsToDart(); } private void encodeKeyEvent(KeyEvent event, Map message) { @@ -304,11 +308,19 @@ public void popRoute() { mFlutterNavigationChannel.invokeMethod("popRoute", null); } - private void setUserSettings() { - Map message = new HashMap<>(); - message.put("textScaleFactor", getResources().getConfiguration().fontScale); - message.put("alwaysUse24HourFormat", DateFormat.is24HourFormat(getContext())); - mFlutterSettingsChannel.send(message); + private void sendUserPlatformSettingsToDart() { + // Lookup the current brightness of the Android OS. + boolean isNightModeOn = (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; + SettingsChannel.PlatformBrightness brightness = isNightModeOn + ? SettingsChannel.PlatformBrightness.dark + : SettingsChannel.PlatformBrightness.light; + + settingsChannel + .startMessage() + .setTextScaleFactor(getResources().getConfiguration().fontScale) + .setUse24HourFormat(DateFormat.is24HourFormat(getContext())) + .setPlatformBrightness(brightness) + .send(); } private void setLocales(Configuration config) { @@ -344,7 +356,7 @@ private void setLocales(Configuration config) { protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); setLocales(newConfig); - setUserSettings(); + sendUserPlatformSettingsToDart(); } float getDevicePixelRatio() { diff --git a/testing/dart/window_hooks_integration_test.dart b/testing/dart/window_hooks_integration_test.dart index a7a8b81a9a1ad..3925594fd3884 100644 --- a/testing/dart/window_hooks_integration_test.dart +++ b/testing/dart/window_hooks_integration_test.dart @@ -246,5 +246,25 @@ void main() { expect(runZone, same(innerZone)); expect(textScaleFactor, equals(0.5)); }); + + test('onThemeBrightnessMode preserves callback zone', () { + Zone innerZone; + Zone runZone; + Brightness platformBrightness; + + runZoned(() { + innerZone = Zone.current; + window.onPlatformBrightnessChanged = () { + runZone = Zone.current; + platformBrightness = window.platformBrightness; + }; + }); + + window.onPlatformBrightnessChanged(); + _updatePlatformBrightness('dark'); + expect(runZone, isNotNull); + expect(runZone, same(innerZone)); + expect(platformBrightness, equals(Brightness.dark)); + }); }); } From ad525410d72b92dcab066595b7f15d7e52223a55 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 5 Feb 2019 00:21:17 -0500 Subject: [PATCH 0049/1117] Roll src/third_party/skia 2d35a1c87553..bb60677d5244 (1 commits) (#7696) https://skia.googlesource.com/skia.git/%2Blog/2d35a1c87553..bb60677d5244 git log 2d35a1c875539b744631a75a037f2b5d2e72c31f..bb60677d5244cb20ec659d035701e92cd1f6f4fa --date=short --no-merges --format=%ad %ae %s 2019-02-04 robertphillips@google.com Move caps and FP factory cache to GrContext_Base The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index b0547afe5f0ac..ec2dbeb76edca 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': '2d35a1c875539b744631a75a037f2b5d2e72c31f', + 'skia_revision': 'bb60677d5244cb20ec659d035701e92cd1f6f4fa', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 324b87dd3ab55..12559bb836b86 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 9c973b58e35bf1b511604299a4ac4ef9 +Signature: 5129b7f80d4cc635e804c6060c1bd280 UNUSED LICENSES: From e26eab83a4bbf68bbfaf50b12e9768e2af241be8 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 5 Feb 2019 04:08:52 -0500 Subject: [PATCH 0050/1117] Roll src/third_party/skia bb60677d5244..0783aca7ba31 (1 commits) (#7697) https://skia.googlesource.com/skia.git/%2Blog/bb60677d5244..0783aca7ba31 git log bb60677d5244cb20ec659d035701e92cd1f6f4fa..0783aca7ba3189092855b373911cffc1b1303222 --date=short --no-merges --format=%ad %ae %s 2019-02-05 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index ec2dbeb76edca..5c6b611f77253 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': 'bb60677d5244cb20ec659d035701e92cd1f6f4fa', + 'skia_revision': '0783aca7ba3189092855b373911cffc1b1303222', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 12559bb836b86..7d6b843fcf21b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 5129b7f80d4cc635e804c6060c1bd280 +Signature: 3d8461364b1f39f091d083e56c3e924d UNUSED LICENSES: From ac003c4830b37099782d53263b45c77c3418ae2c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 5 Feb 2019 07:55:45 -0500 Subject: [PATCH 0051/1117] Roll src/third_party/skia 0783aca7ba31..2462ca36c800 (2 commits) (#7698) https://skia.googlesource.com/skia.git/%2Blog/0783aca7ba31..2462ca36c800 git log 0783aca7ba3189092855b373911cffc1b1303222..2462ca36c800adfaaafe5921475096c107091c9b --date=short --no-merges --format=%ad %ae %s 2019-02-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 049ff3873334..8f71f7311f29 (1 commits) 2019-02-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 950d2f4a3353..6c1a9ccaf5f3 (394 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 5c6b611f77253..2184ac364df02 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': '0783aca7ba3189092855b373911cffc1b1303222', + 'skia_revision': '2462ca36c800adfaaafe5921475096c107091c9b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 7d6b843fcf21b..632fb9cb5fc92 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 3d8461364b1f39f091d083e56c3e924d +Signature: a8693aacf19f781d49b3050657d3d3ac UNUSED LICENSES: From 2c25936ecdb243492529a7cec51acadfba3729e3 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 5 Feb 2019 11:46:39 -0500 Subject: [PATCH 0052/1117] Roll src/third_party/skia 2462ca36c800..5f5e1d57a4ce (7 commits) (#7699) https://skia.googlesource.com/skia.git/%2Blog/2462ca36c800..5f5e1d57a4ce git log 2462ca36c800adfaaafe5921475096c107091c9b..5f5e1d57a4cef2f22e037fe7338dddff28ffa6a0 --date=short --no-merges --format=%ad %ae %s 2019-02-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 8f71f7311f29..24f3d30cdec3 (1 commits) 2019-02-05 egdaniel@google.com Add release proc apis to SkSurface::MakeFromBackend* calls. 2019-02-05 brianosman@google.com Fix RTCc issue (truncating 64 bit value) in GrVkRenderPass 2019-02-05 bsalomon@google.com Convert GrBufferType to enum class, rename, and remove dead values 2019-02-05 egdaniel@google.com Have GrMtlTexture and GrMtlRenderTarget call parents onRelease/Abandon. 2019-02-04 reed@google.com remove mention of SkMetaData 2019-02-05 robertphillips@google.com Fix generated files The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 2184ac364df02..d5e75ae779587 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': '2462ca36c800adfaaafe5921475096c107091c9b', + 'skia_revision': '5f5e1d57a4cef2f22e037fe7338dddff28ffa6a0', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 632fb9cb5fc92..a8125042e6d2a 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: a8693aacf19f781d49b3050657d3d3ac +Signature: 6caee1f06b02345eef4b3d6ac2bbcc7b UNUSED LICENSES: From 2f87713d4074afe4970ae55256100b50819d5315 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Tue, 5 Feb 2019 11:17:21 -0800 Subject: [PATCH 0053/1117] Revert "Disable the persistent cache (#6835)" (#7689) This reverts commit 093b2fea8ac09fb1e9e0d712dbdecc0a09f2c1ad. For https://github.com/flutter/flutter/issues/24058, We now only get a "Program linking failed" error message on Windows Android simulators without crahsing. Skia seems to have handled the linking failure in https://skia-review.googlesource.com/c/skia/+/180372 by rebuilding the program. --- shell/common/persistent_cache.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/shell/common/persistent_cache.cc b/shell/common/persistent_cache.cc index 95d2b6f9ecfab..c3f6ebf025034 100644 --- a/shell/common/persistent_cache.cc +++ b/shell/common/persistent_cache.cc @@ -40,8 +40,16 @@ PersistentCache* PersistentCache::GetCacheForProcess() { return gPersistentCache.get(); } -PersistentCache::PersistentCache() { - // TODO(chinmaygarde): Reenable caching, avoiding the windows crasher. +PersistentCache::PersistentCache() + : cache_directory_(std::make_shared( + CreateDirectory(fml::paths::GetCachesDirectory(), + { + "flutter_engine", // + blink::GetFlutterEngineVersion(), // + "skia", // + blink::GetSkiaVersion() // + }, + fml::FilePermission::kReadWrite))) { if (!IsValid()) { FML_LOG(WARNING) << "Could not acquire the persistent cache directory. " "Caching of GPU resources on disk is disabled."; From 0b014c4ac469344d5166567f174ef2592cc1b099 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 5 Feb 2019 16:37:11 -0500 Subject: [PATCH 0054/1117] Roll src/third_party/skia 5f5e1d57a4ce..0ec8ec27b81c (6 commits) (#7703) https://skia.googlesource.com/skia.git/%2Blog/5f5e1d57a4ce..0ec8ec27b81c git log 5f5e1d57a4cef2f22e037fe7338dddff28ffa6a0..0ec8ec27b81ca3ae46cfc4e85297e09b2c592943 --date=short --no-merges --format=%ad %ae %s 2018-09-04 bungeman@google.com Add a 'correct' shaper. 2019-02-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 4b9e06d6a2df..09a91e48c066 (1 commits) 2019-02-04 halcanary@google.com GN/ICU cleanup 2019-02-05 mtklein@google.com disable DAA by default 2019-02-05 brianosman@google.com Add "MSRTC" bots that build/test with MSVC runtime checks enabled 2019-02-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 24f3d30cdec3..4b9e06d6a2df (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d5e75ae779587..fe3d23b6097f3 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': '5f5e1d57a4cef2f22e037fe7338dddff28ffa6a0', + 'skia_revision': '0ec8ec27b81ca3ae46cfc4e85297e09b2c592943', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a8125042e6d2a..6bc9d789c9cae 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 6caee1f06b02345eef4b3d6ac2bbcc7b +Signature: d2517d3798d1c3a7fb136c480a933df5 UNUSED LICENSES: @@ -2345,6 +2345,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-Debug-Exceptions.json 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/Build-Win-MSVC-x86_64-Debug-MSRTC.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 @@ -2505,6 +2506,7 @@ FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clan FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win2016-Clang-GCE-CPU-AVX2-x86_64-Debug-All-FAAA.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win2016-Clang-GCE-CPU-AVX2-x86_64-Debug-All-FDAA.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win2016-Clang-GCE-CPU-AVX2-x86_64-Debug-All-FSAA.json +FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win2016-MSVC-GCE-CPU-AVX2-x86_64-Debug-All-MSRTC.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-iOS-Clang-iPadPro-GPU-PowerVRGT7800-arm64-Release-All.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/failed_dm.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/failed_get_hashes.json From 351f5a35f3956c7d9a7bd17d5b9b766110f23f30 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Tue, 5 Feb 2019 14:09:18 -0800 Subject: [PATCH 0055/1117] Use the Wuffs GIF decoder (#7658) Fixes https://github.com/flutter/flutter/issues/23838 --- DEPS | 3 + ci/licenses_golden/licenses_skia | 582 +----------------------- ci/licenses_golden/licenses_third_party | 285 +++++++++++- ci/licenses_golden/tool_signature | 2 +- tools/gn | 1 + tools/licenses/lib/licenses.dart | 1 + tools/licenses/lib/main.dart | 20 + tools/licenses/lib/patterns.dart | 2 +- 8 files changed, 312 insertions(+), 584 deletions(-) diff --git a/DEPS b/DEPS index fe3d23b6097f3..8817e7a51faef 100644 --- a/DEPS +++ b/DEPS @@ -369,6 +369,9 @@ deps = { 'src/third_party/libwebp': Var('chromium_git') + '/webm/libwebp.git' + '@' + '0.6.0', + 'src/third_party/wuffs': + Var('fuchsia_git') + '/third_party/wuffs' + '@' + 'a71538baa8f1f4053176c0d9f31bc12fd4e8e71b', + 'src/third_party/gyp': Var('chromium_git') + '/external/gyp.git' + '@' + '4801a5331ae62da9769a327f11c4213d32fb0dad', diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6bc9d789c9cae..ec7a5c01f45a4 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: d2517d3798d1c3a7fb136c480a933df5 +Signature: e37e24e6a26a9973cc56d0593a011cd8 UNUSED LICENSES: @@ -168,46 +168,6 @@ reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS ==================================================================================================== - -==================================================================================================== -ORIGIN: ../../../third_party/skia/third_party/gif/LICENSE -TYPE: LicenseType.unknown ----------------------------------------------------------------------------------------------------- -Version: MPL 1.1/GPL 2.0/LGPL 2.1 - -The contents of this file are subject to the Mozilla Public License Version -1.1 (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.mozilla.org/MPL - -Software distributed under the License is distributed on an "AS IS" basis, -WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -for the specific language governing rights and limitations under the -License. - -The Original Code is mozilla.org code. - -The Initial Developer of the Original Code is -Netscape Communications Corporation. -Portions created by the Initial Developer are Copyright (C) 1998 -the Initial Developer. All Rights Reserved. - -Contributor(s): - Chris Saari - Apple Computer - -Alternatively, the contents of this file may be used under the terms of -either the GNU General Public License Version 2 or later (the "GPL"), or -the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -in which case the provisions of the GPL or the LGPL are applicable instead -of those above. If you wish to allow use of your version of this file only -under the terms of either the GPL or the LGPL, and not to allow others to -use your version of this file under the terms of the MPL, indicate your -decision by deleting the provisions above and replace them with the notice -and other provisions required by the GPL or the LGPL. If you do not delete -the provisions above, a recipient may use your version of this file under -the terms of any one of the MPL, the GPL or the LGPL. -==================================================================================================== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USED LICENSES: @@ -432,544 +392,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================================================== -==================================================================================================== -LIBRARY: gif -ORIGIN: ../../../third_party/skia/third_party/gif/SkGifImageReader.cpp -TYPE: LicenseType.lgpl -FILE: ../../../third_party/skia/third_party/gif/SkGifImageReader.cpp -FILE: ../../../third_party/skia/third_party/gif/SkGifImageReader.h ----------------------------------------------------------------------------------------------------- -GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - -Copyright (C) 1991, 1999 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! -==================================================================================================== - -==================================================================================================== -LIBRARY: gif -ORIGIN: ../../../third_party/skia/third_party/gif/SkGifImageReader.cpp -TYPE: LicenseType.unknown -FILE: ../../../third_party/skia/third_party/gif/SkGifImageReader.cpp ----------------------------------------------------------------------------------------------------- -The Graphics Interchange Format(c) is the copyright property of CompuServe -Incorporated. Only CompuServe Incorporated is authorized to define, redefine, -enhance, alter, modify or change in any way the definition of the format. - -CompuServe Incorporated hereby grants a limited, non-exclusive, royalty-free -license for the use of the Graphics Interchange Format(sm) in computer -software; computer software utilizing GIF(sm) must acknowledge ownership of the -Graphics Interchange Format and its Service Mark by CompuServe Incorporated, in -User and Technical Documentation. Computer software utilizing GIF, which is -distributed or may be distributed without User or Technical Documentation must -display to the screen or printer a message acknowledging ownership of the -Graphics Interchange Format and the Service Mark by CompuServe Incorporated; in -this case, the acknowledgement may be displayed in an opening screen or leading -banner, or a closing screen or trailing banner. A message such as the following -may be used: - - "The Graphics Interchange Format(c) is the Copyright property of - CompuServe Incorporated. GIF(sm) is a Service Mark property of - CompuServe Incorporated." -==================================================================================================== - ==================================================================================================== LIBRARY: harfbuzz ORIGIN: ../../../third_party/skia/third_party/harfbuzz/hb-buffer-deserialize-json.hh @@ -6287,4 +5709,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: 56 +Total license count: 53 diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index fa3dffc69341a..de5fc54aa881b 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: d3ce948332650c24d861ffe66f05086a +Signature: 5a62c68e45af252f4d562ff51b4bd449 UNUSED LICENSES: @@ -388,6 +388,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. LIBRARY: boringssl LIBRARY: observatory_pub_packages LIBRARY: vulkan +LIBRARY: wuffs ORIGIN: ../../../flutter/third_party/txt/LICENSE TYPE: LicenseType.apache FILE: ../../../third_party/boringssl/src/third_party/wycheproof_testvectors/METADATA @@ -514,6 +515,101 @@ 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 +FILE: ../../../third_party/wuffs/cmd/commonflags/commonflags.go +FILE: ../../../third_party/wuffs/cmd/wuffs-c/genlib.go +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/base/all-impl.c +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/base/core-private.h +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/base/core-public.h +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/base/image-impl.c +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/base/image-private.h +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/base/image-public.h +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/base/io-private.h +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/base/io-public.h +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/base/memory-private.h +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/base/memory-public.h +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/base/range-private.h +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/base/range-public.h +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/builtin.go +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/cgen.go +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/data.go +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/expr.go +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/func.go +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/gen.go +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/resume.go +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/statement.go +FILE: ../../../third_party/wuffs/cmd/wuffs-c/internal/cgen/var.go +FILE: ../../../third_party/wuffs/cmd/wuffs-c/main.go +FILE: ../../../third_party/wuffs/cmd/wuffs-c/release.go +FILE: ../../../third_party/wuffs/cmd/wuffs-c/test.go +FILE: ../../../third_party/wuffs/cmd/wuffs/gen.go +FILE: ../../../third_party/wuffs/cmd/wuffs/main.go +FILE: ../../../third_party/wuffs/cmd/wuffs/release.go +FILE: ../../../third_party/wuffs/cmd/wuffs/test.go +FILE: ../../../third_party/wuffs/cmd/wuffsfmt/main.go +FILE: ../../../third_party/wuffs/example/crc32/crc32.cc +FILE: ../../../third_party/wuffs/example/gifplayer/gifplayer.c +FILE: ../../../third_party/wuffs/example/library/library.c +FILE: ../../../third_party/wuffs/example/zcat/zcat.c +FILE: ../../../third_party/wuffs/fuzz/c/fuzzlib/fuzzlib.c +FILE: ../../../third_party/wuffs/fuzz/c/std/gif_fuzzer.c +FILE: ../../../third_party/wuffs/fuzz/c/std/zlib_fuzzer.c +FILE: ../../../third_party/wuffs/lang/ast/ast.go +FILE: ../../../third_party/wuffs/lang/ast/eq.go +FILE: ../../../third_party/wuffs/lang/ast/sort.go +FILE: ../../../third_party/wuffs/lang/ast/string.go +FILE: ../../../third_party/wuffs/lang/ast/string_test.go +FILE: ../../../third_party/wuffs/lang/builtin/builtin.go +FILE: ../../../third_party/wuffs/lang/check/assert.go +FILE: ../../../third_party/wuffs/lang/check/bounds.go +FILE: ../../../third_party/wuffs/lang/check/check.go +FILE: ../../../third_party/wuffs/lang/check/check_test.go +FILE: ../../../third_party/wuffs/lang/check/data.go +FILE: ../../../third_party/wuffs/lang/check/gen.go +FILE: ../../../third_party/wuffs/lang/check/optimize.go +FILE: ../../../third_party/wuffs/lang/check/resolve.go +FILE: ../../../third_party/wuffs/lang/check/type.go +FILE: ../../../third_party/wuffs/lang/generate/generate.go +FILE: ../../../third_party/wuffs/lang/parse/parse.go +FILE: ../../../third_party/wuffs/lang/render/render.go +FILE: ../../../third_party/wuffs/lang/token/list.go +FILE: ../../../third_party/wuffs/lang/token/token.go +FILE: ../../../third_party/wuffs/lang/wuffsroot/wuffsroot.go +FILE: ../../../third_party/wuffs/lib/base38/base38.go +FILE: ../../../third_party/wuffs/lib/base38/base38_test.go +FILE: ../../../third_party/wuffs/lib/interval/interval.go +FILE: ../../../third_party/wuffs/lib/interval/interval_test.go +FILE: ../../../third_party/wuffs/lib/interval/radial_test.go +FILE: ../../../third_party/wuffs/release/c/wuffs-unsupported-snapshot.c +FILE: ../../../third_party/wuffs/release/c/wuffs-v0.2.c +FILE: ../../../third_party/wuffs/script/adler32-standalone.c +FILE: ../../../third_party/wuffs/script/bench-c-deflate-fragmentation.c +FILE: ../../../third_party/wuffs/script/bench-go-gif/main.go +FILE: ../../../third_party/wuffs/script/bench-rust-gif-dot-rs/src/main.rs +FILE: ../../../third_party/wuffs/script/bench-rust-gif/src/main.rs +FILE: ../../../third_party/wuffs/script/checksum.go +FILE: ../../../third_party/wuffs/script/compress-giflzw.go +FILE: ../../../third_party/wuffs/script/crawl.go +FILE: ../../../third_party/wuffs/script/extract-deflate-offsets.go +FILE: ../../../third_party/wuffs/script/extract-giflzw.go +FILE: ../../../third_party/wuffs/script/extract-palette-indexes.go +FILE: ../../../third_party/wuffs/script/inline-c-relative-includes.go +FILE: ../../../third_party/wuffs/script/make-artificial.go +FILE: ../../../third_party/wuffs/script/print-bits.go +FILE: ../../../third_party/wuffs/script/print-crc32-example.go +FILE: ../../../third_party/wuffs/script/print-crc32-magic-numbers.go +FILE: ../../../third_party/wuffs/script/print-deflate-magic-numbers.go +FILE: ../../../third_party/wuffs/script/print-lzw-example.go +FILE: ../../../third_party/wuffs/script/wuffs-deflate-decoder-decode-huffman.c +FILE: ../../../third_party/wuffs/std/adler32/common_adler32.wuffs +FILE: ../../../third_party/wuffs/std/crc32/common_crc32.wuffs +FILE: ../../../third_party/wuffs/std/deflate/common_consts.wuffs +FILE: ../../../third_party/wuffs/std/deflate/decode_deflate.wuffs +FILE: ../../../third_party/wuffs/std/deflate/decode_huffman_fast.wuffs +FILE: ../../../third_party/wuffs/std/deflate/decode_huffman_slow.wuffs +FILE: ../../../third_party/wuffs/std/gif/decode_gif.wuffs +FILE: ../../../third_party/wuffs/std/gzip/decode_gzip.wuffs +FILE: ../../../third_party/wuffs/std/lzw/decode_lzw.wuffs +FILE: ../../../third_party/wuffs/std/zlib/decode_zlib.wuffs ---------------------------------------------------------------------------------------------------- Apache License Version 2.0, January 2004 @@ -17762,6 +17858,191 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== +==================================================================================================== +LIBRARY: wuffs +ORIGIN: ../../../third_party/wuffs/LICENSE +TYPE: LicenseType.apache +FILE: ../../../third_party/wuffs/script/bench-rust-gif-dot-rs/Cargo.toml +FILE: ../../../third_party/wuffs/script/bench-rust-gif/Cargo.toml +---------------------------------------------------------------------------------------------------- +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS +==================================================================================================== + ==================================================================================================== LIBRARY: zlib ORIGIN: ../../../third_party/zlib/LICENSE @@ -18497,4 +18778,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: 309 +Total license count: 310 diff --git a/ci/licenses_golden/tool_signature b/ci/licenses_golden/tool_signature index c44f0c985ad7d..bbf0c62aa6fba 100644 --- a/ci/licenses_golden/tool_signature +++ b/ci/licenses_golden/tool_signature @@ -1,2 +1,2 @@ -Signature: c3d53eebec5b6c8992029095408c2d8c +Signature: 3265e06530be4b2f63aae56dd7a9e830 diff --git a/tools/gn b/tools/gn index 1af546b341b3a..d5735e861e5f3 100755 --- a/tools/gn +++ b/tools/gn @@ -85,6 +85,7 @@ def to_gn_args(args): gn_args['skia_use_x11'] = False # Never add the X11 dependency (only takes effect on Linux). gn_args['skia_use_expat'] = args.target_os == 'android' gn_args['skia_use_fontconfig'] = False # Use the custom font manager instead. + gn_args['skia_use_wuffs'] = True gn_args['is_official_build'] = True # Disable Skia test utilities. gn_args['is_debug'] = args.unoptimized diff --git a/tools/licenses/lib/licenses.dart b/tools/licenses/lib/licenses.dart index 097863fee0db1..629c6fcc63ea2 100644 --- a/tools/licenses/lib/licenses.dart +++ b/tools/licenses/lib/licenses.dart @@ -230,6 +230,7 @@ abstract class License implements Comparable { switch (url) { case 'Apache:2.0': case 'http://www.apache.org/licenses/LICENSE-2.0': + case 'https://www.apache.org/licenses/LICENSE-2.0': body = system.File('data/apache-license-2.0').readAsStringSync(); type = LicenseType.apache; break; diff --git a/tools/licenses/lib/main.dart b/tools/licenses/lib/main.dart index 10732148ad732..a780e3a967440 100644 --- a/tools/licenses/lib/main.dart +++ b/tools/licenses/lib/main.dart @@ -1639,6 +1639,7 @@ class _RepositorySkiaThirdPartyDirectory extends _RepositoryGenericThirdPartyDir return entry.name != 'giflib' // contains nothing that ends up in the binary executable && entry.name != 'freetype' // we use our own version && entry.name != 'freetype2' // we use our own version + && entry.name != 'gif' // not linked in && entry.name != 'icu' // we use our own version && entry.name != 'libjpeg-turbo' // we use our own version && entry.name != 'libpng' // we use our own version @@ -1698,6 +1699,23 @@ class _RepositoryVulkanDirectory extends _RepositoryDirectory { } } +class _RepositoryWuffsDirectory extends _RepositoryDirectory { + _RepositoryWuffsDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); + + @override + bool shouldRecurse(fs.IoNode entry) { + return entry.name != 'CONTRIBUTORS' // not linked in + && super.shouldRecurse(entry); + } + + @override + _RepositoryDirectory createSubdirectory(fs.Directory entry) { + if (entry.name == 'src') + return _RepositoryExcludeSubpathDirectory(this, entry, const ['spec']); + return super.createSubdirectory(entry); + } +} + class _RepositoryRootThirdPartyDirectory extends _RepositoryGenericThirdPartyDirectory { _RepositoryRootThirdPartyDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @@ -1764,6 +1782,8 @@ class _RepositoryRootThirdPartyDirectory extends _RepositoryGenericThirdPartyDir return _RepositoryPkgDirectory(this, entry); if (entry.name == 'vulkan') return _RepositoryVulkanDirectory(this, entry); + if (entry.name == 'wuffs') + return _RepositoryWuffsDirectory(this, entry); return super.createSubdirectory(entry); } } diff --git a/tools/licenses/lib/patterns.dart b/tools/licenses/lib/patterns.dart index 6a4114ad012d8..d92fc1402ca9c 100644 --- a/tools/licenses/lib/patterns.dart +++ b/tools/licenses/lib/patterns.dart @@ -651,7 +651,7 @@ final List csReferencesByUrl = Date: Tue, 5 Feb 2019 14:23:44 -0800 Subject: [PATCH 0056/1117] Update snapshot build rules to generate .o files instead of .S files on Windows (#7702) Update snapshot build rules to generate .o files instead of .S files on Windows to improve link times. This mirrors build rules for snapshots in the Dart SDK. --- lib/snapshot/BUILD.gn | 94 +++++++++++++++++++++++++++++++++---------- 1 file changed, 73 insertions(+), 21 deletions(-) diff --git a/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn index 4db8600eab7fd..601cee102ead1 100644 --- a/lib/snapshot/BUILD.gn +++ b/lib/snapshot/BUILD.gn @@ -79,18 +79,18 @@ compiled_action("generate_snapshot_bin") { template("bin_to_assembly") { assert(defined(invoker.deps), "Must define deps") assert(defined(invoker.input), "Must define input binary file") - assert(defined(invoker.output), "Must define output assembly file") assert(defined(invoker.symbol), "Must define symbol name") assert(defined(invoker.executable), "Must define boolean executable") action(target_name) { deps = invoker.deps script = "//third_party/dart/runtime/tools/bin_to_assembly.py" + output = invoker.input + ".S" args = [ "--input", rebase_path(invoker.input), "--output", - rebase_path(invoker.output), + rebase_path(output), "--symbol_name", invoker.symbol, "--target_os", @@ -104,64 +104,116 @@ template("bin_to_assembly") { invoker.input, ] outputs = [ - invoker.output, + output, ] } } -bin_to_assembly("vm_snapshot_data_assembly") { +# Generates an object file defining a given symbol with the bytes from a +# binary file. Places the symbol in the read-only data section. +template("bin_to_coff") { + assert(defined(invoker.deps), "Must define deps") + assert(defined(invoker.input), "Must define input binary file") + assert(defined(invoker.symbol), "Must define symbol name") + assert(defined(invoker.executable), "Must define executable") + + action(target_name) { + deps = invoker.deps + script = "//third_party/dart/runtime/tools/bin_to_coff.py" + output = invoker.input + ".o" + args = [ + "--input", + rebase_path(invoker.input), + "--output", + rebase_path(output), + "--symbol_name", + invoker.symbol, + ] + + if (defined(invoker.size_symbol)) { + args += [ + "--size_symbol_name", + invoker.size_symbol, + ] + } + + if (invoker.executable) { + args += [ "--executable" ] + } + + if (current_cpu == "x64") { + args += [ "--64-bit" ] + } + inputs = [ + invoker.input, + ] + outputs = [ + output, + ] + } +} + +template("bin_to_linkable") { + assert(defined(invoker.deps), "Must define deps") + assert(defined(invoker.input), "Must define input binary file") + assert(defined(invoker.symbol), "Must define symbol name") + target_type = "bin_to_assembly" + if (is_win) { + target_type = "bin_to_coff" + } + + target(target_type, target_name) { + forward_variables_from(invoker, "*") + } +} + +bin_to_linkable("vm_snapshot_data_linkable") { deps = [ ":generate_snapshot_bin", ] input = "$target_gen_dir/vm_isolate_snapshot.bin" - output = "$target_gen_dir/vm_snapshot_data.S" symbol = "kDartVmSnapshotData" executable = false } -bin_to_assembly("vm_snapshot_instructions_assembly") { +bin_to_linkable("vm_snapshot_instructions_linkable") { deps = [ ":generate_snapshot_bin", ] input = "$target_gen_dir/vm_snapshot_instructions.bin" - output = "$target_gen_dir/vm_snapshot_instructions.S" symbol = "kDartVmSnapshotInstructions" executable = true } -bin_to_assembly("isolate_snapshot_data_assembly") { +bin_to_linkable("isolate_snapshot_data_linkable") { deps = [ ":generate_snapshot_bin", ] input = "$target_gen_dir/isolate_snapshot.bin" - output = "$target_gen_dir/isolate_snapshot_data.S" symbol = "kDartIsolateSnapshotData" executable = false } -bin_to_assembly("isolate_snapshot_instructions_assembly") { +bin_to_linkable("isolate_snapshot_instructions_linkable") { deps = [ ":generate_snapshot_bin", ] input = "$target_gen_dir/isolate_snapshot_instructions.bin" - output = "$target_gen_dir/isolate_snapshot_instructions.S" symbol = "kDartIsolateSnapshotInstructions" executable = true } source_set("snapshot") { deps = [ - ":isolate_snapshot_data_assembly", - ":isolate_snapshot_instructions_assembly", - ":vm_snapshot_data_assembly", - ":vm_snapshot_instructions_assembly", - ] - sources = [ - "$target_gen_dir/isolate_snapshot_data.S", - "$target_gen_dir/isolate_snapshot_instructions.S", - "$target_gen_dir/vm_snapshot_data.S", - "$target_gen_dir/vm_snapshot_instructions.S", + ":isolate_snapshot_data_linkable", + ":isolate_snapshot_instructions_linkable", + ":vm_snapshot_data_linkable", + ":vm_snapshot_instructions_linkable", ] + sources = get_target_outputs(":isolate_snapshot_data_linkable") + + get_target_outputs(":isolate_snapshot_instructions_linkable") + + get_target_outputs(":vm_snapshot_data_linkable") + + get_target_outputs(":vm_snapshot_instructions_linkable") } compile_platform("non_strong_platform") { From 68d9ac44ec530a22beda85fcdf01871770a710d7 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Tue, 5 Feb 2019 16:02:44 -0800 Subject: [PATCH 0057/1117] Revert "Lower the threshold to raster cache pictures (#7687)" (#7701) This reverts commit 2f18c32862bc7a9092850c43a21c5282a95edf00. --- flow/raster_cache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index 94e518e60124a..0827a2de405e9 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -84,7 +84,7 @@ static bool IsPictureWorthRasterizing(SkPicture* picture, // TODO(abarth): We should find a better heuristic here that lets us avoid // wasting memory on trivial layers that are easy to re-rasterize every frame. - return picture->approximateOpCount() > 5; + return picture->approximateOpCount() > 10; } static RasterCacheResult Rasterize( From affa62a34a357a4eb62ab14d9afb5b8790fb9033 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 5 Feb 2019 17:07:47 -0800 Subject: [PATCH 0058/1117] Create stubbed dart:ui implementation, dart2js libraries file, copy rule (#7694) --- BUILD.gn | 1 + ci/licenses_golden/licenses_flutter | 16 + lib/stub_ui/BUILD.gn | 41 + lib/stub_ui/compositing.dart | 328 +++ lib/stub_ui/geometry.dart | 1681 ++++++++++++ lib/stub_ui/hash_codes.dart | 121 + lib/stub_ui/hooks.dart | 252 ++ lib/stub_ui/isolate_name_server.dart | 72 + lib/stub_ui/lerp.dart | 14 + lib/stub_ui/libraries.json | 122 + lib/stub_ui/libraries.yaml | 133 + lib/stub_ui/natives.dart | 50 + lib/stub_ui/painting.dart | 3520 ++++++++++++++++++++++++++ lib/stub_ui/plugins.dart | 71 + lib/stub_ui/pointer.dart | 245 ++ lib/stub_ui/semantics.dart | 694 +++++ lib/stub_ui/text.dart | 1434 +++++++++++ lib/stub_ui/ui.dart | 37 + lib/stub_ui/versions.dart | 25 + lib/stub_ui/window.dart | 915 +++++++ 20 files changed, 9772 insertions(+) create mode 100644 lib/stub_ui/BUILD.gn create mode 100644 lib/stub_ui/compositing.dart create mode 100644 lib/stub_ui/geometry.dart create mode 100644 lib/stub_ui/hash_codes.dart create mode 100644 lib/stub_ui/hooks.dart create mode 100644 lib/stub_ui/isolate_name_server.dart create mode 100644 lib/stub_ui/lerp.dart create mode 100644 lib/stub_ui/libraries.json create mode 100644 lib/stub_ui/libraries.yaml create mode 100644 lib/stub_ui/natives.dart create mode 100644 lib/stub_ui/painting.dart create mode 100644 lib/stub_ui/plugins.dart create mode 100644 lib/stub_ui/pointer.dart create mode 100644 lib/stub_ui/semantics.dart create mode 100644 lib/stub_ui/text.dart create mode 100644 lib/stub_ui/ui.dart create mode 100644 lib/stub_ui/versions.dart create mode 100644 lib/stub_ui/window.dart diff --git a/BUILD.gn b/BUILD.gn index 366cccad20196..fc9d0c930dc67 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -35,6 +35,7 @@ group("flutter") { public_deps += [ "$flutter_root/frontend_server", "//third_party/dart:create_sdk", + "$flutter_root/lib/stub_ui:stub_ui", ] foreach(snapshot, _flutter_sdk_snapshots) { public_deps += [ ":copy_flutter_${snapshot[0]}_snapshot" ] diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 91d15b8fcdc38..90840267553b7 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -217,6 +217,22 @@ 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.h +FILE: ../../../flutter/lib/stub_ui/compositing.dart +FILE: ../../../flutter/lib/stub_ui/geometry.dart +FILE: ../../../flutter/lib/stub_ui/hash_codes.dart +FILE: ../../../flutter/lib/stub_ui/hooks.dart +FILE: ../../../flutter/lib/stub_ui/isolate_name_server.dart +FILE: ../../../flutter/lib/stub_ui/lerp.dart +FILE: ../../../flutter/lib/stub_ui/libraries.json +FILE: ../../../flutter/lib/stub_ui/natives.dart +FILE: ../../../flutter/lib/stub_ui/painting.dart +FILE: ../../../flutter/lib/stub_ui/plugins.dart +FILE: ../../../flutter/lib/stub_ui/pointer.dart +FILE: ../../../flutter/lib/stub_ui/semantics.dart +FILE: ../../../flutter/lib/stub_ui/text.dart +FILE: ../../../flutter/lib/stub_ui/ui.dart +FILE: ../../../flutter/lib/stub_ui/versions.dart +FILE: ../../../flutter/lib/stub_ui/window.dart FILE: ../../../flutter/lib/ui/compositing.dart FILE: ../../../flutter/lib/ui/compositing/scene.cc FILE: ../../../flutter/lib/ui/compositing/scene.h diff --git a/lib/stub_ui/BUILD.gn b/lib/stub_ui/BUILD.gn new file mode 100644 index 0000000000000..22bc913b291b9 --- /dev/null +++ b/lib/stub_ui/BUILD.gn @@ -0,0 +1,41 @@ +# Copyright 2019 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +copy("stub_ui") { + sources = [ + "compositing.dart", + "geometry.dart", + "hash_codes.dart", + "hooks.dart", + "isolate_name_server.dart", + "lerp.dart", + "natives.dart", + "painting.dart", + "plugins.dart", + "pointer.dart", + "semantics.dart", + "text.dart", + "ui.dart", + "versions.dart", + "window.dart", + ] + + deps = [ + ":stub_libraries" + ] + + outputs = [ + "$root_out_dir/flutter_patched_sdk/stub_ui/{{source_file_part}}" + ] +} + +copy("stub_libraries") { + sources = [ + "$flutter_root/lib/snapshot/libraries.json" + ] + + outputs = [ + "$root_out_dir/flutter_patched_sdk/libraries.json" + ] +} diff --git a/lib/stub_ui/compositing.dart b/lib/stub_ui/compositing.dart new file mode 100644 index 0000000000000..3de66280773c9 --- /dev/null +++ b/lib/stub_ui/compositing.dart @@ -0,0 +1,328 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of dart.ui; + +/// An opaque object representing a composited scene. +/// +/// To create a Scene object, use a [SceneBuilder]. +/// +/// Scene objects can be displayed on the screen using the +/// [Window.render] method. +class Scene { + /// This class is created by the engine, and should not be instantiated + /// or extended directly. + /// + /// To create a Scene object, use a [SceneBuilder]. + Scene._(); + + + /// Creates a raster image representation of the current state of the scene. + /// This is a slow operation that is performed on a background thread. + Future toImage(int width, int height) { + throw UnimplementedError(); + } + + /// Releases the resources used by this scene. + /// + /// After calling this function, the scene is cannot be used further. + void dispose() { + throw UnimplementedError(); + } +} + +/// Builds a [Scene] containing the given visuals. +/// +/// A [Scene] can then be rendered using [Window.render]. +/// +/// To draw graphical operations onto a [Scene], first create a +/// [Picture] using a [PictureRecorder] and a [Canvas], and then add +/// it to the scene using [addPicture]. +class SceneBuilder { + SceneBuilder(); + + /// Pushes a transform operation onto the operation stack. + /// + /// The objects are transformed by the given matrix before rasterization. + /// + /// See [pop] for details about the operation stack. + EngineLayer pushTransform(Float64List matrix4) { + throw UnimplementedError(); + } + + /// 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. + EngineLayer pushOffset(double dx, double dy) { + throw UnimplementedError(); + } + + /// Pushes a rectangular clip operation onto the operation stack. + /// + /// Rasterization outside the given rectangle is discarded. + /// + /// 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]). + EngineLayer pushClipRect(Rect rect, {Clip clipBehavior = Clip.antiAlias}) { + throw UnimplementedError(); + } + + /// Pushes a rounded-rectangular clip operation onto the operation stack. + /// + /// Rasterization outside the given rounded rectangle is discarded. + /// + /// 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]). + EngineLayer pushClipRRect(RRect rrect, {Clip clipBehavior = Clip.antiAlias}) { + throw UnimplementedError(); + } + + /// Pushes a path clip operation onto the operation stack. + /// + /// Rasterization outside the given path is discarded. + /// + /// 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]). + EngineLayer pushClipPath(Path path, {Clip clipBehavior = Clip.antiAlias}) { + throw UnimplementedError(); + } + + /// Pushes an opacity operation onto the operation stack. + /// + /// The given alpha value is blended into the alpha value of the objects' + /// rasterization. An alpha value of 0 makes the objects entirely invisible. + /// An alpha value of 255 has no effect (i.e., the objects retain the current + /// opacity). + /// + /// See [pop] for details about the operation stack. + EngineLayer pushOpacity(int alpha, {Offset offset = Offset.zero}) { + throw UnimplementedError(); + } + + /// Pushes a color filter operation onto the operation stack. + /// + /// The given color is applied to the objects' rasterization using the given + /// blend mode. + /// + /// See [pop] for details about the operation stack. + EngineLayer pushColorFilter(Color color, BlendMode blendMode) { + throw UnimplementedError(); + } + + /// Pushes a backdrop filter operation onto the operation stack. + /// + /// The given filter is applied to the current contents of the scene prior to + /// rasterizing the given objects. + /// + /// See [pop] for details about the operation stack. + EngineLayer pushBackdropFilter(ImageFilter filter) { + throw UnimplementedError(); + } + + /// Pushes a shader mask operation onto the operation stack. + /// + /// The given shader is applied to the object's rasterization in the given + /// rectangle using the given blend mode. + /// + /// See [pop] for details about the operation stack. + EngineLayer pushShaderMask(Shader shader, Rect maskRect, BlendMode blendMode) { + throw UnimplementedError(); + } + + /// Pushes a physical layer operation for an arbitrary shape onto the + /// operation stack. + /// + /// By default, the layer's content will not be clipped (clip = [Clip.none]). + /// If clip equals [Clip.hardEdge], [Clip.antiAlias], or [Clip.antiAliasWithSaveLayer], + /// then the content is clipped to the given shape defined by [path]. + /// + /// If [elevation] is greater than 0.0, then a shadow is drawn around the layer. + /// [shadowColor] defines the color of the shadow if present and [color] defines the + /// color of the layer background. + /// + /// See [pop] for details about the operation stack, and [Clip] for different clip modes. + // ignore: deprecated_member_use + EngineLayer pushPhysicalShape({ Path path, double elevation, Color color, Color shadowColor, Clip clipBehavior = Clip.none}) { + throw UnimplementedError(); + } + + /// Ends the effect of the most recently pushed operation. + /// + /// Internally the scene builder maintains a stack of operations. Each of the + /// operations in the stack applies to each of the objects added to the scene. + /// Calling this function removes the most recently added operation from the + /// stack. + void pop() { + throw UnimplementedError(); + } + + /// 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 subclass 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) { + throw UnimplementedError(); + } + + /// Adds an object to the scene that displays performance statistics. + /// + /// Useful during development to assess the performance of the application. + /// The enabledOptions controls which statistics are displayed. The bounds + /// controls where the statistics are displayed. + /// + /// enabledOptions is a bit field with the following bits defined: + /// - 0x01: displayRasterizerStatistics - show GPU thread frame time + /// - 0x02: visualizeRasterizerStatistics - graph GPU thread frame times + /// - 0x04: displayEngineStatistics - show UI thread frame time + /// - 0x08: visualizeEngineStatistics - graph UI thread frame times + /// Set enabledOptions to 0x0F to enable all the currently defined features. + /// + /// The "UI thread" is the thread that includes all the execution of + /// the main Dart isolate (the isolate that can call + /// [Window.render]). The UI thread frame time is the total time + /// spent executing the [Window.onBeginFrame] callback. The "GPU + /// thread" is the thread (running on the CPU) that subsequently + /// processes the [Scene] provided by the Dart code to turn it into + /// GPU commands and send it to the GPU. + /// + /// See also the [PerformanceOverlayOption] enum in the rendering library. + /// for more details. + // Values above must match constants in //engine/src/sky/compositor/performance_overlay_layer.h + void addPerformanceOverlay(int enabledOptions, Rect bounds) { + throw UnimplementedError(); + } + + /// Adds a [Picture] to the scene. + /// + /// The picture is rasterized at the given offset. + void addPicture(Offset offset, Picture picture, { bool isComplexHint: false, bool willChangeHint: false }) { + throw UnimplementedError(); + } + + /// Adds a backend texture to the scene. + /// + /// The texture is scaled to the given size and rasterized at the given offset. + /// + /// If `freeze` is true the texture that is added to the scene will not + /// be updated with new frames. `freeze` is used when resizing an embedded + /// Android view: When resizing an Android view there is a short period during + /// which the framework cannot tell if the newest texture frame has the + /// previous or new size, to workaround this the framework "freezes" the + /// texture just before resizing the Android view and unfreezes it when it is + /// certain that a frame with the new size is ready. + void addTexture(int textureId, { Offset offset: Offset.zero, double width: 0.0, double height: 0.0 , bool freeze: false}) { + throw UnimplementedError(); + } + + /// 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}) { + throw UnimplementedError(); + } + + /// (Fuchsia-only) Adds a scene rendered by another application to the scene + /// for this application. + void addChildScene({ + Offset offset: Offset.zero, + double width: 0.0, + double height: 0.0, + SceneHost sceneHost, + bool hitTestable: true + }) { + throw UnimplementedError(); + } + + /// Sets a threshold after which additional debugging information should be recorded. + /// + /// Currently this interface is difficult to use by end-developers. If you're + /// interested in using this feature, please contact [flutter-dev](https://groups.google.com/forum/#!forum/flutter-dev). + /// We'll hopefully be able to figure out how to make this feature more useful + /// to you. + void setRasterizerTracingThreshold(int frameInterval) { + throw UnimplementedError(); + } + + /// Sets whether the raster cache should checkerboard cached entries. This is + /// only useful for debugging purposes. + /// + /// The compositor can sometimes decide to cache certain portions of the + /// widget hierarchy. Such portions typically don't change often from frame to + /// frame and are expensive to render. This can speed up overall rendering. However, + /// there is certain upfront cost to constructing these cache entries. And, if + /// the cache entries are not used very often, this cost may not be worth the + /// speedup in rendering of subsequent frames. If the developer wants to be certain + /// that populating the raster cache is not causing stutters, this option can be + /// set. Depending on the observations made, hints can be provided to the compositor + /// that aid it in making better decisions about caching. + /// + /// Currently this interface is difficult to use by end-developers. If you're + /// interested in using this feature, please contact [flutter-dev](https://groups.google.com/forum/#!forum/flutter-dev). + void setCheckerboardRasterCacheImages(bool checkerboard) { + throw UnimplementedError(); + } + + /// Sets whether the compositor should checkerboard layers that are rendered + /// to offscreen bitmaps. + /// + /// This is only useful for debugging purposes. + void setCheckerboardOffscreenLayers(bool checkerboard) { + throw UnimplementedError(); + } + + /// Finishes building the scene. + /// + /// Returns a [Scene] containing the objects that have been added to + /// this scene builder. The [Scene] can then be displayed on the + /// screen with [Window.render]. + /// + /// After calling this function, the scene builder object is invalid and + /// cannot be used further. + Scene build() { + throw UnimplementedError(); + } +} + +/// (Fuchsia-only) Hosts content provided by another application. +class SceneHost { + /// Creates a host for a child scene. + /// + /// The export token is bound to a scene graph node which acts as a container + /// for the child's content. The creator of the scene host is responsible for + /// sending the corresponding import token (the other endpoint of the event pair) + /// to the child. + /// + /// The export token is a dart:zircon Handle, but that type isn't + /// available here. This is called by ChildViewConnection in + /// //topaz/public/lib/ui/flutter/. + /// + /// The scene host takes ownership of the provided export token handle. + SceneHost(dynamic exportTokenHandle); + + /// Releases the resources associated with the child scene host. + /// + /// After calling this function, the child scene host cannot be used further. + void dispose() { + throw UnimplementedError(); + } +} diff --git a/lib/stub_ui/geometry.dart b/lib/stub_ui/geometry.dart new file mode 100644 index 0000000000000..f0916021419c0 --- /dev/null +++ b/lib/stub_ui/geometry.dart @@ -0,0 +1,1681 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of dart.ui; + +/// Base class for [Size] and [Offset], which are both ways to describe +/// a distance as a two-dimensional axis-aligned vector. +abstract class OffsetBase { + /// Abstract const constructor. This constructor enables subclasses to provide + /// const constructors so that they can be used in const expressions. + /// + /// The first argument sets the horizontal component, and the second the + /// vertical component. + const OffsetBase(this._dx, this._dy); + + final double _dx; + final double _dy; + + /// Returns true if either component is [double.infinity], and false if both + /// are finite (or negative infinity, or NaN). + /// + /// This is different than comparing for equality with an instance that has + /// _both_ components set to [double.infinity]. + /// + /// See also: + /// + /// * [isFinite], which is true if both components are finite (and not NaN). + bool get isInfinite => _dx >= double.infinity || _dy >= double.infinity; + + /// Whether both components are finite (neither infinite nor NaN). + /// + /// See also: + /// + /// * [isInfinite], which returns true if either component is equal to + /// positive infinity. + bool get isFinite => _dx.isFinite && _dy.isFinite; + + /// Less-than operator. Compares an [Offset] or [Size] to another [Offset] or + /// [Size], and returns true if both the horizontal and vertical values of the + /// left-hand-side operand are smaller than the horizontal and vertical values + /// of the right-hand-side operand respectively. Returns false otherwise. + /// + /// This is a partial ordering. It is possible for two values to be neither + /// less, nor greater than, nor equal to, another. + bool operator <(OffsetBase other) => _dx < other._dx && _dy < other._dy; + + /// Less-than-or-equal-to operator. Compares an [Offset] or [Size] to another + /// [Offset] or [Size], and returns true if both the horizontal and vertical + /// values of the left-hand-side operand are smaller than or equal to the + /// horizontal and vertical values of the right-hand-side operand + /// respectively. Returns false otherwise. + /// + /// This is a partial ordering. It is possible for two values to be neither + /// less, nor greater than, nor equal to, another. + bool operator <=(OffsetBase other) => _dx <= other._dx && _dy <= other._dy; + + /// Greater-than operator. Compares an [Offset] or [Size] to another [Offset] + /// or [Size], and returns true if both the horizontal and vertical values of + /// the left-hand-side operand are bigger than the horizontal and vertical + /// values of the right-hand-side operand respectively. Returns false + /// otherwise. + /// + /// This is a partial ordering. It is possible for two values to be neither + /// less, nor greater than, nor equal to, another. + bool operator >(OffsetBase other) => _dx > other._dx && _dy > other._dy; + + /// Greater-than-or-equal-to operator. Compares an [Offset] or [Size] to + /// another [Offset] or [Size], and returns true if both the horizontal and + /// vertical values of the left-hand-side operand are bigger than or equal to + /// the horizontal and vertical values of the right-hand-side operand + /// respectively. Returns false otherwise. + /// + /// This is a partial ordering. It is possible for two values to be neither + /// less, nor greater than, nor equal to, another. + bool operator >=(OffsetBase other) => _dx > other._dx && _dy >= other._dy; + + /// Equality operator. Compares an [Offset] or [Size] to another [Offset] or + /// [Size], and returns true if the horizontal and vertical values of the + /// left-hand-side operand are equal to the horizontal and vertical values of + /// the right-hand-side operand respectively. Returns false otherwise. + @override + bool operator ==(dynamic other) { + if (other is! OffsetBase) + return false; + final OffsetBase typedOther = other; + return _dx == typedOther._dx && + _dy == typedOther._dy; + } + + @override + int get hashCode => hashValues(_dx, _dy); + + @override + String toString() => '$runtimeType(${_dx?.toStringAsFixed(1)}, ${_dy?.toStringAsFixed(1)})'; +} + +/// An immutable 2D floating-point offset. +/// +/// Generally speaking, Offsets can be interpreted in two ways: +/// +/// 1. As representing a point in Cartesian space a specified distance from a +/// separately-maintained origin. For example, the top-left position of +/// children in the [RenderBox] protocol is typically represented as an +/// [Offset] from the top left of the parent box. +/// +/// 2. As a vector that can be applied to coordinates. For example, when +/// painting a [RenderObject], the parent is passed an [Offset] from the +/// screen's origin which it can add to the offsets of its children to find +/// the [Offset] from the screen's origin to each of the children. +/// +/// Because a particular [Offset] can be interpreted as one sense at one time +/// then as the other sense at a later time, the same class is used for both +/// senses. +/// +/// See also: +/// +/// * [Size], which represents a vector describing the size of a rectangle. +class Offset extends OffsetBase { + /// Creates an offset. The first argument sets [dx], the horizontal component, + /// and the second sets [dy], the vertical component. + const Offset(double dx, double dy) : super(dx, dy); + + /// Creates an offset from its [direction] and [distance]. + /// + /// The direction is in radians clockwise from the positive x-axis. + /// + /// The distance can be omitted, to create a unit vector (distance = 1.0). + factory Offset.fromDirection(double direction, [ double distance = 1.0 ]) { + return new Offset(distance * math.cos(direction), distance * math.sin(direction)); + } + + /// The x component of the offset. + /// + /// The y component is given by [dy]. + double get dx => _dx; + + /// The y component of the offset. + /// + /// The x component is given by [dx]. + double get dy => _dy; + + /// The magnitude of the offset. + /// + /// If you need this value to compare it to another [Offset]'s distance, + /// consider using [distanceSquared] instead, since it is cheaper to compute. + double get distance => math.sqrt(dx * dx + dy * dy); + + /// The square of the magnitude of the offset. + /// + /// This is cheaper than computing the [distance] itself. + double get distanceSquared => dx * dx + dy * dy; + + /// The angle of this offset as radians clockwise from the positive x-axis, in + /// the range -[pi] to [pi], assuming positive values of the x-axis go to the + /// left and positive values of the y-axis go down. + /// + /// Zero means that [dy] is zero and [dx] is zero or positive. + /// + /// Values from zero to [pi]/2 indicate positive values of [dx] and [dy], the + /// bottom-right quadrant. + /// + /// Values from [pi]/2 to [pi] indicate negative values of [dx] and positive + /// values of [dy], the bottom-left quadrant. + /// + /// Values from zero to -[pi]/2 indicate positive values of [dx] and negative + /// values of [dy], the top-right quadrant. + /// + /// Values from -[pi]/2 to -[pi] indicate negative values of [dx] and [dy], + /// the top-left quadrant. + /// + /// When [dy] is zero and [dx] is negative, the [direction] is [pi]. + /// + /// When [dx] is zero, [direction] is [pi]/2 if [dy] is positive and -[pi]/2 + /// if [dy] is negative. + /// + /// See also: + /// + /// * [distance], to compute the magnitude of the vector. + /// * [Canvas.rotate], which uses the same convention for its angle. + double get direction => math.atan2(dy, dx); + + /// An offset with zero magnitude. + /// + /// This can be used to represent the origin of a coordinate space. + static const Offset zero = const Offset(0.0, 0.0); + + /// An offset with infinite x and y components. + /// + /// See also: + /// + /// * [isInfinite], which checks whether either component is infinite. + /// * [isFinite], which checks whether both components are finite. + // This is included for completeness, because [Size.infinite] exists. + static const Offset infinite = const Offset(double.infinity, double.infinity); + + /// Returns a new offset with the x component scaled by `scaleX` and the y + /// component scaled by `scaleY`. + /// + /// If the two scale arguments are the same, consider using the `*` operator + /// instead: + /// + /// ```dart + /// Offset a = const Offset(10.0, 10.0); + /// Offset b = a * 2.0; // same as: a.scale(2.0, 2.0) + /// ``` + /// + /// If the two arguments are -1, consider using the unary `-` operator + /// instead: + /// + /// ```dart + /// Offset a = const Offset(10.0, 10.0); + /// Offset b = -a; // same as: a.scale(-1.0, -1.0) + /// ``` + Offset scale(double scaleX, double scaleY) => new Offset(dx * scaleX, dy * scaleY); + + /// Returns a new offset with translateX added to the x component and + /// translateY added to the y component. + /// + /// If the arguments come from another [Offset], consider using the `+` or `-` + /// operators instead: + /// + /// ```dart + /// Offset a = const Offset(10.0, 10.0); + /// Offset b = const Offset(10.0, 10.0); + /// Offset c = a + b; // same as: a.translate(b.dx, b.dy) + /// Offset d = a - b; // same as: a.translate(-b.dx, -b.dy) + /// ``` + Offset translate(double translateX, double translateY) => new Offset(dx + translateX, dy + translateY); + + /// Unary negation operator. + /// + /// Returns an offset with the coordinates negated. + /// + /// If the [Offset] represents an arrow on a plane, this operator returns the + /// same arrow but pointing in the reverse direction. + Offset operator -() => new Offset(-dx, -dy); + + /// Binary subtraction operator. + /// + /// Returns an offset whose [dx] value is the left-hand-side operand's [dx] + /// minus the right-hand-side operand's [dx] and whose [dy] value is the + /// left-hand-side operand's [dy] minus the right-hand-side operand's [dy]. + /// + /// See also [translate]. + Offset operator -(Offset other) => new Offset(dx - other.dx, dy - other.dy); + + /// Binary addition operator. + /// + /// Returns an offset whose [dx] value is the sum of the [dx] values of the + /// two operands, and whose [dy] value is the sum of the [dy] values of the + /// two operands. + /// + /// See also [translate]. + Offset operator +(Offset other) => new Offset(dx + other.dx, dy + other.dy); + + /// Multiplication operator. + /// + /// Returns an offset whose coordinates are the coordinates of the + /// left-hand-side operand (an Offset) multiplied by the scalar + /// right-hand-side operand (a double). + /// + /// See also [scale]. + Offset operator *(double operand) => new Offset(dx * operand, dy * operand); + + /// Division operator. + /// + /// Returns an offset whose coordinates are the coordinates of the + /// left-hand-side operand (an Offset) divided by the scalar right-hand-side + /// operand (a double). + /// + /// See also [scale]. + Offset operator /(double operand) => new Offset(dx / operand, dy / operand); + + /// Integer (truncating) division operator. + /// + /// Returns an offset whose coordinates are the coordinates of the + /// left-hand-side operand (an Offset) divided by the scalar right-hand-side + /// operand (a double), rounded towards zero. + Offset operator ~/(double operand) => new Offset((dx ~/ operand).toDouble(), (dy ~/ operand).toDouble()); + + /// Modulo (remainder) operator. + /// + /// Returns an offset whose coordinates are the remainder of dividing the + /// coordinates of the left-hand-side operand (an Offset) by the scalar + /// right-hand-side operand (a double). + Offset operator %(double operand) => new Offset(dx % operand, dy % operand); + + /// Rectangle constructor operator. + /// + /// Combines an [Offset] and a [Size] to form a [Rect] whose top-left + /// coordinate is the point given by adding this offset, the left-hand-side + /// operand, to the origin, and whose size is the right-hand-side operand. + /// + /// ```dart + /// Rect myRect = Offset.zero & const Size(100.0, 100.0); + /// // same as: new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0) + /// ``` + Rect operator &(Size other) => new Rect.fromLTWH(dx, dy, other.width, other.height); + + /// Linearly interpolate between two offsets. + /// + /// If either offset is null, this function interpolates from [Offset.zero]. + /// + /// 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]. + static Offset lerp(Offset a, Offset b, double t) { + assert(t != null); + if (a == null && b == null) + return null; + if (a == null) + return b * t; + if (b == null) + return a * (1.0 - t); + return new Offset(lerpDouble(a.dx, b.dx, t), lerpDouble(a.dy, b.dy, t)); + } + + /// Compares two Offsets for equality. + @override + bool operator ==(dynamic other) { + if (other is! Offset) + return false; + final Offset typedOther = other; + return dx == typedOther.dx && + dy == typedOther.dy; + } + + @override + int get hashCode => hashValues(dx, dy); + + @override + String toString() => 'Offset(${dx?.toStringAsFixed(1)}, ${dy?.toStringAsFixed(1)})'; +} + +/// Holds a 2D floating-point size. +/// +/// You can think of this as an [Offset] from the origin. +class Size extends OffsetBase { + /// Creates a [Size] with the given [width] and [height]. + const Size(double width, double height) : super(width, height); + + /// Creates an instance of [Size] that has the same values as another. + // Used by the rendering library's _DebugSize hack. + Size.copy(Size source) : super(source.width, source.height); + + /// Creates a square [Size] whose [width] and [height] are the given dimension. + /// + /// See also: + /// + /// * [new Size.fromRadius], which is more convenient when the available size + /// is the radius of a circle. + const Size.square(double dimension) : super(dimension, dimension); + + /// Creates a [Size] with the given [width] and an infinite [height]. + const Size.fromWidth(double width) : super(width, double.infinity); + + /// Creates a [Size] with the given [height] and an infinite [width]. + const Size.fromHeight(double height) : super(double.infinity, height); + + /// Creates a square [Size] whose [width] and [height] are twice the given + /// dimension. + /// + /// This is a square that contains a circle with the given radius. + /// + /// See also: + /// + /// * [new Size.square], which creates a square with the given dimension. + const Size.fromRadius(double radius) : super(radius * 2.0, radius * 2.0); + + /// The horizontal extent of this size. + double get width => _dx; + + /// The vertical extent of this size. + double get height => _dy; + + /// The aspect ratio of this size. + /// + /// This returns the [width] divided by the [height]. + /// + /// If the [width] is zero, the result will be zero. If the [height] is zero + /// (and the [width] is not), the result will be [double.infinity] or + /// [double.negativeInfinity] as determined by the sign of [width]. + /// + /// See also: + /// + /// * [AspectRatio], a widget for giving a child widget a specific aspect + /// ratio. + /// * [FittedBox], a widget that (in most modes) attempts to maintain a + /// child widget's aspect ratio while changing its size. + double get aspectRatio { + if (height != 0.0) + return width / height; + if (width > 0.0) + return double.infinity; + if (width < 0.0) + return double.negativeInfinity; + return 0.0; + } + + /// An empty size, one with a zero width and a zero height. + static const Size zero = const Size(0.0, 0.0); + + /// A size whose [width] and [height] are infinite. + /// + /// See also: + /// + /// * [isInfinite], which checks whether either dimension is infinite. + /// * [isFinite], which checks whether both dimensions are finite. + static const Size infinite = const Size(double.infinity, double.infinity); + + /// Whether this size encloses a non-zero area. + /// + /// Negative areas are considered empty. + bool get isEmpty => width <= 0.0 || height <= 0.0; + + /// Binary subtraction operator for [Size]. + /// + /// Subtracting a [Size] from a [Size] returns the [Offset] that describes how + /// much bigger the left-hand-side operand is than the right-hand-side + /// operand. Adding that resulting [Offset] to the [Size] that was the + /// right-hand-side operand would return a [Size] equal to the [Size] that was + /// the left-hand-side operand. (i.e. if `sizeA - sizeB -> offsetA`, then + /// `offsetA + sizeB -> sizeA`) + /// + /// Subtracting an [Offset] from a [Size] returns the [Size] that is smaller than + /// the [Size] operand by the difference given by the [Offset] operand. In other + /// words, the returned [Size] has a [width] consisting of the [width] of the + /// left-hand-side operand minus the [Offset.dx] dimension of the + /// right-hand-side operand, and a [height] consisting of the [height] of the + /// left-hand-side operand minus the [Offset.dy] dimension of the + /// right-hand-side operand. + OffsetBase operator -(OffsetBase other) { + if (other is Size) + return new Offset(width - other.width, height - other.height); + if (other is Offset) + return new Size(width - other.dx, height - other.dy); + throw new ArgumentError(other); + } + + /// Binary addition operator for adding an [Offset] to a [Size]. + /// + /// Returns a [Size] whose [width] is the sum of the [width] of the + /// left-hand-side operand, a [Size], and the [Offset.dx] dimension of the + /// right-hand-side operand, an [Offset], and whose [height] is the sum of the + /// [height] of the left-hand-side operand and the [Offset.dy] dimension of + /// the right-hand-side operand. + Size operator +(Offset other) => new Size(width + other.dx, height + other.dy); + + /// Multiplication operator. + /// + /// Returns a [Size] whose dimensions are the dimensions of the left-hand-side + /// operand (a [Size]) multiplied by the scalar right-hand-side operand (a + /// [double]). + Size operator *(double operand) => new Size(width * operand, height * operand); + + /// Division operator. + /// + /// Returns a [Size] whose dimensions are the dimensions of the left-hand-side + /// operand (a [Size]) divided by the scalar right-hand-side operand (a + /// [double]). + Size operator /(double operand) => new Size(width / operand, height / operand); + + /// Integer (truncating) division operator. + /// + /// Returns a [Size] whose dimensions are the dimensions of the left-hand-side + /// operand (a [Size]) divided by the scalar right-hand-side operand (a + /// [double]), rounded towards zero. + Size operator ~/(double operand) => new Size((width ~/ operand).toDouble(), (height ~/ operand).toDouble()); + + /// Modulo (remainder) operator. + /// + /// Returns a [Size] whose dimensions are the remainder of dividing the + /// left-hand-side operand (a [Size]) by the scalar right-hand-side operand (a + /// [double]). + Size operator %(double operand) => new Size(width % operand, height % operand); + + /// The lesser of the magnitudes of the [width] and the [height]. + double get shortestSide => math.min(width.abs(), height.abs()); + + /// The greater of the magnitudes of the [width] and the [height]. + double get longestSide => math.max(width.abs(), height.abs()); + + // Convenience methods that do the equivalent of calling the similarly named + // methods on a Rect constructed from the given origin and this size. + + /// The offset to the intersection of the top and left edges of the rectangle + /// described by the given [Offset] (which is interpreted as the top-left corner) + /// and this [Size]. + /// + /// See also [Rect.topLeft]. + Offset topLeft(Offset origin) => origin; + + /// The offset to the center of the top edge of the rectangle described by the + /// given offset (which is interpreted as the top-left corner) and this size. + /// + /// See also [Rect.topCenter]. + Offset topCenter(Offset origin) => new Offset(origin.dx + width / 2.0, origin.dy); + + /// The offset to the intersection of the top and right edges of the rectangle + /// described by the given offset (which is interpreted as the top-left corner) + /// and this size. + /// + /// See also [Rect.topRight]. + Offset topRight(Offset origin) => new Offset(origin.dx + width, origin.dy); + + /// The offset to the center of the left edge of the rectangle described by the + /// given offset (which is interpreted as the top-left corner) and this size. + /// + /// See also [Rect.centerLeft]. + Offset centerLeft(Offset origin) => new Offset(origin.dx, origin.dy + height / 2.0); + + /// The offset to the point halfway between the left and right and the top and + /// bottom edges of the rectangle described by the given offset (which is + /// interpreted as the top-left corner) and this size. + /// + /// See also [Rect.center]. + Offset center(Offset origin) => new Offset(origin.dx + width / 2.0, origin.dy + height / 2.0); + + /// The offset to the center of the right edge of the rectangle described by the + /// given offset (which is interpreted as the top-left corner) and this size. + /// + /// See also [Rect.centerLeft]. + Offset centerRight(Offset origin) => new Offset(origin.dx + width, origin.dy + height / 2.0); + + /// The offset to the intersection of the bottom and left edges of the + /// rectangle described by the given offset (which is interpreted as the + /// top-left corner) and this size. + /// + /// See also [Rect.bottomLeft]. + Offset bottomLeft(Offset origin) => new Offset(origin.dx, origin.dy + height); + + /// The offset to the center of the bottom edge of the rectangle described by + /// the given offset (which is interpreted as the top-left corner) and this + /// size. + /// + /// See also [Rect.bottomLeft]. + Offset bottomCenter(Offset origin) => new Offset(origin.dx + width / 2.0, origin.dy + height); + + /// The offset to the intersection of the bottom and right edges of the + /// rectangle described by the given offset (which is interpreted as the + /// top-left corner) and this size. + /// + /// See also [Rect.bottomRight]. + Offset bottomRight(Offset origin) => new Offset(origin.dx + width, origin.dy + height); + + /// Whether the point specified by the given offset (which is assumed to be + /// relative to the top left of the size) lies between the left and right and + /// the top and bottom edges of a rectangle of this size. + /// + /// Rectangles include their top and left edges but exclude their bottom and + /// right edges. + bool contains(Offset offset) { + return offset.dx >= 0.0 && offset.dx < width && offset.dy >= 0.0 && offset.dy < height; + } + + /// A [Size] with the [width] and [height] swapped. + Size get flipped => new Size(height, width); + + /// Linearly interpolate between two sizes + /// + /// If either size is null, this function interpolates from [Size.zero]. + /// + /// 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]. + static Size lerp(Size a, Size b, double t) { + assert(t != null); + if (a == null && b == null) + return null; + if (a == null) + return b * t; + if (b == null) + return a * (1.0 - t); + return new Size(lerpDouble(a.width, b.width, t), lerpDouble(a.height, b.height, t)); + } + + /// Compares two Sizes for equality. + // We don't compare the runtimeType because of _DebugSize in the framework. + @override + bool operator ==(dynamic other) { + if (other is! Size) + return false; + final Size typedOther = other; + return _dx == typedOther._dx && + _dy == typedOther._dy; + } + + @override + int get hashCode => hashValues(_dx, _dy); + + @override + String toString() => 'Size(${width?.toStringAsFixed(1)}, ${height?.toStringAsFixed(1)})'; +} + +/// An immutable, 2D, axis-aligned, floating-point rectangle whose coordinates +/// are relative to a given origin. +/// +/// A Rect can be created with one its constructors or from an [Offset] and a +/// [Size] using the `&` operator: +/// +/// ```dart +/// Rect myRect = const Offset(1.0, 2.0) & const Size(3.0, 4.0); +/// ``` +class Rect { + Rect._(); + + /// Construct a rectangle from its left, top, right, and bottom edges. + Rect.fromLTRB(double left, double top, double right, double bottom) { + _value + ..[0] = left + ..[1] = top + ..[2] = right + ..[3] = bottom; + } + + /// Construct a rectangle from its left and top edges, its width, and its + /// height. + /// + /// To construct a [Rect] from an [Offset] and a [Size], you can use the + /// rectangle constructor operator `&`. See [Offset.&]. + Rect.fromLTWH(double left, double top, double width, double height) { + _value + ..[0] = left + ..[1] = top + ..[2] = left + width + ..[3] = top + height; + } + + /// Construct a rectangle that bounds the given circle. + /// + /// The `center` argument is assumed to be an offset from the origin. + Rect.fromCircle({ Offset center, double radius }) { + _value + ..[0] = center.dx - radius + ..[1] = center.dy - radius + ..[2] = center.dx + radius + ..[3] = center.dy + radius; + } + + /// Construct the smallest rectangle that encloses the given offsets, treating + /// them as vectors from the origin. + Rect.fromPoints(Offset a, Offset b) { + _value + ..[0] = math.min(a.dx, b.dx) + ..[1] = math.min(a.dy, b.dy) + ..[2] = math.max(a.dx, b.dx) + ..[3] = math.max(a.dy, b.dy); + } + + static const int _kDataSize = 4; + final Float32List _value = new Float32List(_kDataSize); + + /// The offset of the left edge of this rectangle from the x axis. + double get left => _value[0]; + + /// The offset of the top edge of this rectangle from the y axis. + double get top => _value[1]; + + /// The offset of the right edge of this rectangle from the x axis. + double get right => _value[2]; + + /// The offset of the bottom edge of this rectangle from the y axis. + double get bottom => _value[3]; + + /// The distance between the left and right edges of this rectangle. + double get width => right - left; + + /// The distance between the top and bottom edges of this rectangle. + double get height => bottom - top; + + /// The distance between the upper-left corner and the lower-right corner of + /// this rectangle. + Size get size => new Size(width, height); + + /// A rectangle with left, top, right, and bottom edges all at zero. + static final Rect zero = new Rect._(); + + static const double _giantScalar = 1.0E+9; // matches kGiantRect from layer.h + + /// A rectangle that covers the entire coordinate space. + /// + /// This covers the space from -1e9,-1e9 to 1e9,1e9. + /// This is the space over which graphics operations are valid. + static final Rect largest = new Rect.fromLTRB(-_giantScalar, -_giantScalar, _giantScalar, _giantScalar); + + /// Whether any of the coordinates of this rectangle are equal to positive infinity. + // included for consistency with Offset and Size + bool get isInfinite { + return left >= double.infinity + || top >= double.infinity + || right >= double.infinity + || bottom >= double.infinity; + } + + /// Whether all coordinates of this rectangle are finite. + bool get isFinite => left.isFinite && top.isFinite && right.isFinite && bottom.isFinite; + + /// Whether this rectangle encloses a non-zero area. Negative areas are + /// considered empty. + bool get isEmpty => left >= right || top >= bottom; + + /// Returns a new rectangle translated by the given offset. + /// + /// To translate a rectangle by separate x and y components rather than by an + /// [Offset], consider [translate]. + Rect shift(Offset offset) { + return new Rect.fromLTRB(left + offset.dx, top + offset.dy, right + offset.dx, bottom + offset.dy); + } + + /// Returns a new rectangle with translateX added to the x components and + /// translateY added to the y components. + /// + /// To translate a rectangle by an [Offset] rather than by separate x and y + /// components, consider [shift]. + Rect translate(double translateX, double translateY) { + return new Rect.fromLTRB(left + translateX, top + translateY, right + translateX, bottom + translateY); + } + + /// Returns a new rectangle with edges moved outwards by the given delta. + Rect inflate(double delta) { + return new Rect.fromLTRB(left - delta, top - delta, right + delta, bottom + delta); + } + + /// Returns a new rectangle with edges moved inwards by the given delta. + Rect deflate(double delta) => inflate(-delta); + + /// Returns a new rectangle that is the intersection of the given + /// rectangle and this rectangle. The two rectangles must overlap + /// for this to be meaningful. If the two rectangles do not overlap, + /// then the resulting Rect will have a negative width or height. + Rect intersect(Rect other) { + return new Rect.fromLTRB( + math.max(left, other.left), + math.max(top, other.top), + math.min(right, other.right), + math.min(bottom, other.bottom) + ); + } + + /// Returns a new rectangle which is the bounding box containing this + /// rectangle and the given rectangle. + Rect expandToInclude(Rect other) { + return new Rect.fromLTRB( + math.min(left, other.left), + math.min(top, other.top), + math.max(right, other.right), + math.max(bottom, other.bottom), + ); + } + + /// Whether `other` has a nonzero area of overlap with this rectangle. + bool overlaps(Rect other) { + if (right <= other.left || other.right <= left) + return false; + if (bottom <= other.top || other.bottom <= top) + return false; + return true; + } + + /// The lesser of the magnitudes of the [width] and the [height] of this + /// rectangle. + double get shortestSide => math.min(width.abs(), height.abs()); + + /// The greater of the magnitudes of the [width] and the [height] of this + /// rectangle. + double get longestSide => math.max(width.abs(), height.abs()); + + /// The offset to the intersection of the top and left edges of this rectangle. + /// + /// See also [Size.topLeft]. + Offset get topLeft => new Offset(left, top); + + /// The offset to the center of the top edge of this rectangle. + /// + /// See also [Size.topCenter]. + Offset get topCenter => new Offset(left + width / 2.0, top); + + /// The offset to the intersection of the top and right edges of this rectangle. + /// + /// See also [Size.topRight]. + Offset get topRight => new Offset(right, top); + + /// The offset to the center of the left edge of this rectangle. + /// + /// See also [Size.centerLeft]. + Offset get centerLeft => new Offset(left, top + height / 2.0); + + /// The offset to the point halfway between the left and right and the top and + /// bottom edges of this rectangle. + /// + /// See also [Size.center]. + Offset get center => new Offset(left + width / 2.0, top + height / 2.0); + + /// The offset to the center of the right edge of this rectangle. + /// + /// See also [Size.centerLeft]. + Offset get centerRight => new Offset(right, top + height / 2.0); + + /// The offset to the intersection of the bottom and left edges of this rectangle. + /// + /// See also [Size.bottomLeft]. + Offset get bottomLeft => new Offset(left, bottom); + + /// The offset to the center of the bottom edge of this rectangle. + /// + /// See also [Size.bottomLeft]. + Offset get bottomCenter => new Offset(left + width / 2.0, bottom); + + /// The offset to the intersection of the bottom and right edges of this rectangle. + /// + /// See also [Size.bottomRight]. + Offset get bottomRight => new Offset(right, bottom); + + /// Whether the point specified by the given offset (which is assumed to be + /// relative to the origin) lies between the left and right and the top and + /// bottom edges of this rectangle. + /// + /// Rectangles include their top and left edges but exclude their bottom and + /// right edges. + bool contains(Offset offset) { + return offset.dx >= left && offset.dx < right && offset.dy >= top && offset.dy < bottom; + } + + /// Linearly interpolate between two rectangles. + /// + /// If either rect is null, [Rect.zero] is used as a substitute. + /// + /// 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]. + static Rect lerp(Rect a, Rect b, double t) { + assert(t != null); + if (a == null && b == null) + return null; + if (a == null) + return new Rect.fromLTRB(b.left * t, b.top * t, b.right * t, b.bottom * t); + if (b == null) { + final double k = 1.0 - t; + return new Rect.fromLTRB(a.left * k, a.top * k, a.right * k, a.bottom * k); + } + return new Rect.fromLTRB( + lerpDouble(a.left, b.left, t), + lerpDouble(a.top, b.top, t), + lerpDouble(a.right, b.right, t), + lerpDouble(a.bottom, b.bottom, t), + ); + } + + @override + bool operator ==(dynamic other) { + if (identical(this, other)) + return true; + if (runtimeType != other.runtimeType) + return false; + final Rect typedOther = other; + for (int i = 0; i < _kDataSize; i += 1) { + if (_value[i] != typedOther._value[i]) + return false; + } + return true; + } + + @override + int get hashCode => hashList(_value); + + @override + String toString() => 'Rect.fromLTRB(${left.toStringAsFixed(1)}, ${top.toStringAsFixed(1)}, ${right.toStringAsFixed(1)}, ${bottom.toStringAsFixed(1)})'; +} + +/// A radius for either circular or elliptical shapes. +class Radius { + /// Constructs a circular radius. [x] and [y] will have the same radius value. + const Radius.circular(double radius) : this.elliptical(radius, radius); + + /// Constructs an elliptical radius with the given radii. + const Radius.elliptical(this.x, this.y); + + /// The radius value on the horizontal axis. + final double x; + + /// The radius value on the vertical axis. + final double y; + + /// A radius with [x] and [y] values set to zero. + /// + /// You can use [Radius.zero] with [RRect] to have right-angle corners. + static const Radius zero = const Radius.circular(0.0); + + /// Unary negation operator. + /// + /// Returns a Radius with the distances negated. + /// + /// Radiuses with negative values aren't geometrically meaningful, but could + /// occur as part of expressions. For example, negating a radius of one pixel + /// and then adding the result to another radius is equivalent to subtracting + /// a radius of one pixel from the other. + Radius operator -() => new Radius.elliptical(-x, -y); + + /// Binary subtraction operator. + /// + /// Returns a radius whose [x] value is the left-hand-side operand's [x] + /// minus the right-hand-side operand's [x] and whose [y] value is the + /// left-hand-side operand's [y] minus the right-hand-side operand's [y]. + Radius operator -(Radius other) => new Radius.elliptical(x - other.x, y - other.y); + + /// Binary addition operator. + /// + /// Returns a radius whose [x] value is the sum of the [x] values of the + /// two operands, and whose [y] value is the sum of the [y] values of the + /// two operands. + Radius operator +(Radius other) => new Radius.elliptical(x + other.x, y + other.y); + + /// Multiplication operator. + /// + /// Returns a radius whose coordinates are the coordinates of the + /// left-hand-side operand (a radius) multiplied by the scalar + /// right-hand-side operand (a double). + Radius operator *(double operand) => new Radius.elliptical(x * operand, y * operand); + + /// Division operator. + /// + /// Returns a radius whose coordinates are the coordinates of the + /// left-hand-side operand (a radius) divided by the scalar right-hand-side + /// operand (a double). + Radius operator /(double operand) => new Radius.elliptical(x / operand, y / operand); + + /// Integer (truncating) division operator. + /// + /// Returns a radius whose coordinates are the coordinates of the + /// left-hand-side operand (a radius) divided by the scalar right-hand-side + /// operand (a double), rounded towards zero. + Radius operator ~/(double operand) => new Radius.elliptical((x ~/ operand).toDouble(), (y ~/ operand).toDouble()); + + /// Modulo (remainder) operator. + /// + /// Returns a radius whose coordinates are the remainder of dividing the + /// coordinates of the left-hand-side operand (a radius) by the scalar + /// right-hand-side operand (a double). + Radius operator %(double operand) => new Radius.elliptical(x % operand, y % operand); + + /// Linearly interpolate between two radii. + /// + /// If either is null, this function substitutes [Radius.zero] instead. + /// + /// 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]. + static Radius lerp(Radius a, Radius b, double t) { + assert(t != null); + if (a == null && b == null) + return null; + if (a == null) + return new Radius.elliptical(b.x * t, b.y * t); + if (b == null) { + final double k = 1.0 - t; + return new Radius.elliptical(a.x * k, a.y * k); + } + return new Radius.elliptical( + lerpDouble(a.x, b.x, t), + lerpDouble(a.y, b.y, t), + ); + } + + @override + bool operator ==(dynamic other) { + if (identical(this, other)) + return true; + if (runtimeType != other.runtimeType) + return false; + final Radius typedOther = other; + return typedOther.x == x && typedOther.y == y; + } + + @override + int get hashCode => hashValues(x, y); + + @override + String toString() { + return x == y ? 'Radius.circular(${x.toStringAsFixed(1)})' : + 'Radius.elliptical(${x.toStringAsFixed(1)}, ' + '${y.toStringAsFixed(1)})'; + } +} + +/// An immutable rounded rectangle with the custom radii for all four corners. +class RRect { + RRect._(); + + /// Construct a rounded rectangle from its left, top, right, and bottom edges, + /// and the same radii along its horizontal axis and its vertical axis. + RRect.fromLTRBXY(double left, double top, double right, double bottom, + double radiusX, double radiusY) { + _value + ..[0] = left + ..[1] = top + ..[2] = right + ..[3] = bottom + ..[4] = radiusX + ..[5] = radiusY + ..[6] = radiusX + ..[7] = radiusY + ..[8] = radiusX + ..[9] = radiusY + ..[10] = radiusX + ..[11] = radiusY; + } + + /// Construct a rounded rectangle from its left, top, right, and bottom edges, + /// and the same radius in each corner. + RRect.fromLTRBR(double left, double top, double right, double bottom, + Radius radius) { + _value + ..[0] = left + ..[1] = top + ..[2] = right + ..[3] = bottom + ..[4] = radius.x + ..[5] = radius.y + ..[6] = radius.x + ..[7] = radius.y + ..[8] = radius.x + ..[9] = radius.y + ..[10] = radius.x + ..[11] = radius.y; + } + + /// Construct a rounded rectangle from its bounding box and the same radii + /// along its horizontal axis and its vertical axis. + RRect.fromRectXY(Rect rect, double radiusX, double radiusY) { + _value + ..[0] = rect.left + ..[1] = rect.top + ..[2] = rect.right + ..[3] = rect.bottom + ..[4] = radiusX + ..[5] = radiusY + ..[6] = radiusX + ..[7] = radiusY + ..[8] = radiusX + ..[9] = radiusY + ..[10] = radiusX + ..[11] = radiusY; + } + + /// Construct a rounded rectangle from its bounding box and a radius that is + /// the same in each corner. + RRect.fromRectAndRadius(Rect rect, Radius radius) { + _value + ..[0] = rect.left + ..[1] = rect.top + ..[2] = rect.right + ..[3] = rect.bottom + ..[4] = radius.x + ..[5] = radius.y + ..[6] = radius.x + ..[7] = radius.y + ..[8] = radius.x + ..[9] = radius.y + ..[10] = radius.x + ..[11] = radius.y; + } + + /// Construct a rounded rectangle from its left, top, right, and bottom edges, + /// and topLeft, topRight, bottomRight, and bottomLeft radii. + /// + /// The corner radii default to [Radius.zero], i.e. right-angled corners. + RRect.fromLTRBAndCorners( + double left, + double top, + double right, + double bottom, { + Radius topLeft: Radius.zero, + Radius topRight: Radius.zero, + Radius bottomRight: Radius.zero, + Radius bottomLeft: Radius.zero, + }) { + _value + ..[0] = left + ..[1] = top + ..[2] = right + ..[3] = bottom + ..[4] = topLeft.x + ..[5] = topLeft.y + ..[6] = topRight.x + ..[7] = topRight.y + ..[8] = bottomRight.x + ..[9] = bottomRight.y + ..[10] = bottomLeft.x + ..[11] = bottomLeft.y; + } + + /// Construct a rounded rectangle from its bounding box and and topLeft, + /// topRight, bottomRight, and bottomLeft radii. + /// + /// The corner radii default to [Radius.zero], i.e. right-angled corners + RRect.fromRectAndCorners( + Rect rect, + { + Radius topLeft: Radius.zero, + Radius topRight: Radius.zero, + Radius bottomRight: Radius.zero, + Radius bottomLeft: Radius.zero + } + ) { + _value + ..[0] = rect.left + ..[1] = rect.top + ..[2] = rect.right + ..[3] = rect.bottom + ..[4] = topLeft.x + ..[5] = topLeft.y + ..[6] = topRight.x + ..[7] = topRight.y + ..[8] = bottomRight.x + ..[9] = bottomRight.y + ..[10] = bottomLeft.x + ..[11] = bottomLeft.y; + } + + RRect._fromList(List list) { + for (int i = 0; i < _kDataSize; i += 1) + _value[i] = list[i]; + } + + static const int _kDataSize = 12; + final Float32List _value = new Float32List(_kDataSize); + RRect _scaled; // same RRect with scaled radii per side + + /// The offset of the left edge of this rectangle from the x axis. + double get left => _value[0]; + + /// The offset of the top edge of this rectangle from the y axis. + double get top => _value[1]; + + /// The offset of the right edge of this rectangle from the x axis. + double get right => _value[2]; + + /// The offset of the bottom edge of this rectangle from the y axis. + double get bottom => _value[3]; + + /// The top-left horizontal radius. + double get tlRadiusX => _value[4]; + + /// The top-left vertical radius. + double get tlRadiusY => _value[5]; + + /// The top-left [Radius]. + Radius get tlRadius => new Radius.elliptical(_value[4], _value[5]); + + /// The top-right horizontal radius. + double get trRadiusX => _value[6]; + + /// The top-right vertical radius. + double get trRadiusY => _value[7]; + + /// The top-right [Radius]. + Radius get trRadius => new Radius.elliptical(_value[6], _value[7]); + + /// The bottom-right horizontal radius. + double get brRadiusX => _value[8]; + + /// The bottom-right vertical radius. + double get brRadiusY => _value[9]; + + /// The bottom-right [Radius]. + Radius get brRadius => new Radius.elliptical(_value[8], _value[9]); + + /// The bottom-left horizontal radius. + double get blRadiusX => _value[10]; + + /// The bottom-left vertical radius. + double get blRadiusY => _value[11]; + + /// The bottom-left [Radius]. + Radius get blRadius => new Radius.elliptical(_value[10], _value[11]); + + /// A rounded rectangle with all the values set to zero. + static final RRect zero = new RRect._(); + + /// Returns a new [RRect] translated by the given offset. + RRect shift(Offset offset) { + return new RRect.fromLTRBAndCorners( + _value[0] + offset.dx, + _value[1] + offset.dy, + _value[2] + offset.dx, + _value[3] + offset.dy, + topLeft: new Radius.elliptical( + _value[4], + _value[5] + ), + topRight: new Radius.elliptical( + _value[6], + _value[7] + ), + bottomRight: new Radius.elliptical( + _value[8], + _value[9] + ), + bottomLeft: new Radius.elliptical( + _value[10], + _value[11] + ) + ); + } + + /// Returns a new [RRect] with edges and radii moved outwards by the given + /// delta. + RRect inflate(double delta) { + return new RRect.fromLTRBAndCorners( + _value[0] - delta, + _value[1] - delta, + _value[2] + delta, + _value[3] + delta, + topLeft: new Radius.elliptical( + _value[4] + delta, + _value[5] + delta + ), + topRight: new Radius.elliptical( + _value[6] + delta, + _value[7] + delta + ), + bottomRight: new Radius.elliptical( + _value[8] + delta, + _value[9] + delta + ), + bottomLeft: new Radius.elliptical( + _value[10] + delta, + _value[11] + delta + ) + ); + } + + /// Returns a new [RRect] with edges and radii moved inwards by the given delta. + RRect deflate(double delta) => inflate(-delta); + + /// The distance between the left and right edges of this rectangle. + double get width => right - left; + + /// The distance between the top and bottom edges of this rectangle. + double get height => bottom - top; + + /// The bounding box of this rounded rectangle (the rectangle with no rounded corners). + Rect get outerRect => new Rect.fromLTRB(left, top, right, bottom); + + /// The non-rounded rectangle that is constrained by the smaller of the two + /// diagonals, with each diagonal traveling through the middle of the curve + /// corners. The middle of a corner is the intersection of the curve with its + /// respective quadrant bisector. + Rect get safeInnerRect { + const double kInsetFactor = 0.29289321881; // 1-cos(pi/4) + + final double leftRadius = math.max(blRadiusX, tlRadiusX); + final double topRadius = math.max(tlRadiusY, trRadiusY); + final double rightRadius = math.max(trRadiusX, brRadiusX); + final double bottomRadius = math.max(brRadiusY, blRadiusY); + + return new Rect.fromLTRB( + left + leftRadius * kInsetFactor, + top + topRadius * kInsetFactor, + right - rightRadius * kInsetFactor, + bottom - bottomRadius * kInsetFactor + ); + } + + /// The rectangle that would be formed using the axis-aligned intersection of + /// the sides of the rectangle, i.e., the rectangle formed from the + /// inner-most centers of the ellipses that form the corners. This is the + /// intersection of the [wideMiddleRect] and the [tallMiddleRect]. If any of + /// the intersections are void, the resulting [Rect] will have negative width + /// or height. + Rect get middleRect { + final double leftRadius = math.max(blRadiusX, tlRadiusX); + final double topRadius = math.max(tlRadiusY, trRadiusY); + final double rightRadius = math.max(trRadiusX, brRadiusX); + final double bottomRadius = math.max(brRadiusY, blRadiusY); + return new Rect.fromLTRB( + left + leftRadius, + top + topRadius, + right - rightRadius, + bottom - bottomRadius + ); + } + + /// The biggest rectangle that is entirely inside the rounded rectangle and + /// has the full width of the rounded rectangle. If the rounded rectangle does + /// not have an axis-aligned intersection of its left and right side, the + /// resulting [Rect] will have negative width or height. + Rect get wideMiddleRect { + final double topRadius = math.max(tlRadiusY, trRadiusY); + final double bottomRadius = math.max(brRadiusY, blRadiusY); + return new Rect.fromLTRB( + left, + top + topRadius, + right, + bottom - bottomRadius + ); + } + + /// The biggest rectangle that is entirely inside the rounded rectangle and + /// has the full height of the rounded rectangle. If the rounded rectangle + /// does not have an axis-aligned intersection of its top and bottom side, the + /// resulting [Rect] will have negative width or height. + Rect get tallMiddleRect { + final double leftRadius = math.max(blRadiusX, tlRadiusX); + final double rightRadius = math.max(trRadiusX, brRadiusX); + return new Rect.fromLTRB( + left + leftRadius, + top, + right - rightRadius, + bottom + ); + } + + /// Whether this rounded rectangle encloses a non-zero area. + /// Negative areas are considered empty. + bool get isEmpty => left >= right || top >= bottom; + + /// Whether all coordinates of this rounded rectangle are finite. + bool get isFinite => left.isFinite && top.isFinite && right.isFinite && bottom.isFinite; + + /// Whether this rounded rectangle is a simple rectangle with zero + /// corner radii. + bool get isRect { + return (tlRadiusX == 0.0 || tlRadiusY == 0.0) && + (trRadiusX == 0.0 || trRadiusY == 0.0) && + (blRadiusX == 0.0 || blRadiusY == 0.0) && + (brRadiusX == 0.0 || brRadiusY == 0.0); + } + + /// Whether this rounded rectangle has a side with no straight section. + bool get isStadium { + return tlRadius == trRadius + && trRadius == brRadius + && brRadius == blRadius + && (width <= 2.0 * tlRadiusX || height <= 2.0 * tlRadiusY); + } + + /// Whether this rounded rectangle has no side with a straight section. + bool get isEllipse { + return tlRadius == trRadius + && trRadius == brRadius + && brRadius == blRadius + && width <= 2.0 * tlRadiusX + && height <= 2.0 * tlRadiusY; + } + + /// Whether this rounded rectangle would draw as a circle. + bool get isCircle => width == height && isEllipse; + + /// The lesser of the magnitudes of the [width] and the [height] of this + /// rounded rectangle. + double get shortestSide => math.min(width.abs(), height.abs()); + + /// The greater of the magnitudes of the [width] and the [height] of this + /// rounded rectangle. + double get longestSide => math.max(width.abs(), height.abs()); + + + /// The offset to the point halfway between the left and right and the top and + /// bottom edges of this rectangle. + Offset get center => new Offset(left + width / 2.0, top + height / 2.0); + + // Returns the minimum between min and scale to which radius1 and radius2 + // should be scaled with in order not to exceed the limit. + double _getMin(double min, double radius1, double radius2, double limit) { + final double sum = radius1 + radius2; + if (sum > limit && sum != 0.0) + return math.min(min, limit / sum); + return min; + } + + // Scales all radii so that on each side their sum will not pass the size of + // the width/height. + // + // Inspired from: + // https://github.com/google/skia/blob/master/src/core/SkRRect.cpp#L164 + void _scaleRadii() { + if (_scaled == null) { + double scale = 1.0; + final List scaled = new List.from(_value); + + scale = _getMin(scale, scaled[11], scaled[5], height); + scale = _getMin(scale, scaled[4], scaled[6], width); + scale = _getMin(scale, scaled[7], scaled[9], height); + scale = _getMin(scale, scaled[8], scaled[10], width); + + if (scale < 1.0) { + for (int i = 4; i < _kDataSize; i += 1) + scaled[i] *= scale; + } + + _scaled = new RRect._fromList(scaled); + } + } + + /// Whether the point specified by the given offset (which is assumed to be + /// relative to the origin) lies inside the rounded rectangle. + /// + /// This method may allocate (and cache) a copy of the object with normalized + /// radii the first time it is called on a particular [RRect] instance. When + /// using this method, prefer to reuse existing [RRect]s rather than + /// recreating the object each time. + bool contains(Offset point) { + if (point.dx < left || point.dx >= right || point.dy < top || point.dy >= bottom) + return false; // outside bounding box + + _scaleRadii(); + + double x; + double y; + double radiusX; + double radiusY; + // check whether point is in one of the rounded corner areas + // x, y -> translate to ellipse center + if (point.dx < left + _scaled.tlRadiusX && + point.dy < top + _scaled.tlRadiusY) { + x = point.dx - left - _scaled.tlRadiusX; + y = point.dy - top - _scaled.tlRadiusY; + radiusX = _scaled.tlRadiusX; + radiusY = _scaled.tlRadiusY; + } else if (point.dx > right - _scaled.trRadiusX && + point.dy < top + _scaled.trRadiusY) { + x = point.dx - right + _scaled.trRadiusX; + y = point.dy - top - _scaled.trRadiusY; + radiusX = _scaled.trRadiusX; + radiusY = _scaled.trRadiusY; + } else if (point.dx > right - _scaled.brRadiusX && + point.dy > bottom - _scaled.brRadiusY) { + x = point.dx - right + _scaled.brRadiusX; + y = point.dy - bottom + _scaled.brRadiusY; + radiusX = _scaled.brRadiusX; + radiusY = _scaled.brRadiusY; + } else if (point.dx < left + _scaled.blRadiusX && + point.dy > bottom - _scaled.blRadiusY) { + x = point.dx - left - _scaled.blRadiusX; + y = point.dy - bottom + _scaled.blRadiusY; + radiusX = _scaled.blRadiusX; + radiusY = _scaled.blRadiusY; + } else { + return true; // inside and not within the rounded corner area + } + + x = x / radiusX; + y = y / radiusY; + // check if the point is outside the unit circle + if (x * x + y * y > 1.0) + return false; + return true; + } + + /// Linearly interpolate between two rounded rectangles. + /// + /// If either is null, this function substitutes [RRect.zero] instead. + /// + /// 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]. + static RRect lerp(RRect a, RRect b, double t) { + assert(t != null); + if (a == null && b == null) + return null; + if (a == null) { + return new RRect._fromList([ + b.left * t, + b.top * t, + b.right * t, + b.bottom * t, + b.tlRadiusX * t, + b.tlRadiusY * t, + b.trRadiusX * t, + b.trRadiusY * t, + b.brRadiusX * t, + b.brRadiusY * t, + b.blRadiusX * t, + b.blRadiusY * t, + ]); + } + if (b == null) { + final double k = 1.0 - t; + return new RRect._fromList([ + a.left * k, + a.top * k, + a.right * k, + a.bottom * k, + a.tlRadiusX * k, + a.tlRadiusY * k, + a.trRadiusX * k, + a.trRadiusY * k, + a.brRadiusX * k, + a.brRadiusY * k, + a.blRadiusX * k, + a.blRadiusY * k, + ]); + } + return new RRect._fromList([ + lerpDouble(a.left, b.left, t), + lerpDouble(a.top, b.top, t), + lerpDouble(a.right, b.right, t), + lerpDouble(a.bottom, b.bottom, t), + lerpDouble(a.tlRadiusX, b.tlRadiusX, t), + lerpDouble(a.tlRadiusY, b.tlRadiusY, t), + lerpDouble(a.trRadiusX, b.trRadiusX, t), + lerpDouble(a.trRadiusY, b.trRadiusY, t), + lerpDouble(a.brRadiusX, b.brRadiusX, t), + lerpDouble(a.brRadiusY, b.brRadiusY, t), + lerpDouble(a.blRadiusX, b.blRadiusX, t), + lerpDouble(a.blRadiusY, b.blRadiusY, t), + ]); + } + + @override + bool operator ==(dynamic other) { + if (identical(this, other)) + return true; + if (runtimeType != other.runtimeType) + return false; + final RRect typedOther = other; + for (int i = 0; i < _kDataSize; i += 1) { + if (_value[i] != typedOther._value[i]) + return false; + } + return true; + } + + @override + int get hashCode => hashList(_value); + + @override + String toString() { + final String rect = '${left.toStringAsFixed(1)}, ' + '${top.toStringAsFixed(1)}, ' + '${right.toStringAsFixed(1)}, ' + '${bottom.toStringAsFixed(1)}'; + if (tlRadius == trRadius && + trRadius == brRadius && + brRadius == blRadius) { + if (tlRadius.x == tlRadius.y) + return 'RRect.fromLTRBR($rect, ${tlRadius.x.toStringAsFixed(1)})'; + return 'RRect.fromLTRBXY($rect, ${tlRadius.x.toStringAsFixed(1)}, ${tlRadius.y.toStringAsFixed(1)})'; + } + return 'RRect.fromLTRBAndCorners(' + '$rect, ' + 'topLeft: $tlRadius, ' + 'topRight: $trRadius, ' + 'bottomRight: $brRadius, ' + 'bottomLeft: $blRadius' + ')'; + } +} + +/// A transform consisting of a translation, a rotation, and a uniform scale. +/// +/// Used by [Canvas.drawAtlas]. This is a more efficient way to represent these +/// simple transformations than a full matrix. +// Modeled after Skia's SkRSXform. +class RSTransform { + /// Creates an RSTransform. + /// + /// An [RSTransform] expresses the combination of a translation, a rotation + /// around a particular point, and a scale factor. + /// + /// The first argument, `scos`, is the cosine of the rotation, multiplied by + /// the scale factor. + /// + /// The second argument, `ssin`, is the sine of the rotation, multiplied by + /// that same scale factor. + /// + /// The third argument is the x coordinate of the translation, minus the + /// `scos` argument multiplied by the x-coordinate of the rotation point, plus + /// the `ssin` argument multiplied by the y-coordinate of the rotation point. + /// + /// The fourth argument is the y coordinate of the translation, minus the `ssin` + /// argument multiplied by the x-coordinate of the rotation point, minus the + /// `scos` argument multiplied by the y-coordinate of the rotation point. + /// + /// The [new RSTransform.fromComponents] method may be a simpler way to + /// construct these values. However, if there is a way to factor out the + /// computations of the sine and cosine of the rotation so that they can be + /// reused over multiple calls to this constructor, it may be more efficient + /// to directly use this constructor instead. + RSTransform(double scos, double ssin, double tx, double ty) { + _value + ..[0] = scos + ..[1] = ssin + ..[2] = tx + ..[3] = ty; + } + + /// Creates an RSTransform from its individual components. + /// + /// The `rotation` parameter gives the rotation in radians. + /// + /// The `scale` parameter describes the uniform scale factor. + /// + /// The `anchorX` and `anchorY` parameters give the coordinate of the point + /// around which to rotate. + /// + /// The `translateX` and `translateY` parameters give the coordinate of the + /// offset by which to translate. + /// + /// This constructor computes the arguments of the [new RSTransform] + /// constructor and then defers to that constructor to actually create the + /// object. If many [RSTransform] objects are being created and there is a way + /// to factor out the computations of the sine and cosine of the rotation + /// (which are computed each time this constructor is called) and reuse them + /// over multiple [RSTransform] objects, it may be more efficient to directly + /// use the more direct [new RSTransform] constructor instead. + factory RSTransform.fromComponents({ + double rotation, + double scale, + double anchorX, + double anchorY, + double translateX, + double translateY + }) { + final double scos = math.cos(rotation) * scale; + final double ssin = math.sin(rotation) * scale; + final double tx = translateX + -scos * anchorX + ssin * anchorY; + final double ty = translateY + -ssin * anchorX - scos * anchorY; + return new RSTransform(scos, ssin, tx, ty); + } + + final Float32List _value = new Float32List(4); + + /// The cosine of the rotation multiplied by the scale factor. + double get scos => _value[0]; + + /// The sine of the rotation multiplied by that same scale factor. + double get ssin => _value[1]; + + /// The x coordinate of the translation, minus [scos] multiplied by the + /// x-coordinate of the rotation point, plus [ssin] multiplied by the + /// y-coordinate of the rotation point. + double get tx => _value[2]; + + /// The y coordinate of the translation, minus [ssin] multiplied by the + /// x-coordinate of the rotation point, minus [scos] multiplied by the + /// y-coordinate of the rotation point. + double get ty => _value[3]; +} diff --git a/lib/stub_ui/hash_codes.dart b/lib/stub_ui/hash_codes.dart new file mode 100644 index 0000000000000..a3a24d7b7dd54 --- /dev/null +++ b/lib/stub_ui/hash_codes.dart @@ -0,0 +1,121 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of dart.ui; + +class _HashEnd { const _HashEnd(); } +const _HashEnd _hashEnd = const _HashEnd(); + +/// Jenkins hash function, optimized for small integers. +// +// Borrowed from the dart sdk: sdk/lib/math/jenkins_smi_hash.dart. +class _Jenkins { + static int combine(int hash, Object o) { + assert(o is! Iterable); + hash = 0x1fffffff & (hash + o.hashCode); + hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); + return hash ^ (hash >> 6); + } + + static int finish(int hash) { + hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); + hash = hash ^ (hash >> 11); + return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); + } +} + +/// Combine up to twenty objects' hash codes into one value. +/// +/// If you only need to handle one object's hash code, then just refer to its +/// [Object.hashCode] getter directly. +/// +/// If you need to combine an arbitrary number of objects from a [List] or other +/// [Iterable], use [hashList]. The output of [hashList] can be used as one of +/// the arguments to this function. +/// +/// For example: +/// +/// ```dart +/// int hashCode => hashValues(foo, bar, hashList(quux), baz); +/// ``` +int hashValues( + Object arg01, Object arg02, [ Object arg03 = _hashEnd, + Object arg04 = _hashEnd, Object arg05 = _hashEnd, Object arg06 = _hashEnd, + Object arg07 = _hashEnd, Object arg08 = _hashEnd, Object arg09 = _hashEnd, + Object arg10 = _hashEnd, Object arg11 = _hashEnd, Object arg12 = _hashEnd, + Object arg13 = _hashEnd, Object arg14 = _hashEnd, Object arg15 = _hashEnd, + Object arg16 = _hashEnd, Object arg17 = _hashEnd, Object arg18 = _hashEnd, + Object arg19 = _hashEnd, Object arg20 = _hashEnd ]) { + int result = 0; + result = _Jenkins.combine(result, arg01); + result = _Jenkins.combine(result, arg02); + if (arg03 != _hashEnd) { + result = _Jenkins.combine(result, arg03); + if (arg04 != _hashEnd) { + result = _Jenkins.combine(result, arg04); + if (arg05 != _hashEnd) { + result = _Jenkins.combine(result, arg05); + if (arg06 != _hashEnd) { + result = _Jenkins.combine(result, arg06); + if (arg07 != _hashEnd) { + result = _Jenkins.combine(result, arg07); + if (arg08 != _hashEnd) { + result = _Jenkins.combine(result, arg08); + if (arg09 != _hashEnd) { + result = _Jenkins.combine(result, arg09); + if (arg10 != _hashEnd) { + result = _Jenkins.combine(result, arg10); + if (arg11 != _hashEnd) { + result = _Jenkins.combine(result, arg11); + if (arg12 != _hashEnd) { + result = _Jenkins.combine(result, arg12); + if (arg13 != _hashEnd) { + result = _Jenkins.combine(result, arg13); + if (arg14 != _hashEnd) { + result = _Jenkins.combine(result, arg14); + if (arg15 != _hashEnd) { + result = _Jenkins.combine(result, arg15); + if (arg16 != _hashEnd) { + result = _Jenkins.combine(result, arg16); + if (arg17 != _hashEnd) { + result = _Jenkins.combine(result, arg17); + if (arg18 != _hashEnd) { + result = _Jenkins.combine(result, arg18); + if (arg19 != _hashEnd) { + result = _Jenkins.combine(result, arg19); + if (arg20 != _hashEnd) { + result = _Jenkins.combine(result, arg20); + // I can see my house from here! + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + return _Jenkins.finish(result); +} + +/// Combine the [Object.hashCode] values of an arbitrary number of objects from +/// an [Iterable] into one value. This function will return the same value if +/// given null as if given an empty list. +int hashList(Iterable arguments) { + int result = 0; + if (arguments != null) { + for (Object argument in arguments) + result = _Jenkins.combine(result, argument); + } + return _Jenkins.finish(result); +} diff --git a/lib/stub_ui/hooks.dart b/lib/stub_ui/hooks.dart new file mode 100644 index 0000000000000..8fd0c2a338a01 --- /dev/null +++ b/lib/stub_ui/hooks.dart @@ -0,0 +1,252 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO(dnfield): Remove unused_import ignores when https://github.com/dart-lang/sdk/issues/35164 is resolved. + +part of dart.ui; + +// ignore: unused_element +String _decodeUTF8(ByteData message) { + return message != null ? utf8.decoder.convert(message.buffer.asUint8List()) : null; +} + +// ignore: unused_element +dynamic _decodeJSON(String message) { + return message != null ? json.decode(message) : null; +} + +// ignore: unused_element +void _updateWindowMetrics(double devicePixelRatio, + double width, + double height, + double paddingTop, + double paddingRight, + double paddingBottom, + double paddingLeft, + double viewInsetTop, + double viewInsetRight, + double viewInsetBottom, + double viewInsetLeft) { + window + .._devicePixelRatio = devicePixelRatio + .._physicalSize = new Size(width, height) + .._padding = new WindowPadding._( + top: paddingTop, + right: paddingRight, + bottom: paddingBottom, + left: paddingLeft) + .._viewInsets = new WindowPadding._( + top: viewInsetTop, + right: viewInsetRight, + bottom: viewInsetBottom, + left: viewInsetLeft); + _invoke(window.onMetricsChanged, window._onMetricsChangedZone); +} + +typedef _LocaleClosure = String Function(); + +String _localeClosure() { + if (window.locale == null) { + return null; + } + return window.locale.toString(); +} + +// ignore: unused_element +_LocaleClosure _getLocaleClosure() => _localeClosure; + +// ignore: unused_element +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); +} + +// ignore: unused_element +void _updateUserSettingsData(String jsonData) { + final Map data = json.decode(jsonData); + if (data.isEmpty) { + return; + } + _updateTextScaleFactor(data['textScaleFactor'].toDouble()); + _updateAlwaysUse24HourFormat(data['alwaysUse24HourFormat']); +} + +void _updateTextScaleFactor(double textScaleFactor) { + window._textScaleFactor = textScaleFactor; + _invoke(window.onTextScaleFactorChanged, window._onTextScaleFactorChangedZone); +} + +void _updateAlwaysUse24HourFormat(bool alwaysUse24HourFormat) { + window._alwaysUse24HourFormat = alwaysUse24HourFormat; +} + +// ignore: unused_element +void _updateSemanticsEnabled(bool enabled) { + window._semanticsEnabled = enabled; + _invoke(window.onSemanticsEnabledChanged, window._onSemanticsEnabledChangedZone); +} + +// ignore: unused_element +void _updateAccessibilityFeatures(int values) { + final AccessibilityFeatures newFeatures = new AccessibilityFeatures._(values); + if (newFeatures == window._accessibilityFeatures) + return; + window._accessibilityFeatures = newFeatures; + _invoke(window.onAccessibilityFeaturesChanged, window._onAccessibilityFlagsChangedZone); +} + +// ignore: unused_element +void _dispatchPointerDataPacket(ByteData packet) { + if (window.onPointerDataPacket != null) + _invoke1(window.onPointerDataPacket, window._onPointerDataPacketZone, _unpackPointerDataPacket(packet)); +} + +// ignore: unused_element +void _dispatchSemanticsAction(int id, int action, ByteData args) { + _invoke3( + window.onSemanticsAction, + window._onSemanticsActionZone, + id, + SemanticsAction.values[action], + args, + ); +} + +// ignore: unused_element +void _beginFrame(int microseconds) { + _invoke1(window.onBeginFrame, window._onBeginFrameZone, new Duration(microseconds: microseconds)); +} + +// ignore: unused_element +void _drawFrame() { + _invoke(window.onDrawFrame, window._onDrawFrameZone); +} + +// ignore: unused_element +void _runMainZoned(Function startMainIsolateFunction, Function userMainFunction) { + startMainIsolateFunction((){ + runZoned>(() { + userMainFunction(); + }, onError: (Object error, StackTrace stackTrace) { + _reportUnhandledException(error.toString(), stackTrace.toString()); + }); + }, null); +} + +void _reportUnhandledException(String error, String stackTrace) { + throw UnimplementedError(); +} + +/// Invokes [callback] inside the given [zone]. +void _invoke(void callback(), Zone zone) { + if (callback == null) + return; + + assert(zone != null); + + if (identical(zone, Zone.current)) { + callback(); + } else { + zone.runGuarded(callback); + } +} + +/// Invokes [callback] inside the given [zone] passing it [arg]. +void _invoke1(void callback(A a), Zone zone, A arg) { + if (callback == null) + return; + + assert(zone != null); + + if (identical(zone, Zone.current)) { + callback(arg); + } else { + zone.runUnaryGuarded(callback, arg); + } +} + +/// Invokes [callback] inside the given [zone] passing it [arg1] and [arg2]. +// ignore: unused_element +void _invoke2(void callback(A1 a1, A2 a2), Zone zone, A1 arg1, A2 arg2) { + if (callback == null) + return; + + assert(zone != null); + + if (identical(zone, Zone.current)) { + callback(arg1, arg2); + } else { + zone.runBinaryGuarded(callback, arg1, arg2); + } +} + +/// Invokes [callback] inside the given [zone] passing it [arg1], [arg2] and [arg3]. +void _invoke3(void callback(A1 a1, A2 a2, A3 a3), Zone zone, A1 arg1, A2 arg2, A3 arg3) { + if (callback == null) + return; + + assert(zone != null); + + if (identical(zone, Zone.current)) { + callback(arg1, arg2, arg3); + } else { + zone.runGuarded(() { + callback(arg1, arg2, arg3); + }); + } +} + +// If this value changes, update the encoding code in the following files: +// +// * pointer_data.cc +// * FlutterView.java +const int _kPointerDataFieldCount = 21; + +PointerDataPacket _unpackPointerDataPacket(ByteData packet) { + const int kStride = Int64List.bytesPerElement; + const int kBytesPerPointerData = _kPointerDataFieldCount * kStride; + final int length = packet.lengthInBytes ~/ kBytesPerPointerData; + assert(length * kBytesPerPointerData == packet.lengthInBytes); + final List data = new List(length); + for (int i = 0; i < length; ++i) { + int offset = i * _kPointerDataFieldCount; + data[i] = new PointerData( + timeStamp: new Duration(microseconds: packet.getInt64(kStride * offset++, _kFakeHostEndian)), + change: PointerChange.values[packet.getInt64(kStride * offset++, _kFakeHostEndian)], + kind: PointerDeviceKind.values[packet.getInt64(kStride * offset++, _kFakeHostEndian)], + device: packet.getInt64(kStride * offset++, _kFakeHostEndian), + physicalX: packet.getFloat64(kStride * offset++, _kFakeHostEndian), + physicalY: packet.getFloat64(kStride * offset++, _kFakeHostEndian), + buttons: packet.getInt64(kStride * offset++, _kFakeHostEndian), + obscured: packet.getInt64(kStride * offset++, _kFakeHostEndian) != 0, + pressure: packet.getFloat64(kStride * offset++, _kFakeHostEndian), + pressureMin: packet.getFloat64(kStride * offset++, _kFakeHostEndian), + 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), + platformData: packet.getInt64(kStride * offset++, _kFakeHostEndian), + ); + assert(offset == (i + 1) * _kPointerDataFieldCount); + } + return new PointerDataPacket(data: data); +} diff --git a/lib/stub_ui/isolate_name_server.dart b/lib/stub_ui/isolate_name_server.dart new file mode 100644 index 0000000000000..b346dc8f32aa9 --- /dev/null +++ b/lib/stub_ui/isolate_name_server.dart @@ -0,0 +1,72 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of dart.ui; + +/// Static methods to allow for simple sharing of [SendPort]s across [Isolate]s. +/// +/// All isolates share a global mapping of names to ports. An isolate can +/// register a [SendPort] with a given name using [registerPortWithName]; +/// another isolate can then look up that port using [lookupPortByName]. +/// +/// To create a [SendPort], first create a [ReceivePort], then use +/// [ReceivePort.sendPort]. +/// +/// Since multiple isolates can each obtain the same [SendPort] associated with +/// a particular [ReceivePort], the protocol built on top of this mechanism +/// should typically consist of a single message. If more elaborate two-way +/// communication or multiple-message communication is necessary, it is +/// recommended to establish a separate communication channel in that first +/// message (e.g. by passing a dedicated [SendPort]). +class IsolateNameServer { + // This class is only a namespace, and should not be instantiated or + // extended directly. + factory IsolateNameServer._() => null; + + /// Looks up the [SendPort] associated with a given name. + /// + /// Returns null if the name does not exist. To register the name in the first + /// place, consider [registerPortWithName]. + /// + /// The `name` argument must not be null. + static SendPort lookupPortByName(String name) { + assert(name != null, "'name' cannot be null."); + throw UnimplementedError(); + } + + /// Registers a [SendPort] with a given name. + /// + /// Returns true if registration is successful, and false if the name entry + /// already existed (in which case the earlier registration is left + /// unchanged). To remove a registration, consider [removePortNameMapping]. + /// + /// Once a port has been registered with a name, it can be obtained from any + /// [Isolate] using [lookupPortByName]. + /// + /// Multiple isolates should avoid attempting to register ports with the same + /// name, as there is an inherent race condition in doing so. + /// + /// The `port` and `name` arguments must not be null. + static bool registerPortWithName(SendPort port, String name) { + assert(port != null, "'port' cannot be null."); + assert(name != null, "'name' cannot be null."); + throw UnimplementedError(); + } + + /// Removes a name-to-[SendPort] mapping given its name. + /// + /// Returns true if the mapping was successfully removed, false if the mapping + /// did not exist. To add a registration, consider [registerPortWithName]. + /// + /// Generally, removing a port name mapping is an inherently racy operation + /// (another isolate could have obtained the name just prior to the name being + /// removed, and thus would still be able to communicate over the port even + /// after it has been removed). + /// + /// The `name` argument must not be null. + static bool removePortNameMapping(String name) { + assert(name != null, "'name' cannot be null."); + throw UnimplementedError(); + } +} diff --git a/lib/stub_ui/lerp.dart b/lib/stub_ui/lerp.dart new file mode 100644 index 0000000000000..0c69476779b73 --- /dev/null +++ b/lib/stub_ui/lerp.dart @@ -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. + +part of dart.ui; + +/// Linearly interpolate between two numbers. +double lerpDouble(num a, num b, double t) { + if (a == null && b == null) + return null; + a ??= 0.0; + b ??= 0.0; + return a + (b - a) * t; +} diff --git a/lib/stub_ui/libraries.json b/lib/stub_ui/libraries.json new file mode 100644 index 0000000000000..183ce7a8c5fe2 --- /dev/null +++ b/lib/stub_ui/libraries.json @@ -0,0 +1,122 @@ +{ + "comment:0": "NOTE: THIS FILE IS GENERATED. DO NOT EDIT.", + "comment:1": "Instead modify 'flutter/lib/stub_ui/libraries.yaml' and follow the instructions therein.", + "dart2js": { + "libraries": { + "async": { + "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart", + "uri": "../../dart-sdk/lib/async/async.dart" + }, + "_interceptors": { + "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/interceptors.dart" + }, + "mirrors": { + "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart", + "supported": false, + "uri": "../../dart-sdk/lib/mirrors/mirrors.dart" + }, + "_js_embedded_names": { + "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart" + }, + "io": { + "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/io_patch.dart", + "supported": false, + "uri": "../../dart-sdk/lib/io/io.dart" + }, + "_internal": { + "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/internal_patch.dart", + "uri": "../../dart-sdk/lib/internal/internal.dart" + }, + "_metadata": { + "uri": "../../dart-sdk/lib/html/html_common/metadata.dart" + }, + "_async_await_error_codes": { + "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart" + }, + "_http": { + "uri": "../../dart-sdk/lib/_http/http.dart" + }, + "_js_primitives": { + "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/js_primitives.dart" + }, + "_js_helper": { + "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/js_helper.dart" + }, + "_chrome": { + "uri": "../../dart-sdk/lib/_chrome/dart2js/chrome_dart2js.dart" + }, + "html_common": { + "uri": "../../dart-sdk/lib/html/html_common/html_common_dart2js.dart" + }, + "ui": { + "uri": "stub_ui/ui.dart" + }, + "js": { + "uri": "../../dart-sdk/lib/js/dart2js/js_dart2js.dart" + }, + "_native_typed_data": { + "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/native_typed_data.dart" + }, + "_js_names": { + "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/js_names.dart" + }, + "core": { + "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/core_patch.dart", + "uri": "../../dart-sdk/lib/core/core.dart" + }, + "collection": { + "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/collection_patch.dart", + "uri": "../../dart-sdk/lib/collection/collection.dart" + }, + "js_util": { + "uri": "../../dart-sdk/lib/js_util/dart2js/js_util_dart2js.dart" + }, + "typed_data": { + "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/typed_data_patch.dart", + "uri": "../../dart-sdk/lib/typed_data/typed_data.dart" + }, + "web_audio": { + "uri": "../../dart-sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" + }, + "html": { + "uri": "../../dart-sdk/lib/html/dart2js/html_dart2js.dart" + }, + "isolate": { + "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/isolate_patch.dart", + "supported": false, + "uri": "../../dart-sdk/lib/isolate/isolate.dart" + }, + "developer": { + "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/developer_patch.dart", + "uri": "../../dart-sdk/lib/developer/developer.dart" + }, + "web_gl": { + "uri": "../../dart-sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" + }, + "indexed_db": { + "uri": "../../dart-sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" + }, + "_js": { + "patches": "../../dart-sdk/lib/js/_js_client.dart", + "uri": "../../dart-sdk/lib/js/_js.dart" + }, + "convert": { + "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/convert_patch.dart", + "uri": "../../dart-sdk/lib/convert/convert.dart" + }, + "math": { + "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/math_patch.dart", + "uri": "../../dart-sdk/lib/math/math.dart" + }, + "_foreign_helper": { + "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/foreign_helper.dart" + }, + "web_sql": { + "uri": "../../dart-sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" + }, + "svg": { + "uri": "../../dart-sdk/lib/svg/dart2js/svg_dart2js.dart" + } + } + } +} \ No newline at end of file diff --git a/lib/stub_ui/libraries.yaml b/lib/stub_ui/libraries.yaml new file mode 100644 index 0000000000000..39196be63e5c9 --- /dev/null +++ b/lib/stub_ui/libraries.yaml @@ -0,0 +1,133 @@ +# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. + +# Note: if you edit this file, you must also edit libraries.json in this +# directory: +# +#. python third_party/dart/tools/yaml2json.py flutter/lib/snapshot/libraries.yaml flutter/lib/snapshot/libraries.json +# +# We currently have several different files that needs to be updated when +# changing libraries, sources, and patch files. See +# https://github.com/dart-lang/sdk/issues/28836. + +# These paths are relative to the source location in the flutter cache under +# the flutter_patched_sdk +# bin/cache/ +# dart-sdk/ +# engine/common/flutter_patched_sdk +dart2js: + libraries: + ui: + uri: "stub_ui/ui.dart" + + async: + uri: "../../dart-sdk/lib/async/async.dart" + patches: "../../dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart" + + _chrome: + uri: "../../dart-sdk/lib/_chrome/dart2js/chrome_dart2js.dart" + + collection: + uri: "../../dart-sdk/lib/collection/collection.dart" + patches: "../../dart-sdk/lib/_internal/js_runtime/lib/collection_patch.dart" + + convert: + uri: "../../dart-sdk/lib/convert/convert.dart" + patches: "../../dart-sdk/lib/_internal/js_runtime/lib/convert_patch.dart" + + core: + uri: "../../dart-sdk/lib/core/core.dart" + patches: "../../dart-sdk/lib/_internal/js_runtime/lib/core_patch.dart" + + developer: + uri: "../../dart-sdk/lib/developer/developer.dart" + patches: "../../dart-sdk/lib/_internal/js_runtime/lib/developer_patch.dart" + + html: + uri: "../../dart-sdk/lib/html/dart2js/html_dart2js.dart" + + html_common: + uri: "../../dart-sdk/lib/html/html_common/html_common_dart2js.dart" + + indexed_db: + uri: "../../dart-sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" + + _http: + uri: "../../dart-sdk/lib/_http/http.dart" + + io: + uri: "../../dart-sdk/lib/io/io.dart" + patches: "../../dart-sdk/lib/_internal/js_runtime/lib/io_patch.dart" + supported: false + + isolate: + uri: "../../dart-sdk/lib/isolate/isolate.dart" + patches: "../../dart-sdk/lib/_internal/js_runtime/lib/isolate_patch.dart" + supported: false + + js: + uri: "../../dart-sdk/lib/js/dart2js/js_dart2js.dart" + + _js: + uri: "../../dart-sdk/lib/js/_js.dart" + patches: "../../dart-sdk/lib/js/_js_client.dart" + + js_util: + uri: "../../dart-sdk/lib/js_util/dart2js/js_util_dart2js.dart" + + math: + uri: "../../dart-sdk/lib/math/math.dart" + patches: "../../dart-sdk/lib/_internal/js_runtime/lib/math_patch.dart" + + mirrors: + uri: "../../dart-sdk/lib/mirrors/mirrors.dart" + patches: "../../dart-sdk/lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart" + supported: false + + typed_data: + uri: "../../dart-sdk/lib/typed_data/typed_data.dart" + patches: "../../dart-sdk/lib/_internal/js_runtime/lib/typed_data_patch.dart" + + _native_typed_data: + uri: "../../dart-sdk/lib/_internal/js_runtime/lib/native_typed_data.dart" + + svg: + uri: "../../dart-sdk/lib/svg/dart2js/svg_dart2js.dart" + + web_audio: + uri: "../../dart-sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" + + web_gl: + uri: "../../dart-sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" + + web_sql: + uri: "../../dart-sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" + + _internal: + uri: "../../dart-sdk/lib/internal/internal.dart" + patches: "../../dart-sdk/lib/_internal/js_runtime/lib/internal_patch.dart" + + _js_helper: + uri: "../../dart-sdk/lib/_internal/js_runtime/lib/js_helper.dart" + + _interceptors: + uri: "../../dart-sdk/lib/_internal/js_runtime/lib/interceptors.dart" + + _foreign_helper: + uri: "../../dart-sdk/lib/_internal/js_runtime/lib/foreign_helper.dart" + + _js_names: + uri: "../../dart-sdk/lib/_internal/js_runtime/lib/js_names.dart" + + _js_primitives: + uri: "../../dart-sdk/lib/_internal/js_runtime/lib/js_primitives.dart" + + _js_embedded_names: + uri: "../../dart-sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart" + + _async_await_error_codes: + uri: "../../dart-sdk/lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart" + + _metadata: + uri: "../../dart-sdk/lib/html/html_common/metadata.dart" \ No newline at end of file diff --git a/lib/stub_ui/natives.dart b/lib/stub_ui/natives.dart new file mode 100644 index 0000000000000..d8388a8640e5f --- /dev/null +++ b/lib/stub_ui/natives.dart @@ -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. + +// TODO(dnfield): remove unused_element ignores when https://github.com/dart-lang/sdk/issues/35164 is resolved. + +part of dart.ui; + +// A service protocol extension to schedule a frame to be rendered into the +// window. +Future _scheduleFrame( + String method, + Map parameters + ) async { + // Schedule the frame. + window.scheduleFrame(); + // Always succeed. + return new developer.ServiceExtensionResponse.result(json.encode({ + 'type': 'Success', + })); +} + +@pragma('vm:entry-point') +void _setupHooks() { // ignore: unused_element + assert(() { + // In debug mode, register the schedule frame extension. + developer.registerExtension('ext.ui.window.scheduleFrame', _scheduleFrame); + return true; + }()); +} + +/// Returns runtime Dart compilation trace as a UTF-8 encoded memory buffer. +/// +/// The buffer contains a list of symbols compiled by the Dart JIT at runtime up to the point +/// when this function was called. This list can be saved to a text file and passed to tools +/// such as `flutter build` or Dart `gen_snapshot` in order to precompile this code offline. +/// +/// The list has one symbol per line of the following format: `,,\n`. +/// Here are some examples: +/// +/// ``` +/// dart:core,Duration,get:inMilliseconds +/// package:flutter/src/widgets/binding.dart,::,runApp +/// file:///.../my_app.dart,::,main +/// ``` +/// +/// This function is only effective in debug and dynamic modes, and will throw in AOT mode. +List saveCompilationTrace() { + throw UnimplementedError(); +} diff --git a/lib/stub_ui/painting.dart b/lib/stub_ui/painting.dart new file mode 100644 index 0000000000000..958f4020d0dad --- /dev/null +++ b/lib/stub_ui/painting.dart @@ -0,0 +1,3520 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of dart.ui; + +// Some methods in this file assert that their arguments are not null. These +// asserts are just to improve the error messages; they should only cover +// arguments that are either dereferenced _in Dart_, before being passed to the +// engine, or that the engine explicitly null-checks itself (after attempting to +// convert the argument to a native type). It should not be possible for a null +// or invalid value to be used by the engine even in release mode, since that +// would cause a crash. It is, however, acceptable for error messages to be much +// less useful or correct in release mode than in debug mode. +// +// Painting APIs will also warn about arguments representing NaN coordinates, +// which can not be rendered by Skia. + +// Update this list when changing the list of supported codecs. +/// {@template flutter.dart:ui.imageFormats} +/// JPEG, PNG, GIF, Animated GIF, WebP, Animated WebP, BMP, and WBMP +/// {@endtemplate} + +bool _rectIsValid(Rect rect) { + assert(rect != null, 'Rect argument was null.'); + assert(!rect._value.any((double value) => value.isNaN), 'Rect argument contained a NaN value.'); + return true; +} + +bool _rrectIsValid(RRect rrect) { + assert(rrect != null, 'RRect argument was null.'); + assert(!rrect._value.any((double value) => value.isNaN), 'RRect argument contained a NaN value.'); + return true; +} + +bool _offsetIsValid(Offset offset) { + assert(offset != null, 'Offset argument was null.'); + assert(!offset.dx.isNaN && !offset.dy.isNaN, 'Offset argument contained a NaN value.'); + return true; +} + +bool _matrix4IsValid(Float64List matrix4) { + assert(matrix4 != null, 'Matrix4 argument was null.'); + assert(matrix4.length == 16, 'Matrix4 must have 16 entries.'); + return true; +} + +bool _radiusIsValid(Radius radius) { + assert(radius != null, 'Radius argument was null.'); + assert(!radius.x.isNaN && !radius.y.isNaN, 'Radius argument contained a NaN value.'); + return true; +} + +Color _scaleAlpha(Color a, double factor) { + return a.withAlpha((a.alpha * factor).round().clamp(0, 255)); +} + +/// An immutable 32 bit color value in ARGB format. +/// +/// Consider the light teal of the Flutter logo. It is fully opaque, with a red +/// channel value of 0x42 (66), a green channel value of 0xA5 (165), and a blue +/// channel value of 0xF5 (245). In the common "hash syntax" for colour values, +/// it would be described as `#42A5F5`. +/// +/// Here are some ways it could be constructed: +/// +/// ```dart +/// Color c = const Color(0xFF42A5F5); +/// Color c = const Color.fromARGB(0xFF, 0x42, 0xA5, 0xF5); +/// Color c = const Color.fromARGB(255, 66, 165, 245); +/// Color c = const Color.fromRGBO(66, 165, 245, 1.0); +/// ``` +/// +/// If you are having a problem with `Color` wherein it seems your color is just +/// not painting, check to make sure you are specifying the full 8 hexadecimal +/// digits. If you only specify six, then the leading two digits are assumed to +/// be zero, which means fully-transparent: +/// +/// ```dart +/// Color c1 = const Color(0xFFFFFF); // fully transparent white (invisible) +/// Color c2 = const Color(0xFFFFFFFF); // fully opaque white (visible) +/// ``` +/// +/// See also: +/// +/// * [Colors](https://docs.flutter.io/flutter/material/Colors-class.html), which +/// defines the colors found in the Material Design specification. +class Color { + /// Construct a color from the lower 32 bits of an [int]. + /// + /// The bits are interpreted as follows: + /// + /// * Bits 24-31 are the alpha value. + /// * Bits 16-23 are the red value. + /// * Bits 8-15 are the green value. + /// * Bits 0-7 are the blue value. + /// + /// In other words, if AA is the alpha value in hex, RR the red value in hex, + /// GG the green value in hex, and BB the blue value in hex, a color can be + /// expressed as `const Color(0xAARRGGBB)`. + /// + /// For example, to get a fully opaque orange, you would use `const + /// Color(0xFFFF9000)` (`FF` for the alpha, `FF` for the red, `90` for the + /// green, and `00` for the blue). + @pragma('vm:entry-point') + const Color(int value) : value = value & 0xFFFFFFFF; + + /// Construct a color from the lower 8 bits of four integers. + /// + /// * `a` is the alpha value, with 0 being transparent and 255 being fully + /// opaque. + /// * `r` is [red], from 0 to 255. + /// * `g` is [green], from 0 to 255. + /// * `b` is [blue], from 0 to 255. + /// + /// Out of range values are brought into range using modulo 255. + /// + /// See also [fromRGBO], which takes the alpha value as a floating point + /// value. + const Color.fromARGB(int a, int r, int g, int b) : + value = (((a & 0xff) << 24) | + ((r & 0xff) << 16) | + ((g & 0xff) << 8) | + ((b & 0xff) << 0)) & 0xFFFFFFFF; + + /// Create a color from red, green, blue, and opacity, similar to `rgba()` in CSS. + /// + /// * `r` is [red], from 0 to 255. + /// * `g` is [green], from 0 to 255. + /// * `b` is [blue], from 0 to 255. + /// * `opacity` is alpha channel of this color as a double, with 0.0 being + /// transparent and 1.0 being fully opaque. + /// + /// Out of range values are brought into range using modulo 255. + /// + /// See also [fromARGB], which takes the opacity as an integer value. + const Color.fromRGBO(int r, int g, int b, double opacity) : + value = ((((opacity * 0xff ~/ 1) & 0xff) << 24) | + ((r & 0xff) << 16) | + ((g & 0xff) << 8) | + ((b & 0xff) << 0)) & 0xFFFFFFFF; + + /// A 32 bit value representing this color. + /// + /// The bits are assigned as follows: + /// + /// * Bits 24-31 are the alpha value. + /// * Bits 16-23 are the red value. + /// * Bits 8-15 are the green value. + /// * Bits 0-7 are the blue value. + final int value; + + /// The alpha channel of this color in an 8 bit value. + /// + /// A value of 0 means this color is fully transparent. A value of 255 means + /// this color is fully opaque. + int get alpha => (0xff000000 & value) >> 24; + + /// The alpha channel of this color as a double. + /// + /// A value of 0.0 means this color is fully transparent. A value of 1.0 means + /// this color is fully opaque. + double get opacity => alpha / 0xFF; + + /// The red channel of this color in an 8 bit value. + int get red => (0x00ff0000 & value) >> 16; + + /// The green channel of this color in an 8 bit value. + int get green => (0x0000ff00 & value) >> 8; + + /// The blue channel of this color in an 8 bit value. + int get blue => (0x000000ff & value) >> 0; + + /// Returns a new color that matches this color with the alpha channel + /// replaced with `a` (which ranges from 0 to 255). + /// + /// Out of range values will have unexpected effects. + Color withAlpha(int a) { + return new Color.fromARGB(a, red, green, blue); + } + + /// Returns a new color that matches this color with the alpha channel + /// replaced with the given `opacity` (which ranges from 0.0 to 1.0). + /// + /// Out of range values will have unexpected effects. + Color withOpacity(double opacity) { + assert(opacity >= 0.0 && opacity <= 1.0); + return withAlpha((255.0 * opacity).round()); + } + + /// Returns a new color that matches this color with the red channel replaced + /// with `r` (which ranges from 0 to 255). + /// + /// Out of range values will have unexpected effects. + Color withRed(int r) { + return new Color.fromARGB(alpha, r, green, blue); + } + + /// Returns a new color that matches this color with the green channel + /// replaced with `g` (which ranges from 0 to 255). + /// + /// Out of range values will have unexpected effects. + Color withGreen(int g) { + return new Color.fromARGB(alpha, red, g, blue); + } + + /// Returns a new color that matches this color with the blue channel replaced + /// with `b` (which ranges from 0 to 255). + /// + /// Out of range values will have unexpected effects. + Color withBlue(int b) { + return new Color.fromARGB(alpha, red, green, b); + } + + // See + static double _linearizeColorComponent(double component) { + if (component <= 0.03928) + return component / 12.92; + return math.pow((component + 0.055) / 1.055, 2.4); + } + + /// Returns a brightness value between 0 for darkest and 1 for lightest. + /// + /// Represents the relative luminance of the color. This value is computationally + /// expensive to calculate. + /// + /// See . + double computeLuminance() { + // See + final double R = _linearizeColorComponent(red / 0xFF); + final double G = _linearizeColorComponent(green / 0xFF); + final double B = _linearizeColorComponent(blue / 0xFF); + return 0.2126 * R + 0.7152 * G + 0.0722 * B; + } + + /// Linearly interpolate between two colors. + /// + /// This is intended to be fast but as a result may be ugly. Consider + /// [HSVColor] or writing custom logic for interpolating colors. + /// + /// If either color is null, this function linearly interpolates from a + /// transparent instance of the other color. This is usually preferable to + /// interpolating from [material.Colors.transparent] (`const + /// Color(0x00000000)`), which is specifically transparent _black_. + /// + /// 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]). Each channel + /// will be clamped to the range 0 to 255. + /// + /// Values for `t` are usually obtained from an [Animation], such as + /// an [AnimationController]. + static Color lerp(Color a, Color b, double t) { + assert(t != null); + if (a == null && b == null) + return null; + if (a == null) + return _scaleAlpha(b, t); + if (b == null) + return _scaleAlpha(a, 1.0 - t); + return new Color.fromARGB( + lerpDouble(a.alpha, b.alpha, t).toInt().clamp(0, 255), + lerpDouble(a.red, b.red, t).toInt().clamp(0, 255), + lerpDouble(a.green, b.green, t).toInt().clamp(0, 255), + lerpDouble(a.blue, b.blue, t).toInt().clamp(0, 255), + ); + } + + /// Combine the foreground color as a transparent color over top + /// of a background color, and return the resulting combined color. + /// + /// This uses standard alpha blending ("SRC over DST") rules to produce a + /// blended color from two colors. This can be used as a performance + /// enhancement when trying to avoid needless alpha blending compositing + /// operations for two things that are solid colors with the same shape, but + /// overlay each other: instead, just paint one with the combined color. + static Color alphaBlend(Color foreground, Color background) { + final int alpha = foreground.alpha; + if (alpha == 0x00) { // Foreground completely transparent. + return background; + } + final int invAlpha = 0xff - alpha; + int backAlpha = background.alpha; + if (backAlpha == 0xff) { // Opaque background case + return new Color.fromARGB( + 0xff, + (alpha * foreground.red + invAlpha * background.red) ~/ 0xff, + (alpha * foreground.green + invAlpha * background.green) ~/ 0xff, + (alpha * foreground.blue + invAlpha * background.blue) ~/ 0xff, + ); + } else { // General case + backAlpha = (backAlpha * invAlpha) ~/ 0xff; + final int outAlpha = alpha + backAlpha; + assert(outAlpha != 0x00); + return new Color.fromARGB( + outAlpha, + (foreground.red * alpha + background.red * backAlpha) ~/ outAlpha, + (foreground.green * alpha + background.green * backAlpha) ~/ outAlpha, + (foreground.blue * alpha + background.blue * backAlpha) ~/ outAlpha, + ); + } + } + + @override + bool operator ==(dynamic other) { + if (identical(this, other)) + return true; + if (other.runtimeType != runtimeType) + return false; + final Color typedOther = other; + return value == typedOther.value; + } + + @override + int get hashCode => value.hashCode; + + @override + String toString() => 'Color(0x${value.toRadixString(16).padLeft(8, '0')})'; +} + +/// Algorithms to use when painting on the canvas. +/// +/// When drawing a shape or image onto a canvas, different algorithms can be +/// used to blend the pixels. The different values of [BlendMode] specify +/// different such algorithms. +/// +/// Each algorithm has two inputs, the _source_, which is the image being drawn, +/// and the _destination_, which is the image into which the source image is +/// being composited. The destination is often thought of as the _background_. +/// The source and destination both have four color channels, the red, green, +/// blue, and alpha channels. These are typically represented as numbers in the +/// range 0.0 to 1.0. The output of the algorithm also has these same four +/// channels, with values computed from the source and destination. +/// +/// The documentation of each value below describes how the algorithm works. In +/// each case, an image shows the output of blending a source image with a +/// destination image. In the images below, the destination is represented by an +/// image with horizontal lines and an opaque landscape photograph, and the +/// source is represented by an image with vertical lines (the same lines but +/// rotated) and a bird clip-art image. The [src] mode shows only the source +/// image, and the [dst] mode shows only the destination image. In the +/// documentation below, the transparency is illustrated by a checkerboard +/// pattern. The [clear] mode drops both the source and destination, resulting +/// in an output that is entirely transparent (illustrated by a solid +/// checkerboard pattern). +/// +/// The horizontal and vertical bars in these images show the red, green, and +/// blue channels with varying opacity levels, then all three color channels +/// together with those same varying opacity levels, then all three color +/// channels set to zero with those varying opacity levels, then two bars showing +/// a red/green/blue repeating gradient, the first with full opacity and the +/// second with partial opacity, and finally a bar with the three color channels +/// set to zero but the opacity varying in a repeating gradient. +/// +/// ## Application to the [Canvas] API +/// +/// When using [Canvas.saveLayer] and [Canvas.restore], the blend mode of the +/// [Paint] given to the [Canvas.saveLayer] will be applied when +/// [Canvas.restore] is called. Each call to [Canvas.saveLayer] introduces a new +/// layer onto which shapes and images are painted; when [Canvas.restore] is +/// called, that layer is then composited onto the parent layer, with the source +/// being the most-recently-drawn shapes and images, and the destination being +/// the parent layer. (For the first [Canvas.saveLayer] call, the parent layer +/// is the canvas itself.) +/// +/// See also: +/// +/// * [Paint.blendMode], which uses [BlendMode] to define the compositing +/// strategy. +enum BlendMode { + // This list comes from Skia's SkXfermode.h and the values (order) should be + // kept in sync. + // See: https://skia.org/user/api/skpaint#SkXfermode + + /// Drop both the source and destination images, leaving nothing. + /// + /// This corresponds to the "clear" Porter-Duff operator. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_clear.png) + clear, + + /// Drop the destination image, only paint the source image. + /// + /// Conceptually, the destination is first cleared, then the source image is + /// painted. + /// + /// This corresponds to the "Copy" Porter-Duff operator. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_src.png) + src, + + /// Drop the source image, only paint the destination image. + /// + /// Conceptually, the source image is discarded, leaving the destination + /// untouched. + /// + /// This corresponds to the "Destination" Porter-Duff operator. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_dst.png) + dst, + + /// Composite the source image over the destination image. + /// + /// This is the default value. It represents the most intuitive case, where + /// shapes are painted on top of what is below, with transparent areas showing + /// the destination layer. + /// + /// This corresponds to the "Source over Destination" Porter-Duff operator, + /// also known as the Painter's Algorithm. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_srcOver.png) + srcOver, + + /// Composite the source image under the destination image. + /// + /// This is the opposite of [srcOver]. + /// + /// This corresponds to the "Destination over Source" Porter-Duff operator. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_dstOver.png) + /// + /// This is useful when the source image should have been painted before the + /// destination image, but could not be. + dstOver, + + /// Show the source image, but only where the two images overlap. The + /// destination image is not rendered, it is treated merely as a mask. The + /// color channels of the destination are ignored, only the opacity has an + /// effect. + /// + /// To show the destination image instead, consider [dstIn]. + /// + /// To reverse the semantic of the mask (only showing the source where the + /// destination is absent, rather than where it is present), consider + /// [srcOut]. + /// + /// This corresponds to the "Source in Destination" Porter-Duff operator. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_srcIn.png) + srcIn, + + /// Show the destination image, but only where the two images overlap. The + /// source image is not rendered, it is treated merely as a mask. The color + /// channels of the source are ignored, only the opacity has an effect. + /// + /// To show the source image instead, consider [srcIn]. + /// + /// To reverse the semantic of the mask (only showing the source where the + /// destination is present, rather than where it is absent), consider [dstOut]. + /// + /// This corresponds to the "Destination in Source" Porter-Duff operator. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_dstIn.png) + dstIn, + + /// Show the source image, but only where the two images do not overlap. The + /// destination image is not rendered, it is treated merely as a mask. The color + /// channels of the destination are ignored, only the opacity has an effect. + /// + /// To show the destination image instead, consider [dstOut]. + /// + /// To reverse the semantic of the mask (only showing the source where the + /// destination is present, rather than where it is absent), consider [srcIn]. + /// + /// This corresponds to the "Source out Destination" Porter-Duff operator. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_srcOut.png) + srcOut, + + /// Show the destination image, but only where the two images do not overlap. The + /// source image is not rendered, it is treated merely as a mask. The color + /// channels of the source are ignored, only the opacity has an effect. + /// + /// To show the source image instead, consider [srcOut]. + /// + /// To reverse the semantic of the mask (only showing the destination where the + /// source is present, rather than where it is absent), consider [dstIn]. + /// + /// This corresponds to the "Destination out Source" Porter-Duff operator. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_dstOut.png) + dstOut, + + /// Composite the source image over the destination image, but only where it + /// overlaps the destination. + /// + /// This corresponds to the "Source atop Destination" Porter-Duff operator. + /// + /// This is essentially the [srcOver] operator, but with the output's opacity + /// channel being set to that of the destination image instead of being a + /// combination of both image's opacity channels. + /// + /// For a variant with the destination on top instead of the source, see + /// [dstATop]. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_srcATop.png) + srcATop, + + /// Composite the destination image over the source image, but only where it + /// overlaps the source. + /// + /// This corresponds to the "Destination atop Source" Porter-Duff operator. + /// + /// This is essentially the [dstOver] operator, but with the output's opacity + /// channel being set to that of the source image instead of being a + /// combination of both image's opacity channels. + /// + /// For a variant with the source on top instead of the destination, see + /// [srcATop]. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_dstATop.png) + dstATop, + + /// Apply a bitwise `xor` operator to the source and destination images. This + /// leaves transparency where they would overlap. + /// + /// This corresponds to the "Source xor Destination" Porter-Duff operator. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_xor.png) + xor, + + /// Sum the components of the source and destination images. + /// + /// Transparency in a pixel of one of the images reduces the contribution of + /// that image to the corresponding output pixel, as if the color of that + /// pixel in that image was darker. + /// + /// This corresponds to the "Source plus Destination" Porter-Duff operator. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_plus.png) + plus, + + /// Multiply the color components of the source and destination images. + /// + /// This can only result in the same or darker colors (multiplying by white, + /// 1.0, results in no change; multiplying by black, 0.0, results in black). + /// + /// When compositing two opaque images, this has similar effect to overlapping + /// two transparencies on a projector. + /// + /// For a variant that also multiplies the alpha channel, consider [multiply]. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_modulate.png) + /// + /// See also: + /// + /// * [screen], which does a similar computation but inverted. + /// * [overlay], which combines [modulate] and [screen] to favor the + /// destination image. + /// * [hardLight], which combines [modulate] and [screen] to favor the + /// source image. + modulate, + + // Following blend modes are defined in the CSS Compositing standard. + + /// Multiply the inverse of the components of the source and destination + /// images, and inverse the result. + /// + /// Inverting the components means that a fully saturated channel (opaque + /// white) is treated as the value 0.0, and values normally treated as 0.0 + /// (black, transparent) are treated as 1.0. + /// + /// This is essentially the same as [modulate] blend mode, but with the values + /// of the colors inverted before the multiplication and the result being + /// inverted back before rendering. + /// + /// This can only result in the same or lighter colors (multiplying by black, + /// 1.0, results in no change; multiplying by white, 0.0, results in white). + /// Similarly, in the alpha channel, it can only result in more opaque colors. + /// + /// This has similar effect to two projectors displaying their images on the + /// same screen simultaneously. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_screen.png) + /// + /// See also: + /// + /// * [modulate], which does a similar computation but without inverting the + /// values. + /// * [overlay], which combines [modulate] and [screen] to favor the + /// destination image. + /// * [hardLight], which combines [modulate] and [screen] to favor the + /// source image. + screen, // The last coeff mode. + + /// Multiply the components of the source and destination images after + /// adjusting them to favor the destination. + /// + /// Specifically, if the destination value is smaller, this multiplies it with + /// the source value, whereas is the source value is smaller, it multiplies + /// the inverse of the source value with the inverse of the destination value, + /// then inverts the result. + /// + /// Inverting the components means that a fully saturated channel (opaque + /// white) is treated as the value 0.0, and values normally treated as 0.0 + /// (black, transparent) are treated as 1.0. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_overlay.png) + /// + /// See also: + /// + /// * [modulate], which always multiplies the values. + /// * [screen], which always multiplies the inverses of the values. + /// * [hardLight], which is similar to [overlay] but favors the source image + /// instead of the destination image. + overlay, + + /// Composite the source and destination image by choosing the lowest value + /// from each color channel. + /// + /// The opacity of the output image is computed in the same way as for + /// [srcOver]. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_darken.png) + darken, + + /// Composite the source and destination image by choosing the highest value + /// from each color channel. + /// + /// The opacity of the output image is computed in the same way as for + /// [srcOver]. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_lighten.png) + lighten, + + /// Divide the destination by the inverse of the source. + /// + /// Inverting the components means that a fully saturated channel (opaque + /// white) is treated as the value 0.0, and values normally treated as 0.0 + /// (black, transparent) are treated as 1.0. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_colorDodge.png) + colorDodge, + + /// Divide the inverse of the destination by the the source, and inverse the result. + /// + /// Inverting the components means that a fully saturated channel (opaque + /// white) is treated as the value 0.0, and values normally treated as 0.0 + /// (black, transparent) are treated as 1.0. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_colorBurn.png) + colorBurn, + + /// Multiply the components of the source and destination images after + /// adjusting them to favor the source. + /// + /// Specifically, if the source value is smaller, this multiplies it with the + /// destination value, whereas is the destination value is smaller, it + /// multiplies the inverse of the destination value with the inverse of the + /// source value, then inverts the result. + /// + /// Inverting the components means that a fully saturated channel (opaque + /// white) is treated as the value 0.0, and values normally treated as 0.0 + /// (black, transparent) are treated as 1.0. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_hardLight.png) + /// + /// See also: + /// + /// * [modulate], which always multiplies the values. + /// * [screen], which always multiplies the inverses of the values. + /// * [overlay], which is similar to [hardLight] but favors the destination + /// image instead of the source image. + hardLight, + + /// Use [colorDodge] for source values below 0.5 and [colorBurn] for source + /// values above 0.5. + /// + /// This results in a similar but softer effect than [overlay]. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_softLight.png) + /// + /// See also: + /// + /// * [color], which is a more subtle tinting effect. + softLight, + + /// Subtract the smaller value from the bigger value for each channel. + /// + /// Compositing black has no effect; compositing white inverts the colors of + /// the other image. + /// + /// The opacity of the output image is computed in the same way as for + /// [srcOver]. + /// + /// The effect is similar to [exclusion] but harsher. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_difference.png) + difference, + + /// Subtract double the product of the two images from the sum of the two + /// images. + /// + /// Compositing black has no effect; compositing white inverts the colors of + /// the other image. + /// + /// The opacity of the output image is computed in the same way as for + /// [srcOver]. + /// + /// The effect is similar to [difference] but softer. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_exclusion.png) + exclusion, + + /// Multiply the components of the source and destination images, including + /// the alpha channel. + /// + /// This can only result in the same or darker colors (multiplying by white, + /// 1.0, results in no change; multiplying by black, 0.0, results in black). + /// + /// Since the alpha channel is also multiplied, a fully-transparent pixel + /// (opacity 0.0) in one image results in a fully transparent pixel in the + /// output. This is similar to [dstIn], but with the colors combined. + /// + /// For a variant that multiplies the colors but does not multiply the alpha + /// channel, consider [modulate]. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_multiply.png) + multiply, // The last separable mode. + + /// Take the hue of the source image, and the saturation and luminosity of the + /// destination image. + /// + /// The effect is to tint the destination image with the source image. + /// + /// The opacity of the output image is computed in the same way as for + /// [srcOver]. Regions that are entirely transparent in the source image take + /// their hue from the destination. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_hue.png) + /// + /// See also: + /// + /// * [color], which is a similar but stronger effect as it also applies the + /// saturation of the source image. + /// * [HSVColor], which allows colors to be expressed using Hue rather than + /// the red/green/blue channels of [Color]. + hue, + + /// Take the saturation of the source image, and the hue and luminosity of the + /// destination image. + /// + /// The opacity of the output image is computed in the same way as for + /// [srcOver]. Regions that are entirely transparent in the source image take + /// their saturation from the destination. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_hue.png) + /// + /// See also: + /// + /// * [color], which also applies the hue of the source image. + /// * [luminosity], which applies the luminosity of the source image to the + /// destination. + saturation, + + /// Take the hue and saturation of the source image, and the luminosity of the + /// destination image. + /// + /// The effect is to tint the destination image with the source image. + /// + /// The opacity of the output image is computed in the same way as for + /// [srcOver]. Regions that are entirely transparent in the source image take + /// their hue and saturation from the destination. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_color.png) + /// + /// See also: + /// + /// * [hue], which is a similar but weaker effect. + /// * [softLight], which is a similar tinting effect but also tints white. + /// * [saturation], which only applies the saturation of the source image. + color, + + /// Take the luminosity of the source image, and the hue and saturation of the + /// destination image. + /// + /// The opacity of the output image is computed in the same way as for + /// [srcOver]. Regions that are entirely transparent in the source image take + /// their luminosity from the destination. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/blend_mode_luminosity.png) + /// + /// See also: + /// + /// * [saturation], which applies the saturation of the source image to the + /// destination. + /// * [ImageFilter.blur], which can be used with [BackdropFilter] for a + /// related effect. + luminosity, +} + +/// Quality levels for image filters. +/// +/// See [Paint.filterQuality]. +enum FilterQuality { + // This list comes from Skia's SkFilterQuality.h and the values (order) should + // be kept in sync. + + /// Fastest possible filtering, albeit also the lowest quality. + /// + /// Typically this implies nearest-neighbour filtering. + none, + + /// Better quality than [none], faster than [medium]. + /// + /// Typically this implies bilinear interpolation. + low, + + /// Better quality than [low], faster than [high]. + /// + /// Typically this implies a combination of bilinear interpolation and + /// pyramidal parametric prefiltering (mipmaps). + medium, + + /// Best possible quality filtering, albeit also the slowest. + /// + /// Typically this implies bicubic interpolation or better. + high, +} + +/// Styles to use for line endings. +/// +/// See also: +/// +/// * [Paint.strokeCap] for how this value is used. +/// * [StrokeJoin] for the different kinds of line segment joins. +// These enum values must be kept in sync with SkPaint::Cap. +enum StrokeCap { + /// Begin and end contours with a flat edge and no extension. + /// + /// ![A butt cap ends line segments with a square end that stops at the end of + /// the line segment.](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/butt_cap.png) + /// + /// Compare to the [square] cap, which has the same shape, but extends past + /// the end of the line by half a stroke width. + butt, + + /// Begin and end contours with a semi-circle extension. + /// + /// ![A round cap adds a rounded end to the line segment that protrudes + /// by one half of the thickness of the line (which is the radius of the cap) + /// past the end of the segment.](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/round_cap.png) + /// + /// The cap is colored in the diagram above to highlight it: in normal use it + /// is the same color as the line. + round, + + /// Begin and end contours with a half square extension. This is + /// similar to extending each contour by half the stroke width (as + /// given by [Paint.strokeWidth]). + /// + /// ![A square cap has a square end that effectively extends the line length + /// by half of the stroke width.](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/square_cap.png) + /// + /// The cap is colored in the diagram above to highlight it: in normal use it + /// is the same color as the line. + /// + /// Compare to the [butt] cap, which has the same shape, but doesn't extend + /// past the end of the line. + square, +} + +/// Styles to use for line segment joins. +/// +/// This only affects line joins for polygons drawn by [Canvas.drawPath] and +/// rectangles, not points drawn as lines with [Canvas.drawPoints]. +/// +/// See also: +/// +/// * [Paint.strokeJoin] and [Paint.strokeMiterLimit] for how this value is +/// used. +/// * [StrokeCap] for the different kinds of line endings. +// These enum values must be kept in sync with SkPaint::Join. +enum StrokeJoin { + /// Joins between line segments form sharp corners. + /// + /// {@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 + /// line. + /// + /// See also: + /// + /// * [Paint.strokeJoin], used to set the line segment join style to this + /// value. + /// * [Paint.strokeMiterLimit], used to define when a miter is drawn instead + /// of a bevel when the join is set to this value. + miter, + + /// Joins between line segments are semi-circular. + /// + /// {@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 + /// line. + /// + /// See also: + /// + /// * [Paint.strokeJoin], used to set the line segment join style to this + /// value. + round, + + /// Joins between line segments connect the corners of the butt ends of the + /// line segments to give a beveled appearance. + /// + /// {@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 + /// line. + /// + /// See also: + /// + /// * [Paint.strokeJoin], used to set the line segment join style to this + /// value. + bevel, +} + +/// Strategies for painting shapes and paths on a canvas. +/// +/// See [Paint.style]. +// These enum values must be kept in sync with SkPaint::Style. +enum PaintingStyle { + // This list comes from Skia's SkPaint.h and the values (order) should be kept + // in sync. + + /// Apply the [Paint] to the inside of the shape. For example, when + /// applied to the [Canvas.drawCircle] call, this results in a disc + /// of the given size being painted. + fill, + + /// Apply the [Paint] to the edge of the shape. For example, when + /// applied to the [Canvas.drawCircle] call, this results is a hoop + /// of the given size being painted. The line drawn on the edge will + /// be the width given by the [Paint.strokeWidth] property. + stroke, +} + + +/// Different ways to clip a widget's content. +enum Clip { + /// No clip at all. + /// + /// This is the default option for most widgets: if the content does not + /// overflow the widget boundary, don't pay any performance cost for clipping. + /// + /// If the content does overflow, please explicitly specify the following + /// [Clip] options: + /// * [hardEdge], which is the fastest clipping, but with lower fidelity. + /// * [antiAlias], which is a little slower than [hardEdge], but with smoothed edges. + /// * [antiAliasWithSaveLayer], which is much slower than [antiAlias], and should + /// rarely be used. + none, + + /// Clip, but do not apply anti-aliasing. + /// + /// This mode enables clipping, but curves and non-axis-aligned straight lines will be + /// jagged as no effort is made to anti-alias. + /// + /// Faster than other clipping modes, but slower than [none]. + /// + /// This is a reasonable choice when clipping is needed, if the container is an axis- + /// aligned rectangle or an axis-aligned rounded rectangle with very small corner radii. + /// + /// See also: + /// + /// * [antiAlias], which is more reasonable when clipping is needed and the shape is not + /// an axis-aligned rectangle. + hardEdge, + + /// Clip with anti-aliasing. + /// + /// This mode has anti-aliased clipping edges to achieve a smoother look. + /// + /// It' s much faster than [antiAliasWithSaveLayer], but slower than [hardEdge]. + /// + /// This will be the common case when dealing with circles and arcs. + /// + /// Different from [hardEdge] and [antiAliasWithSaveLayer], this clipping may have + /// bleeding edge artifacts. + /// (See https://fiddle.skia.org/c/21cb4c2b2515996b537f36e7819288ae for an example.) + /// + /// See also: + /// + /// * [hardEdge], which is a little faster, but with lower fidelity. + /// * [antiAliasWithSaveLayer], which is much slower, but can avoid the + /// bleeding edges if there's no other way. + /// * [Paint.isAntiAlias], which is the anti-aliasing switch for general draw operations. + antiAlias, + + /// Clip with anti-aliasing and saveLayer immediately following the clip. + /// + /// This mode not only clips with anti-aliasing, but also allocates an offscreen + /// buffer. All subsequent paints are carried out on that buffer before finally + /// being clipped and composited back. + /// + /// This is very slow. It has no bleeding edge artifacts (that [antiAlias] has) + /// but it changes the semantics as an offscreen buffer is now introduced. + /// (See https://github.com/flutter/flutter/issues/18057#issuecomment-394197336 + /// for a difference between paint without saveLayer and paint with saveLayer.) + /// + /// This will be only rarely needed. One case where you might need this is if + /// you have an image overlaid on a very different background color. In these + /// cases, consider whether you can avoid overlaying multiple colors in one + /// spot (e.g. by having the background color only present where the image is + /// absent). If you can, [antiAlias] would be fine and much faster. + /// + /// See also: + /// + /// * [antiAlias], which is much faster, and has similar clipping results. + antiAliasWithSaveLayer, +} + +// If we actually run on big endian machines, we'll need to do something smarter +// here. We don't use [Endian.Host] because it's not a compile-time +// constant and can't propagate into the set/get calls. +const Endian _kFakeHostEndian = Endian.little; + +/// A description of the style to use when drawing on a [Canvas]. +/// +/// Most APIs on [Canvas] take a [Paint] object to describe the style +/// to use for that operation. +class Paint { + // Paint objects are encoded in two buffers: + // + // * _data is binary data in four-byte fields, each of which is either a + // uint32_t or a float. The default value for each field is encoded as + // zero to make initialization trivial. Most values already have a default + // value of zero, but some, such as color, have a non-zero default value. + // To encode or decode these values, XOR the value with the default value. + // + // * _objects is a list of unencodable objects, typically wrappers for native + // objects. The objects are simply stored in the list without any additional + // encoding. + // + // The binary format must match the deserialization code in paint.cc. + + final ByteData _data = new ByteData(_kDataByteCount); + static const int _kIsAntiAliasIndex = 0; + static const int _kColorIndex = 1; + static const int _kBlendModeIndex = 2; + static const int _kStyleIndex = 3; + static const int _kStrokeWidthIndex = 4; + static const int _kStrokeCapIndex = 5; + static const int _kStrokeJoinIndex = 6; + static const int _kStrokeMiterLimitIndex = 7; + static const int _kFilterQualityIndex = 8; + static const int _kColorFilterIndex = 9; + static const int _kColorFilterColorIndex = 10; + static const int _kColorFilterBlendModeIndex = 11; + static const int _kMaskFilterIndex = 12; + static const int _kMaskFilterBlurStyleIndex = 13; + static const int _kMaskFilterSigmaIndex = 14; + static const int _kInvertColorIndex = 15; + + static const int _kIsAntiAliasOffset = _kIsAntiAliasIndex << 2; + static const int _kColorOffset = _kColorIndex << 2; + static const int _kBlendModeOffset = _kBlendModeIndex << 2; + static const int _kStyleOffset = _kStyleIndex << 2; + static const int _kStrokeWidthOffset = _kStrokeWidthIndex << 2; + static const int _kStrokeCapOffset = _kStrokeCapIndex << 2; + static const int _kStrokeJoinOffset = _kStrokeJoinIndex << 2; + static const int _kStrokeMiterLimitOffset = _kStrokeMiterLimitIndex << 2; + static const int _kFilterQualityOffset = _kFilterQualityIndex << 2; + static const int _kColorFilterOffset = _kColorFilterIndex << 2; + static const int _kColorFilterColorOffset = _kColorFilterColorIndex << 2; + static const int _kColorFilterBlendModeOffset = _kColorFilterBlendModeIndex << 2; + static const int _kMaskFilterOffset = _kMaskFilterIndex << 2; + static const int _kMaskFilterBlurStyleOffset = _kMaskFilterBlurStyleIndex << 2; + static const int _kMaskFilterSigmaOffset = _kMaskFilterSigmaIndex << 2; + static const int _kInvertColorOffset = _kInvertColorIndex << 2; + // If you add more fields, remember to update _kDataByteCount. + static const int _kDataByteCount = 75; + + // Binary format must match the deserialization code in paint.cc. + List _objects; + static const int _kShaderIndex = 0; + static const int _kColorFilterMatrixIndex = 1; + static const int _kObjectCount = 2; // Must be one larger than the largest index. + + /// Whether to apply anti-aliasing to lines and images drawn on the + /// canvas. + /// + /// Defaults to true. + bool get isAntiAlias { + return _data.getInt32(_kIsAntiAliasOffset, _kFakeHostEndian) == 0; + } + set isAntiAlias(bool value) { + // We encode true as zero and false as one because the default value, which + // we always encode as zero, is true. + final int encoded = value ? 0 : 1; + _data.setInt32(_kIsAntiAliasOffset, encoded, _kFakeHostEndian); + } + + // Must be kept in sync with the default in paint.cc. + static const int _kColorDefault = 0xFF000000; + + /// The color to use when stroking or filling a shape. + /// + /// Defaults to opaque black. + /// + /// See also: + /// + /// * [style], which controls whether to stroke or fill (or both). + /// * [colorFilter], which overrides [color]. + /// * [shader], which overrides [color] with more elaborate effects. + /// + /// This color is not used when compositing. To colorize a layer, use + /// [colorFilter]. + Color get color { + final int encoded = _data.getInt32(_kColorOffset, _kFakeHostEndian); + return new Color(encoded ^ _kColorDefault); + } + set color(Color value) { + assert(value != null); + final int encoded = value.value ^ _kColorDefault; + _data.setInt32(_kColorOffset, encoded, _kFakeHostEndian); + } + + // Must be kept in sync with the default in paint.cc. + static final int _kBlendModeDefault = BlendMode.srcOver.index; + + /// A blend mode to apply when a shape is drawn or a layer is composited. + /// + /// The source colors are from the shape being drawn (e.g. from + /// [Canvas.drawPath]) or layer being composited (the graphics that were drawn + /// between the [Canvas.saveLayer] and [Canvas.restore] calls), after applying + /// the [colorFilter], if any. + /// + /// The destination colors are from the background onto which the shape or + /// layer is being composited. + /// + /// Defaults to [BlendMode.srcOver]. + /// + /// See also: + /// + /// * [Canvas.saveLayer], which uses its [Paint]'s [blendMode] to composite + /// the layer when [restore] is called. + /// * [BlendMode], which discusses the user of [saveLayer] with [blendMode]. + BlendMode get blendMode { + final int encoded = _data.getInt32(_kBlendModeOffset, _kFakeHostEndian); + return BlendMode.values[encoded ^ _kBlendModeDefault]; + } + set blendMode(BlendMode value) { + assert(value != null); + final int encoded = value.index ^ _kBlendModeDefault; + _data.setInt32(_kBlendModeOffset, encoded, _kFakeHostEndian); + } + + /// Whether to paint inside shapes, the edges of shapes, or both. + /// + /// Defaults to [PaintingStyle.fill]. + PaintingStyle get style { + return PaintingStyle.values[_data.getInt32(_kStyleOffset, _kFakeHostEndian)]; + } + set style(PaintingStyle value) { + assert(value != null); + final int encoded = value.index; + _data.setInt32(_kStyleOffset, encoded, _kFakeHostEndian); + } + + /// How wide to make edges drawn when [style] is set to + /// [PaintingStyle.stroke]. The width is given in logical pixels measured in + /// the direction orthogonal to the direction of the path. + /// + /// Defaults to 0.0, which correspond to a hairline width. + double get strokeWidth { + return _data.getFloat32(_kStrokeWidthOffset, _kFakeHostEndian); + } + set strokeWidth(double value) { + assert(value != null); + final double encoded = value; + _data.setFloat32(_kStrokeWidthOffset, encoded, _kFakeHostEndian); + } + + /// The kind of finish to place on the end of lines drawn when + /// [style] is set to [PaintingStyle.stroke]. + /// + /// Defaults to [StrokeCap.butt], i.e. no caps. + StrokeCap get strokeCap { + return StrokeCap.values[_data.getInt32(_kStrokeCapOffset, _kFakeHostEndian)]; + } + set strokeCap(StrokeCap value) { + assert(value != null); + final int encoded = value.index; + _data.setInt32(_kStrokeCapOffset, encoded, _kFakeHostEndian); + } + + /// The kind of finish to place on the joins between segments. + /// + /// This applies to paths drawn when [style] is set to [PaintingStyle.stroke], + /// It does not apply to points drawn as lines with [Canvas.drawPoints]. + /// + /// Defaults to [StrokeJoin.miter], i.e. sharp corners. + /// + /// Some examples of joins: + /// + /// {@animation 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/round_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 + /// line. + /// + /// See also: + /// + /// * [strokeMiterLimit] to control when miters are replaced by bevels when + /// this is set to [StrokeJoin.miter]. + /// * [strokeCap] to control what is drawn at the ends of the stroke. + /// * [StrokeJoin] for the definitive list of stroke joins. + StrokeJoin get strokeJoin { + return StrokeJoin.values[_data.getInt32(_kStrokeJoinOffset, _kFakeHostEndian)]; + } + set strokeJoin(StrokeJoin value) { + assert(value != null); + final int encoded = value.index; + _data.setInt32(_kStrokeJoinOffset, encoded, _kFakeHostEndian); + } + + // Must be kept in sync with the default in paint.cc. + static const double _kStrokeMiterLimitDefault = 4.0; + + /// The limit for miters to be drawn on segments when the join is set to + /// [StrokeJoin.miter] and the [style] is set to [PaintingStyle.stroke]. If + /// this limit is exceeded, then a [StrokeJoin.bevel] join will be drawn + /// instead. This may cause some 'popping' of the corners of a path if the + /// angle between line segments is animated, as seen in the diagrams below. + /// + /// This limit is expressed as a limit on the length of the miter. + /// + /// Defaults to 4.0. Using zero as a limit will cause a [StrokeJoin.bevel] + /// join to be used all the time. + /// + /// {@animation 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_4_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 + /// line. + /// + /// See also: + /// + /// * [strokeJoin] to control the kind of finish to place on the joins + /// between segments. + /// * [strokeCap] to control what is drawn at the ends of the stroke. + double get strokeMiterLimit { + return _data.getFloat32(_kStrokeMiterLimitOffset, _kFakeHostEndian); + } + set strokeMiterLimit(double value) { + assert(value != null); + final double encoded = value - _kStrokeMiterLimitDefault; + _data.setFloat32(_kStrokeMiterLimitOffset, encoded, _kFakeHostEndian); + } + + /// A mask filter (for example, a blur) to apply to a shape after it has been + /// drawn but before it has been composited into the image. + /// + /// See [MaskFilter] for details. + MaskFilter get maskFilter { + switch (_data.getInt32(_kMaskFilterOffset, _kFakeHostEndian)) { + case MaskFilter._TypeNone: + return null; + case MaskFilter._TypeBlur: + return new MaskFilter.blur( + BlurStyle.values[_data.getInt32(_kMaskFilterBlurStyleOffset, _kFakeHostEndian)], + _data.getFloat32(_kMaskFilterSigmaOffset, _kFakeHostEndian), + ); + } + return null; + } + set maskFilter(MaskFilter value) { + if (value == null) { + _data.setInt32(_kMaskFilterOffset, MaskFilter._TypeNone, _kFakeHostEndian); + _data.setInt32(_kMaskFilterBlurStyleOffset, 0, _kFakeHostEndian); + _data.setFloat32(_kMaskFilterSigmaOffset, 0.0, _kFakeHostEndian); + } else { + // For now we only support one kind of MaskFilter, so we don't need to + // check what the type is if it's not null. + _data.setInt32(_kMaskFilterOffset, MaskFilter._TypeBlur, _kFakeHostEndian); + _data.setInt32(_kMaskFilterBlurStyleOffset, value._style.index, _kFakeHostEndian); + _data.setFloat32(_kMaskFilterSigmaOffset, value._sigma, _kFakeHostEndian); + } + } + + /// Controls the performance vs quality trade-off to use when applying + /// filters, such as [maskFilter], or when drawing images, as with + /// [Canvas.drawImageRect] or [Canvas.drawImageNine]. + /// + /// Defaults to [FilterQuality.none]. + // TODO(ianh): verify that the image drawing methods actually respect this + FilterQuality get filterQuality { + return FilterQuality.values[_data.getInt32(_kFilterQualityOffset, _kFakeHostEndian)]; + } + set filterQuality(FilterQuality value) { + assert(value != null); + final int encoded = value.index; + _data.setInt32(_kFilterQualityOffset, encoded, _kFakeHostEndian); + } + + /// The shader to use when stroking or filling a shape. + /// + /// When this is null, the [color] is used instead. + /// + /// See also: + /// + /// * [Gradient], a shader that paints a color gradient. + /// * [ImageShader], a shader that tiles an [Image]. + /// * [colorFilter], which overrides [shader]. + /// * [color], which is used if [shader] and [colorFilter] are null. + Shader get shader { + if (_objects == null) + return null; + return _objects[_kShaderIndex]; + } + set shader(Shader value) { + _objects ??= new List(_kObjectCount); + _objects[_kShaderIndex] = value; + } + + /// A color filter to apply when a shape is drawn or when a layer is + /// composited. + /// + /// See [ColorFilter] for details. + /// + /// When a shape is being drawn, [colorFilter] overrides [color] and [shader]. + ColorFilter get colorFilter { + switch (_data.getInt32(_kColorFilterOffset, _kFakeHostEndian)) { + case ColorFilter._TypeNone: + return null; + case ColorFilter._TypeMode: + return new ColorFilter.mode( + new Color(_data.getInt32(_kColorFilterColorOffset, _kFakeHostEndian)), + BlendMode.values[_data.getInt32(_kColorFilterBlendModeOffset, _kFakeHostEndian)], + ); + case ColorFilter._TypeMatrix: + return new ColorFilter.matrix(_objects[_kColorFilterMatrixIndex]); + case ColorFilter._TypeLinearToSrgbGamma: + return const ColorFilter.linearToSrgbGamma(); + case ColorFilter._TypeSrgbToLinearGamma: + return const ColorFilter.srgbToLinearGamma(); + } + + return null; + } + + set colorFilter(ColorFilter value) { + if (value == null) { + _data.setInt32(_kColorFilterOffset, ColorFilter._TypeNone, _kFakeHostEndian); + _data.setInt32(_kColorFilterColorOffset, 0, _kFakeHostEndian); + _data.setInt32(_kColorFilterBlendModeOffset, 0, _kFakeHostEndian); + + if (_objects != null) { + _objects[_kColorFilterMatrixIndex] = null; + } + } else { + _data.setInt32(_kColorFilterOffset, value._type, _kFakeHostEndian); + + if (value._type == ColorFilter._TypeMode) { + assert(value._color != null); + assert(value._blendMode != null); + + _data.setInt32(_kColorFilterColorOffset, value._color.value, _kFakeHostEndian); + _data.setInt32(_kColorFilterBlendModeOffset, value._blendMode.index, _kFakeHostEndian); + } else if (value._type == ColorFilter._TypeMatrix) { + assert(value._matrix != null); + + _objects ??= new List(_kObjectCount); + _objects[_kColorFilterMatrixIndex] = Float32List.fromList(value._matrix); + } + } + } + + /// Whether the colors of the image are inverted when drawn. + /// + /// inverting the colors of an image applies a new color filter that will + /// be composed with any user provided color filters. This is primarily + /// used for implementing smart invert on iOS. + bool get invertColors { + return _data.getInt32(_kInvertColorOffset, _kFakeHostEndian) == 1; + } + set invertColors(bool value) { + _data.setInt32(_kInvertColorOffset, value ? 1 : 0, _kFakeHostEndian); + } + + @override + String toString() { + final StringBuffer result = new StringBuffer(); + String semicolon = ''; + result.write('Paint('); + if (style == PaintingStyle.stroke) { + result.write('$style'); + if (strokeWidth != 0.0) + result.write(' ${strokeWidth.toStringAsFixed(1)}'); + else + result.write(' hairline'); + if (strokeCap != StrokeCap.butt) + result.write(' $strokeCap'); + if (strokeJoin == StrokeJoin.miter) { + if (strokeMiterLimit != _kStrokeMiterLimitDefault) + result.write(' $strokeJoin up to ${strokeMiterLimit.toStringAsFixed(1)}'); + } else { + result.write(' $strokeJoin'); + } + semicolon = '; '; + } + if (isAntiAlias != true) { + result.write('${semicolon}antialias off'); + semicolon = '; '; + } + if (color != const Color(_kColorDefault)) { + if (color != null) + result.write('$semicolon$color'); + else + result.write('${semicolon}no color'); + semicolon = '; '; + } + if (blendMode.index != _kBlendModeDefault) { + result.write('$semicolon$blendMode'); + semicolon = '; '; + } + if (colorFilter != null) { + result.write('${semicolon}colorFilter: $colorFilter'); + semicolon = '; '; + } + if (maskFilter != null) { + result.write('${semicolon}maskFilter: $maskFilter'); + semicolon = '; '; + } + if (filterQuality != FilterQuality.none) { + result.write('${semicolon}filterQuality: $filterQuality'); + semicolon = '; '; + } + if (shader != null) { + result.write('${semicolon}shader: $shader'); + semicolon = '; '; + } + if (invertColors) + result.write('${semicolon}invert: $invertColors'); + result.write(')'); + return result.toString(); + } +} + +/// The format in which image bytes should be returned when using +/// [Image.toByteData]. +enum ImageByteFormat { + /// Raw RGBA format. + /// + /// Unencoded bytes, in RGBA row-primary form, 8 bits per channel. + rawRgba, + + /// Raw unmodified format. + /// + /// Unencoded bytes, in the image's existing format. For example, a grayscale + /// image may use a single 8-bit channel for each pixel. + rawUnmodified, + + /// PNG format. + /// + /// A loss-less compression format for images. This format is well suited for + /// images with hard edges, such as screenshots or sprites, and images with + /// text. Transparency is supported. The PNG format supports images up to + /// 2,147,483,647 pixels in either dimension, though in practice available + /// memory provides a more immediate limitation on maximum image size. + /// + /// PNG images normally use the `.png` file extension and the `image/png` MIME + /// type. + /// + /// See also: + /// + /// * , the Wikipedia page on PNG. + /// * , the PNG standard. + png, +} + +/// The format of pixel data given to [decodeImageFromPixels]. +enum PixelFormat { + /// Each pixel is 32 bits, with the highest 8 bits encoding red, the next 8 + /// bits encoding green, the next 8 bits encoding blue, and the lowest 8 bits + /// encoding alpha. + rgba8888, + + /// Each pixel is 32 bits, with the highest 8 bits encoding blue, the next 8 + /// bits encoding green, the next 8 bits encoding red, and the lowest 8 bits + /// encoding alpha. + bgra8888, +} + +/// Opaque handle to raw decoded image data (pixels). +/// +/// To obtain an [Image] object, use [instantiateImageCodec]. +/// +/// To draw an [Image], use one of the methods on the [Canvas] class, such as +/// [Canvas.drawImage]. +class Image { + // This class is created by the engine, and should not be instantiated + // or extended directly. + // + // To obtain an [Image] object, use [instantiateImageCodec]. + Image._(); + + /// The number of image pixels along the image's horizontal axis. + int get width { + throw UnimplementedError(); + } + + /// The number of image pixels along the image's vertical axis. + int get height { + throw UnimplementedError(); + } + + /// Converts the [Image] object into a byte array. + /// + /// The [format] argument specifies the format in which the bytes will be + /// returned. + /// + /// Returns a future that completes with the binary image data or an error + /// if encoding fails. + Future toByteData({ImageByteFormat format: ImageByteFormat.rawRgba}) { + throw UnimplementedError(); + } + + /// Release the resources used by this object. The object is no longer usable + /// after this method is called. + void dispose() { + throw UnimplementedError(); + } + + @override + String toString() => '[$width\u00D7$height]'; +} + +/// Callback signature for [decodeImageFromList]. +typedef ImageDecoderCallback = void Function(Image result); + +/// Information for a single frame of an animation. +/// +/// To obtain an instance of the [FrameInfo] interface, see +/// [Codec.getNextFrame]. +class FrameInfo { + /// This class is created by the engine, and should not be instantiated + /// or extended directly. + /// + /// To obtain an instance of the [FrameInfo] interface, see + /// [Codec.getNextFrame]. + FrameInfo._(); + + /// The duration this frame should be shown. + Duration get duration { + throw UnimplementedError(); + } + + /// The [Image] object for this frame. + Image get image { + throw UnimplementedError(); + } +} + +/// A handle to an image codec. +/// +/// This class is created by the engine, and should not be instantiated +/// or extended directly. +/// +/// To obtain an instance of the [Codec] interface, see +/// [instantiateImageCodec]. +class Codec { + // + // This class is created by the engine, and should not be instantiated + // or extended directly. + // + // To obtain an instance of the [Codec] interface, see + // [instantiateImageCodec]. + Codec._(); + + /// Number of frames in this image. + int get frameCount { + throw UnimplementedError(); + } + + /// Number of times to repeat the animation. + /// + /// * 0 when the animation should be played once. + /// * -1 for infinity repetitions. + int get repetitionCount { + throw UnimplementedError(); + } + + /// Fetches the next animation frame. + /// + /// Wraps back to the first frame after returning the last frame. + /// + /// The returned future can complete with an error if the decoding has failed. + Future getNextFrame() { + throw UnimplementedError(); + } + + /// Release the resources used by this object. The object is no longer usable + /// after this method is called. + void dispose() { + throw UnimplementedError(); + } +} + +/// 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 [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, { + double decodedCacheRatioCap = double.infinity, +}) { + throw UnimplementedError(); +} + + +/// Loads a single image frame from a byte array into an [Image] object. +/// +/// This is a convenience wrapper around [instantiateImageCodec]. Prefer using +/// [instantiateImageCodec] which also supports multi frame images. +void decodeImageFromList(Uint8List list, ImageDecoderCallback callback) { + throw UnimplementedError(); +} + +/// Convert an array of pixel values into an [Image] object. +/// +/// [pixels] is the pixel data in the encoding described by [format]. +/// +/// [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, double decodedCacheRatioCap = double.infinity} +) { + throw UnimplementedError(); +} + +/// Determines the winding rule that decides how the interior of a [Path] is +/// calculated. +/// +/// This enum is used by the [Path.fillType] property. +enum PathFillType { + /// The interior is defined by a non-zero sum of signed edge crossings. + /// + /// For a given point, the point is considered to be on the inside of the path + /// if a line drawn from the point to infinity crosses lines going clockwise + /// around the point a different number of times than it crosses lines going + /// counter-clockwise around that point. + /// + /// See: + nonZero, + + /// The interior is defined by an odd number of edge crossings. + /// + /// For a given point, the point is considered to be on the inside of the path + /// if a line drawn from the point to infinity crosses an odd number of lines. + /// + /// See: + evenOdd, +} + +/// Strategies for combining paths. +/// +/// See also: +/// +/// * [Path.combine], which uses this enum to decide how to combine two paths. +// Must be kept in sync with SkPathOp +enum PathOperation { + /// Subtract the second path from the first path. + /// + /// For example, if the two paths are overlapping circles of equal diameter + /// but differing centers, the result would be a crescent portion of the + /// first circle that was not overlapped by the second circle. + /// + /// See also: + /// + /// * [reverseDifference], which is the same but subtracting the first path + /// from the second. + difference, + /// Create a new path that is the intersection of the two paths, leaving the + /// overlapping pieces of the path. + /// + /// For example, if the two paths are overlapping circles of equal diameter + /// but differing centers, the result would be only the overlapping portion + /// of the two circles. + /// + /// See also: + /// * [xor], which is the inverse of this operation + intersect, + /// Create a new path that is the union (inclusive-or) of the two paths. + /// + /// For example, if the two paths are overlapping circles of equal diameter + /// but differing centers, the result would be a figure-eight like shape + /// matching the outer boundaries of both circles. + union, + /// Create a new path that is the exclusive-or of the two paths, leaving + /// everything but the overlapping pieces of the path. + /// + /// For example, if the two paths are overlapping circles of equal diameter + /// but differing centers, the figure-eight like shape less the overlapping parts + /// + /// See also: + /// * [intersect], which is the inverse of this operation + xor, + /// Subtract the first path from the second path. + /// + /// For example, if the two paths are overlapping circles of equal diameter + /// but differing centers, the result would be a crescent portion of the + /// second circle that was not overlapped by the first circle. + /// + /// See also: + /// + /// * [difference], which is the same but subtracting the second path + /// from the first. + reverseDifference, +} + +/// A handle for the framework to hold and retain an engine layer across frames. +class EngineLayer { + /// This class is created by the engine, and should not be instantiated + /// or extended directly. + EngineLayer._(); +} + +/// A complex, one-dimensional subset of a plane. +/// +/// A path consists of a number of subpaths, and a _current point_. +/// +/// Subpaths consist of segments of various types, such as lines, +/// arcs, or beziers. Subpaths can be open or closed, and can +/// self-intersect. +/// +/// Closed subpaths enclose a (possibly discontiguous) region of the +/// plane based on the current [fillType]. +/// +/// The _current point_ is initially at the origin. After each +/// operation adding a segment to a subpath, the current point is +/// updated to the end of that segment. +/// +/// Paths can be drawn on canvases using [Canvas.drawPath], and can +/// used to create clip regions using [Canvas.clipPath]. +class Path { + /// Create a new empty [Path] object. + Path() { throw UnimplementedError(); } + + /// Creates a copy of another [Path]. + /// + /// This copy is fast and does not require additional memory unless either + /// the `source` path or the path returned by this constructor are modified. + Path.from(Path source); + + /// Determines how the interior of this path is calculated. + /// + /// Defaults to the non-zero winding rule, [PathFillType.nonZero]. + PathFillType get fillType { + throw UnimplementedError(); + } + set fillType(PathFillType value) { + throw UnimplementedError(); + } + + + /// Starts a new subpath at the given coordinate. + void moveTo(double x, double y) { + throw UnimplementedError(); + } + + /// Starts a new subpath at the given offset from the current point. + void relativeMoveTo(double dx, double dy) { + throw UnimplementedError(); + } + + /// Adds a straight line segment from the current point to the given + /// point. + void lineTo(double x, double y) { + throw UnimplementedError(); + } + + /// Adds a straight line segment from the current point to the point + /// at the given offset from the current point. + void relativeLineTo(double dx, double dy) { + throw UnimplementedError(); + } + + /// Adds a quadratic bezier segment that curves from the current + /// point to the given point (x2,y2), using the control point + /// (x1,y1). + void quadraticBezierTo(double x1, double y1, double x2, double y2) { + throw UnimplementedError(); + } + + /// Adds a quadratic bezier segment that curves from the current + /// point to the point at the offset (x2,y2) from the current point, + /// using the control point at the offset (x1,y1) from the current + /// point. + void relativeQuadraticBezierTo(double x1, double y1, double x2, double y2) { + throw UnimplementedError(); + } + + /// Adds a cubic bezier segment that curves from the current point + /// to the given point (x3,y3), using the control points (x1,y1) and + /// (x2,y2). + void cubicTo(double x1, double y1, double x2, double y2, double x3, double y3) { + throw UnimplementedError(); + } + + /// Adds a cubic bezier segment that curves from the current point + /// to the point at the offset (x3,y3) from the current point, using + /// the control points at the offsets (x1,y1) and (x2,y2) from the + /// current point. + void relativeCubicTo(double x1, double y1, double x2, double y2, double x3, double y3) { + throw UnimplementedError(); + } + + /// Adds a bezier segment that curves from the current point to the + /// given point (x2,y2), using the control points (x1,y1) and the + /// weight w. If the weight is greater than 1, then the curve is a + /// hyperbola; if the weight equals 1, it's a parabola; and if it is + /// less than 1, it is an ellipse. + void conicTo(double x1, double y1, double x2, double y2, double w) { + throw UnimplementedError(); + } + + /// Adds a bezier segment that curves from the current point to the + /// point at the offset (x2,y2) from the current point, using the + /// control point at the offset (x1,y1) from the current point and + /// the weight w. If the weight is greater than 1, then the curve is + /// a hyperbola; if the weight equals 1, it's a parabola; and if it + /// is less than 1, it is an ellipse. + void relativeConicTo(double x1, double y1, double x2, double y2, double w) { + throw UnimplementedError(); + } + + /// If the `forceMoveTo` argument is false, adds a straight line + /// segment and an arc segment. + /// + /// If the `forceMoveTo` argument is true, starts a new subpath + /// consisting of an arc segment. + /// + /// In either case, the arc segment consists of the arc that follows + /// the edge of the oval bounded by the given rectangle, from + /// startAngle radians around the oval up to startAngle + sweepAngle + /// radians around the oval, with zero radians being the point on + /// the right hand side of the oval that crosses the horizontal line + /// that intersects the center of the rectangle and with positive + /// angles going clockwise around the oval. + /// + /// The line segment added if `forceMoveTo` is false starts at the + /// current point and ends at the start of the arc. + void arcTo(Rect rect, double startAngle, double sweepAngle, bool forceMoveTo) { + throw UnimplementedError(); + } + + /// Appends up to four conic curves weighted to describe an oval of `radius` + /// and rotated by `rotation`. + /// + /// The first curve begins from the last point in the path and the last ends + /// at `arcEnd`. The curves follow a path in a direction determined by + /// `clockwise` and `largeArc` in such a way that the sweep angle + /// is always less than 360 degrees. + /// + /// A simple line is appended if either either radii are zero or the last + /// point in the path is `arcEnd`. The radii are scaled to fit the last path + /// point if both are greater than zero but too small to describe an arc. + /// + void arcToPoint(Offset arcEnd, { + Radius radius: Radius.zero, + double rotation: 0.0, + bool largeArc: false, + bool clockwise: true, + }) { + throw UnimplementedError(); + } + + + /// Appends up to four conic curves weighted to describe an oval of `radius` + /// and rotated by `rotation`. + /// + /// The last path point is described by (px, py). + /// + /// The first curve begins from the last point in the path and the last ends + /// at `arcEndDelta.dx + px` and `arcEndDelta.dy + py`. The curves follow a + /// path in a direction determined by `clockwise` and `largeArc` + /// in such a way that the sweep angle is always less than 360 degrees. + /// + /// A simple line is appended if either either radii are zero, or, both + /// `arcEndDelta.dx` and `arcEndDelta.dy` are zero. The radii are scaled to + /// fit the last path point if both are greater than zero but too small to + /// describe an arc. + void relativeArcToPoint(Offset arcEndDelta, { + Radius radius: Radius.zero, + double rotation: 0.0, + bool largeArc: false, + bool clockwise: true, + }) { + assert(_offsetIsValid(arcEndDelta)); + assert(_radiusIsValid(radius)); + throw UnimplementedError(); + } + + /// Adds a new subpath that consists of four lines that outline the + /// given rectangle. + void addRect(Rect rect) { + assert(_rectIsValid(rect)); + throw UnimplementedError(); + } + + /// Adds a new subpath that consists of a curve that forms the + /// ellipse that fills the given rectangle. + /// + /// To add a circle, pass an appropriate rectangle as `oval`. [Rect.fromCircle] + /// can be used to easily describe the circle's center [Offset] and radius. + void addOval(Rect oval) { + assert(_rectIsValid(oval)); + throw UnimplementedError(); + } + + /// Adds a new subpath with one arc segment that consists of the arc + /// that follows the edge of the oval bounded by the given + /// rectangle, from startAngle radians around the oval up to + /// startAngle + sweepAngle radians around the oval, with zero + /// radians being the point on the right hand side of the oval that + /// crosses the horizontal line that intersects the center of the + /// rectangle and with positive angles going clockwise around the + /// oval. + void addArc(Rect oval, double startAngle, double sweepAngle) { + assert(_rectIsValid(oval)); + throw UnimplementedError(); + } + + + /// Adds a new subpath with a sequence of line segments that connect the given + /// points. + /// + /// If `close` is true, a final line segment will be added that connects the + /// last point to the first point. + /// + /// The `points` argument is interpreted as offsets from the origin. + void addPolygon(List points, bool close) { + assert(points != null); + throw UnimplementedError(); + } + + /// Adds a new subpath that consists of the straight lines and + /// curves needed to form the rounded rectangle described by the + /// argument. + void addRRect(RRect rrect) { + assert(_rrectIsValid(rrect)); + throw UnimplementedError(); + } + + /// Adds a new subpath that consists of the given `path` offset by the given + /// `offset`. + /// + /// If `matrix4` is specified, the path will be transformed by this matrix + /// after the matrix is translated by the given offset. The matrix is a 4x4 + /// matrix stored in column major order. + void addPath(Path path, Offset offset, {Float64List matrix4}) { + assert(path != null); // path is checked on the engine side + assert(_offsetIsValid(offset)); + throw UnimplementedError(); + } + + /// Adds the given path to this path by extending the current segment of this + /// path with the the first segment of the given path. + /// + /// If `matrix4` is specified, the path will be transformed by this matrix + /// after the matrix is translated by the given `offset`. The matrix is a 4x4 + /// matrix stored in column major order. + void extendWithPath(Path path, Offset offset, {Float64List matrix4}) { + assert(path != null); // path is checked on the engine side + assert(_offsetIsValid(offset)); + throw UnimplementedError(); + } + + /// Closes the last subpath, as if a straight line had been drawn + /// from the current point to the first point of the subpath. + void close() { + throw UnimplementedError(); + } + + /// Clears the [Path] object of all subpaths, returning it to the + /// same state it had when it was created. The _current point_ is + /// reset to the origin. + void reset() { + throw UnimplementedError(); + } + + /// Tests to see if the given point is within the path. (That is, whether the + /// point would be in the visible portion of the path if the path was used + /// with [Canvas.clipPath].) + /// + /// The `point` argument is interpreted as an offset from the origin. + /// + /// Returns true if the point is in the path, and false otherwise. + bool contains(Offset point) { + assert(_offsetIsValid(point)); + throw UnimplementedError(); + } + + /// Returns a copy of the path with all the segments of every + /// subpath translated by the given offset. + Path shift(Offset offset) { + assert(_offsetIsValid(offset)); + throw UnimplementedError(); + } + + /// Returns a copy of the path with all the segments of every + /// subpath transformed by the given matrix. + Path transform(Float64List matrix4) { + assert(_matrix4IsValid(matrix4)); + throw UnimplementedError(); + } + + /// Computes the bounding rectangle for this path. + /// + /// A path containing only axis-aligned points on the same straight line will + /// have no area, and therefore `Rect.isEmpty` will return true for such a + /// path. Consider checking `rect.width + rect.height > 0.0` instead, or + /// using the [computeMetrics] API to check the path length. + /// + /// For many more elaborate paths, the bounds may be inaccurate. For example, + /// when a path contains a circle, the points used to compute the bounds are + /// the circle's implied control points, which form a square around the circle; + /// if the circle has a transformation applied using [transform] then that + /// square is rotated, and the (axis-aligned, non-rotated) bounding box + /// therefore ends up grossly overestimating the actual area covered by the + /// circle. + // see https://skia.org/user/api/SkPath_Reference#SkPath_getBounds + Rect getBounds() { + throw UnimplementedError(); + } + + /// Combines the two paths according to the manner specified by the given + /// `operation`. + /// + /// The resulting path will be constructed from non-overlapping contours. The + /// curve order is reduced where possible so that cubics may be turned into + /// quadratics, and quadratics maybe turned into lines. + static Path combine(PathOperation operation, Path path1, Path path2) { + assert(path1 != null); + assert(path2 != null); + throw UnimplementedError(); + } + + /// Creates a [PathMetrics] object for this path. + /// + /// If `forceClosed` is set to true, the contours of the path will be measured + /// as if they had been closed, even if they were not explicitly closed. + PathMetrics computeMetrics({bool forceClosed: false}) { + throw UnimplementedError(); + } +} + +/// The geometric description of a tangent: the angle at a point. +/// +/// See also: +/// * [PathMetric.getTangentForOffset], which returns the tangent of an offset along a path. +class Tangent { + /// Creates a [Tangent] with the given values. + /// + /// The arguments must not be null. + const Tangent(this.position, this.vector) + : assert(position != null), + assert(vector != null); + + /// Creates a [Tangent] based on the angle rather than the vector. + /// + /// The [vector] is computed to be the unit vector at the given angle, interpreted + /// as clockwise radians from the x axis. + factory Tangent.fromAngle(Offset position, double angle) { + return new Tangent(position, new Offset(math.cos(angle), math.sin(angle))); + } + + /// Position of the tangent. + /// + /// When used with [PathMetric.getTangentForOffset], this represents the precise + /// position that the given offset along the path corresponds to. + final Offset position; + + /// The vector of the curve at [position]. + /// + /// When used with [PathMetric.getTangentForOffset], this is the vector of the + /// curve that is at the given offset along the path (i.e. the direction of the + /// curve at [position]). + final Offset vector; + + /// The direction of the curve at [position]. + /// + /// When used with [PathMetric.getTangentForOffset], this is the angle of the + /// curve that is the given offset along the path (i.e. the direction of the + /// curve at [position]). + /// + /// This value is in radians, with 0.0 meaning pointing along the x axis in + /// the positive x-axis direction, positive numbers pointing downward toward + /// the negative y-axis, i.e. in a clockwise direction, and negative numbers + /// pointing upward toward the positive y-axis, i.e. in a counter-clockwise + /// direction. + // flip the sign to be consistent with [Path.arcTo]'s `sweepAngle` + double get angle => -math.atan2(vector.dy, vector.dx); +} + +/// An iterable collection of [PathMetric] objects describing a [Path]. +/// +/// A [PathMetrics] object is created by using the [Path.computeMetrics] method, +/// and represents the path as it stood at the time of the call. Subsequent +/// modifications of the path do not affect the [PathMetrics] object. +/// +/// Each path metric corresponds to a segment, or contour, of a path. +/// +/// For example, a path consisting of a [Path.lineTo], a [Path.moveTo], and +/// another [Path.lineTo] will contain two contours and thus be represented by +/// two [PathMetric] objects. +/// +/// When iterating across a [PathMetrics]' contours, the [PathMetric] objects are only +/// valid until the next one is obtained. +class PathMetrics extends collection.IterableBase { + + @override + Iterator get iterator { + throw UnimplementedError(); + } +} + +/// Tracks iteration from one segment of a path to the next for measurement. +class PathMetricIterator implements Iterator { + + @override + PathMetric get current { + throw UnimplementedError(); + } + + @override + bool moveNext() { + throw UnimplementedError(); + } +} + +/// Utilities for measuring a [Path] and extracting subpaths. +/// +/// Iterate over the object returned by [Path.computeMetrics] to obtain +/// [PathMetric] objects. +/// +/// Once created, the methods on this class will only be valid while the +/// iterator is at the contour for which they were created. When the next +/// contour's [PathMetric] is obtained, the [length] and [isClosed] properties +/// remain valid, but the [getTangentForOffset] and [extractPath] will throw a +/// [StateError]. +// TODO(dnfield): Fix this if/when https://bugs.chromium.org/p/skia/issues/detail?id=8721 lands. +class PathMetric { + PathMetric._(this._measure) + : assert(_measure != null), + length = _measure.length, + isClosed = _measure.isClosed, + contourIndex = _measure.currentContourIndex; + + /// Return the total length of the current contour. + final double length; + + /// Whether the contour is closed. + /// + /// Returns true if the contour ends with a call to [Path.close] (which may + /// have been implied when using [Path.addRect]) or if `forceClosed` was + /// specified as true in the call to [Path.computeMetrics]. Returns false + /// otherwise. + final bool isClosed; + + /// The zero-based index of the contour. + /// + /// [Path] objects are made up of zero or more contours. The first contour is + /// created once a drawing command (e.g. [Path.lineTo]) is issued. A + /// [Path.moveTo] command after a drawing command may create a new contour, + /// although it may not if optimizations are applied that determine the move + /// command did not actually result in moving the pen. + /// + /// This property is only valid with reference to its original iterator. If + /// [getTangetForOffset] or [extractPath] are called when this property does + /// not match the actual count of the iterator, those methods will throw a + /// [StateError]. + final int contourIndex; + + final _PathMeasure _measure; + + + /// Computes the position of hte current contour at the given offset, and the + /// angle of the path at that point. + /// + /// For example, calling this method with a distance of 1.41 for a line from + /// 0.0,0.0 to 2.0,2.0 would give a point 1.0,1.0 and the angle 45 degrees + /// (but in radians). + /// + /// Returns null if the contour has zero [length]. + /// + /// The distance is clamped to the [length] of the current contour. + Tangent getTangentForOffset(double distance) { + if (contourIndex != _measure.currentContourIndex) { + throw StateError('This method cannot be invoked once the underlying iterator has advanced.'); + } + return _measure.getTangentForOffset(distance); + } + + /// Given a start and stop distance, return the intervening segment(s). + /// + /// `start` and `end` are pinned to legal values (0..[length]) + /// Returns null if the segment is 0 length or `start` > `stop`. + /// Begin the segment with a moveTo if `startWithMoveTo` is true. + Path extractPath(double start, double end, {bool startWithMoveTo: true}) { + if (contourIndex != _measure.currentContourIndex) { + throw StateError('This method cannot be invoked once the underlying iterator has advanced.'); + } + return _measure.extractPath(start, end, startWithMoveTo: startWithMoveTo); + } + + @override + String toString() => '$runtimeType{length: $length, isClosed: $isClosed, contourIndex:$contourIndex}'; +} + +class _PathMeasure { + _PathMeasure(Path path, bool forceClosed) { + currentContourIndex = -1; // PathMetricIterator will increment this the first time. + } + + double get length { + throw UnimplementedError(); + } + + Tangent getTangentForOffset(double distance) { + throw UnimplementedError(); + } + + Path extractPath(double start, double end, {bool startWithMoveTo: true}) { + throw UnimplementedError(); + } + + bool get isClosed { + throw UnimplementedError(); + } + + int currentContourIndex; +} + +/// Styles to use for blurs in [MaskFilter] objects. +// These enum values must be kept in sync with SkBlurStyle. +enum BlurStyle { + // These mirror SkBlurStyle and must be kept in sync. + + /// Fuzzy inside and outside. This is useful for painting shadows that are + /// offset from the shape that ostensibly is casting the shadow. + normal, + + /// Solid inside, fuzzy outside. This corresponds to drawing the shape, and + /// additionally drawing the blur. This can make objects appear brighter, + /// maybe even as if they were fluorescent. + solid, + + /// Nothing inside, fuzzy outside. This is useful for painting shadows for + /// partially transparent shapes, when they are painted separately but without + /// an offset, so that the shadow doesn't paint below the shape. + outer, + + /// Fuzzy inside, nothing outside. This can make shapes appear to be lit from + /// within. + inner, +} + +/// A mask filter to apply to shapes as they are painted. A mask filter is a +/// function that takes a bitmap of color pixels, and returns another bitmap of +/// color pixels. +/// +/// Instances of this class are used with [Paint.maskFilter] on [Paint] objects. +class MaskFilter { + /// Creates a mask filter that takes the shape being drawn and blurs it. + /// + /// This is commonly used to approximate shadows. + /// + /// The `style` argument controls the kind of effect to draw; see [BlurStyle]. + /// + /// The `sigma` argument controls the size of the effect. It is the standard + /// deviation of the Gaussian blur to apply. The value must be greater than + /// zero. The sigma corresponds to very roughly half the radius of the effect + /// in pixels. + /// + /// A blur is an expensive operation and should therefore be used sparingly. + /// + /// The arguments must not be null. + /// + /// See also: + /// + /// * [Canvas.drawShadow], which is a more efficient way to draw shadows. + const MaskFilter.blur( + this._style, + this._sigma, + ) : assert(_style != null), + assert(_sigma != null); + + final BlurStyle _style; + final double _sigma; + + // The type of MaskFilter class to create for Skia. + // These constants must be kept in sync with MaskFilterType in paint.cc. + static const int _TypeNone = 0; // null + static const int _TypeBlur = 1; // SkBlurMaskFilter + + @override + bool operator ==(dynamic other) { + if (other is! MaskFilter) + return false; + final MaskFilter typedOther = other; + return _style == typedOther._style && + _sigma == typedOther._sigma; + } + + @override + int get hashCode => hashValues(_style, _sigma); + + @override + String toString() => 'MaskFilter.blur($_style, ${_sigma.toStringAsFixed(1)})'; +} + +/// A description of a color filter to apply when drawing a shape or compositing +/// a layer with a particular [Paint]. A color filter is a function that takes +/// two colors, and outputs one color. When applied during compositing, it is +/// independently applied to each pixel of the layer being drawn before the +/// entire layer is merged with the destination. +/// +/// Instances of this class are used with [Paint.colorFilter] on [Paint] +/// objects. +class ColorFilter { + /// Creates a color filter that applies the blend mode given as the second + /// argument. The source color is the one given as the first argument, and the + /// destination color is the one from the layer being composited. + /// + /// The output of this filter is then composited into the background according + /// to the [Paint.blendMode], using the output of this filter as the source + /// and the background as the destination. + const ColorFilter.mode(Color color, BlendMode blendMode) + : _color = color, + _blendMode = blendMode, + _matrix = null, + _type = _TypeMode; + + /// Construct a color filter that transforms a color by a 4x5 matrix. The + /// matrix is in row-major order and the translation column is specified in + /// unnormalized, 0...255, space. + const ColorFilter.matrix(List matrix) + : _color = null, + _blendMode = null, + _matrix = matrix, + _type = _TypeMatrix; + + /// Construct a color filter that applies the srgb gamma curve to the RGB + /// channels. + const ColorFilter.linearToSrgbGamma() + : _color = null, + _blendMode = null, + _matrix = null, + _type = _TypeLinearToSrgbGamma; + + /// Creates a color filter that applies the inverse of the srgb gamma curve + /// to the RGB channels. + const ColorFilter.srgbToLinearGamma() + : _color = null, + _blendMode = null, + _matrix = null, + _type = _TypeSrgbToLinearGamma; + + final Color _color; + final BlendMode _blendMode; + final List _matrix; + final int _type; + + // The type of SkColorFilter class to create for Skia. + // These constants must be kept in sync with ColorFilterType in paint.cc. + static const int _TypeNone = 0; // null + static const int _TypeMode = 1; // MakeModeFilter + static const int _TypeMatrix = 2; // MakeMatrixFilterRowMajor255 + static const int _TypeLinearToSrgbGamma = 3; // MakeLinearToSRGBGamma + static const int _TypeSrgbToLinearGamma = 4; // MakeSRGBToLinearGamma + + @override + bool operator ==(dynamic other) { + if (other is! ColorFilter) { + return false; + } + final ColorFilter typedOther = other; + + if (_type != typedOther._type) { + return false; + } + if (!_listEquals(_matrix, typedOther._matrix)) { + return false; + } + + return _color == typedOther._color && _blendMode == typedOther._blendMode; + } + + @override + int get hashCode => hashValues(_color, _blendMode, hashList(_matrix), _type); + + @override + String toString() { + switch (_type) { + case _TypeMode: + return 'ColorFilter.mode($_color, $_blendMode)'; + case _TypeMatrix: + return 'ColorFilter.matrix($_matrix)'; + case _TypeLinearToSrgbGamma: + return 'ColorFilter.linearToSrgbGamma()'; + case _TypeSrgbToLinearGamma: + return 'ColorFilter.srgbToLinearGamma()'; + default: + return 'Unknown ColorFilter type. This is an error. If you\'re seeing this, please file an issue at https://github.com/flutter/flutter/issues/new.'; + } + } +} + +/// A filter operation to apply to a raster image. +/// +/// See also: +/// +/// * [BackdropFilter], a widget that applies [ImageFilter] to its rendering. +/// * [SceneBuilder.pushBackdropFilter], which is the low-level API for using +/// this class. +class ImageFilter { + + /// Creates an image filter that applies a Gaussian blur. + ImageFilter.blur({ double sigmaX: 0.0, double sigmaY: 0.0 }); + + /// Creates an image filter that applies a matrix transformation. + /// + /// For example, applying a positive scale matrix (see [new Matrix4.diagonal3]) + /// when used with [BackdropFilter] would magnify the background image. + ImageFilter.matrix(Float64List matrix4, + { FilterQuality filterQuality: FilterQuality.low }); +} + +/// Base class for objects such as [Gradient] and [ImageShader] which +/// correspond to shaders as used by [Paint.shader]. +class Shader { + /// This class is created by the engine, and should not be instantiated + /// or extended directly. + Shader._(); +} + +/// Defines what happens at the edge of the gradient. +/// +/// A gradient is defined along a finite inner area. In the case of a linear +/// gradient, it's between the parallel lines that are orthogonal to the line +/// drawn between two points. In the case of radial gradients, it's the disc +/// that covers the circle centered on a particular point up to a given radius. +/// +/// This enum is used to define how the gradient should paint the regions +/// outside that defined inner area. +/// +/// See also: +/// +/// * [painting.Gradient], the superclass for [LinearGradient] and +/// [RadialGradient], as used by [BoxDecoration] et al, which works in +/// relative coordinates and can create a [Shader] representing the gradient +/// for a particular [Rect] on demand. +/// * [dart:ui.Gradient], the low-level class used when dealing with the +/// [Paint.shader] property directly, with its [new Gradient.linear] and [new +/// Gradient.radial] constructors. +// These enum values must be kept in sync with SkShader::TileMode. +enum TileMode { + /// Edge is clamped to the final color. + /// + /// The gradient will paint the all the regions outside the inner area with + /// the color of the point closest to that region. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_clamp_radial.png) + clamp, + + /// Edge is repeated from first color to last. + /// + /// This is as if the stop points from 0.0 to 1.0 were then repeated from 1.0 + /// to 2.0, 2.0 to 3.0, and so forth (and for linear gradients, similarly from + /// -1.0 to 0.0, -2.0 to -1.0, etc). + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_repeated_linear.png) + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_repeated_radial.png) + repeated, + + /// Edge is mirrored from last color to first. + /// + /// This is as if the stop points from 0.0 to 1.0 were then repeated backwards + /// from 2.0 to 1.0, then forwards from 2.0 to 3.0, then backwards again from + /// 4.0 to 3.0, and so forth (and for linear gradients, similarly from in the + /// negative direction). + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_mirror_linear.png) + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_mirror_radial.png) + mirror, +} + +/// A shader (as used by [Paint.shader]) that renders a color gradient. +/// +/// There are several types of gradients, represented by the various constructors +/// on this class. +class Gradient extends Shader { + + /// Creates a linear gradient from `from` to `to`. + /// + /// If `colorStops` is provided, `colorStops[i]` is a number from 0.0 to 1.0 + /// that specifies where `color[i]` begins in the gradient. If `colorStops` is + /// not provided, then only two stops, at 0.0 and 1.0, are implied (and + /// `color` must therefore only have two entries). + /// + /// The behavior before `from` and after `to` is described by the `tileMode` + /// argument. For details, see the [TileMode] enum. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_clamp_linear.png) + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_mirror_linear.png) + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_repeated_linear.png) + /// + /// If `from`, `to`, `colors`, or `tileMode` are null, or if `colors` or + /// `colorStops` contain null values, this constructor will throw a + /// [NoSuchMethodError]. + Gradient.linear( + Offset from, + Offset to, + List colors, [ + List colorStops, + TileMode tileMode = TileMode.clamp, + ]) : assert(_offsetIsValid(from)), + assert(_offsetIsValid(to)), + assert(colors != null), + assert(tileMode != null), + super._(); + + /// Creates a radial gradient centered at `center` that ends at `radius` + /// distance from the center. + /// + /// If `colorStops` is provided, `colorStops[i]` is a number from 0.0 to 1.0 + /// that specifies where `color[i]` begins in the gradient. If `colorStops` is + /// not provided, then only two stops, at 0.0 and 1.0, are implied (and + /// `color` must therefore only have two entries). + /// + /// The behavior before and after the radius is described by the `tileMode` + /// argument. For details, see the [TileMode] enum. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_clamp_radial.png) + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_mirror_radial.png) + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_repeated_radial.png) + /// + /// If `center`, `radius`, `colors`, or `tileMode` are null, or if `colors` or + /// `colorStops` contain null values, this constructor will throw a + /// [NoSuchMethodError]. + /// + /// If `matrix4` is provided, the gradient fill will be transformed by the + /// specified 4x4 matrix relative to the local coordinate system. `matrix4` must + /// be a column-major matrix packed into a list of 16 values. + /// + /// If `focal` is provided and not equal to `center` and `focalRadius` is + /// provided and not equal to 0.0, the generated shader will be a two point + /// conical radial gradient, with `focal` being the center of the focal + /// circle and `focalRadius` being the radius of that circle. If `focal` is + /// provided and not equal to `center`, at least one of the two offsets must + /// not be equal to [Offset.zero]. + Gradient.radial( + Offset center, + double radius, + List colors, [ + List colorStops, + TileMode tileMode = TileMode.clamp, + Float64List matrix4, + Offset focal, + double focalRadius = 0.0 + ]) : assert(_offsetIsValid(center)), + assert(colors != null), + assert(tileMode != null), + assert(matrix4 == null || _matrix4IsValid(matrix4)), + super._(); + + /// Creates a sweep gradient centered at `center` that starts at `startAngle` + /// and ends at `endAngle`. + /// + /// `startAngle` and `endAngle` should be provided in radians, with zero + /// radians being the horizontal line to the right of the `center` and with + /// positive angles going clockwise around the `center`. + /// + /// If `colorStops` is provided, `colorStops[i]` is a number from 0.0 to 1.0 + /// that specifies where `color[i]` begins in the gradient. If `colorStops` is + /// not provided, then only two stops, at 0.0 and 1.0, are implied (and + /// `color` must therefore only have two entries). + /// + /// The behavior before `startAngle` and after `endAngle` is described by the + /// `tileMode` argument. For details, see the [TileMode] enum. + /// + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_clamp_sweep.png) + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_mirror_sweep.png) + /// ![](https://flutter.github.io/assets-for-api-docs/assets/dart-ui/tile_mode_repeated_sweep.png) + /// + /// If `center`, `colors`, `tileMode`, `startAngle`, or `endAngle` are null, + /// or if `colors` or `colorStops` contain null values, this constructor will + /// throw a [NoSuchMethodError]. + /// + /// If `matrix4` is provided, the gradient fill will be transformed by the + /// specified 4x4 matrix relative to the local coordinate system. `matrix4` must + /// be a column-major matrix packed into a list of 16 values. + Gradient.sweep( + Offset center, + List colors, [ + List colorStops, + TileMode tileMode = TileMode.clamp, + double startAngle = 0.0, + double endAngle = math.pi * 2, + Float64List matrix4, + ]) : assert(_offsetIsValid(center)), + assert(colors != null), + assert(tileMode != null), + assert(startAngle != null), + assert(endAngle != null), + assert(startAngle < endAngle), + assert(matrix4 == null || _matrix4IsValid(matrix4)), + super._(); +} + +/// A shader (as used by [Paint.shader]) that tiles an image. +class ImageShader extends Shader { + /// Creates an image-tiling shader. The first argument specifies the image to + /// tile. The second and third arguments specify the [TileMode] for the x + /// direction and y direction respectively. The fourth argument gives the + /// matrix to apply to the effect. All the arguments are required and must not + /// be null. + ImageShader(Image image, TileMode tmx, TileMode tmy, Float64List matrix4) : + assert(image != null), // image is checked on the engine side + assert(tmx != null), + assert(tmy != null), + assert(matrix4 != null), + super._(); +} + +/// Defines how a list of points is interpreted when drawing a set of triangles. +/// +/// Used by [Canvas.drawVertices]. +// These enum values must be kept in sync with SkVertices::VertexMode. +enum VertexMode { + /// Draw each sequence of three points as the vertices of a triangle. + triangles, + + /// Draw each sliding window of three points as the vertices of a triangle. + triangleStrip, + + /// Draw the first point and each sliding window of two points as the vertices of a triangle. + triangleFan, +} + +/// A set of vertex data used by [Canvas.drawVertices]. +class Vertices { + Vertices( + VertexMode mode, + List positions, { + List textureCoordinates, + List colors, + List indices, + }) : assert(mode != null), + assert(positions != null); + + Vertices.raw( + VertexMode mode, + Float32List positions, { + Float32List textureCoordinates, + Int32List colors, + Int32List indices, + }) : assert(mode != null), + assert(positions != null); +} + +/// Defines how a list of points is interpreted when drawing a set of points. +/// +// ignore: deprecated_member_use +/// Used by [Canvas.drawPoints]. +// These enum values must be kept in sync with SkCanvas::PointMode. +enum PointMode { + /// Draw each point separately. + /// + /// If the [Paint.strokeCap] is [StrokeCap.round], then each point is drawn + /// as a circle with the diameter of the [Paint.strokeWidth], filled as + /// described by the [Paint] (ignoring [Paint.style]). + /// + /// Otherwise, each point is drawn as an axis-aligned square with sides of + /// length [Paint.strokeWidth], filled as described by the [Paint] (ignoring + /// [Paint.style]). + points, + + /// Draw each sequence of two points as a line segment. + /// + /// If the number of points is odd, then the last point is ignored. + /// + /// The lines are stroked as described by the [Paint] (ignoring + /// [Paint.style]). + lines, + + /// Draw the entire sequence of point as one line. + /// + /// The lines are stroked as described by the [Paint] (ignoring + /// [Paint.style]). + polygon, +} + +/// Defines how a new clip region should be merged with the existing clip +/// region. +/// +/// Used by [Canvas.clipRect]. +enum ClipOp { + /// Subtract the new region from the existing region. + difference, + + /// Intersect the new region from the existing region. + intersect, +} + +/// An interface for recording graphical operations. +/// +/// [Canvas] objects are used in creating [Picture] objects, which can +/// themselves be used with a [SceneBuilder] to build a [Scene]. In +/// normal usage, however, this is all handled by the framework. +/// +/// A canvas has a current transformation matrix which is applied to all +/// operations. Initially, the transformation matrix is the identity transform. +/// It can be modified using the [translate], [scale], [rotate], [skew], +/// and [transform] methods. +/// +/// A canvas also has a current clip region which is applied to all operations. +/// Initially, the clip region is infinite. It can be modified using the +/// [clipRect], [clipRRect], and [clipPath] methods. +/// +/// The current transform and clip can be saved and restored using the stack +/// managed by the [save], [saveLayer], and [restore] methods. +class Canvas { + /// Creates a canvas for recording graphical operations into the + /// given picture recorder. + /// + /// Graphical operations that affect pixels entirely outside the given + /// `cullRect` might be discarded by the implementation. However, the + /// implementation might draw outside these bounds if, for example, a command + /// draws partially inside and outside the `cullRect`. To ensure that pixels + /// outside a given region are discarded, consider using a [clipRect]. The + /// `cullRect` is optional; by default, all operations are kept. + /// + /// To end the recording, call [PictureRecorder.endRecording] on the + /// given recorder. + Canvas(PictureRecorder recorder, [ Rect cullRect ]) : assert(recorder != null); + + /// Saves a copy of the current transform and clip on the save stack. + /// + /// Call [restore] to pop the save stack. + /// + /// See also: + /// + /// * [saveLayer], which does the same thing but additionally also groups the + /// commands done until the matching [restore]. + void save() { + throw UnimplementedError(); + } + + /// Saves a copy of the current transform and clip on the save stack, and then + /// creates a new group which subsequent calls will become a part of. When the + /// save stack is later popped, the group will be flattened into a layer and + /// have the given `paint`'s [Paint.colorFilter] and [Paint.blendMode] + /// applied. + /// + /// This lets you create composite effects, for example making a group of + /// drawing commands semi-transparent. Without using [saveLayer], each part of + /// the group would be painted individually, so where they overlap would be + /// darker than where they do not. By using [saveLayer] to group them + /// together, they can be drawn with an opaque color at first, and then the + /// entire group can be made transparent using the [saveLayer]'s paint. + /// + /// Call [restore] to pop the save stack and apply the paint to the group. + /// + /// ## Using saveLayer with clips + /// + /// When a rectangular clip operation (from [clipRect]) is not axis-aligned + /// with the raster buffer, or when the clip operation is not rectalinear (e.g. + /// because it is a rounded rectangle clip created by [clipRRect] or an + /// arbitrarily complicated path clip created by [clipPath]), the edge of the + /// clip needs to be anti-aliased. + /// + /// If two draw calls overlap at the edge of such a clipped region, without + /// using [saveLayer], the first drawing will be anti-aliased with the + /// background first, and then the second will be anti-aliased with the result + /// of blending the first drawing and the background. On the other hand, if + /// [saveLayer] is used immediately after establishing the clip, the second + /// drawing will cover the first in the layer, and thus the second alone will + /// be anti-aliased with the background when the layer is clipped and + /// composited (when [restore] is called). + /// + /// For example, this [CustomPainter.paint] method paints a clean white + /// rounded rectangle: + /// + /// ```dart + /// void paint(Canvas canvas, Size size) { + /// Rect rect = Offset.zero & size; + /// canvas.save(); + /// canvas.clipRRect(new RRect.fromRectXY(rect, 100.0, 100.0)); + /// canvas.saveLayer(rect, new Paint()); + /// canvas.drawPaint(new Paint()..color = Colors.red); + /// canvas.drawPaint(new Paint()..color = Colors.white); + /// canvas.restore(); + /// canvas.restore(); + /// } + /// ``` + /// + /// On the other hand, this one renders a red outline, the result of the red + /// paint being anti-aliased with the background at the clip edge, then the + /// white paint being similarly anti-aliased with the background _including + /// the clipped red paint_: + /// + /// ```dart + /// void paint(Canvas canvas, Size size) { + /// // (this example renders poorly, prefer the example above) + /// Rect rect = Offset.zero & size; + /// canvas.save(); + /// canvas.clipRRect(new RRect.fromRectXY(rect, 100.0, 100.0)); + /// canvas.drawPaint(new Paint()..color = Colors.red); + /// canvas.drawPaint(new Paint()..color = Colors.white); + /// canvas.restore(); + /// } + /// ``` + /// + /// This point is moot if the clip only clips one draw operation. For example, + /// the following paint method paints a pair of clean white rounded + /// rectangles, even though the clips are not done on a separate layer: + /// + /// ```dart + /// void paint(Canvas canvas, Size size) { + /// canvas.save(); + /// canvas.clipRRect(new RRect.fromRectXY(Offset.zero & (size / 2.0), 50.0, 50.0)); + /// canvas.drawPaint(new Paint()..color = Colors.white); + /// canvas.restore(); + /// canvas.save(); + /// canvas.clipRRect(new RRect.fromRectXY(size.center(Offset.zero) & (size / 2.0), 50.0, 50.0)); + /// canvas.drawPaint(new Paint()..color = Colors.white); + /// canvas.restore(); + /// } + /// ``` + /// + /// (Incidentally, rather than using [clipRRect] and [drawPaint] to draw + /// rounded rectangles like this, prefer the [drawRRect] method. These + /// examples are using [drawPaint] as a proxy for "complicated draw operations + /// that will get clipped", to illustrate the point.) + /// + /// ## Performance considerations + /// + /// Generally speaking, [saveLayer] is relatively expensive. + /// + /// There are a several different hardware architectures for GPUs (graphics + /// processing units, the hardware that handles graphics), but most of them + /// involve batching commands and reordering them for performance. When layers + /// are used, they cause the rendering pipeline to have to switch render + /// target (from one layer to another). Render target switches can flush the + /// GPU's command buffer, which typically means that optimizations that one + /// could get with larger batching are lost. Render target switches also + /// generate a lot of memory churn because the GPU needs to copy out the + /// current frame buffer contents from the part of memory that's optimized for + /// writing, and then needs to copy it back in once the previous render target + /// (layer) is restored. + /// + /// See also: + /// + /// * [save], which saves the current state, but does not create a new layer + /// for subsequent commands. + /// * [BlendMode], which discusses the use of [Paint.blendMode] with + /// [saveLayer]. + void saveLayer(Rect bounds, Paint paint) { + throw UnimplementedError(); + } + + /// Pops the current save stack, if there is anything to pop. + /// Otherwise, does nothing. + /// + /// Use [save] and [saveLayer] to push state onto the stack. + /// + /// If the state was pushed with with [saveLayer], then this call will also + /// cause the new layer to be composited into the previous layer. + void restore() { + throw UnimplementedError(); + } + + /// Returns the number of items on the save stack, including the + /// initial state. This means it returns 1 for a clean canvas, and + /// that each call to [save] and [saveLayer] increments it, and that + /// each matching call to [restore] decrements it. + /// + /// This number cannot go below 1. + int getSaveCount() { + throw UnimplementedError(); + } + + /// Add a translation to the current transform, shifting the coordinate space + /// horizontally by the first argument and vertically by the second argument. + void translate(double dx, double dy) { + throw UnimplementedError(); + } + + /// Add an axis-aligned scale to the current transform, scaling by the first + /// argument in the horizontal direction and the second in the vertical + /// direction. + /// + /// If [sy] is unspecified, [sx] will be used for the scale in both + /// directions. + void scale(double sx, [double sy]) { + throw UnimplementedError(); + } + + /// Add a rotation to the current transform. The argument is in radians clockwise. + void rotate(double radians) { + throw UnimplementedError(); + } + + /// Add an axis-aligned skew to the current transform, with the first argument + /// being the horizontal skew in radians clockwise around the origin, and the + /// second argument being the vertical skew in radians clockwise around the + /// origin. + void skew(double sx, double sy) { + throw UnimplementedError(); + } + + /// Multiply the current transform by the specified 4⨉4 transformation matrix + /// specified as a list of values in column-major order. + void transform(Float64List matrix4) { + throw UnimplementedError(); + } + + /// Reduces the clip region to the intersection of the current clip and the + /// given rectangle. + /// + /// If [doAntiAlias] is true, then the clip will be anti-aliased. + /// + /// If multiple draw commands intersect with the clip boundary, this can result + /// in incorrect blending at the clip boundary. See [saveLayer] for a + /// discussion of how to address that. + /// + /// Use [ClipOp.difference] to subtract the provided rectangle from the + /// current clip. + void clipRect(Rect rect, { ClipOp clipOp: ClipOp.intersect, bool doAntiAlias = true }) { + assert(_rectIsValid(rect)); + assert(clipOp != null); + assert(doAntiAlias != null); + throw UnimplementedError(); + } + + /// Reduces the clip region to the intersection of the current clip and the + /// given rounded rectangle. + /// + /// If [doAntiAlias] is true, then the clip will be anti-aliased. + /// + /// If multiple draw commands intersect with the clip boundary, this can result + /// in incorrect blending at the clip boundary. See [saveLayer] for a + /// discussion of how to address that and some examples of using [clipRRect]. + void clipRRect(RRect rrect, {bool doAntiAlias = true}) { + assert(_rrectIsValid(rrect)); + assert(doAntiAlias != null); + throw UnimplementedError(); + } + + /// Reduces the clip region to the intersection of the current clip and the + /// given [Path]. + /// + /// If [doAntiAlias] is true, then the clip will be anti-aliased. + /// + /// If multiple draw commands intersect with the clip boundary, this can result + /// multiple draw commands intersect with the clip boundary, this can result + /// in incorrect blending at the clip boundary. See [saveLayer] for a + /// discussion of how to address that. + void clipPath(Path path, {bool doAntiAlias = true}) { + assert(path != null); // path is checked on the engine side + assert(doAntiAlias != null); + throw UnimplementedError(); + } + + /// Paints the given [Color] onto the canvas, applying the given + /// [BlendMode], with the given color being the source and the background + /// being the destination. + void drawColor(Color color, BlendMode blendMode) { + assert(color != null); + assert(blendMode != null); + throw UnimplementedError(); + } + + /// Draws a line between the given points using the given paint. The line is + /// stroked, the value of the [Paint.style] is ignored for this call. + /// + /// The `p1` and `p2` arguments are interpreted as offsets from the origin. + void drawLine(Offset p1, Offset p2, Paint paint) { + assert(_offsetIsValid(p1)); + assert(_offsetIsValid(p2)); + assert(paint != null); + throw UnimplementedError(); + } + + /// Fills the canvas with the given [Paint]. + /// + /// To fill the canvas with a solid color and blend mode, consider + /// [drawColor] instead. + void drawPaint(Paint paint) { + assert(paint != null); + throw UnimplementedError(); + } + + /// Draws a rectangle with the given [Paint]. Whether the rectangle is filled + /// or stroked (or both) is controlled by [Paint.style]. + void drawRect(Rect rect, Paint paint) { + assert(_rectIsValid(rect)); + assert(paint != null); + throw UnimplementedError(); + } + + /// Draws a rounded rectangle with the given [Paint]. Whether the rectangle is + /// filled or stroked (or both) is controlled by [Paint.style]. + void drawRRect(RRect rrect, Paint paint) { + assert(_rrectIsValid(rrect)); + assert(paint != null); + throw UnimplementedError(); + } + + /// Draws a shape consisting of the difference between two rounded rectangles + /// with the given [Paint]. Whether this shape is filled or stroked (or both) + /// is controlled by [Paint.style]. + /// + /// This shape is almost but not quite entirely unlike an annulus. + void drawDRRect(RRect outer, RRect inner, Paint paint) { + assert(_rrectIsValid(outer)); + assert(_rrectIsValid(inner)); + assert(paint != null); + throw UnimplementedError(); + } + + /// Draws an axis-aligned oval that fills the given axis-aligned rectangle + /// with the given [Paint]. Whether the oval is filled or stroked (or both) is + /// controlled by [Paint.style]. + void drawOval(Rect rect, Paint paint) { + assert(_rectIsValid(rect)); + assert(paint != null); + throw UnimplementedError(); + } + + /// Draws a circle centered at the point given by the first argument and + /// that has the radius given by the second argument, with the [Paint] given in + /// the third argument. Whether the circle is filled or stroked (or both) is + /// controlled by [Paint.style]. + void drawCircle(Offset c, double radius, Paint paint) { + assert(_offsetIsValid(c)); + assert(paint != null); + throw UnimplementedError(); + } + + /// Draw an arc scaled to fit inside the given rectangle. It starts from + /// startAngle radians around the oval up to startAngle + sweepAngle + /// radians around the oval, with zero radians being the point on + /// the right hand side of the oval that crosses the horizontal line + /// that intersects the center of the rectangle and with positive + /// angles going clockwise around the oval. If useCenter is true, the arc is + /// closed back to the center, forming a circle sector. Otherwise, the arc is + /// not closed, forming a circle segment. + /// + /// This method is optimized for drawing arcs and should be faster than [Path.arcTo]. + void drawArc(Rect rect, double startAngle, double sweepAngle, bool useCenter, Paint paint) { + assert(_rectIsValid(rect)); + assert(paint != null); + throw UnimplementedError(); + } + + /// Draws the given [Path] with the given [Paint]. Whether this shape is + /// filled or stroked (or both) is controlled by [Paint.style]. If the path is + /// filled, then subpaths within it are implicitly closed (see [Path.close]). + void drawPath(Path path, Paint paint) { + assert(path != null); // path is checked on the engine side + assert(paint != null); + throw UnimplementedError(); + } + + /// Draws the given [Image] into the canvas with its top-left corner at the + /// given [Offset]. The image is composited into the canvas using the given [Paint]. + void drawImage(Image image, Offset p, Paint paint) { + assert(image != null); // image is checked on the engine side + assert(_offsetIsValid(p)); + assert(paint != null); + throw UnimplementedError(); + } + + /// Draws the subset of the given image described by the `src` argument into + /// the canvas in the axis-aligned rectangle given by the `dst` argument. + /// + /// This might sample from outside the `src` rect by up to half the width of + /// an applied filter. + /// + /// Multiple calls to this method with different arguments (from the same + /// image) can be batched into a single call to [drawAtlas] to improve + /// performance. + void drawImageRect(Image image, Rect src, Rect dst, Paint paint) { + assert(image != null); // image is checked on the engine side + assert(_rectIsValid(src)); + assert(_rectIsValid(dst)); + assert(paint != null); + throw UnimplementedError(); + } + + /// Draws the given [Image] into the canvas using the given [Paint]. + /// + /// The image is drawn in nine portions described by splitting the image by + /// drawing two horizontal lines and two vertical lines, where the `center` + /// argument describes the rectangle formed by the four points where these + /// four lines intersect each other. (This forms a 3-by-3 grid of regions, + /// the center region being described by the `center` argument.) + /// + /// The four regions in the corners are drawn, without scaling, in the four + /// corners of the destination rectangle described by `dst`. The remaining + /// five regions are drawn by stretching them to fit such that they exactly + /// cover the destination rectangle while maintaining their relative + /// positions. + void drawImageNine(Image image, Rect center, Rect dst, Paint paint) { + assert(image != null); // image is checked on the engine side + assert(_rectIsValid(center)); + assert(_rectIsValid(dst)); + assert(paint != null); + throw UnimplementedError(); + } + + /// Draw the given picture onto the canvas. To create a picture, see + /// [PictureRecorder]. + void drawPicture(Picture picture) { + assert(picture != null); // picture is checked on the engine side + throw UnimplementedError(); + } + + /// Draws the text in the given [Paragraph] into this canvas at the given + /// [Offset]. + /// + /// The [Paragraph] object must have had [Paragraph.layout] called on it + /// first. + /// + /// To align the text, set the `textAlign` on the [ParagraphStyle] object + /// passed to the [new ParagraphBuilder] constructor. For more details see + /// [TextAlign] and the discussion at [new ParagraphStyle]. + /// + /// If the text is left aligned or justified, the left margin will be at the + /// position specified by the `offset` argument's [Offset.dx] coordinate. + /// + /// If the text is right aligned or justified, the right margin will be at the + /// position described by adding the [ParagraphConstraints.width] given to + /// [Paragraph.layout], to the `offset` argument's [Offset.dx] coordinate. + /// + /// If the text is centered, the centering axis will be at the position + /// described by adding half of the [ParagraphConstraints.width] given to + /// [Paragraph.layout], to the `offset` argument's [Offset.dx] coordinate. + void drawParagraph(Paragraph paragraph, Offset offset) { + assert(paragraph != null); + assert(_offsetIsValid(offset)); + throw UnimplementedError(); + } + + /// Draws a sequence of points according to the given [PointMode]. + /// + /// The `points` argument is interpreted as offsets from the origin. + /// + /// See also: + /// + /// * [drawRawPoints], which takes `points` as a [Float32List] rather than a + /// [List]. + void drawPoints(PointMode pointMode, List points, Paint paint) { + assert(pointMode != null); + assert(points != null); + assert(paint != null); + throw UnimplementedError(); + } + + /// Draws a sequence of points according to the given [PointMode]. + /// + /// The `points` argument is interpreted as a list of pairs of floating point + /// numbers, where each pair represents an x and y offset from the origin. + /// + /// See also: + /// + /// * [drawPoints], which takes `points` as a [List] rather than a + /// [List]. + void drawRawPoints(PointMode pointMode, Float32List points, Paint paint) { + assert(pointMode != null); + assert(points != null); + assert(paint != null); + throw UnimplementedError(); + } + + void drawVertices(Vertices vertices, BlendMode blendMode, Paint paint) { + assert(vertices != null); // vertices is checked on the engine side + assert(paint != null); + assert(blendMode != null); + throw UnimplementedError(); + } + + // + // See also: + // + // * [drawRawAtlas], which takes its arguments as typed data lists rather + // than objects. + void drawAtlas(Image atlas, + List transforms, + List rects, + List colors, + BlendMode blendMode, + Rect cullRect, + Paint paint) { + assert(atlas != null); // atlas is checked on the engine side + assert(transforms != null); + assert(rects != null); + assert(colors != null); + assert(blendMode != null); + assert(paint != null); + throw UnimplementedError(); + } + + // + // The `rstTransforms` argument is interpreted as a list of four-tuples, with + // each tuple being ([RSTransform.scos], [RSTransform.ssin], + // [RSTransform.tx], [RSTransform.ty]). + // + // The `rects` argument is interpreted as a list of four-tuples, with each + // tuple being ([Rect.left], [Rect.top], [Rect.right], [Rect.bottom]). + // + // The `colors` argument, which can be null, is interpreted as a list of + // 32-bit colors, with the same packing as [Color.value]. + // + // See also: + // + // * [drawAtlas], which takes its arguments as objects rather than typed + // data lists. + void drawRawAtlas(Image atlas, + Float32List rstTransforms, + Float32List rects, + Int32List colors, + BlendMode blendMode, + Rect cullRect, + Paint paint) { + throw UnimplementedError(); + } + + /// Draws a shadow for a [Path] representing the given material elevation. + /// + /// The `transparentOccluder` argument should be true if the occluding object + /// is not opaque. + /// + /// The arguments must not be null. + void drawShadow(Path path, Color color, double elevation, bool transparentOccluder) { + assert(path != null); // path is checked on the engine side + assert(color != null); + assert(transparentOccluder != null); + throw UnimplementedError(); + } +} + +/// An object representing a sequence of recorded graphical operations. +/// +/// To create a [Picture], use a [PictureRecorder]. +/// +/// 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. +class Picture { + /// This class is created by the engine, and should not be instantiated + /// or extended directly. + /// + /// To create a [Picture], use a [PictureRecorder]. + Picture._(); + + /// Creates an image from this picture. + /// + /// The picture is rasterized using the number of pixels specified by the + /// given width and height. + /// + /// Although the image is returned synchronously, the picture is actually + /// rasterized the first time the image is drawn and then cached. + Future toImage(int width, int height) { + throw UnimplementedError(); + } + /// Release the resources used by this object. The object is no longer usable + /// after this method is called. + void dispose() { + throw UnimplementedError(); + } + + /// Returns the approximate number of bytes allocated for this object. + /// + /// The actual size of this picture may be larger, particularly if it contains + /// references to image or other large objects. + int get approximateBytesUsed { + throw UnimplementedError(); + } +} + +/// Records a [Picture] containing a sequence of graphical operations. +/// +/// To begin recording, construct a [Canvas] to record the commands. +/// To end recording, use the [PictureRecorder.endRecording] method. +class PictureRecorder { + /// Creates a new idle PictureRecorder. To associate it with a + /// [Canvas] and begin recording, pass this [PictureRecorder] to the + /// [Canvas] constructor. + PictureRecorder(); + + /// Whether this object is currently recording commands. + /// + /// Specifically, this returns true if a [Canvas] object has been + /// created to record commands and recording has not yet ended via a + /// call to [endRecording], and false if either this + /// [PictureRecorder] has not yet been associated with a [Canvas], + /// or the [endRecording] method has already been called. + bool get isRecording { + throw UnimplementedError(); + } + + /// Finishes recording graphical operations. + /// + /// Returns a picture containing the graphical operations that have been + /// recorded thus far. After calling this function, both the picture recorder + /// and the canvas objects are invalid and cannot be used further. + /// + /// Returns null if the PictureRecorder is not associated with a canvas. + Picture endRecording() { + throw UnimplementedError(); + } +} + +/// 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; + + /// 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() { + throw UnimplementedError(); + } + + /// Returns a new shadow with its [offset] and [blurRadius] scaled by the given + /// factor. + Shadow scale(double factor) { + throw UnimplementedError(); + } + + /// 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) { + throw UnimplementedError(); + } + + /// 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) { + throw UnimplementedError(); + } + + @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); + + @override + String toString() => 'TextShadow($color, $offset, $blurRadius)'; +} + +/// Generic callback signature, used by [_futurize]. +typedef _Callback = void Function(T result); + +/// Signature for a method that receives a [_Callback]. +/// +/// Return value should be null on success, and a string error message on +/// failure. +typedef _Callbacker = String Function(_Callback callback); + +/// Converts a method that receives a value-returning callback to a method that +/// returns a Future. +/// +/// Return a [String] to cause an [Exception] to be synchronously thrown with +/// that string as a message. +/// +/// If the callback is called with null, the future completes with an error. +/// +/// Example usage: +/// +/// ```dart +/// typedef IntCallback = void Function(int result); +/// +/// String _doSomethingAndCallback(IntCallback callback) { +/// new Timer(new Duration(seconds: 1), () { callback(1); }); +/// } +/// +/// Future doSomething() { +/// return _futurize(_doSomethingAndCallback); +/// } +/// ``` +Future _futurize(_Callbacker callbacker) { + throw UnimplementedError(); +} diff --git a/lib/stub_ui/plugins.dart b/lib/stub_ui/plugins.dart new file mode 100644 index 0000000000000..12dbbf2d3c98f --- /dev/null +++ b/lib/stub_ui/plugins.dart @@ -0,0 +1,71 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of dart.ui; + +/// A wrapper for a raw callback handle. +/// +/// This is the return type for [PluginUtilities.getCallbackHandle]. +class CallbackHandle { + /// Create an instance using a raw callback handle. + /// + /// Only values produced by a call to [CallbackHandle.toRawHandle] should be + /// used, otherwise this object will be an invalid handle. + CallbackHandle.fromRawHandle(this._handle) + : assert(_handle != null, "'_handle' must not be null."); + + final int _handle; + + /// Get the raw callback handle to pass over a [MethodChannel] or [SendPort] + /// (to pass to another [Isolate]). + int toRawHandle() => _handle; + + @override + bool operator ==(dynamic other) { + if (runtimeType != other.runtimeType) + return false; + final CallbackHandle typedOther = other; + return _handle == typedOther._handle; + } + + @override + int get hashCode => _handle.hashCode; +} + +/// Functionality for Flutter plugin authors. +/// +/// See also: +/// +/// * [IsolateNameServer], which provides utilities for dealing with +/// [Isolate]s. +class PluginUtilities { + // This class is only a namespace, and should not be instantiated or + // extended directly. + factory PluginUtilities._() => null; + + /// Get a handle to a named top-level or static callback function which can + /// be easily passed between isolates. + /// + /// The `callback` argument must not be null. + /// + /// Returns a [CallbackHandle] that can be provided to + /// [PluginUtilities.getCallbackFromHandle] to retrieve a tear-off of the + /// original callback. If `callback` is not a top-level or static function, + /// null is returned. + static CallbackHandle getCallbackHandle(Function callback) { + throw UnimplementedError(); + } + + /// Get a tear-off of a named top-level or static callback represented by a + /// handle. + /// + /// The `handle` argument must not be null. + /// + /// If `handle` is not a valid handle returned by + /// [PluginUtilities.getCallbackHandle], null is returned. Otherwise, a + /// tear-off of the callback associated with `handle` is returned. + static Function getCallbackFromHandle(CallbackHandle handle) { + throw UnimplementedError(); + } +} diff --git a/lib/stub_ui/pointer.dart b/lib/stub_ui/pointer.dart new file mode 100644 index 0000000000000..c0d3757d84bd5 --- /dev/null +++ b/lib/stub_ui/pointer.dart @@ -0,0 +1,245 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of dart.ui; + +/// How the pointer has changed since the last report. +enum PointerChange { + /// The input from the pointer is no longer directed towards this receiver. + cancel, + + /// The device has started tracking the pointer. + /// + /// For example, the pointer might be hovering above the device, having not yet + /// made contact with the surface of the device. + add, + + /// The device is no longer tracking the pointer. + /// + /// For example, the pointer might have drifted out of the device's hover + /// detection range or might have been disconnected from the system entirely. + remove, + + /// The pointer has moved with respect to the device while not in contact with + /// the device. + hover, + + /// The pointer has made contact with the device. + down, + + /// The pointer has moved with respect to the device while in contact with the + /// device. + move, + + /// The pointer has stopped making contact with the device. + up, +} + +/// The kind of pointer device. +enum PointerDeviceKind { + /// A touch-based pointer device. + touch, + + /// A mouse-based pointer device. + mouse, + + /// A pointer device with a stylus. + stylus, + + /// A pointer device with a stylus that has been inverted. + invertedStylus, + + /// An unknown pointer device. + unknown +} + +/// Information about the state of a pointer. +class PointerData { + /// Creates an object that represents the state of a pointer. + const PointerData({ + this.timeStamp: Duration.zero, + this.change: PointerChange.cancel, + this.kind: PointerDeviceKind.touch, + this.device: 0, + this.physicalX: 0.0, + this.physicalY: 0.0, + this.buttons: 0, + this.obscured: false, + this.pressure: 0.0, + this.pressureMin: 0.0, + 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.platformData: 0, + }); + + /// Time of event dispatch, relative to an arbitrary timeline. + final Duration timeStamp; + + /// How the pointer has changed since the last report. + final PointerChange change; + + /// The kind of input device for which the event was generated. + final PointerDeviceKind kind; + + /// Unique identifier for the pointing device, reused across interactions. + final int device; + + /// X coordinate of the position of the pointer, in physical pixels in the + /// global coordinate space. + final double physicalX; + + /// Y coordinate of the position of the pointer, in physical pixels in the + /// global coordinate space. + final double physicalY; + + /// Bit field using the *Button constants (primaryMouseButton, + /// secondaryStylusButton, etc). For example, if this has the value 6 and the + /// [kind] is [PointerDeviceKind.invertedStylus], then this indicates an + /// upside-down stylus with both its primary and secondary buttons pressed. + final int buttons; + + /// Set if an application from a different security domain is in any way + /// obscuring this application's window. (Aspirational; not currently + /// implemented.) + final bool obscured; + + /// The pressure of the touch as a number ranging from 0.0, indicating a touch + /// with no discernible pressure, to 1.0, indicating a touch with "normal" + /// pressure, and possibly beyond, indicating a stronger touch. For devices + /// that do not detect pressure (e.g. mice), returns 1.0. + final double pressure; + + /// The minimum value that [pressure] can return for this pointer. For devices + /// that do not detect pressure (e.g. mice), returns 1.0. This will always be + /// a number less than or equal to 1.0. + final double pressureMin; + + /// The maximum value that [pressure] can return for this pointer. For devices + /// that do not detect pressure (e.g. mice), returns 1.0. This will always be + /// a greater than or equal to 1.0. + final double pressureMax; + + /// The distance of the detected object from the input surface (e.g. the + /// distance of a stylus or finger from a touch screen), in arbitrary units on + /// an arbitrary (not necessarily linear) scale. If the pointer is down, this + /// is 0.0 by definition. + final double distance; + + /// The maximum value that a distance can return for this pointer. If this + /// input device cannot detect "hover touch" input events, then this will be + /// 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; + + /// The radius of the contact ellipse along the minor axis, in logical pixels. + final double radiusMinor; + + /// The minimum value that could be reported for radiusMajor and radiusMinor + /// for this pointer, in logical pixels. + final double radiusMin; + + /// The minimum value that could be reported for radiusMajor and radiusMinor + /// for this pointer, in logical pixels. + final double radiusMax; + + /// For PointerDeviceKind.touch events: + /// + /// The angle of the contact ellipse, in radius in the range: + /// + /// -pi/2 < orientation <= pi/2 + /// + /// ...giving the angle of the major axis of the ellipse with the y-axis + /// (negative angles indicating an orientation along the top-left / + /// bottom-right diagonal, positive angles indicating an orientation along the + /// top-right / bottom-left diagonal, and zero indicating an orientation + /// parallel with the y-axis). + /// + /// For PointerDeviceKind.stylus and PointerDeviceKind.invertedStylus events: + /// + /// The angle of the stylus, in radians in the range: + /// + /// -pi < orientation <= pi + /// + /// ...giving the angle of the axis of the stylus projected onto the input + /// surface, relative to the positive y-axis of that surface (thus 0.0 + /// indicates the stylus, if projected onto that surface, would go from the + /// contact point vertically up in the positive y-axis direction, pi would + /// indicate that the stylus would go down in the negative y-axis direction; + /// pi/4 would indicate that the stylus goes up and to the right, -pi/2 would + /// indicate that the stylus goes to the left, etc). + final double orientation; + + /// For PointerDeviceKind.stylus and PointerDeviceKind.invertedStylus events: + /// + /// The angle of the stylus, in radians in the range: + /// + /// 0 <= tilt <= pi/2 + /// + /// ...giving the angle of the axis of the stylus, relative to the axis + /// perpendicular to the input surface (thus 0.0 indicates the stylus is + /// orthogonal to the plane of the input surface, while pi/2 indicates that + /// 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)'; + + /// Returns a complete textual description of the information in this object. + String toStringFull() { + return '$runtimeType(' + 'timeStamp: $timeStamp, ' + 'change: $change, ' + 'kind: $kind, ' + 'device: $device, ' + 'physicalX: $physicalX, ' + 'physicalY: $physicalY, ' + 'buttons: $buttons, ' + 'pressure: $pressure, ' + 'pressureMin: $pressureMin, ' + 'pressureMax: $pressureMax, ' + 'distance: $distance, ' + 'distanceMax: $distanceMax, ' + 'size: $size, ' + 'radiusMajor: $radiusMajor, ' + 'radiusMinor: $radiusMinor, ' + 'radiusMin: $radiusMin, ' + 'radiusMax: $radiusMax, ' + 'orientation: $orientation, ' + 'tilt: $tilt, ' + 'platformData: $platformData' + ')'; + } +} + +/// A sequence of reports about the state of pointers. +class PointerDataPacket { + /// Creates a packet of pointer data reports. + const PointerDataPacket({ this.data: const [] }); + + /// Data about the individual pointers in this packet. + /// + /// This list might contain multiple pieces of data about the same pointer. + final List data; +} diff --git a/lib/stub_ui/semantics.dart b/lib/stub_ui/semantics.dart new file mode 100644 index 0000000000000..97996270303d9 --- /dev/null +++ b/lib/stub_ui/semantics.dart @@ -0,0 +1,694 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of dart.ui; + +/// The possible actions that can be conveyed from the operating system +/// accessibility APIs to a semantics node. +class SemanticsAction { + const SemanticsAction._(this.index); + + static const int _kTapIndex = 1 << 0; + static const int _kLongPressIndex = 1 << 1; + static const int _kScrollLeftIndex = 1 << 2; + static const int _kScrollRightIndex = 1 << 3; + static const int _kScrollUpIndex = 1 << 4; + static const int _kScrollDownIndex = 1 << 5; + static const int _kIncreaseIndex = 1 << 6; + static const int _kDecreaseIndex = 1 << 7; + static const int _kShowOnScreenIndex = 1 << 8; + static const int _kMoveCursorForwardByCharacterIndex = 1 << 9; + static const int _kMoveCursorBackwardByCharacterIndex = 1 << 10; + static const int _kSetSelectionIndex = 1 << 11; + static const int _kCopyIndex = 1 << 12; + static const int _kCutIndex = 1 << 13; + static const int _kPasteIndex = 1 << 14; + static const int _kDidGainAccessibilityFocusIndex = 1 << 15; + static const int _kDidLoseAccessibilityFocusIndex = 1 << 16; + static const int _kCustomAction = 1 << 17; + static const int _kDismissIndex = 1 << 18; + static const int _kMoveCursorForwardByWordIndex = 1 << 19; + static const int _kMoveCursorBackwardByWordIndex = 1 << 20; + + /// The numerical value for this action. + /// + /// Each action has one bit set in this bit field. + final int index; + + /// The equivalent of a user briefly tapping the screen with the finger + /// without moving it. + static const SemanticsAction tap = const SemanticsAction._(_kTapIndex); + + /// The equivalent of a user pressing and holding the screen with the finger + /// for a few seconds without moving it. + static const SemanticsAction longPress = const SemanticsAction._(_kLongPressIndex); + + /// The equivalent of a user moving their finger across the screen from right + /// to left. + /// + /// This action should be recognized by controls that are horizontally + /// scrollable. + static const SemanticsAction scrollLeft = const SemanticsAction._(_kScrollLeftIndex); + + /// The equivalent of a user moving their finger across the screen from left + /// to right. + /// + /// This action should be recognized by controls that are horizontally + /// scrollable. + static const SemanticsAction scrollRight = const SemanticsAction._(_kScrollRightIndex); + + /// The equivalent of a user moving their finger across the screen from + /// bottom to top. + /// + /// This action should be recognized by controls that are vertically + /// scrollable. + static const SemanticsAction scrollUp = const SemanticsAction._(_kScrollUpIndex); + + /// The equivalent of a user moving their finger across the screen from top + /// to bottom. + /// + /// This action should be recognized by controls that are vertically + /// scrollable. + static const SemanticsAction scrollDown = const SemanticsAction._(_kScrollDownIndex); + + /// A request to increase the value represented by the semantics node. + /// + /// For example, this action might be recognized by a slider control. + static const SemanticsAction increase = const SemanticsAction._(_kIncreaseIndex); + + /// A request to decrease the value represented by the semantics node. + /// + /// For example, this action might be recognized by a slider control. + static const SemanticsAction decrease = const SemanticsAction._(_kDecreaseIndex); + + /// A request to fully show the semantics node on screen. + /// + /// For example, this action might be send to a node in a scrollable list that + /// is partially off screen to bring it on screen. + static const SemanticsAction showOnScreen = const SemanticsAction._(_kShowOnScreenIndex); + + /// Move the cursor forward by one character. + /// + /// This is for example used by the cursor control in text fields. + /// + /// The action includes a boolean argument, which indicates whether the cursor + /// movement should extend (or start) a selection. + static const SemanticsAction moveCursorForwardByCharacter = const SemanticsAction._(_kMoveCursorForwardByCharacterIndex); + + /// Move the cursor backward by one character. + /// + /// This is for example used by the cursor control in text fields. + /// + /// The action includes a boolean argument, which indicates whether the cursor + /// movement should extend (or start) a selection. + static const SemanticsAction moveCursorBackwardByCharacter = const SemanticsAction._(_kMoveCursorBackwardByCharacterIndex); + + /// Set the text selection to the given range. + /// + /// The provided argument is a Map which includes the keys `base` + /// and `extent` indicating where the selection within the `value` of the + /// semantics node should start and where it should end. Values for both + /// keys can range from 0 to length of `value` (inclusive). + /// + /// Setting `base` and `extent` to the same value will move the cursor to + /// that position (without selecting anything). + static const SemanticsAction setSelection = const SemanticsAction._(_kSetSelectionIndex); + + /// Copy the current selection to the clipboard. + static const SemanticsAction copy = const SemanticsAction._(_kCopyIndex); + + /// Cut the current selection and place it in the clipboard. + static const SemanticsAction cut = const SemanticsAction._(_kCutIndex); + + /// Paste the current content of the clipboard. + static const SemanticsAction paste = const SemanticsAction._(_kPasteIndex); + + /// Indicates that the nodes has gained accessibility focus. + /// + /// This handler is invoked when the node annotated with this handler gains + /// the accessibility focus. The accessibility focus is the + /// green (on Android with TalkBack) or black (on iOS with VoiceOver) + /// rectangle shown on screen to indicate what element an accessibility + /// user is currently interacting with. + /// + /// The accessibility focus is different from the input focus. The input focus + /// is usually held by the element that currently responds to keyboard inputs. + /// Accessibility focus and input focus can be held by two different nodes! + static const SemanticsAction didGainAccessibilityFocus = const SemanticsAction._(_kDidGainAccessibilityFocusIndex); + + /// Indicates that the nodes has lost accessibility focus. + /// + /// This handler is invoked when the node annotated with this handler + /// loses the accessibility focus. The accessibility focus is + /// the green (on Android with TalkBack) or black (on iOS with VoiceOver) + /// rectangle shown on screen to indicate what element an accessibility + /// user is currently interacting with. + /// + /// The accessibility focus is different from the input focus. The input focus + /// is usually held by the element that currently responds to keyboard inputs. + /// Accessibility focus and input focus can be held by two different nodes! + static const SemanticsAction didLoseAccessibilityFocus = const SemanticsAction._(_kDidLoseAccessibilityFocusIndex); + + /// Indicates that the user has invoked a custom accessibility action. + /// + /// This handler is added automatically whenever a custom accessibility + /// action is added to a semantics node. + static const SemanticsAction customAction = const SemanticsAction._(_kCustomAction); + + /// A request that the node should be dismissed. + /// + /// A [Snackbar], for example, may have a dismiss action to indicate to the + /// user that it can be removed after it is no longer relevant. On Android, + /// (with TalkBack) special hint text is spoken when focusing the node and + /// a custom action is availible in the local context menu. On iOS, + /// (with VoiceOver) users can perform a standard gesture to dismiss it. + static const SemanticsAction dismiss = const SemanticsAction._(_kDismissIndex); + + /// Move the cursor forward by one word. + /// + /// This is for example used by the cursor control in text fields. + /// + /// The action includes a boolean argument, which indicates whether the cursor + /// movement should extend (or start) a selection. + static const SemanticsAction moveCursorForwardByWord = const SemanticsAction._(_kMoveCursorForwardByWordIndex); + + /// Move the cursor backward by one word. + /// + /// This is for example used by the cursor control in text fields. + /// + /// The action includes a boolean argument, which indicates whether the cursor + /// movement should extend (or start) a selection. + static const SemanticsAction moveCursorBackwardByWord = const SemanticsAction._(_kMoveCursorBackwardByWordIndex); + + /// The possible semantics actions. + /// + /// The map's key is the [index] of the action and the value is the action + /// itself. + static const Map values = const { + _kTapIndex: tap, + _kLongPressIndex: longPress, + _kScrollLeftIndex: scrollLeft, + _kScrollRightIndex: scrollRight, + _kScrollUpIndex: scrollUp, + _kScrollDownIndex: scrollDown, + _kIncreaseIndex: increase, + _kDecreaseIndex: decrease, + _kShowOnScreenIndex: showOnScreen, + _kMoveCursorForwardByCharacterIndex: moveCursorForwardByCharacter, + _kMoveCursorBackwardByCharacterIndex: moveCursorBackwardByCharacter, + _kSetSelectionIndex: setSelection, + _kCopyIndex: copy, + _kCutIndex: cut, + _kPasteIndex: paste, + _kDidGainAccessibilityFocusIndex: didGainAccessibilityFocus, + _kDidLoseAccessibilityFocusIndex: didLoseAccessibilityFocus, + _kCustomAction: customAction, + _kDismissIndex: dismiss, + _kMoveCursorForwardByWordIndex: moveCursorForwardByWord, + _kMoveCursorBackwardByWordIndex: moveCursorBackwardByWord, + }; + + @override + String toString() { + switch (index) { + case _kTapIndex: + return 'SemanticsAction.tap'; + case _kLongPressIndex: + return 'SemanticsAction.longPress'; + case _kScrollLeftIndex: + return 'SemanticsAction.scrollLeft'; + case _kScrollRightIndex: + return 'SemanticsAction.scrollRight'; + case _kScrollUpIndex: + return 'SemanticsAction.scrollUp'; + case _kScrollDownIndex: + return 'SemanticsAction.scrollDown'; + case _kIncreaseIndex: + return 'SemanticsAction.increase'; + case _kDecreaseIndex: + return 'SemanticsAction.decrease'; + case _kShowOnScreenIndex: + return 'SemanticsAction.showOnScreen'; + case _kMoveCursorForwardByCharacterIndex: + return 'SemanticsAction.moveCursorForwardByCharacter'; + case _kMoveCursorBackwardByCharacterIndex: + return 'SemanticsAction.moveCursorBackwardByCharacter'; + case _kSetSelectionIndex: + return 'SemanticsAction.setSelection'; + case _kCopyIndex: + return 'SemanticsAction.copy'; + case _kCutIndex: + return 'SemanticsAction.cut'; + case _kPasteIndex: + return 'SemanticsAction.paste'; + case _kDidGainAccessibilityFocusIndex: + return 'SemanticsAction.didGainAccessibilityFocus'; + case _kDidLoseAccessibilityFocusIndex: + return 'SemanticsAction.didLoseAccessibilityFocus'; + case _kCustomAction: + return 'SemanticsAction.customAction'; + case _kDismissIndex: + return 'SemanticsAction.dismiss'; + case _kMoveCursorForwardByWordIndex: + return 'SemanticsAction.moveCursorForwardByWord'; + case _kMoveCursorBackwardByWordIndex: + return 'SemanticsAction.moveCursorBackwardByWord'; + } + return null; + } +} + +/// A Boolean value that can be associated with a semantics node. +class SemanticsFlag { + static const int _kHasCheckedStateIndex = 1 << 0; + static const int _kIsCheckedIndex = 1 << 1; + static const int _kIsSelectedIndex = 1 << 2; + static const int _kIsButtonIndex = 1 << 3; + static const int _kIsTextFieldIndex = 1 << 4; + static const int _kIsFocusedIndex = 1 << 5; + static const int _kHasEnabledStateIndex = 1 << 6; + static const int _kIsEnabledIndex = 1 << 7; + static const int _kIsInMutuallyExclusiveGroupIndex = 1 << 8; + static const int _kIsHeaderIndex = 1 << 9; + static const int _kIsObscuredIndex = 1 << 10; + static const int _kScopesRouteIndex= 1 << 11; + static const int _kNamesRouteIndex = 1 << 12; + static const int _kIsHiddenIndex = 1 << 13; + static const int _kIsImageIndex = 1 << 14; + static const int _kIsLiveRegionIndex = 1 << 15; + static const int _kHasToggledStateIndex = 1 << 16; + static const int _kIsToggledIndex = 1 << 17; + static const int _kHasImplicitScrollingIndex = 1 << 18; + + const SemanticsFlag._(this.index); + + /// The numerical value for this flag. + /// + /// Each flag has one bit set in this bit field. + final int index; + + /// The semantics node has the quality of either being "checked" or "unchecked". + /// + /// This flag is mutually exclusive with [hasToggledState]. + /// + /// For example, a checkbox or a radio button widget has checked state. + /// + /// See also: + /// + /// * [SemanticsFlag.isChecked], which controls whether the node is "checked" or "unchecked". + static const SemanticsFlag hasCheckedState = const SemanticsFlag._(_kHasCheckedStateIndex); + + /// Whether a semantics node that [hasCheckedState] is checked. + /// + /// If true, the semantics node is "checked". If false, the semantics node is + /// "unchecked". + /// + /// For example, if a checkbox has a visible checkmark, [isChecked] is true. + /// + /// See also: + /// + /// * [SemanticsFlag.hasCheckedState], which enables a checked state. + static const SemanticsFlag isChecked = const SemanticsFlag._(_kIsCheckedIndex); + + + /// Whether a semantics node is selected. + /// + /// If true, the semantics node is "selected". If false, the semantics node is + /// "unselected". + /// + /// For example, the active tab in a tab bar has [isSelected] set to true. + static const SemanticsFlag isSelected = const SemanticsFlag._(_kIsSelectedIndex); + + /// Whether the semantic node represents a button. + /// + /// Platforms has special handling for buttons, for example Android's TalkBack + /// and iOS's VoiceOver provides an additional hint when the focused object is + /// a button. + static const SemanticsFlag isButton = const SemanticsFlag._(_kIsButtonIndex); + + /// Whether the semantic node represents a text field. + /// + /// Text fields are announced as such and allow text input via accessibility + /// affordances. + static const SemanticsFlag isTextField = const SemanticsFlag._(_kIsTextFieldIndex); + + /// Whether the semantic node currently holds the user's focus. + /// + /// The focused element is usually the current receiver of keyboard inputs. + static const SemanticsFlag isFocused = const SemanticsFlag._(_kIsFocusedIndex); + + /// The semantics node has the quality of either being "enabled" or + /// "disabled". + /// + /// For example, a button can be enabled or disabled and therefore has an + /// "enabled" state. Static text is usually neither enabled nor disabled and + /// therefore does not have an "enabled" state. + static const SemanticsFlag hasEnabledState = const SemanticsFlag._(_kHasEnabledStateIndex); + + /// Whether a semantic node that [hasEnabledState] is currently enabled. + /// + /// A disabled element does not respond to user interaction. For example, a + /// button that currently does not respond to user interaction should be + /// marked as disabled. + static const SemanticsFlag isEnabled = const SemanticsFlag._(_kIsEnabledIndex); + + /// Whether a semantic node is in a mutually exclusive group. + /// + /// For example, a radio button is in a mutually exclusive group because + /// only one radio button in that group can be marked as [isChecked]. + static const SemanticsFlag isInMutuallyExclusiveGroup = const SemanticsFlag._(_kIsInMutuallyExclusiveGroupIndex); + + /// Whether a semantic node is a header that divides content into sections. + /// + /// For example, headers can be used to divide a list of alphabetically + /// sorted words into the sections A, B, C, etc. as can be found in many + /// address book applications. + static const SemanticsFlag isHeader = const SemanticsFlag._(_kIsHeaderIndex); + + /// Whether the value of the semantics node is obscured. + /// + /// This is usually used for text fields to indicate that its content + /// is a password or contains other sensitive information. + static const SemanticsFlag isObscured = const SemanticsFlag._(_kIsObscuredIndex); + + /// Whether the semantics node is the root of a subtree for which a route name + /// should be announced. + /// + /// When a node with this flag is removed from the semantics tree, the + /// framework will select the last in depth-first, paint order node with this + /// flag. When a node with this flag is added to the semantics tree, it is + /// selected automatically, unless there were multiple nodes with this flag + /// added. In this case, the last added node in depth-first, paint order + /// will be selected. + /// + /// From this selected node, the framework will search in depth-first, paint + /// order for the first node with a [namesRoute] flag and a non-null, + /// non-empty label. The [namesRoute] and [scopesRoute] flags may be on the + /// same node. The label of the found node will be announced as an edge + /// transition. If no non-empty, non-null label is found then: + /// + /// * VoiceOver will make a chime announcement. + /// * TalkBack will make no announcement + /// + /// Semantic nodes annotated with this flag are generally not a11y focusable. + /// + /// This is used in widgets such as Routes, Drawers, and Dialogs to + /// communicate significant changes in the visible screen. + static const SemanticsFlag scopesRoute = const SemanticsFlag._(_kScopesRouteIndex); + + /// Whether the semantics node label is the name of a visually distinct + /// route. + /// + /// This is used by certain widgets like Drawers and Dialogs, to indicate + /// that the node's semantic label can be used to announce an edge triggered + /// semantics update. + /// + /// Semantic nodes annotated with this flag will still receive a11y focus. + /// + /// Updating this label within the same active route subtree will not cause + /// additional announcements. + static const SemanticsFlag namesRoute = const SemanticsFlag._(_kNamesRouteIndex); + + /// Whether the semantics node is considered hidden. + /// + /// Hidden elements are currently not visible on screen. They may be covered + /// by other elements or positioned outside of the visible area of a viewport. + /// + /// Hidden elements cannot gain accessibility focus though regular touch. The + /// only way they can be focused is by moving the focus to them via linear + /// navigation. + /// + /// Platforms are free to completely ignore hidden elements and new platforms + /// are encouraged to do so. + /// + /// Instead of marking an element as hidden it should usually be excluded from + /// the semantics tree altogether. Hidden elements are only included in the + /// semantics tree to work around platform limitations and they are mainly + /// used to implement accessibility scrolling on iOS. + static const SemanticsFlag isHidden = const SemanticsFlag._(_kIsHiddenIndex); + + /// Whether the semantics node represents an image. + /// + /// Both TalkBack and VoiceOver will inform the user the the semantics node + /// represents an image. + static const SemanticsFlag isImage = const SemanticsFlag._(_kIsImageIndex); + + /// Whether the semantics node is a live region. + /// + /// A live region indicates that updates to semantics node are important. + /// Platforms may use this information to make polite announcements to the + /// user to inform them of updates to this node. + /// + /// An example of a live region is a [SnackBar] widget. On Android, A live + /// region causes a polite announcement to be generated automatically, even + /// if the user does not have focus of the widget. + static const SemanticsFlag isLiveRegion = const SemanticsFlag._(_kIsLiveRegionIndex); + + /// The semantics node has the quality of either being "on" or "off". + /// + /// This flag is mutually exclusive with [hasCheckedState]. + /// + /// For example, a switch has toggled state. + /// + /// See also: + /// + /// * [SemanticsFlag.isToggled], which controls whether the node is "on" or "off". + static const SemanticsFlag hasToggledState = const SemanticsFlag._(_kHasToggledStateIndex); + + /// If true, the semantics node is "on". If false, the semantics node is + /// "off". + /// + /// For example, if a switch is in the on position, [isToggled] is true. + /// + /// See also: + /// + /// * [SemanticsFlag.hasToggledState], which enables a toggled state. + static const SemanticsFlag isToggled = const SemanticsFlag._(_kIsToggledIndex); + + /// Whether the platform can scroll the semantics node when the user attempts + /// to move focus to an offscreen child. + /// + /// For example, a [ListView] widget has implicit scrolling so that users can + /// easily move to the next visible set of children. A [TabBar] widget does + /// not have implicit scrolling, so that users can navigate into the tab + /// body when reaching the end of the tab bar. + static const SemanticsFlag hasImplicitScrolling = const SemanticsFlag._(_kHasImplicitScrollingIndex); + + /// The possible semantics flags. + /// + /// The map's key is the [index] of the flag and the value is the flag itself. + static const Map values = const { + _kHasCheckedStateIndex: hasCheckedState, + _kIsCheckedIndex: isChecked, + _kIsSelectedIndex: isSelected, + _kIsButtonIndex: isButton, + _kIsTextFieldIndex: isTextField, + _kIsFocusedIndex: isFocused, + _kHasEnabledStateIndex: hasEnabledState, + _kIsEnabledIndex: isEnabled, + _kIsInMutuallyExclusiveGroupIndex: isInMutuallyExclusiveGroup, + _kIsHeaderIndex: isHeader, + _kIsObscuredIndex: isObscured, + _kScopesRouteIndex: scopesRoute, + _kNamesRouteIndex: namesRoute, + _kIsHiddenIndex: isHidden, + _kIsImageIndex: isImage, + _kIsLiveRegionIndex: isLiveRegion, + _kHasToggledStateIndex: hasToggledState, + _kIsToggledIndex: isToggled, + _kHasImplicitScrollingIndex: hasImplicitScrolling, + }; + + @override + String toString() { + switch (index) { + case _kHasCheckedStateIndex: + return 'SemanticsFlag.hasCheckedState'; + case _kIsCheckedIndex: + return 'SemanticsFlag.isChecked'; + case _kIsSelectedIndex: + return 'SemanticsFlag.isSelected'; + case _kIsButtonIndex: + return 'SemanticsFlag.isButton'; + case _kIsTextFieldIndex: + return 'SemanticsFlag.isTextField'; + case _kIsFocusedIndex: + return 'SemanticsFlag.isFocused'; + case _kHasEnabledStateIndex: + return 'SemanticsFlag.hasEnabledState'; + case _kIsEnabledIndex: + return 'SemanticsFlag.isEnabled'; + case _kIsInMutuallyExclusiveGroupIndex: + return 'SemanticsFlag.isInMutuallyExclusiveGroup'; + case _kIsHeaderIndex: + return 'SemanticsFlag.isHeader'; + case _kIsObscuredIndex: + return 'SemanticsFlag.isObscured'; + case _kScopesRouteIndex: + return 'SemanticsFlag.scopesRoute'; + case _kNamesRouteIndex: + return 'SemanticsFlag.namesRoute'; + case _kIsHiddenIndex: + return 'SemanticsFlag.isHidden'; + case _kIsImageIndex: + return 'SemanticsFlag.isImage'; + case _kIsLiveRegionIndex: + return 'SemanticsFlag.isLiveRegion'; + case _kHasToggledStateIndex: + return 'SemanticsFlag.hasToggledState'; + case _kIsToggledIndex: + return 'SemanticsFlag.isToggled'; + case _kHasImplicitScrollingIndex: + return 'SemanticsFlag.hasImplicitScrolling'; + } + return null; + } +} + +/// An object that creates [SemanticsUpdate] objects. +/// +/// Once created, the [SemanticsUpdate] objects can be passed to +/// [Window.updateSemantics] to update the semantics conveyed to the user. +class SemanticsUpdateBuilder { + /// Creates an empty [SemanticsUpdateBuilder] object. + SemanticsUpdateBuilder(); + + /// Update the information associated with the node with the given `id`. + /// + /// The semantics nodes form a tree, with the root of the tree always having + /// an id of zero. The `childrenInTraversalOrder` and `childrenInHitTestOrder` + /// are the ids of the nodes that are immediate children of this node. The + /// former enumerates children in traversal order, and the latter enumerates + /// the same children in the hit test order. The two lists must have the same + /// length and contain the same ids. They may only differ in the order the + /// ids are listed in. For more information about different child orders, see + /// [DebugSemanticsDumpOrder]. + /// + /// The system retains the nodes that are currently reachable from the root. + /// A given update need not contain information for nodes that do not change + /// in the update. If a node is not reachable from the root after an update, + /// the node will be discarded from the tree. + /// + /// The `flags` are a bit field of [SemanticsFlag]s that apply to this node. + /// + /// The `actions` are a bit field of [SemanticsAction]s that can be undertaken + /// by this node. If the user wishes to undertake one of these actions on this + /// node, the [Window.onSemanticsAction] will be called with `id` and one of + /// the possible [SemanticsAction]s. Because the semantics tree is maintained + /// asynchronously, the [Window.onSemanticsAction] callback might be called + /// with an action that is no longer possible. + /// + /// The `label` is a string that describes this node. The `value` property + /// describes the current value of the node as a string. The `increasedValue` + /// string will become the `value` string after a [SemanticsAction.increase] + /// action is performed. The `decreasedValue` string will become the `value` + /// string after a [SemanticsAction.decrease] action is performed. The `hint` + /// string describes what result an action performed on this node has. The + /// reading direction of all these strings is given by `textDirection`. + /// + /// The fields 'textSelectionBase' and 'textSelectionExtent' describe the + /// currently selected text within `value`. + /// + /// For scrollable nodes `scrollPosition` describes the current scroll + /// position in logical pixel. `scrollExtentMax` and `scrollExtentMin` + /// describe the maximum and minimum in-rage values that `scrollPosition` can + /// be. Both or either may be infinity to indicate unbound scrolling. The + /// value for `scrollPosition` can (temporarily) be outside this range, for + /// example during an overscroll. `scrollChildren` is the count of the + /// total number of child nodes that contribute semantics and `scrollIndex` + /// is the index of the first visible child node that contributes semantics. + /// + /// The `rect` is the region occupied by this node in its own coordinate + /// system. + /// + /// The `transform` is a matrix that maps this node's coordinate system into + /// its parent's coordinate system. + /// + /// The `elevation` describes the distance in z-direction between this node + /// and the `elevation` of the parent. + /// + /// The `thickness` describes how much space this node occupies in the + /// z-direction starting at `elevation`. Basically, in the z-direction the + /// node starts at `elevation` above the parent and ends at `elevation` + + /// `thickness` above the parent. + void updateNode({ + int id, + int flags, + int actions, + int textSelectionBase, + int textSelectionExtent, + int scrollChildren, + int scrollIndex, + double scrollPosition, + double scrollExtentMax, + double scrollExtentMin, + double elevation, + double thickness, + Rect rect, + String label, + String hint, + String value, + String increasedValue, + String decreasedValue, + TextDirection textDirection, + Float64List transform, + Int32List childrenInTraversalOrder, + Int32List childrenInHitTestOrder, + Int32List additionalActions, + }) { + throw UnimplementedError(); + } + + /// Update the custom semantics action associated with the given `id`. + /// + /// The name of the action exposed to the user is the `label`. For overriden + /// standard actions this value is ignored. + /// + /// The `hint` should describe what happens when an action occurs, not the + /// manner in which a tap is accomplished. For example, use "delete" instead + /// of "double tap to delete". + /// + /// The text direction of the `hint` and `label` is the same as the global + /// window. + /// + /// For overriden standard actions, `overrideId` corresponds with a + /// [SemanticsAction.index] value. For custom actions this argument should not be + /// provided. + void updateCustomAction({int id, String label, String hint, int overrideId = -1}) { + assert(id != null); + assert(overrideId != null); + throw UnimplementedError(); + } + + /// Creates a [SemanticsUpdate] object that encapsulates the updates recorded + /// by this object. + /// + /// The returned object can be passed to [Window.updateSemantics] to actually + /// update the semantics retained by the system. + SemanticsUpdate build() { + throw UnimplementedError(); + } +} + +/// An opaque object representing a batch of semantics updates. +/// +/// To create a SemanticsUpdate object, use a [SemanticsUpdateBuilder]. +/// +/// Semantics updates can be applied to the system's retained semantics tree +/// using the [Window.updateSemantics] method. +class SemanticsUpdate { + /// This class is created by the engine, and should not be instantiated + /// or extended directly. + /// + /// To create a SemanticsUpdate object, use a [SemanticsUpdateBuilder]. + SemanticsUpdate._(); + + /// Releases the resources used by this semantics update. + /// + /// After calling this function, the semantics update is cannot be used + /// further. + void dispose() { + throw UnimplementedError(); + } +} diff --git a/lib/stub_ui/text.dart b/lib/stub_ui/text.dart new file mode 100644 index 0000000000000..6b0fd57a16ad6 --- /dev/null +++ b/lib/stub_ui/text.dart @@ -0,0 +1,1434 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of dart.ui; + +/// Whether to slant the glyphs in the font +enum FontStyle { + /// Use the upright glyphs + normal, + + /// Use glyphs designed for slanting + italic, +} + +/// The thickness of the glyphs used to draw the text +class FontWeight { + const FontWeight._(this.index); + + /// The encoded integer value of this font weight. + final int index; + + /// Thin, the least thick + static const FontWeight w100 = const FontWeight._(0); + + /// Extra-light + static const FontWeight w200 = const FontWeight._(1); + + /// Light + static const FontWeight w300 = const FontWeight._(2); + + /// Normal / regular / plain + static const FontWeight w400 = const FontWeight._(3); + + /// Medium + static const FontWeight w500 = const FontWeight._(4); + + /// Semi-bold + static const FontWeight w600 = const FontWeight._(5); + + /// Bold + static const FontWeight w700 = const FontWeight._(6); + + /// Extra-bold + static const FontWeight w800 = const FontWeight._(7); + + /// Black, the most thick + static const FontWeight w900 = const FontWeight._(8); + + /// The default font weight. + static const FontWeight normal = w400; + + /// A commonly used font weight that is heavier than normal. + static const FontWeight bold = w700; + + /// A list of all the font weights. + static const List values = const [ + w100, w200, w300, w400, w500, w600, w700, w800, w900 + ]; + + /// Linearly interpolates between two font weights. + /// + /// Rather than using fractional weights, the interpolation rounds to the + /// nearest weight. + /// + /// Any null values for `a` or `b` are interpreted as equivalent to [normal] + /// (also known as [w400]). + /// + /// 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]). The result + /// is clamped to the range [w100]–[w900]. + /// + /// Values for `t` are usually obtained from an [Animation], such as + /// an [AnimationController]. + static FontWeight lerp(FontWeight a, FontWeight b, double t) { + assert(t != null); + return values[lerpDouble(a?.index ?? normal.index, b?.index ?? normal.index, t).round().clamp(0, 8)]; + } + + @override + String toString() { + return const { + 0: 'FontWeight.w100', + 1: 'FontWeight.w200', + 2: 'FontWeight.w300', + 3: 'FontWeight.w400', + 4: 'FontWeight.w500', + 5: 'FontWeight.w600', + 6: 'FontWeight.w700', + 7: 'FontWeight.w800', + 8: 'FontWeight.w900', + }[index]; + } +} + +/// Whether and how to align text horizontally. +// The order of this enum must match the order of the values in RenderStyleConstants.h's ETextAlign. +enum TextAlign { + /// Align the text on the left edge of the container. + left, + + /// Align the text on the right edge of the container. + right, + + /// Align the text in the center of the container. + center, + + /// Stretch lines of text that end with a soft line break to fill the width of + /// the container. + /// + /// Lines that end with hard line breaks are aligned towards the [start] edge. + justify, + + /// Align the text on the leading edge of the container. + /// + /// For left-to-right text ([TextDirection.ltr]), this is the left edge. + /// + /// For right-to-left text ([TextDirection.rtl]), this is the right edge. + start, + + /// Align the text on the trailing edge of the container. + /// + /// For left-to-right text ([TextDirection.ltr]), this is the right edge. + /// + /// For right-to-left text ([TextDirection.rtl]), this is the left edge. + end, +} + +/// A horizontal line used for aligning text. +enum TextBaseline { + /// The horizontal line used to align the bottom of glyphs for alphabetic characters. + alphabetic, + + /// The horizontal line used to align ideographic characters. + ideographic, +} + +/// A linear decoration to draw near the text. +class TextDecoration { + const TextDecoration._(this._mask); + + /// Creates a decoration that paints the union of all the given decorations. + factory TextDecoration.combine(List decorations) { + int mask = 0; + for (TextDecoration decoration in decorations) + mask |= decoration._mask; + return new TextDecoration._(mask); + } + + final int _mask; + + /// Whether this decoration will paint at least as much decoration as the given decoration. + bool contains(TextDecoration other) { + return (_mask | other._mask) == _mask; + } + + /// Do not draw a decoration + static const TextDecoration none = const TextDecoration._(0x0); + + /// Draw a line underneath each line of text + static const TextDecoration underline = const TextDecoration._(0x1); + + /// Draw a line above each line of text + static const TextDecoration overline = const TextDecoration._(0x2); + + /// Draw a line through each line of text + static const TextDecoration lineThrough = const TextDecoration._(0x4); + + @override + bool operator ==(dynamic other) { + if (other is! TextDecoration) + return false; + final TextDecoration typedOther = other; + return _mask == typedOther._mask; + } + + @override + int get hashCode => _mask.hashCode; + + @override + String toString() { + if (_mask == 0) + return 'TextDecoration.none'; + final List values = []; + if (_mask & underline._mask != 0) + values.add('underline'); + if (_mask & overline._mask != 0) + values.add('overline'); + if (_mask & lineThrough._mask != 0) + values.add('lineThrough'); + if (values.length == 1) + return 'TextDecoration.${values[0]}'; + return 'TextDecoration.combine([${values.join(", ")}])'; + } +} + +/// The style in which to draw a text decoration +enum TextDecorationStyle { + /// Draw a solid line + solid, + + /// Draw two lines + double, + + /// Draw a dotted line + dotted, + + /// Draw a dashed line + dashed, + + /// Draw a sinusoidal line + wavy +} + +/// 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 elements in the same order. Returns +/// false otherwise. +bool _listEquals(List a, List b) { + if (a == null) + return b == null; + if (b == null || a.length != b.length) + return false; + for (int index = 0; index < a.length; index += 1) { + if (a[index] != b[index]) + return false; + } + return true; +} + +// This encoding must match the C++ version of ParagraphBuilder::pushStyle. +// +// The encoded array buffer has 8 elements. +// +// - Element 0: A bit field where the ith bit indicates wheter the ith element +// has a non-null value. Bits 8 to 12 indicate whether |fontFamily|, +// |fontSize|, |letterSpacing|, |wordSpacing|, and |height| are non-null, +// respectively. Bit 0 is unused. +// +// - Element 1: The |color| in ARGB with 8 bits per channel. +// +// - Element 2: A bit field indicating which text decorations are present in +// the |textDecoration| list. The ith bit is set if there's a TextDecoration +// with enum index i in the list. +// +// - Element 3: The |decorationColor| in ARGB with 8 bits per channel. +// +// - Element 4: The bit field of the |decorationStyle|. +// +// - Element 5: The index of the |fontWeight|. +// +// - Element 6: The enum index of the |fontStyle|. +// +// - Element 7: The enum index of the |textBaseline|. +// +Int32List _encodeTextStyle( + Color color, + TextDecoration decoration, + Color decorationColor, + TextDecorationStyle decorationStyle, + FontWeight fontWeight, + FontStyle fontStyle, + TextBaseline textBaseline, + String fontFamily, + List fontFamilyFallback, + double fontSize, + double letterSpacing, + double wordSpacing, + double height, + Locale locale, + Paint background, + Paint foreground, + List shadows +) { + final Int32List result = new Int32List(8); + if (color != null) { + result[0] |= 1 << 1; + result[1] = color.value; + } + if (decoration != null) { + result[0] |= 1 << 2; + result[2] = decoration._mask; + } + if (decorationColor != null) { + result[0] |= 1 << 3; + result[3] = decorationColor.value; + } + if (decorationStyle != null) { + result[0] |= 1 << 4; + result[4] = decorationStyle.index; + } + if (fontWeight != null) { + result[0] |= 1 << 5; + result[5] = fontWeight.index; + } + if (fontStyle != null) { + result[0] |= 1 << 6; + result[6] = fontStyle.index; + } + if (textBaseline != null) { + result[0] |= 1 << 7; + result[7] = textBaseline.index; + } + if (fontFamily != null || (fontFamilyFallback != null && fontFamilyFallback.isNotEmpty)) { + result[0] |= 1 << 8; + // Passed separately to native. + } + if (fontSize != null) { + result[0] |= 1 << 9; + // Passed separately to native. + } + if (letterSpacing != null) { + result[0] |= 1 << 10; + // Passed separately to native. + } + if (wordSpacing != null) { + result[0] |= 1 << 11; + // Passed separately to native. + } + if (height != null) { + result[0] |= 1 << 12; + // Passed separately to native. + } + if (locale != null) { + result[0] |= 1 << 13; + // Passed separately to native. + } + if (background != null) { + result[0] |= 1 << 14; + // Passed separately to native. + } + if (foreground != null) { + result[0] |= 1 << 15; + // Passed separately to native. + } + if (shadows != null) { + result[0] |= 1 << 16; + // Passed separately to native. + } + return result; +} + +/// An opaque object that determines the size, position, and rendering of text. +class TextStyle { + /// Creates a new TextStyle object. + /// + /// * `color`: The color to use when painting the text. If this is specified, `foreground` must be null. + /// * `decoration`: The decorations to paint near the text (e.g., an underline). + /// * `decorationColor`: The color in which to paint the text decorations. + /// * `decorationStyle`: The style in which to paint the text decorations (e.g., dashed). + /// * `fontWeight`: The typeface thickness to use when painting the text (e.g., bold). + /// * `fontStyle`: The typeface variant to use when drawing the letters (e.g., italics). + /// * `fontFamily`: The name of the font to use when painting the text (e.g., Roboto). If a `fontFamilyFallback` is + /// provided and `fontFamily` is not, then the first font family in `fontFamilyFallback` will take the postion of + /// the preferred font family. When a higher priority font cannot be found or does not contain a glyph, a lower + /// priority font will be used. + /// * `fontFamilyFallback`: An ordered list of the names of the fonts to fallback on when a glyph cannot + /// be found in a higher priority font. When the `fontFamily` is null, the first font family in this list + /// is used as the preferred font. Internally, the 'fontFamily` is concatenated to the front of this list. + /// When no font family is provided through 'fontFamilyFallback' (null or empty) or `fontFamily`, then the + /// platform default font will be used. + /// * `fontSize`: The size of glyphs (in logical pixels) to use when painting the text. + /// * `letterSpacing`: The amount of space (in logical pixels) to add between each letter. + /// * `wordSpacing`: The amount of space (in logical pixels) to add at each sequence of white-space (i.e. between each word). + /// * `textBaseline`: The common baseline that should be aligned between this text span and its parent text span, or, for the root text spans, with the line box. + /// * `height`: The height of this text span, as a multiple of the font size. + /// * `locale`: The locale used to select region-specific glyphs. + /// * `background`: The paint drawn as a background for the text. + /// * `foreground`: The paint used to draw the text. If this is specified, `color` must be null. + TextStyle({ + Color color, + TextDecoration decoration, + Color decorationColor, + TextDecorationStyle decorationStyle, + FontWeight fontWeight, + FontStyle fontStyle, + TextBaseline textBaseline, + String fontFamily, + List fontFamilyFallback, + double fontSize, + double letterSpacing, + double wordSpacing, + double height, + 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".' + ), + _encoded = _encodeTextStyle( + color, + decoration, + decorationColor, + decorationStyle, + fontWeight, + fontStyle, + textBaseline, + fontFamily, + fontFamilyFallback, + fontSize, + letterSpacing, + wordSpacing, + height, + locale, + background, + foreground, + shadows, + ), + _fontFamily = fontFamily ?? '', + _fontFamilyFallback = fontFamilyFallback, + _fontSize = fontSize, + _letterSpacing = letterSpacing, + _wordSpacing = wordSpacing, + _height = height, + _locale = locale, + _background = background, + _foreground = foreground, + _shadows = shadows; + + final Int32List _encoded; + final String _fontFamily; + final List _fontFamilyFallback; + final double _fontSize; + final double _letterSpacing; + final double _wordSpacing; + final double _height; + final Locale _locale; + final Paint _background; + final Paint _foreground; + final List _shadows; + + @override + bool operator ==(dynamic other) { + if (identical(this, other)) + return true; + if (other is! TextStyle) + return false; + final TextStyle typedOther = other; + if (_fontFamily != typedOther._fontFamily || + _fontSize != typedOther._fontSize || + _letterSpacing != typedOther._letterSpacing || + _wordSpacing != typedOther._wordSpacing || + _height != typedOther._height || + _locale != typedOther._locale || + _background != typedOther._background || + _foreground != typedOther._foreground) + return false; + for (int index = 0; index < _encoded.length; index += 1) { + if (_encoded[index] != typedOther._encoded[index]) + return false; + } + if (!_listEquals(_shadows, typedOther._shadows)) + return false; + if (!_listEquals(_fontFamilyFallback, typedOther._fontFamilyFallback)) + return false; + return true; + } + + @override + int get hashCode => hashValues(hashList(_encoded), _fontFamily, _fontFamilyFallback, _fontSize, _letterSpacing, _wordSpacing, _height, _locale, _background, _foreground, _shadows); + + @override + String toString() { + return 'TextStyle(' + '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 != null ? _fontFamily : "unspecified"}, ' + 'fontFamilyFallback: ${_encoded[0] & 0x00100 == 0x00100 + && _fontFamilyFallback != null + && _fontFamilyFallback.isNotEmpty ? _fontFamilyFallback : "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"}' + ')'; + } +} + +// This encoding must match the C++ version ParagraphBuilder::build. +// +// The encoded array buffer has 6 elements. +// +// - Element 0: A bit mask indicating which fields are non-null. +// Bit 0 is unused. Bits 1-n are set if the corresponding index in the +// encoded array is non-null. The remaining bits represent fields that +// are passed separately from the array. +// +// - Element 1: The enum index of the |textAlign|. +// +// - Element 2: The enum index of the |textDirection|. +// +// - Element 3: The index of the |fontWeight|. +// +// - Element 4: The enum index of the |fontStyle|. +// +// - Element 5: The value of |maxLines|. +// +Int32List _encodeParagraphStyle( + TextAlign textAlign, + TextDirection textDirection, + int maxLines, + String fontFamily, + double fontSize, + double height, + FontWeight fontWeight, + FontStyle fontStyle, + StrutStyle strutStyle, + String ellipsis, + Locale locale, +) { + final Int32List result = new Int32List(6); // also update paragraph_builder.cc + if (textAlign != null) { + result[0] |= 1 << 1; + result[1] = textAlign.index; + } + if (textDirection != null) { + result[0] |= 1 << 2; + result[2] = textDirection.index; + } + if (fontWeight != null) { + result[0] |= 1 << 3; + result[3] = fontWeight.index; + } + if (fontStyle != null) { + result[0] |= 1 << 4; + result[4] = fontStyle.index; + } + if (maxLines != null) { + result[0] |= 1 << 5; + result[5] = maxLines; + } + if (fontFamily != null) { + result[0] |= 1 << 6; + // Passed separately to native. + } + if (fontSize != null) { + result[0] |= 1 << 7; + // Passed separately to native. + } + if (height != null) { + result[0] |= 1 << 8; + // Passed separately to native. + } + if (strutStyle != null) { + result[0] |= 1 << 9; + // Passed separately to native. + } + if (ellipsis != null) { + result[0] |= 1 << 10; + // Passed separately to native. + } + if (locale != null) { + result[0] |= 1 << 11; + // Passed separately to native. + } + return result; +} + +/// An opaque object that determines the configuration used by +/// [ParagraphBuilder] to position lines within a [Paragraph] of text. +class ParagraphStyle { + /// Creates a new ParagraphStyle object. + /// + /// * `textAlign`: The alignment of the text within the lines of the + /// paragraph. If the last line is ellipsized (see `ellipsis` below), the + /// alignment is applied to that line after it has been truncated but before + /// the ellipsis has been added. + // See: https://github.com/flutter/flutter/issues/9819 + /// + /// * `textDirection`: The directionality of the text, left-to-right (e.g. + /// Norwegian) or right-to-left (e.g. Hebrew). This controls the overall + /// directionality of the paragraph, as well as the meaning of + /// [TextAlign.start] and [TextAlign.end] in the `textAlign` field. + /// + /// * `maxLines`: The maximum number of lines painted. Lines beyond this + /// number are silently dropped. For example, if `maxLines` is 1, then only + /// one line is rendered. If `maxLines` is null, but `ellipsis` is not null, + /// then lines after the first one that overflows the width constraints are + /// dropped. The width constraints are those set in the + /// [ParagraphConstraints] object passed to the [Paragraph.layout] method. + /// + /// * `fontFamily`: The name of the font to use when painting the text (e.g., + /// Roboto). + /// + /// * `fontSize`: The size of glyphs (in logical pixels) to use when painting + /// the text. + /// + /// * `height`: The minimum height of the line boxes, as a multiple of the + /// font size. The lines of the paragraph will be at least + /// `(height + leading) * fontSize` tall when fontSize + /// is not null. When fontSize is null, there is no minimum line height. Tall + /// glyphs due to baseline alignment or large [TextStyle.fontSize] may cause + /// the actual line height after layout to be taller than specified here. + /// [fontSize] must be provided for this property to take effect. + /// + /// * `fontWeight`: The typeface thickness to use when painting the text + /// (e.g., bold). + /// + /// * `fontStyle`: The typeface variant to use when drawing the letters (e.g., + /// italics). + /// + /// * `strutStyle`: The properties of the strut. Strut defines a set of minimum + /// vertical line height related metrics and can be used to obtain more + /// advanced line spacing behavior. + /// + /// * `ellipsis`: String used to ellipsize overflowing text. If `maxLines` is + /// not null, then the `ellipsis`, if any, is applied to the last rendered + /// line, if that line overflows the width constraints. If `maxLines` is + /// null, then the `ellipsis` is applied to the first line that overflows + /// the width constraints, and subsequent lines are dropped. The width + /// constraints are those set in the [ParagraphConstraints] object passed to + /// the [Paragraph.layout] method. The empty string and the null value are + /// considered equivalent and turn off this behavior. + /// + /// * `locale`: The locale used to select region-specific glyphs. + ParagraphStyle({ + TextAlign textAlign, + TextDirection textDirection, + int maxLines, + String fontFamily, + double fontSize, + double height, + FontWeight fontWeight, + FontStyle fontStyle, + StrutStyle strutStyle, + String ellipsis, + Locale locale, + }) : _encoded = _encodeParagraphStyle( + textAlign, + textDirection, + maxLines, + fontFamily, + fontSize, + height, + fontWeight, + fontStyle, + strutStyle, + ellipsis, + locale, + ), + _fontFamily = fontFamily, + _fontSize = fontSize, + _height = height, + _strutStyle = strutStyle, + _ellipsis = ellipsis, + _locale = locale; + + final Int32List _encoded; + final String _fontFamily; + final double _fontSize; + final double _height; + final StrutStyle _strutStyle; + final String _ellipsis; + final Locale _locale; + + @override + bool operator ==(dynamic other) { + if (identical(this, other)) + return true; + if (other.runtimeType != runtimeType) + return false; + final ParagraphStyle typedOther = other; + if (_fontFamily != typedOther._fontFamily || + _fontSize != typedOther._fontSize || + _height != typedOther._height || + _strutStyle != typedOther._strutStyle || + _ellipsis != typedOther._ellipsis || + _locale != typedOther._locale) + return false; + for (int index = 0; index < _encoded.length; index += 1) { + if (_encoded[index] != typedOther._encoded[index]) + return false; + } + return true; + } + + @override + int get hashCode => hashValues(hashList(_encoded), _fontFamily, _fontSize, _height, _ellipsis, _locale); + + @override + String toString() { + return '$runtimeType(' + 'textAlign: ${ _encoded[0] & 0x002 == 0x002 ? TextAlign.values[_encoded[1]] : "unspecified"}, ' + 'textDirection: ${ _encoded[0] & 0x004 == 0x004 ? TextDirection.values[_encoded[2]] : "unspecified"}, ' + 'fontWeight: ${ _encoded[0] & 0x008 == 0x008 ? FontWeight.values[_encoded[3]] : "unspecified"}, ' + 'fontStyle: ${ _encoded[0] & 0x010 == 0x010 ? FontStyle.values[_encoded[4]] : "unspecified"}, ' + 'maxLines: ${ _encoded[0] & 0x020 == 0x020 ? _encoded[5] : "unspecified"}, ' + 'fontFamily: ${ _encoded[0] & 0x040 == 0x040 ? _fontFamily : "unspecified"}, ' + 'fontSize: ${ _encoded[0] & 0x080 == 0x080 ? _fontSize : "unspecified"}, ' + 'height: ${ _encoded[0] & 0x100 == 0x100 ? "${_height}x" : "unspecified"}, ' + 'ellipsis: ${ _encoded[0] & 0x200 == 0x200 ? "\"$_ellipsis\"" : "unspecified"}, ' + 'locale: ${ _encoded[0] & 0x400 == 0x400 ? _locale : "unspecified"}' + ')'; + } +} + +// Serialize strut properties into ByteData. This encoding errs towards +// compactness. The first 8 bits is a bitmask that records which properties +// are null. The rest of the values are encoded in the same order encountered +// in the bitmask. The final returned value truncates any unused bytes +// at the end. +// +// We serialize this more thoroughly than ParagraphStyle because it is +// much more likely that the strut is empty/null and we wish to add +// minimal overhead for non-strut cases. +ByteData _encodeStrut( + String fontFamily, + List fontFamilyFallback, + double fontSize, + double height, + double leading, + FontWeight fontWeight, + FontStyle fontStyle, + bool forceStrutHeight) { + if (fontFamily == null && + fontSize == null && + height == null && + leading == null && + fontWeight == null && + fontStyle == null && + forceStrutHeight == null) + return ByteData(0); + + final ByteData data = ByteData(15); // Max size is 15 bytes + int bitmask = 0; // 8 bit mask + int byteCount = 1; + if (fontWeight != null) { + bitmask |= 1 << 0; + data.setInt8(byteCount, fontWeight.index); + byteCount += 1; + } + if (fontStyle != null) { + bitmask |= 1 << 1; + data.setInt8(byteCount, fontStyle.index); + byteCount += 1; + } + if (fontFamily != null || (fontFamilyFallback != null && fontFamilyFallback.isNotEmpty)){ + bitmask |= 1 << 2; + // passed separately to native + } + if (fontSize != null) { + bitmask |= 1 << 3; + data.setFloat32(byteCount, fontSize, _kFakeHostEndian); + byteCount += 4; + } + if (height != null) { + bitmask |= 1 << 4; + data.setFloat32(byteCount, height, _kFakeHostEndian); + byteCount += 4; + } + if (leading != null) { + bitmask |= 1 << 5; + data.setFloat32(byteCount, leading, _kFakeHostEndian); + byteCount += 4; + } + if (forceStrutHeight != null) { + bitmask |= 1 << 6; + // We store this boolean directly in the bitmask since there is + // extra space in the 16 bit int. + bitmask |= (forceStrutHeight ? 1 : 0) << 7; + } + + data.setInt8(0, bitmask); + + return ByteData.view(data.buffer, 0, byteCount); +} + +class StrutStyle { + /// Creates a new StrutStyle object. + /// + /// * `fontFamily`: The name of the font to use when painting the text (e.g., + /// Roboto). + /// + /// * `fontFamilyFallback`: An ordered list of font family names that will be searched for when + /// the font in `fontFamily` cannot be found. + /// + /// * `fontSize`: The size of glyphs (in logical pixels) to use when painting + /// the text. + /// + /// * `lineHeight`: The minimum height of the line boxes, as a multiple of the + /// font size. The lines of the paragraph will be at least + /// `(lineHeight + leading) * fontSize` tall when fontSize + /// is not null. When fontSize is null, there is no minimum line height. Tall + /// glyphs due to baseline alignment or large [TextStyle.fontSize] may cause + /// the actual line height after layout to be taller than specified here. + /// [fontSize] must be provided for this property to take effect. + /// + /// * `leading`: The minimum amount of leading between lines as a multiple of + /// the font size. [fontSize] must be provided for this property to take effect. + /// + /// * `fontWeight`: The typeface thickness to use when painting the text + /// (e.g., bold). + /// + /// * `fontStyle`: The typeface variant to use when drawing the letters (e.g., + /// italics). + /// + /// * `forceStrutHeight`: When true, the paragraph will force all lines to be exactly + /// `(lineHeight + leading) * fontSize` tall from baseline to baseline. + /// [TextStyle] is no longer able to influence the line height, and any tall + /// glyphs may overlap with lines above. If a [fontFamily] is specified, the + /// total ascent of the first line will be the min of the `Ascent + half-leading` + /// of the [fontFamily] and `(lineHeight + leading) * fontSize`. Otherwise, it + /// will be determined by the Ascent + half-leading of the first text. + StrutStyle({ + String fontFamily, + List fontFamilyFallback, + double fontSize, + double height, + double leading, + FontWeight fontWeight, + FontStyle fontStyle, + bool forceStrutHeight, + }) : _encoded = _encodeStrut( + fontFamily, + fontFamilyFallback, + fontSize, + height, + leading, + fontWeight, + fontStyle, + forceStrutHeight, + ), + _fontFamily = fontFamily, + _fontFamilyFallback = fontFamilyFallback; + + final ByteData _encoded; // Most of the data for strut is encoded. + final String _fontFamily; + final List _fontFamilyFallback; + + + @override + bool operator ==(dynamic other) { + if (identical(this, other)) + return true; + if (other.runtimeType != runtimeType) + return false; + final StrutStyle typedOther = other; + if (_fontFamily != typedOther._fontFamily) + return false; + final Int8List encodedList = _encoded.buffer.asInt8List(); + final Int8List otherEncodedList = typedOther._encoded.buffer.asInt8List(); + for (int index = 0; index < _encoded.lengthInBytes; index += 1) { + if (encodedList[index] != otherEncodedList[index]) + return false; + } + if (!_listEquals(_fontFamilyFallback, typedOther._fontFamilyFallback)) + return false; + return true; + } + + @override + int get hashCode => hashValues(hashList(_encoded.buffer.asInt8List()), _fontFamily); + +} + +/// A direction in which text flows. +/// +/// Some languages are written from the left to the right (for example, English, +/// Tamil, or Chinese), while others are written from the right to the left (for +/// example Aramaic, Hebrew, or Urdu). Some are also written in a mixture, for +/// example Arabic is mostly written right-to-left, with numerals written +/// left-to-right. +/// +/// The text direction must be provided to APIs that render text or lay out +/// boxes horizontally, so that they can determine which direction to start in: +/// either right-to-left, [TextDirection.rtl]; or left-to-right, +/// [TextDirection.ltr]. +/// +/// ## Design discussion +/// +/// Flutter is designed to address the needs of applications written in any of +/// the world's currently-used languages, whether they use a right-to-left or +/// left-to-right writing direction. Flutter does not support other writing +/// modes, such as vertical text or boustrophedon text, as these are rarely used +/// in computer programs. +/// +/// It is common when developing user interface frameworks to pick a default +/// text direction — typically left-to-right, the direction most familiar to the +/// engineers working on the framework — because this simplifies the development +/// of applications on the platform. Unfortunately, this frequently results in +/// the platform having unexpected left-to-right biases or assumptions, as +/// engineers will typically miss places where they need to support +/// right-to-left text. This then results in bugs that only manifest in +/// right-to-left environments. +/// +/// In an effort to minimize the extent to which Flutter experiences this +/// category of issues, the lowest levels of the Flutter framework do not have a +/// default text reading direction. Any time a reading direction is necessary, +/// for example when text is to be displayed, or when a +/// writing-direction-dependent value is to be interpreted, the reading +/// direction must be explicitly specified. Where possible, such as in `switch` +/// statements, the right-to-left case is listed first, to avoid the impression +/// that it is an afterthought. +/// +/// At the higher levels (specifically starting at the widgets library), an +/// ambient [Directionality] is introduced, which provides a default. Thus, for +/// instance, a [Text] widget in the scope of a [MaterialApp] widget does not +/// need to be given an explicit writing direction. The [Directionality.of] +/// static method can be used to obtain the ambient text direction for a +/// particular [BuildContext]. +/// +/// ### Known left-to-right biases in Flutter +/// +/// Despite the design intent described above, certain left-to-right biases have +/// nonetheless crept into Flutter's design. These include: +/// +/// * The [Canvas] origin is at the top left, and the x-axis increases in a +/// left-to-right direction. +/// +/// * The default localization in the widgets and material libraries is +/// American English, which is left-to-right. +/// +/// ### Visual properties vs directional properties +/// +/// Many classes in the Flutter framework are offered in two versions, a +/// visually-oriented variant, and a text-direction-dependent variant. For +/// example, [EdgeInsets] is described in terms of top, left, right, and bottom, +/// while [EdgeInsetsDirectional] is described in terms of top, start, end, and +/// bottom, where start and end correspond to right and left in right-to-left +/// text and left and right in left-to-right text. +/// +/// There are distinct use cases for each of these variants. +/// +/// Text-direction-dependent variants are useful when developing user interfaces +/// that should "flip" with the text direction. For example, a paragraph of text +/// in English will typically be left-aligned and a quote will be indented from +/// the left, while in Arabic it will be right-aligned and indented from the +/// right. Both of these cases are described by the direction-dependent +/// [TextAlign.start] and [EdgeInsetsDirectional.start]. +/// +/// In contrast, the visual variants are useful when the text direction is known +/// and not affected by the reading direction. For example, an application +/// giving driving directions might show a "turn left" arrow on the left and a +/// "turn right" arrow on the right — and would do so whether the application +/// was localized to French (left-to-right) or Hebrew (right-to-left). +/// +/// In practice, it is also expected that many developers will only be +/// targeting one language, and in that case it may be simpler to think in +/// visual terms. +// The order of this enum must match the order of the values in TextDirection.h's TextDirection. +enum TextDirection { + /// The text flows from right to left (e.g. Arabic, Hebrew). + rtl, + + /// The text flows from left to right (e.g., English, French). + ltr, +} + +/// A rectangle enclosing a run of text. +/// +/// This is similar to [Rect] but includes an inherent [TextDirection]. +class TextBox { + /// Creates an object that describes a box containing text. + const TextBox.fromLTRBD( + this.left, + this.top, + this.right, + this.bottom, + this.direction, + ); + + TextBox._( + this.left, + this.top, + this.right, + this.bottom, + int directionIndex, + ) : direction = TextDirection.values[directionIndex]; + + /// The left edge of the text box, irrespective of direction. + /// + /// To get the leading edge (which may depend on the [direction]), consider [start]. + final double left; + + /// The top edge of the text box. + final double top; + + /// The right edge of the text box, irrespective of direction. + /// + /// To get the trailing edge (which may depend on the [direction]), consider [end]. + final double right; + + /// The bottom edge of the text box. + final double bottom; + + /// The direction in which text inside this box flows. + final TextDirection direction; + + /// Returns a rect of the same size as this box. + Rect toRect() => new Rect.fromLTRB(left, top, right, bottom); + + /// The [left] edge of the box for left-to-right text; the [right] edge of the box for right-to-left text. + /// + /// See also: + /// + /// * [direction], which specifies the text direction. + double get start { + return (direction == TextDirection.ltr) ? left : right; + } + + /// The [right] edge of the box for left-to-right text; the [left] edge of the box for right-to-left text. + /// + /// See also: + /// + /// * [direction], which specifies the text direction. + double get end { + return (direction == TextDirection.ltr) ? right : left; + } + + @override + bool operator ==(dynamic other) { + if (identical(this, other)) + return true; + if (other.runtimeType != runtimeType) + return false; + final TextBox typedOther = other; + return typedOther.left == left + && typedOther.top == top + && typedOther.right == right + && typedOther.bottom == bottom + && typedOther.direction == direction; + } + + @override + int get hashCode => hashValues(left, top, right, bottom, direction); + + @override + String toString() => 'TextBox.fromLTRBD(${left.toStringAsFixed(1)}, ${top.toStringAsFixed(1)}, ${right.toStringAsFixed(1)}, ${bottom.toStringAsFixed(1)}, $direction)'; +} + +/// A way to disambiguate a [TextPosition] when its offset could match two +/// different locations in the rendered string. +/// +/// For example, at an offset where the rendered text wraps, there are two +/// visual positions that the offset could represent: one prior to the line +/// break (at the end of the first line) and one after the line break (at the +/// start of the second line). A text affinity disambiguates between these two +/// cases. +/// +/// This affects only line breaks caused by wrapping, not explicit newline +/// characters. For newline characters, the position is fully specified by the +/// offset alone, and there is no ambiguity. +/// +/// [TextAffinity] also affects bidirectional text at the interface between LTR +/// and RTL text. Consider the following string, where the lowercase letters +/// will be displayed as LTR and the uppercase letters RTL: "helloHELLO". When +/// rendered, the string would appear visually as "helloOLLEH". An offset of 5 +/// would be ambiguous without a corresponding [TextAffinity]. Looking at the +/// string in code, the offset represents the position just after the "o" and +/// just before the "H". When rendered, this offset could be either in the +/// middle of the string to the right of the "o" or at the end of the string to +/// the right of the "H". +enum TextAffinity { + /// The position has affinity for the upstream side of the text position, i.e. + /// in the direction of the beginning of the string. + /// + /// In the example of an offset at the place where text is wrapping, upstream + /// indicates the end of the first line. + /// + /// In the bidirectional text example "helloHELLO", an offset of 5 with + /// [TextAffinity] upstream would appear in the middle of the rendered text, + /// just to the right of the "o". See the definition of [TextAffinity] for the + /// full example. + upstream, + + /// The position has affinity for the downstream side of the text position, + /// i.e. in the direction of the end of the string. + /// + /// In the example of an offset at the place where text is wrapping, + /// downstream indicates the beginning of the second line. + /// + /// In the bidirectional text example "helloHELLO", an offset of 5 with + /// [TextAffinity] downstream would appear at the end of the rendered text, + /// just to the right of the "H". See the definition of [TextAffinity] for the + /// full example. + downstream, +} + +/// A position in a string of text. +/// +/// A TextPosition can be used to locate a position in a string in code (using +/// the [offset] property), and it can also be used to locate the same position +/// visually in a rendered string of text (using [offset] and, when needed to +/// resolve ambiguity, [affinity]). +/// +/// The location of an offset in a rendered string is ambiguous in two cases. +/// One happens when rendered text is forced to wrap. In this case, the offset +/// where the wrap occurs could visually appear either at the end of the first +/// line or the beginning of the second line. The second way is with +/// bidirectional text. An offset at the interface between two different text +/// directions could have one of two locations in the rendered text. +/// +/// See the documentation for [TextAffinity] for more information on how +/// TextAffinity disambiguates situations like these. +class TextPosition { + /// Creates an object representing a particular position in a string. + /// + /// The arguments must not be null (so the [offset] argument is required). + const TextPosition({ + this.offset, + this.affinity: TextAffinity.downstream, + }) : assert(offset != null), + assert(affinity != null); + + /// The index of the character that immediately follows the position in the + /// string representation of the text. + /// + /// For example, given the string `'Hello'`, offset 0 represents the cursor + /// being before the `H`, while offset 5 represents the cursor being just + /// after the `o`. + final int offset; + + /// Disambiguates cases where the position in the string given by [offset] + /// could represent two different visual positions in the rendered text. For + /// example, this can happen when text is forced to wrap, or when one string + /// of text is rendered with multiple text directions. + /// + /// See the documentation for [TextAffinity] for more information on how + /// TextAffinity disambiguates situations like these. + final TextAffinity affinity; + + @override + bool operator ==(dynamic other) { + if (other.runtimeType != runtimeType) + return false; + final TextPosition typedOther = other; + return typedOther.offset == offset + && typedOther.affinity == affinity; + } + + @override + int get hashCode => hashValues(offset, affinity); + + @override + String toString() { + return '$runtimeType(offset: $offset, affinity: $affinity)'; + } +} + +/// Layout constraints for [Paragraph] objects. +/// +/// Instances of this class are typically used with [Paragraph.layout]. +/// +/// The only constraint that can be specified is the [width]. See the discussion +/// at [width] for more details. +class ParagraphConstraints { + /// Creates constraints for laying out a pargraph. + /// + /// The [width] argument must not be null. + const ParagraphConstraints({ + this.width, + }) : assert(width != null); + + /// The width the paragraph should use whey computing the positions of glyphs. + /// + /// If possible, the paragraph will select a soft line break prior to reaching + /// this width. If no soft line break is available, the paragraph will select + /// a hard line break prior to reaching this width. If that would force a line + /// break without any characters having been placed (i.e. if the next + /// character to be laid out does not fit within the given width constraint) + /// then the next character is allowed to overflow the width constraint and a + /// forced line break is placed after it (even if an explicit line break + /// follows). + /// + /// The width influences how ellipses are applied. See the discussion at [new + /// ParagraphStyle] for more details. + /// + /// This width is also used to position glyphs according to the [TextAlign] + /// alignment described in the [ParagraphStyle] used when building the + /// [Paragraph] with a [ParagraphBuilder]. + final double width; + + @override + bool operator ==(dynamic other) { + if (other.runtimeType != runtimeType) + return false; + final ParagraphConstraints typedOther = other; + return typedOther.width == width; + } + + @override + int get hashCode => width.hashCode; + + @override + 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 +/// be efficiently resized and painted. +/// +/// To create a [Paragraph] object, use a [ParagraphBuilder]. +/// +/// Paragraphs can be displayed on a [Canvas] using the [Canvas.drawParagraph] +/// method. +class Paragraph { + /// This class is created by the engine, and should not be instantiated + /// or extended directly. + /// + /// To create a [Paragraph] object, use a [ParagraphBuilder]. + Paragraph._(); + + /// The amount of horizontal space this paragraph occupies. + /// + /// Valid only after [layout] has been called. + double get width { + throw UnimplementedError(); + } + + /// The amount of vertical space this paragraph occupies. + /// + /// Valid only after [layout] has been called. + double get height { + throw UnimplementedError(); + } + + /// The minimum width that this paragraph could be without failing to paint + /// its contents within itself. + /// + /// Valid only after [layout] has been called. + double get minIntrinsicWidth { + throw UnimplementedError(); + } + + /// Returns the smallest width beyond which increasing the width never + /// decreases the height. + /// + /// Valid only after [layout] has been called. + double get maxIntrinsicWidth { + throw UnimplementedError(); + } + + /// The distance from the top of the paragraph to the alphabetic + /// baseline of the first line, in logical pixels. + double get alphabeticBaseline { + throw UnimplementedError(); + } + + /// The distance from the top of the paragraph to the ideographic + /// baseline of the first line, in logical pixels. + double get ideographicBaseline { + throw UnimplementedError(); + } + + /// True if there is more vertical content, but the text was truncated, either + /// because we reached `maxLines` lines of text or because the `maxLines` was + /// null, `ellipsis` was not null, and one of the lines exceeded the width + /// constraint. + /// + /// See the discussion of the `maxLines` and `ellipsis` arguments at [new + /// ParagraphStyle]. + bool get didExceedMaxLines { + throw UnimplementedError(); + } + + /// Computes the size and position of each glyph in the paragraph. + /// + /// The [ParagraphConstraints] control how wide the text is allowed to be. + void layout(ParagraphConstraints constraints) { + throw UnimplementedError(); + } + + /// Returns a list of text boxes that enclose the given text range. + /// + /// 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}) { + throw UnimplementedError(); + } + + /// Returns the text position closest to the given offset. + TextPosition getPositionForOffset(Offset offset) { + throw UnimplementedError(); + } + + /// Returns the [start, end] of the word at the given offset. Characters not + /// part of a word, such as spaces, symbols, and punctuation, have word breaks + /// on both sides. In such cases, this method will return [offset, offset+1]. + /// Word boundaries are defined more precisely in Unicode Standard Annex #29 + /// http://www.unicode.org/reports/tr29/#Word_Boundaries + List getWordBoundary(int offset) { + throw UnimplementedError(); + } +} + +/// Builds a [Paragraph] containing text with the given styling information. +/// +/// To set the paragraph's alignment, truncation, and ellipsising behavior, pass +/// an appropriately-configured [ParagraphStyle] object to the [new +/// ParagraphBuilder] constructor. +/// +/// Then, call combinations of [pushStyle], [addText], and [pop] to add styled +/// text to the object. +/// +/// Finally, call [build] to obtain the constructed [Paragraph] object. After +/// this point, the builder is no longer usable. +/// +/// After constructing a [Paragraph], call [Paragraph.layout] on it and then +/// paint it with [Canvas.drawParagraph]. +class ParagraphBuilder { + + /// Creates a [ParagraphBuilder] object, which is used to create a + /// [Paragraph]. + ParagraphBuilder(ParagraphStyle style); + + /// Applies the given style to the added text until [pop] is called. + /// + /// See [pop] for details. + void pushStyle(TextStyle style) { + throw UnimplementedError(); + } + + /// Ends the effect of the most recent call to [pushStyle]. + /// + /// Internally, the paragraph builder maintains a stack of text styles. Text + /// added to the paragraph is affected by all the styles in the stack. Calling + /// [pop] removes the topmost style in the stack, leaving the remaining styles + /// in effect. + void pop() { + throw UnimplementedError(); + } + + /// Adds the given text to the paragraph. + /// + /// The text will be styled according to the current stack of text styles. + void addText(String text) { + throw UnimplementedError(); + } + + /// Applies the given paragraph style and returns a [Paragraph] containing the + /// added text and associated styling. + /// + /// After calling this function, the paragraph builder object is invalid and + /// cannot be used further. + Paragraph build() { + throw UnimplementedError(); + } +} + +/// 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}) { + throw UnimplementedError(); +} diff --git a/lib/stub_ui/ui.dart b/lib/stub_ui/ui.dart new file mode 100644 index 0000000000000..f87f1ec6f2d58 --- /dev/null +++ b/lib/stub_ui/ui.dart @@ -0,0 +1,37 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/// Built-in types and core primitives for a Flutter application. +/// +/// To use, import `dart:ui`. +/// +/// This library exposes the lowest-level services that Flutter frameworks use +/// to bootstrap applications, such as classes for driving the input, graphics +/// text, layout, and rendering subsystems. +library dart.ui; + +import 'dart:_internal' hide Symbol; // ignore: import_internal_library, unused_import +import 'dart:async'; +import 'dart:collection' as collection; +import 'dart:convert'; +import 'dart:developer' as developer; +import 'dart:io'; // ignore: unused_import +import 'dart:isolate' show SendPort; +import 'dart:math' as math; +import 'dart:typed_data'; + +part 'compositing.dart'; +part 'geometry.dart'; +part 'hash_codes.dart'; +part 'hooks.dart'; +part 'isolate_name_server.dart'; +part 'lerp.dart'; +part 'natives.dart'; +part 'painting.dart'; +part 'plugins.dart'; +part 'pointer.dart'; +part 'semantics.dart'; +part 'text.dart'; +part 'versions.dart'; +part 'window.dart'; diff --git a/lib/stub_ui/versions.dart b/lib/stub_ui/versions.dart new file mode 100644 index 0000000000000..3f555262b8f9a --- /dev/null +++ b/lib/stub_ui/versions.dart @@ -0,0 +1,25 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of dart.ui; + +/// Wraps version information for Dart, Skia and Flutter. +class Versions { + /// Private constructor to capture the versions. + Versions._( + this.dartVersion, + this.skiaVersion, + this.flutterEngineVersion + ) : assert(dartVersion != null), + assert(skiaVersion != null), + assert(flutterEngineVersion != null); + + final String dartVersion; + final String skiaVersion; + final String flutterEngineVersion; +} + +/// [Versions] singleton. This object exposes Dart, Skia and +/// Flutter engine versions. +final Versions versions = Versions._('', '', ''); diff --git a/lib/stub_ui/window.dart b/lib/stub_ui/window.dart new file mode 100644 index 0000000000000..4fd096aa5e7af --- /dev/null +++ b/lib/stub_ui/window.dart @@ -0,0 +1,915 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +part of dart.ui; + +/// Signature of callbacks that have no arguments and return no data. +typedef VoidCallback = void Function(); + +/// Signature for [Window.onBeginFrame]. +typedef FrameCallback = void Function(Duration duration); + +/// Signature for [Window.onPointerDataPacket]. +typedef PointerDataPacketCallback = void Function(PointerDataPacket packet); + +/// Signature for [Window.onSemanticsAction]. +typedef SemanticsActionCallback = void Function(int id, SemanticsAction action, ByteData args); + +/// Signature for responses to platform messages. +/// +/// Used as a parameter to [Window.sendPlatformMessage] and +/// [Window.onPlatformMessage]. +typedef PlatformMessageResponseCallback = void Function(ByteData data); + +/// Signature for [Window.onPlatformMessage]. +typedef PlatformMessageCallback = void Function(String name, ByteData data, PlatformMessageResponseCallback callback); + +/// States that an application can be in. +/// +/// The values below describe notifications from the operating system. +/// Applications should not expect to always receive all possible +/// notifications. For example, if the users pulls out the battery from the +/// device, no notification will be sent before the application is suddenly +/// terminated, along with the rest of the operating system. +/// +/// See also: +/// +/// * [WidgetsBindingObserver], for a mechanism to observe the lifecycle state +/// from the widgets layer. +enum AppLifecycleState { + /// The application is visible and responding to user input. + resumed, + + /// The application is in an inactive state and is not receiving user input. + /// + /// On iOS, this state corresponds to an app or the Flutter host view running + /// in the foreground inactive state. Apps transition to this state when in + /// a phone call, responding to a TouchID request, when entering the app + /// switcher or the control center, or when the UIViewController hosting the + /// Flutter app is transitioning. + /// + /// On Android, this corresponds to an app or the Flutter host view running + /// in the foreground inactive state. Apps transition to this state when + /// another activity is focused, such as a split-screen app, a phone call, + /// a picture-in-picture app, a system dialog, or another window. + /// + /// Apps in this state should assume that they may be [paused] at any time. + inactive, + + /// The application is not currently visible to the user, not responding to + /// user input, and running in the background. + /// + /// When the application is in this state, the engine will not call the + /// [Window.onBeginFrame] and [Window.onDrawFrame] callbacks. + /// + /// Android apps in this state should assume that they may enter the + /// [suspending] state at any time. + paused, + + /// The application will be suspended momentarily. + /// + /// When the application is in this state, the engine will not call the + /// [Window.onBeginFrame] and [Window.onDrawFrame] callbacks. + /// + /// On iOS, this state is currently unused. + suspending, +} + +/// A representation of distances for each of the four edges of a rectangle, +/// used to encode the view insets and padding that applications should place +/// around their user interface, as exposed by [Window.viewInsets] and +/// [Window.padding]. View insets and padding are preferably read via +/// [MediaQuery.of]. +/// +/// For a generic class that represents distances around a rectangle, see the +/// [EdgeInsets] class. +/// +/// See also: +/// +/// * [WidgetsBindingObserver], for a widgets layer mechanism to receive +/// notifications when the padding changes. +/// * [MediaQuery.of], for the preferred mechanism for accessing these values. +/// * [Scaffold], which automatically applies the padding in material design +/// applications. +class WindowPadding { + const WindowPadding._({ this.left, this.top, this.right, this.bottom }); + + /// The distance from the left edge to the first unpadded pixel, in physical pixels. + final double left; + + /// The distance from the top edge to the first unpadded pixel, in physical pixels. + final double top; + + /// The distance from the right edge to the first unpadded pixel, in physical pixels. + final double right; + + /// The distance from the bottom edge to the first unpadded pixel, in physical pixels. + final double bottom; + + /// A window padding that has zeros for each edge. + static const WindowPadding zero = const WindowPadding._(left: 0.0, top: 0.0, right: 0.0, bottom: 0.0); + + @override + String toString() { + return '$runtimeType(left: $left, top: $top, right: $right, bottom: $bottom)'; + } +} + +/// 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 +/// Registry](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry). +/// For example, `const 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`. +/// +/// See also: +/// +/// * [Window.locale], which specifies the system's currently selected +/// [Locale]. +class Locale { + /// Creates a new Locale object. The first argument is the + /// primary language subtag, the second is the region (also + /// referred to as 'country') subtag. + /// + /// For example: + /// + /// ```dart + /// const Locale swissFrench = const Locale('fr', 'CH'); + /// const Locale canadianFrench = const Locale('fr', 'CA'); + /// ``` + /// + /// The primary language subtag must not be null. The region subtag is + /// 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: + /// + /// * [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. 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) + /// with the type "language". The string specified must match the case of the + /// string in the registry. + /// + /// Language subtags that are deprecated in the registry and have a preferred + /// code are changed to their preferred code. For example, `const + /// 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`. + /// + /// 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 _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) { + case 'in': return 'id'; // Indonesian; deprecated 1989-01-01 + case 'iw': return 'he'; // Hebrew; deprecated 1989-01-01 + case 'ji': return 'yi'; // Yiddish; deprecated 1989-01-01 + case 'jw': return 'jv'; // Javanese; deprecated 2001-08-13 + case 'mo': return 'ro'; // Moldavian, Moldovan; deprecated 2008-11-22 + case 'aam': return 'aas'; // Aramanik; deprecated 2015-02-12 + case 'adp': return 'dz'; // Adap; deprecated 2015-02-12 + case 'aue': return 'ktz'; // =/Kx'au//'ein; deprecated 2015-02-12 + case 'ayx': return 'nun'; // Ayi (China); deprecated 2011-08-16 + case 'bgm': return 'bcg'; // Baga Mboteni; deprecated 2016-05-30 + case 'bjd': return 'drl'; // Bandjigali; deprecated 2012-08-12 + case 'ccq': return 'rki'; // Chaungtha; deprecated 2012-08-12 + case 'cjr': return 'mom'; // Chorotega; deprecated 2010-03-11 + case 'cka': return 'cmr'; // Khumi Awa Chin; deprecated 2012-08-12 + case 'cmk': return 'xch'; // Chimakum; deprecated 2010-03-11 + case 'coy': return 'pij'; // Coyaima; deprecated 2016-05-30 + case 'cqu': return 'quh'; // Chilean Quechua; deprecated 2016-05-30 + case 'drh': return 'khk'; // Darkhat; deprecated 2010-03-11 + case 'drw': return 'prs'; // Darwazi; deprecated 2010-03-11 + case 'gav': return 'dev'; // Gabutamon; deprecated 2010-03-11 + case 'gfx': return 'vaj'; // Mangetti Dune !Xung; deprecated 2015-02-12 + case 'ggn': return 'gvr'; // Eastern Gurung; deprecated 2016-05-30 + case 'gti': return 'nyc'; // Gbati-ri; deprecated 2015-02-12 + case 'guv': return 'duz'; // Gey; deprecated 2016-05-30 + case 'hrr': return 'jal'; // Horuru; deprecated 2012-08-12 + case 'ibi': return 'opa'; // Ibilo; deprecated 2012-08-12 + case 'ilw': return 'gal'; // Talur; deprecated 2013-09-10 + case 'jeg': return 'oyb'; // Jeng; deprecated 2017-02-23 + case 'kgc': return 'tdf'; // Kasseng; deprecated 2016-05-30 + case 'kgh': return 'kml'; // Upper Tanudan Kalinga; deprecated 2012-08-12 + case 'koj': return 'kwv'; // Sara Dunjo; deprecated 2015-02-12 + case 'krm': return 'bmf'; // Krim; deprecated 2017-02-23 + case 'ktr': return 'dtp'; // Kota Marudu Tinagas; deprecated 2016-05-30 + case 'kvs': return 'gdj'; // Kunggara; deprecated 2016-05-30 + case 'kwq': return 'yam'; // Kwak; deprecated 2015-02-12 + case 'kxe': return 'tvd'; // Kakihum; deprecated 2015-02-12 + case 'kzj': return 'dtp'; // Coastal Kadazan; deprecated 2016-05-30 + case 'kzt': return 'dtp'; // Tambunan Dusun; deprecated 2016-05-30 + case 'lii': return 'raq'; // Lingkhim; deprecated 2015-02-12 + case 'lmm': return 'rmx'; // Lamam; deprecated 2014-02-28 + case 'meg': return 'cir'; // Mea; deprecated 2013-09-10 + case 'mst': return 'mry'; // Cataelano Mandaya; deprecated 2010-03-11 + case 'mwj': return 'vaj'; // Maligo; deprecated 2015-02-12 + case 'myt': return 'mry'; // Sangab Mandaya; deprecated 2010-03-11 + case 'nad': return 'xny'; // Nijadali; deprecated 2016-05-30 + case 'ncp': return 'kdz'; // Ndaktup; deprecated 2018-03-08 + case 'nnx': return 'ngv'; // Ngong; deprecated 2015-02-12 + case 'nts': return 'pij'; // Natagaimas; deprecated 2016-05-30 + case 'oun': return 'vaj'; // !O!ung; deprecated 2015-02-12 + case 'pcr': return 'adx'; // Panang; deprecated 2013-09-10 + case 'pmc': return 'huw'; // Palumata; deprecated 2016-05-30 + case 'pmu': return 'phr'; // Mirpur Panjabi; deprecated 2015-02-12 + case 'ppa': return 'bfy'; // Pao; deprecated 2016-05-30 + case 'ppr': return 'lcq'; // Piru; deprecated 2013-09-10 + case 'pry': return 'prt'; // Pray 3; deprecated 2016-05-30 + case 'puz': return 'pub'; // Purum Naga; deprecated 2014-02-28 + case 'sca': return 'hle'; // Sansu; deprecated 2012-08-12 + case 'skk': return 'oyb'; // Sok; deprecated 2017-02-23 + case 'tdu': return 'dtp'; // Tempasuk Dusun; deprecated 2016-05-30 + case 'thc': return 'tpo'; // Tai Hang Tong; deprecated 2016-05-30 + case 'thx': return 'oyb'; // The; deprecated 2015-02-12 + case 'tie': return 'ras'; // Tingal; deprecated 2011-08-16 + case 'tkk': return 'twm'; // Takpa; deprecated 2011-08-16 + case 'tlw': return 'weo'; // South Wemale; deprecated 2012-08-12 + case 'tmp': return 'tyj'; // Tai Mène; deprecated 2016-05-30 + case 'tne': return 'kak'; // Tinoc Kallahan; deprecated 2016-05-30 + case 'tnf': return 'prs'; // Tangshewi; deprecated 2010-03-11 + case 'tsf': return 'taj'; // Southwestern Tamang; deprecated 2015-02-12 + case 'uok': return 'ema'; // Uokha; deprecated 2015-02-12 + case 'xba': return 'cax'; // Kamba (Brazil); deprecated 2016-05-30 + case 'xia': return 'acn'; // Xiandao; deprecated 2013-09-10 + case 'xkh': return 'waw'; // Karahawyana; deprecated 2016-05-30 + case 'xsj': return 'suj'; // Subi; deprecated 2015-02-12 + case 'ybd': return 'rki'; // Yangbye; deprecated 2012-08-12 + case 'yma': return 'lrr'; // Yamphe; deprecated 2012-08-12 + case 'ymt': return 'mtm'; // Mator-Taygi-Karagas; deprecated 2015-02-12 + case 'yos': return 'zom'; // Yos; deprecated 2013-09-10 + case 'yuu': return 'yug'; // Yugh; deprecated 2014-02-28 + default: return languageCode; + } + } + + /// 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 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) + /// with the type "region". The string specified must match the case of the + /// string in the registry. + /// + /// Region subtags that are deprecated in the registry and have a preferred + /// code are changed to their preferred code. For example, `const Locale('de', + /// '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`. + /// + /// See also: + /// + /// * [new Locale.fromSubtags], which describes the conventions for creating + /// [Locale] objects. + String get countryCode => _replaceDeprecatedRegionSubtag(_countryCode); + final String _countryCode; + + 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) { + case 'BU': return 'MM'; // Burma; deprecated 1989-12-05 + case 'DD': return 'DE'; // German Democratic Republic; deprecated 1990-10-30 + case 'FX': return 'FR'; // Metropolitan France; deprecated 1997-07-14 + case 'TP': return 'TL'; // East Timor; deprecated 2002-05-20 + case 'YD': return 'YE'; // Democratic Yemen; deprecated 1990-08-14 + case 'ZR': return 'CD'; // Zaire; deprecated 1997-07-14 + default: return regionCode; + } + } + + @override + bool operator ==(dynamic other) { + if (identical(this, other)) + return true; + if (other is! Locale) + return false; + final Locale typedOther = other; + return languageCode == typedOther.languageCode + && scriptCode == typedOther.scriptCode + && countryCode == typedOther.countryCode; + } + + @override + int get hashCode => hashValues(languageCode, scriptCode, countryCode); + + @override + String toString() { + final StringBuffer out = StringBuffer(languageCode); + if (scriptCode != null) + out.write('_$scriptCode'); + if (_countryCode != null) + out.write('_$countryCode'); + return out.toString(); + } +} + +/// The most basic interface to the host operating system's user interface. +/// +/// There is a single Window instance in the system, which you can +/// obtain from the [window] property. +class Window { + Window._(); + + /// The number of device pixels for each logical pixel. This number might not + /// be a power of two. Indeed, it might not even be an integer. For example, + /// the Nexus 6 has a device pixel ratio of 3.5. + /// + /// Device pixels are also referred to as physical pixels. Logical pixels are + /// also referred to as device-independent or resolution-independent pixels. + /// + /// By definition, there are roughly 38 logical pixels per centimeter, or + /// about 96 logical pixels per inch, of the physical display. The value + /// returned by [devicePixelRatio] is ultimately obtained either from the + /// hardware itself, the device drivers, or a hard-coded value stored in the + /// operating system or firmware, and may be inaccurate, sometimes by a + /// significant margin. + /// + /// The Flutter framework operates in logical pixels, so it is rarely + /// necessary to directly deal with this property. + /// + /// When this changes, [onMetricsChanged] is called. + /// + /// See also: + /// + /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to + /// observe when this value changes. + double get devicePixelRatio => _devicePixelRatio; + double _devicePixelRatio = 1.0; + + /// The dimensions of the rectangle into which the application will be drawn, + /// in physical pixels. + /// + /// When this changes, [onMetricsChanged] is called. + /// + /// At startup, the size of the application window may not be known before Dart + /// code runs. If this value is observed early in the application lifecycle, + /// it may report [Size.zero]. + /// + /// This value does not take into account any on-screen keyboards or other + /// system UI. The [padding] and [viewInsets] properties provide a view into + /// how much of each side of the application may be obscured by system UI. + /// + /// See also: + /// + /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to + /// observe when this value changes. + Size get physicalSize => _physicalSize; + Size _physicalSize = Size.zero; + + /// The number of physical pixels on each side of the display rectangle into + /// which the application can render, but over which the operating system + /// will likely place system UI, such as the keyboard, that fully obscures + /// any content. + /// + /// When this changes, [onMetricsChanged] is called. + /// + /// See also: + /// + /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to + /// observe when this value changes. + /// * [MediaQuery.of], a simpler mechanism for the same. + /// * [Scaffold], which automatically applies the view insets in material + /// design applications. + WindowPadding get viewInsets => _viewInsets; + WindowPadding _viewInsets = WindowPadding.zero; + + /// The number of physical pixels on each side of the display rectangle into + /// which the application can render, but which may be partially obscured by + /// system UI (such as the system notification area), or or physical + /// intrusions in the display (e.g. overscan regions on television screens or + /// phone sensor housings). + /// + /// When this changes, [onMetricsChanged] is called. + /// + /// See also: + /// + /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to + /// observe when this value changes. + /// * [MediaQuery.of], a simpler mechanism for the same. + /// * [Scaffold], which automatically applies the padding in material design + /// applications. + WindowPadding get padding => _padding; + WindowPadding _padding = WindowPadding.zero; + + /// A callback that is invoked whenever the [devicePixelRatio], + /// [physicalSize], [padding], or [viewInsets] values change, for example + /// when the device is rotated or when the application is resized (e.g. when + /// showing applications side-by-side on Android). + /// + /// The engine invokes this callback in the same zone in which the callback + /// was set. + /// + /// The framework registers with this callback and updates the layout + /// appropriately. + /// + /// See also: + /// + /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to + /// register for notifications when this is called. + /// * [MediaQuery.of], a simpler mechanism for the same. + VoidCallback get onMetricsChanged => _onMetricsChanged; + VoidCallback _onMetricsChanged; + Zone _onMetricsChangedZone; + set onMetricsChanged(VoidCallback callback) { + _onMetricsChanged = callback; + _onMetricsChangedZone = Zone.current; + } + + /// 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. + List get locales => _locales; + List _locales; + + /// A callback that is invoked whenever [locale] changes value. + /// + /// The framework invokes this callback in the same zone in which the + /// callback was set. + /// + /// See also: + /// + /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to + /// observe when this callback is invoked. + VoidCallback get onLocaleChanged => _onLocaleChanged; + VoidCallback _onLocaleChanged; + Zone _onLocaleChangedZone; + set onLocaleChanged(VoidCallback callback) { + _onLocaleChanged = callback; + _onLocaleChangedZone = Zone.current; + } + + /// The system-reported text scale. + /// + /// This establishes the text scaling factor to use when rendering text, + /// according to the user's platform preferences. + /// + /// The [onTextScaleFactorChanged] callback is called whenever this value + /// changes. + /// + /// See also: + /// + /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to + /// observe when this value changes. + double get textScaleFactor => _textScaleFactor; + double _textScaleFactor = 1.0; + + /// The setting indicating whether time should always be shown in the 24-hour + /// format. + /// + /// This option is used by [showTimePicker]. + bool get alwaysUse24HourFormat => _alwaysUse24HourFormat; + bool _alwaysUse24HourFormat = false; + + /// A callback that is invoked whenever [textScaleFactor] changes value. + /// + /// The framework invokes this callback in the same zone in which the + /// callback was set. + /// + /// See also: + /// + /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to + /// observe when this callback is invoked. + VoidCallback get onTextScaleFactorChanged => _onTextScaleFactorChanged; + VoidCallback _onTextScaleFactorChanged; + Zone _onTextScaleFactorChangedZone; + set onTextScaleFactorChanged(VoidCallback callback) { + _onTextScaleFactorChanged = callback; + _onTextScaleFactorChangedZone = Zone.current; + } + + /// A callback that is invoked to notify the application that it is an + /// appropriate time to provide a scene using the [SceneBuilder] API and the + /// [render] method. When possible, this is driven by the hardware VSync + /// signal. This is only called if [scheduleFrame] has been called since the + /// last time this callback was invoked. + /// + /// The [onDrawFrame] callback is invoked immediately after [onBeginFrame], + /// after draining any microtasks (e.g. completions of any [Future]s) queued + /// by the [onBeginFrame] handler. + /// + /// The framework invokes this callback in the same zone in which the + /// callback was set. + /// + /// See also: + /// + /// * [SchedulerBinding], the Flutter framework class which manages the + /// scheduling of frames. + /// * [RendererBinding], the Flutter framework class which manages layout and + /// painting. + FrameCallback get onBeginFrame => _onBeginFrame; + FrameCallback _onBeginFrame; + Zone _onBeginFrameZone; + set onBeginFrame(FrameCallback callback) { + _onBeginFrame = callback; + _onBeginFrameZone = Zone.current; + } + + /// A callback that is invoked for each frame after [onBeginFrame] has + /// completed and after the microtask queue has been drained. This can be + /// used to implement a second phase of frame rendering that happens + /// after any deferred work queued by the [onBeginFrame] phase. + /// + /// The framework invokes this callback in the same zone in which the + /// callback was set. + /// + /// See also: + /// + /// * [SchedulerBinding], the Flutter framework class which manages the + /// scheduling of frames. + /// * [RendererBinding], the Flutter framework class which manages layout and + /// painting. + VoidCallback get onDrawFrame => _onDrawFrame; + VoidCallback _onDrawFrame; + Zone _onDrawFrameZone; + set onDrawFrame(VoidCallback callback) { + _onDrawFrame = callback; + _onDrawFrameZone = Zone.current; + } + + /// A callback that is invoked when pointer data is available. + /// + /// The framework invokes this callback in the same zone in which the + /// callback was set. + /// + /// See also: + /// + /// * [GestureBinding], the Flutter framework class which manages pointer + /// events. + PointerDataPacketCallback get onPointerDataPacket => _onPointerDataPacket; + PointerDataPacketCallback _onPointerDataPacket; + Zone _onPointerDataPacketZone; + set onPointerDataPacket(PointerDataPacketCallback callback) { + _onPointerDataPacket = callback; + _onPointerDataPacketZone = Zone.current; + } + + /// The route or path that the embedder requested when the application was + /// launched. + /// + /// This will be the string "`/`" if no particular route was requested. + /// + /// ## Android + /// + /// On Android, calling + /// [`FlutterView.setInitialRoute`](/javadoc/io/flutter/view/FlutterView.html#setInitialRoute-java.lang.String-) + /// will set this value. The value must be set sufficiently early, i.e. before + /// the [runApp] call is executed in Dart, for this to have any effect on the + /// framework. The `createFlutterView` method in your `FlutterActivity` + /// subclass is a suitable time to set the value. The application's + /// `AndroidManifest.xml` file must also be updated to have a suitable + /// [``](https://developer.android.com/guide/topics/manifest/intent-filter-element.html). + /// + /// ## iOS + /// + /// On iOS, calling + /// [`FlutterViewController.setInitialRoute`](/objcdoc/Classes/FlutterViewController.html#/c:objc%28cs%29FlutterViewController%28im%29setInitialRoute:) + /// will set this value. The value must be set sufficiently early, i.e. before + /// the [runApp] call is executed in Dart, for this to have any effect on the + /// framework. The `application:didFinishLaunchingWithOptions:` method is a + /// suitable time to set this value. + /// + /// See also: + /// + /// * [Navigator], a widget that handles routing. + /// * [SystemChannels.navigation], which handles subsequent navigation + /// requests from the embedder. + String get defaultRouteName { + throw UnimplementedError(); + } + + /// Requests that, at the next appropriate opportunity, the [onBeginFrame] + /// and [onDrawFrame] callbacks be invoked. + /// + /// See also: + /// + /// * [SchedulerBinding], the Flutter framework class which manages the + /// scheduling of frames. + void scheduleFrame() { + throw UnimplementedError(); + } + + /// Updates the application's rendering on the GPU with the newly provided + /// [Scene]. This function must be called within the scope of the + /// [onBeginFrame] or [onDrawFrame] callbacks being invoked. If this function + /// is called a second time during a single [onBeginFrame]/[onDrawFrame] + /// callback sequence or called outside the scope of those callbacks, the call + /// will be ignored. + /// + /// To record graphical operations, first create a [PictureRecorder], then + /// construct a [Canvas], passing that [PictureRecorder] to its constructor. + /// After issuing all the graphical operations, call the + /// [PictureRecorder.endRecording] function on the [PictureRecorder] to obtain + /// the final [Picture] that represents the issued graphical operations. + /// + /// Next, create a [SceneBuilder], and add the [Picture] to it using + /// [SceneBuilder.addPicture]. With the [SceneBuilder.build] method you can + /// then obtain a [Scene] object, which you can display to the user via this + /// [render] function. + /// + /// See also: + /// + /// * [SchedulerBinding], the Flutter framework class which manages the + /// scheduling of frames. + /// * [RendererBinding], the Flutter framework class which manages layout and + /// painting. + void render(Scene scene) { + throw UnimplementedError(); + } + + /// Whether the user has requested that [updateSemantics] be called when + /// the semantic contents of window changes. + /// + /// The [onSemanticsEnabledChanged] callback is called whenever this value + /// changes. + bool get semanticsEnabled => _semanticsEnabled; + bool _semanticsEnabled = false; + + /// A callback that is invoked when the value of [semanticsEnabled] changes. + /// + /// The framework invokes this callback in the same zone in which the + /// callback was set. + VoidCallback get onSemanticsEnabledChanged => _onSemanticsEnabledChanged; + VoidCallback _onSemanticsEnabledChanged; + Zone _onSemanticsEnabledChangedZone; + set onSemanticsEnabledChanged(VoidCallback callback) { + _onSemanticsEnabledChanged = callback; + _onSemanticsEnabledChangedZone = Zone.current; + } + + /// A callback that is invoked whenever the user requests an action to be + /// performed. + /// + /// This callback is used when the user expresses the action they wish to + /// perform based on the semantics supplied by [updateSemantics]. + /// + /// The framework invokes this callback in the same zone in which the + /// callback was set. + SemanticsActionCallback get onSemanticsAction => _onSemanticsAction; + SemanticsActionCallback _onSemanticsAction; + Zone _onSemanticsActionZone; + set onSemanticsAction(SemanticsActionCallback callback) { + _onSemanticsAction = callback; + _onSemanticsActionZone = Zone.current; + } + + /// Additional accessibility features that may be enabled by the platform. + AccessibilityFeatures get accessibilityFeatures => _accessibilityFeatures; + AccessibilityFeatures _accessibilityFeatures; + + /// A callback that is invoked when the value of [accessibilityFlags] changes. + /// + /// The framework invokes this callback in the same zone in which the + /// callback was set. + VoidCallback get onAccessibilityFeaturesChanged => _onAccessibilityFeaturesChanged; + VoidCallback _onAccessibilityFeaturesChanged; + Zone _onAccessibilityFlagsChangedZone; + set onAccessibilityFeaturesChanged(VoidCallback callback) { + _onAccessibilityFeaturesChanged = callback; + _onAccessibilityFlagsChangedZone = Zone.current; + } + + /// Change the retained semantics data about this window. + /// + /// If [semanticsEnabled] is true, the user has requested that this function + /// be called whenever the semantic content of this window changes. + /// + /// In either case, this function disposes the given update, which means the + /// semantics update cannot be used further. + void updateSemantics(SemanticsUpdate update) { + throw UnimplementedError(); + } + + /// 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) { + throw UnimplementedError(); + } + + /// Sends a message to a platform-specific plugin. + /// + /// The `name` parameter determines which plugin receives the message. The + /// `data` parameter contains the message payload and is typically UTF-8 + /// encoded JSON but can be arbitrary data. If the plugin replies to the + /// message, `callback` will be called with the response. + /// + /// The framework invokes [callback] in the same zone in which this method + /// was called. + void sendPlatformMessage(String name, + ByteData data, + PlatformMessageResponseCallback callback) { + throw UnimplementedError(); + } + + /// Called whenever this window receives a message from a platform-specific + /// plugin. + /// + /// The `name` parameter determines which plugin sent the message. The `data` + /// parameter is the payload and is typically UTF-8 encoded JSON but can be + /// arbitrary data. + /// + /// Message handlers must call the function given in the `callback` parameter. + /// If the handler does not need to respond, the handler should pass null to + /// the callback. + /// + /// The framework invokes this callback in the same zone in which the + /// callback was set. + PlatformMessageCallback get onPlatformMessage => _onPlatformMessage; + PlatformMessageCallback _onPlatformMessage; + Zone _onPlatformMessageZone; + set onPlatformMessage(PlatformMessageCallback callback) { + _onPlatformMessage = callback; + _onPlatformMessageZone = Zone.current; + } +} + +/// Additional accessibility features that may be enabled by the platform. +/// +/// It is not possible to enable these settings from Flutter, instead they are +/// used by the platform to indicate that additional accessibility features are +/// enabled. +class AccessibilityFeatures { + const AccessibilityFeatures._(this._index); + + static const int _kAccessibleNavigation = 1 << 0; + static const int _kInvertColorsIndex = 1 << 1; + static const int _kDisableAnimationsIndex = 1 << 2; + static const int _kBoldTextIndex = 1 << 3; + static const int _kReduceMotionIndex = 1 << 4; + + // A bitfield which represents each enabled feature. + final int _index; + + /// Whether there is a running accessibility service which is changing the + /// interaction model of the device. + /// + /// For example, TalkBack on Android and VoiceOver on iOS enable this flag. + bool get accessibleNavigation => _kAccessibleNavigation & _index != 0; + + /// The platform is inverting the colors of the application. + bool get invertColors => _kInvertColorsIndex & _index != 0; + + /// The platform is requesting that animations be disabled or simplified. + bool get disableAnimations => _kDisableAnimationsIndex & _index != 0; + + /// The platform is requesting that text be rendered at a bold font weight. + /// + /// Only supported on iOS. + bool get boldText => _kBoldTextIndex & _index != 0; + + /// The platform is requesting that certain animations be simplified and + /// parallax effects removed. + /// + /// Only supported on iOS. + bool get reduceMotion => _kReduceMotionIndex & _index != 0; + + @override + String toString() { + final List features = []; + if (accessibleNavigation) + features.add('accessibleNavigation'); + if (invertColors) + features.add('invertColors'); + if (disableAnimations) + features.add('disableAnimations'); + if (boldText) + features.add('boldText'); + if (reduceMotion) + features.add('reduceMotion'); + return 'AccessibilityFeatures$features'; + } + + @override + bool operator ==(dynamic other) { + if (other.runtimeType != runtimeType) + return false; + final AccessibilityFeatures typedOther = other; + return _index == typedOther._index; + } + + @override + int get hashCode => _index.hashCode; +} + +/// The [Window] singleton. This object exposes the size of the display, the +/// core scheduler API, the input event callback, the graphics drawing API, and +/// other such core services. +final Window window = new Window._(); From 75d7f24fe4613f6d46dcb6cfc3304cdf767da133 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 5 Feb 2019 20:26:47 -0500 Subject: [PATCH 0059/1117] Roll src/third_party/skia 0ec8ec27b81c..b26b8998fa9c (11 commits) (#7705) https://skia.googlesource.com/skia.git/%2Blog/0ec8ec27b81c..b26b8998fa9c git log 0ec8ec27b81ca3ae46cfc4e85297e09b2c592943..b26b8998fa9cd06c57e091243339f2c7e5396af5 --date=short --no-merges --format=%ad %ae %s 2019-02-05 fmalita@chromium.org [skottie] Fix logging of oversized messages 2019-02-04 herb@google.com Remove fPreBlendForFilter 2019-01-25 halcanary@google.com third_party/icu: use upstream 2019-02-05 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-05 ethannicholas@google.com Revert "SkSL is now pickier about type conversions" 2019-02-05 bungeman@google.com s/geTestSVGTypeface/getTestSVGTypeface 2019-02-05 ethannicholas@google.com SkSL is now pickier about type conversions 2019-01-28 herb@google.com Move luminace calculation to the SkScalerContext ctor. 2019-02-05 bsalomon@google.com Remove fIntendedType from GrMtlBuffer. Add accessor to base class 2019-02-05 egdaniel@google.com Make sure the vulkan gpu is done work before we deleting objects in VkHardwareBufferTest. 2019-02-05 egdaniel@google.com Fill in missing GrMtlCaps functions and fix for 0 buffer alloc. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- sky/packages/sky_engine/LICENSE | 707 ++++++++----------------------- 3 files changed, 182 insertions(+), 529 deletions(-) diff --git a/DEPS b/DEPS index 8817e7a51faef..3515fc9f3f69b 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': '0ec8ec27b81ca3ae46cfc4e85297e09b2c592943', + 'skia_revision': 'b26b8998fa9cd06c57e091243339f2c7e5396af5', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index ec7a5c01f45a4..7cd964ab38171 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: e37e24e6a26a9973cc56d0593a011cd8 +Signature: 6207adccc2ca53acc3c6c3ee4d23b1e7 UNUSED LICENSES: diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index b60311605db62..4b935d593b7d6 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -2813,6 +2813,7 @@ observatory_pub_packages skia txt vulkan +wuffs Apache License Version 2.0, January 2004 @@ -4181,533 +4182,6 @@ Legal Terms --- end of FTL.TXT --- -------------------------------------------------------------------------------- -gif - -GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - -Copyright (C) 1991, 1999 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! --------------------------------------------------------------------------------- -gif - -The Graphics Interchange Format(c) is the copyright property of CompuServe -Incorporated. Only CompuServe Incorporated is authorized to define, redefine, -enhance, alter, modify or change in any way the definition of the format. - -CompuServe Incorporated hereby grants a limited, non-exclusive, royalty-free -license for the use of the Graphics Interchange Format(sm) in computer -software; computer software utilizing GIF(sm) must acknowledge ownership of the -Graphics Interchange Format and its Service Mark by CompuServe Incorporated, in -User and Technical Documentation. Computer software utilizing GIF, which is -distributed or may be distributed without User or Technical Documentation must -display to the screen or printer a message acknowledging ownership of the -Graphics Interchange Format and the Service Mark by CompuServe Incorporated; in -this case, the acknowledgement may be displayed in an opening screen or leading -banner, or a closing screen or trailing banner. A message such as the following -may be used: - - "The Graphics Interchange Format(c) is the Copyright property of - CompuServe Incorporated. GIF(sm) is a Service Mark property of - CompuServe Incorporated." --------------------------------------------------------------------------------- harfbuzz Copyright (C) 2012 Grigori Goronzy @@ -11205,6 +10679,185 @@ 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. -------------------------------------------------------------------------------- +wuffs + +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS +-------------------------------------------------------------------------------- zlib Copyright (C) 1995-2003, 2010 Jean-loup Gailly. From 83d8529ffba0f88d9fcdc8f933cc6cb9df3559ab Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 5 Feb 2019 19:06:43 -0800 Subject: [PATCH 0060/1117] Roll src/third_party/dart 5823be65af..c26bf54391 (29 commits) c26bf54391 Add InheritanceManager2 APIs to access inherited interface/class maps. e83b309354 [vm] Remove single-stepping from PRODUCT 0a2de9238b Extract importLibraryElement() implementation, make it less pessimistic. ae72248770 Encapsulate dartfix name/description of each fix ceb7b89df1 Remove a fix that has now been replaced by an assist 336969538c [vm/bytecode] Revise representation of types, constants and calls in bytecode b5eb7d463e Extract and migrate ErrorReporter tests. db9e3f21c9 remove InconsistentAnalysisException guard code from dartfix 9afb65d7f1 [vm] Fixes for recursive class loading d6caaeeebb [vm] Have Dart_TimelineEvent respect SUPPORT_TIMELINE instead of PRODUCT. d236dca9d9 Add 'offset' to 'getSuggestionDetails'. 3395550962 Provisional nullability migration API in analysis_server. 0637a860f0 Revert "Create new template for breaking changes" 2d6afa04cb Create new template for breaking changes 102f3074d5 Enhance assist to convert invocation of LinkedHashMap to a map literal 3c1ffd23ba remove unneeded override 8d5b5bba41 Allow for non-function types in alias builders. 824598b17d Rename files related to type aliases d7d195283a Add missing type arguments 6efbd07145 Rename FunctionTypeAliasBuilder to TypeAliasBuilder f45d103d67 Finish implementing IsTypeParameterSubtypeOf 7213306aad [VM/Compiler] Do not use unboxed doubles if target CPU does not support VFP 52bd3d9159 Complain about use of deprecated members 0828d2c786 [Fasta] Implement exact types for Set literals 4b28312282 [vm] Remove reference to vm/flag_list.h in runtime/bin/main.cc. c6556dc1a3 [package:js] draft proposal to improve JS interop, see #35084 798123ddb7 add lint associations b59d5a2be9 [vm] Relax assertion about duplicated direct implementors 1f638607c2 Rework the ConstraintVariable.or constructor. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 3515fc9f3f69b..4568f7df1cfa4 100644 --- a/DEPS +++ b/DEPS @@ -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': '5823be65af2662b359c04528756798f5441c7305', + 'dart_revision': 'c26bf543915d50f84dd814d2e93dd502f7cb8677', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index de5fc54aa881b..449a83d329927 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 5a62c68e45af252f4d562ff51b4bd449 +Signature: 383cd62895dbbe2bf9042812dfdb3041 UNUSED LICENSES: From 9b33323924a4f249994dfbcb30b7ed394518edcd Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 6 Feb 2019 00:20:23 -0500 Subject: [PATCH 0061/1117] Roll src/third_party/skia b26b8998fa9c..fac1e367f428 (6 commits) (#7707) https://skia.googlesource.com/skia.git/%2Blog/b26b8998fa9c..fac1e367f428 git log b26b8998fa9cd06c57e091243339f2c7e5396af5..fac1e367f4283c2b7d1e40001a05f598ec0cf3fa --date=short --no-merges --format=%ad %ae %s 2019-02-06 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader a69ca6050e3e..c81766320762 (1 commits) 2019-02-06 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 09a91e48c066..a69ca6050e3e (4 commits) 2019-02-05 ethannicholas@google.com Reland "SkSL is now pickier about type conversions" 2019-02-05 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-06 fmalita@chromium.org Revert "third_party/icu: use upstream" 2019-02-05 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4568f7df1cfa4..4f23ad56844ab 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': 'b26b8998fa9cd06c57e091243339f2c7e5396af5', + 'skia_revision': 'fac1e367f4283c2b7d1e40001a05f598ec0cf3fa', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 7cd964ab38171..fed4c05ad2325 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 6207adccc2ca53acc3c6c3ee4d23b1e7 +Signature: 3d1f2fb2221cf4716b967af0ffa7a316 UNUSED LICENSES: From c6376e5b7f2fc3cbd0bbe76a4297123a44629826 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 6 Feb 2019 04:11:08 -0500 Subject: [PATCH 0062/1117] Roll src/third_party/skia fac1e367f428..3abdd7a90e45 (1 commits) (#7709) https://skia.googlesource.com/skia.git/%2Blog/fac1e367f428..3abdd7a90e45 git log fac1e367f4283c2b7d1e40001a05f598ec0cf3fa..3abdd7a90e453ba7a9e2cad76e3526195ece14a6 --date=short --no-merges --format=%ad %ae %s 2019-02-06 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4f23ad56844ab..a60cb7d9aa946 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': 'fac1e367f4283c2b7d1e40001a05f598ec0cf3fa', + 'skia_revision': '3abdd7a90e453ba7a9e2cad76e3526195ece14a6', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index fed4c05ad2325..810d4b9dbfce1 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 3d1f2fb2221cf4716b967af0ffa7a316 +Signature: 825cb0f4b8ffb0e5812873e4aa1a1a3f UNUSED LICENSES: From 47e4e15214384824c9db0e9bd60e5eb9d6316336 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 6 Feb 2019 00:59:04 -0800 Subject: [PATCH 0063/1117] Roll src/third_party/dart c26bf54391..631c550ff9 (1 commits) 631c550ff9 Extract and migrate ExitDetector and its tests. --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index a60cb7d9aa946..9e79666da2fb6 100644 --- a/DEPS +++ b/DEPS @@ -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': 'c26bf543915d50f84dd814d2e93dd502f7cb8677', + 'dart_revision': '631c550ff9f75aca637dbd208fe0f5dc133255cf', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py From 00e0640c2f3faf33fd73abb14205a4241ebdcff4 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 6 Feb 2019 08:03:08 -0500 Subject: [PATCH 0064/1117] Roll src/third_party/skia 3abdd7a90e45..37b7d41d01cb (2 commits) (#7711) https://skia.googlesource.com/skia.git/%2Blog/3abdd7a90e45..37b7d41d01cb git log 3abdd7a90e453ba7a9e2cad76e3526195ece14a6..37b7d41d01cb3e0930c74aa70cb98e6cdaf8ad27 --date=short --no-merges --format=%ad %ae %s 2019-02-06 reed@google.com Revert "templatize drawString" 2019-02-06 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 6c1a9ccaf5f3..c27b32b2fd52 (449 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 9e79666da2fb6..653bb263ac643 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': '3abdd7a90e453ba7a9e2cad76e3526195ece14a6', + 'skia_revision': '37b7d41d01cb3e0930c74aa70cb98e6cdaf8ad27', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 810d4b9dbfce1..68166d0edef11 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 825cb0f4b8ffb0e5812873e4aa1a1a3f +Signature: fe34f261390544544c894082ac0f8c4f UNUSED LICENSES: From ebd18a241f2ebebb064a95f384650322ac34019d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 6 Feb 2019 12:05:37 -0500 Subject: [PATCH 0065/1117] Roll src/third_party/skia 37b7d41d01cb..455c74797b46 (8 commits) (#7712) https://skia.googlesource.com/skia.git/%2Blog/37b7d41d01cb..455c74797b46 git log 37b7d41d01cb3e0930c74aa70cb98e6cdaf8ad27..455c74797b4692d7dbb19a1b99c3fa3e89ca9d50 --date=short --no-merges --format=%ad %ae %s 2019-02-05 mtklein@google.com sketch SkVx 2019-02-06 benjaminwagner@google.com Add DDL jobs for Intel 2019-02-06 ethannicholas@google.com fixed SRGB effect color accuracy 2019-02-06 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-06 brianosman@google.com Remove all references to jsoncpp (build scripts, DEPS, etc) 2019-02-06 brianosman@google.com Convert bookmaker to SkJSON 2019-02-06 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-05 brianosman@google.com Fix makeColorSpace on YUV images The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 653bb263ac643..94732f96804e9 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': '37b7d41d01cb3e0930c74aa70cb98e6cdaf8ad27', + 'skia_revision': '455c74797b4692d7dbb19a1b99c3fa3e89ca9d50', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 68166d0edef11..9fd3f358eaa7f 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: fe34f261390544544c894082ac0f8c4f +Signature: fa3191bf0bd21c1eda6617b0ad4d47ea UNUSED LICENSES: @@ -4460,6 +4460,7 @@ FILE: ../../../third_party/skia/include/gpu/GrContextThreadSafeProxy.h FILE: ../../../third_party/skia/include/private/GrContext_Base.h FILE: ../../../third_party/skia/include/private/GrImageContext.h FILE: ../../../third_party/skia/include/private/GrRecordingContext.h +FILE: ../../../third_party/skia/include/private/SkVx.h FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp From 3c118b6c3b42c89f4ef18fce4b27e328f2fd754d Mon Sep 17 00:00:00 2001 From: liyuqian Date: Wed, 6 Feb 2019 11:52:25 -0800 Subject: [PATCH 0066/1117] Disable wuff on Windows (#7713) MSVC won't compile wuff... --- tools/gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/gn b/tools/gn index d5735e861e5f3..3853504d19e77 100755 --- a/tools/gn +++ b/tools/gn @@ -85,7 +85,7 @@ def to_gn_args(args): gn_args['skia_use_x11'] = False # Never add the X11 dependency (only takes effect on Linux). gn_args['skia_use_expat'] = args.target_os == 'android' gn_args['skia_use_fontconfig'] = False # Use the custom font manager instead. - gn_args['skia_use_wuffs'] = True + gn_args['skia_use_wuffs'] = not sys.platform.startswith(('cygwin', 'win')) gn_args['is_official_build'] = True # Disable Skia test utilities. gn_args['is_debug'] = args.unoptimized From 9f4b8e442138325961fbdbaf68ca9d852481cff6 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 6 Feb 2019 15:51:45 -0500 Subject: [PATCH 0067/1117] Roll src/third_party/skia 455c74797b46..429251513f71 (8 commits) (#7714) https://skia.googlesource.com/skia.git/%2Blog/455c74797b46..429251513f71 git log 455c74797b4692d7dbb19a1b99c3fa3e89ca9d50..429251513f716de18e9c4ebda05f304eb97fedde --date=short --no-merges --format=%ad %ae %s 2019-02-06 mtklein@google.com fill in most remaining skvx operations 2019-02-06 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-06 herb@google.com Remove filterRec bypass on MakeRecAndEffects 2019-02-06 rmistry@google.com Have the RecreateSKPs bot upload to partner bucket 2019-02-05 herb@google.com Reorganize MakeRecAndEffects and SkScalerContext ctor 2019-02-06 reed@google.com per-contour variant of SkPathMeasure 2019-02-06 rmistry@google.com Remove PerCommit-Bookmaker 2019-02-06 jvanverth@google.com Switch back to non-Retina display resolution. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 94732f96804e9..2cbfb5d83ebf8 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': '455c74797b4692d7dbb19a1b99c3fa3e89ca9d50', + 'skia_revision': '429251513f716de18e9c4ebda05f304eb97fedde', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 9fd3f358eaa7f..1220689224db8 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: fa3191bf0bd21c1eda6617b0ad4d47ea +Signature: 7eb43a71ab47ddd84407142d2b672c29 UNUSED LICENSES: @@ -1149,6 +1149,7 @@ 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/SkContourMeasure.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 @@ -1258,6 +1259,7 @@ FILE: ../../../third_party/skia/src/core/SkBlurPriv.h FILE: ../../../third_party/skia/src/core/SkCanvasPriv.cpp FILE: ../../../third_party/skia/src/core/SkColorSpaceXformSteps.cpp FILE: ../../../third_party/skia/src/core/SkColorSpaceXformSteps.h +FILE: ../../../third_party/skia/src/core/SkContourMeasure.cpp FILE: ../../../third_party/skia/src/core/SkCoverageModePriv.h FILE: ../../../third_party/skia/src/core/SkCubicMap.cpp FILE: ../../../third_party/skia/src/core/SkCubicMap.h From fdc699b803478c7d90a40a51832a964f7da160ae Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 6 Feb 2019 13:09:16 -0800 Subject: [PATCH 0068/1117] Roll src/third_party/dart 631c550ff9..adfa4791fc (20 commits) adfa4791fc Improve storage for available declarations. 392a869ee4 [infra] Skip all co19_2 tests that are timing out on dartdevc. 033cb7ffcc Issue 1438. Use expression function body for createState(). c3542cbc3b Set relevance for IncludedSuggestionSet. 661e91e30e Extract and migrate tests for ConstantEvaluator. cc74e20eee Make some fields on Interface private, and change the way InheritanceManager2 is tested. 512e2ef292 Extract FixCodeTask/Processor from main dartfix class e4755b34ba Extract FixLintTask/Processor from main dartfix class 1e8f9bf63a Extract FixErrorTask/Processor from main dartfix class 5ae156e055 Extract DartFixListener to record source changes and recommendations 1c0422735e Abstract type operations in flow analysis. efcf8b01b1 Move integration tests of migration API to analysis server. 8f821d408e Fix status files for dartkp 6b73a02937 Fix status files for simarm and simarm64 4fb220707e Hardcode SourceFileEdit.fileStamp to -1 in migration prototype. d972c2b7b7 [vm] Update raw_object_fields.cc after 7e81f56a. c2778062e7 Add UI as code status file entries for simarm 2b8560f4b2 [Fasta] Add spread and control-flow collection flags dc812e0921 [infra] Add third_party/requirejs to the fileset used by dartdevc testing 7e81f56ad7 Save Initializer for field and pass into debugger to enable breakpoint setting. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 2cbfb5d83ebf8..c4f6de2cf48ee 100644 --- a/DEPS +++ b/DEPS @@ -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': '631c550ff9f75aca637dbd208fe0f5dc133255cf', + 'dart_revision': 'adfa4791fcf2337c27f3aabe8a3b9d6ed0605ff1', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 449a83d329927..7327ca204ea19 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 383cd62895dbbe2bf9042812dfdb3041 +Signature: b3a9b7d84197e4af9acec558e5c89894 UNUSED LICENSES: From ce07399180967707dc28f134da94debaf8ac1771 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 6 Feb 2019 14:16:47 -0800 Subject: [PATCH 0069/1117] Add FlutterProjectArgs::root_isolate_create_callback (#7651) Allows embedders to specify a callback to be invoked in isolate scope once root isolate has been created and marked runnable. As an example of where this is useful, embedder unit test fixtures may want to include Dart functions backed by a native implementation. On isolate creation, this patch allows the unit test author to call Dart_SetNativeResolver in root isolate scope. --- shell/platform/embedder/embedder.cc | 7 +++++++ shell/platform/embedder/embedder.h | 3 +++ shell/platform/embedder/tests/embedder_unittests.cc | 8 +++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 807ebe772b7ba..512f1183153dd 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -361,6 +361,13 @@ FlutterEngineResult FlutterEngineRun(size_t version, settings.task_observer_remove = [](intptr_t key) { fml::MessageLoop::GetCurrent().RemoveTaskObserver(key); }; + if (SAFE_ACCESS(args, root_isolate_create_callback, nullptr) != nullptr) { + VoidCallback callback = + SAFE_ACCESS(args, root_isolate_create_callback, nullptr); + settings.root_isolate_create_callback = [callback, user_data]() { + callback(user_data); + }; + } // Create a thread host with the current thread as the platform thread and all // other threads managed. diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index c2cc35669ca72..e0603644f449b 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -251,6 +251,9 @@ typedef struct { const uint8_t* isolate_snapshot_instructions; // The size of the isolate snapshot instructions buffer. size_t isolate_snapshot_instructions_size; + // The callback invoked by the engine in root isolate scope. Called + // immediately after the root isolate has been created and marked runnable. + VoidCallback root_isolate_create_callback; } FlutterProjectArgs; FLUTTER_EXPORT diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc index e2062f6ee953b..7ddff1e96aafd 100644 --- a/shell/platform/embedder/tests/embedder_unittests.cc +++ b/shell/platform/embedder/tests/embedder_unittests.cc @@ -29,10 +29,16 @@ TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) { FlutterProjectArgs args = {}; args.struct_size = sizeof(FlutterProjectArgs); args.assets_path = testing::GetFixturesPath(); + args.root_isolate_create_callback = [](void* data) { + std::string str_data = reinterpret_cast(data); + ASSERT_EQ(str_data, "Data"); + }; + std::string str_data = "Data"; + void* user_data = const_cast(str_data.c_str()); FlutterEngine engine = nullptr; FlutterEngineResult result = FlutterEngineRun(FLUTTER_ENGINE_VERSION, &config, - &args, nullptr, &engine); + &args, user_data, &engine); ASSERT_EQ(result, FlutterEngineResult::kSuccess); result = FlutterEngineShutdown(engine); From 6585f334a1cc272e6faf471d738f2b9ebeb10265 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 6 Feb 2019 15:29:19 -0800 Subject: [PATCH 0070/1117] Allow all entrypoints support by the command line VM. (#7717) --- lib/ui/hooks.dart | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index 3f536d2fa1196..b1550bf90b1ee 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -168,12 +168,26 @@ void _drawFrame() { _invoke(window.onDrawFrame, window._onDrawFrameZone); } +// ignore: always_declare_return_types, prefer_generic_function_type_aliases +typedef _UnaryFunction(Null args); +// ignore: always_declare_return_types, prefer_generic_function_type_aliases +typedef _BinaryFunction(Null args, Null message); + @pragma('vm:entry-point') // ignore: unused_element void _runMainZoned(Function startMainIsolateFunction, Function userMainFunction) { startMainIsolateFunction((){ runZoned>(() { - userMainFunction(); + const List empty_args = []; + if (userMainFunction is _BinaryFunction) { + // This seems to be undocumented but supported by the command line VM. + // Let's do the same in case old entry-points are ported to Flutter. + (userMainFunction as dynamic)(empty_args, ''); + } else if (userMainFunction is _UnaryFunction) { + (userMainFunction as dynamic)(empty_args); + } else { + userMainFunction(); + } }, onError: (Object error, StackTrace stackTrace) { _reportUnhandledException(error.toString(), stackTrace.toString()); }); From 67831a3ed2af6c14579641d9cecd520a34608377 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 6 Feb 2019 15:41:32 -0800 Subject: [PATCH 0071/1117] Roll buildroot to c82412bcdcd593f1385a478ae2c4b8eb9814f3b8 (#7718) --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index c4f6de2cf48ee..bb47454c7ed39 100644 --- a/DEPS +++ b/DEPS @@ -116,7 +116,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '13ca742ec8b3d7761877197d74b003d3e646d805', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'c82412bcdcd593f1385a478ae2c4b8eb9814f3b8', # Fuchsia compatibility # From 77b3186038eec0be36b04ee16b2e26a916d2226f Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 6 Feb 2019 16:03:37 -0800 Subject: [PATCH 0072/1117] Roll src/third_party/dart adfa4791fc..caa8747a37 (2 commits) caa8747a37 Rework dartfix NNBD fix to use new NullabilityMigration engine ae5bd68570 Lower relevance of deprecated suggestion sets. --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index bb47454c7ed39..d4931a67d8a67 100644 --- a/DEPS +++ b/DEPS @@ -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': 'adfa4791fcf2337c27f3aabe8a3b9d6ed0605ff1', + 'dart_revision': 'caa8747a377778f4349ff416d6e9aa7a7e410837', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py From fdf57a64ddce01c734dfe8e929c8f6d3d2ba519d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 6 Feb 2019 19:41:22 -0500 Subject: [PATCH 0073/1117] Roll src/third_party/skia 429251513f71..2fc1474f9d62 (8 commits) (#7721) https://skia.googlesource.com/skia.git/%2Blog/429251513f71..2fc1474f9d62 git log 429251513f716de18e9c4ebda05f304eb97fedde..2fc1474f9d62db4b854fd4e5af322f41a323ffe5 --date=short --no-merges --format=%ad %ae %s 2019-02-06 bungeman@google.com Add BOT/EOT to Shaper. 2019-02-06 halcanary@google.com bin/gn format gn/skia.gni 2019-02-06 herb@google.com Remove the distinction between key and device descriptors 2019-02-06 bungeman@google.com Roll HarfBuzz 2019-02-06 halcanary@google.com SkLoadICU: simplify 2019-02-06 robertphillips@google.com Move GrContextPriv methods to their own .cpp file 2019-02-06 mtklein@google.com add mad() and shuffle() to SkVx 2019-02-05 csmartdalton@google.com Add a GpuGM class for GPU-only tests The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 124 +------------------------------ 2 files changed, 4 insertions(+), 122 deletions(-) diff --git a/DEPS b/DEPS index d4931a67d8a67..908000aada017 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': '429251513f716de18e9c4ebda05f304eb97fedde', + 'skia_revision': '2fc1474f9d62db4b854fd4e5af322f41a323ffe5', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 1220689224db8..37ae1a542a38b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 7eb43a71ab47ddd84407142d2b672c29 +Signature: a7e934aefd676fac1ba45d5773925b60 UNUSED LICENSES: @@ -392,125 +392,6 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================================================== -==================================================================================================== -LIBRARY: harfbuzz -ORIGIN: ../../../third_party/skia/third_party/harfbuzz/hb-buffer-deserialize-json.hh -TYPE: LicenseType.unknown -FILE: ../../../third_party/skia/third_party/harfbuzz/hb-buffer-deserialize-json.hh -FILE: ../../../third_party/skia/third_party/harfbuzz/hb-buffer-deserialize-text.hh ----------------------------------------------------------------------------------------------------- -Copyright © 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/skia/third_party/harfbuzz/hb-ot-shape-complex-indic-machine.hh -TYPE: LicenseType.unknown -FILE: ../../../third_party/skia/third_party/harfbuzz/hb-ot-shape-complex-indic-machine.hh -FILE: ../../../third_party/skia/third_party/harfbuzz/hb-ot-shape-complex-myanmar-machine.hh ----------------------------------------------------------------------------------------------------- -Copyright © 2011,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/skia/third_party/harfbuzz/hb-ot-shape-complex-use-machine.hh -TYPE: LicenseType.unknown -FILE: ../../../third_party/skia/third_party/harfbuzz/hb-ot-shape-complex-use-machine.hh ----------------------------------------------------------------------------------------------------- -Copyright © 2015 Mozilla Foundation. -Copyright © 2015 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/skia/third_party/harfbuzz/hb-version.h -TYPE: LicenseType.unknown -FILE: ../../../third_party/skia/third_party/harfbuzz/hb-version.h ----------------------------------------------------------------------------------------------------- -Copyright © 2011 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: libsdl LIBRARY: skia @@ -4467,6 +4348,7 @@ FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp FILE: ../../../third_party/skia/src/gpu/GrBaseContextPriv.h +FILE: ../../../third_party/skia/src/gpu/GrContextPriv.cpp FILE: ../../../third_party/skia/src/gpu/GrContextThreadSafeProxy.cpp FILE: ../../../third_party/skia/src/gpu/GrContext_Base.cpp FILE: ../../../third_party/skia/src/gpu/GrImageContext.cpp @@ -5712,4 +5594,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: 53 +Total license count: 49 From 211adeac3a400d33ea2cbd9f26f809a38ff3584e Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 6 Feb 2019 17:07:30 -0800 Subject: [PATCH 0074/1117] Introduced a number of Java system channels in io/flutter/embedding/engine/systemchannels/ (#7500) --- ci/licenses_golden/licenses_flutter | 6 ++ shell/platform/android/BUILD.gn | 6 ++ .../flutter/embedding/engine/FlutterJNI.java | 2 +- .../embedding/engine/dart/DartExecutor.java | 76 ++++++++------- .../embedding/engine/dart/DartMessenger.java | 92 ++++++++++++------- .../engine/dart/PlatformMessageHandler.java | 2 +- .../systemchannels/KeyEventChannel.java | 54 +++++++++++ .../systemchannels/LifecycleChannel.java | 37 ++++++++ .../systemchannels/LocalizationChannel.java | 35 +++++++ .../systemchannels/NavigationChannel.java | 42 +++++++++ .../systemchannels/PlatformChannel.java | 29 ++++++ .../engine/systemchannels/SystemChannel.java | 34 +++++++ .../plugin/common/BinaryMessenger.java | 5 + .../flutter/plugin/common/MethodChannel.java | 3 +- .../io/flutter/view/FlutterNativeView.java | 4 +- .../android/io/flutter/view/FlutterView.java | 64 +++++-------- 16 files changed, 379 insertions(+), 112 deletions(-) create mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/KeyEventChannel.java create mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/LifecycleChannel.java create mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java create mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/NavigationChannel.java create mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java create mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/SystemChannel.java diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 90840267553b7..8a0bf83a6b245 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -444,7 +444,13 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/D 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/engine/systemchannels/KeyEventChannel.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/LifecycleChannel.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/NavigationChannel.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/SettingsChannel.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/SystemChannel.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 diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index 1b49602f25d0a..7779ecef83590 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -113,7 +113,13 @@ java_library("flutter_shell_java") { "io/flutter/embedding/engine/dart/PlatformMessageHandler.java", "io/flutter/embedding/engine/renderer/FlutterRenderer.java", "io/flutter/embedding/engine/renderer/OnFirstFrameRenderedListener.java", + "io/flutter/embedding/engine/systemchannels/KeyEventChannel.java", + "io/flutter/embedding/engine/systemchannels/LifecycleChannel.java", + "io/flutter/embedding/engine/systemchannels/LocalizationChannel.java", + "io/flutter/embedding/engine/systemchannels/NavigationChannel.java", + "io/flutter/embedding/engine/systemchannels/PlatformChannel.java", "io/flutter/embedding/engine/systemchannels/SettingsChannel.java", + "io/flutter/embedding/engine/systemchannels/SystemChannel.java", "io/flutter/plugin/common/ActivityLifecycleListener.java", "io/flutter/plugin/common/BasicMessageChannel.java", "io/flutter/plugin/common/BinaryCodec.java", diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java index 4923f1c77c341..0ee86091ab09c 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java @@ -199,7 +199,7 @@ public void setPlatformMessageHandler(@Nullable PlatformMessageHandler platformM @SuppressWarnings("unused") private void handlePlatformMessage(final String channel, byte[] message, final int replyId) { if (platformMessageHandler != null) { - platformMessageHandler.handlePlatformMessage(channel, message, replyId); + platformMessageHandler.handleMessageFromDart(channel, message, replyId); } // TODO(mattcarroll): log dropped messages when in debug mode (https://github.com/flutter/flutter/issues/25391) } 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 28d6f52772016..f7cdd855d77de 100644 --- a/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java +++ b/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java @@ -37,29 +37,33 @@ */ public class DartExecutor implements BinaryMessenger { private static final String TAG = "DartExecutor"; - + + @NonNull private final FlutterJNI flutterJNI; + @NonNull private final DartMessenger messenger; private boolean isApplicationRunning = false; - + public DartExecutor(@NonNull FlutterJNI flutterJNI) { this.flutterJNI = flutterJNI; this.messenger = new DartMessenger(flutterJNI); } - + /** * Invoked when the {@link io.flutter.embedding.engine.FlutterEngine} that owns this * {@link DartExecutor} attaches to JNI. *

* When attached to JNI, this {@link DartExecutor} begins handling 2-way communication to/from * the Dart execution context. This communication is facilitate via 2 APIs: - * - {@link BinaryMessenger}, which sends messages to Dart - * - {@link PlatformMessageHandler}, which receives messages from Dart + *

    + *
  • {@link BinaryMessenger}, which sends messages to Dart
  • + *
  • {@link PlatformMessageHandler}, which receives messages from Dart
  • + *
*/ public void onAttachedToJNI() { flutterJNI.setPlatformMessageHandler(messenger); } - + /** * Invoked when the {@link io.flutter.embedding.engine.FlutterEngine} that owns this * {@link DartExecutor} detaches from JNI. @@ -70,7 +74,7 @@ public void onAttachedToJNI() { public void onDetachedFromJNI() { flutterJNI.setPlatformMessageHandler(null); } - + /** * Is this {@link DartExecutor} currently executing Dart code? * @@ -79,7 +83,7 @@ public void onDetachedFromJNI() { public boolean isExecutingDart() { return isApplicationRunning; } - + /** * Starts executing Dart code based on the given {@code dartEntrypoint}. *

@@ -87,12 +91,12 @@ public boolean isExecutingDart() { * * @param dartEntrypoint specifies which Dart function to run, and where to find it */ - public void executeDartEntrypoint(DartEntrypoint dartEntrypoint) { + public void executeDartEntrypoint(@NonNull DartEntrypoint dartEntrypoint) { if (isApplicationRunning) { Log.w(TAG, "Attempted to run a DartExecutor that is already running."); return; } - + flutterJNI.runBundleAndSnapshotFromLibrary( new String[]{ dartEntrypoint.pathToPrimaryBundle, @@ -102,10 +106,10 @@ public void executeDartEntrypoint(DartEntrypoint dartEntrypoint) { null, dartEntrypoint.androidAssetManager ); - + isApplicationRunning = true; } - + /** * Starts executing Dart code based on the given {@code dartCallback}. *

@@ -113,12 +117,12 @@ public void executeDartEntrypoint(DartEntrypoint dartEntrypoint) { * * @param dartCallback specifies which Dart callback to run, and where to find it */ - public void executeDartCallback(DartCallback dartCallback) { + public void executeDartCallback(@NonNull DartCallback dartCallback) { if (isApplicationRunning) { Log.w(TAG, "Attempted to run a DartExecutor that is already running."); return; } - + flutterJNI.runBundleAndSnapshotFromLibrary( new String[]{ dartCallback.pathToPrimaryBundle, @@ -128,12 +132,12 @@ public void executeDartCallback(DartCallback dartCallback) { dartCallback.callbackHandle.callbackLibraryPath, dartCallback.androidAssetManager ); - + isApplicationRunning = true; } - + //------ START BinaryMessenger ----- - + /** * Sends the given {@code message} from Android to Dart over the given {@code channel}. * @@ -141,10 +145,10 @@ public void executeDartCallback(DartCallback dartCallback) { * @param message the message payload, a direct-allocated {@link ByteBuffer} with the message bytes */ @Override - public void send(String channel, ByteBuffer message) { + public void send(@NonNull String channel, @Nullable ByteBuffer message) { messenger.send(channel, message, null); } - + /** * Sends the given {@code messages} from Android to Dart over the given {@code channel} and * then has the provided {@code callback} invoked when the Dart side responds. @@ -155,10 +159,10 @@ public void send(String channel, ByteBuffer message) { * @param callback a callback invoked when the Dart application responds to the message */ @Override - public void send(String channel, ByteBuffer message, BinaryMessenger.BinaryReply callback) { + public void send(@NonNull String channel, @Nullable ByteBuffer message, @Nullable BinaryMessenger.BinaryReply callback) { messenger.send(channel, message, callback); } - + /** * Sets the given {@link io.flutter.plugin.common.BinaryMessenger.BinaryMessageHandler} as the * singular handler for all incoming messages received from the Dart side of this Dart execution @@ -168,11 +172,11 @@ public void send(String channel, ByteBuffer message, BinaryMessenger.BinaryReply * @param handler a {@link BinaryMessageHandler} to be invoked on incoming messages, or null. */ @Override - public void setMessageHandler(String channel, BinaryMessenger.BinaryMessageHandler handler) { + public void setMessageHandler(@NonNull String channel, @Nullable BinaryMessenger.BinaryMessageHandler handler) { messenger.setMessageHandler(channel, handler); } //------ END BinaryMessenger ----- - + /** * Configuration options that specify which Dart entrypoint function is executed and where * to find that entrypoint and other assets required for Dart execution. @@ -181,23 +185,27 @@ public static class DartEntrypoint { /** * Standard Android AssetManager, provided from some {@code Context} or {@code Resources}. */ + @NonNull public final AssetManager androidAssetManager; - + /** * The first place that Dart will look for a given function or asset. */ + @NonNull public final String pathToPrimaryBundle; - + /** * A secondary fallback location that Dart will look for a given function or asset. */ + @Nullable public final String pathToFallbackBundle; - + /** * The name of a Dart function to execute. */ + @NonNull public final String dartEntrypointFunctionName; - + public DartEntrypoint( @NonNull AssetManager androidAssetManager, @NonNull String pathToBundle, @@ -210,7 +218,7 @@ public DartEntrypoint( dartEntrypointFunctionName ); } - + public DartEntrypoint( @NonNull AssetManager androidAssetManager, @NonNull String pathToPrimaryBundle, @@ -223,7 +231,7 @@ public DartEntrypoint( this.dartEntrypointFunctionName = dartEntrypointFunctionName; } } - + /** * Configuration options that specify which Dart callback function is executed and where * to find that callback and other assets required for Dart execution. @@ -233,22 +241,22 @@ public static class DartCallback { * Standard Android AssetManager, provided from some {@code Context} or {@code Resources}. */ public final AssetManager androidAssetManager; - + /** * The first place that Dart will look for a given function or asset. */ public final String pathToPrimaryBundle; - + /** * A secondary fallback location that Dart will look for a given function or asset. */ public final String pathToFallbackBundle; - + /** * A Dart callback that was previously registered with the Dart VM. */ public final FlutterCallbackInformation callbackHandle; - + public DartCallback( @NonNull AssetManager androidAssetManager, @NonNull String pathToPrimaryBundle, @@ -261,7 +269,7 @@ public DartCallback( callbackHandle ); } - + public DartCallback( @NonNull AssetManager androidAssetManager, @NonNull String pathToPrimaryBundle, diff --git a/shell/platform/android/io/flutter/embedding/engine/dart/DartMessenger.java b/shell/platform/android/io/flutter/embedding/engine/dart/DartMessenger.java index 16a6b10b8a267..e9fe0a7cd8c09 100644 --- a/shell/platform/android/io/flutter/embedding/engine/dart/DartMessenger.java +++ b/shell/platform/android/io/flutter/embedding/engine/dart/DartMessenger.java @@ -5,6 +5,7 @@ package io.flutter.embedding.engine.dart; import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.util.Log; import java.nio.ByteBuffer; @@ -22,41 +23,50 @@ * IF YOU USE IT, WE WILL BREAK YOU. *

* See {@link BinaryMessenger}, which sends messages from Android to Dart + *

* See {@link PlatformMessageHandler}, which handles messages to Android from Dart */ class DartMessenger implements BinaryMessenger, PlatformMessageHandler { private static final String TAG = "DartMessenger"; - + + @NonNull private final FlutterJNI flutterJNI; + @NonNull private final Map messageHandlers; - private final Map mPendingReplies = new HashMap<>(); - private int mNextReplyId = 1; - + @NonNull + private final Map pendingReplies; + private int nextReplyId = 1; + DartMessenger(@NonNull FlutterJNI flutterJNI) { this.flutterJNI = flutterJNI; this.messageHandlers = new HashMap<>(); + this.pendingReplies = new HashMap<>(); } - + @Override - public void setMessageHandler(String channel, BinaryMessenger.BinaryMessageHandler handler) { + public void setMessageHandler(@NonNull String channel, @Nullable BinaryMessenger.BinaryMessageHandler handler) { if (handler == null) { messageHandlers.remove(channel); } else { messageHandlers.put(channel, handler); } } - + @Override - public void send(String channel, ByteBuffer message) { + public void send(@NonNull String channel, @NonNull ByteBuffer message) { send(channel, message, null); } - + @Override - public void send(String channel, ByteBuffer message, BinaryMessenger.BinaryReply callback) { + public void send( + @NonNull String channel, + @Nullable ByteBuffer message, + @Nullable BinaryMessenger.BinaryReply callback + ) { int replyId = 0; if (callback != null) { - replyId = mNextReplyId++; - mPendingReplies.put(replyId, callback); + replyId = nextReplyId++; + pendingReplies.put(replyId, callback); } if (message == null) { flutterJNI.dispatchEmptyPlatformMessage(channel, replyId); @@ -64,40 +74,30 @@ public void send(String channel, ByteBuffer message, BinaryMessenger.BinaryReply flutterJNI.dispatchPlatformMessage(channel, message, message.position(), replyId); } } - + @Override - public void handlePlatformMessage(final String channel, byte[] message, final int replyId) { + public void handleMessageFromDart( + @NonNull final String channel, + @Nullable byte[] message, + final int replyId + ) { BinaryMessenger.BinaryMessageHandler handler = messageHandlers.get(channel); if (handler != null) { try { final ByteBuffer buffer = (message == null ? null : ByteBuffer.wrap(message)); - handler.onMessage(buffer, new BinaryMessenger.BinaryReply() { - private final AtomicBoolean done = new AtomicBoolean(false); - - @Override - public void reply(ByteBuffer reply) { - if (done.getAndSet(true)) { - throw new IllegalStateException("Reply already submitted"); - } - if (reply == null) { - flutterJNI.invokePlatformMessageEmptyResponseCallback(replyId); - } else { - flutterJNI.invokePlatformMessageResponseCallback(replyId, reply, reply.position()); - } - } - }); + handler.onMessage(buffer, new Reply(flutterJNI, replyId)); } catch (Exception ex) { Log.e(TAG, "Uncaught exception in binary message listener", ex); flutterJNI.invokePlatformMessageEmptyResponseCallback(replyId); } - return; + } else { + flutterJNI.invokePlatformMessageEmptyResponseCallback(replyId); } - flutterJNI.invokePlatformMessageEmptyResponseCallback(replyId); } - + @Override - public void handlePlatformMessageResponse(int replyId, byte[] reply) { - BinaryMessenger.BinaryReply callback = mPendingReplies.remove(replyId); + public void handlePlatformMessageResponse(int replyId, @Nullable byte[] reply) { + BinaryMessenger.BinaryReply callback = pendingReplies.remove(replyId); if (callback != null) { try { callback.reply(reply == null ? null : ByteBuffer.wrap(reply)); @@ -106,4 +106,28 @@ public void handlePlatformMessageResponse(int replyId, byte[] reply) { } } } + + private static class Reply implements BinaryMessenger.BinaryReply { + @NonNull + private final FlutterJNI flutterJNI; + private final int replyId; + private final AtomicBoolean done = new AtomicBoolean(false); + + Reply(@NonNull FlutterJNI flutterJNI, int replyId) { + this.flutterJNI = flutterJNI; + this.replyId = replyId; + } + + @Override + public void reply(ByteBuffer reply) { + if (done.getAndSet(true)) { + throw new IllegalStateException("Reply already submitted"); + } + if (reply == null) { + flutterJNI.invokePlatformMessageEmptyResponseCallback(replyId); + } else { + flutterJNI.invokePlatformMessageResponseCallback(replyId, reply, reply.position()); + } + } + } } \ No newline at end of file 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 0403348b871b8..ea1011c09abcf 100644 --- a/shell/platform/android/io/flutter/embedding/engine/dart/PlatformMessageHandler.java +++ b/shell/platform/android/io/flutter/embedding/engine/dart/PlatformMessageHandler.java @@ -9,7 +9,7 @@ * IF YOU USE IT, WE WILL BREAK YOU. */ public interface PlatformMessageHandler { - void handlePlatformMessage(final String channel, byte[] message, final int replyId); + void handleMessageFromDart(final String channel, byte[] message, final int replyId); void handlePlatformMessageResponse(int replyId, byte[] reply); } diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/KeyEventChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/KeyEventChannel.java new file mode 100644 index 0000000000000..2ecd048386fcd --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/KeyEventChannel.java @@ -0,0 +1,54 @@ +// Copyright 2013 The Flutter 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.systemchannels; + +import android.support.annotation.NonNull; +import android.view.KeyEvent; + +import java.util.HashMap; +import java.util.Map; + +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.plugin.common.BasicMessageChannel; +import io.flutter.plugin.common.JSONMessageCodec; + +/** + * TODO(mattcarroll): fill in javadoc for KeyEventChannel. + */ +public class KeyEventChannel { + + @NonNull + public final BasicMessageChannel channel; + + public KeyEventChannel(@NonNull DartExecutor dartExecutor) { + this.channel = new BasicMessageChannel<>(dartExecutor, "flutter/keyevent", JSONMessageCodec.INSTANCE); + } + + public void keyUp(@NonNull KeyEvent keyEvent) { + Map message = new HashMap<>(); + message.put("type", "keyup"); + message.put("keymap", "android"); + encodeKeyEvent(keyEvent, message); + + channel.send(message); + } + + public void keyDown(@NonNull KeyEvent keyEvent) { + Map message = new HashMap<>(); + message.put("type", "keydown"); + message.put("keymap", "android"); + encodeKeyEvent(keyEvent, message); + + channel.send(message); + } + + private void encodeKeyEvent(@NonNull KeyEvent event, @NonNull Map message) { + message.put("flags", event.getFlags()); + message.put("codePoint", event.getUnicodeChar()); + message.put("keyCode", event.getKeyCode()); + message.put("scanCode", event.getScanCode()); + message.put("metaState", event.getMetaState()); + } +} diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LifecycleChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LifecycleChannel.java new file mode 100644 index 0000000000000..7f3e4c8513a9d --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LifecycleChannel.java @@ -0,0 +1,37 @@ +// Copyright 2013 The Flutter 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.systemchannels; + +import android.support.annotation.NonNull; + +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.plugin.common.BasicMessageChannel; +import io.flutter.plugin.common.StringCodec; + +/** + * TODO(mattcarroll): fill in javadoc for LifecycleChannel. + */ +public class LifecycleChannel { + + @NonNull + public final BasicMessageChannel channel; + + public LifecycleChannel(@NonNull DartExecutor dartExecutor) { + this.channel = new BasicMessageChannel<>(dartExecutor, "flutter/lifecycle", StringCodec.INSTANCE); + } + + public void appIsInactive() { + channel.send("AppLifecycleState.inactive"); + } + + public void appIsResumed() { + channel.send("AppLifecycleState.resumed"); + } + + public void appIsPaused() { + channel.send("AppLifecycleState.paused"); + } + +} diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java new file mode 100644 index 0000000000000..ffb8f1f84a155 --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java @@ -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. + +package io.flutter.embedding.engine.systemchannels; + +import android.support.annotation.NonNull; + +import java.util.Arrays; + +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.plugin.common.JSONMethodCodec; +import io.flutter.plugin.common.MethodChannel; + +/** + * TODO(mattcarroll): fill in javadoc for LocalizationChannel. + */ +public class LocalizationChannel { + + @NonNull + public final MethodChannel channel; + + public LocalizationChannel(@NonNull DartExecutor dartExecutor) { + this.channel = new MethodChannel(dartExecutor, "flutter/localization", JSONMethodCodec.INSTANCE); + } + + public void setLocale(String language, String country) { + channel.invokeMethod("setLocale", Arrays.asList(language, country)); + } + + public void setMethodCallHandler(MethodChannel.MethodCallHandler handler) { + channel.setMethodCallHandler(handler); + } + +} diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/NavigationChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/NavigationChannel.java new file mode 100644 index 0000000000000..f81f24204d392 --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/NavigationChannel.java @@ -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. + +package io.flutter.embedding.engine.systemchannels; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; + +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.plugin.common.JSONMethodCodec; +import io.flutter.plugin.common.MethodChannel; + +/** + * TODO(mattcarroll): fill in javadoc for NavigationChannel. + */ +public class NavigationChannel { + + @NonNull + public final MethodChannel channel; + + public NavigationChannel(@NonNull DartExecutor dartExecutor) { + this.channel = new MethodChannel(dartExecutor, "flutter/navigation", JSONMethodCodec.INSTANCE); + } + + public void setInitialRoute(String initialRoute) { + channel.invokeMethod("setInitialRoute", initialRoute); + } + + public void pushRoute(String route) { + channel.invokeMethod("pushRoute", route); + } + + public void popRoute() { + channel.invokeMethod("popRoute", null); + } + + public void setMethodCallHandler(@Nullable MethodChannel.MethodCallHandler handler) { + channel.setMethodCallHandler(handler); + } + +} diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java new file mode 100644 index 0000000000000..b1ceb82b7a74d --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java @@ -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. + +package io.flutter.embedding.engine.systemchannels; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; + +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.plugin.common.JSONMethodCodec; +import io.flutter.plugin.common.MethodChannel; + +/** + * TODO(mattcarroll): fill in javadoc for PlatformChannel. + */ +public class PlatformChannel { + + public final MethodChannel channel; + + public PlatformChannel(@NonNull DartExecutor dartExecutor) { + this.channel = new MethodChannel(dartExecutor, "flutter/platform", JSONMethodCodec.INSTANCE); + } + + public void setMethodCallHandler(@Nullable MethodChannel.MethodCallHandler handler) { + channel.setMethodCallHandler(handler); + } + +} diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/SystemChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/SystemChannel.java new file mode 100644 index 0000000000000..46c85926daf1b --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/SystemChannel.java @@ -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. + +package io.flutter.embedding.engine.systemchannels; + +import android.support.annotation.NonNull; + +import java.util.HashMap; +import java.util.Map; + +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.plugin.common.BasicMessageChannel; +import io.flutter.plugin.common.JSONMessageCodec; + +/** + * TODO(mattcarroll): fill in javadoc for SystemChannel. + */ +public class SystemChannel { + + @NonNull + public final BasicMessageChannel channel; + + public SystemChannel(@NonNull DartExecutor dartExecutor) { + this.channel = new BasicMessageChannel<>(dartExecutor, "flutter/system", JSONMessageCodec.INSTANCE); + } + + public void sendMemoryPressureWarning() { + Map message = new HashMap<>(1); + message.put("type", "memoryPressure"); + channel.send(message); + } + +} diff --git a/shell/platform/android/io/flutter/plugin/common/BinaryMessenger.java b/shell/platform/android/io/flutter/plugin/common/BinaryMessenger.java index c8f54e9e88f2b..9f1e4eb4b67a8 100644 --- a/shell/platform/android/io/flutter/plugin/common/BinaryMessenger.java +++ b/shell/platform/android/io/flutter/plugin/common/BinaryMessenger.java @@ -11,6 +11,11 @@ * The Flutter Dart code should use * BinaryMessages * to participate. + *

+ * {@code BinaryMessenger} is expected to be utilized from a single thread throughout the duration + * of its existence. If created on the main thread, then all invocations should take place on the + * main thread. If created on a background thread, then all invocations should take place on that + * background thread. * * @see BasicMessageChannel , which supports message passing with Strings and semi-structured messages. * @see MethodChannel , which supports communication using asynchronous method invocation. diff --git a/shell/platform/android/io/flutter/plugin/common/MethodChannel.java b/shell/platform/android/io/flutter/plugin/common/MethodChannel.java index d16671bc1c91e..9f725e7bdf545 100644 --- a/shell/platform/android/io/flutter/plugin/common/MethodChannel.java +++ b/shell/platform/android/io/flutter/plugin/common/MethodChannel.java @@ -4,6 +4,7 @@ package io.flutter.plugin.common; +import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.Log; import io.flutter.plugin.common.BinaryMessenger.BinaryMessageHandler; @@ -66,7 +67,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, @Nullable Object arguments) { + public void invokeMethod(@NonNull String method, @Nullable Object arguments) { invokeMethod(method, arguments, null); } diff --git a/shell/platform/android/io/flutter/view/FlutterNativeView.java b/shell/platform/android/io/flutter/view/FlutterNativeView.java index c18f259f51e77..5988840ca7d3e 100644 --- a/shell/platform/android/io/flutter/view/FlutterNativeView.java +++ b/shell/platform/android/io/flutter/view/FlutterNativeView.java @@ -179,7 +179,7 @@ private void attach(FlutterNativeView view, boolean isBackgroundView) { private final class PlatformMessageHandlerImpl implements PlatformMessageHandler { // Called by native to send us a platform message. - public void handlePlatformMessage(final String channel, byte[] message, final int replyId) { + public void handleMessageFromDart(final String channel, byte[] message, final int replyId) { assertAttached(); BinaryMessageHandler handler = mMessageHandlers.get(channel); if (handler != null) { @@ -190,7 +190,7 @@ public void handlePlatformMessage(final String channel, byte[] message, final in @Override public void reply(ByteBuffer reply) { if (!isAttached()) { - Log.d(TAG, "handlePlatformMessage replying ot a detached view, channel=" + channel); + Log.d(TAG, "handleMessageFromDart replying ot a detached view, channel=" + channel); return; } if (done.getAndSet(true)) { diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index e7d8c74ac6ddb..49c2c8d6d694d 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -27,7 +27,12 @@ import android.view.inputmethod.InputMethodManager; import io.flutter.app.FlutterPluginRegistry; import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.embedding.engine.systemchannels.KeyEventChannel; +import io.flutter.embedding.engine.systemchannels.LifecycleChannel; +import io.flutter.embedding.engine.systemchannels.LocalizationChannel; +import io.flutter.embedding.engine.systemchannels.NavigationChannel; import io.flutter.embedding.engine.systemchannels.SettingsChannel; +import io.flutter.embedding.engine.systemchannels.SystemChannel; import io.flutter.plugin.common.*; import io.flutter.plugin.editing.TextInputPlugin; import io.flutter.plugin.platform.PlatformPlugin; @@ -81,17 +86,17 @@ static final class ViewportMetrics { } private final DartExecutor dartExecutor; + private final NavigationChannel navigationChannel; + private final KeyEventChannel keyEventChannel; + private final LifecycleChannel lifecycleChannel; + private final SettingsChannel settingsChannel; + private final SystemChannel systemChannel; private final InputMethodManager mImm; private final TextInputPlugin mTextInputPlugin; private final SurfaceHolder.Callback mSurfaceCallback; private final ViewportMetrics mMetrics; private final AccessibilityManager mAccessibilityManager; private final MethodChannel mFlutterLocalizationChannel; - private final MethodChannel mFlutterNavigationChannel; - private final BasicMessageChannel mFlutterKeyEventChannel; - private final BasicMessageChannel mFlutterLifecycleChannel; - private final BasicMessageChannel mFlutterSystemChannel; - private final SettingsChannel settingsChannel; private final List mActivityLifecycleListeners; private final List mFirstFrameListeners; private final AtomicLong nextTextureId = new AtomicLong(0L); @@ -154,12 +159,12 @@ public void surfaceDestroyed(SurfaceHolder holder) { mFirstFrameListeners = new ArrayList<>(); // Configure the platform plugins and flutter channels. - mFlutterLocalizationChannel = new MethodChannel(this, "flutter/localization", JSONMethodCodec.INSTANCE); - mFlutterNavigationChannel = new MethodChannel(this, "flutter/navigation", JSONMethodCodec.INSTANCE); - mFlutterKeyEventChannel = new BasicMessageChannel<>(this, "flutter/keyevent", JSONMessageCodec.INSTANCE); - mFlutterLifecycleChannel = new BasicMessageChannel<>(this, "flutter/lifecycle", StringCodec.INSTANCE); - mFlutterSystemChannel = new BasicMessageChannel<>(this, "flutter/system", JSONMessageCodec.INSTANCE); + navigationChannel = new NavigationChannel(dartExecutor); + keyEventChannel = new KeyEventChannel(dartExecutor); + lifecycleChannel = new LifecycleChannel(dartExecutor); + systemChannel = new SystemChannel(dartExecutor); settingsChannel = new SettingsChannel(dartExecutor); + mFlutterLocalizationChannel = new MethodChannel(this, "flutter/localization", JSONMethodCodec.INSTANCE); PlatformPlugin platformPlugin = new PlatformPlugin(activity); MethodChannel flutterPlatformChannel = new MethodChannel(this, "flutter/platform", JSONMethodCodec.INSTANCE); @@ -173,25 +178,12 @@ public void surfaceDestroyed(SurfaceHolder holder) { sendUserPlatformSettingsToDart(); } - private void encodeKeyEvent(KeyEvent event, Map message) { - message.put("flags", event.getFlags()); - message.put("codePoint", event.getUnicodeChar()); - message.put("keyCode", event.getKeyCode()); - message.put("scanCode", event.getScanCode()); - message.put("metaState", event.getMetaState()); - } - @Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (!isAttached()) { return super.onKeyUp(keyCode, event); } - - Map message = new HashMap<>(); - message.put("type", "keyup"); - message.put("keymap", "android"); - encodeKeyEvent(event, message); - mFlutterKeyEventChannel.send(message); + keyEventChannel.keyUp(event); return super.onKeyUp(keyCode, event); } @@ -207,11 +199,7 @@ public boolean onKeyDown(int keyCode, KeyEvent event) { } } - Map message = new HashMap<>(); - message.put("type", "keydown"); - message.put("keymap", "android"); - encodeKeyEvent(event, message); - mFlutterKeyEventChannel.send(message); + keyEventChannel.keyDown(event); return super.onKeyDown(keyCode, event); } @@ -236,11 +224,11 @@ public void addActivityLifecycleListener(ActivityLifecycleListener listener) { } public void onStart() { - mFlutterLifecycleChannel.send("AppLifecycleState.inactive"); + lifecycleChannel.appIsInactive(); } public void onPause() { - mFlutterLifecycleChannel.send("AppLifecycleState.inactive"); + lifecycleChannel.appIsInactive(); } public void onPostResume() { @@ -248,17 +236,15 @@ public void onPostResume() { for (ActivityLifecycleListener listener : mActivityLifecycleListeners) { listener.onPostResume(); } - mFlutterLifecycleChannel.send("AppLifecycleState.resumed"); + lifecycleChannel.appIsResumed(); } public void onStop() { - mFlutterLifecycleChannel.send("AppLifecycleState.paused"); + lifecycleChannel.appIsPaused(); } public void onMemoryPressure() { - Map message = new HashMap<>(1); - message.put("type", "memoryPressure"); - mFlutterSystemChannel.send(message); + systemChannel.sendMemoryPressureWarning(); } /** @@ -297,15 +283,15 @@ public void disableTransparentBackground() { } public void setInitialRoute(String route) { - mFlutterNavigationChannel.invokeMethod("setInitialRoute", route); + navigationChannel.setInitialRoute(route); } public void pushRoute(String route) { - mFlutterNavigationChannel.invokeMethod("pushRoute", route); + navigationChannel.pushRoute(route); } public void popRoute() { - mFlutterNavigationChannel.invokeMethod("popRoute", null); + navigationChannel.popRoute(); } private void sendUserPlatformSettingsToDart() { From 053f7a8fa3bb4c50c28451f5403f176846692ce0 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 6 Feb 2019 23:33:44 -0500 Subject: [PATCH 0075/1117] Roll src/third_party/skia 2fc1474f9d62..f36ad269e88a (2 commits) (#7724) https://skia.googlesource.com/skia.git/%2Blog/2fc1474f9d62..f36ad269e88a git log 2fc1474f9d62db4b854fd4e5af322f41a323ffe5..f36ad269e88a1b2fec16e6404cd6cd36bc202115 --date=short --no-merges --format=%ad %ae %s 2019-02-06 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-04 reed@google.com move SkMetaData into src The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index 908000aada017..33d57e2f3889d 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': '2fc1474f9d62db4b854fd4e5af322f41a323ffe5', + 'skia_revision': 'f36ad269e88a1b2fec16e6404cd6cd36bc202115', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 37ae1a542a38b..9026d0b99dcae 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: a7e934aefd676fac1ba45d5773925b60 +Signature: 36a800b4fd73b99bfa7017a2123c2129 UNUSED LICENSES: @@ -4405,7 +4405,6 @@ FILE: ../../../third_party/skia/include/core/SkGraphics.h FILE: ../../../third_party/skia/include/core/SkMaskFilter.h FILE: ../../../third_party/skia/include/core/SkMath.h FILE: ../../../third_party/skia/include/core/SkMatrix.h -FILE: ../../../third_party/skia/include/core/SkMetaData.h FILE: ../../../third_party/skia/include/core/SkPaint.h FILE: ../../../third_party/skia/include/core/SkPath.h FILE: ../../../third_party/skia/include/core/SkPathEffect.h @@ -4477,7 +4476,6 @@ FILE: ../../../third_party/skia/src/core/SkGraphics.cpp FILE: ../../../third_party/skia/src/core/SkMask.h FILE: ../../../third_party/skia/src/core/SkMaskFilter.cpp FILE: ../../../third_party/skia/src/core/SkMatrix.cpp -FILE: ../../../third_party/skia/src/core/SkMetaData.cpp FILE: ../../../third_party/skia/src/core/SkModeColorFilter.cpp FILE: ../../../third_party/skia/src/core/SkOSFile.h FILE: ../../../third_party/skia/src/core/SkPaint.cpp @@ -4536,6 +4534,8 @@ FILE: ../../../third_party/skia/src/shaders/gradients/SkGradientShader.cpp FILE: ../../../third_party/skia/src/utils/SkBase64.cpp FILE: ../../../third_party/skia/src/utils/SkBase64.h FILE: ../../../third_party/skia/src/utils/SkCamera.cpp +FILE: ../../../third_party/skia/src/utils/SkMetaData.cpp +FILE: ../../../third_party/skia/src/utils/SkMetaData.h FILE: ../../../third_party/skia/src/utils/SkParse.cpp FILE: ../../../third_party/skia/src/utils/SkParseColor.cpp FILE: ../../../third_party/skia/src/xml/SkDOM.cpp From ee0cf82c1f21072a968ab383add470ea40121603 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Wed, 6 Feb 2019 22:24:15 -0800 Subject: [PATCH 0076/1117] Correct libraries.yaml path for stub_ui, add brightness, copy dart2js_platform.dill files (#7725) --- BUILD.gn | 16 +++++++ lib/stub_ui/BUILD.gn | 2 +- lib/stub_ui/libraries.json | 88 +++++++++++++++++------------------ lib/stub_ui/libraries.yaml | 95 ++++++++++++++++++-------------------- lib/stub_ui/window.dart | 15 ++++++ 5 files changed, 121 insertions(+), 95 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index fc9d0c930dc67..cc9b9dff1eb69 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -36,6 +36,7 @@ group("flutter") { "$flutter_root/frontend_server", "//third_party/dart:create_sdk", "$flutter_root/lib/stub_ui:stub_ui", + ":dart2js_platform_files" ] foreach(snapshot, _flutter_sdk_snapshots) { public_deps += [ ":copy_flutter_${snapshot[0]}_snapshot" ] @@ -91,3 +92,18 @@ foreach(snapshot, _flutter_sdk_snapshots) { ] } } + +copy("dart2js_platform_files") { + deps = [ + "//third_party/dart/utils/compiler:compile_dart2js_platform" + ] + + sources = [ + "$root_out_dir/dart2js_outline.dill", + "$root_out_dir/dart2js_platform.dill", + ] + + outputs = [ + "$root_out_dir/flutter_patched_sdk/{{source_file_part}}", + ] +} diff --git a/lib/stub_ui/BUILD.gn b/lib/stub_ui/BUILD.gn index 22bc913b291b9..fc7fc43c9ca7a 100644 --- a/lib/stub_ui/BUILD.gn +++ b/lib/stub_ui/BUILD.gn @@ -22,7 +22,7 @@ copy("stub_ui") { ] deps = [ - ":stub_libraries" + ":stub_libraries", ] outputs = [ diff --git a/lib/stub_ui/libraries.json b/lib/stub_ui/libraries.json index 183ce7a8c5fe2..60313c4ce6cbc 100644 --- a/lib/stub_ui/libraries.json +++ b/lib/stub_ui/libraries.json @@ -4,118 +4,118 @@ "dart2js": { "libraries": { "async": { - "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart", - "uri": "../../dart-sdk/lib/async/async.dart" + "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart", + "uri": "../../../../dart-sdk/lib/async/async.dart" }, "_interceptors": { - "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/interceptors.dart" + "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/interceptors.dart" }, "mirrors": { - "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart", + "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart", "supported": false, - "uri": "../../dart-sdk/lib/mirrors/mirrors.dart" + "uri": "../../../../dart-sdk/lib/mirrors/mirrors.dart" }, "_js_embedded_names": { - "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart" + "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart" }, "io": { - "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/io_patch.dart", + "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/io_patch.dart", "supported": false, - "uri": "../../dart-sdk/lib/io/io.dart" + "uri": "../../../../dart-sdk/lib/io/io.dart" }, "_internal": { - "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/internal_patch.dart", - "uri": "../../dart-sdk/lib/internal/internal.dart" + "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/internal_patch.dart", + "uri": "../../../../dart-sdk/lib/internal/internal.dart" }, "_metadata": { - "uri": "../../dart-sdk/lib/html/html_common/metadata.dart" + "uri": "../../../../dart-sdk/lib/html/html_common/metadata.dart" }, "_async_await_error_codes": { - "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart" + "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart" }, "_http": { - "uri": "../../dart-sdk/lib/_http/http.dart" + "uri": "../../../../dart-sdk/lib/_http/http.dart" }, "_js_primitives": { - "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/js_primitives.dart" + "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/js_primitives.dart" }, "_js_helper": { - "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/js_helper.dart" + "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/js_helper.dart" }, "_chrome": { - "uri": "../../dart-sdk/lib/_chrome/dart2js/chrome_dart2js.dart" + "uri": "../../../../dart-sdk/lib/_chrome/dart2js/chrome_dart2js.dart" }, "html_common": { - "uri": "../../dart-sdk/lib/html/html_common/html_common_dart2js.dart" + "uri": "../../../../dart-sdk/lib/html/html_common/html_common_dart2js.dart" }, "ui": { "uri": "stub_ui/ui.dart" }, "js": { - "uri": "../../dart-sdk/lib/js/dart2js/js_dart2js.dart" + "uri": "../../../../dart-sdk/lib/js/dart2js/js_dart2js.dart" }, "_native_typed_data": { - "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/native_typed_data.dart" + "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/native_typed_data.dart" }, "_js_names": { - "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/js_names.dart" + "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/js_names.dart" }, "core": { - "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/core_patch.dart", - "uri": "../../dart-sdk/lib/core/core.dart" + "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/core_patch.dart", + "uri": "../../../../dart-sdk/lib/core/core.dart" }, "collection": { - "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/collection_patch.dart", - "uri": "../../dart-sdk/lib/collection/collection.dart" + "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/collection_patch.dart", + "uri": "../../../../dart-sdk/lib/collection/collection.dart" }, "js_util": { - "uri": "../../dart-sdk/lib/js_util/dart2js/js_util_dart2js.dart" + "uri": "../../../../dart-sdk/lib/js_util/dart2js/js_util_dart2js.dart" }, "typed_data": { - "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/typed_data_patch.dart", - "uri": "../../dart-sdk/lib/typed_data/typed_data.dart" + "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/typed_data_patch.dart", + "uri": "../../../../dart-sdk/lib/typed_data/typed_data.dart" }, "web_audio": { - "uri": "../../dart-sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" + "uri": "../../../../dart-sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" }, "html": { - "uri": "../../dart-sdk/lib/html/dart2js/html_dart2js.dart" + "uri": "../../../../dart-sdk/lib/html/dart2js/html_dart2js.dart" }, "isolate": { - "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/isolate_patch.dart", + "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/isolate_patch.dart", "supported": false, - "uri": "../../dart-sdk/lib/isolate/isolate.dart" + "uri": "../../../../dart-sdk/lib/isolate/isolate.dart" }, "developer": { - "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/developer_patch.dart", - "uri": "../../dart-sdk/lib/developer/developer.dart" + "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/developer_patch.dart", + "uri": "../../../../dart-sdk/lib/developer/developer.dart" }, "web_gl": { - "uri": "../../dart-sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" + "uri": "../../../../dart-sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" }, "indexed_db": { - "uri": "../../dart-sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" + "uri": "../../../../dart-sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" }, "_js": { - "patches": "../../dart-sdk/lib/js/_js_client.dart", - "uri": "../../dart-sdk/lib/js/_js.dart" + "patches": "../../../../dart-sdk/lib/js/_js_client.dart", + "uri": "../../../../dart-sdk/lib/js/_js.dart" }, "convert": { - "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/convert_patch.dart", - "uri": "../../dart-sdk/lib/convert/convert.dart" + "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/convert_patch.dart", + "uri": "../../../../dart-sdk/lib/convert/convert.dart" }, "math": { - "patches": "../../dart-sdk/lib/_internal/js_runtime/lib/math_patch.dart", - "uri": "../../dart-sdk/lib/math/math.dart" + "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/math_patch.dart", + "uri": "../../../../dart-sdk/lib/math/math.dart" }, "_foreign_helper": { - "uri": "../../dart-sdk/lib/_internal/js_runtime/lib/foreign_helper.dart" + "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/foreign_helper.dart" }, "web_sql": { - "uri": "../../dart-sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" + "uri": "../../../../dart-sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" }, "svg": { - "uri": "../../dart-sdk/lib/svg/dart2js/svg_dart2js.dart" + "uri": "../../../../dart-sdk/lib/svg/dart2js/svg_dart2js.dart" } } } diff --git a/lib/stub_ui/libraries.yaml b/lib/stub_ui/libraries.yaml index 39196be63e5c9..aded84171f6e5 100644 --- a/lib/stub_ui/libraries.yaml +++ b/lib/stub_ui/libraries.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file +# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. @@ -11,123 +11,118 @@ # changing libraries, sources, and patch files. See # https://github.com/dart-lang/sdk/issues/28836. -# These paths are relative to the source location in the flutter cache under -# the flutter_patched_sdk -# bin/cache/ -# dart-sdk/ -# engine/common/flutter_patched_sdk dart2js: libraries: ui: uri: "stub_ui/ui.dart" async: - uri: "../../dart-sdk/lib/async/async.dart" - patches: "../../dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart" + uri: "../../../../dart-sdk/lib/async/async.dart" + patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart" _chrome: - uri: "../../dart-sdk/lib/_chrome/dart2js/chrome_dart2js.dart" + uri: "../../../../dart-sdk/lib/_chrome/dart2js/chrome_dart2js.dart" collection: - uri: "../../dart-sdk/lib/collection/collection.dart" - patches: "../../dart-sdk/lib/_internal/js_runtime/lib/collection_patch.dart" + uri: "../../../../dart-sdk/lib/collection/collection.dart" + patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/collection_patch.dart" convert: - uri: "../../dart-sdk/lib/convert/convert.dart" - patches: "../../dart-sdk/lib/_internal/js_runtime/lib/convert_patch.dart" + uri: "../../../../dart-sdk/lib/convert/convert.dart" + patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/convert_patch.dart" core: - uri: "../../dart-sdk/lib/core/core.dart" - patches: "../../dart-sdk/lib/_internal/js_runtime/lib/core_patch.dart" + uri: "../../../../dart-sdk/lib/core/core.dart" + patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/core_patch.dart" developer: - uri: "../../dart-sdk/lib/developer/developer.dart" - patches: "../../dart-sdk/lib/_internal/js_runtime/lib/developer_patch.dart" + uri: "../../../../dart-sdk/lib/developer/developer.dart" + patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/developer_patch.dart" html: - uri: "../../dart-sdk/lib/html/dart2js/html_dart2js.dart" + uri: "../../../../dart-sdk/lib/html/dart2js/html_dart2js.dart" html_common: - uri: "../../dart-sdk/lib/html/html_common/html_common_dart2js.dart" + uri: "../../../../dart-sdk/lib/html/html_common/html_common_dart2js.dart" indexed_db: - uri: "../../dart-sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" + uri: "../../../../dart-sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" _http: - uri: "../../dart-sdk/lib/_http/http.dart" + uri: "../../../../dart-sdk/lib/_http/http.dart" io: - uri: "../../dart-sdk/lib/io/io.dart" - patches: "../../dart-sdk/lib/_internal/js_runtime/lib/io_patch.dart" + uri: "../../../../dart-sdk/lib/io/io.dart" + patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/io_patch.dart" supported: false isolate: - uri: "../../dart-sdk/lib/isolate/isolate.dart" - patches: "../../dart-sdk/lib/_internal/js_runtime/lib/isolate_patch.dart" + uri: "../../../../dart-sdk/lib/isolate/isolate.dart" + patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/isolate_patch.dart" supported: false js: - uri: "../../dart-sdk/lib/js/dart2js/js_dart2js.dart" + uri: "../../../../dart-sdk/lib/js/dart2js/js_dart2js.dart" _js: - uri: "../../dart-sdk/lib/js/_js.dart" - patches: "../../dart-sdk/lib/js/_js_client.dart" + uri: "../../../../dart-sdk/lib/js/_js.dart" + patches: "../../../../dart-sdk/lib/js/_js_client.dart" js_util: - uri: "../../dart-sdk/lib/js_util/dart2js/js_util_dart2js.dart" + uri: "../../../../dart-sdk/lib/js_util/dart2js/js_util_dart2js.dart" math: - uri: "../../dart-sdk/lib/math/math.dart" - patches: "../../dart-sdk/lib/_internal/js_runtime/lib/math_patch.dart" + uri: "../../../../dart-sdk/lib/math/math.dart" + patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/math_patch.dart" mirrors: - uri: "../../dart-sdk/lib/mirrors/mirrors.dart" - patches: "../../dart-sdk/lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart" + uri: "../../../../dart-sdk/lib/mirrors/mirrors.dart" + patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart" supported: false typed_data: - uri: "../../dart-sdk/lib/typed_data/typed_data.dart" - patches: "../../dart-sdk/lib/_internal/js_runtime/lib/typed_data_patch.dart" + uri: "../../../../dart-sdk/lib/typed_data/typed_data.dart" + patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/typed_data_patch.dart" _native_typed_data: - uri: "../../dart-sdk/lib/_internal/js_runtime/lib/native_typed_data.dart" + uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/native_typed_data.dart" svg: - uri: "../../dart-sdk/lib/svg/dart2js/svg_dart2js.dart" + uri: "../../../../dart-sdk/lib/svg/dart2js/svg_dart2js.dart" web_audio: - uri: "../../dart-sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" + uri: "../../../../dart-sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" web_gl: - uri: "../../dart-sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" + uri: "../../../../dart-sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" web_sql: - uri: "../../dart-sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" + uri: "../../../../dart-sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" _internal: - uri: "../../dart-sdk/lib/internal/internal.dart" - patches: "../../dart-sdk/lib/_internal/js_runtime/lib/internal_patch.dart" + uri: "../../../../dart-sdk/lib/internal/internal.dart" + patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/internal_patch.dart" _js_helper: - uri: "../../dart-sdk/lib/_internal/js_runtime/lib/js_helper.dart" + uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/js_helper.dart" _interceptors: - uri: "../../dart-sdk/lib/_internal/js_runtime/lib/interceptors.dart" + uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/interceptors.dart" _foreign_helper: - uri: "../../dart-sdk/lib/_internal/js_runtime/lib/foreign_helper.dart" + uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/foreign_helper.dart" _js_names: - uri: "../../dart-sdk/lib/_internal/js_runtime/lib/js_names.dart" + uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/js_names.dart" _js_primitives: - uri: "../../dart-sdk/lib/_internal/js_runtime/lib/js_primitives.dart" + uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/js_primitives.dart" _js_embedded_names: - uri: "../../dart-sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart" + uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart" _async_await_error_codes: - uri: "../../dart-sdk/lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart" + uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart" _metadata: - uri: "../../dart-sdk/lib/html/html_common/metadata.dart" \ No newline at end of file + uri: "../../../../dart-sdk/lib/html/html_common/metadata.dart" \ No newline at end of file diff --git a/lib/stub_ui/window.dart b/lib/stub_ui/window.dart index 4fd096aa5e7af..f9820eec96503 100644 --- a/lib/stub_ui/window.dart +++ b/lib/stub_ui/window.dart @@ -909,6 +909,21 @@ class AccessibilityFeatures { int get hashCode => _index.hashCode; } +/// Describes the contrast of a theme or color palette. +enum Brightness { + /// The color is dark and will require a light text color to achieve readable + /// contrast. + /// + /// For example, the color might be dark grey, requiring white text. + dark, + + /// The color is light and will require a dark text color to achieve readable + /// contrast. + /// + /// For example, the color might be bright white, requiring black text. + light, +} + /// The [Window] singleton. This object exposes the size of the display, the /// core scheduler API, the input event callback, the graphics drawing API, and /// other such core services. From 168cabc973e833c590136bb46f5f43fb1de9c6f6 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 7 Feb 2019 03:18:27 -0500 Subject: [PATCH 0077/1117] Roll src/third_party/skia f36ad269e88a..859db6b5a03c (1 commits) (#7727) https://skia.googlesource.com/skia.git/%2Blog/f36ad269e88a..859db6b5a03c git log f36ad269e88a1b2fec16e6404cd6cd36bc202115..859db6b5a03c4d87df06ff3f4b289bda4b5c4022 --date=short --no-merges --format=%ad %ae %s 2019-02-07 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 33d57e2f3889d..aa1ef23e442c3 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': 'f36ad269e88a1b2fec16e6404cd6cd36bc202115', + 'skia_revision': '859db6b5a03c4d87df06ff3f4b289bda4b5c4022', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 9026d0b99dcae..5d30b7e83f2e3 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 36a800b4fd73b99bfa7017a2123c2129 +Signature: 2fdd4f3fd3693b30e8f110ab16f926a2 UNUSED LICENSES: From d0fee9b280297cb45820924ca3ba7f7e01495ce4 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 7 Feb 2019 01:06:57 -0800 Subject: [PATCH 0078/1117] Roll src/third_party/dart caa8747a37..6c680a0ebd (12 commits) 6c680a0ebd Update dartfix readme and update version numbers 33337cf8d0 Fix API breakage, reexport ConstantEvaluator. c2cdc1c639 Allow migration of multiple files at once. d68d8526f4 Allow nullabilty migration prepareInput/processInput to operate on different ASTs. 5ecf660b50 [dartdevc] skip co19 tests on linux bots ba9fbda83e Rework provisional migration API. a4b681b83a Update dartdoc to 0.28.1+2. fea5413d5a [ VM ] Fix hang of Flutter engine tests caused by global RuntimeEntry objects being destroyed when exit() is called when the VM hasn't finished shutting down. a5570bd995 [vm/compiler] Add optimization flag f0d5cb73a9 Guard the custom formatter for a Map against errors df779789f2 Support two more cases in the convert-to-spread assist (issue 35867) fd2225ab6c Adapt to the flow analysis spec v2. --- DEPS | 4 ++-- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index aa1ef23e442c3..8f6681673c761 100644 --- a/DEPS +++ b/DEPS @@ -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': 'caa8747a377778f4349ff416d6e9aa7a7e410837', + 'dart_revision': '6c680a0ebd195d60bb80fd68f92aed1626db997e', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -49,7 +49,7 @@ vars = { 'dart_csslib_tag': '0.14.4+1', 'dart_dart2js_info_tag': '0.5.15', 'dart_dart_style_tag': '1.2.2', - 'dart_dartdoc_tag': 'v0.28.0', + 'dart_dartdoc_tag': 'v0.28.1+2', 'dart_fixnum_tag': '0.10.9', 'dart_glob_tag': '1.1.7', 'dart_html_tag': '0.13.3+2', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 7327ca204ea19..f3e36c3e5c73a 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: b3a9b7d84197e4af9acec558e5c89894 +Signature: fd8b05c8fdf470d9f4330846e131a5fe UNUSED LICENSES: From 473097b53d22ef3368ebdcb5a2e1804bca04ec92 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 7 Feb 2019 07:04:30 -0500 Subject: [PATCH 0079/1117] Roll src/third_party/skia 859db6b5a03c..c19d81acc096 (2 commits) (#7729) https://skia.googlesource.com/skia.git/%2Blog/859db6b5a03c..c19d81acc096 git log 859db6b5a03c4d87df06ff3f4b289bda4b5c4022..c19d81acc0965eff7ac1f8a2f9e544dfc86a230f --date=short --no-merges --format=%ad %ae %s 2019-02-07 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src c27b32b2fd52..635f11205d4b (414 commits) 2019-02-07 csmartdalton@google.com Revert "Add a GpuGM class for GPU-only tests" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 8f6681673c761..9d943f0f5b392 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': '859db6b5a03c4d87df06ff3f4b289bda4b5c4022', + 'skia_revision': 'c19d81acc0965eff7ac1f8a2f9e544dfc86a230f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 5d30b7e83f2e3..9291606a027e4 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2fdd4f3fd3693b30e8f110ab16f926a2 +Signature: 3d4daec7c9b6e2647ba4018c2771bd82 UNUSED LICENSES: From d292ed6c235d538dc7b84463696db0201fab9590 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 7 Feb 2019 10:49:38 -0500 Subject: [PATCH 0080/1117] Roll src/third_party/skia c19d81acc096..9564bf44e5fa (5 commits) (#7730) https://skia.googlesource.com/skia.git/%2Blog/c19d81acc096..9564bf44e5fa git log c19d81acc0965eff7ac1f8a2f9e544dfc86a230f..9564bf44e5fa000c32ae9390326181dbd89c4b59 --date=short --no-merges --format=%ad %ae %s 2019-02-06 benjaminwagner@google.com Upgrade NVIDIA driver on Ubuntu18 QuadroP400 bots. 2019-02-06 egdaniel@google.com Add support for importing AHardwareBuffers into SkSurfaces. 2019-02-07 scroggo@google.com SkWuffsCodec: Initialize memory when incomplete 2019-02-07 kjlubick@google.com Add a k8s cheat sheet to trooper docs 2019-02-06 reed@google.com Hide setDrawLooper -- deprecate loopers The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 9d943f0f5b392..7b8f1b9f43e75 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': 'c19d81acc0965eff7ac1f8a2f9e544dfc86a230f', + 'skia_revision': '9564bf44e5fa000c32ae9390326181dbd89c4b59', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 9291606a027e4..71ea4d5bbec76 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 3d4daec7c9b6e2647ba4018c2771bd82 +Signature: f4ff8040dcefe800abe8f206b00e11a4 UNUSED LICENSES: @@ -4347,6 +4347,8 @@ FILE: ../../../third_party/skia/include/private/SkVx.h FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp +FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.cpp +FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.h FILE: ../../../third_party/skia/src/gpu/GrBaseContextPriv.h FILE: ../../../third_party/skia/src/gpu/GrContextPriv.cpp FILE: ../../../third_party/skia/src/gpu/GrContextThreadSafeProxy.cpp From 3c38dd342f53d39603d1c5b138b5e4d36d93720f Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 7 Feb 2019 08:53:31 -0800 Subject: [PATCH 0081/1117] Fix versions implementation (#7726) --- lib/ui/versions.cc | 2 +- testing/dart/versions_test.dart | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/ui/versions.cc b/lib/ui/versions.cc index 37c18613240c8..b044621a86916 100644 --- a/lib/ui/versions.cc +++ b/lib/ui/versions.cc @@ -25,7 +25,7 @@ void GetVersions(Dart_NativeArguments args) { } void Versions::RegisterNatives(tonic::DartLibraryNatives* natives) { - natives->Register({{"Versions_getVersions", GetVersions, 1, true}}); + natives->Register({{"Versions_getVersions", GetVersions, 0, true}}); } } // namespace blink diff --git a/testing/dart/versions_test.dart b/testing/dart/versions_test.dart index 4de21ef252966..91935c76a58bc 100644 --- a/testing/dart/versions_test.dart +++ b/testing/dart/versions_test.dart @@ -2,13 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// HACK: pretend to be dart.ui in order to access its internals -library dart.ui; +import 'dart:ui'; import 'package:test/test.dart'; -part '../../lib/ui/versions.dart'; - bool _isNotEmpty(String s) { if (s == null || s.isEmpty) { return false; From c40d6dacc78b8c25a2822ec8c6f47aa46f642c5f Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Thu, 7 Feb 2019 10:45:21 -0800 Subject: [PATCH 0082/1117] [fuchsia] Update scenic include (#7708) This header is now spelled thusly. --- flow/layers/clip_path_layer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow/layers/clip_path_layer.cc b/flow/layers/clip_path_layer.cc index a8b23ee4903b8..d119ea606d758 100644 --- a/flow/layers/clip_path_layer.cc +++ b/flow/layers/clip_path_layer.cc @@ -6,7 +6,7 @@ #if defined(OS_FUCHSIA) -#include "lib/ui/scenic/fidl_helpers.h" // nogncheck +#include "lib/ui/scenic/cpp/commands.h" #endif // defined(OS_FUCHSIA) From 4e13ede57e4ecbef82faf492efdd40f2b7c2afe0 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 7 Feb 2019 14:49:34 -0500 Subject: [PATCH 0083/1117] Roll src/third_party/skia 9564bf44e5fa..8619a34bb875 (10 commits) (#7732) https://skia.googlesource.com/skia.git/%2Blog/9564bf44e5fa..8619a34bb875 git log 9564bf44e5fa000c32ae9390326181dbd89c4b59..8619a34bb87565dfcfc3818ceab065e93ea183e6 --date=short --no-merges --format=%ad %ae %s 2019-02-07 reed@google.com Revert "Hide setDrawLooper -- deprecate loopers" 2019-02-07 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-07 brianosman@google.com Remove duplicate entry in harfbuzz GN file 2019-02-07 bsalomon@google.com Use different classes for client side arrays and GPU buffer objects. 2019-02-07 abarth@google.com [fuchsia] Update path to fuchsia.fonts 2019-02-06 robertphillips@google.com Add support for Mtl backend to DeferredDisplayListTest 2019-02-07 fmalita@chromium.org [skshaper] Add per-line callback 2019-02-07 jvanverth@google.com Set correct uniform size for Metal. 2019-02-07 fmalita@chromium.org [skottie] Use SkShaper for text 2019-02-07 mtklein@google.com move Reporter::reportFailedWithContext() out of line The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index 7b8f1b9f43e75..bbb03b68ad9fb 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': '9564bf44e5fa000c32ae9390326181dbd89c4b59', + 'skia_revision': '8619a34bb87565dfcfc3818ceab065e93ea183e6', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 71ea4d5bbec76..ce8807155c8d0 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f4ff8040dcefe800abe8f206b00e11a4 +Signature: 4429bc6b2c346cb26cff0ef1e4042cf7 UNUSED LICENSES: @@ -695,8 +695,6 @@ FILE: ../../../third_party/skia/src/gpu/GrAppliedClip.h FILE: ../../../third_party/skia/src/gpu/GrAuditTrail.cpp FILE: ../../../third_party/skia/src/gpu/GrBitmapTextureMaker.cpp FILE: ../../../third_party/skia/src/gpu/GrBitmapTextureMaker.h -FILE: ../../../third_party/skia/src/gpu/GrBuffer.cpp -FILE: ../../../third_party/skia/src/gpu/GrBuffer.h FILE: ../../../third_party/skia/src/gpu/GrClipStackClip.cpp FILE: ../../../third_party/skia/src/gpu/GrClipStackClip.h FILE: ../../../third_party/skia/src/gpu/GrColorSpaceXform.cpp @@ -4350,9 +4348,13 @@ FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.cpp FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.h FILE: ../../../third_party/skia/src/gpu/GrBaseContextPriv.h +FILE: ../../../third_party/skia/src/gpu/GrBuffer.h FILE: ../../../third_party/skia/src/gpu/GrContextPriv.cpp FILE: ../../../third_party/skia/src/gpu/GrContextThreadSafeProxy.cpp FILE: ../../../third_party/skia/src/gpu/GrContext_Base.cpp +FILE: ../../../third_party/skia/src/gpu/GrCpuBuffer.h +FILE: ../../../third_party/skia/src/gpu/GrGpuBuffer.cpp +FILE: ../../../third_party/skia/src/gpu/GrGpuBuffer.h FILE: ../../../third_party/skia/src/gpu/GrImageContext.cpp FILE: ../../../third_party/skia/src/gpu/GrImageContextPriv.h FILE: ../../../third_party/skia/src/gpu/GrRecordingContext.cpp From 4f3eb42dfd8ac734a75c2b9b29fefe3001ceec4a Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 7 Feb 2019 14:14:44 -0800 Subject: [PATCH 0084/1117] Update documentation for command line args in FlutterProjectArgs. (#7733) --- common/settings.h | 4 ++-- shell/platform/embedder/embedder.h | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/common/settings.h b/common/settings.h index d51052f3c1ee6..c95e6eb7a5210 100644 --- a/common/settings.h +++ b/common/settings.h @@ -97,8 +97,8 @@ struct Settings { std::function idle_notification_callback; // A callback given to the embedder to react to unhandled exceptions in the // running Flutter application. This callback is made on an internal engine - // managed thread and embedders must thread as necessary. Performing blocking - // calls in this callback will cause applications to jank. + // managed thread and embedders must re-thread as necessary. Performing + // blocking calls in this callback will cause applications to jank. UnhandledExceptionCallback unhandled_exception_callback; bool enable_software_rendering = false; bool skia_deterministic_rendering_on_cpu = false; diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index e0603644f449b..cebe9d6b74dd9 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -218,6 +218,14 @@ typedef struct { // The command line arguments used to initialize the project. The strings can // be collected after the call to |FlutterEngineRun| returns. The strings must // be NULL terminated. + // Note: The first item in the command line (if specificed at all) is + // interpreted as the executable name. So if an engine flag needs to be passed + // into the same, it needs to not be the very first item in the list. The set + // of engine flags are only meant to control unstable features in the engine. + // Deployed applications should not pass any command line arguments at all as + // they may affect engine stability at runtime in the presence of unsanitized + // input. The list of currently recognized engine flags and their descriptions + // can be retrieved from the |switches.h| engine source file. const char* const* command_line_argv; // The callback invoked by the engine in order to give the embedder the chance // to respond to platform messages from the Dart application. The callback From b0370c13c302bc747f0cb3736a3a79e79ae4f7cd Mon Sep 17 00:00:00 2001 From: Michael Klimushyn Date: Thu, 7 Feb 2019 14:47:23 -0800 Subject: [PATCH 0085/1117] Decode using the last cached required frame (#7715) `MultiFrameCodec` now uses whatever previously cached required frame is available instead of panicking if it doesn't have the exact frame requested by `SkCodec::FrameInfo#fRequiredFrame`. `SkCodec::FrameInfo#fRequiredFrame` doesn't point to the one and only frame that's required to decode the given frame. It points to the latest frame that's disposal method none and filling a greater surface area than the current frame. The last required frame `MultiFrameCodec` has actually cached is also valid in these cases and can be supplied as `fPriorFrame` instead. [flutter/flutter#26757](https://github.com/flutter/flutter/issues/26757#issuecomment-459522530) has a more detailed explanation. Fixes flutter/flutter#26757 --- lib/ui/painting/codec.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/ui/painting/codec.cc b/lib/ui/painting/codec.cc index 18e123d992571..0555d8269ceb2 100644 --- a/lib/ui/painting/codec.cc +++ b/lib/ui/painting/codec.cc @@ -408,11 +408,15 @@ sk_sp MultiFrameCodec::GetNextFrameImage( options.fFrameIndex = nextFrameIndex_; const int requiredFrameIndex = frameInfos_[nextFrameIndex_].fRequiredFrame; if (requiredFrameIndex != SkCodec::kNoFrame) { - if (lastRequiredFrame_ == nullptr || - lastRequiredFrameIndex_ != requiredFrameIndex) { + if (lastRequiredFrame_ == nullptr) { FML_LOG(ERROR) << "Frame " << nextFrameIndex_ << " depends on frame " - << requiredFrameIndex << " which has not been cached."; + << requiredFrameIndex + << " and no required frames are cached."; return NULL; + } else if (lastRequiredFrameIndex_ != requiredFrameIndex) { + FML_DLOG(INFO) << "Required frame " << requiredFrameIndex + << " is not cached. Using " << lastRequiredFrameIndex_ + << " instead"; } if (lastRequiredFrame_->getPixels() && From b8473cdee13d4739afda6b171f4c84280584ab98 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 7 Feb 2019 15:15:41 -0800 Subject: [PATCH 0086/1117] use correct no-download-badge (#7735) --- tools/gen_objcdoc.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/gen_objcdoc.sh b/tools/gen_objcdoc.sh index 54e561e0a1828..54dae94e5b719 100755 --- a/tools/gen_objcdoc.sh +++ b/tools/gen_objcdoc.sh @@ -24,6 +24,15 @@ if [[ -n "${GEM_HOME}" ]] PATH="${GEM_HOME}/bin:$PATH" fi +# Jazzy 0.8.x, used on chrome infra, expects --no-download-badge +# Jazzy 0.9.x, used on LUCI, doesn't support that flag. +noDownloadBadge="" +if [[ -z "$LUCI_CONTEXT" ]] + then + noDownloadBadge="--no-download-badge" +fi + + # Use iPhoneSimulator SDK # See: https://github.com/realm/jazzy/issues/791 jazzy \ @@ -39,4 +48,4 @@ jazzy \ --module Flutter\ --root-url https://docs.flutter.io/objc/\ --output "$1"\ - --no-download-badge + $noDownloadBadge From 929c8feec542bd6df0174b50d2814c100d16367e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 7 Feb 2019 18:37:47 -0500 Subject: [PATCH 0087/1117] Roll src/third_party/skia 8619a34bb875..d978b90d205d (17 commits) (#7736) https://skia.googlesource.com/skia.git/%2Blog/8619a34bb875..d978b90d205d git log 8619a34bb87565dfcfc3818ceab065e93ea183e6..d978b90d205d76206e9d15cd8c4db8743350e023 --date=short --no-merges --format=%ad %ae %s 2019-02-07 bsalomon@google.com Track separate texure binding states for each OpenGL texture target. 2019-01-18 halcanary@google.com SkQP: new tool: tools/skqp/find_commit_with_best_gold_results 2019-02-07 brianosman@google.com Check for single owner and abandoned context in createMipMapProxyFromBitmap 2019-02-07 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-07 jvanverth@google.com Fix Metal bots. 2019-02-07 halcanary@google.com SkQP: update tools/skqp/gn_to_bp.py, add release script 2019-02-07 bsalomon@google.com Cache CPU memory buffers used for client side arrays. 2019-02-07 bungeman@google.com Don't include .cpp file in SampleCCPRGeometry.cpp 2019-02-07 brianosman@google.com Give ImGui the correct DeltaTime 2019-01-30 djsollen@google.com Remove colorspace restrictions for 565/FP16 configs in Android Codec. 2019-02-07 mtklein@google.com skvx wip 2019-02-07 bsalomon@google.com Default init GrGpuResource::UniqueID to invalid id. 2019-02-07 robertphillips@google.com Move "matches" from GrContextThreadSafeProxy to GrContext_Base 2019-02-07 robertphillips@google.com Make room for shifting GrContext to GrDirectContext 2019-02-07 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-07 brianosman@google.com Support building mips when creating cross context images 2019-02-07 bsalomon@google.com Pin the quad index buffer in GrResourceProvider. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index bbb03b68ad9fb..3e6b5d04e7d7d 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': '8619a34bb87565dfcfc3818ceab065e93ea183e6', + 'skia_revision': 'd978b90d205d76206e9d15cd8c4db8743350e023', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index ce8807155c8d0..3505e75d52f18 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 4429bc6b2c346cb26cff0ef1e4042cf7 +Signature: ac5c698899bb2b83190448b35b3c66d7 UNUSED LICENSES: @@ -1174,9 +1174,9 @@ FILE: ../../../third_party/skia/src/gpu/GrContextThreadSafeProxyPriv.h FILE: ../../../third_party/skia/src/gpu/GrDDLContext.cpp FILE: ../../../third_party/skia/src/gpu/GrDeinstantiateProxyTracker.cpp FILE: ../../../third_party/skia/src/gpu/GrDeinstantiateProxyTracker.h -FILE: ../../../third_party/skia/src/gpu/GrDirectContext.cpp FILE: ../../../third_party/skia/src/gpu/GrDriverBugWorkarounds.cpp FILE: ../../../third_party/skia/src/gpu/GrFPArgs.h +FILE: ../../../third_party/skia/src/gpu/GrLegacyDirectContext.cpp FILE: ../../../third_party/skia/src/gpu/GrProxyProvider.cpp FILE: ../../../third_party/skia/src/gpu/GrProxyProvider.h FILE: ../../../third_party/skia/src/gpu/GrQuad.cpp From 168f92ddd7b783e2c120a116e663ba260855ba1e Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 7 Feb 2019 19:08:14 -0800 Subject: [PATCH 0088/1117] Roll src/third_party/dart 6c680a0ebd..9c0a73f943 (31 commits) 9c0a73f943 [dart/vm] Skip finalization error for now b05b8777d4 [dart/fuzzer] Refactor switch setup, add VFP to ARM 5a7ecfbabe [dart/vm] Skip finalization error for now 26379d088d Update dartfix to report path of resource if resource changes during analysis 2710834272 [fuchsia] Update path to fuchsia.timezone da7ed9b05a Add missing generics in FlowAnalysis. 21b596e1b1 Change NullabilityFixKind from enum to class d84ec89f39 add NullabilityMigrationListener for communicating changes to the client 9f0301630f Update dartfix NNBD to use 2-pass analysis 70283bdb3a Improve choosing context for changes files. dbf4900c99 [vm/tools] Fix issues with snapshot size reporting 1c8f571f76 Add source links to dartdoc output. a0516965b4 [vm] Load top-level functions and variables lazily 20f12ad874 [gardening] Re-add two status file lines after landing d05000af4d 073f557b1a Temporary fix for Analysis Server tests on Windows. d05000af4d [gardening] Remove flaky markers and close issues for tests not appearing in flakiness dashboard ac95355fdb Compiler option for environment defines 0e4f917759 Implement subtyping of optional function parameters c84a0bd932 Infer mixin applications in hierarchy builder 2fd96e75d6 Separate MixinInferrer from Kernel ClassHierarchy 8927bc8d38 Remove ConstraintGatherer's dependency on TypeSchemaEnvironment 5a98aa704b Extract StandardBounds to a mixin 86f5aed890 Finish implementing IsTypedefSubtypeOf d373b2ce9c [gardening] Disable golden test until next engine roll a8a9171dd8 Avoid crashing on this property access 33bc628235 Treeshake unread fields b040d3c853 Improve error message on ambiguous constructors c591454dd3 Inline unprovided optional parameters 3afc3b58d0 Add dartfix protocol integration tests 67a1ce6b34 Notify DeclarationsTracker about file changes. 876e671a2c Migrate DeclarationResolverTest. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 3e6b5d04e7d7d..144489229adf5 100644 --- a/DEPS +++ b/DEPS @@ -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': '6c680a0ebd195d60bb80fd68f92aed1626db997e', + 'dart_revision': '9c0a73f9430caa50f1c5fa417ca61c7919fc21a7', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index f3e36c3e5c73a..26f40ae27edfb 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: fd8b05c8fdf470d9f4330846e131a5fe +Signature: 9ae7c8c7be5c5ee36d6a16b2c1513a82 UNUSED LICENSES: From 8c80b404d720d7a9b3d4837291ef4144a94953a7 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 7 Feb 2019 22:32:12 -0500 Subject: [PATCH 0089/1117] Roll src/third_party/skia d978b90d205d..50e24d7d5f52 (4 commits) (#7743) https://skia.googlesource.com/skia.git/%2Blog/d978b90d205d..50e24d7d5f52 git log d978b90d205d76206e9d15cd8c4db8743350e023..50e24d7d5f52724b4286078a813eb253e710fe47 --date=short --no-merges --format=%ad %ae %s 2019-02-07 csmartdalton@google.com Add a mechanism for GMs to silently exclude themselves from Gold 2019-02-07 benjaminwagner@google.com [infra] Update Win10 in Skolo. 2019-02-07 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-07 csmartdalton@google.com Reland "Add a GpuGM class for GPU-only tests" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 144489229adf5..316bfe1d76138 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': 'd978b90d205d76206e9d15cd8c4db8743350e023', + 'skia_revision': '50e24d7d5f52724b4286078a813eb253e710fe47', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3505e75d52f18..a82aa6ce08e86 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ac5c698899bb2b83190448b35b3c66d7 +Signature: 245c8f04811974866afdeaff80f56139 UNUSED LICENSES: From c5ab02766477b04635b48bf9a70edfe7c091f21c Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 7 Feb 2019 22:00:17 -0800 Subject: [PATCH 0090/1117] use full git hash for version (#7741) --- build/git_revision.py | 1 - 1 file changed, 1 deletion(-) diff --git a/build/git_revision.py b/build/git_revision.py index c571ee823cb0c..29d62e796a347 100755 --- a/build/git_revision.py +++ b/build/git_revision.py @@ -31,7 +31,6 @@ def main(): '-C', repository, 'rev-parse', - '--short', 'HEAD', ]) From aa901fc84a4ae30a55e982b3d6c752f50fc01ffe Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Thu, 7 Feb 2019 22:07:24 -0800 Subject: [PATCH 0091/1117] [fuchsia] Update path to fuchsia.ui.scenic (#7731) This target is now in //sdk/fidl. --- flow/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow/BUILD.gn b/flow/BUILD.gn index 799c23caf02d3..6b345aa87a35a 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -80,7 +80,7 @@ source_set("flow") { ] public_deps += [ - "//garnet/public/fidl/fuchsia.ui.scenic", + "//sdk/fidl/fuchsia.ui.scenic", "//garnet/public/lib/ui/scenic/cpp", "//topaz/public/dart-pkg/zircon", ] From 401d2e24f43cb8bb21f84e00af9ba8941c18ec6b Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 8 Feb 2019 02:16:38 -0500 Subject: [PATCH 0092/1117] Roll src/third_party/skia 50e24d7d5f52..26490759e464 (3 commits) (#7745) https://skia.googlesource.com/skia.git/%2Blog/50e24d7d5f52..26490759e464 git log 50e24d7d5f52724b4286078a813eb253e710fe47..26490759e46483558627c9132e31f4b97cf052ac --date=short --no-merges --format=%ad %ae %s 2019-02-08 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-02-07 ericrk@chromium.org Fix issue where command buffer was skipped if drawing a single drawable 2019-02-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader c81766320762..7fb0b73b1aa7 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 316bfe1d76138..77e4fd3c19b48 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': '50e24d7d5f52724b4286078a813eb253e710fe47', + 'skia_revision': '26490759e46483558627c9132e31f4b97cf052ac', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a82aa6ce08e86..738bada49493b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 245c8f04811974866afdeaff80f56139 +Signature: f6b697affa5493d514e7ad4decee91e7 UNUSED LICENSES: From 87d3f4281d369f4fc02e6543bd2d3d5c0c8a7880 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 8 Feb 2019 00:59:08 -0800 Subject: [PATCH 0093/1117] Roll src/third_party/dart 9c0a73f943..246430bc8c (1 commits) 246430bc8c [dartdevc] wait for async callbacks to complete in tests --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 77e4fd3c19b48..b481972e2a844 100644 --- a/DEPS +++ b/DEPS @@ -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': '9c0a73f9430caa50f1c5fa417ca61c7919fc21a7', + 'dart_revision': '246430bc8c125e4dc8194a99dd7ecc8b721b3151', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py From f20d8558d7b3eb6da0cd7d3c54a2ae47981e15ba Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 8 Feb 2019 06:04:17 -0500 Subject: [PATCH 0094/1117] Roll src/third_party/skia 26490759e464..44bffbfc1c3e (1 commits) (#7748) https://skia.googlesource.com/skia.git/%2Blog/26490759e464..44bffbfc1c3e git log 26490759e46483558627c9132e31f4b97cf052ac..44bffbfc1c3e6be6580ec2f7f209b4a2115b7014 --date=short --no-merges --format=%ad %ae %s 2019-02-07 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index b481972e2a844..55c134c52a66f 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': '26490759e46483558627c9132e31f4b97cf052ac', + 'skia_revision': '44bffbfc1c3e6be6580ec2f7f209b4a2115b7014', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 738bada49493b..54797afca5423 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f6b697affa5493d514e7ad4decee91e7 +Signature: d226043609fe37306a1a8bc03e41b779 UNUSED LICENSES: From b5892b6af56899d431da83931408cfa941e144e2 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 8 Feb 2019 09:55:27 -0500 Subject: [PATCH 0095/1117] Roll src/third_party/skia 44bffbfc1c3e..f2a3f5943e4c (3 commits) (#7749) https://skia.googlesource.com/skia.git/%2Blog/44bffbfc1c3e..f2a3f5943e4c git log 44bffbfc1c3e6be6580ec2f7f209b4a2115b7014..f2a3f5943e4ca1a3c33b352664231523e0ce9053 --date=short --no-merges --format=%ad %ae %s 2019-02-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 52d861bd49cc..cd4f1fbaabce (27 commits) 2019-02-07 borenet@google.com Roll third_party/externals/angle2 a54104803d72..52d861bd49cc (8 commits) 2019-02-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 635f11205d4b..3e6732ee4ac8 (349 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 55c134c52a66f..56f1fa1b479a5 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': '44bffbfc1c3e6be6580ec2f7f209b4a2115b7014', + 'skia_revision': 'f2a3f5943e4ca1a3c33b352664231523e0ce9053', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 54797afca5423..188862bd58591 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: d226043609fe37306a1a8bc03e41b779 +Signature: 1ea580a3a0abdf06e95e805c0b2e9237 UNUSED LICENSES: From 25c513c72a5a4b2ef3cf5c174a9541e7f327d2b8 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 8 Feb 2019 06:59:52 -0800 Subject: [PATCH 0096/1117] Roll src/third_party/dart 246430bc8c..52f5e34dbf (5 commits) 52f5e34dbf Move JsToFrontendMap to js_world_builder and add toBackendConstant. 30d760e0c9 Add unittest of allocator analysis for the K model 45f55183c5 Refactor processing of pragma annotations b2bffb2147 Revert "[dartdevc] skip co19 tests on linux bots" 3fab17ee58 Display CFE message contexts --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 56f1fa1b479a5..27b155ff74b56 100644 --- a/DEPS +++ b/DEPS @@ -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': '246430bc8c125e4dc8194a99dd7ecc8b721b3151', + 'dart_revision': '52f5e34dbfed9d2e594d969bbefc0f39cf75c213', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py From cf1d70a278a416c10176f6ba6ed38b6e0bea1f1d Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Fri, 8 Feb 2019 10:34:48 -0800 Subject: [PATCH 0097/1117] Add onPlatformBrightnessChanged/platformBrightness to stub ui window. (#7739) --- lib/stub_ui/BUILD.gn | 2 +- lib/stub_ui/window.dart | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/stub_ui/BUILD.gn b/lib/stub_ui/BUILD.gn index fc7fc43c9ca7a..218f0344083df 100644 --- a/lib/stub_ui/BUILD.gn +++ b/lib/stub_ui/BUILD.gn @@ -32,7 +32,7 @@ copy("stub_ui") { copy("stub_libraries") { sources = [ - "$flutter_root/lib/snapshot/libraries.json" + "$flutter_root/lib/stub_ui/libraries.json" ] outputs = [ diff --git a/lib/stub_ui/window.dart b/lib/stub_ui/window.dart index f9820eec96503..bf81854896cc7 100644 --- a/lib/stub_ui/window.dart +++ b/lib/stub_ui/window.dart @@ -551,6 +551,28 @@ class Window { _onLocaleChangedZone = Zone.current; } + /// The setting indicating the current brightness mode of the host platform. + /// If the platform has no preference, [platformBrightness] defaults to [Brightness.light]. + Brightness get platformBrightness => _platformBrightness; + Brightness _platformBrightness = Brightness.light; + + /// A callback that is invoked whenever [platformBrightness] changes value. + /// + /// The framework invokes this callback in the same zone in which the + /// callback was set. + /// + /// See also: + /// + /// * [WidgetsBindingObserver], for a mechanism at the widgets layer to + /// observe when this callback is invoked. + VoidCallback get onPlatformBrightnessChanged => _onPlatformBrightnessChanged; + VoidCallback _onPlatformBrightnessChanged; + Zone _onPlatformBrightnessChangedZone; + set onPlatformBrightnessChanged(VoidCallback callback) { + _onPlatformBrightnessChanged = callback; + _onPlatformBrightnessChangedZone = Zone.current; + } + /// The system-reported text scale. /// /// This establishes the text scaling factor to use when rendering text, From 5bfb1ecb5c1fda4ebbb2755e41256437e5daca6b Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 8 Feb 2019 13:46:20 -0500 Subject: [PATCH 0098/1117] Roll src/third_party/skia f2a3f5943e4c..37064c1739f3 (11 commits) (#7752) https://skia.googlesource.com/skia.git/%2Blog/f2a3f5943e4c..37064c1739f3 git log f2a3f5943e4ca1a3c33b352664231523e0ce9053..37064c1739f3feb46862791fde9903c0d64d5135 --date=short --no-merges --format=%ad %ae %s 2019-02-08 brianosman@google.com Remove support for GPU bone transformations 2019-02-08 mtklein@google.com add more test cases to DAA gm 2019-02-08 robertphillips@google.com Move auditTrail and opMemoryPool from GrContext to GrRecordingContext 2019-02-08 brianosman@google.com Fix vertex indexing error when using ImGui skiaWidgets 2019-02-07 mtklein@google.com move some methods out of line 2019-02-07 herb@google.com Simplify typeface and effects handling 2019-02-07 robertphillips@google.com Move proxyProvider and singleOwner to GrImageContext 2019-02-08 mtklein@google.com remove a couple more jsoncpp deps 2019-02-08 jcgregorio@google.com docs - Trim down infra trooper docs. 2019-02-08 kjlubick@google.com Remove abandoned fSubdivisionsMax 2019-02-08 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 27b155ff74b56..4b75e94f29737 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': 'f2a3f5943e4ca1a3c33b352664231523e0ce9053', + 'skia_revision': '37064c1739f3feb46862791fde9903c0d64d5135', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 188862bd58591..a44b9759c382c 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 1ea580a3a0abdf06e95e805c0b2e9237 +Signature: c32bc2f430a8f206f1023660220092c0 UNUSED LICENSES: From aa275820bcc8f1e7c01db9f670ab0f54d98a4c99 Mon Sep 17 00:00:00 2001 From: Stanislav Baranov Date: Fri, 8 Feb 2019 10:47:01 -0800 Subject: [PATCH 0099/1117] Support for loading dynamic patches in AOT mode. (#7744) * Dynamic patching support for AOT mode. * Cleanup. --- .../io/flutter/view/ResourceUpdater.java | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/shell/platform/android/io/flutter/view/ResourceUpdater.java b/shell/platform/android/io/flutter/view/ResourceUpdater.java index 61dbe3080379c..30db64e14b1a8 100644 --- a/shell/platform/android/io/flutter/view/ResourceUpdater.java +++ b/shell/platform/android/io/flutter/view/ResourceUpdater.java @@ -318,31 +318,35 @@ public boolean validateManifest(JSONObject manifest) { return false; } - final AssetManager manager = context.getResources().getAssets(); - try (InputStream is = manager.open("flutter_assets/isolate_snapshot_data")) { - CRC32 checksum = new CRC32(); - - int count = 0; - byte[] buffer = new byte[BUFFER_SIZE]; - while ((count = is.read(buffer, 0, BUFFER_SIZE)) != -1) { - checksum.update(buffer, 0, count); - } - - if (!baselineChecksum.equals(String.valueOf(checksum.getValue()))) { - Log.w(TAG, "Mismatched update file for APK"); - return false; + CRC32 checksum = new CRC32(); + String[] checksumFiles = { + "isolate_snapshot_data", + "isolate_snapshot_instr", + "flutter_assets/isolate_snapshot_data", + }; + for (String fn : checksumFiles) { + AssetManager manager = context.getResources().getAssets(); + try (InputStream is = manager.open(fn)) { + int count = 0; + byte[] buffer = new byte[BUFFER_SIZE]; + while ((count = is.read(buffer, 0, BUFFER_SIZE)) != -1) { + checksum.update(buffer, 0, count); + } + } catch (IOException e) { + // Skip missing files. } + } - return true; - - } catch (IOException e) { - Log.w(TAG, "Could not read APK: " + e); + if (!baselineChecksum.equals(String.valueOf(checksum.getValue()))) { + Log.w(TAG, "Mismatched update file for APK"); return false; } + + return true; } void startUpdateDownloadOnce() { - if (downloadTask != null ) { + if (downloadTask != null) { return; } downloadTask = new DownloadTask(); From 3183d151dfc6f2d7b05a18980a9c5bf85f79e6e3 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Fri, 8 Feb 2019 12:00:17 -0800 Subject: [PATCH 0100/1117] Rename macOS framework to FlutterMacOS.framework (#7740) Avoids potential confusion due to the iOS framework already being called Flutter.framework. --- ci/licenses_golden/licenses_flutter | 2 +- shell/platform/darwin/macos/BUILD.gn | 16 ++++++++-------- .../Headers/{Flutter.h => FlutterMacOS.h} | 0 shell/platform/darwin/macos/framework/Info.plist | 6 +++--- .../darwin/macos/framework/module.modulemap | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) rename shell/platform/darwin/macos/framework/Headers/{Flutter.h => FlutterMacOS.h} (100%) diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 8a0bf83a6b245..d9ed2700a3777 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -588,7 +588,7 @@ FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FLEPluginRe FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FLEReshapeListener.h FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FLEView.h FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FLEViewController.h -FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/Flutter.h +FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterMacOS.h FILE: ../../../flutter/shell/platform/darwin/macos/framework/Info.plist FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FLETextInputModel.h FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FLETextInputModel.mm diff --git a/shell/platform/darwin/macos/BUILD.gn b/shell/platform/darwin/macos/BUILD.gn index 29fcb9f1f1fe5..87c055bbdae7e 100644 --- a/shell/platform/darwin/macos/BUILD.gn +++ b/shell/platform/darwin/macos/BUILD.gn @@ -8,14 +8,14 @@ import("//build/config/mac/mac_sdk.gni") import("$flutter_root/common/config.gni") import("$flutter_root/shell/platform/darwin/framework_shared.gni") -_flutter_framework_name = "Flutter" -_flutter_framework_out_dir_subpath = "macos/$_flutter_framework_name.framework" -_flutter_framework_dir = "$root_out_dir/$_flutter_framework_out_dir_subpath" +_flutter_framework_name = "FlutterMacOS" +_flutter_framework_filename = "$_flutter_framework_name.framework" +_flutter_framework_dir = "$root_out_dir/$_flutter_framework_filename" -# The headers that will be copied to the Flutter.framework and be accessed -# from outside the Flutter engine source root. +# The headers that will be copied to the framework and be accessed from outside +# the Flutter engine source root. _flutter_framework_headers = [ - "framework/Headers/Flutter.h", + "framework/Headers/FlutterMacOS.h", "framework/Headers/FLEOpenGLContextHandling.h", "framework/Headers/FLEPlugin.h", "framework/Headers/FLEPluginRegistrar.h", @@ -89,7 +89,7 @@ action("copy_dylib_and_update_framework_install_name") { "--dylib", rebase_path("$_flutter_framework_dir/Versions/A/$_flutter_framework_name"), "--install_name", - "@rpath/$_flutter_framework_name.framework/Versions/A/$_flutter_framework_name", + "@rpath/$_flutter_framework_filename/Versions/A/$_flutter_framework_name", "--stamp", rebase_path(stamp_file), ] @@ -168,7 +168,7 @@ action("_generate_symlinks") { ] args = [ "--framework", - "$_flutter_framework_out_dir_subpath", + "$_flutter_framework_filename", "--version", "A", "--contents", diff --git a/shell/platform/darwin/macos/framework/Headers/Flutter.h b/shell/platform/darwin/macos/framework/Headers/FlutterMacOS.h similarity index 100% rename from shell/platform/darwin/macos/framework/Headers/Flutter.h rename to shell/platform/darwin/macos/framework/Headers/FlutterMacOS.h diff --git a/shell/platform/darwin/macos/framework/Info.plist b/shell/platform/darwin/macos/framework/Info.plist index a4f200a190429..044a5e31b7ec8 100644 --- a/shell/platform/darwin/macos/framework/Info.plist +++ b/shell/platform/darwin/macos/framework/Info.plist @@ -5,13 +5,13 @@ CFBundleDevelopmentRegion en CFBundleExecutable - Flutter + FlutterMacOS CFBundleIdentifier - io.flutter.flutter + io.flutter.flutter-macos CFBundleInfoDictionaryVersion 6.0 CFBundleName - Flutter + FlutterMacOS CFBundlePackageType FMWK CFBundleShortVersionString diff --git a/shell/platform/darwin/macos/framework/module.modulemap b/shell/platform/darwin/macos/framework/module.modulemap index bf81c8a86519f..3e70a88b7c220 100644 --- a/shell/platform/darwin/macos/framework/module.modulemap +++ b/shell/platform/darwin/macos/framework/module.modulemap @@ -1,5 +1,5 @@ -framework module Flutter { - umbrella header "Flutter.h" +framework module FlutterMacOS { + umbrella header "FlutterMacOS.h" export * module * { export * } From 7c702404b820c670cda34b564ac3f8c0b914f40e Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Fri, 8 Feb 2019 15:12:29 -0500 Subject: [PATCH 0101/1117] Create mipmaps for images when uploading them on the IO thread (#7751) This does several things: - It adds CPU time on the IO thread, but avoids GPU time on the GPU thread. - For images that are never drawn with mipmaps, it adds about 33% memory overhead. For images that are drawn with mipmaps, it saves an entire copy of the base level. - It fixes https://github.com/flutter/flutter/issues/24517, which is a driver bug related to mip-mapping and cross-context images. Overall, I think the tradeoff is good, but I'm curious to see what benchmarks look like. --- lib/ui/painting/codec.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ui/painting/codec.cc b/lib/ui/painting/codec.cc index 0555d8269ceb2..0b1de9c2c7889 100644 --- a/lib/ui/painting/codec.cc +++ b/lib/ui/painting/codec.cc @@ -70,7 +70,7 @@ static sk_sp DecodeImage(fml::WeakPtr context, // This indicates that we do not want a "linear blending" decode. sk_sp dstColorSpace = nullptr; return SkImage::MakeCrossContextFromEncoded( - context.get(), std::move(buffer), false, dstColorSpace.get(), true); + context.get(), std::move(buffer), true, dstColorSpace.get(), true); } else { // Defer decoding until time of draw later on the GPU thread. Can happen // when GL operations are currently forbidden such as in the background @@ -131,7 +131,7 @@ fml::RefPtr InitCodecUncompressed( sk_sp skImage; if (context) { SkPixmap pixmap(image_info.sk_info, buffer->data(), image_info.row_bytes); - skImage = SkImage::MakeCrossContextFromPixmap(context.get(), pixmap, false, + skImage = SkImage::MakeCrossContextFromPixmap(context.get(), pixmap, true, nullptr, true); } else { skImage = SkImage::MakeRasterData(image_info.sk_info, std::move(buffer), @@ -455,7 +455,7 @@ sk_sp MultiFrameCodec::GetNextFrameImage( // This indicates that we do not want a "linear blending" decode. sk_sp dstColorSpace = nullptr; return SkImage::MakeCrossContextFromPixmap(resourceContext.get(), pixmap, - false, dstColorSpace.get()); + true, dstColorSpace.get()); } else { // Defer decoding until time of draw later on the GPU thread. Can happen // when GL operations are currently forbidden such as in the background From 4d3a112279fb48b2de9f75d3655c037cc4729fb4 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 8 Feb 2019 14:21:47 -0800 Subject: [PATCH 0102/1117] Document GPUSurfaceGLDelegate methods and move it to its own file. (#7755) --- ci/licenses_golden/licenses_flutter | 1 + shell/gpu/BUILD.gn | 1 + shell/gpu/gpu_surface_gl.h | 24 +----------- shell/gpu/gpu_surface_gl_delegate.h | 60 +++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 23 deletions(-) create mode 100644 shell/gpu/gpu_surface_gl_delegate.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index d9ed2700a3777..7d5e643fdcb6d 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -403,6 +403,7 @@ 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_gl_delegate.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 diff --git a/shell/gpu/BUILD.gn b/shell/gpu/BUILD.gn index a886b0192c903..5e7bcddbfb1bf 100644 --- a/shell/gpu/BUILD.gn +++ b/shell/gpu/BUILD.gn @@ -28,6 +28,7 @@ source_set("gpu_surface_gl") { sources = [ "$gpu_dir/gpu_surface_gl.cc", "$gpu_dir/gpu_surface_gl.h", + "$gpu_dir/gpu_surface_gl_delegate.h", ] deps = gpu_common_deps + [ "//third_party/skia" ] diff --git a/shell/gpu/gpu_surface_gl.h b/shell/gpu/gpu_surface_gl.h index a268e6d28020f..2be751297b7aa 100644 --- a/shell/gpu/gpu_surface_gl.h +++ b/shell/gpu/gpu_surface_gl.h @@ -12,33 +12,11 @@ #include "flutter/fml/macros.h" #include "flutter/fml/memory/weak_ptr.h" #include "flutter/shell/common/surface.h" +#include "flutter/shell/gpu/gpu_surface_gl_delegate.h" #include "third_party/skia/include/gpu/GrContext.h" namespace shell { -class GPUSurfaceGLDelegate { - public: - virtual bool GLContextMakeCurrent() = 0; - - virtual bool GLContextClearCurrent() = 0; - - virtual bool GLContextPresent() = 0; - - virtual intptr_t GLContextFBO() const = 0; - - virtual bool GLContextFBOResetAfterPresent() const; - - virtual bool UseOffscreenSurface() const; - - virtual SkMatrix GLContextSurfaceTransformation() const; - - virtual flow::ExternalViewEmbedder* GetExternalViewEmbedder(); - - using GLProcResolver = - std::function; - virtual GLProcResolver GetGLProcResolver() const; -}; - class GPUSurfaceGL : public Surface { public: GPUSurfaceGL(GPUSurfaceGLDelegate* delegate); diff --git a/shell/gpu/gpu_surface_gl_delegate.h b/shell/gpu/gpu_surface_gl_delegate.h new file mode 100644 index 0000000000000..36e7d2912c4a1 --- /dev/null +++ b/shell/gpu/gpu_surface_gl_delegate.h @@ -0,0 +1,60 @@ +// Copyright 2013 The Flutter 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_GL_DELEGATE_H_ +#define FLUTTER_SHELL_GPU_GPU_SURFACE_GL_DELEGATE_H_ + +#include "flutter/flow/embedded_views.h" +#include "flutter/fml/macros.h" +#include "third_party/skia/include/core/SkMatrix.h" + +namespace shell { + +class GPUSurfaceGLDelegate { + public: + // Called to make the main GL context current on the current thread. + virtual bool GLContextMakeCurrent() = 0; + + // Called to clear the current GL context on the thread. This may be called on + // either the GPU or IO threads. + virtual bool GLContextClearCurrent() = 0; + + // Called to present the main GL surface. This is only called for the main GL + // context and not any of the contexts dedicated for IO. + virtual bool GLContextPresent() = 0; + + // The ID of the main window bound framebuffer. Typically FBO0. + virtual intptr_t GLContextFBO() const = 0; + + // The rendering subsystem assumes that the ID of the main window bound + // framebuffer remains constant throughout. If this assumption in incorrect, + // embedders are required to return true from this method. In such cases, + // GLContextFBO() will be called again to acquire the new FBO ID for rendering + // subsequent frames. + virtual bool GLContextFBOResetAfterPresent() const; + + // Create an offscreen surface to render into before onscreen composition. + virtual bool UseOffscreenSurface() const; + + // A transformation applied to the onscreen surface before the canvas is + // flushed. + virtual SkMatrix GLContextSurfaceTransformation() const; + + // Get a reference to the external views embedder. This happens on the same + // thread that the renderer is operating on. + virtual flow::ExternalViewEmbedder* GetExternalViewEmbedder(); + + using GLProcResolver = + std::function; + // Provide a custom GL proc resolver. If no such resolver is present, Skia + // will attempt to do GL proc address resolution on its own. Embedders that + // have specific opinions on GL API selection or need to add their own + // instrumentation to specific GL calls can specify custom GL functions + // here. + virtual GLProcResolver GetGLProcResolver() const; +}; + +} // namespace shell + +#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_GL_DELEGATE_H_ From 3bfd26505c5d41b7c1f9677ea03869391822b8f6 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Fri, 8 Feb 2019 14:30:16 -0800 Subject: [PATCH 0103/1117] Add flutter config to macOS targets (#7756) In 9345274 (#7642), //shell/platform/darwin:framework_shared was added without the root flutter config, causing a build breakage in Fuchsia, where flutter sits under //third_party/flutter as opposed to at the root. The flutter root config is required to set -I../../third_party as an include path. --- shell/platform/darwin/BUILD.gn | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shell/platform/darwin/BUILD.gn b/shell/platform/darwin/BUILD.gn index 3231560745489..672ea4537eda3 100644 --- a/shell/platform/darwin/BUILD.gn +++ b/shell/platform/darwin/BUILD.gn @@ -61,6 +61,8 @@ source_set("framework_shared") { set_sources_assignment_filter(sources_assignment_filter) defines = [ "FLUTTER_FRAMEWORK" ] + + public_configs = [ "$flutter_root:config" ] } executable("flutter_channels_unittests") { @@ -78,4 +80,6 @@ executable("flutter_channels_unittests") { "$flutter_root/testing", "//third_party/dart/runtime:libdart_jit", ] + + public_configs = [ "$flutter_root:config" ] } From 7d97afd8a37100d9d87d2146fe9256206249fdee Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 8 Feb 2019 17:37:26 -0500 Subject: [PATCH 0104/1117] Roll src/third_party/skia 37064c1739f3..be39f713e530 (7 commits) (#7757) https://skia.googlesource.com/skia.git/%2Blog/37064c1739f3..be39f713e530 git log 37064c1739f3feb46862791fde9903c0d64d5135..be39f713e5302317e760f51c0f114761ddc969ca --date=short --no-merges --format=%ad %ae %s 2019-02-08 jvanverth@google.com Add Metal context to Viewer. 2019-02-08 bsalomon@google.com Add GrContext::resetGLTextureBindings(). 2019-02-08 jvanverth@google.com Manage Mac paint events more directly. 2019-02-08 benjaminwagner@google.com Distinguish DDL in Gold results. 2019-02-08 halcanary@google.com SkQP: make text context outlast gm 2019-02-07 herb@google.com Simplify mask handling in SkRemoteGlyphCache 2019-02-08 herb@google.com Split getOrCreateCache into a SkFont and descriptor based calles The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4b75e94f29737..c6582606e507c 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': '37064c1739f3feb46862791fde9903c0d64d5135', + 'skia_revision': 'be39f713e5302317e760f51c0f114761ddc969ca', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a44b9759c382c..40e02d5165982 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c32bc2f430a8f206f1023660220092c0 +Signature: af6337ee787fca049a3ae700ea88f1d1 UNUSED LICENSES: From 5f3f3bd9839b0d4e185a13de05fc6b9a24e6067f Mon Sep 17 00:00:00 2001 From: liyuqian Date: Fri, 8 Feb 2019 14:47:22 -0800 Subject: [PATCH 0105/1117] Add mock capability to PerformanceOverlayLayer (#7537) So we can do golden test on PerformanceOverlay to avoid regression like https://github.com/flutter/flutter/issues/26387 --- ci/licenses_golden/licenses_flutter | 1 + flow/BUILD.gn | 1 + flow/layers/performance_overlay_layer.cc | 31 ++++-- flow/layers/performance_overlay_layer.h | 6 +- .../performance_overlay_layer_unittests.cc | 90 ++++++++++++++++++ .../resources/performance_overlay_gold.png | Bin 0 -> 16572 bytes 6 files changed, 118 insertions(+), 11 deletions(-) create mode 100644 flow/layers/performance_overlay_layer_unittests.cc create mode 100644 testing/resources/performance_overlay_gold.png diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 7d5e643fdcb6d..35ea7cad1e859 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -57,6 +57,7 @@ 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/performance_overlay_layer_unittests.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.h FILE: ../../../flutter/flow/layers/picture_layer.cc diff --git a/flow/BUILD.gn b/flow/BUILD.gn index 6b345aa87a35a..003fb326becb1 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -95,6 +95,7 @@ executable("flow_unittests") { sources = [ "matrix_decomposition_unittests.cc", "raster_cache_unittests.cc", + "layers/performance_overlay_layer_unittests.cc", ] deps = [ diff --git a/flow/layers/performance_overlay_layer.cc b/flow/layers/performance_overlay_layer.cc index c80786e866e1b..e7f40058c3bfb 100644 --- a/flow/layers/performance_overlay_layer.cc +++ b/flow/layers/performance_overlay_layer.cc @@ -15,8 +15,12 @@ namespace { void DrawStatisticsText(SkCanvas& canvas, const std::string& string, int x, - int y) { + int y, + const std::string& font_path) { SkFont font; + if (font_path != "") { + font = SkFont(SkTypeface::MakeFromFile(font_path.c_str())); + } font.setSize(15); font.setLinearMetrics(false); SkPaint paint; @@ -33,7 +37,8 @@ void VisualizeStopWatch(SkCanvas& canvas, SkScalar height, bool show_graph, bool show_labels, - const std::string& label_prefix) { + const std::string& label_prefix, + const std::string& font_path) { const int label_x = 8; // distance from x const int label_y = -10; // distance from y+height @@ -51,14 +56,20 @@ void VisualizeStopWatch(SkCanvas& canvas, stream << label_prefix << " " << "max " << max_ms_per_frame << " ms/frame, " << "avg " << average_ms_per_frame << " ms/frame"; - DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y); + DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y, + font_path); } } } // namespace -PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options) - : options_(options) {} +PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options, + const char* font_path) + : options_(options) { + if (font_path != nullptr) { + font_path_ = font_path; + } +} void PerformanceOverlayLayer::Paint(PaintContext& context) const { const int padding = 8; @@ -73,15 +84,15 @@ void PerformanceOverlayLayer::Paint(PaintContext& context) const { SkScalar height = paint_bounds().height() / 2; SkAutoCanvasRestore save(context.leaf_nodes_canvas, true); - VisualizeStopWatch(*context.leaf_nodes_canvas, context.frame_time, x, y, - width, height - padding, - options_ & kVisualizeRasterizerStatistics, - options_ & kDisplayRasterizerStatistics, "GPU"); + VisualizeStopWatch( + *context.leaf_nodes_canvas, context.frame_time, x, y, width, + height - padding, options_ & kVisualizeRasterizerStatistics, + options_ & kDisplayRasterizerStatistics, "GPU", font_path_); VisualizeStopWatch(*context.leaf_nodes_canvas, context.engine_time, x, y + height, width, height - padding, options_ & kVisualizeEngineStatistics, - options_ & kDisplayEngineStatistics, "UI"); + options_ & kDisplayEngineStatistics, "UI", font_path_); } } // namespace flow diff --git a/flow/layers/performance_overlay_layer.h b/flow/layers/performance_overlay_layer.h index b5f20ecbd7a6b..a47b836c49f3a 100644 --- a/flow/layers/performance_overlay_layer.h +++ b/flow/layers/performance_overlay_layer.h @@ -5,6 +5,8 @@ #ifndef FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ #define FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ +#include + #include "flutter/flow/layers/layer.h" #include "flutter/fml/macros.h" @@ -17,12 +19,14 @@ const int kVisualizeEngineStatistics = 1 << 3; class PerformanceOverlayLayer : public Layer { public: - explicit PerformanceOverlayLayer(uint64_t options); + explicit PerformanceOverlayLayer(uint64_t options, + const char* font_path = nullptr); void Paint(PaintContext& context) const override; private: int options_; + std::string font_path_; FML_DISALLOW_COPY_AND_ASSIGN(PerformanceOverlayLayer); }; diff --git a/flow/layers/performance_overlay_layer_unittests.cc b/flow/layers/performance_overlay_layer_unittests.cc new file mode 100644 index 0000000000000..21eb30653c50f --- /dev/null +++ b/flow/layers/performance_overlay_layer_unittests.cc @@ -0,0 +1,90 @@ +// Copyright 2013 The Flutter 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/performance_overlay_layer.h" +#include "flutter/flow/raster_cache.h" + +#include "third_party/skia/include/core/SkSurface.h" +#include "third_party/skia/include/utils/SkBase64.h" + +#include "gtest/gtest.h" + +// To get the size of kMockedTimes in compile time. +template +constexpr int size(const T (&array)[N]) noexcept { + return N; +} + +constexpr int kMockedTimes[] = {17, 1, 4, 24, 4, 25, 30, 4, 13, 34, + 14, 0, 18, 9, 32, 36, 26, 23, 5, 8, + 32, 18, 29, 16, 29, 18, 0, 36, 33, 10}; + +const char* kGoldenFileName = + "flutter/testing/resources/performance_overlay_gold.png"; + +const char* kNewGoldenFileName = + "flutter/testing/resources/performance_overlay_gold_new.png"; + +// Ensure the same font across different operation systems. +const char* kFontFilePath = + "flutter/third_party/txt/third_party/fonts/Roboto-Regular.ttf"; + +TEST(PerformanceOverlayLayer, Gold) { + flow::Stopwatch mock_stopwatch; + for (int i = 0; i < size(kMockedTimes); ++i) { + mock_stopwatch.SetLapTime( + fml::TimeDelta::FromMilliseconds(kMockedTimes[i])); + } + + const SkImageInfo image_info = SkImageInfo::MakeN32Premul(1000, 1000); + sk_sp surface = SkSurface::MakeRaster(image_info); + + ASSERT_TRUE(surface != nullptr); + + flow::TextureRegistry unused_texture_registry; + + flow::Layer::PaintContext paintContext = { + nullptr, surface->getCanvas(), nullptr, mock_stopwatch, + mock_stopwatch, unused_texture_registry, nullptr, false}; + + flow::PerformanceOverlayLayer layer(flow::kDisplayRasterizerStatistics | + flow::kVisualizeRasterizerStatistics | + flow::kDisplayEngineStatistics | + flow::kVisualizeEngineStatistics, + kFontFilePath); + layer.set_paint_bounds(SkRect::MakeWH(1000, 400)); + surface->getCanvas()->clear(SK_ColorTRANSPARENT); + layer.Paint(paintContext); + + sk_sp snapshot = surface->makeImageSnapshot(); + sk_sp snapshot_data = snapshot->encodeToData(); + + sk_sp golden_data = SkData::MakeFromFileName(kGoldenFileName); + EXPECT_TRUE(golden_data != nullptr) + << "Golden file not found: " << kGoldenFileName << ".\n" + << "Please make sure that the unit test is run from the right directory " + << "(e.g., flutter/engine/src)"; + + const bool golden_data_matches = golden_data->equals(snapshot_data.get()); + if (!golden_data_matches) { + SkFILEWStream wstream(kNewGoldenFileName); + wstream.write(snapshot_data->data(), snapshot_data->size()); + wstream.flush(); + + size_t b64_size = + SkBase64::Encode(snapshot_data->data(), snapshot_data->size(), nullptr); + char* b64_data = new char[b64_size]; + SkBase64::Encode(snapshot_data->data(), snapshot_data->size(), b64_data); + + EXPECT_TRUE(golden_data_matches) + << "Golden file mismatch. Please check " + << "the difference between " << kGoldenFileName << " and " + << kNewGoldenFileName << ", and replace the former " + << "with the latter if the difference looks good.\n\n" + << "See also the base64 encoded " << kNewGoldenFileName << ":\n" + << b64_data; + + delete[] b64_data; + } +} diff --git a/testing/resources/performance_overlay_gold.png b/testing/resources/performance_overlay_gold.png new file mode 100644 index 0000000000000000000000000000000000000000..119551f705793600890950be96b6b0d60688cc54 GIT binary patch literal 16572 zcmeI4c~n!`mjAIV3ra+AKuQrPN(B`KCqS7}f{4nbGLKOiWeN}=Od*ys2ndu?fJ{L_ zWD*dNAwY;S$`}~~1QHp;lmrMQB#`hssp{_4@As--zt#PIfBe>}yOt|@FWh_XIeYK3 z_xH17^lc+Ok=;jj3kV2^+`Mt^u7JSKIsPA^@4y+uoPlZZ@hx2Yrl}A(LWLZk3JClt zaP!(#)4+_S@gQ$AN~Zi4Wx?Lg)Aj297sJiYOr)UXq_{fiLEFQ;i&NEP8jEUxz@-Ki zk<$v&AhV_Oh3p*7K|AGnzuJD2L<5(O)Wh;dlf`jT#K4_TM)v&hbcg;s?Qgypb0v(E zAg)&)#f9(dJkJX)JSoA-2I1kA%d&fPek?&9{Ew+*5%aQsCpKpZ~h_Kc9_9&E1NRloHH} z8j(*tp*XF2pBy)KVZVfcfcN70$9utz_x<>4r+~oE-wFZK6cF3-jT-p4_UO@nz7*Is zDl%DS2`=nu75dND#U$OL+7sogNl&%C{Lh{}k^986v}kdm=1!$;vCYI0FYzX7?0>Qj zw*|2Dilt>`J_GlNQ5jFPg8iB>pQ_T;kxpI_SLUi4mB&s;F2u?zw|*xwCn6$(J2JGg zL*NnqY0Gyq#}KjVe=@SYYFS5^^|M0fjHLwxHp(yjv#<1TZ;O5+U9!X`qq9T=1U{}i ze)}f|*L5{Ye@~^{r`wDB_OQ6%$1D=}{qN25N1qDeuR~>SW;L*Uj zvLLpu3U1n*-;&{A8-*-(7JtAf8PdvR`T{i~b$BTjiUq7R= z@dM_{AKrt0vKM;$Ang(ush8&Ue>RvUSj9elEj?Zth76qgJ%WCWbNO>q#9fa})8V`3 zlYiQI|7VMJ+$&(m*ySSgh)u5m;2Q#=TF3q*KHS@@20cC73*txh=|8*v--njppL4{k z&eMeb+bNsV`=fdFs-%sIV@TwQ)O5Q81bjNI;R=F98)ujln6B25xwP%V{QNo0i1H4B zk16BI!gI&;RK&Z|)&rb^*wK$I&qyrN6pf|SKFoOt#cB)5I$lVv$8m~q9Gb4Y@o`RP zM@P>)Ta52w#ua#)w$KEOHw)v<%=P9ZXtJjh>Gn1BY+a?eBgzZ6SKLdvxTsRIZi303 zUd%>)P^nqM(Gk<%Qc^@HJ%el1QUC1%IK_=4$c%3By+8UvMBJf`7jO;y>{fSrmg_^$ z%r(qa`J`JdD0U~b#LLYs?Pa^;{@mPL7h1z6P2{3;mn+7{VqLv6S<@oD{dfhj3Yk+` zUw`6?Lu;LxUP6y1Vc=3x1rBF~Gm`b49+0$K{bIz3&|osOb6&oDckE6NB^6f#Ul zr)hvjqxA{Ogf0(`RJh3Co>%VO7{P}HKsBU|Q51D@(B|?)QxdVt)8@QW$8XpQ7rfU= z1%*ZIVg4Kz&!&C5wz`@;-I0Wkr!5^#9mQ@oRH4y*26p4WOpa8Lf2j1b+sp`|VO&@r z8^ExKl@YWtV=#AP7`U!_z|zZ#0P1L|d}4dbTf_8#RqKHRyE;?0ANZX~7A97srmo2) ze(ug-8_lfF;NBq_-HRT6} z>3uq-vvd5jb%V$1>V+~494aXuD>80?*I;y|B_}6yPMN&j3RswPS|GuX$+hc(@vNc@hc1?K0i%+^;yV=9;;PVxRP`ufDx*jT(= zl^1fWxjiv4L|f=Si?%sxUdof1x*o5A*6?==g(A5n`;?XAPN)ZHgig-&Ua`}WVtjsn z%;c?6CWlCb;kZ8w$(mYN;J8yV+Z#|Xu%4?6gGDSmx_j+y{_i4@E%Q}X-(zLNe>Gsv zI$c;9s}!Q}Jvb72->*Auedu$bhScKHy9F5!T%4pTX=rRrW2K~y7VN-YorzN|Y`|9p zF=h*P?by?u7Q1dHF;8&m4WEe}S9*XHSF zhYqea*VT2J)CG)_Rm3hSoK8!ua49V+%y&K2HS++&WY#uhs>^s#7mlQoYJ8?V>A-O` zS!C39k+6iK#*16Ilc;SLYMVMaIoU%GW7R3y1@hwK7X}ncw}?6t4auD?Ja({2kZkxl zuQ6I5li7>4*xwTy(<67c!1Su8r|05FcQZ4y@ra0s@#5lQvlLoZ7CD`@UW!6ZetHs1 zba&f(NJ1j38~0*S>CDnod=@Ui)XB-@J}_)5)gK9r?aR=Jm4B}gx5g(#?~*EhZjWrZ zI&EWQuA{?2S2lckF2~qd%jdx@!fZDVG1;q^g&qSwom04QN+E)f%f|sCW-9JRq3jQLXVTvlX=O#Gx&u4eF#^JW-4?Z?4LLbiT zmh%PPk(nG5GqsCB!CBi`2dj+`EM92&xqiYNzDOz_{V-4LPDy`z`;Jfjy~gm&8JlV? z(glZB^`s|*%#}77 z+YsD)^rhOvzBhcYZ-ekwj)BQ@0Dqs)%i<;aOtmU&tq+*MG`MU1s0%@>(+TP6>1`+W zM-Q+XSXk&$jllPA3zi2Vz@%lai9;rGw{Qv)tU>)fKt%0RaKY5{C{2C_x)S zO;pmmiRDh6i5Dy^a+l!}?0t5B0BK-?vswiA_mK$*N_MLR1aX zF3p>QyhsUizjV^xa(G`tn@Q04_{_Y1wLik*O^Onf6o`3VbGw#k~3r ze*BoW(U*%W!7jf%al&Q4lT-1osJ&#1 zDD1B9(r`xnPC;|@;X-6-)hu`;X)_DNtLdBsnme&(g_Yhv|9Gj~33pT~A@9MH_4eEA ze0zWQPQ(0?cgEHhsXitqx$*7W)XXwV#WPl`p`IG(XiqY4xm`1arlssPhQ?FtcJQxR zz7H_f?;PkkApdp`=GAEGMVG=C?T++>u(cc*ZxG5I+~z(3u~S`A#p9*Qa7cqI5xYf& zMKKEtmy5G_m$pd8s3Wzv^qWd~UquzwW}^?t-vV}Z(QTyMNhV6H(ZpDDeW5G$BH}p6 zBv1?(uNxA!XhRMTxko;x7jJ-8^IvF-l~5ujgW!ROY;WlV1qF@BqXQ>f^rVBPlSm}e zWQu+8e2H)ZWLXM1_d06mkhr)%78n}B69n89Da6Olnvh|rmomlp4I#hCa8$&^F zj!ra1$&-U9nRG4Q#*`9&!EnIbM43#c_40mTp4j`_IRW>sT~0b(lTEa%hLIZ{Y%-|| z-|^5O>Zqc4TW1w4O12zHiYBSPW{zx`BdeIrWavLGP#~eS= zB&_z(wu$F0~Uej9(Ov%p2zQ?*hAkgM^}Ojni0-k387LuQ)VCiXhA_EV44SkQ|EQ z8J6y-Vz^k3sYO(8TYSWdplGC+cHkU_(%5hXuC1t~v?uhd*2dQ-sr(S<=H{lRBlPs_A*AQp>_=J9yVuXUo{l8~%%*j|s) zq9PkslMHWJ6pY*oRgnj3?T_9f>aRq@%N@&E{jUNknUKRa=0nzE+Cs(?pyCV9J?yii+$|uue5fWcxh>Fl1?*T{O=u>_tKX1<7wh!E9)04i(YR&VgBG|y z47=Xe_FWJ0%lmiSL}T*|@TC5{wn}p|DTR#7K6>-HJCN@&ZcH@Ee;2mr2LmV+s*%#!GTW8P znE1#M>3?ge&Ia-BURRV%*ky+A4sPrRI}p`To7DHTUcIIS9v3IN4$N%64iTjef_Aop zv{q=~>K2=U*kcA4l0BZ-Zk(qL@-z>yCu(jkRk-(nT{iPp?rt3+*?{(iKnaqaiKXSR zjJD9s%*^=CQt^Wa*C@UiOB4!~4Rjb&#gtB)YOnD$|HUCYKN^Tuhlr@AAp7J*%!@R^1eaaHTKPgXmckNV)bY5xcWe`#_GczM38c1X^ z^j8D9s0?>x?h(lpw7Xl{Ab+cQv9Qpj8+!ODuF_ZN0pF=&_y*GI%u|#+!fsi#mAF>sPOSOuTWNqr_ct zYJR$p5*!i|Te8utW4ZB3@ID8vIWZN)Xq-4@(#SB@6ql2}EY`5zp9R9mFeuAj0+-Hq z>P$vX)Y;V5*1k}xUv7K?qJyEa7JE9@q4n7n7Ly3Wld3$4F|Wy*HT;qJC`PRHB*)s?(5uAqNoOcC@yhpsugibvXBg zhD?*Ntc->=Oa8R#r|@cNSQhWqd?N)NwOsdnsHCKW*U^!qEBj7E{eAJ9X^-sUV%|kY zVn}dDKby_Q8X6k<%Z9gtc;@b|Fu%B{P*PBUk&AT@Kj_y2!lU6J@JtAB_$6DNrgC_q zoTpOeMaue}mKJI>jTYmF%FFu$r-N=py-;{aRw~3I{h*2x!ZS1SyREI?hK+g! z1*Hz>Lc(kfHQVC5X=%#tcI%*qH_z*D_kc6jXkyxPbNRPsD6E;Jq{`VWb=A}2+CnRV zoN_{W2rJEmzuUqm-1)CoRb73F+pEXQT$pDsaYUS)oLth<)Agdn0z~SEMnJ9#RAjQAXk9Q ziCzE#o|CuXH^7=$=)yuZ^T0MK{4=0mB)Ncv?rUjrIl!N@*tV(p#>Pg4Fe8M+)QbxJ zWDRI_C|k)*R0d7nr!54Q@|OOsQ3iq*`nCKRy=k!bPEyCrB)@Vf(C~BZ#jLI#Xup|Q zW#0S%bMD;T2JZ<-+yby1>Ij@Z&*M#Yt<6iGPLRnO37U_Y$TNzgQx_FF&R8xR=YR~T zr+?n>g1Y}gYmA@Tb9XQFkd(HN;NEwxP`>W~QQ^o)pRWxo{Co8dV50lu;$ra;VvQdj zN}jH*z5e#QSyAJc=Uz{I{q&??)noXJxt$#{03_A=2coZ$vvp&Eg%iO540Ltj6JSke zwwcw4Od}90($b7?_02aL7#jzvNgKCZk5ezWQ0V1zaOaZ?w7t15_()I|1;XKQE|*2#<_sRim6Vidf=J3wJaa)&JOdN6aTy08ya0S*b8%)7d}Ex#6-i@H8c z9l|60ogGGpKqk9b+nWQC z_L=_txI#7qb(G*)?Ri>B33h60E=So@Hr)H`$Bv53%ws0PhwAUb+dqu{3NlKNQxUu8 z{q8vTW=ptRyxU;UIhM;eICUO4yE7-ZySpE#5!gDrQtF`RnJksO<@pRUBNE+Nk>$3E&Z2WHIWJ_u@MYq3C9#g zuKzf-dYgWJ*Dkx2?sQzxPvDBrR6xQFU}Fkazicu1#$>~amlCa3Q8lL5Q>(hgi!2}) z0~*7noIvPML-Kk(k!7Q!kuMq>OYosRr615adKCYRZTeVjBYCJeA?vd^}64-5vh@0WEl2>)=zTiU}fw zee>iTRRquNm5JD9yPyu$>gzXEhjIGFI-Q%6&)Rr(;_>t>5N^!kh6w`$ekJx;4i%_u z7W|ZQQBYJm;{uYiHV!6yV|n7L%z4$9{3>W1h-}6IV24l!h*Gz= zvm0j)J0y4>=?MarJvqAN0ZMH+0Ka!O#$$Ndl<_4*SKn!-tT8e&mr78}0A(L2p;={T z&zjVMq<`G%uCE+w^uv0ROV2avVXw;xF%aGqBrIqS3vT9q^JhwOC7kkv;Mx5c6sMl) zDxS!hH#cRH!OpN$VB!#hpmI3=>N0#lcHqmz=?@7o~X29uxbo~5nOXR3*s=-^YYqB5X`U&K$A3Q>?UPx`YQ_1H{ zy1+bn_lSaAy=?=5iD}=+n_8L3aL8vtqX7f;E}giZF=hRs-`kEJ&~T^( zp>BUuau4fhst5iRnfuuBf@a1Pz<*hTWO5c{m?^9G#iC?M>vG07B`rc6Z@u}_mX7fz zY`mmT-qnMn4{N~hLxl--Ql)Q1B9WPr4-y55V*~;#@xBxYxEs$bJ(kb=!vDag8iG;{ zuTG9V1WPs+{7>U*>54=9bTn(-xt!(JxWZi^;!EQHJ}&?K?aL=&aeI`bj)J>?=kRB& z^g<5YP|H=xj)v(AL(^$P#N!sSnyh)7anVC)uF8`^@hB*sfspLh6xc|g0O=_L#dJY27u|hGi^chK zwxOhYLZM!~$7#+Yu4fA>E-qdS5|)wMP$MKNHs;AOs7tCQMcoZ5l>=6ueCkt zMFvQ?3qdaRd$m78hMvg~&93EmPsE7h~KtN9qjr|u+#1uo78$b(}_A?TeIQ8V^YbNS3Vz0sDIHp z^MGH1?@TqA?GFfX=6T7)w z-PBzDtWv|{9Irsg@%_l4!9l&4f2+F&2cu%OKX+0`*FP5UaUI5X>3Ygq?(>wC=~LH#`L1GhI3*g}5T)`sQ@K~cqp8XmyZpjy1Xwl1D0c%7cuPO1k*4N#sVjWP+n{7#Pa zAfCc`_aU2OQ!9S&Dk=(5@3{+$h`9WMhi690rX~)6`_I?jS+^@m7T&C@uDLv&cURW< z9LQikKlS*TzOZnMMt23mM8H&{Z4@a~7gU=M@29LVLc3AVagp-E}|DooUF1K1aPIqg>Ne!%Yj9gkTxga$bX z-T(5)-qcU!c@{Z^K+>v(eXZmdk}#Oh+YcX(;HFaX4O+E@F$ie_t<@w^f;QS|NS6Lz%5BtaOoB zx%f*}Pfy`MM4ODN7yaq%?BPt1rMF2zB<-w%-kl5=lSZ!1x62zD%#YTySwP4VwakyB%_U(>q&1!rL4WZTAv|`R6IEWj2SPT()`Qz=k7Q5 ztOA$@OFci8+40FuQq>FbFl2L%r0_jOqH3JX9p}lbtE+bkF4D!E!^KJ(a0CnVw$$`I zZmaVgHz%QS3bJVx$Whw9&_ymkaWq5a>@<%?M{kh;V2s6YYH6;0(V-6x4F%Y4NNENv zS#obHi-umW81Y!jO|iEo0j7Tzh_0QToyOxKbgZPDVVa*?e!w>Zk8G@_VLlMQxi8b) zO&A2=?*nI%$YXtsS*-a*|AozCpsw5;0OeZcv~St+Y&tCLY`7SJ$6IVl7V0DjUYpGa zjO#b}v7(Piw5j)==u`%4HT}81r>ZJ?yuul4mc)1K3^wz#W4S85NmRy5sy;>xNOm1i z6n9;{qoczJkJj7_6p{s||MqmM0h2eU2jR^A7dUW^u2k##`9h}RXSqad3N`9KU?3=B zKUC%C=Pv?ORp$;!RV=+`DxM`1`1KdUgEC96uN<(Hz1b;l!1zEL0@oQ>qw$A>pit*m zyVQubGpDX3o>Xu@d)d$Rs-BRn$LJb0nJ@SO8E12$2o>f^tZFmbyJTatd9%ID0j{?9 zsAZ5GKYEudxD+%@Q-kk+|!fzNxPu4T31%}Uk;#s>|zr}SL zT^xoL-yIy%w9S&)b_krNK(_tJ36!qy87i>7d>|Nrq4xv6>_>=b``sRt?lORnvMQUR zM2#C5J?dm6XbFM#fT9|;(jp~OtbKzGaJhkNR}p`L!j^E{(K)a zj#Ld>p9eI~4hXNN13pzB*5VcbU%VC;7RD@VleVz|sJN=8<}%P7_2Q3?kVy^h?2jv2 zTg$J9>S&ymjUdL5d4g0OtofIn3dRV3v$tB?OR~THJF^43(YY(nZ>*sh>EzI$dp2sB zimslXQgz-Fjc2!Ka0ZK6msgs~LH~=)AduJ9{0n*6m{y>PS_;XA^2TUOPETBQnqn^g zu8m%lzvKk)`e>!QjCHNwd~!>ygv@T)aG-vTgX-8CsWo;ma&nTn#cy}AwvlH>iZuf1 zqbmL|!{_FiycuhmhL#`lKZT0#aXY?A}Q4us3X9F5ulgjsWfyQR#uR zTSp%4!b+r+tx~I-RuQD{C*o9(Tue0}QIJ^yv@y(dBMb2DuT22h?X`l#V6bc)4&pQS z<#hpqjAW(nBrYy23~`sEAX`lU^9^k?#!mtzH|b#XBVG_Ap23&`dq}VlfO5GPb%dm3 zx4hOc)rjUig=c)xn$LH(yk|)b4UJu&pYPgr(M1btWlu^oI37GD8!i^hRRnrvvNMyq zIa+W9ZZ9(k7;80Xj&Ttz0&PfX12!-u%N2B|H4hX>D)1=Vq3p715@*VR@8Dl_FvBEl zr+OH7(F_Rl4gVKk^SI~5qMSXWA{GxZWo8-4%8<%QLa@ zCbnZ}h^42_AfQst##zz?6N_qC^F$LveQ{y$ZyzcR=XxAh;UF1m2RK_whyog++K(#| zMfvGbqCBj4W4S5Hc+b`k=UxJE4jNHFD~Z*neAYWYQhI{a3PTuL43VR+q3nSHV}`hy z^*_FE`>)7a)Me=e)Tp!$^17s?q~44#rXCQqVk>~sbSYjim{Q$~BRha*=5P2-@b7>u z760rT%1o{UXnT*;EK&F`37Kp3c-GbLU$w_V= zw!tL@56uanTj^F|k*LI3>os3b8)6SyRBIzZUr2Uf;L;%gM4CZQ-e!bMFfx}KqFm(> zl#QvVxPY8+*U^mP-dcF*mNs(5rAKnG-O-rz`MIGku^Qt0Q#gam(KRp3Qt{+|uCMp= zSecYqIHVLd(NE~?uonJ3VSzQU^Yp&Ep09Hma*M00C1bG|%tTmNSgb}!*ayA`IyT5@ zvO;~jUY@6r!ZxWRU=Oo7KUNC}*Cz{r(tAL9_VD4nq16QF^Uj`3>$*z+onoN^URRWt zS2V16orbmFMAeHI715v-axIq*n3-|jUES2@ z$I^ET+AEw^OTQskcfbWdv1i!>e(_Nj__ z4NNY9envCM_bx&%aXZ4o9ruFC%?3FZ3&`}h?ZdL~eU17RBz>kpEa&tQsikkxAd(@R zDuVdEM@9Yfj#ZeTV1$q?2%ovDjLp@K4r_>1ZbDms3O0GXj*t<&SWK73E*k?gLD>+S zX~4B$`nuobQZk6*LxZ8yz2CXsRfI z?|!*rH1k>~wkIhi>xNOR1d^JLN`=P0^v6UMh9b(L4Nx1NvHiEV`x_b02 z_CP@YBMb_?c~1j>F48|0uxp9H~rDJ0N4OtciH=%?j|3#bfdXLpOce`wekkT zcg$~pNpkhD4FwzTTSMaQ-a+LH%IB(UF+py>+c_RxJWmH~8H|eb*{}B8#rMb>&SvaI zaq;d5kmV(B6UiihHQ++-Zd#{q<_TZa)SQ_I(Ls{m0n9H10T+=0Em5;CvDnxsV#@b+2Vje=`Ks zuRwm`l@t}ZCxGTj1S!a6zA-|Wbrcd-9}MzG1{~ZVvE6nsAp~?eEggo0ZOPXGE&gRz zRu=k#Q^!hVWaN3!s%yD6U}DUzt*T;1YI%tPKblT^_Nw}W!6K=A#-@AMuFPn#N(F$j zq`32Wd%B9|hz6hpMY{zpa_Z`S!nzZ<#ZFH0!pVF>GS@4UaM{=K(}-9PB!01qr~*>m z>Vsixy=hgyFV@URPtWs$UBdPS7(cH-5K=e6{tpsA-Bd71@9fGZDLJ6WZG)eO?s=BX z=O`q=ajMQcFq2CxR~YB{D7VTpWUcvQ{cLXzD`{Xz<)G+M2IxqG_)j)_+JWrauF`h~ zuLoMKTC2T~OEI&TpwYI9hk6LMzk=>5f`2uchid~lZi^~t^X6Y^jU#IQ1Qxs0an~yT zqUol+=Q!w28XFzcz%sxKSiH06b`5`jAmBGDpm}R-z3TNAH+RWfyM^nt7*^Q6;CSgw zf)5V|SK5u@m)bw2cX#rGD0OKBW?o%6xDBrh?a|(0@wJa9y}&pRzBhn#2Ted0pnH=! z-=9}RD6!jIeT}DMOi9oNm6rw!5P_Qhv)BcbI z4;K~W4LR>Mz)~1z9wFAb69}b5HeZT6_KJ}-*mt2aFW1SfzqCS2V z@ztb{{GuUYuoolpGJH+7A!m1y64{C@z; C%{D;* literal 0 HcmV?d00001 From 12d0b95c2413ebbf103c6695580b4f8655d8b411 Mon Sep 17 00:00:00 2001 From: nathanrogersgoogle Date: Fri, 8 Feb 2019 15:14:06 -0800 Subject: [PATCH 0106/1117] Don't call OnAnimatorNotifyIdle if a frame is scheduled (#7746) If a frame is scheduled by the time the delayed animator notify idle task runs, then we should not call |NotifyIdle|. Also, add a trace event in the task, to make it more clear in traces when a notify idle call is coming from here (as opposed to |Animator::AwaitVSync|). --- shell/common/animator.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/shell/common/animator.cc b/shell/common/animator.cc index 19aaad5394f60..9d31a0c2eabab 100644 --- a/shell/common/animator.cc +++ b/shell/common/animator.cc @@ -124,10 +124,13 @@ void Animator::BeginFrame(fml::TimePoint frame_start_time, if (!self.get()) { return; } - // If our (this task's) task id is the same as the current one, then - // no further frames were produced, and it is safe (w.r.t. jank) to - // notify the engine we are idle. - if (notify_idle_task_id == self->notify_idle_task_id_) { + // If our (this task's) task id is the same as the current one + // (meaning there were no follow up frames to the |BeginFrame| call + // that posted this task) and no frame is currently scheduled, then + // assume that we are idle, and notify the engine of this. + if (notify_idle_task_id == self->notify_idle_task_id_ && + !self->frame_scheduled_) { + TRACE_EVENT0("flutter", "BeginFrame idle callback"); self->delegate_.OnAnimatorNotifyIdle(Dart_TimelineGetMicros() + 100000); } From f9252e72f805b510046135f3c10f7b15501e082d Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 8 Feb 2019 15:15:47 -0800 Subject: [PATCH 0107/1117] allow specifying out directory root (#7753) --- tools/gn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/gn b/tools/gn index 3853504d19e77..f7cfb0ac36d30 100755 --- a/tools/gn +++ b/tools/gn @@ -43,7 +43,7 @@ def get_out_dir(args): if args.enable_vulkan: target_dir.append('vulkan') - return os.path.join('out', '_'.join(target_dir)) + return os.path.join(args.out_dir, 'out', '_'.join(target_dir)) def to_command_line(gn_args): def merge(key, value): @@ -271,6 +271,8 @@ def parse_args(args): parser.add_argument('--coverage', default=False, action='store_true') + parser.add_argument('--out-dir', default='', type=str) + return parser.parse_args(args) def main(argv): From a6753b08a0ace35045dc59f31029a0fe47859e78 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 8 Feb 2019 16:31:34 -0800 Subject: [PATCH 0108/1117] Roll src/third_party/dart 52f5e34dbf..174d6fec3d (12 commits) 174d6fec3d [vm] Increase the size of the irregexp interpreter's backtracing stack. 128139be71 [vm] Rename RawObject::Size to RawObject::HeapSize. d136a35244 [dart/fuzzer] Add O3 as random command line switch afe37d7fe0 Add migration support for named parameters (with and without default values). eab295e521 [vm/bytecode] Split bytecode reading from kernel metadata 3afac84840 [vm, aot] Remove KernelProgramInfo etc before Symbols::Compact. 69d0411768 Fix exception when completion is requested not in a Dart file. be79eb4517 Ship experiment 'set-literals' 88fea76f58 [kernel] Add text (de)serialization for simple function types 65ac1d08d9 Dartdevc co19 tests - skip co19_2 tests that time out 5b7b34eb3a Add a "permissive mode" to the nullability migration tool. 60527d7b97 Support computation of ResolutionImpact through ImpactData based on kernel --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c6582606e507c..358a912455191 100644 --- a/DEPS +++ b/DEPS @@ -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': '52f5e34dbfed9d2e594d969bbefc0f39cf75c213', + 'dart_revision': '174d6fec3dc3e1af3b07439179769dbbedd88703', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 26f40ae27edfb..047bb86021ced 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 9ae7c8c7be5c5ee36d6a16b2c1513a82 +Signature: d319807b58e8646bccb8cf9d185b3ca9 UNUSED LICENSES: From 68396ae3a387e332e299b48296931415d31f3d45 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Fri, 8 Feb 2019 17:40:38 -0800 Subject: [PATCH 0109/1117] Throttle picture raster cache (#7759) This decreases worst_frame_rasterizer_time_millis from 30ms to 10ms when we enabled picture raster cache in tiles_scroll (i.e., lower the threshold from 10 to 5). --- flow/raster_cache.cc | 12 ++++++++++-- flow/raster_cache.h | 14 +++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index 0827a2de405e9..fe42639fe7899 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -36,8 +36,11 @@ void RasterCacheResult::draw(SkCanvas& canvas, const SkPaint* paint) const { canvas.drawImage(image_, bounds.fLeft, bounds.fTop, paint); } -RasterCache::RasterCache(size_t threshold) - : threshold_(threshold), checkerboard_images_(false), weak_factory_(this) {} +RasterCache::RasterCache(size_t threshold, size_t picture_cache_limit_per_frame) + : threshold_(threshold), + picture_cache_limit_per_frame_(picture_cache_limit_per_frame), + checkerboard_images_(false), + weak_factory_(this) {} RasterCache::~RasterCache() = default; @@ -182,6 +185,9 @@ bool RasterCache::Prepare(GrContext* context, SkColorSpace* dst_color_space, bool is_complex, bool will_change) { + if (picture_cached_this_frame_ >= picture_cache_limit_per_frame_) { + return false; + } if (!IsPictureWorthRasterizing(picture, will_change, is_complex)) { // We only deal with pictures that are worthy of rasterization. return false; @@ -211,6 +217,7 @@ bool RasterCache::Prepare(GrContext* context, entry.image = RasterizePicture(picture, context, transformation_matrix, dst_color_space, checkerboard_images_); } + picture_cached_this_frame_++; return true; } @@ -232,6 +239,7 @@ void RasterCache::SweepAfterFrame() { using LayerCache = LayerRasterCacheKey::Map; SweepOneCacheAfterFrame(picture_cache_); SweepOneCacheAfterFrame(layer_cache_); + picture_cached_this_frame_ = 0; } void RasterCache::Clear() { diff --git a/flow/raster_cache.h b/flow/raster_cache.h index cb4383f41fb52..74ce010b07c8c 100644 --- a/flow/raster_cache.h +++ b/flow/raster_cache.h @@ -42,7 +42,15 @@ struct PrerollContext; class RasterCache { public: - explicit RasterCache(size_t threshold = 3); + // The default max number of picture raster caches to be generated per frame. + // Generating too many caches in one frame may cause jank on that frame. This + // limit allows us to throttle the cache and distribute the work across + // multiple frames. + static constexpr int kDefaultPictureCacheLimitPerFrame = 3; + + explicit RasterCache( + size_t threshold = 3, + size_t picture_cache_limit_per_frame = kDefaultPictureCacheLimitPerFrame); ~RasterCache(); @@ -67,6 +75,8 @@ class RasterCache { // 1. The picture is not worth rasterizing // 2. The matrix is singular // 3. The picture is accessed too few times + // 4. There are too many pictures to be cached in the current frame. + // (See also kDefaultPictureCacheLimitPerFrame.) bool Prepare(GrContext* context, SkPicture* picture, const SkMatrix& transformation_matrix, @@ -110,6 +120,8 @@ class RasterCache { } const size_t threshold_; + const size_t picture_cache_limit_per_frame_; + size_t picture_cached_this_frame_ = 0; PictureRasterCacheKey::Map picture_cache_; LayerRasterCacheKey::Map layer_cache_; bool checkerboard_images_; From 2a648b90388898f33fd7044c77df2b104293d2c7 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 8 Feb 2019 21:33:10 -0500 Subject: [PATCH 0110/1117] Roll src/third_party/skia be39f713e530..706a7cd1e826 (4 commits) (#7761) https://skia.googlesource.com/skia.git/%2Blog/be39f713e530..706a7cd1e826 git log be39f713e5302317e760f51c0f114761ddc969ca..706a7cd1e8269039c7a9a3f66f0334673bb1e8dd --date=short --no-merges --format=%ad %ae %s 2019-02-08 herb@google.com Clearify code around hasImage and hasPath 2019-02-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 7fb0b73b1aa7..9686153413f3 (1 commits) 2019-02-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 cd4f1fbaabce..2b0553ce59c3 (7 commits) 2019-02-08 reed@google.com update dox for pathmeasure The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 358a912455191..0cfd12418b718 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': 'be39f713e5302317e760f51c0f114761ddc969ca', + 'skia_revision': '706a7cd1e8269039c7a9a3f66f0334673bb1e8dd', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 40e02d5165982..388063af0980d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: af6337ee787fca049a3ae700ea88f1d1 +Signature: 97fa2d8292b253a78d1b7b1445417696 UNUSED LICENSES: From 2146cdeca8e1f2dc3e82a6014939516b0af2e980 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 9 Feb 2019 01:37:48 -0500 Subject: [PATCH 0111/1117] Roll src/third_party/skia 706a7cd1e826..87461aad7285 (1 commits) (#7763) https://skia.googlesource.com/skia.git/%2Blog/706a7cd1e826..87461aad7285 git log 706a7cd1e8269039c7a9a3f66f0334673bb1e8dd..87461aad7285c745a418c7102ab349890347a4cb --date=short --no-merges --format=%ad %ae %s 2019-02-09 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 0cfd12418b718..8bbfde68bdf04 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': '706a7cd1e8269039c7a9a3f66f0334673bb1e8dd', + 'skia_revision': '87461aad7285c745a418c7102ab349890347a4cb', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 388063af0980d..7747e17ebfdca 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 97fa2d8292b253a78d1b7b1445417696 +Signature: efbdad2c346737b589f0582e8aa3ba0e UNUSED LICENSES: From d130f15af69f7cfb6ecbcb1d0e2c040e515e3561 Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Fri, 8 Feb 2019 23:57:46 -0800 Subject: [PATCH 0112/1117] Add x bit to some python scripts (#7764) --- sky/tools/dist_dart_pkg.py | 0 sky/tools/install_framework_headers.py | 0 sky/tools/objcopy.py | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 sky/tools/dist_dart_pkg.py mode change 100644 => 100755 sky/tools/install_framework_headers.py mode change 100644 => 100755 sky/tools/objcopy.py diff --git a/sky/tools/dist_dart_pkg.py b/sky/tools/dist_dart_pkg.py old mode 100644 new mode 100755 diff --git a/sky/tools/install_framework_headers.py b/sky/tools/install_framework_headers.py old mode 100644 new mode 100755 diff --git a/sky/tools/objcopy.py b/sky/tools/objcopy.py old mode 100644 new mode 100755 From 693645e4645001ae460d5794fa6f5c7066677955 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Sat, 9 Feb 2019 00:13:14 -0800 Subject: [PATCH 0113/1117] Revert "Add mock capability to PerformanceOverlayLayer (#7537)" (#7765) This reverts commit 5f3f3bd9839b0d4e185a13de05fc6b9a24e6067f. --- ci/licenses_golden/licenses_flutter | 1 - flow/BUILD.gn | 1 - flow/layers/performance_overlay_layer.cc | 31 ++---- flow/layers/performance_overlay_layer.h | 6 +- .../performance_overlay_layer_unittests.cc | 90 ------------------ .../resources/performance_overlay_gold.png | Bin 16572 -> 0 bytes 6 files changed, 11 insertions(+), 118 deletions(-) delete mode 100644 flow/layers/performance_overlay_layer_unittests.cc delete mode 100644 testing/resources/performance_overlay_gold.png diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 35ea7cad1e859..7d5e643fdcb6d 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -57,7 +57,6 @@ 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/performance_overlay_layer_unittests.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.h FILE: ../../../flutter/flow/layers/picture_layer.cc diff --git a/flow/BUILD.gn b/flow/BUILD.gn index 003fb326becb1..6b345aa87a35a 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -95,7 +95,6 @@ executable("flow_unittests") { sources = [ "matrix_decomposition_unittests.cc", "raster_cache_unittests.cc", - "layers/performance_overlay_layer_unittests.cc", ] deps = [ diff --git a/flow/layers/performance_overlay_layer.cc b/flow/layers/performance_overlay_layer.cc index e7f40058c3bfb..c80786e866e1b 100644 --- a/flow/layers/performance_overlay_layer.cc +++ b/flow/layers/performance_overlay_layer.cc @@ -15,12 +15,8 @@ namespace { void DrawStatisticsText(SkCanvas& canvas, const std::string& string, int x, - int y, - const std::string& font_path) { + int y) { SkFont font; - if (font_path != "") { - font = SkFont(SkTypeface::MakeFromFile(font_path.c_str())); - } font.setSize(15); font.setLinearMetrics(false); SkPaint paint; @@ -37,8 +33,7 @@ void VisualizeStopWatch(SkCanvas& canvas, SkScalar height, bool show_graph, bool show_labels, - const std::string& label_prefix, - const std::string& font_path) { + const std::string& label_prefix) { const int label_x = 8; // distance from x const int label_y = -10; // distance from y+height @@ -56,20 +51,14 @@ void VisualizeStopWatch(SkCanvas& canvas, stream << label_prefix << " " << "max " << max_ms_per_frame << " ms/frame, " << "avg " << average_ms_per_frame << " ms/frame"; - DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y, - font_path); + DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y); } } } // namespace -PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options, - const char* font_path) - : options_(options) { - if (font_path != nullptr) { - font_path_ = font_path; - } -} +PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options) + : options_(options) {} void PerformanceOverlayLayer::Paint(PaintContext& context) const { const int padding = 8; @@ -84,15 +73,15 @@ void PerformanceOverlayLayer::Paint(PaintContext& context) const { SkScalar height = paint_bounds().height() / 2; SkAutoCanvasRestore save(context.leaf_nodes_canvas, true); - VisualizeStopWatch( - *context.leaf_nodes_canvas, context.frame_time, x, y, width, - height - padding, options_ & kVisualizeRasterizerStatistics, - options_ & kDisplayRasterizerStatistics, "GPU", font_path_); + VisualizeStopWatch(*context.leaf_nodes_canvas, context.frame_time, x, y, + width, height - padding, + options_ & kVisualizeRasterizerStatistics, + options_ & kDisplayRasterizerStatistics, "GPU"); VisualizeStopWatch(*context.leaf_nodes_canvas, context.engine_time, x, y + height, width, height - padding, options_ & kVisualizeEngineStatistics, - options_ & kDisplayEngineStatistics, "UI", font_path_); + options_ & kDisplayEngineStatistics, "UI"); } } // namespace flow diff --git a/flow/layers/performance_overlay_layer.h b/flow/layers/performance_overlay_layer.h index a47b836c49f3a..b5f20ecbd7a6b 100644 --- a/flow/layers/performance_overlay_layer.h +++ b/flow/layers/performance_overlay_layer.h @@ -5,8 +5,6 @@ #ifndef FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ #define FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ -#include - #include "flutter/flow/layers/layer.h" #include "flutter/fml/macros.h" @@ -19,14 +17,12 @@ const int kVisualizeEngineStatistics = 1 << 3; class PerformanceOverlayLayer : public Layer { public: - explicit PerformanceOverlayLayer(uint64_t options, - const char* font_path = nullptr); + explicit PerformanceOverlayLayer(uint64_t options); void Paint(PaintContext& context) const override; private: int options_; - std::string font_path_; FML_DISALLOW_COPY_AND_ASSIGN(PerformanceOverlayLayer); }; diff --git a/flow/layers/performance_overlay_layer_unittests.cc b/flow/layers/performance_overlay_layer_unittests.cc deleted file mode 100644 index 21eb30653c50f..0000000000000 --- a/flow/layers/performance_overlay_layer_unittests.cc +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2013 The Flutter 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/performance_overlay_layer.h" -#include "flutter/flow/raster_cache.h" - -#include "third_party/skia/include/core/SkSurface.h" -#include "third_party/skia/include/utils/SkBase64.h" - -#include "gtest/gtest.h" - -// To get the size of kMockedTimes in compile time. -template -constexpr int size(const T (&array)[N]) noexcept { - return N; -} - -constexpr int kMockedTimes[] = {17, 1, 4, 24, 4, 25, 30, 4, 13, 34, - 14, 0, 18, 9, 32, 36, 26, 23, 5, 8, - 32, 18, 29, 16, 29, 18, 0, 36, 33, 10}; - -const char* kGoldenFileName = - "flutter/testing/resources/performance_overlay_gold.png"; - -const char* kNewGoldenFileName = - "flutter/testing/resources/performance_overlay_gold_new.png"; - -// Ensure the same font across different operation systems. -const char* kFontFilePath = - "flutter/third_party/txt/third_party/fonts/Roboto-Regular.ttf"; - -TEST(PerformanceOverlayLayer, Gold) { - flow::Stopwatch mock_stopwatch; - for (int i = 0; i < size(kMockedTimes); ++i) { - mock_stopwatch.SetLapTime( - fml::TimeDelta::FromMilliseconds(kMockedTimes[i])); - } - - const SkImageInfo image_info = SkImageInfo::MakeN32Premul(1000, 1000); - sk_sp surface = SkSurface::MakeRaster(image_info); - - ASSERT_TRUE(surface != nullptr); - - flow::TextureRegistry unused_texture_registry; - - flow::Layer::PaintContext paintContext = { - nullptr, surface->getCanvas(), nullptr, mock_stopwatch, - mock_stopwatch, unused_texture_registry, nullptr, false}; - - flow::PerformanceOverlayLayer layer(flow::kDisplayRasterizerStatistics | - flow::kVisualizeRasterizerStatistics | - flow::kDisplayEngineStatistics | - flow::kVisualizeEngineStatistics, - kFontFilePath); - layer.set_paint_bounds(SkRect::MakeWH(1000, 400)); - surface->getCanvas()->clear(SK_ColorTRANSPARENT); - layer.Paint(paintContext); - - sk_sp snapshot = surface->makeImageSnapshot(); - sk_sp snapshot_data = snapshot->encodeToData(); - - sk_sp golden_data = SkData::MakeFromFileName(kGoldenFileName); - EXPECT_TRUE(golden_data != nullptr) - << "Golden file not found: " << kGoldenFileName << ".\n" - << "Please make sure that the unit test is run from the right directory " - << "(e.g., flutter/engine/src)"; - - const bool golden_data_matches = golden_data->equals(snapshot_data.get()); - if (!golden_data_matches) { - SkFILEWStream wstream(kNewGoldenFileName); - wstream.write(snapshot_data->data(), snapshot_data->size()); - wstream.flush(); - - size_t b64_size = - SkBase64::Encode(snapshot_data->data(), snapshot_data->size(), nullptr); - char* b64_data = new char[b64_size]; - SkBase64::Encode(snapshot_data->data(), snapshot_data->size(), b64_data); - - EXPECT_TRUE(golden_data_matches) - << "Golden file mismatch. Please check " - << "the difference between " << kGoldenFileName << " and " - << kNewGoldenFileName << ", and replace the former " - << "with the latter if the difference looks good.\n\n" - << "See also the base64 encoded " << kNewGoldenFileName << ":\n" - << b64_data; - - delete[] b64_data; - } -} diff --git a/testing/resources/performance_overlay_gold.png b/testing/resources/performance_overlay_gold.png deleted file mode 100644 index 119551f705793600890950be96b6b0d60688cc54..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16572 zcmeI4c~n!`mjAIV3ra+AKuQrPN(B`KCqS7}f{4nbGLKOiWeN}=Od*ys2ndu?fJ{L_ zWD*dNAwY;S$`}~~1QHp;lmrMQB#`hssp{_4@As--zt#PIfBe>}yOt|@FWh_XIeYK3 z_xH17^lc+Ok=;jj3kV2^+`Mt^u7JSKIsPA^@4y+uoPlZZ@hx2Yrl}A(LWLZk3JClt zaP!(#)4+_S@gQ$AN~Zi4Wx?Lg)Aj297sJiYOr)UXq_{fiLEFQ;i&NEP8jEUxz@-Ki zk<$v&AhV_Oh3p*7K|AGnzuJD2L<5(O)Wh;dlf`jT#K4_TM)v&hbcg;s?Qgypb0v(E zAg)&)#f9(dJkJX)JSoA-2I1kA%d&fPek?&9{Ew+*5%aQsCpKpZ~h_Kc9_9&E1NRloHH} z8j(*tp*XF2pBy)KVZVfcfcN70$9utz_x<>4r+~oE-wFZK6cF3-jT-p4_UO@nz7*Is zDl%DS2`=nu75dND#U$OL+7sogNl&%C{Lh{}k^986v}kdm=1!$;vCYI0FYzX7?0>Qj zw*|2Dilt>`J_GlNQ5jFPg8iB>pQ_T;kxpI_SLUi4mB&s;F2u?zw|*xwCn6$(J2JGg zL*NnqY0Gyq#}KjVe=@SYYFS5^^|M0fjHLwxHp(yjv#<1TZ;O5+U9!X`qq9T=1U{}i ze)}f|*L5{Ye@~^{r`wDB_OQ6%$1D=}{qN25N1qDeuR~>SW;L*Uj zvLLpu3U1n*-;&{A8-*-(7JtAf8PdvR`T{i~b$BTjiUq7R= z@dM_{AKrt0vKM;$Ang(ush8&Ue>RvUSj9elEj?Zth76qgJ%WCWbNO>q#9fa})8V`3 zlYiQI|7VMJ+$&(m*ySSgh)u5m;2Q#=TF3q*KHS@@20cC73*txh=|8*v--njppL4{k z&eMeb+bNsV`=fdFs-%sIV@TwQ)O5Q81bjNI;R=F98)ujln6B25xwP%V{QNo0i1H4B zk16BI!gI&;RK&Z|)&rb^*wK$I&qyrN6pf|SKFoOt#cB)5I$lVv$8m~q9Gb4Y@o`RP zM@P>)Ta52w#ua#)w$KEOHw)v<%=P9ZXtJjh>Gn1BY+a?eBgzZ6SKLdvxTsRIZi303 zUd%>)P^nqM(Gk<%Qc^@HJ%el1QUC1%IK_=4$c%3By+8UvMBJf`7jO;y>{fSrmg_^$ z%r(qa`J`JdD0U~b#LLYs?Pa^;{@mPL7h1z6P2{3;mn+7{VqLv6S<@oD{dfhj3Yk+` zUw`6?Lu;LxUP6y1Vc=3x1rBF~Gm`b49+0$K{bIz3&|osOb6&oDckE6NB^6f#Ul zr)hvjqxA{Ogf0(`RJh3Co>%VO7{P}HKsBU|Q51D@(B|?)QxdVt)8@QW$8XpQ7rfU= z1%*ZIVg4Kz&!&C5wz`@;-I0Wkr!5^#9mQ@oRH4y*26p4WOpa8Lf2j1b+sp`|VO&@r z8^ExKl@YWtV=#AP7`U!_z|zZ#0P1L|d}4dbTf_8#RqKHRyE;?0ANZX~7A97srmo2) ze(ug-8_lfF;NBq_-HRT6} z>3uq-vvd5jb%V$1>V+~494aXuD>80?*I;y|B_}6yPMN&j3RswPS|GuX$+hc(@vNc@hc1?K0i%+^;yV=9;;PVxRP`ufDx*jT(= zl^1fWxjiv4L|f=Si?%sxUdof1x*o5A*6?==g(A5n`;?XAPN)ZHgig-&Ua`}WVtjsn z%;c?6CWlCb;kZ8w$(mYN;J8yV+Z#|Xu%4?6gGDSmx_j+y{_i4@E%Q}X-(zLNe>Gsv zI$c;9s}!Q}Jvb72->*Auedu$bhScKHy9F5!T%4pTX=rRrW2K~y7VN-YorzN|Y`|9p zF=h*P?by?u7Q1dHF;8&m4WEe}S9*XHSF zhYqea*VT2J)CG)_Rm3hSoK8!ua49V+%y&K2HS++&WY#uhs>^s#7mlQoYJ8?V>A-O` zS!C39k+6iK#*16Ilc;SLYMVMaIoU%GW7R3y1@hwK7X}ncw}?6t4auD?Ja({2kZkxl zuQ6I5li7>4*xwTy(<67c!1Su8r|05FcQZ4y@ra0s@#5lQvlLoZ7CD`@UW!6ZetHs1 zba&f(NJ1j38~0*S>CDnod=@Ui)XB-@J}_)5)gK9r?aR=Jm4B}gx5g(#?~*EhZjWrZ zI&EWQuA{?2S2lckF2~qd%jdx@!fZDVG1;q^g&qSwom04QN+E)f%f|sCW-9JRq3jQLXVTvlX=O#Gx&u4eF#^JW-4?Z?4LLbiT zmh%PPk(nG5GqsCB!CBi`2dj+`EM92&xqiYNzDOz_{V-4LPDy`z`;Jfjy~gm&8JlV? z(glZB^`s|*%#}77 z+YsD)^rhOvzBhcYZ-ekwj)BQ@0Dqs)%i<;aOtmU&tq+*MG`MU1s0%@>(+TP6>1`+W zM-Q+XSXk&$jllPA3zi2Vz@%lai9;rGw{Qv)tU>)fKt%0RaKY5{C{2C_x)S zO;pmmiRDh6i5Dy^a+l!}?0t5B0BK-?vswiA_mK$*N_MLR1aX zF3p>QyhsUizjV^xa(G`tn@Q04_{_Y1wLik*O^Onf6o`3VbGw#k~3r ze*BoW(U*%W!7jf%al&Q4lT-1osJ&#1 zDD1B9(r`xnPC;|@;X-6-)hu`;X)_DNtLdBsnme&(g_Yhv|9Gj~33pT~A@9MH_4eEA ze0zWQPQ(0?cgEHhsXitqx$*7W)XXwV#WPl`p`IG(XiqY4xm`1arlssPhQ?FtcJQxR zz7H_f?;PkkApdp`=GAEGMVG=C?T++>u(cc*ZxG5I+~z(3u~S`A#p9*Qa7cqI5xYf& zMKKEtmy5G_m$pd8s3Wzv^qWd~UquzwW}^?t-vV}Z(QTyMNhV6H(ZpDDeW5G$BH}p6 zBv1?(uNxA!XhRMTxko;x7jJ-8^IvF-l~5ujgW!ROY;WlV1qF@BqXQ>f^rVBPlSm}e zWQu+8e2H)ZWLXM1_d06mkhr)%78n}B69n89Da6Olnvh|rmomlp4I#hCa8$&^F zj!ra1$&-U9nRG4Q#*`9&!EnIbM43#c_40mTp4j`_IRW>sT~0b(lTEa%hLIZ{Y%-|| z-|^5O>Zqc4TW1w4O12zHiYBSPW{zx`BdeIrWavLGP#~eS= zB&_z(wu$F0~Uej9(Ov%p2zQ?*hAkgM^}Ojni0-k387LuQ)VCiXhA_EV44SkQ|EQ z8J6y-Vz^k3sYO(8TYSWdplGC+cHkU_(%5hXuC1t~v?uhd*2dQ-sr(S<=H{lRBlPs_A*AQp>_=J9yVuXUo{l8~%%*j|s) zq9PkslMHWJ6pY*oRgnj3?T_9f>aRq@%N@&E{jUNknUKRa=0nzE+Cs(?pyCV9J?yii+$|uue5fWcxh>Fl1?*T{O=u>_tKX1<7wh!E9)04i(YR&VgBG|y z47=Xe_FWJ0%lmiSL}T*|@TC5{wn}p|DTR#7K6>-HJCN@&ZcH@Ee;2mr2LmV+s*%#!GTW8P znE1#M>3?ge&Ia-BURRV%*ky+A4sPrRI}p`To7DHTUcIIS9v3IN4$N%64iTjef_Aop zv{q=~>K2=U*kcA4l0BZ-Zk(qL@-z>yCu(jkRk-(nT{iPp?rt3+*?{(iKnaqaiKXSR zjJD9s%*^=CQt^Wa*C@UiOB4!~4Rjb&#gtB)YOnD$|HUCYKN^Tuhlr@AAp7J*%!@R^1eaaHTKPgXmckNV)bY5xcWe`#_GczM38c1X^ z^j8D9s0?>x?h(lpw7Xl{Ab+cQv9Qpj8+!ODuF_ZN0pF=&_y*GI%u|#+!fsi#mAF>sPOSOuTWNqr_ct zYJR$p5*!i|Te8utW4ZB3@ID8vIWZN)Xq-4@(#SB@6ql2}EY`5zp9R9mFeuAj0+-Hq z>P$vX)Y;V5*1k}xUv7K?qJyEa7JE9@q4n7n7Ly3Wld3$4F|Wy*HT;qJC`PRHB*)s?(5uAqNoOcC@yhpsugibvXBg zhD?*Ntc->=Oa8R#r|@cNSQhWqd?N)NwOsdnsHCKW*U^!qEBj7E{eAJ9X^-sUV%|kY zVn}dDKby_Q8X6k<%Z9gtc;@b|Fu%B{P*PBUk&AT@Kj_y2!lU6J@JtAB_$6DNrgC_q zoTpOeMaue}mKJI>jTYmF%FFu$r-N=py-;{aRw~3I{h*2x!ZS1SyREI?hK+g! z1*Hz>Lc(kfHQVC5X=%#tcI%*qH_z*D_kc6jXkyxPbNRPsD6E;Jq{`VWb=A}2+CnRV zoN_{W2rJEmzuUqm-1)CoRb73F+pEXQT$pDsaYUS)oLth<)Agdn0z~SEMnJ9#RAjQAXk9Q ziCzE#o|CuXH^7=$=)yuZ^T0MK{4=0mB)Ncv?rUjrIl!N@*tV(p#>Pg4Fe8M+)QbxJ zWDRI_C|k)*R0d7nr!54Q@|OOsQ3iq*`nCKRy=k!bPEyCrB)@Vf(C~BZ#jLI#Xup|Q zW#0S%bMD;T2JZ<-+yby1>Ij@Z&*M#Yt<6iGPLRnO37U_Y$TNzgQx_FF&R8xR=YR~T zr+?n>g1Y}gYmA@Tb9XQFkd(HN;NEwxP`>W~QQ^o)pRWxo{Co8dV50lu;$ra;VvQdj zN}jH*z5e#QSyAJc=Uz{I{q&??)noXJxt$#{03_A=2coZ$vvp&Eg%iO540Ltj6JSke zwwcw4Od}90($b7?_02aL7#jzvNgKCZk5ezWQ0V1zaOaZ?w7t15_()I|1;XKQE|*2#<_sRim6Vidf=J3wJaa)&JOdN6aTy08ya0S*b8%)7d}Ex#6-i@H8c z9l|60ogGGpKqk9b+nWQC z_L=_txI#7qb(G*)?Ri>B33h60E=So@Hr)H`$Bv53%ws0PhwAUb+dqu{3NlKNQxUu8 z{q8vTW=ptRyxU;UIhM;eICUO4yE7-ZySpE#5!gDrQtF`RnJksO<@pRUBNE+Nk>$3E&Z2WHIWJ_u@MYq3C9#g zuKzf-dYgWJ*Dkx2?sQzxPvDBrR6xQFU}Fkazicu1#$>~amlCa3Q8lL5Q>(hgi!2}) z0~*7noIvPML-Kk(k!7Q!kuMq>OYosRr615adKCYRZTeVjBYCJeA?vd^}64-5vh@0WEl2>)=zTiU}fw zee>iTRRquNm5JD9yPyu$>gzXEhjIGFI-Q%6&)Rr(;_>t>5N^!kh6w`$ekJx;4i%_u z7W|ZQQBYJm;{uYiHV!6yV|n7L%z4$9{3>W1h-}6IV24l!h*Gz= zvm0j)J0y4>=?MarJvqAN0ZMH+0Ka!O#$$Ndl<_4*SKn!-tT8e&mr78}0A(L2p;={T z&zjVMq<`G%uCE+w^uv0ROV2avVXw;xF%aGqBrIqS3vT9q^JhwOC7kkv;Mx5c6sMl) zDxS!hH#cRH!OpN$VB!#hpmI3=>N0#lcHqmz=?@7o~X29uxbo~5nOXR3*s=-^YYqB5X`U&K$A3Q>?UPx`YQ_1H{ zy1+bn_lSaAy=?=5iD}=+n_8L3aL8vtqX7f;E}giZF=hRs-`kEJ&~T^( zp>BUuau4fhst5iRnfuuBf@a1Pz<*hTWO5c{m?^9G#iC?M>vG07B`rc6Z@u}_mX7fz zY`mmT-qnMn4{N~hLxl--Ql)Q1B9WPr4-y55V*~;#@xBxYxEs$bJ(kb=!vDag8iG;{ zuTG9V1WPs+{7>U*>54=9bTn(-xt!(JxWZi^;!EQHJ}&?K?aL=&aeI`bj)J>?=kRB& z^g<5YP|H=xj)v(AL(^$P#N!sSnyh)7anVC)uF8`^@hB*sfspLh6xc|g0O=_L#dJY27u|hGi^chK zwxOhYLZM!~$7#+Yu4fA>E-qdS5|)wMP$MKNHs;AOs7tCQMcoZ5l>=6ueCkt zMFvQ?3qdaRd$m78hMvg~&93EmPsE7h~KtN9qjr|u+#1uo78$b(}_A?TeIQ8V^YbNS3Vz0sDIHp z^MGH1?@TqA?GFfX=6T7)w z-PBzDtWv|{9Irsg@%_l4!9l&4f2+F&2cu%OKX+0`*FP5UaUI5X>3Ygq?(>wC=~LH#`L1GhI3*g}5T)`sQ@K~cqp8XmyZpjy1Xwl1D0c%7cuPO1k*4N#sVjWP+n{7#Pa zAfCc`_aU2OQ!9S&Dk=(5@3{+$h`9WMhi690rX~)6`_I?jS+^@m7T&C@uDLv&cURW< z9LQikKlS*TzOZnMMt23mM8H&{Z4@a~7gU=M@29LVLc3AVagp-E}|DooUF1K1aPIqg>Ne!%Yj9gkTxga$bX z-T(5)-qcU!c@{Z^K+>v(eXZmdk}#Oh+YcX(;HFaX4O+E@F$ie_t<@w^f;QS|NS6Lz%5BtaOoB zx%f*}Pfy`MM4ODN7yaq%?BPt1rMF2zB<-w%-kl5=lSZ!1x62zD%#YTySwP4VwakyB%_U(>q&1!rL4WZTAv|`R6IEWj2SPT()`Qz=k7Q5 ztOA$@OFci8+40FuQq>FbFl2L%r0_jOqH3JX9p}lbtE+bkF4D!E!^KJ(a0CnVw$$`I zZmaVgHz%QS3bJVx$Whw9&_ymkaWq5a>@<%?M{kh;V2s6YYH6;0(V-6x4F%Y4NNENv zS#obHi-umW81Y!jO|iEo0j7Tzh_0QToyOxKbgZPDVVa*?e!w>Zk8G@_VLlMQxi8b) zO&A2=?*nI%$YXtsS*-a*|AozCpsw5;0OeZcv~St+Y&tCLY`7SJ$6IVl7V0DjUYpGa zjO#b}v7(Piw5j)==u`%4HT}81r>ZJ?yuul4mc)1K3^wz#W4S85NmRy5sy;>xNOm1i z6n9;{qoczJkJj7_6p{s||MqmM0h2eU2jR^A7dUW^u2k##`9h}RXSqad3N`9KU?3=B zKUC%C=Pv?ORp$;!RV=+`DxM`1`1KdUgEC96uN<(Hz1b;l!1zEL0@oQ>qw$A>pit*m zyVQubGpDX3o>Xu@d)d$Rs-BRn$LJb0nJ@SO8E12$2o>f^tZFmbyJTatd9%ID0j{?9 zsAZ5GKYEudxD+%@Q-kk+|!fzNxPu4T31%}Uk;#s>|zr}SL zT^xoL-yIy%w9S&)b_krNK(_tJ36!qy87i>7d>|Nrq4xv6>_>=b``sRt?lORnvMQUR zM2#C5J?dm6XbFM#fT9|;(jp~OtbKzGaJhkNR}p`L!j^E{(K)a zj#Ld>p9eI~4hXNN13pzB*5VcbU%VC;7RD@VleVz|sJN=8<}%P7_2Q3?kVy^h?2jv2 zTg$J9>S&ymjUdL5d4g0OtofIn3dRV3v$tB?OR~THJF^43(YY(nZ>*sh>EzI$dp2sB zimslXQgz-Fjc2!Ka0ZK6msgs~LH~=)AduJ9{0n*6m{y>PS_;XA^2TUOPETBQnqn^g zu8m%lzvKk)`e>!QjCHNwd~!>ygv@T)aG-vTgX-8CsWo;ma&nTn#cy}AwvlH>iZuf1 zqbmL|!{_FiycuhmhL#`lKZT0#aXY?A}Q4us3X9F5ulgjsWfyQR#uR zTSp%4!b+r+tx~I-RuQD{C*o9(Tue0}QIJ^yv@y(dBMb2DuT22h?X`l#V6bc)4&pQS z<#hpqjAW(nBrYy23~`sEAX`lU^9^k?#!mtzH|b#XBVG_Ap23&`dq}VlfO5GPb%dm3 zx4hOc)rjUig=c)xn$LH(yk|)b4UJu&pYPgr(M1btWlu^oI37GD8!i^hRRnrvvNMyq zIa+W9ZZ9(k7;80Xj&Ttz0&PfX12!-u%N2B|H4hX>D)1=Vq3p715@*VR@8Dl_FvBEl zr+OH7(F_Rl4gVKk^SI~5qMSXWA{GxZWo8-4%8<%QLa@ zCbnZ}h^42_AfQst##zz?6N_qC^F$LveQ{y$ZyzcR=XxAh;UF1m2RK_whyog++K(#| zMfvGbqCBj4W4S5Hc+b`k=UxJE4jNHFD~Z*neAYWYQhI{a3PTuL43VR+q3nSHV}`hy z^*_FE`>)7a)Me=e)Tp!$^17s?q~44#rXCQqVk>~sbSYjim{Q$~BRha*=5P2-@b7>u z760rT%1o{UXnT*;EK&F`37Kp3c-GbLU$w_V= zw!tL@56uanTj^F|k*LI3>os3b8)6SyRBIzZUr2Uf;L;%gM4CZQ-e!bMFfx}KqFm(> zl#QvVxPY8+*U^mP-dcF*mNs(5rAKnG-O-rz`MIGku^Qt0Q#gam(KRp3Qt{+|uCMp= zSecYqIHVLd(NE~?uonJ3VSzQU^Yp&Ep09Hma*M00C1bG|%tTmNSgb}!*ayA`IyT5@ zvO;~jUY@6r!ZxWRU=Oo7KUNC}*Cz{r(tAL9_VD4nq16QF^Uj`3>$*z+onoN^URRWt zS2V16orbmFMAeHI715v-axIq*n3-|jUES2@ z$I^ET+AEw^OTQskcfbWdv1i!>e(_Nj__ z4NNY9envCM_bx&%aXZ4o9ruFC%?3FZ3&`}h?ZdL~eU17RBz>kpEa&tQsikkxAd(@R zDuVdEM@9Yfj#ZeTV1$q?2%ovDjLp@K4r_>1ZbDms3O0GXj*t<&SWK73E*k?gLD>+S zX~4B$`nuobQZk6*LxZ8yz2CXsRfI z?|!*rH1k>~wkIhi>xNOR1d^JLN`=P0^v6UMh9b(L4Nx1NvHiEV`x_b02 z_CP@YBMb_?c~1j>F48|0uxp9H~rDJ0N4OtciH=%?j|3#bfdXLpOce`wekkT zcg$~pNpkhD4FwzTTSMaQ-a+LH%IB(UF+py>+c_RxJWmH~8H|eb*{}B8#rMb>&SvaI zaq;d5kmV(B6UiihHQ++-Zd#{q<_TZa)SQ_I(Ls{m0n9H10T+=0Em5;CvDnxsV#@b+2Vje=`Ks zuRwm`l@t}ZCxGTj1S!a6zA-|Wbrcd-9}MzG1{~ZVvE6nsAp~?eEggo0ZOPXGE&gRz zRu=k#Q^!hVWaN3!s%yD6U}DUzt*T;1YI%tPKblT^_Nw}W!6K=A#-@AMuFPn#N(F$j zq`32Wd%B9|hz6hpMY{zpa_Z`S!nzZ<#ZFH0!pVF>GS@4UaM{=K(}-9PB!01qr~*>m z>Vsixy=hgyFV@URPtWs$UBdPS7(cH-5K=e6{tpsA-Bd71@9fGZDLJ6WZG)eO?s=BX z=O`q=ajMQcFq2CxR~YB{D7VTpWUcvQ{cLXzD`{Xz<)G+M2IxqG_)j)_+JWrauF`h~ zuLoMKTC2T~OEI&TpwYI9hk6LMzk=>5f`2uchid~lZi^~t^X6Y^jU#IQ1Qxs0an~yT zqUol+=Q!w28XFzcz%sxKSiH06b`5`jAmBGDpm}R-z3TNAH+RWfyM^nt7*^Q6;CSgw zf)5V|SK5u@m)bw2cX#rGD0OKBW?o%6xDBrh?a|(0@wJa9y}&pRzBhn#2Ted0pnH=! z-=9}RD6!jIeT}DMOi9oNm6rw!5P_Qhv)BcbI z4;K~W4LR>Mz)~1z9wFAb69}b5HeZT6_KJ}-*mt2aFW1SfzqCS2V z@ztb{{GuUYuoolpGJH+7A!m1y64{C@z; C%{D;* From 90569e8416c71b2f763dc5e47924b56e5f911660 Mon Sep 17 00:00:00 2001 From: KyleWong Date: Sat, 9 Feb 2019 17:13:04 +0800 Subject: [PATCH 0114/1117] Provide public api to allow FlutterEngine related context to be destoryed (#7610) Provide public api to allow FlutterEngine related context to be destoryed. --- .../darwin/ios/framework/Headers/FlutterEngine.h | 14 ++++++++++++++ .../darwin/ios/framework/Source/FlutterEngine.mm | 11 +++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h b/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h index 8d7d4f7fef5dc..262a97a1dc2d3 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h @@ -50,6 +50,10 @@ FLUTTER_EXPORT * A newly initialized engine will not run the `FlutterDartProject` until either * `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI:` is called. * + * FlutterEngine created with this method will have allowHeadlessExecution set to `YES`. + * This means that the engine will continue to run regardless of whether a `FlutterViewController` + * is attached to it or not, until `-destroyContext:` is called or the process finishes. + * * @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. @@ -119,6 +123,16 @@ FLUTTER_EXPORT */ - (BOOL)runWithEntrypoint:(NSString*)entrypoint libraryURI:(NSString*)uri; +/** + * Destroy running context for an engine. + * + * This method can be used to force the FlutterEngine object to release all resources. + * After sending this message, the object will be in an unusable state until it is deallocated. + * Accessing properties or sending messages to it will result in undefined behavior or runtime + * errors. + */ +- (void)destroyContext; + /** * Sets the `FlutterViewController` for this instance. The FlutterEngine must be * running (e.g. a successful call to `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI`) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm index 10491ffb0c905..6a855650b9125 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -149,13 +149,16 @@ - (void)setViewController:(FlutterViewController*)viewController { - (void)notifyViewControllerDeallocated { if (!_allowHeadlessExecution) { - [self resetChannels]; - - _shell.reset(); - _threadHost.Reset(); + [self destroyContext]; } } +- (void)destroyContext { + [self resetChannels]; + _shell.reset(); + _threadHost.Reset(); +} + - (FlutterViewController*)viewController { if (!_viewController) { return nil; From 067045757ff529aeeba3d7ebaf0ebee0b2e09d8d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 9 Feb 2019 05:32:08 -0500 Subject: [PATCH 0115/1117] Roll src/third_party/skia 87461aad7285..5c211130646b (1 commits) (#7766) https://skia.googlesource.com/skia.git/%2Blog/87461aad7285..5c211130646b git log 87461aad7285c745a418c7102ab349890347a4cb..5c211130646b41ed5d703f4c6f0f8133f9b58726 --date=short --no-merges --format=%ad %ae %s 2019-02-09 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 2b0553ce59c3..abf6dbbb107b (5 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 8bbfde68bdf04..24397591b0951 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': '87461aad7285c745a418c7102ab349890347a4cb', + 'skia_revision': '5c211130646b41ed5d703f4c6f0f8133f9b58726', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 7747e17ebfdca..f2f115965ebd4 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: efbdad2c346737b589f0582e8aa3ba0e +Signature: 509aa8ea7155c1ab39a4e30cac0eaf6b UNUSED LICENSES: From 5dee035ee2d9a47123b72c0ac8d14b60e5c9fee1 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 9 Feb 2019 09:19:11 -0500 Subject: [PATCH 0116/1117] Roll src/third_party/skia 5c211130646b..1f43a4359d7d (5 commits) (#7767) https://skia.googlesource.com/skia.git/%2Blog/5c211130646b..1f43a4359d7d git log 5c211130646b41ed5d703f4c6f0f8133f9b58726..1f43a4359d7d1b2e6cae144c3f510c0ffa8e60ec --date=short --no-merges --format=%ad %ae %s 2019-02-08 fmalita@chromium.org [skottie] Add drop shadow support 2019-02-09 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 3e6732ee4ac8..99d98c846f9b (360 commits) 2019-02-08 gkaiser@google.com SkPathOpsTSect: Avoid null dereference in asserts 2019-02-08 gkaiser@google.com bench: Fix a couple presumed copy/paste errors 2019-02-08 gkaiser@google.com SkLiteDL: Don't use move()d object The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 24397591b0951..245bbfca333f6 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': '5c211130646b41ed5d703f4c6f0f8133f9b58726', + 'skia_revision': '1f43a4359d7d1b2e6cae144c3f510c0ffa8e60ec', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index f2f115965ebd4..34af0b04f7153 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 509aa8ea7155c1ab39a4e30cac0eaf6b +Signature: 0ceb867a57161d1f3bbc943ccf14708a UNUSED LICENSES: @@ -4342,6 +4342,8 @@ FILE: ../../../third_party/skia/include/private/GrContext_Base.h FILE: ../../../third_party/skia/include/private/GrImageContext.h FILE: ../../../third_party/skia/include/private/GrRecordingContext.h FILE: ../../../third_party/skia/include/private/SkVx.h +FILE: ../../../third_party/skia/modules/sksg/include/SkSGRenderEffect.h +FILE: ../../../third_party/skia/modules/sksg/src/SkSGRenderEffect.cpp FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp From ddd224072b1b5e72ff1b447e3c2f77cc76ce5687 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 9 Feb 2019 13:05:25 -0500 Subject: [PATCH 0117/1117] Roll src/third_party/skia 1f43a4359d7d..0b36acdad970 (1 commits) (#7768) https://skia.googlesource.com/skia.git/%2Blog/1f43a4359d7d..0b36acdad970 git log 1f43a4359d7d1b2e6cae144c3f510c0ffa8e60ec..0b36acdad970ff3581a46bc114939637a5baa11c --date=short --no-merges --format=%ad %ae %s 2019-02-09 fmalita@chromium.org Revert "[skottie] Add drop shadow support" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index 245bbfca333f6..bb61a9c84704c 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': '1f43a4359d7d1b2e6cae144c3f510c0ffa8e60ec', + 'skia_revision': '0b36acdad970ff3581a46bc114939637a5baa11c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 34af0b04f7153..02817b4e5db79 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 0ceb867a57161d1f3bbc943ccf14708a +Signature: 2c21e01c5d8d00c2f382f3030f15bf5d UNUSED LICENSES: @@ -4342,8 +4342,6 @@ FILE: ../../../third_party/skia/include/private/GrContext_Base.h FILE: ../../../third_party/skia/include/private/GrImageContext.h FILE: ../../../third_party/skia/include/private/GrRecordingContext.h FILE: ../../../third_party/skia/include/private/SkVx.h -FILE: ../../../third_party/skia/modules/sksg/include/SkSGRenderEffect.h -FILE: ../../../third_party/skia/modules/sksg/src/SkSGRenderEffect.cpp FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp From b2a93978b9add89a7aa40fa9022c64fb9d0810fe Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 9 Feb 2019 17:05:06 -0500 Subject: [PATCH 0118/1117] Roll src/third_party/skia 0b36acdad970..cd9ef731fe75 (1 commits) (#7769) https://skia.googlesource.com/skia.git/%2Blog/0b36acdad970..cd9ef731fe75 git log 0b36acdad970ff3581a46bc114939637a5baa11c..cd9ef731fe75caae3f400d8a1b1ea4ac8c4a8cdb --date=short --no-merges --format=%ad %ae %s 2019-02-09 mtklein@google.com Mask -> M The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (fmalita@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index bb61a9c84704c..4c4f1f91c5db2 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': '0b36acdad970ff3581a46bc114939637a5baa11c', + 'skia_revision': 'cd9ef731fe75caae3f400d8a1b1ea4ac8c4a8cdb', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 02817b4e5db79..9fb67a3db5c28 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2c21e01c5d8d00c2f382f3030f15bf5d +Signature: 450bc0f73bc240f4550652daf9b84825 UNUSED LICENSES: From ba0f38b1d9780760773377cbeb41f0bb064b6d80 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Sat, 9 Feb 2019 16:15:56 -0800 Subject: [PATCH 0119/1117] Allow specifying the out directory prefix (#7762) --- ci/analyze.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/analyze.sh b/ci/analyze.sh index 09bf3e12f3993..6cf2206b99e40 100755 --- a/ci/analyze.sh +++ b/ci/analyze.sh @@ -2,7 +2,7 @@ echo "Analyzing dart:ui library..." RESULTS=`dartanalyzer \ --options flutter/analysis_options.yaml \ - out/host_debug_unopt/gen/sky/bindings/dart_ui/ui.dart \ + "$1out/host_debug_unopt/gen/sky/bindings/dart_ui/ui.dart" \ 2>&1 \ | grep -Ev "No issues found!" \ | grep -Ev "Analyzing.+out/host_debug_unopt/gen/sky/bindings/dart_ui/ui\.dart"` From 06cc2e45973df855688aed535b51721aca3d003c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 9 Feb 2019 21:35:09 -0500 Subject: [PATCH 0120/1117] Roll src/third_party/skia cd9ef731fe75..dafd65217b4e (1 commits) (#7770) https://skia.googlesource.com/skia.git/%2Blog/cd9ef731fe75..dafd65217b4e git log cd9ef731fe75caae3f400d8a1b1ea4ac8c4a8cdb..dafd65217b4e8883f4a43ffa43289e3c9a9ce22b --date=short --no-merges --format=%ad %ae %s 2019-02-10 fmalita@chromium.org Reland "[skottie] Add drop shadow support" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4c4f1f91c5db2..97b4a4041b3b0 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': 'cd9ef731fe75caae3f400d8a1b1ea4ac8c4a8cdb', + 'skia_revision': 'dafd65217b4e8883f4a43ffa43289e3c9a9ce22b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 9fb67a3db5c28..de7c1006f9d85 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 450bc0f73bc240f4550652daf9b84825 +Signature: ed59157ab7ca277639aaf26883be68e5 UNUSED LICENSES: @@ -4342,6 +4342,8 @@ FILE: ../../../third_party/skia/include/private/GrContext_Base.h FILE: ../../../third_party/skia/include/private/GrImageContext.h FILE: ../../../third_party/skia/include/private/GrRecordingContext.h FILE: ../../../third_party/skia/include/private/SkVx.h +FILE: ../../../third_party/skia/modules/sksg/include/SkSGRenderEffect.h +FILE: ../../../third_party/skia/modules/sksg/src/SkSGRenderEffect.cpp FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp From 81cdd5491a422773176ffe76046437241a35fb01 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 10 Feb 2019 01:35:30 -0500 Subject: [PATCH 0121/1117] Roll src/third_party/skia dafd65217b4e..1e1bc8de5671 (1 commits) (#7771) https://skia.googlesource.com/skia.git/%2Blog/dafd65217b4e..1e1bc8de5671 git log dafd65217b4e8883f4a43ffa43289e3c9a9ce22b..1e1bc8de567161fc5aa0f23e8412f100d15ee783 --date=short --no-merges --format=%ad %ae %s 2019-02-10 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 97b4a4041b3b0..88e1d3b08beb4 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': 'dafd65217b4e8883f4a43ffa43289e3c9a9ce22b', + 'skia_revision': '1e1bc8de567161fc5aa0f23e8412f100d15ee783', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index de7c1006f9d85..56af996e6ddf1 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ed59157ab7ca277639aaf26883be68e5 +Signature: 6535230a93768153527b89b34b7ea803 UNUSED LICENSES: From 967460f8389de7ae924e2e8f31dbd51a91df9473 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 10 Feb 2019 05:33:10 -0500 Subject: [PATCH 0122/1117] Roll src/third_party/skia 1e1bc8de5671..475134f2de57 (1 commits) (#7772) https://skia.googlesource.com/skia.git/%2Blog/1e1bc8de5671..475134f2de57 git log 1e1bc8de567161fc5aa0f23e8412f100d15ee783..475134f2de57e9292db701f084baaf208a1083b7 --date=short --no-merges --format=%ad %ae %s 2019-02-10 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update SKP version The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 88e1d3b08beb4..fb0a49184791c 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': '1e1bc8de567161fc5aa0f23e8412f100d15ee783', + 'skia_revision': '475134f2de57e9292db701f084baaf208a1083b7', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 56af996e6ddf1..ad748001fcde3 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 6535230a93768153527b89b34b7ea803 +Signature: 1b9b66acbb8063ec2c48894f13c11678 UNUSED LICENSES: From c3523d9106894e6592a985ab780800d2e6614657 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 10 Feb 2019 09:32:30 -0500 Subject: [PATCH 0123/1117] Roll src/third_party/skia 475134f2de57..fbe2e937c798 (1 commits) (#7773) https://skia.googlesource.com/skia.git/%2Blog/475134f2de57..fbe2e937c798 git log 475134f2de57e9292db701f084baaf208a1083b7..fbe2e937c7984ef7a7716f8168ab1a2fdc0c570d --date=short --no-merges --format=%ad %ae %s 2019-02-10 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 99d98c846f9b..1fcc8416fd35 (15 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index fb0a49184791c..28fab81ac0e9c 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': '475134f2de57e9292db701f084baaf208a1083b7', + 'skia_revision': 'fbe2e937c7984ef7a7716f8168ab1a2fdc0c570d', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index ad748001fcde3..8ab040bbee10f 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 1b9b66acbb8063ec2c48894f13c11678 +Signature: 8055a75c1608cf1bef3f9ea1cf64f140 UNUSED LICENSES: From 94e0e2c2083537be44e835b682d0fc6d800b782d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 10 Feb 2019 13:21:30 -0500 Subject: [PATCH 0124/1117] Roll src/third_party/skia fbe2e937c798..5fc138c04690 (1 commits) (#7774) https://skia.googlesource.com/skia.git/%2Blog/fbe2e937c798..5fc138c04690 git log fbe2e937c7984ef7a7716f8168ab1a2fdc0c570d..5fc138c046907808363d478d16c1a1f4767f654f --date=short --no-merges --format=%ad %ae %s 2019-02-10 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 28fab81ac0e9c..a488a414f8a61 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': 'fbe2e937c7984ef7a7716f8168ab1a2fdc0c570d', + 'skia_revision': '5fc138c046907808363d478d16c1a1f4767f654f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 8ab040bbee10f..3543a36a1a509 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8055a75c1608cf1bef3f9ea1cf64f140 +Signature: 18ecbc9e01b16e7ad48bc5f3faf53198 UNUSED LICENSES: From 9c2f8726ddae5caa661ccf809877fed99667b49a Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 10 Feb 2019 17:33:06 -0500 Subject: [PATCH 0125/1117] Roll src/third_party/skia 5fc138c04690..ef26fcb13fc6 (1 commits) (#7775) https://skia.googlesource.com/skia.git/%2Blog/5fc138c04690..ef26fcb13fc6 git log 5fc138c046907808363d478d16c1a1f4767f654f..ef26fcb13fc6ae3943da82cad45a20d8497c3c98 --date=short --no-merges --format=%ad %ae %s 2019-02-10 fmalita@chromium.org [sksg] Fix image filter content inval rect tracking The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index a488a414f8a61..e1541439bcf8e 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': '5fc138c046907808363d478d16c1a1f4767f654f', + 'skia_revision': 'ef26fcb13fc6ae3943da82cad45a20d8497c3c98', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3543a36a1a509..a907eab9d90f1 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 18ecbc9e01b16e7ad48bc5f3faf53198 +Signature: 9dac5d9708ae15cefdef7347ad815e6f UNUSED LICENSES: From f4a22d8961d9a2b7570aef52646b0df999bc2699 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 11 Feb 2019 01:25:13 -0500 Subject: [PATCH 0126/1117] Roll src/third_party/skia ef26fcb13fc6..136cd7018a99 (1 commits) (#7778) https://skia.googlesource.com/skia.git/%2Blog/ef26fcb13fc6..136cd7018a99 git log ef26fcb13fc6ae3943da82cad45a20d8497c3c98..136cd7018a9999f9104758c5dd807fc545f796a4 --date=short --no-merges --format=%ad %ae %s 2019-02-11 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index e1541439bcf8e..c2cc6af579405 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': 'ef26fcb13fc6ae3943da82cad45a20d8497c3c98', + 'skia_revision': '136cd7018a9999f9104758c5dd807fc545f796a4', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a907eab9d90f1..ae67d7776de34 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 9dac5d9708ae15cefdef7347ad815e6f +Signature: 95f2c2e625e02d463e9eed98f647633f UNUSED LICENSES: From 6933fcb2bfceaa9a7d443d167bec5092d87a8081 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 11 Feb 2019 01:03:38 -0800 Subject: [PATCH 0127/1117] Roll src/third_party/dart 174d6fec3d..fdfe40ea95 (27 commits) fdfe40ea95 Compute 'executableElement' and 'parameterElement' in CompletionTarget. 36a31879da Preserve indentation when converting documentation from block to line 6875b9b26b Do not convert empty function bodies to async (issue 35899) d32ca512ec fix linter changelog entry 00ee3159e5 Convert interfaces to use implements not extends 0a2672453f Split out several more hint tests a49f7f1d44 Remove FunctionTypeAlias in _isFunctionalParameter(). 5f2d651d94 Move FindElement to analyzer/src/test_utilities/. 7cec1b03b6 Add missing awaits to migration tests. b3ee960092 Stop indirecting through VariableRecorder/VariableRepostitory to create constraint variables. 5f79c9f4d1 Move UNCHECKED_NULL to error verifier. 090ba0a520 Fix FUNCTION_TYPE_ALIAS test, provide the name for the named parameter. d5038fc976 Stop using FileContentOverlay in RuntimeCompletionComputer and AbstractContextTest. ad3adb6285 Move nullability migration algorithm into analysis server. 9103baf31c Move find_node into test_utilities so that it can be re-used in analysis server tests. 5787f08619 Clean up some hints in server and analyzer 5f3ed76854 Issue 3172. When adding a required argument, create a linked group for the default value. 32603d5626 [vm/compiler] improve equality constant folding 6f6bed94fd Replace TypeMatcher with isXyzElement. 18b5d66966 pass analysis options to linter contexts 2bab9eab49 Guard against empty URIs. 6c73b25ba9 [js_runtime] Don't use ReflectionInfo e6bc1d317a Break AvailableDeclarationsTest into several test classes. 61ae86bce2 Add relevance tags to available declarations. 6b0baad623 Track definitely nullable and non-nullable variables. 67c5923cce Enhance protocol to allow changing relevance of individual suggesions. 4b8ff1275c bump to linter 0.1.80 (set literals FTW!) --- DEPS | 4 ++-- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index c2cc6af579405..6ec11403a43ce 100644 --- a/DEPS +++ b/DEPS @@ -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': '174d6fec3dc3e1af3b07439179769dbbedd88703', + 'dart_revision': 'fdfe40ea95d4e91dc9fc0d6e0a1f5215ab7c4b40', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -60,7 +60,7 @@ vars = { 'dart_http_throttle_tag': '1.0.2', 'dart_intl_tag': '0.15.7', 'dart_json_rpc_2_tag': '2.0.9', - 'dart_linter_tag': '0.1.79', + 'dart_linter_tag': '0.1.80', 'dart_logging_tag': '0.11.3+2', 'dart_markdown_tag': '2.0.2', 'dart_matcher_tag': '0.12.3', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 047bb86021ced..c656e8d53bb7a 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: d319807b58e8646bccb8cf9d185b3ca9 +Signature: 040756bb0b57c047a52c98602ad55b4b UNUSED LICENSES: From dbb90a534c647f36c049e16d9bed2a75022b03fc Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 11 Feb 2019 08:04:57 -0500 Subject: [PATCH 0128/1117] Roll src/third_party/skia 136cd7018a99..d336ebdea812 (4 commits) (#7781) https://skia.googlesource.com/skia.git/%2Blog/136cd7018a99..d336ebdea812 git log 136cd7018a9999f9104758c5dd807fc545f796a4..d336ebdea812c4c260c2d10bb5a515b7a98a42c1 --date=short --no-merges --format=%ad %ae %s 2019-02-10 gkaiser@google.com SkDeque: Move asserts prior to pointer dereference 2019-02-10 gkaiser@google.com GrGLGpu: Remove unused 'return' 2019-02-10 gkaiser@google.com SkPath: Cleanup code to make array size match 2019-02-10 gkaiser@google.com SkImage_GpuYUVA: Also sanity check height The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 6ec11403a43ce..9918927fa8a1e 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': '136cd7018a9999f9104758c5dd807fc545f796a4', + 'skia_revision': 'd336ebdea812c4c260c2d10bb5a515b7a98a42c1', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index ae67d7776de34..dc4fe9520f495 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 95f2c2e625e02d463e9eed98f647633f +Signature: 624fd8774b432d0287ace0dfd8d5705a UNUSED LICENSES: From 5dfa029498f86c32fe3df7a25691c84b08f30621 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 11 Feb 2019 12:06:09 -0500 Subject: [PATCH 0129/1117] Roll src/third_party/skia d336ebdea812..77a1a7e6182e (5 commits) (#7784) https://skia.googlesource.com/skia.git/%2Blog/d336ebdea812..77a1a7e6182e git log d336ebdea812c4c260c2d10bb5a515b7a98a42c1..77a1a7e6182e6a8437e357cfa5725409e2d80e30 --date=short --no-merges --format=%ad %ae %s 2019-02-11 halcanary@google.com find_commit_with_best_gold_results takes arguments 2019-02-11 thakis@chromium.org Remove a few semicolons. 2019-02-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 9388dded242f..d9ce258c174b (1 commits) 2019-02-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 1fcc8416fd35..35663ddf4997 (90 commits) 2019-02-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 9686153413f3..9388dded242f (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 9918927fa8a1e..d1e2fe19b201f 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': 'd336ebdea812c4c260c2d10bb5a515b7a98a42c1', + 'skia_revision': '77a1a7e6182e6a8437e357cfa5725409e2d80e30', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index dc4fe9520f495..20e19152d1c9a 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 624fd8774b432d0287ace0dfd8d5705a +Signature: 70f3c998dbf0358a95626af31051e3fb UNUSED LICENSES: From 694300d32539f22969d8a0e0ec9c1efbfa599125 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 11 Feb 2019 09:29:07 -0800 Subject: [PATCH 0130/1117] Provide a default pressure range if a MotionEvent does not have a device (#7737) Fixes https://github.com/flutter/flutter/issues/27641 --- .../platform/android/io/flutter/view/FlutterView.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 49c2c8d6d694d..04abba458acb0 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -472,10 +472,15 @@ private void addPointerForIndex(MotionEvent event, int pointerIndex, int pointer packet.putLong(0); // obscured - InputDevice.MotionRange pressureRange = event.getDevice().getMotionRange(MotionEvent.AXIS_PRESSURE); packet.putDouble(event.getPressure(pointerIndex)); // pressure - packet.putDouble(pressureRange.getMin()); // pressure_min - packet.putDouble(pressureRange.getMax()); // pressure_max + if (event.getDevice() != null) { + InputDevice.MotionRange pressureRange = event.getDevice().getMotionRange(MotionEvent.AXIS_PRESSURE); + packet.putDouble(pressureRange.getMin()); // pressure_min + packet.putDouble(pressureRange.getMax()); // pressure_max + } else { + packet.putDouble(0.0); // pressure_min + packet.putDouble(1.0); // pressure_max + } if (pointerKind == kPointerDeviceKindStylus) { packet.putDouble(event.getAxisValue(MotionEvent.AXIS_DISTANCE, pointerIndex)); // distance From a3be1ff580d20fbbc1c8e9556d82edb7dd61ea9d Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 11 Feb 2019 10:57:28 -0800 Subject: [PATCH 0131/1117] libtxt: support justification of RTL text (#7719) Fixes https://github.com/flutter/flutter/issues/25567 --- third_party/txt/src/txt/paragraph.cc | 36 +++++++++++---- third_party/txt/src/txt/paragraph.h | 1 + third_party/txt/tests/paragraph_unittests.cc | 47 ++++++++++++++++++++ 3 files changed, 76 insertions(+), 8 deletions(-) diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index c5e10fa0776be..65efccc8a1f1b 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -534,11 +534,12 @@ void Paragraph::Layout(double width, bool force) { } } - // Exclude trailing whitespace from right and center-justified lines so the - // last visible character in the line will be flush with the right margin. + // Exclude trailing whitespace from justified lines so the last visible + // character in the line will be flush with the right margin. size_t line_end_index = (paragraph_style_.effective_align() == TextAlign::right || - paragraph_style_.effective_align() == TextAlign::center) + paragraph_style_.effective_align() == TextAlign::center || + paragraph_style_.effective_align() == TextAlign::justify) ? line_range.end_excluding_whitespace : line_range.end; @@ -552,6 +553,14 @@ void Paragraph::Layout(double width, bool force) { bidi_run.direction(), bidi_run.style()); } } + bool line_runs_all_rtl = + line_runs.size() && + std::accumulate( + line_runs.begin(), line_runs.end(), true, + [](const bool a, const BidiRun& b) { return a && b.is_rtl(); }); + if (line_runs_all_rtl) { + std::reverse(words.begin(), words.end()); + } std::vector line_glyph_positions; std::vector line_code_unit_runs; @@ -720,15 +729,26 @@ void Paragraph::Layout(double width, bool force) { grapheme_code_unit_counts[i]); } - if (word_index < words.size() && - words[word_index].start == run.start() + glyph_code_units.start) { + bool at_word_start = false; + bool at_word_end = false; + if (word_index < words.size()) { + at_word_start = + words[word_index].start == run.start() + glyph_code_units.start; + at_word_end = + words[word_index].end == run.start() + glyph_code_units.end; + if (line_runs_all_rtl) { + std::swap(at_word_start, at_word_end); + } + } + + if (at_word_start) { word_start_position = run_x_offset + glyph_x_offset; } - if (word_index < words.size() && - words[word_index].end == run.start() + glyph_code_units.end) { - if (justify_line) + if (at_word_end) { + if (justify_line) { justify_x_offset += word_gap_width; + } word_index++; if (!isnan(word_start_position)) { diff --git a/third_party/txt/src/txt/paragraph.h b/third_party/txt/src/txt/paragraph.h index 3ce1ae197973f..2866eeaf80335 100644 --- a/third_party/txt/src/txt/paragraph.h +++ b/third_party/txt/src/txt/paragraph.h @@ -212,6 +212,7 @@ class Paragraph { FRIEND_TEST_WINDOWS_DISABLED(ParagraphTest, RightAlignParagraph); FRIEND_TEST_WINDOWS_DISABLED(ParagraphTest, CenterAlignParagraph); FRIEND_TEST_WINDOWS_DISABLED(ParagraphTest, JustifyAlignParagraph); + FRIEND_TEST_WINDOWS_DISABLED(ParagraphTest, JustifyRTL); FRIEND_TEST(ParagraphTest, DecorationsParagraph); FRIEND_TEST(ParagraphTest, ItalicsParagraph); FRIEND_TEST(ParagraphTest, ChineseParagraph); diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index 13c41e4890401..5e37ae1d33092 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -669,6 +669,53 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(JustifyAlignParagraph)) { ASSERT_TRUE(Snapshot()); } +TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(JustifyRTL)) { + 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 = 14; + paragraph_style.text_align = TextAlign::justify; + txt::ParagraphBuilder builder(paragraph_style, GetTestFontCollection()); + + txt::TextStyle text_style; + text_style.font_families = std::vector(1, "Ahem"); + text_style.font_size = 26; + text_style.color = SK_ColorBLACK; + text_style.height = 1; + builder.PushStyle(text_style); + + builder.AddText(u16_text); + + builder.Pop(); + + auto paragraph = builder.Build(); + size_t paragraph_width = GetTestCanvasWidth() - 100; + paragraph->Layout(paragraph_width); + + paragraph->Paint(GetCanvas(), 0, 0); + + ASSERT_TRUE(Snapshot()); + + auto glyph_line_width = [¶graph](int index) { + return paragraph->glyph_lines_[index].positions.back().x_pos.end; + }; + + // All lines except the last should be justified to the width of the + // paragraph. + for (size_t i = 0; i < paragraph->glyph_lines_.size() - 1; ++i) { + ASSERT_EQ(glyph_line_width(i), paragraph_width); + } + ASSERT_NE(glyph_line_width(paragraph->glyph_lines_.size() - 1), + paragraph_width); +} + TEST_F(ParagraphTest, DecorationsParagraph) { txt::ParagraphStyle paragraph_style; paragraph_style.max_lines = 14; From 28bafe6903f58b5b7395a52ddc1870da33458316 Mon Sep 17 00:00:00 2001 From: Michael Klimushyn Date: Mon, 11 Feb 2019 11:09:45 -0800 Subject: [PATCH 0132/1117] Don't use Wuffs (#7785) This code path isn't stable yet. Fixes flutter/flutter#27718 Reopens flutter/flutter#23838 --- tools/gn | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/gn b/tools/gn index f7cfb0ac36d30..e7e6e82b262cb 100755 --- a/tools/gn +++ b/tools/gn @@ -85,7 +85,6 @@ def to_gn_args(args): gn_args['skia_use_x11'] = False # Never add the X11 dependency (only takes effect on Linux). gn_args['skia_use_expat'] = args.target_os == 'android' gn_args['skia_use_fontconfig'] = False # Use the custom font manager instead. - gn_args['skia_use_wuffs'] = not sys.platform.startswith(('cygwin', 'win')) gn_args['is_official_build'] = True # Disable Skia test utilities. gn_args['is_debug'] = args.unoptimized From f8042799641e67ab5907e59078e08538c9eb5023 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 11 Feb 2019 11:41:21 -0800 Subject: [PATCH 0133/1117] Update licenses for the switch away from the Wuffs GIF decoder (#7786) --- ci/licenses_golden/licenses_skia | 582 +++++++++++++++++++++++++++++- ci/licenses_golden/tool_signature | 2 +- tools/licenses/lib/main.dart | 1 - 3 files changed, 581 insertions(+), 4 deletions(-) diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 20e19152d1c9a..1266737a0fd85 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 70f3c998dbf0358a95626af31051e3fb +Signature: 6d3affba5fd7544b22cd12bff47ab93d UNUSED LICENSES: @@ -168,6 +168,46 @@ reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS ==================================================================================================== + +==================================================================================================== +ORIGIN: ../../../third_party/skia/third_party/gif/LICENSE +TYPE: LicenseType.unknown +---------------------------------------------------------------------------------------------------- +Version: MPL 1.1/GPL 2.0/LGPL 2.1 + +The contents of this file are subject to the Mozilla Public License Version +1.1 (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.mozilla.org/MPL + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +for the specific language governing rights and limitations under the +License. + +The Original Code is mozilla.org code. + +The Initial Developer of the Original Code is +Netscape Communications Corporation. +Portions created by the Initial Developer are Copyright (C) 1998 +the Initial Developer. All Rights Reserved. + +Contributor(s): + Chris Saari + Apple Computer + +Alternatively, the contents of this file may be used under the terms of +either the GNU General Public License Version 2 or later (the "GPL"), or +the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +in which case the provisions of the GPL or the LGPL are applicable instead +of those above. If you wish to allow use of your version of this file only +under the terms of either the GPL or the LGPL, and not to allow others to +use your version of this file under the terms of the MPL, indicate your +decision by deleting the provisions above and replace them with the notice +and other provisions required by the GPL or the LGPL. If you do not delete +the provisions above, a recipient may use your version of this file under +the terms of any one of the MPL, the GPL or the LGPL. +==================================================================================================== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USED LICENSES: @@ -392,6 +432,544 @@ See the License for the specific language governing permissions and limitations under the License. ==================================================================================================== +==================================================================================================== +LIBRARY: gif +ORIGIN: ../../../third_party/skia/third_party/gif/SkGifImageReader.cpp +TYPE: LicenseType.lgpl +FILE: ../../../third_party/skia/third_party/gif/SkGifImageReader.cpp +FILE: ../../../third_party/skia/third_party/gif/SkGifImageReader.h +---------------------------------------------------------------------------------------------------- +GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + +Copyright (C) 1991, 1999 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! +==================================================================================================== + +==================================================================================================== +LIBRARY: gif +ORIGIN: ../../../third_party/skia/third_party/gif/SkGifImageReader.cpp +TYPE: LicenseType.unknown +FILE: ../../../third_party/skia/third_party/gif/SkGifImageReader.cpp +---------------------------------------------------------------------------------------------------- +The Graphics Interchange Format(c) is the copyright property of CompuServe +Incorporated. Only CompuServe Incorporated is authorized to define, redefine, +enhance, alter, modify or change in any way the definition of the format. + +CompuServe Incorporated hereby grants a limited, non-exclusive, royalty-free +license for the use of the Graphics Interchange Format(sm) in computer +software; computer software utilizing GIF(sm) must acknowledge ownership of the +Graphics Interchange Format and its Service Mark by CompuServe Incorporated, in +User and Technical Documentation. Computer software utilizing GIF, which is +distributed or may be distributed without User or Technical Documentation must +display to the screen or printer a message acknowledging ownership of the +Graphics Interchange Format and the Service Mark by CompuServe Incorporated; in +this case, the acknowledgement may be displayed in an opening screen or leading +banner, or a closing screen or trailing banner. A message such as the following +may be used: + + "The Graphics Interchange Format(c) is the Copyright property of + CompuServe Incorporated. GIF(sm) is a Service Mark property of + CompuServe Incorporated." +==================================================================================================== + ==================================================================================================== LIBRARY: libsdl LIBRARY: skia @@ -5600,4 +6178,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: 49 +Total license count: 52 diff --git a/ci/licenses_golden/tool_signature b/ci/licenses_golden/tool_signature index bbf0c62aa6fba..30c9333357bfe 100644 --- a/ci/licenses_golden/tool_signature +++ b/ci/licenses_golden/tool_signature @@ -1,2 +1,2 @@ -Signature: 3265e06530be4b2f63aae56dd7a9e830 +Signature: 293c762c71d027f77cf88deb80f9e78e diff --git a/tools/licenses/lib/main.dart b/tools/licenses/lib/main.dart index a780e3a967440..c9d8171eb1c46 100644 --- a/tools/licenses/lib/main.dart +++ b/tools/licenses/lib/main.dart @@ -1639,7 +1639,6 @@ class _RepositorySkiaThirdPartyDirectory extends _RepositoryGenericThirdPartyDir return entry.name != 'giflib' // contains nothing that ends up in the binary executable && entry.name != 'freetype' // we use our own version && entry.name != 'freetype2' // we use our own version - && entry.name != 'gif' // not linked in && entry.name != 'icu' // we use our own version && entry.name != 'libjpeg-turbo' // we use our own version && entry.name != 'libpng' // we use our own version From 3a1a604d71a464b5b6013eed52a4c3657f0cce3c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 11 Feb 2019 15:56:28 -0500 Subject: [PATCH 0134/1117] Roll src/third_party/skia 77a1a7e6182e..103288b50fa7 (16 commits) (#7787) https://skia.googlesource.com/skia.git/%2Blog/77a1a7e6182e..103288b50fa7 git log 77a1a7e6182e6a8437e357cfa5725409e2d80e30..103288b50fa799631fec5e8f63c990145528f9ba --date=short --no-merges --format=%ad %ae %s 2019-02-11 mtklein@google.com add Mac OpenCL bots 2019-02-11 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-11 herb@google.com Plumb strike through the common code. 2019-02-11 mtklein@google.com remove pointer tagging hack in SkRecord 2019-02-11 gkaiser@google.com GrGLGpu: Avoid potential nullptr dereference 2019-02-11 mtklein@google.com update hello-opencl 2019-02-09 nigeltao@google.com Update Wuffs version 2019-02-11 mtklein@google.com use /imsvc with clang-cl where we use -isystem 2019-02-11 gkaiser@google.com sksl: Use va_end() after va_copy() 2019-02-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 abf6dbbb107b..fe59f6b5ed2b (1 commits) 2019-02-11 gkaiser@google.com bookmaker: Remove fflush() on closed file 2019-02-11 gkaiser@google.com skc: Avoid undefined variable modification 2019-02-11 herb@google.com Use descriptor instead of cache for GrStrikeCache lookup 2019-02-11 michaelludwig@google.com Implement drawImage in terms of drawImageRect 2019-02-11 mtklein@google.com turn on -Wextra-semi-stmt on Windows 2019-02-09 brianosman@google.com Add ImGui::DragCanvas, to simplify several custom widgets The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- sky/packages/sky_engine/LICENSE | 527 +++++++++++++++++++++++++++++++ 3 files changed, 529 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d1e2fe19b201f..2db84bd100c19 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': '77a1a7e6182e6a8437e357cfa5725409e2d80e30', + 'skia_revision': '103288b50fa799631fec5e8f63c990145528f9ba', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 1266737a0fd85..6236cfe222498 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 6d3affba5fd7544b22cd12bff47ab93d +Signature: 0ab00063cbfd8da7c9afcc01389033d1 UNUSED LICENSES: diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index 4b935d593b7d6..edab381ceabd6 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -4182,6 +4182,533 @@ Legal Terms --- end of FTL.TXT --- -------------------------------------------------------------------------------- +gif + +GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + +Copyright (C) 1991, 1999 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! +-------------------------------------------------------------------------------- +gif + +The Graphics Interchange Format(c) is the copyright property of CompuServe +Incorporated. Only CompuServe Incorporated is authorized to define, redefine, +enhance, alter, modify or change in any way the definition of the format. + +CompuServe Incorporated hereby grants a limited, non-exclusive, royalty-free +license for the use of the Graphics Interchange Format(sm) in computer +software; computer software utilizing GIF(sm) must acknowledge ownership of the +Graphics Interchange Format and its Service Mark by CompuServe Incorporated, in +User and Technical Documentation. Computer software utilizing GIF, which is +distributed or may be distributed without User or Technical Documentation must +display to the screen or printer a message acknowledging ownership of the +Graphics Interchange Format and the Service Mark by CompuServe Incorporated; in +this case, the acknowledgement may be displayed in an opening screen or leading +banner, or a closing screen or trailing banner. A message such as the following +may be used: + + "The Graphics Interchange Format(c) is the Copyright property of + CompuServe Incorporated. GIF(sm) is a Service Mark property of + CompuServe Incorporated." +-------------------------------------------------------------------------------- harfbuzz Copyright (C) 2012 Grigori Goronzy From a003c46788cea2c95cdbf419054ed8307619cb45 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 11 Feb 2019 13:04:27 -0800 Subject: [PATCH 0135/1117] Roll src/third_party/dart fdfe40ea95..de2e7e7721 (7 commits) de2e7e7721 [infra] Update test.py help now that named configurations are implemented. 859c1ffb79 [testing] Allow test.py test list to be specified as string 07f2eba311 [infra] Remove remnant of analyzer-linux-release-analyzer-new. 473c424fe2 [VM/Decoupling] Follow-up change to decoupling of stub_code: Fix missing "!" a8e2dfdb9b [vm] Decouple stub code from runtime. 5e48ccb808 Give more context when initializing from dill fails a5c53b03cd Convert more doc comments from block to line style --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/DEPS b/DEPS index 2db84bd100c19..4423ec366917c 100644 --- a/DEPS +++ b/DEPS @@ -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': 'fdfe40ea95d4e91dc9fc0d6e0a1f5215ab7c4b40', + 'dart_revision': 'de2e7e77213c08d421ec3b46a18e67105e3b6bec', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index c656e8d53bb7a..38db8ef196e5c 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 040756bb0b57c047a52c98602ad55b4b +Signature: 55b84995da2335f2560d2dddcb9db8bf UNUSED LICENSES: @@ -5653,7 +5653,6 @@ FILE: ../../../third_party/dart/runtime/vm/signal_handler_fuchsia.cc FILE: ../../../third_party/dart/runtime/vm/simulator_dbc.cc FILE: ../../../third_party/dart/runtime/vm/simulator_dbc.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_dbc.h -FILE: ../../../third_party/dart/runtime/vm/stub_code_dbc.cc FILE: ../../../third_party/dart/runtime/vm/thread_interrupter_fuchsia.cc FILE: ../../../third_party/dart/runtime/vm/token_position.cc FILE: ../../../third_party/dart/runtime/vm/token_position.h @@ -5709,15 +5708,26 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/backend/slot_test.cc FILE: ../../../third_party/dart/runtime/vm/compiler/relocation.cc FILE: ../../../third_party/dart/runtime/vm/compiler/runtime_api.cc FILE: ../../../third_party/dart/runtime/vm/compiler/runtime_api.h +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler.h +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm64.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_dbc.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_ia32.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_x64.cc FILE: ../../../third_party/dart/runtime/vm/frame_layout.h FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist.h FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist_test.cc FILE: ../../../third_party/dart/runtime/vm/longjump.h FILE: ../../../third_party/dart/runtime/vm/pointer_tagging.h +FILE: ../../../third_party/dart/runtime/vm/static_type_exactness_state.h +FILE: ../../../third_party/dart/runtime/vm/stub_code_list.h FILE: ../../../third_party/dart/runtime/vm/thread_stack_resource.cc FILE: ../../../third_party/dart/runtime/vm/thread_stack_resource.h FILE: ../../../third_party/dart/runtime/vm/thread_state.cc FILE: ../../../third_party/dart/runtime/vm/thread_state.h +FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm.cc +FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm64.cc +FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_x64.cc ---------------------------------------------------------------------------------------------------- Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file for details. All rights reserved. @@ -6201,10 +6211,7 @@ FILE: ../../../third_party/dart/runtime/vm/simulator_arm.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_arm.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_ia32.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_x64.h -FILE: ../../../third_party/dart/runtime/vm/stub_code_arm.cc FILE: ../../../third_party/dart/runtime/vm/stub_code_arm_test.cc -FILE: ../../../third_party/dart/runtime/vm/stub_code_ia32.cc -FILE: ../../../third_party/dart/runtime/vm/stub_code_x64.cc FILE: ../../../third_party/dart/runtime/vm/tags.h FILE: ../../../third_party/dart/runtime/vm/thread_interrupter.cc FILE: ../../../third_party/dart/runtime/vm/thread_interrupter.h @@ -6466,7 +6473,6 @@ FILE: ../../../third_party/dart/runtime/vm/runtime_entry_arm64.cc FILE: ../../../third_party/dart/runtime/vm/simulator_arm64.cc FILE: ../../../third_party/dart/runtime/vm/simulator_arm64.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_arm64.h -FILE: ../../../third_party/dart/runtime/vm/stub_code_arm64.cc FILE: ../../../third_party/dart/runtime/vm/stub_code_arm64_test.cc FILE: ../../../third_party/dart/runtime/vm/tags.cc FILE: ../../../third_party/dart/runtime/vm/unibrow-inl.h From d521212719450f2d690cb685b1caf593ee11d167 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 11 Feb 2019 14:27:56 -0800 Subject: [PATCH 0136/1117] Revert "Roll src/third_party/dart fdfe40ea95..de2e7e7721 (7 commits)" (#7789) This reverts commit a003c46788cea2c95cdbf419054ed8307619cb45. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/DEPS b/DEPS index 4423ec366917c..2db84bd100c19 100644 --- a/DEPS +++ b/DEPS @@ -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': 'de2e7e77213c08d421ec3b46a18e67105e3b6bec', + 'dart_revision': 'fdfe40ea95d4e91dc9fc0d6e0a1f5215ab7c4b40', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 38db8ef196e5c..c656e8d53bb7a 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 55b84995da2335f2560d2dddcb9db8bf +Signature: 040756bb0b57c047a52c98602ad55b4b UNUSED LICENSES: @@ -5653,6 +5653,7 @@ FILE: ../../../third_party/dart/runtime/vm/signal_handler_fuchsia.cc FILE: ../../../third_party/dart/runtime/vm/simulator_dbc.cc FILE: ../../../third_party/dart/runtime/vm/simulator_dbc.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_dbc.h +FILE: ../../../third_party/dart/runtime/vm/stub_code_dbc.cc FILE: ../../../third_party/dart/runtime/vm/thread_interrupter_fuchsia.cc FILE: ../../../third_party/dart/runtime/vm/token_position.cc FILE: ../../../third_party/dart/runtime/vm/token_position.h @@ -5708,26 +5709,15 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/backend/slot_test.cc FILE: ../../../third_party/dart/runtime/vm/compiler/relocation.cc FILE: ../../../third_party/dart/runtime/vm/compiler/runtime_api.cc FILE: ../../../third_party/dart/runtime/vm/compiler/runtime_api.h -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler.h -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm64.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_dbc.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_ia32.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_x64.cc FILE: ../../../third_party/dart/runtime/vm/frame_layout.h FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist.h FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist_test.cc FILE: ../../../third_party/dart/runtime/vm/longjump.h FILE: ../../../third_party/dart/runtime/vm/pointer_tagging.h -FILE: ../../../third_party/dart/runtime/vm/static_type_exactness_state.h -FILE: ../../../third_party/dart/runtime/vm/stub_code_list.h FILE: ../../../third_party/dart/runtime/vm/thread_stack_resource.cc FILE: ../../../third_party/dart/runtime/vm/thread_stack_resource.h FILE: ../../../third_party/dart/runtime/vm/thread_state.cc FILE: ../../../third_party/dart/runtime/vm/thread_state.h -FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm.cc -FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm64.cc -FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_x64.cc ---------------------------------------------------------------------------------------------------- Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file for details. All rights reserved. @@ -6211,7 +6201,10 @@ FILE: ../../../third_party/dart/runtime/vm/simulator_arm.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_arm.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_ia32.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_x64.h +FILE: ../../../third_party/dart/runtime/vm/stub_code_arm.cc FILE: ../../../third_party/dart/runtime/vm/stub_code_arm_test.cc +FILE: ../../../third_party/dart/runtime/vm/stub_code_ia32.cc +FILE: ../../../third_party/dart/runtime/vm/stub_code_x64.cc FILE: ../../../third_party/dart/runtime/vm/tags.h FILE: ../../../third_party/dart/runtime/vm/thread_interrupter.cc FILE: ../../../third_party/dart/runtime/vm/thread_interrupter.h @@ -6473,6 +6466,7 @@ FILE: ../../../third_party/dart/runtime/vm/runtime_entry_arm64.cc FILE: ../../../third_party/dart/runtime/vm/simulator_arm64.cc FILE: ../../../third_party/dart/runtime/vm/simulator_arm64.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_arm64.h +FILE: ../../../third_party/dart/runtime/vm/stub_code_arm64.cc FILE: ../../../third_party/dart/runtime/vm/stub_code_arm64_test.cc FILE: ../../../third_party/dart/runtime/vm/tags.cc FILE: ../../../third_party/dart/runtime/vm/unibrow-inl.h From 4663d357a36043b7dcafa01fc88511f457cc1319 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Mon, 11 Feb 2019 15:27:55 -0800 Subject: [PATCH 0137/1117] Recommended implementation of combining characters implementation. (#7758) --- ci/licenses_golden/licenses_flutter | 1 + shell/platform/android/BUILD.gn | 1 + .../engine/android/AndroidKeyProcessor.java | 87 +++++++++++++++++++ .../systemchannels/KeyEventChannel.java | 74 ++++++++++++++-- .../android/io/flutter/view/FlutterView.java | 8 +- 5 files changed, 160 insertions(+), 11 deletions(-) create mode 100644 shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.java diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 7d5e643fdcb6d..cea4f342c6317 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -440,6 +440,7 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterFragmentActi FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterPluginRegistry.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/android/AndroidKeyProcessor.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartMessenger.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/PlatformMessageHandler.java diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index 7779ecef83590..b6560fca38737 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -108,6 +108,7 @@ java_library("flutter_shell_java") { "io/flutter/app/FlutterPluginRegistry.java", "io/flutter/embedding/engine/FlutterEngine.java", "io/flutter/embedding/engine/FlutterJNI.java", + "io/flutter/embedding/engine/android/AndroidKeyProcessor.java", "io/flutter/embedding/engine/dart/DartExecutor.java", "io/flutter/embedding/engine/dart/DartMessenger.java", "io/flutter/embedding/engine/dart/PlatformMessageHandler.java", diff --git a/shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.java b/shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.java new file mode 100644 index 0000000000000..0a876cec5e20e --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.java @@ -0,0 +1,87 @@ +package io.flutter.embedding.engine.android; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.view.KeyCharacterMap; +import android.view.KeyEvent; + +import io.flutter.embedding.engine.systemchannels.KeyEventChannel; + +public class AndroidKeyProcessor { + private final KeyEventChannel keyEventChannel; + private int combiningCharacter; + + public AndroidKeyProcessor(@NonNull KeyEventChannel keyEventChannel) { + this.keyEventChannel = keyEventChannel; + } + + public void onKeyUp(@NonNull KeyEvent keyEvent) { + Character complexCharacter = applyCombiningCharacterToBaseCharacter(keyEvent.getUnicodeChar()); + keyEventChannel.keyUp( + new KeyEventChannel.FlutterKeyEvent(keyEvent, complexCharacter) + ); + } + + public void onKeyDown(@NonNull KeyEvent keyEvent) { + Character complexCharacter = applyCombiningCharacterToBaseCharacter(keyEvent.getUnicodeChar()); + keyEventChannel.keyDown( + new KeyEventChannel.FlutterKeyEvent(keyEvent, complexCharacter) + ); + } + + /** + * Applies the given Unicode character in {@code newCharacterCodePoint} to a previously + * entered Unicode combining character and returns the combination of these characters + * if a combination exists. + *

+ * This method mutates {@link #combiningCharacter} over time to combine characters. + *

+ * One of the following things happens in this method: + *

    + *
  • If no previous {@link #combiningCharacter} exists and the {@code newCharacterCodePoint} + * is not a combining character, then {@code newCharacterCodePoint} is returned.
  • + *
  • If no previous {@link #combiningCharacter} exists and the {@code newCharacterCodePoint} + * is a combining character, then {@code newCharacterCodePoint} is saved as the + * {@link #combiningCharacter} and null is returned.
  • + *
  • If a previous {@link #combiningCharacter} exists and the {@code newCharacterCodePoint} + * is also a combining character, then the {@code newCharacterCodePoint} is combined with + * the existing {@link #combiningCharacter} and null is returned.
  • + *
  • If a previous {@link #combiningCharacter} exists and the {@code newCharacterCodePoint} + * is not a combining character, then the {@link #combiningCharacter} is applied to the + * regular {@code newCharacterCodePoint} and the resulting complex character is returned. The + * {@link #combiningCharacter} is cleared.
  • + *
+ *

+ * The following reference explains the concept of a "combining character": + * https://en.wikipedia.org/wiki/Combining_character + */ + @Nullable + private Character applyCombiningCharacterToBaseCharacter(int newCharacterCodePoint) { + if (newCharacterCodePoint == 0) { + return null; + } + + Character complexCharacter = (char) newCharacterCodePoint; + boolean isNewCodePointACombiningCharacter = (newCharacterCodePoint & KeyCharacterMap.COMBINING_ACCENT) != 0; + if (isNewCodePointACombiningCharacter) { + // If a combining character was entered before, combine this one with that one. + int plainCodePoint = newCharacterCodePoint & KeyCharacterMap.COMBINING_ACCENT_MASK; + if (combiningCharacter != 0) { + combiningCharacter = KeyCharacterMap.getDeadChar(combiningCharacter, plainCodePoint); + } else { + combiningCharacter = plainCodePoint; + } + } else { + // The new character is a regular character. Apply combiningCharacter to it, if it exists. + if (combiningCharacter != 0) { + int combinedChar = KeyCharacterMap.getDeadChar(combiningCharacter, newCharacterCodePoint); + if (combinedChar > 0) { + complexCharacter = (char) combinedChar; + } + combiningCharacter = 0; + } + } + + return complexCharacter; + } +} diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/KeyEventChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/KeyEventChannel.java index 2ecd048386fcd..5b90d2a761d34 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/KeyEventChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/KeyEventChannel.java @@ -5,6 +5,7 @@ package io.flutter.embedding.engine.systemchannels; import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.view.KeyEvent; import java.util.HashMap; @@ -26,7 +27,7 @@ public KeyEventChannel(@NonNull DartExecutor dartExecutor) { this.channel = new BasicMessageChannel<>(dartExecutor, "flutter/keyevent", JSONMessageCodec.INSTANCE); } - public void keyUp(@NonNull KeyEvent keyEvent) { + public void keyUp(@NonNull FlutterKeyEvent keyEvent) { Map message = new HashMap<>(); message.put("type", "keyup"); message.put("keymap", "android"); @@ -35,7 +36,7 @@ public void keyUp(@NonNull KeyEvent keyEvent) { channel.send(message); } - public void keyDown(@NonNull KeyEvent keyEvent) { + public void keyDown(@NonNull FlutterKeyEvent keyEvent) { Map message = new HashMap<>(); message.put("type", "keydown"); message.put("keymap", "android"); @@ -44,11 +45,68 @@ public void keyDown(@NonNull KeyEvent keyEvent) { channel.send(message); } - private void encodeKeyEvent(@NonNull KeyEvent event, @NonNull Map message) { - message.put("flags", event.getFlags()); - message.put("codePoint", event.getUnicodeChar()); - message.put("keyCode", event.getKeyCode()); - message.put("scanCode", event.getScanCode()); - message.put("metaState", event.getMetaState()); + private void encodeKeyEvent(@NonNull FlutterKeyEvent event, @NonNull Map message) { + message.put("flags", event.flags); + message.put("plainCodePoint", event.plainCodePoint); + message.put("codePoint", event.codePoint); + message.put("keyCode", event.keyCode); + message.put("scanCode", event.scanCode); + message.put("metaState", event.metaState); + if (event.complexCharacter != null) { + message.put("character", event.complexCharacter.toString()); + } + } + + /** + * Key event as defined by Flutter. + */ + public static class FlutterKeyEvent { + public final int flags; + public final int plainCodePoint; + public final int codePoint; + public final int keyCode; + @Nullable + public final Character complexCharacter; + public final int scanCode; + public final int metaState; + + public FlutterKeyEvent( + @NonNull KeyEvent androidKeyEvent + ) { + this(androidKeyEvent, null); + } + + public FlutterKeyEvent( + @NonNull KeyEvent androidKeyEvent, + @Nullable Character complexCharacter + ) { + this( + androidKeyEvent.getFlags(), + androidKeyEvent.getUnicodeChar(0x0), + androidKeyEvent.getUnicodeChar(), + androidKeyEvent.getKeyCode(), + complexCharacter, + androidKeyEvent.getScanCode(), + androidKeyEvent.getMetaState() + ); + } + + public FlutterKeyEvent( + int flags, + int plainCodePoint, + int codePoint, + int keyCode, + @Nullable Character complexCharacter, + int scanCode, + int metaState + ) { + this.flags = flags; + this.plainCodePoint = plainCodePoint; + this.codePoint = codePoint; + this.keyCode = keyCode; + this.complexCharacter = complexCharacter; + this.scanCode = scanCode; + this.metaState = metaState; + } } } diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 04abba458acb0..b5126c31d5418 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -26,6 +26,7 @@ import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; import io.flutter.app.FlutterPluginRegistry; +import io.flutter.embedding.engine.android.AndroidKeyProcessor; import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.embedding.engine.systemchannels.KeyEventChannel; import io.flutter.embedding.engine.systemchannels.LifecycleChannel; @@ -93,6 +94,7 @@ static final class ViewportMetrics { private final SystemChannel systemChannel; private final InputMethodManager mImm; private final TextInputPlugin mTextInputPlugin; + private final AndroidKeyProcessor androidKeyProcessor; private final SurfaceHolder.Callback mSurfaceCallback; private final ViewportMetrics mMetrics; private final AccessibilityManager mAccessibilityManager; @@ -172,7 +174,7 @@ public void surfaceDestroyed(SurfaceHolder holder) { addActivityLifecycleListener(platformPlugin); mImm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); mTextInputPlugin = new TextInputPlugin(this); - + androidKeyProcessor = new AndroidKeyProcessor(keyEventChannel); setLocales(getResources().getConfiguration()); sendUserPlatformSettingsToDart(); @@ -183,7 +185,7 @@ public boolean onKeyUp(int keyCode, KeyEvent event) { if (!isAttached()) { return super.onKeyUp(keyCode, event); } - keyEventChannel.keyUp(event); + androidKeyProcessor.onKeyUp(event); return super.onKeyUp(keyCode, event); } @@ -199,7 +201,7 @@ public boolean onKeyDown(int keyCode, KeyEvent event) { } } - keyEventChannel.keyDown(event); + androidKeyProcessor.onKeyDown(event); return super.onKeyDown(keyCode, event); } From 87b40ba974b845fbee6c841591ea0fcd5fd7a6fb Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 11 Feb 2019 16:49:45 -0800 Subject: [PATCH 0138/1117] Allow embedders to specify pointer device IDs. (#7790) --- shell/platform/embedder/embedder.cc | 1 + shell/platform/embedder/embedder.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 512f1183153dd..165610d8caf2f 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -576,6 +576,7 @@ FlutterEngineResult FlutterEngineSendPointerEvent( pointer_data.kind = blink::PointerData::DeviceKind::kMouse; pointer_data.physical_x = SAFE_ACCESS(current, x, 0.0); pointer_data.physical_y = SAFE_ACCESS(current, y, 0.0); + pointer_data.device = SAFE_ACCESS(current, device, 0); packet->SetPointerData(i, pointer_data); current = reinterpret_cast( reinterpret_cast(current) + current->struct_size); diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index cebe9d6b74dd9..d1a997aeca16e 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -157,6 +157,9 @@ typedef struct { size_t timestamp; // in microseconds. double x; double y; + // An optional device identifier. If this is not specified, it is assumed that + // the embedder has no multitouch capability. + int32_t device; } FlutterPointerEvent; struct _FlutterPlatformMessageResponseHandle; From 713fe130eb0200412b04cc0c3356fce5f6f98153 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 11 Feb 2019 19:51:02 -0500 Subject: [PATCH 0139/1117] Roll src/third_party/skia 103288b50fa7..454e5fb7457d (11 commits) (#7792) https://skia.googlesource.com/skia.git/%2Blog/103288b50fa7..454e5fb7457d git log 103288b50fa799631fec5e8f63c990145528f9ba..454e5fb7457dacc4c508187ed879ceb6c9d0302d --date=short --no-merges --format=%ad %ae %s 2019-02-08 bungeman@google.com Fix cluster reporting from shaper. 2019-02-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 64c44b0c53c4..f96948857780 (3 commits) 2019-02-11 herb@google.com Common code calculates strike for mask case. 2019-02-11 mtklein@google.com run all available OpenCL devices 2019-02-11 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-11 herb@google.com Introduce SkScopedStrike 2019-02-11 mtklein@google.com add a -Wuffs bot 2019-02-11 robertphillips@google.com Outline GrDrawAtlasOp and GrDrawVerticesOp 2019-02-11 brianosman@google.com Use clang versions of SK_RESTRICT and SK_WARN_UNUSED_RESULT on Windows 2019-02-11 robertphillips@google.com Plumb abandonment throughout GrContext hierarchy 2019-02-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader d9ce258c174b..64c44b0c53c4 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 2db84bd100c19..7093d6faa960b 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': '103288b50fa799631fec5e8f63c990145528f9ba', + 'skia_revision': '454e5fb7457dacc4c508187ed879ceb6c9d0302d', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6236cfe222498..6864331f40f1b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 0ab00063cbfd8da7c9afcc01389033d1 +Signature: 7f16312dcc1a7eabb2005abe872bbe29 UNUSED LICENSES: @@ -2198,6 +2198,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-Debian9-Clang-x86_64-Debug-SK_CPU_LIMIT_SSE41.json 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-Debug-Tidy.json +FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Debug-Wuffs.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-CMake.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian9-Clang-x86_64-Release-Fast.json From d48de7a3ec97ebf7ffe543aa74993efa51064789 Mon Sep 17 00:00:00 2001 From: Stanislav Baranov Date: Mon, 11 Feb 2019 16:56:33 -0800 Subject: [PATCH 0140/1117] Support for binary decompression of dynamic patches. (#7777) --- ci/licenses.sh | 2 +- ci/licenses_golden/licenses_flutter | 36 +++++++- shell/platform/android/BUILD.gn | 1 + .../android/io/flutter/util/BSDiff.java | 92 +++++++++++++++++++ .../io/flutter/view/ResourceExtractor.java | 65 ++++++++----- 5 files changed, 169 insertions(+), 27 deletions(-) create mode 100644 shell/platform/android/io/flutter/util/BSDiff.java diff --git a/ci/licenses.sh b/ci/licenses.sh index a8452f36edcc5..40bb4b9eb559a 100755 --- a/ci/licenses.sh +++ b/ci/licenses.sh @@ -42,7 +42,7 @@ fi 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. +expectedLicenseCount=3 # When changing this number: Update the error message below as well describing all expected license types. if [ "$actualLicenseCount" -ne "$expectedLicenseCount" ] then diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index cea4f342c6317..761a54549f62f 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -691,6 +691,40 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== +==================================================================================================== +LIBRARY: engine +ORIGIN: ../../../flutter/shell/platform/android/io/flutter/util/BSDiff.java + ../../../flutter/LICENSE +TYPE: LicenseType.bsd +FILE: ../../../flutter/shell/platform/android/io/flutter/util/BSDiff.java +---------------------------------------------------------------------------------------------------- +Copyright 2003-2005 Colin Percival. 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 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: txt ORIGIN: ../../../flutter/third_party/txt/LICENSE @@ -977,4 +1011,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: 2 +Total license count: 3 diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index b6560fca38737..37002cf5fd4eb 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -149,6 +149,7 @@ java_library("flutter_shell_java") { "io/flutter/plugin/platform/PlatformViewsController.java", "io/flutter/plugin/platform/SingleViewPresentation.java", "io/flutter/plugin/platform/VirtualDisplayController.java", + "io/flutter/util/BSDiff.java", "io/flutter/util/PathUtils.java", "io/flutter/util/Preconditions.java", "io/flutter/util/Predicate.java", diff --git a/shell/platform/android/io/flutter/util/BSDiff.java b/shell/platform/android/io/flutter/util/BSDiff.java new file mode 100644 index 0000000000000..3b0295dc68b26 --- /dev/null +++ b/shell/platform/android/io/flutter/util/BSDiff.java @@ -0,0 +1,92 @@ +// Copyright 2003-2005 Colin Percival. All rights reserved. +// Copyright 2013 The Flutter 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.util; + +import java.io.*; +import java.util.zip.GZIPInputStream; + +/** + * This is a Java port of algorithm from Flutter framework bsdiff.dart. + * Note that this port uses 32-bit ints, which limits data size to 2GB. + **/ +public abstract class BSDiff { + public static byte[] bspatch(byte[] olddata, byte[] diffdata) throws IOException { + InputStream in = new ByteArrayInputStream(diffdata, 0, diffdata.length); + DataInputStream header = new DataInputStream(in); + + byte[] magic = new byte[8]; + header.read(magic); + if (!new String(magic).equals("BZDIFF40")) { + throw new IOException("Invalid magic"); + } + + int ctrllen = (int) header.readLong(); + int datalen = (int) header.readLong(); + int newsize = (int) header.readLong(); + header.close(); + + in = new ByteArrayInputStream(diffdata, 0, diffdata.length); + in.skip(32); + DataInputStream cpf = new DataInputStream(new GZIPInputStream(in)); + + in = new ByteArrayInputStream(diffdata, 0, diffdata.length); + in.skip(32 + ctrllen); + InputStream dpf = new GZIPInputStream(in); + + in = new ByteArrayInputStream(diffdata, 0, diffdata.length); + in.skip(32 + ctrllen + datalen); + InputStream epf = new GZIPInputStream(in); + + byte[] newdata = new byte[newsize]; + + int oldpos = 0; + int newpos = 0; + + while (newpos < newsize) { + int[] ctrl = new int[3]; + for (int i = 0; i <= 2; i++) { + ctrl[i] = (int) cpf.readLong(); + } + if (newpos + ctrl[0] > newsize) { + throw new IOException("Invalid ctrl[0]"); + } + + read(dpf, newdata, newpos, ctrl[0]); + + for (int i = 0; i < ctrl[0]; i++) { + if ((oldpos + i >= 0) && (oldpos + i < olddata.length)) { + newdata[newpos + i] += olddata[oldpos + i]; + } + } + + newpos += ctrl[0]; + oldpos += ctrl[0]; + + if (newpos + ctrl[1] > newsize) { + throw new IOException("Invalid ctrl[0]"); + } + + read(epf, newdata, newpos, ctrl[1]); + + newpos += ctrl[1]; + oldpos += ctrl[2]; + } + + cpf.close(); + dpf.close(); + epf.close(); + + return newdata; + } + + private static void read(InputStream in, byte[] buf, int off, int len) throws IOException { + for (int i, n = 0; n < len; n += i) { + if ((i = in.read(buf, off + n, len - n)) < 0) { + throw new IOException("Unexpected EOF"); + } + } + } +} diff --git a/shell/platform/android/io/flutter/view/ResourceExtractor.java b/shell/platform/android/io/flutter/view/ResourceExtractor.java index a0e2f0965ad4d..b44bace5f0a4e 100644 --- a/shell/platform/android/io/flutter/view/ResourceExtractor.java +++ b/shell/platform/android/io/flutter/view/ResourceExtractor.java @@ -11,6 +11,7 @@ import android.os.AsyncTask; import android.os.Build; import android.util.Log; +import io.flutter.util.BSDiff; import io.flutter.util.PathUtils; import org.json.JSONObject; @@ -19,6 +20,7 @@ import java.util.HashSet; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; +import java.util.zip.GZIPInputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -29,8 +31,6 @@ class ResourceExtractor { private static final String TAG = "ResourceExtractor"; private static final String TIMESTAMP_PREFIX = "res_timestamp-"; - private static final int BUFFER_SIZE = 16 * 1024; - @SuppressWarnings("deprecation") static long getVersionCode(PackageInfo packageInfo) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { @@ -177,7 +177,6 @@ private void deleteFiles() { private boolean extractAPK(File dataDir) { final AssetManager manager = mContext.getResources().getAssets(); - byte[] buffer = null; for (String asset : mResources) { try { final File output = new File(dataDir, asset); @@ -190,19 +189,11 @@ private boolean extractAPK(File dataDir) { try (InputStream is = manager.open(asset); OutputStream os = new FileOutputStream(output)) { - if (buffer == null) { - buffer = new byte[BUFFER_SIZE]; - } - - int count = 0; - while ((count = is.read(buffer, 0, BUFFER_SIZE)) != -1) { - os.write(buffer, 0, count); - } - - os.flush(); - Log.i(TAG, "Extracted baseline resource " + asset); + copy(is, os); } + Log.i(TAG, "Extracted baseline resource " + asset); + } catch (FileNotFoundException fnfe) { continue; @@ -219,6 +210,8 @@ private boolean extractAPK(File dataDir) { /// Returns true if successfully unpacked update resources or if there is no update, /// otherwise deletes all resources and returns false. private boolean extractUpdate(File dataDir) { + final AssetManager manager = mContext.getResources().getAssets(); + ResourceUpdater resourceUpdater = FlutterMain.getResourceUpdater(); if (resourceUpdater == null) { return true; @@ -245,11 +238,15 @@ private boolean extractUpdate(File dataDir) { return false; } - byte[] buffer = null; for (String asset : mResources) { + boolean useDiff = false; ZipEntry entry = zipFile.getEntry(asset); if (entry == null) { - continue; + useDiff = true; + entry = zipFile.getEntry(asset + ".bzdiff40"); + if (entry == null) { + continue; + } } final File output = new File(dataDir, asset); @@ -260,18 +257,29 @@ private boolean extractUpdate(File dataDir) { output.getParentFile().mkdirs(); } - try (InputStream is = zipFile.getInputStream(entry); - OutputStream os = new FileOutputStream(output)) { - if (buffer == null) { - buffer = new byte[BUFFER_SIZE]; - } + try { + if (useDiff) { + ByteArrayOutputStream diff = new ByteArrayOutputStream(); + try (InputStream is = zipFile.getInputStream(entry)) { + copy(is, diff); + } + + ByteArrayOutputStream orig = new ByteArrayOutputStream(); + try (InputStream is = manager.open(asset)) { + copy(is, orig); + } + + try (OutputStream os = new FileOutputStream(output)) { + os.write(BSDiff.bspatch(orig.toByteArray(), diff.toByteArray())); + } - int count = 0; - while ((count = is.read(buffer, 0, BUFFER_SIZE)) != -1) { - os.write(buffer, 0, count); + } else { + try (InputStream is = zipFile.getInputStream(entry); + OutputStream os = new FileOutputStream(output)) { + copy(is, os); + } } - os.flush(); Log.i(TAG, "Extracted override resource " + asset); } catch (FileNotFoundException fnfe) { @@ -339,4 +347,11 @@ private String checkTimestamp(File dataDir) { return null; } + + private static void copy(InputStream in, OutputStream out) throws IOException { + byte[] buf = new byte[16 * 1024]; + for (int i; (i = in.read(buf)) >= 0; ) { + out.write(buf, 0, i); + } + } } From c58f5fefe0bd3a064c0f8b05e6fe90d4112d912b Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 11 Feb 2019 19:04:38 -0800 Subject: [PATCH 0141/1117] Roll src/third_party/dart fdfe40ea95..754e5f404c (13 commits) 754e5f404c Revert "[vm/extensions] Fix Loader::ReloadNativeExtensions(...)." 61e109c652 Fix typo in Map.values documentation 640bfb45f8 Mark test as failing due to #35909 5f02f3cac2 Remove tests for removed ARGUMENT_LIST suggestions. 4118d3c793 [vm/extensions] Fix Loader::ReloadNativeExtensions(...). a988ed06bd [analyzer] Fix off-by-one-error in experiments de2e7e7721 [infra] Update test.py help now that named configurations are implemented. 859c1ffb79 [testing] Allow test.py test list to be specified as string 07f2eba311 [infra] Remove remnant of analyzer-linux-release-analyzer-new. 473c424fe2 [VM/Decoupling] Follow-up change to decoupling of stub_code: Fix missing "!" a8e2dfdb9b [vm] Decouple stub code from runtime. 5e48ccb808 Give more context when initializing from dill fails a5c53b03cd Convert more doc comments from block to line style --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 18 ++++++++++----- sky/packages/sky_engine/LICENSE | 29 +++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/DEPS b/DEPS index 7093d6faa960b..6d38fe793454c 100644 --- a/DEPS +++ b/DEPS @@ -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': 'fdfe40ea95d4e91dc9fc0d6e0a1f5215ab7c4b40', + 'dart_revision': '754e5f404c7a78510e2b8c52a265f4dc786cf786', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index c656e8d53bb7a..7f2d3ee9d7acc 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 040756bb0b57c047a52c98602ad55b4b +Signature: b0c9cbfed3ecf7fd6279c9c064b15125 UNUSED LICENSES: @@ -5653,7 +5653,6 @@ FILE: ../../../third_party/dart/runtime/vm/signal_handler_fuchsia.cc FILE: ../../../third_party/dart/runtime/vm/simulator_dbc.cc FILE: ../../../third_party/dart/runtime/vm/simulator_dbc.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_dbc.h -FILE: ../../../third_party/dart/runtime/vm/stub_code_dbc.cc FILE: ../../../third_party/dart/runtime/vm/thread_interrupter_fuchsia.cc FILE: ../../../third_party/dart/runtime/vm/token_position.cc FILE: ../../../third_party/dart/runtime/vm/token_position.h @@ -5709,15 +5708,26 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/backend/slot_test.cc FILE: ../../../third_party/dart/runtime/vm/compiler/relocation.cc FILE: ../../../third_party/dart/runtime/vm/compiler/runtime_api.cc FILE: ../../../third_party/dart/runtime/vm/compiler/runtime_api.h +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler.h +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm64.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_dbc.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_ia32.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_x64.cc FILE: ../../../third_party/dart/runtime/vm/frame_layout.h FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist.h FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist_test.cc FILE: ../../../third_party/dart/runtime/vm/longjump.h FILE: ../../../third_party/dart/runtime/vm/pointer_tagging.h +FILE: ../../../third_party/dart/runtime/vm/static_type_exactness_state.h +FILE: ../../../third_party/dart/runtime/vm/stub_code_list.h FILE: ../../../third_party/dart/runtime/vm/thread_stack_resource.cc FILE: ../../../third_party/dart/runtime/vm/thread_stack_resource.h FILE: ../../../third_party/dart/runtime/vm/thread_state.cc FILE: ../../../third_party/dart/runtime/vm/thread_state.h +FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm.cc +FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm64.cc +FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_x64.cc ---------------------------------------------------------------------------------------------------- Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file for details. All rights reserved. @@ -6201,10 +6211,7 @@ FILE: ../../../third_party/dart/runtime/vm/simulator_arm.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_arm.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_ia32.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_x64.h -FILE: ../../../third_party/dart/runtime/vm/stub_code_arm.cc FILE: ../../../third_party/dart/runtime/vm/stub_code_arm_test.cc -FILE: ../../../third_party/dart/runtime/vm/stub_code_ia32.cc -FILE: ../../../third_party/dart/runtime/vm/stub_code_x64.cc FILE: ../../../third_party/dart/runtime/vm/tags.h FILE: ../../../third_party/dart/runtime/vm/thread_interrupter.cc FILE: ../../../third_party/dart/runtime/vm/thread_interrupter.h @@ -6466,7 +6473,6 @@ FILE: ../../../third_party/dart/runtime/vm/runtime_entry_arm64.cc FILE: ../../../third_party/dart/runtime/vm/simulator_arm64.cc FILE: ../../../third_party/dart/runtime/vm/simulator_arm64.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_arm64.h -FILE: ../../../third_party/dart/runtime/vm/stub_code_arm64.cc FILE: ../../../third_party/dart/runtime/vm/stub_code_arm64_test.cc FILE: ../../../third_party/dart/runtime/vm/tags.cc FILE: ../../../third_party/dart/runtime/vm/unibrow-inl.h diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index edab381ceabd6..7105cca3faac3 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -3493,6 +3493,35 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- engine + +Copyright 2003-2005 Colin Percival. 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 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 txt Copyright 2013 The Flutter Authors. All rights reserved. From 27ab9f7afc26fe5ea116f83e8e778cd3bc4feaf9 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 11 Feb 2019 23:42:39 -0500 Subject: [PATCH 0142/1117] Roll src/third_party/skia 454e5fb7457d..233fc0b03c02 (4 commits) (#7794) https://skia.googlesource.com/skia.git/%2Blog/454e5fb7457d..233fc0b03c02 git log 454e5fb7457dacc4c508187ed879ceb6c9d0302d..233fc0b03c0255c96880e8e4561ee0d7eb352836 --date=short --no-merges --format=%ad %ae %s 2019-02-11 reed@google.com remove unused cruft 2019-02-11 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 fe59f6b5ed2b..ad194995ed72 (8 commits) 2019-02-10 nigeltao@google.com SkWuffsCodec: zero dst buffer before decodeFrame The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 6d38fe793454c..7d8aa44844b39 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': '454e5fb7457dacc4c508187ed879ceb6c9d0302d', + 'skia_revision': '233fc0b03c0255c96880e8e4561ee0d7eb352836', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6864331f40f1b..d13baab14ed2a 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 7f16312dcc1a7eabb2005abe872bbe29 +Signature: f610deca58b93710bfc33d3c50818c00 UNUSED LICENSES: From b4ed8cff380debaf04e36c1b251e8191f5b9bb6a Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 12 Feb 2019 03:48:49 -0500 Subject: [PATCH 0143/1117] Roll src/third_party/skia 233fc0b03c02..217acf58d0d8 (1 commits) (#7795) https://skia.googlesource.com/skia.git/%2Blog/233fc0b03c02..217acf58d0d8 git log 233fc0b03c0255c96880e8e4561ee0d7eb352836..217acf58d0d80c50854c1fd8f6684c325d8d6de6 --date=short --no-merges --format=%ad %ae %s 2019-02-12 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 7d8aa44844b39..6fafab5b30d2a 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': '233fc0b03c0255c96880e8e4561ee0d7eb352836', + 'skia_revision': '217acf58d0d80c50854c1fd8f6684c325d8d6de6', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index d13baab14ed2a..424df66227352 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f610deca58b93710bfc33d3c50818c00 +Signature: b1299c4da24c2df1f77a18391e21fca3 UNUSED LICENSES: From 17b7d1e0ae119a1d659a2a0ef8295723f81a53f7 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 12 Feb 2019 01:07:37 -0800 Subject: [PATCH 0144/1117] Roll src/third_party/dart 754e5f404c..ecd7a88606 (8 commits) ecd7a88606 [vm, gc] Don't enqueue pre-marked Instructions. 553e20863c [vm] Remove some dead code from the old front end. 7ff0cbe8a3 Add types to TimelineSyncFunction and Timeline.timeSync; fixes #35509 3de72ae066 Added files, when in a context root, should be accessible through getLibraries(). b9bcfb4529 Change IncludedSuggestionRelevanceTag to using 'relevanceBoost'. d93ef933d5 [tests] Add 'spread-collections' flag b88d11a9bd Implement LSP workspace/symbol 25cefbdad7 Add HintCode.INVALID_VISIBILITY_ANNOTATION. Fixes #35141 --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 6fafab5b30d2a..d71ebeae10a3a 100644 --- a/DEPS +++ b/DEPS @@ -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': '754e5f404c7a78510e2b8c52a265f4dc786cf786', + 'dart_revision': 'ecd7a88606a4bf896316f56f1b0db6f5469c2623', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 7f2d3ee9d7acc..0bb6b2c9d119f 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: b0c9cbfed3ecf7fd6279c9c064b15125 +Signature: b96e952dc699011e4e876641cc051a12 UNUSED LICENSES: From c4a55552b5f07fdb0bb1db73df08a1843dd7e5a8 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Tue, 12 Feb 2019 03:32:59 -0800 Subject: [PATCH 0145/1117] Use all font managers to discover fonts for strut. (#7734) --- third_party/txt/src/txt/font_collection.cc | 20 ---- third_party/txt/src/txt/font_collection.h | 4 - third_party/txt/src/txt/paragraph.cc | 26 +++-- third_party/txt/tests/paragraph_unittests.cc | 110 +++++++++---------- 4 files changed, 69 insertions(+), 91 deletions(-) diff --git a/third_party/txt/src/txt/font_collection.cc b/third_party/txt/src/txt/font_collection.cc index 1592d9227ccfe..ff687726ebed9 100644 --- a/third_party/txt/src/txt/font_collection.cc +++ b/third_party/txt/src/txt/font_collection.cc @@ -178,26 +178,6 @@ FontCollection::GetMinikinFontCollectionForFamilies( return font_collection; } -minikin::MinikinFont* FontCollection::GetMinikinFontForFamilies( - const std::vector& font_families, - minikin::FontStyle style) { - std::shared_ptr font_family = nullptr; - for (std::string family_name : font_families) { - font_family = FindFontFamilyInManagers(family_name); - if (font_family != nullptr) { - break; - } - } - if (font_family == nullptr) { - const auto default_font_family = GetDefaultFontFamily(); - font_family = FindFontFamilyInManagers(default_font_family); - } - if (font_family == nullptr) { - return nullptr; - } - return font_family.get()->getClosestMatch(style).font; -} - std::shared_ptr FontCollection::FindFontFamilyInManagers( const std::string& family_name) { // Search for the font family in each font manager. diff --git a/third_party/txt/src/txt/font_collection.h b/third_party/txt/src/txt/font_collection.h index fe05c9f6d97be..c98b4d29ca05d 100644 --- a/third_party/txt/src/txt/font_collection.h +++ b/third_party/txt/src/txt/font_collection.h @@ -49,10 +49,6 @@ class FontCollection : public std::enable_shared_from_this { const std::vector& font_families, const std::string& locale); - minikin::MinikinFont* GetMinikinFontForFamilies( - const std::vector& font_families, - minikin::FontStyle style); - // Provides a FontFamily that contains glyphs for ch. This caches previously // matched fonts. Also see FontCollection::DoMatchFallbackFont. const std::shared_ptr& MatchFallbackFont( diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index 65efccc8a1f1b..5ba7e648b318c 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -441,18 +441,20 @@ void Paragraph::ComputeStrut(StrutMetrics* strut, SkFont& font) { // force_strut makes all lines have exactly the strut metrics, and ignores all // actual metrics. We only force the strut if the strut is non-zero and valid. strut->force_strut = paragraph_style_.force_strut_height && valid_strut; - const FontSkia* font_skia = - static_cast(font_collection_->GetMinikinFontForFamilies( - paragraph_style_.strut_font_families, - // TODO(garyq): The variant is currently set to 0 (default) as we do - // not have a property to set it with. We should eventually support - // default, compact, and elegant variants. - minikin::FontStyle( - 0, GetWeight(paragraph_style_.strut_font_weight), - paragraph_style_.strut_font_style == FontStyle::italic))); - - if (font_skia != nullptr) { - font.setTypeface(font_skia->GetSkTypeface()); + minikin::FontStyle minikin_font_style( + 0, GetWeight(paragraph_style_.strut_font_weight), + paragraph_style_.strut_font_style == FontStyle::italic); + + std::shared_ptr collection = + font_collection_->GetMinikinFontCollectionForFamilies( + paragraph_style_.strut_font_families, ""); + if (!collection) { + return; + } + minikin::FakedFont faked_font = collection->baseFontFaked(minikin_font_style); + + if (faked_font.font != nullptr) { + font.setTypeface(static_cast(faked_font.font)->GetSkTypeface()); font.setSize(paragraph_style_.strut_font_size); SkFontMetrics strut_metrics; font.getMetrics(&strut_metrics); diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index 5e37ae1d33092..1f0c98ef77ac4 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -2755,7 +2755,7 @@ TEST_F(ParagraphTest, FontFallbackParagraph) { // // TODO(garyq): Re-enable strut tests, allow font metric fakery, or // consolidate skia font metric behavior. -TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { +TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph1)) { // The chinese extra height should be absorbed by the strut. const char* text = "01234満毎冠p来É本可\nabcd\n満毎É行p昼本可"; auto icu_text = icu::UnicodeString::fromUTF8(text); @@ -2767,7 +2767,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { paragraph_style.strut_font_families = std::vector(1, "BlahFake"); paragraph_style.strut_font_families.push_back("ahem"); paragraph_style.strut_font_size = 50; - paragraph_style.strut_height = 1.5; + paragraph_style.strut_height = 1.8; paragraph_style.strut_leading = 0.1; paragraph_style.strut_enabled = true; @@ -2781,7 +2781,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { text_style.font_weight = FontWeight::w500; text_style.word_spacing = 0; text_style.color = SK_ColorBLACK; - text_style.height = 1; + text_style.height = .5; builder.PushStyle(text_style); builder.AddText(u16_text); @@ -2820,9 +2820,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 34.5); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80.313477); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 84.5); boxes = paragraph->GetRectsForRange(0, 1, rect_height_max_style, rect_width_style); @@ -2831,9 +2831,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 34.5); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 95); boxes = paragraph->GetRectsForRange(6, 10, rect_height_style, rect_width_style); @@ -2842,9 +2842,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 34.5); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80.313477); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 84.5); boxes = paragraph->GetRectsForRange(6, 10, rect_height_max_style, rect_width_style); @@ -2853,9 +2853,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 34.5); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 95); boxes = paragraph->GetRectsForRange(14, 16, rect_height_max_style, rect_width_style); @@ -2864,9 +2864,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 208.31348); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 224.5); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 100); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 267); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 285); boxes = paragraph->GetRectsForRange(20, 25, rect_height_max_style, rect_width_style); @@ -2875,9 +2875,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 297.31348); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 319.5); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 356); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 380); ASSERT_TRUE(Snapshot()); } @@ -2887,7 +2887,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { // // TODO(garyq): Re-enable strut tests, allow font metric fakery, or // consolidate skia font metric behavior. -TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { +TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph2)) { // This string is all one size and smaller than the strut metrics. const char* text = "01234ABCDEFGH\nabcd\nABCDEFGH"; auto icu_text = icu::UnicodeString::fromUTF8(text); @@ -2949,9 +2949,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 33.229004); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 24); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 83.229004); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 74); boxes = paragraph->GetRectsForRange(0, 1, rect_height_max_style, rect_width_style); @@ -2960,9 +2960,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 33.229004); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 24); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 91); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80); boxes = paragraph->GetRectsForRange(6, 10, rect_height_style, rect_width_style); @@ -2971,9 +2971,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 33.229004); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 24); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 83.229004); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 74); boxes = paragraph->GetRectsForRange(6, 10, rect_height_max_style, rect_width_style); @@ -2982,9 +2982,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 33.229004); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 24); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 91); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80); boxes = paragraph->GetRectsForRange(14, 16, rect_height_max_style, rect_width_style); @@ -2993,9 +2993,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 215.229); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 184); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 100); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 273); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 240); boxes = paragraph->GetRectsForRange(20, 25, rect_height_max_style, rect_width_style); @@ -3004,9 +3004,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 306.229); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 264); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 364); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 320); ASSERT_TRUE(Snapshot()); } @@ -3016,7 +3016,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { // // TODO(garyq): Re-enable strut tests, allow font metric fakery, or // consolidate skia font metric behavior. -TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { +TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph3)) { // The strut is too small to absorb the extra chinese height, but the english // second line height is increased due to strut. const char* text = "01234満毎p行来昼本可\nabcd\n満毎冠行来昼本可"; @@ -3028,7 +3028,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { paragraph_style.max_lines = 10; paragraph_style.strut_font_families = std::vector(1, "ahem"); paragraph_style.strut_font_size = 50; - paragraph_style.strut_height = 1.1; + paragraph_style.strut_height = 1.2; paragraph_style.strut_enabled = true; txt::ParagraphBuilder builder(paragraph_style, GetTestFontCollection()); @@ -3079,9 +3079,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 10.526855); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 8); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 60.526855); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 58); boxes = paragraph->GetRectsForRange(0, 1, rect_height_max_style, rect_width_style); @@ -3090,9 +3090,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 10.526855); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 8); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 63); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 60); boxes = paragraph->GetRectsForRange(6, 10, rect_height_style, rect_width_style); @@ -3101,9 +3101,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 10.526855); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 8); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 60.526855); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 58); boxes = paragraph->GetRectsForRange(6, 10, rect_height_max_style, rect_width_style); @@ -3112,9 +3112,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 10.526855); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 8); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 63); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 60); boxes = paragraph->GetRectsForRange(14, 16, rect_height_max_style, rect_width_style); @@ -3123,9 +3123,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 136.52686); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 128); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 100); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 189); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 180); boxes = paragraph->GetRectsForRange(20, 25, rect_height_max_style, rect_width_style); @@ -3134,9 +3134,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 199.52686); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 188); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 252); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 240); ASSERT_TRUE(Snapshot()); } @@ -3146,7 +3146,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { // // TODO(garyq): Re-enable strut tests, allow font metric fakery, or // consolidate skia font metric behavior. -TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutForceParagraph)) { +TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutForceParagraph)) { // The strut is too small to absorb the extra chinese height, but the english // second line height is increased due to strut. const char* text = "01234満毎冠行来昼本可\nabcd\n満毎冠行来昼本可"; @@ -3210,9 +3210,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 22.5); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80.313477); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 72.5); boxes = paragraph->GetRectsForRange(0, 1, rect_height_max_style, rect_width_style); @@ -3221,9 +3221,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 22.5); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80); boxes = paragraph->GetRectsForRange(6, 10, rect_height_style, rect_width_style); @@ -3232,9 +3232,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 22.5); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80.313477); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 72.5); boxes = paragraph->GetRectsForRange(6, 10, rect_height_max_style, rect_width_style); @@ -3243,9 +3243,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 22.5); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80); boxes = paragraph->GetRectsForRange(14, 16, rect_height_max_style, rect_width_style); @@ -3254,9 +3254,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 208.31348); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 182.5); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 100); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 267); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 240); boxes = paragraph->GetRectsForRange(20, 25, rect_height_max_style, rect_width_style); @@ -3265,9 +3265,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 297.31348); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 262.5); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 356); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 320); ASSERT_TRUE(Snapshot()); } From f7eb3cb2034a13991d65d6c499e0a764aca31671 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 12 Feb 2019 08:26:23 -0500 Subject: [PATCH 0146/1117] Roll src/third_party/skia 217acf58d0d8..63d477cd99b0 (1 commits) (#7797) https://skia.googlesource.com/skia.git/%2Blog/217acf58d0d8..63d477cd99b0 git log 217acf58d0d80c50854c1fd8f6684c325d8d6de6..63d477cd99b0706262a284a03cba859d0f19d638 --date=short --no-merges --format=%ad %ae %s 2019-02-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 ad194995ed72..c66fb571be1a (2 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d71ebeae10a3a..a354e3325b600 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': '217acf58d0d80c50854c1fd8f6684c325d8d6de6', + 'skia_revision': '63d477cd99b0706262a284a03cba859d0f19d638', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 424df66227352..97a0f93d54280 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b1299c4da24c2df1f77a18391e21fca3 +Signature: ca2d81d6f11db6fa446d934a915aeeee UNUSED LICENSES: From 769016c88029d5cfc60ff56a12924e06b6be81b2 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 12 Feb 2019 12:18:44 -0500 Subject: [PATCH 0147/1117] Roll src/third_party/skia 63d477cd99b0..0b6ae6386d34 (9 commits) (#7798) https://skia.googlesource.com/skia.git/%2Blog/63d477cd99b0..0b6ae6386d34 git log 63d477cd99b0706262a284a03cba859d0f19d638..0b6ae6386d34efa7554d1b515c016f1c66e09a30 --date=short --no-merges --format=%ad %ae %s 2019-02-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 0f34a98a206d..73c3124cc249 (1 commits) 2019-02-12 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader f96948857780..0f34a98a206d (1 commits) 2019-02-12 fmalita@chromium.org [sksg] Hit-testing API 2019-02-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 35663ddf4997..77b5d9247fd7 (472 commits) 2019-02-08 ethannicholas@google.com SkSL Metal backend can now handle CCPR 2019-02-12 kjlubick@google.com Build code size treemaps for skottie_tool 2019-02-11 gkaiser@google.com SkUTF: Avoid potential nullptr dereference 2019-02-12 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index a354e3325b600..4a9de7e44514f 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': '63d477cd99b0706262a284a03cba859d0f19d638', + 'skia_revision': '0b6ae6386d34efa7554d1b515c016f1c66e09a30', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 97a0f93d54280..8ca16378eb06f 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ca2d81d6f11db6fa446d934a915aeeee +Signature: cd4ae5c621870cc057df563c35539d56 UNUSED LICENSES: @@ -2053,6 +2053,7 @@ FILE: ../../../third_party/skia/animations/redcross#1.jpg 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/binary-size/Dockerfile FILE: ../../../third_party/skia/docker/cmake-release/Dockerfile FILE: ../../../third_party/skia/docker/skia-release/Dockerfile FILE: ../../../third_party/skia/docker/skia-wasm-release/Dockerfile From 74d94e52c66ed02a2da68e5a13b2f40de0820e79 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Tue, 12 Feb 2019 13:11:16 -0800 Subject: [PATCH 0148/1117] Revert "Use all font managers to discover fonts for strut. (#7734)" (#7801) This reverts commit c4a55552b5f07fdb0bb1db73df08a1843dd7e5a8. --- third_party/txt/src/txt/font_collection.cc | 20 ++++ third_party/txt/src/txt/font_collection.h | 4 + third_party/txt/src/txt/paragraph.cc | 26 ++--- third_party/txt/tests/paragraph_unittests.cc | 110 +++++++++---------- 4 files changed, 91 insertions(+), 69 deletions(-) diff --git a/third_party/txt/src/txt/font_collection.cc b/third_party/txt/src/txt/font_collection.cc index ff687726ebed9..1592d9227ccfe 100644 --- a/third_party/txt/src/txt/font_collection.cc +++ b/third_party/txt/src/txt/font_collection.cc @@ -178,6 +178,26 @@ FontCollection::GetMinikinFontCollectionForFamilies( return font_collection; } +minikin::MinikinFont* FontCollection::GetMinikinFontForFamilies( + const std::vector& font_families, + minikin::FontStyle style) { + std::shared_ptr font_family = nullptr; + for (std::string family_name : font_families) { + font_family = FindFontFamilyInManagers(family_name); + if (font_family != nullptr) { + break; + } + } + if (font_family == nullptr) { + const auto default_font_family = GetDefaultFontFamily(); + font_family = FindFontFamilyInManagers(default_font_family); + } + if (font_family == nullptr) { + return nullptr; + } + return font_family.get()->getClosestMatch(style).font; +} + std::shared_ptr FontCollection::FindFontFamilyInManagers( const std::string& family_name) { // Search for the font family in each font manager. diff --git a/third_party/txt/src/txt/font_collection.h b/third_party/txt/src/txt/font_collection.h index c98b4d29ca05d..fe05c9f6d97be 100644 --- a/third_party/txt/src/txt/font_collection.h +++ b/third_party/txt/src/txt/font_collection.h @@ -49,6 +49,10 @@ class FontCollection : public std::enable_shared_from_this { const std::vector& font_families, const std::string& locale); + minikin::MinikinFont* GetMinikinFontForFamilies( + const std::vector& font_families, + minikin::FontStyle style); + // Provides a FontFamily that contains glyphs for ch. This caches previously // matched fonts. Also see FontCollection::DoMatchFallbackFont. const std::shared_ptr& MatchFallbackFont( diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index 5ba7e648b318c..65efccc8a1f1b 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -441,20 +441,18 @@ void Paragraph::ComputeStrut(StrutMetrics* strut, SkFont& font) { // force_strut makes all lines have exactly the strut metrics, and ignores all // actual metrics. We only force the strut if the strut is non-zero and valid. strut->force_strut = paragraph_style_.force_strut_height && valid_strut; - minikin::FontStyle minikin_font_style( - 0, GetWeight(paragraph_style_.strut_font_weight), - paragraph_style_.strut_font_style == FontStyle::italic); - - std::shared_ptr collection = - font_collection_->GetMinikinFontCollectionForFamilies( - paragraph_style_.strut_font_families, ""); - if (!collection) { - return; - } - minikin::FakedFont faked_font = collection->baseFontFaked(minikin_font_style); - - if (faked_font.font != nullptr) { - font.setTypeface(static_cast(faked_font.font)->GetSkTypeface()); + const FontSkia* font_skia = + static_cast(font_collection_->GetMinikinFontForFamilies( + paragraph_style_.strut_font_families, + // TODO(garyq): The variant is currently set to 0 (default) as we do + // not have a property to set it with. We should eventually support + // default, compact, and elegant variants. + minikin::FontStyle( + 0, GetWeight(paragraph_style_.strut_font_weight), + paragraph_style_.strut_font_style == FontStyle::italic))); + + if (font_skia != nullptr) { + font.setTypeface(font_skia->GetSkTypeface()); font.setSize(paragraph_style_.strut_font_size); SkFontMetrics strut_metrics; font.getMetrics(&strut_metrics); diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index 1f0c98ef77ac4..5e37ae1d33092 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -2755,7 +2755,7 @@ TEST_F(ParagraphTest, FontFallbackParagraph) { // // TODO(garyq): Re-enable strut tests, allow font metric fakery, or // consolidate skia font metric behavior. -TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph1)) { +TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { // The chinese extra height should be absorbed by the strut. const char* text = "01234満毎冠p来É本可\nabcd\n満毎É行p昼本可"; auto icu_text = icu::UnicodeString::fromUTF8(text); @@ -2767,7 +2767,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph1)) { paragraph_style.strut_font_families = std::vector(1, "BlahFake"); paragraph_style.strut_font_families.push_back("ahem"); paragraph_style.strut_font_size = 50; - paragraph_style.strut_height = 1.8; + paragraph_style.strut_height = 1.5; paragraph_style.strut_leading = 0.1; paragraph_style.strut_enabled = true; @@ -2781,7 +2781,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph1)) { text_style.font_weight = FontWeight::w500; text_style.word_spacing = 0; text_style.color = SK_ColorBLACK; - text_style.height = .5; + text_style.height = 1; builder.PushStyle(text_style); builder.AddText(u16_text); @@ -2820,9 +2820,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 34.5); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 84.5); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80.313477); boxes = paragraph->GetRectsForRange(0, 1, rect_height_max_style, rect_width_style); @@ -2831,9 +2831,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 34.5); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 95); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89); boxes = paragraph->GetRectsForRange(6, 10, rect_height_style, rect_width_style); @@ -2842,9 +2842,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 34.5); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 84.5); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80.313477); boxes = paragraph->GetRectsForRange(6, 10, rect_height_max_style, rect_width_style); @@ -2853,9 +2853,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 34.5); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 95); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89); boxes = paragraph->GetRectsForRange(14, 16, rect_height_max_style, rect_width_style); @@ -2864,9 +2864,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 224.5); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 208.31348); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 100); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 285); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 267); boxes = paragraph->GetRectsForRange(20, 25, rect_height_max_style, rect_width_style); @@ -2875,9 +2875,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 319.5); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 297.31348); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 380); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 356); ASSERT_TRUE(Snapshot()); } @@ -2887,7 +2887,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph1)) { // // TODO(garyq): Re-enable strut tests, allow font metric fakery, or // consolidate skia font metric behavior. -TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph2)) { +TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { // This string is all one size and smaller than the strut metrics. const char* text = "01234ABCDEFGH\nabcd\nABCDEFGH"; auto icu_text = icu::UnicodeString::fromUTF8(text); @@ -2949,9 +2949,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 24); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 33.229004); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 74); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 83.229004); boxes = paragraph->GetRectsForRange(0, 1, rect_height_max_style, rect_width_style); @@ -2960,9 +2960,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 24); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 33.229004); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 91); boxes = paragraph->GetRectsForRange(6, 10, rect_height_style, rect_width_style); @@ -2971,9 +2971,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 24); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 33.229004); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 74); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 83.229004); boxes = paragraph->GetRectsForRange(6, 10, rect_height_max_style, rect_width_style); @@ -2982,9 +2982,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 24); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 33.229004); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 91); boxes = paragraph->GetRectsForRange(14, 16, rect_height_max_style, rect_width_style); @@ -2993,9 +2993,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 184); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 215.229); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 100); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 240); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 273); boxes = paragraph->GetRectsForRange(20, 25, rect_height_max_style, rect_width_style); @@ -3004,9 +3004,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 264); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 306.229); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 320); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 364); ASSERT_TRUE(Snapshot()); } @@ -3016,7 +3016,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph2)) { // // TODO(garyq): Re-enable strut tests, allow font metric fakery, or // consolidate skia font metric behavior. -TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph3)) { +TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { // The strut is too small to absorb the extra chinese height, but the english // second line height is increased due to strut. const char* text = "01234満毎p行来昼本可\nabcd\n満毎冠行来昼本可"; @@ -3028,7 +3028,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph3)) { paragraph_style.max_lines = 10; paragraph_style.strut_font_families = std::vector(1, "ahem"); paragraph_style.strut_font_size = 50; - paragraph_style.strut_height = 1.2; + paragraph_style.strut_height = 1.1; paragraph_style.strut_enabled = true; txt::ParagraphBuilder builder(paragraph_style, GetTestFontCollection()); @@ -3079,9 +3079,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 8); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 10.526855); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 58); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 60.526855); boxes = paragraph->GetRectsForRange(0, 1, rect_height_max_style, rect_width_style); @@ -3090,9 +3090,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 8); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 10.526855); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 60); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 63); boxes = paragraph->GetRectsForRange(6, 10, rect_height_style, rect_width_style); @@ -3101,9 +3101,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 8); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 10.526855); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 58); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 60.526855); boxes = paragraph->GetRectsForRange(6, 10, rect_height_max_style, rect_width_style); @@ -3112,9 +3112,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 8); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 10.526855); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 60); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 63); boxes = paragraph->GetRectsForRange(14, 16, rect_height_max_style, rect_width_style); @@ -3123,9 +3123,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 128); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 136.52686); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 100); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 180); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 189); boxes = paragraph->GetRectsForRange(20, 25, rect_height_max_style, rect_width_style); @@ -3134,9 +3134,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 188); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 199.52686); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 240); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 252); ASSERT_TRUE(Snapshot()); } @@ -3146,7 +3146,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph3)) { // // TODO(garyq): Re-enable strut tests, allow font metric fakery, or // consolidate skia font metric behavior. -TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutForceParagraph)) { +TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutForceParagraph)) { // The strut is too small to absorb the extra chinese height, but the english // second line height is increased due to strut. const char* text = "01234満毎冠行来昼本可\nabcd\n満毎冠行来昼本可"; @@ -3210,9 +3210,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 22.5); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 72.5); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80.313477); boxes = paragraph->GetRectsForRange(0, 1, rect_height_max_style, rect_width_style); @@ -3221,9 +3221,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 22.5); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89); boxes = paragraph->GetRectsForRange(6, 10, rect_height_style, rect_width_style); @@ -3232,9 +3232,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 22.5); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 72.5); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80.313477); boxes = paragraph->GetRectsForRange(6, 10, rect_height_max_style, rect_width_style); @@ -3243,9 +3243,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 22.5); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89); boxes = paragraph->GetRectsForRange(14, 16, rect_height_max_style, rect_width_style); @@ -3254,9 +3254,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 182.5); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 208.31348); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 100); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 240); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 267); boxes = paragraph->GetRectsForRange(20, 25, rect_height_max_style, rect_width_style); @@ -3265,9 +3265,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 262.5); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 297.31348); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 320); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 356); ASSERT_TRUE(Snapshot()); } From 1dead52a80a2d8fa3b89445c192ba1b7169c0dca Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 12 Feb 2019 16:13:47 -0500 Subject: [PATCH 0149/1117] Roll src/third_party/skia 0b6ae6386d34..14d64dd4c47c (10 commits) (#7802) https://skia.googlesource.com/skia.git/%2Blog/0b6ae6386d34..14d64dd4c47c git log 0b6ae6386d34efa7554d1b515c016f1c66e09a30..14d64dd4c47c2ecf45e8b9e02b264fcd5eea7b09 --date=short --no-merges --format=%ad %ae %s 2019-02-12 herb@google.com Remove unneeded SkPackedUnicharID 2019-02-12 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-12 egdaniel@google.com Remove private configs from GrPixelConfig. 2019-02-12 halcanary@google.com SkPaint: clean up ctor, dtor, etc 2019-02-12 brianosman@google.com Experimental Particle System 2019-02-12 bungeman@google.com Primitive SkShaper to do primitive line breaking. 2019-02-12 reed@google.com starter sample for playing with SG. will flesh out more over time. 2019-02-12 bungeman@google.com Make SkSpan C++11 compatible. 2019-02-12 benjaminwagner@google.com Upgrade to Mesa 18.3.3 2019-02-12 herb@google.com Remove redundant fGlyphMap.set The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4a9de7e44514f..64a4e2b085143 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': '0b6ae6386d34efa7554d1b515c016f1c66e09a30', + 'skia_revision': '14d64dd4c47c2ecf45e8b9e02b264fcd5eea7b09', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 8ca16378eb06f..8c4f9969e7457 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: cd4ae5c621870cc057df563c35539d56 +Signature: 61a114339340fd33e37605281ad212bc UNUSED LICENSES: @@ -4682,6 +4682,18 @@ ORIGIN: ../../../third_party/skia/experimental/canvaskit/WasmAliases.h + ../../. TYPE: LicenseType.bsd FILE: ../../../third_party/skia/experimental/canvaskit/WasmAliases.h FILE: ../../../third_party/skia/experimental/canvaskit/skottie_bindings.cpp +FILE: ../../../third_party/skia/modules/particles/include/SkCurve.h +FILE: ../../../third_party/skia/modules/particles/include/SkParticleAffector.h +FILE: ../../../third_party/skia/modules/particles/include/SkParticleData.h +FILE: ../../../third_party/skia/modules/particles/include/SkParticleEffect.h +FILE: ../../../third_party/skia/modules/particles/include/SkParticleEmitter.h +FILE: ../../../third_party/skia/modules/particles/include/SkParticleSerialization.h +FILE: ../../../third_party/skia/modules/particles/include/SkReflected.h +FILE: ../../../third_party/skia/modules/particles/src/SkCurve.cpp +FILE: ../../../third_party/skia/modules/particles/src/SkParticleAffector.cpp +FILE: ../../../third_party/skia/modules/particles/src/SkParticleEffect.cpp +FILE: ../../../third_party/skia/modules/particles/src/SkParticleEmitter.cpp +FILE: ../../../third_party/skia/modules/particles/src/SkReflected.cpp ---------------------------------------------------------------------------------------------------- Copyright 2019 Google LLC @@ -4925,6 +4937,7 @@ FILE: ../../../third_party/skia/include/private/SkVx.h FILE: ../../../third_party/skia/modules/sksg/include/SkSGRenderEffect.h FILE: ../../../third_party/skia/modules/sksg/src/SkSGRenderEffect.cpp FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h +FILE: ../../../third_party/skia/samplecode/SampleSG.cpp FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.cpp From 309b90ca582bbfe6855b710e12e1541f53693f1f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 12 Feb 2019 20:07:43 -0500 Subject: [PATCH 0150/1117] Roll src/third_party/skia 14d64dd4c47c..66f09a72995a (8 commits) (#7805) https://skia.googlesource.com/skia.git/%2Blog/14d64dd4c47c..66f09a72995a git log 14d64dd4c47c2ecf45e8b9e02b264fcd5eea7b09..66f09a72995a761bb9bde11b0e378ce84b84bae9 --date=short --no-merges --format=%ad %ae %s 2019-02-12 mtklein@google.com replace gamma_correct with gamut/transfer_fn in DM 2019-02-12 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-12 herb@google.com Inline allocateNewGlyph 2019-02-12 bungeman@google.com Font fallback to handle no font with character. 2019-02-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 c66fb571be1a..d3fac74a236e (8 commits) 2019-02-12 fmalita@chromium.org [sksg] Fix group hit-testing order 2019-02-12 reed@google.com update sample-sg with hittesting 2019-02-12 bungeman@google.com Check both thickness and position in gm. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 64a4e2b085143..96aa6d6c1995a 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': '14d64dd4c47c2ecf45e8b9e02b264fcd5eea7b09', + 'skia_revision': '66f09a72995a761bb9bde11b0e378ce84b84bae9', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 8c4f9969e7457..d5eee61f608c1 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 61a114339340fd33e37605281ad212bc +Signature: 54989979d3d71e0d46e6a656082f4108 UNUSED LICENSES: From 347d690b29e2177e504252482fa59271ac53da5d Mon Sep 17 00:00:00 2001 From: Josh Gargus Date: Tue, 12 Feb 2019 18:33:14 -0800 Subject: [PATCH 0151/1117] Add support for new Scenic clip planes. (#7804) Uses SetClipPlanesCmd in addition to the old clipping approach. Flutter will use both clipping methods during a transition period (Scenic will select internally which one to use). --- flow/layers/clip_rrect_layer.cc | 2 +- flow/scene_update_context.cc | 45 +++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/flow/layers/clip_rrect_layer.cc b/flow/layers/clip_rrect_layer.cc index b4b968bb3960f..72092110cf789 100644 --- a/flow/layers/clip_rrect_layer.cc +++ b/flow/layers/clip_rrect_layer.cc @@ -32,7 +32,7 @@ void ClipRRectLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { void ClipRRectLayer::UpdateScene(SceneUpdateContext& context) { FML_DCHECK(needs_system_composite()); - // TODO(MZ-137): Need to be able to express the radii as vectors. + // TODO(SCN-137): Need to be able to express the radii as vectors. scenic::RoundedRectangle shape( context.session(), // session clip_rrect_.width(), // width diff --git a/flow/scene_update_context.cc b/flow/scene_update_context.cc index bebe2ef67fb9e..c02332d83fb19 100644 --- a/flow/scene_update_context.cc +++ b/flow/scene_update_context.cc @@ -40,6 +40,45 @@ void SceneUpdateContext::RemoveExportNode(ExportNode* export_node) { export_nodes_.erase(export_node); } +// Helper function to generate clip planes for a scenic::EntityNode. +static void SetEntityNodeClipPlanes(scenic::EntityNode* entity_node, + const SkRect& bounds) { + const float top = bounds.top(); + const float bottom = bounds.bottom(); + const float left = bounds.left(); + const float right = bounds.right(); + + // We will generate 4 oriented planes, one for each edge of the bounding rect. + std::vector clip_planes; + clip_planes.resize(4); + + // Top plane. + clip_planes[0].dist = top; + clip_planes[0].dir.x = 0.f; + clip_planes[0].dir.y = 1.f; + clip_planes[0].dir.z = 0.f; + + // Bottom plane. + clip_planes[1].dist = -bottom; + clip_planes[1].dir.x = 0.f; + clip_planes[1].dir.y = -1.f; + clip_planes[1].dir.z = 0.f; + + // Left plane. + clip_planes[2].dist = left; + clip_planes[2].dir.x = 1.f; + clip_planes[2].dir.y = 0.f; + clip_planes[2].dir.z = 0.f; + + // Right plane. + clip_planes[3].dist = -right; + clip_planes[3].dir.x = -1.f; + clip_planes[3].dir.y = 0.f; + clip_planes[3].dir.z = 0.f; + + entity_node->SetClipPlanes(std::move(clip_planes)); +} + void SceneUpdateContext::CreateFrame( std::unique_ptr entity_node, const SkRRect& rrect, @@ -48,6 +87,8 @@ void SceneUpdateContext::CreateFrame( std::vector paint_layers, Layer* layer) { // Frames always clip their children. + SetEntityNodeClipPlanes(entity_node.get(), rrect.getBounds()); + // TODO(SCN-1274): AddPart() and SetClip() will be deleted. entity_node->SetClip(0u, true /* clip to self */); // We don't need a shape if the frame is zero size. @@ -72,6 +113,7 @@ void SceneUpdateContext::CreateFrame( shape_node.SetTranslation(shape_bounds.width() * 0.5f + shape_bounds.left(), shape_bounds.height() * 0.5f + shape_bounds.top(), 0.f); + // TODO(SCN-1274): AddPart() and SetClip() will be deleted. entity_node->AddPart(shape_node); // Check whether the painted layers will be visible. @@ -244,8 +286,11 @@ SceneUpdateContext::Clip::Clip(SceneUpdateContext& context, shape_bounds.height() * 0.5f + shape_bounds.top(), 0.f); + // TODO(SCN-1274): AddPart() and SetClip() will be deleted. entity_node().AddPart(shape_node); entity_node().SetClip(0u, true /* clip to self */); + + SetEntityNodeClipPlanes(&entity_node(), shape_bounds); } SceneUpdateContext::Clip::~Clip() = default; From 04fbc25450089486cc2c80090d34e98d42818713 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 13 Feb 2019 08:19:35 -0500 Subject: [PATCH 0152/1117] Roll src/third_party/skia 66f09a72995a..94a5328e0e4b (1 commits) (#7810) https://skia.googlesource.com/skia.git/%2Blog/66f09a72995a..94a5328e0e4b git log 66f09a72995a761bb9bde11b0e378ce84b84bae9..94a5328e0e4b59286ec0e04e0fabe6a447451f30 --date=short --no-merges --format=%ad %ae %s 2019-02-12 benjaminwagner@google.com Add Ubuntu18 Calmbench and Valgrind jobs The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 96aa6d6c1995a..c6d7fb11093bb 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': '66f09a72995a761bb9bde11b0e378ce84b84bae9', + 'skia_revision': '94a5328e0e4b59286ec0e04e0fabe6a447451f30', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index d5eee61f608c1..294dad70af9b6 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 54989979d3d71e0d46e6a656082f4108 +Signature: fad81f79fc8c934ae311f91b879aa530 UNUSED LICENSES: From da56ff9c666c056f383e83cf5937e6160714b886 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 13 Feb 2019 12:21:02 -0500 Subject: [PATCH 0153/1117] Roll src/third_party/skia 94a5328e0e4b..b6f53783337e (8 commits) (#7812) https://skia.googlesource.com/skia.git/%2Blog/94a5328e0e4b..b6f53783337e git log 94a5328e0e4b59286ec0e04e0fabe6a447451f30..b6f53783337e096d6803ba3907044b79b4ac9f6c --date=short --no-merges --format=%ad %ae %s 2019-02-13 halcanary@google.com SkShaper: enable for unit and render tests 2019-02-13 reed@google.com fix rawiter::peek 2019-02-12 robertphillips@google.com Switch Ops over to using GrRecordingContext 2019-02-13 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 77b5d9247fd7..1f0e830f475f (486 commits) 2019-02-12 scroggo@google.com Blacklist Codec tests on Wuffs bot 2019-02-13 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 73c3124cc249..de16f327d051 (1 commits) 2019-02-12 ethannicholas@google.com added constant 0 and 1 swizzle components to SkSL 2019-02-13 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c6d7fb11093bb..5409e0e3d61d2 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': '94a5328e0e4b59286ec0e04e0fabe6a447451f30', + 'skia_revision': 'b6f53783337e096d6803ba3907044b79b4ac9f6c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 294dad70af9b6..3806e2d324507 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: fad81f79fc8c934ae311f91b879aa530 +Signature: 16ee44df42aee8e098d6bf1d138049e1 UNUSED LICENSES: @@ -2359,6 +2359,7 @@ FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Debian9-Cl FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-BonusConfigs.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json +FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-Wuffs.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-shard_00_10-Coverage.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-Lottie.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-SK_FORCE_RASTER_PIPELINE_BLITTER.json From 816921b9e4433eef908489a8e2f282b801828d0f Mon Sep 17 00:00:00 2001 From: Dan Field Date: Wed, 13 Feb 2019 11:15:19 -0800 Subject: [PATCH 0154/1117] Use newer Skia API for PathMeasure (#7809) --- lib/ui/painting.dart | 72 ++++++++++++++++----------------- lib/ui/painting/path_measure.cc | 55 +++++++++++++++++-------- lib/ui/painting/path_measure.h | 18 +++++---- testing/dart/path_test.dart | 6 ++- 4 files changed, 88 insertions(+), 63 deletions(-) diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index 478b85263a5a7..ebed3d8a66c32 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -2234,13 +2234,6 @@ class PathMetricIterator implements Iterator { @override bool moveNext() { - // PathMetric isn't a normal iterable - it's already initialized to its - // first Path. Should only call _moveNext when done with the first one. - if (_pathMeasure.currentContourIndex == -1) { - _pathMeasure.currentContourIndex++; - _pathMetric = PathMetric._(_pathMeasure); - return true; - } if (_pathMeasure._nextContour()) { _pathMetric = PathMetric._(_pathMeasure); return true; @@ -2256,16 +2249,15 @@ class PathMetricIterator implements Iterator { /// [PathMetric] objects. /// /// Once created, the methods on this class will only be valid while the -/// iterator is at the contour for which they were created. When the next -/// contour's [PathMetric] is obtained, the [length] and [isClosed] properties -/// remain valid, but the [getTangentForOffset] and [extractPath] will throw a -/// [StateError]. -// TODO(dnfield): Fix this if/when https://bugs.chromium.org/p/skia/issues/detail?id=8721 lands. +/// iterator is at the contour for which they were created. It will also only be +/// valid for the path as it was specifed when [Path.computeMetrics] was called. +/// If additional contours are added or any contours are updated, the metrics +/// need to be recomputed. class PathMetric { PathMetric._(this._measure) : assert(_measure != null), - length = _measure.length, - isClosed = _measure.isClosed, + length = _measure.length(_measure.currentContourIndex), + isClosed = _measure.isClosed(_measure.currentContourIndex), contourIndex = _measure.currentContourIndex; /// Return the total length of the current contour. @@ -2287,10 +2279,10 @@ class PathMetric { /// although it may not if optimizations are applied that determine the move /// command did not actually result in moving the pen. /// - /// This property is only valid with reference to its original iterator. If - /// [getTangetForOffset] or [extractPath] are called when this property does - /// not match the actual count of the iterator, those methods will throw a - /// [StateError]. + /// This property is only valid with reference to its original iterator and + /// the contours of the path at the time the path's metrics were computed. If + /// additional contours were added or existing contours updated, this metric + /// will be invalid for the current state of the path. final int contourIndex; final _PathMeasure _measure; @@ -2307,10 +2299,7 @@ class PathMetric { /// /// The distance is clamped to the [length] of the current contour. Tangent getTangentForOffset(double distance) { - if (contourIndex != _measure.currentContourIndex) { - throw StateError('This method cannot be invoked once the underlying iterator has advanced.'); - } - return _measure.getTangentForOffset(distance); + return _measure.getTangentForOffset(contourIndex, distance); } /// Given a start and stop distance, return the intervening segment(s). @@ -2319,10 +2308,7 @@ class PathMetric { /// Returns null if the segment is 0 length or `start` > `stop`. /// Begin the segment with a moveTo if `startWithMoveTo` is true. Path extractPath(double start, double end, {bool startWithMoveTo: true}) { - if (contourIndex != _measure.currentContourIndex) { - throw StateError('This method cannot be invoked once the underlying iterator has advanced.'); - } - return _measure.extractPath(start, end, startWithMoveTo: startWithMoveTo); + return _measure.extractPath(contourIndex, start, end, startWithMoveTo: startWithMoveTo); } @override @@ -2331,15 +2317,20 @@ class PathMetric { class _PathMeasure extends NativeFieldWrapperClass2 { _PathMeasure(Path path, bool forceClosed) { - currentContourIndex = -1; // PathMetricIterator will increment this the first time. + currentContourIndex = -1; // nextContour will incremenet this to the zero based index. _constructor(path, forceClosed); } void _constructor(Path path, bool forceClosed) native 'PathMeasure_constructor'; - double get length native 'PathMeasure_getLength'; + double length(int contourIndex) { + assert(contourIndex <= currentContourIndex, 'Iterator must be advanced before index $contourIndex can be used.'); + return _length(contourIndex); + } + double _length(int contourIndex) native 'PathMeasure_getLength'; - Tangent getTangentForOffset(double distance) { - final Float32List posTan = _getPosTan(distance); + Tangent getTangentForOffset(int contourIndex, double distance) { + assert(contourIndex <= currentContourIndex, 'Iterator must be advanced before index $contourIndex can be used.'); + final Float32List posTan = _getPosTan(contourIndex, distance); // first entry == 0 indicates that Skia returned false if (posTan[0] == 0.0) { return null; @@ -2350,22 +2341,27 @@ class _PathMeasure extends NativeFieldWrapperClass2 { ); } } - Float32List _getPosTan(double distance) native 'PathMeasure_getPosTan'; + Float32List _getPosTan(int contourIndex, double distance) native 'PathMeasure_getPosTan'; - Path extractPath(double start, double end, {bool startWithMoveTo: true}) native 'PathMeasure_getSegment'; + Path extractPath(int contourIndex, double start, double end, {bool startWithMoveTo: true}) { + assert(contourIndex <= currentContourIndex, 'Iterator must be advanced before index $contourIndex can be used.'); + return _extractPath(contourIndex, start, end, startWithMoveTo: startWithMoveTo); + } + Path _extractPath(int contourIndex, double start, double end, {bool startWithMoveTo: true}) native 'PathMeasure_getSegment'; - bool get isClosed native 'PathMeasure_isClosed'; + bool isClosed(int contourIndex) { + assert(contourIndex <= currentContourIndex, 'Iterator must be advanced before index $contourIndex can be used.'); + return _isClosed(contourIndex); + } + bool _isClosed(int contourIndex) native 'PathMeasure_isClosed'; // Move to the next contour in the path. // // A path can have a next contour if [Path.moveTo] was called after drawing began. // Return true if one exists, or false. // - // This is not exactly congruent with a regular [Iterator.moveNext]. - // Typically, [Iterator.moveNext] should be called before accessing the - // [Iterator.current]. In this case, the [PathMetric] is valid before - // calling `_moveNext` - `_moveNext` should be called after the first - // iteration is done instead of before. + // Before Skia introduced an SkPathContourMeasureIter, this didn't work like + // a normal iterator. Now it does. bool _nextContour() { final bool next = _nativeNextContour(); if (next) { diff --git a/lib/ui/painting/path_measure.cc b/lib/ui/painting/path_measure.cc index d22340381a57e..6eff5c310cf91 100644 --- a/lib/ui/painting/path_measure.cc +++ b/lib/ui/painting/path_measure.cc @@ -49,9 +49,9 @@ fml::RefPtr CanvasPathMeasure::Create(const CanvasPath* path, const SkPath skPath = path->path(); SkScalar resScale = 1; pathMeasure->path_measure_ = - std::make_unique(skPath, forceClosed, resScale); + std::make_unique(skPath, forceClosed, resScale); } else { - pathMeasure->path_measure_ = std::make_unique(); + pathMeasure->path_measure_ = std::make_unique(); } return pathMeasure; } @@ -61,39 +61,53 @@ CanvasPathMeasure::CanvasPathMeasure() {} CanvasPathMeasure::~CanvasPathMeasure() {} void CanvasPathMeasure::setPath(const CanvasPath* path, bool isClosed) { - const SkPath* skPath = &(path->path()); - path_measure_->setPath(skPath, isClosed); + const SkPath& skPath = path->path(); + path_measure_->reset(skPath, isClosed); } -float CanvasPathMeasure::getLength() { - return path_measure_->getLength(); +float CanvasPathMeasure::getLength(int contourIndex) { + if (static_cast>::size_type>( + contourIndex) < measures_.size()) { + return measures_[contourIndex]->length(); + } + return -1; } -tonic::Float32List CanvasPathMeasure::getPosTan(float distance) { +tonic::Float32List CanvasPathMeasure::getPosTan(int contourIndex, + float distance) { + tonic::Float32List posTan(Dart_NewTypedData(Dart_TypedData_kFloat32, 5)); + posTan[0] = 0; // dart code will check for this for failure + if (static_cast>::size_type>( + contourIndex) >= measures_.size()) { + return posTan; + } + SkPoint pos; SkVector tan; - bool success = path_measure_->getPosTan(distance, &pos, &tan); + bool success = measures_[contourIndex]->getPosTan(distance, &pos, &tan); - tonic::Float32List posTan(Dart_NewTypedData(Dart_TypedData_kFloat32, 5)); if (success) { posTan[0] = 1; // dart code will check for this for success posTan[1] = pos.x(); posTan[2] = pos.y(); posTan[3] = tan.x(); posTan[4] = tan.y(); - } else { - posTan[0] = 0; // dart code will check for this for failure } return posTan; } -fml::RefPtr CanvasPathMeasure::getSegment(float startD, +fml::RefPtr CanvasPathMeasure::getSegment(int contourIndex, + float startD, float stopD, bool startWithMoveTo) { + if (static_cast>::size_type>( + contourIndex) >= measures_.size()) { + return CanvasPath::Create(); + } SkPath dst; bool success = - path_measure_->getSegment(startD, stopD, &dst, startWithMoveTo); + measures_[contourIndex]->getSegment(startD, stopD, &dst, startWithMoveTo); if (!success) { return CanvasPath::Create(); } else { @@ -101,12 +115,21 @@ fml::RefPtr CanvasPathMeasure::getSegment(float startD, } } -bool CanvasPathMeasure::isClosed() { - return path_measure_->isClosed(); +bool CanvasPathMeasure::isClosed(int contourIndex) { + if (static_cast>::size_type>( + contourIndex) < measures_.size()) { + return measures_[contourIndex]->isClosed(); + } + return false; } bool CanvasPathMeasure::nextContour() { - return path_measure_->nextContour(); + auto measure = path_measure_->next(); + if (measure) { + measures_.push_back(std::move(measure)); + return true; + } + return false; } } // namespace blink diff --git a/lib/ui/painting/path_measure.h b/lib/ui/painting/path_measure.h index 5869e5a777ba6..c19bc29e614de 100644 --- a/lib/ui/painting/path_measure.h +++ b/lib/ui/painting/path_measure.h @@ -5,10 +5,12 @@ #ifndef FLUTTER_LIB_UI_PAINTING_PATH_MEASURE_H_ #define FLUTTER_LIB_UI_PAINTING_PATH_MEASURE_H_ +#include + #include "flutter/lib/ui/dart_wrapper.h" #include "flutter/lib/ui/painting/path.h" +#include "third_party/skia/include/core/SkContourMeasure.h" #include "third_party/skia/include/core/SkPath.h" -#include "third_party/skia/include/core/SkPathMeasure.h" #include "third_party/tonic/typed_data/float64_list.h" namespace tonic { @@ -30,22 +32,24 @@ class CanvasPathMeasure : public RefCountedDartWrappable { bool forceClosed); void setPath(const CanvasPath* path, bool isClosed); - float getLength(); - tonic::Float32List getPosTan(float distance); - fml::RefPtr getSegment(float startD, + float getLength(int contourIndex); + tonic::Float32List getPosTan(int contourIndex, float distance); + fml::RefPtr getSegment(int contourIndex, + float startD, float stopD, bool startWithMoveTo); - bool isClosed(); + bool isClosed(int contourIndex); bool nextContour(); static void RegisterNatives(tonic::DartLibraryNatives* natives); - const SkPathMeasure& pathMeasure() const { return *path_measure_; } + const SkContourMeasureIter& pathMeasure() const { return *path_measure_; } private: CanvasPathMeasure(); - std::unique_ptr path_measure_; + std::unique_ptr path_measure_; + std::vector> measures_; }; } // namespace blink diff --git a/testing/dart/path_test.dart b/testing/dart/path_test.dart index d4e75078e88dc..6a0c99f1aefad 100644 --- a/testing/dart/path_test.dart +++ b/testing/dart/path_test.dart @@ -210,9 +210,11 @@ void main() { print(metrics); expect(metrics[0].length, 20); expect(metrics[0].isClosed, true); - expect(() => metrics[0].getTangentForOffset(4.0), throwsStateError); - expect(() => metrics[0].getTangentForOffset(4.0), throwsStateError); + expect(() => metrics[0].getTangentForOffset(4.0), isNotNull); + expect(() => metrics[0].extractPath(4.0, 10.0), isNotNull); expect(metrics[1].length, 10); expect(metrics[1].isClosed, false); + expect(() => metrics[1].getTangentForOffset(4.0), isNotNull); + expect(() => metrics[1].extractPath(4.0, 10.0), isNotNull); }); } From f5259b8e2d73fb125063ef8fd0a2f370800f3ee3 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 13 Feb 2019 16:21:38 -0500 Subject: [PATCH 0155/1117] Roll src/third_party/skia b6f53783337e..186669c4128b (8 commits) (#7816) https://skia.googlesource.com/skia.git/%2Blog/b6f53783337e..186669c4128b git log b6f53783337e096d6803ba3907044b79b4ac9f6c..186669c4128bf9de63453e238d7c2e6ffbf34bca --date=short --no-merges --format=%ad %ae %s 2019-02-13 reed@google.com work to fix bookmaker 2019-02-13 jvanverth@google.com Fix drag events in Mac viewer. 2019-02-13 herb@google.com Use SkStrikeSpec to consolidate SkDescriptor, Effects and Typeface. 2019-02-13 mtklein@google.com rewrite SkMasks::CreateMasks to work in bytesPerPixel 2019-02-13 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 d3fac74a236e..6fc22a13d45d (7 commits) 2019-02-13 mtklein@google.com add Windows -Wuffs builders 2019-02-13 reed@google.com fix contour-measure for move-line-move 2019-02-13 robertphillips@google.com Switch path renderers over to using GrRecordingContext The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 5409e0e3d61d2..6c2c317bcb677 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': 'b6f53783337e096d6803ba3907044b79b4ac9f6c', + 'skia_revision': '186669c4128bf9de63453e238d7c2e6ffbf34bca', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3806e2d324507..4779e7753c66c 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 16ee44df42aee8e098d6bf1d138049e1 +Signature: 50103e41a09677a1a5eba1e1e6e3b3f8 UNUSED LICENSES: From 61d3080d5d9b72191443900ee288340eecd0d803 Mon Sep 17 00:00:00 2001 From: sjindel-google Date: Wed, 13 Feb 2019 22:28:07 +0100 Subject: [PATCH 0156/1117] Add FFI to libraries.yaml. (#7811) --- lib/snapshot/libraries.json | 8 ++++++++ lib/snapshot/libraries.yaml | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/lib/snapshot/libraries.json b/lib/snapshot/libraries.json index a59ae6c6624f6..99ef4cd778f8c 100644 --- a/lib/snapshot/libraries.json +++ b/lib/snapshot/libraries.json @@ -57,6 +57,14 @@ ], "uri": "../../../third_party/dart/sdk/lib/collection/collection.dart" }, + "ffi": { + "patches": [ + "../../../third_party/dart/runtime/lib/ffi_dynamic_library_patch.dart", + "../../../third_party/dart/runtime/lib/ffi_native_type_patch.dart", + "../../../third_party/dart/runtime/lib/ffi_patch.dart" + ], + "uri": "../../../third_party/dart/sdk/lib/ffi/ffi.dart" + }, "typed_data": { "patches": "../../../third_party/dart/runtime/lib/typed_data_patch.dart", "uri": "../../../third_party/dart/sdk/lib/typed_data/typed_data.dart" diff --git a/lib/snapshot/libraries.yaml b/lib/snapshot/libraries.yaml index 26c3277054c7d..c4244eaff8719 100644 --- a/lib/snapshot/libraries.yaml +++ b/lib/snapshot/libraries.yaml @@ -84,6 +84,13 @@ flutter: - "../../../third_party/dart/runtime/lib/profiler.dart" - "../../../third_party/dart/runtime/lib/timeline.dart" + ffi: + uri: "../../../third_party/dart/sdk/lib/ffi/ffi.dart" + patches: + - "../../../third_party/dart/runtime/lib/ffi_dynamic_library_patch.dart" + - "../../../third_party/dart/runtime/lib/ffi_native_type_patch.dart" + - "../../../third_party/dart/runtime/lib/ffi_patch.dart" + _http: uri: "../../../third_party/dart/sdk/lib/_http/http.dart" From 3757390fa4b00d2d261bfdf5182d2e87c9113ff9 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 13 Feb 2019 13:45:39 -0800 Subject: [PATCH 0157/1117] Roll src/third_party/dart ecd7a88606..0a7dcf17eb (4 commits) 0a7dcf17eb Attempt tracing to /sys/kernel/tracing/trace_marker on Linux. 02b65ee478 Include 'includedSuggestionRelevanceTags' into completion response. 71e8588399 Include enum constants into available declarations. 30f9143831 Revert "[vm] Decouple stub code from runtime." and "[VM/Decoupling] Follow-up change to decoupling of stub_code: Fix missing "!"" --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/DEPS b/DEPS index 6c2c317bcb677..c9cdcfbfccfff 100644 --- a/DEPS +++ b/DEPS @@ -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': 'ecd7a88606a4bf896316f56f1b0db6f5469c2623', + 'dart_revision': '0a7dcf17eb5f2450480527d6ad1e201fb47f1e36', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 0bb6b2c9d119f..26dd013bb3bc0 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: b96e952dc699011e4e876641cc051a12 +Signature: 8a314b3884017fae7b125cb423fa8d3f UNUSED LICENSES: @@ -5653,6 +5653,7 @@ FILE: ../../../third_party/dart/runtime/vm/signal_handler_fuchsia.cc FILE: ../../../third_party/dart/runtime/vm/simulator_dbc.cc FILE: ../../../third_party/dart/runtime/vm/simulator_dbc.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_dbc.h +FILE: ../../../third_party/dart/runtime/vm/stub_code_dbc.cc FILE: ../../../third_party/dart/runtime/vm/thread_interrupter_fuchsia.cc FILE: ../../../third_party/dart/runtime/vm/token_position.cc FILE: ../../../third_party/dart/runtime/vm/token_position.h @@ -5708,26 +5709,15 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/backend/slot_test.cc FILE: ../../../third_party/dart/runtime/vm/compiler/relocation.cc FILE: ../../../third_party/dart/runtime/vm/compiler/runtime_api.cc FILE: ../../../third_party/dart/runtime/vm/compiler/runtime_api.h -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler.h -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm64.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_dbc.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_ia32.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_x64.cc FILE: ../../../third_party/dart/runtime/vm/frame_layout.h FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist.h FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist_test.cc FILE: ../../../third_party/dart/runtime/vm/longjump.h FILE: ../../../third_party/dart/runtime/vm/pointer_tagging.h -FILE: ../../../third_party/dart/runtime/vm/static_type_exactness_state.h -FILE: ../../../third_party/dart/runtime/vm/stub_code_list.h FILE: ../../../third_party/dart/runtime/vm/thread_stack_resource.cc FILE: ../../../third_party/dart/runtime/vm/thread_stack_resource.h FILE: ../../../third_party/dart/runtime/vm/thread_state.cc FILE: ../../../third_party/dart/runtime/vm/thread_state.h -FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm.cc -FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm64.cc -FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_x64.cc ---------------------------------------------------------------------------------------------------- Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file for details. All rights reserved. @@ -6211,7 +6201,10 @@ FILE: ../../../third_party/dart/runtime/vm/simulator_arm.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_arm.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_ia32.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_x64.h +FILE: ../../../third_party/dart/runtime/vm/stub_code_arm.cc FILE: ../../../third_party/dart/runtime/vm/stub_code_arm_test.cc +FILE: ../../../third_party/dart/runtime/vm/stub_code_ia32.cc +FILE: ../../../third_party/dart/runtime/vm/stub_code_x64.cc FILE: ../../../third_party/dart/runtime/vm/tags.h FILE: ../../../third_party/dart/runtime/vm/thread_interrupter.cc FILE: ../../../third_party/dart/runtime/vm/thread_interrupter.h @@ -6473,6 +6466,7 @@ FILE: ../../../third_party/dart/runtime/vm/runtime_entry_arm64.cc FILE: ../../../third_party/dart/runtime/vm/simulator_arm64.cc FILE: ../../../third_party/dart/runtime/vm/simulator_arm64.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_arm64.h +FILE: ../../../third_party/dart/runtime/vm/stub_code_arm64.cc FILE: ../../../third_party/dart/runtime/vm/stub_code_arm64_test.cc FILE: ../../../third_party/dart/runtime/vm/tags.cc FILE: ../../../third_party/dart/runtime/vm/unibrow-inl.h From f519aedb9531d1d0278bcbba85af7c56b02f5de6 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Wed, 13 Feb 2019 15:14:10 -0800 Subject: [PATCH 0158/1117] Fix typo in painting.dart (#7814) --- lib/ui/painting.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index ebed3d8a66c32..53fb922288a86 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -2317,7 +2317,7 @@ class PathMetric { class _PathMeasure extends NativeFieldWrapperClass2 { _PathMeasure(Path path, bool forceClosed) { - currentContourIndex = -1; // nextContour will incremenet this to the zero based index. + currentContourIndex = -1; // nextContour will increment this to the zero based index. _constructor(path, forceClosed); } void _constructor(Path path, bool forceClosed) native 'PathMeasure_constructor'; From adf02abcd16c06e2782f20a313dffe58030a273b Mon Sep 17 00:00:00 2001 From: Dan Field Date: Wed, 13 Feb 2019 15:16:49 -0800 Subject: [PATCH 0159/1117] Allow specifying the buildtools path (#7815) --- testing/symbols/verify_exported.dart | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/testing/symbols/verify_exported.dart b/testing/symbols/verify_exported.dart index 95a9982b0f3e6..df9770988fd54 100644 --- a/testing/symbols/verify_exported.dart +++ b/testing/symbols/verify_exported.dart @@ -14,10 +14,18 @@ import 'package:collection/collection.dart' show MapEquality; // Symbols from the Flutter namespace. These are either of type // "(__DATA,__common)" or "(__DATA,__objc_data)". -/// Takes the path to the out directory as argument. +/// Takes the path to the out directory as the first argument, and the path to +/// the buildtools directory as the second argument. +/// +/// If the second argument is not specified, it is assumed that it is the parent +/// of the out directory (for backwards compatibility). void main(List arguments) { - assert(arguments.length == 1); + assert(arguments.length == 2 || arguments.length == 1); final String outPath = arguments.first; + final String buildToolsPath = arguments.length == 1 + ? p.join(p.dirname(outPath), 'buildtools') + : arguments[1]; + String platform; if (Platform.isLinux) { platform = 'linux-x64'; @@ -26,7 +34,7 @@ void main(List arguments) { } else { throw new UnimplementedError('Script only support running on Linux or MacOS.'); } - final String nmPath = p.join(p.dirname(outPath), 'buildtools', platform, 'clang', 'bin', 'llvm-nm'); + final String nmPath = p.join(buildToolsPath, platform, 'clang', 'bin', 'llvm-nm'); assert(new Directory(outPath).existsSync()); final Iterable releaseBuilds = new Directory(outPath).listSync() From 033f2072c315d48b4d7680d4cbbe856012b1259b Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Wed, 13 Feb 2019 15:19:53 -0800 Subject: [PATCH 0160/1117] Add space metrics tracking for trailing whitespace "ghost" runs. (#7791) * Begin space tracking metrics in LibTxt. * Add tracking for trailing whitespace. * Store is_ghost in BidiRun * Add comments --- third_party/txt/src/txt/paint_record.cc | 15 ++-- third_party/txt/src/txt/paint_record.h | 11 ++- third_party/txt/src/txt/paragraph.cc | 45 ++++++----- third_party/txt/src/txt/paragraph.h | 14 +++- third_party/txt/tests/paragraph_unittests.cc | 78 ++++++++++---------- 5 files changed, 98 insertions(+), 65 deletions(-) diff --git a/third_party/txt/src/txt/paint_record.cc b/third_party/txt/src/txt/paint_record.cc index 200c48665aa81..0ee43f847808f 100644 --- a/third_party/txt/src/txt/paint_record.cc +++ b/third_party/txt/src/txt/paint_record.cc @@ -26,24 +26,28 @@ PaintRecord::PaintRecord(TextStyle style, sk_sp text, SkFontMetrics metrics, size_t line, - double run_width) + double run_width, + bool is_ghost) : style_(style), offset_(offset), text_(std::move(text)), metrics_(metrics), line_(line), - run_width_(run_width) {} + run_width_(run_width), + is_ghost_(is_ghost) {} PaintRecord::PaintRecord(TextStyle style, sk_sp text, SkFontMetrics metrics, size_t line, - double run_width) + double run_width, + bool is_ghost) : style_(style), text_(std::move(text)), metrics_(metrics), line_(line), - run_width_(run_width) {} + run_width_(run_width), + is_ghost_(is_ghost) {} PaintRecord::PaintRecord(PaintRecord&& other) { style_ = other.style_; @@ -51,7 +55,7 @@ PaintRecord::PaintRecord(PaintRecord&& other) { text_ = std::move(other.text_); metrics_ = other.metrics_; line_ = other.line_; - run_width_ = other.run_width_; + run_width_ = other.run_width_, is_ghost_ = other.is_ghost_; } PaintRecord& PaintRecord::operator=(PaintRecord&& other) { @@ -61,6 +65,7 @@ PaintRecord& PaintRecord::operator=(PaintRecord&& other) { metrics_ = other.metrics_; line_ = other.line_; run_width_ = other.run_width_; + is_ghost_ = other.is_ghost_; return *this; } diff --git a/third_party/txt/src/txt/paint_record.h b/third_party/txt/src/txt/paint_record.h index 13f2b2311d4dd..c07ab6827c350 100644 --- a/third_party/txt/src/txt/paint_record.h +++ b/third_party/txt/src/txt/paint_record.h @@ -39,13 +39,15 @@ class PaintRecord { sk_sp text, SkFontMetrics metrics, size_t line, - double run_width); + double run_width, + bool is_ghost); PaintRecord(TextStyle style, sk_sp text, SkFontMetrics metrics, size_t line, - double run_width); + double run_width, + bool is_ghost); PaintRecord(PaintRecord&& other); @@ -65,6 +67,8 @@ class PaintRecord { double GetRunWidth() const { return run_width_; } + bool isGhost() const { return is_ghost_; } + private: TextStyle style_; // offset_ is the overall offset of the origin of the SkTextBlob. @@ -75,6 +79,9 @@ class PaintRecord { SkFontMetrics metrics_; size_t line_; double run_width_ = 0.0f; + // 'Ghost' runs represent trailing whitespace. 'Ghost' runs should not have + // decorations painted on them and do not impact layout of visible glyphs. + bool is_ghost_ = false; FML_DISALLOW_COPY_AND_ASSIGN(PaintRecord); }; diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index 65efccc8a1f1b..df40bd1cc2041 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -552,6 +552,22 @@ void Paragraph::Layout(double width, bool force) { std::min(bidi_run.end(), line_end_index), bidi_run.direction(), bidi_run.style()); } + // A "ghost" run is a run that does not impact the layout, breaking, + // alignment, width, etc but is still "visible" though getRectsForRange. + // For example, trailing whitespace on centered text can be scrolled + // through with the caret but will not wrap the line. + // + // Here, we add an additional run for the whitespace, but dont + // let it impact metrics. After layout of the whitespace run, we do not + // add its width into the x-offset adjustment, effectively nullifying its + // impact on the layout. + if (line_range.end_excluding_whitespace < line_range.end && + bidi_run.start() <= line_range.end && + bidi_run.end() > line_end_index) { + line_runs.emplace_back(std::max(bidi_run.start(), line_end_index), + std::min(bidi_run.end(), line_range.end), + bidi_run.direction(), bidi_run.style(), true); + } } bool line_runs_all_rtl = line_runs.size() && @@ -766,7 +782,7 @@ void Paragraph::Layout(double width, bool force) { font.getMetrics(&metrics); paint_records.emplace_back(run.style(), SkPoint::Make(run_x_offset, 0), builder.make(), metrics, line_number, - layout.getAdvance()); + layout.getAdvance(), run.is_ghost()); line_glyph_positions.insert(line_glyph_positions.end(), glyph_positions.begin(), @@ -789,7 +805,12 @@ void Paragraph::Layout(double width, bool force) { max_right_ = std::max(max_right_, glyph_positions.back().x_pos.end); } // for each in glyph_blobs - run_x_offset += layout.getAdvance(); + // Do not increase x offset for trailing ghost runs as it should not + // impact the layout of visible glyphs. We do keep the record though so + // GetRectsForRange() can find metrics for trailing spaces. + if (!run.is_ghost()) { + run_x_offset += layout.getAdvance(); + } } // for each in line_runs // Adjust the glyph positions based on the alignment of the line. @@ -811,23 +832,6 @@ void Paragraph::Layout(double width, bool force) { code_unit_runs_.insert(code_unit_runs_.end(), line_code_unit_runs.begin(), line_code_unit_runs.end()); - // Add extra empty metrics for skipped whitespace at line end. This allows - // GetRectsForRange to properly draw empty rects at the ends of lines with - // truncated whitespace. - if (line_end_index < line_range.end && !line_code_unit_runs.empty()) { - std::vector empty_glyph_positions; - double end_x = line_code_unit_runs.back().positions.back().x_pos.end; - for (size_t index = line_end_index; index < line_range.end; ++index) { - empty_glyph_positions.emplace_back(end_x, 0, index, 1); - } - code_unit_runs_.emplace_back( - std::move(empty_glyph_positions), - Range(line_end_index, line_range.end), - Range(end_x, end_x), line_code_unit_runs.back().line_number, - line_code_unit_runs.back().font_metrics, - line_code_unit_runs.back().direction); - } - // Calculate the amount to advance in the y direction. This is done by // computing the maximum ascent and descent with respect to the strut. double max_ascent = strut.ascent + strut.half_leading; @@ -1020,6 +1024,9 @@ void Paragraph::PaintDecorations(SkCanvas* canvas, if (record.style().decoration == TextDecoration::kNone) return; + if (record.isGhost()) + return; + const SkFontMetrics& metrics = record.metrics(); SkPaint paint; paint.setStyle(SkPaint::kStroke_Style); diff --git a/third_party/txt/src/txt/paragraph.h b/third_party/txt/src/txt/paragraph.h index 2866eeaf80335..0518bac03326a 100644 --- a/third_party/txt/src/txt/paragraph.h +++ b/third_party/txt/src/txt/paragraph.h @@ -272,19 +272,31 @@ class Paragraph { class BidiRun { public: + // Constructs a BidiRun with is_ghost defaulted to false. BidiRun(size_t s, size_t e, TextDirection d, const TextStyle& st) - : start_(s), end_(e), direction_(d), style_(&st) {} + : start_(s), end_(e), direction_(d), style_(&st), is_ghost_(false) {} + + // Constructs a BidiRun with a custom is_ghost flag. + BidiRun(size_t s, + size_t e, + TextDirection d, + const TextStyle& st, + bool is_ghost) + : start_(s), end_(e), direction_(d), style_(&st), is_ghost_(is_ghost) {} size_t start() const { return start_; } size_t end() const { return end_; } TextDirection direction() const { return direction_; } const TextStyle& style() const { return *style_; } bool is_rtl() const { return direction_ == TextDirection::rtl; } + // Tracks if the run represents trailing whitespace. + bool is_ghost() const { return is_ghost_; } private: size_t start_, end_; TextDirection direction_; const TextStyle* style_; + bool is_ghost_; }; struct GlyphPosition { diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index 5e37ae1d33092..0c2f9df3dd2c4 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -419,7 +419,8 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(RightAlignParagraph)) { 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_.size(), paragraph_style.max_lines); + // Two records for each due to 'ghost' trailing whitespace run. + ASSERT_EQ(paragraph->records_.size(), paragraph_style.max_lines * 2); double expected_y = 24; ASSERT_TRUE(paragraph->records_[0].style().equals(text_style)); @@ -431,39 +432,39 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(RightAlignParagraph)) { paragraph->breaker_.getWidths()[paragraph->records_[0].line()], 2.0); - ASSERT_TRUE(paragraph->records_[1].style().equals(text_style)); - ASSERT_DOUBLE_EQ(paragraph->records_[1].offset().y(), expected_y); + ASSERT_TRUE(paragraph->records_[2].style().equals(text_style)); + ASSERT_DOUBLE_EQ(paragraph->records_[2].offset().y(), expected_y); expected_y += 30; ASSERT_NEAR( - paragraph->records_[1].offset().x(), + paragraph->records_[2].offset().x(), paragraph->width_ - - paragraph->breaker_.getWidths()[paragraph->records_[1].line()], + paragraph->breaker_.getWidths()[paragraph->records_[2].line()], 2.0); - ASSERT_TRUE(paragraph->records_[2].style().equals(text_style)); - ASSERT_DOUBLE_EQ(paragraph->records_[2].offset().y(), expected_y); + ASSERT_TRUE(paragraph->records_[4].style().equals(text_style)); + ASSERT_DOUBLE_EQ(paragraph->records_[4].offset().y(), expected_y); expected_y += 30; ASSERT_NEAR( - paragraph->records_[2].offset().x(), + paragraph->records_[4].offset().x(), paragraph->width_ - - paragraph->breaker_.getWidths()[paragraph->records_[2].line()], + paragraph->breaker_.getWidths()[paragraph->records_[4].line()], 2.0); - ASSERT_TRUE(paragraph->records_[3].style().equals(text_style)); - ASSERT_DOUBLE_EQ(paragraph->records_[3].offset().y(), expected_y); + ASSERT_TRUE(paragraph->records_[6].style().equals(text_style)); + ASSERT_DOUBLE_EQ(paragraph->records_[6].offset().y(), expected_y); expected_y += 30 * 10; ASSERT_NEAR( - paragraph->records_[3].offset().x(), + paragraph->records_[6].offset().x(), paragraph->width_ - - paragraph->breaker_.getWidths()[paragraph->records_[3].line()], + paragraph->breaker_.getWidths()[paragraph->records_[6].line()], 2.0); - ASSERT_TRUE(paragraph->records_[13].style().equals(text_style)); - ASSERT_DOUBLE_EQ(paragraph->records_[13].offset().y(), expected_y); + ASSERT_TRUE(paragraph->records_[26].style().equals(text_style)); + ASSERT_DOUBLE_EQ(paragraph->records_[26].offset().y(), expected_y); ASSERT_NEAR( - paragraph->records_[13].offset().x(), + paragraph->records_[26].offset().x(), paragraph->width_ - - paragraph->breaker_.getWidths()[paragraph->records_[13].line()], + paragraph->breaker_.getWidths()[paragraph->records_[26].line()], 2.0); ASSERT_EQ(paragraph_style.text_align, @@ -528,7 +529,8 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(CenterAlignParagraph)) { 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_.size(), paragraph_style.max_lines); + // Two records for each due to 'ghost' trailing whitespace run. + ASSERT_EQ(paragraph->records_.size(), paragraph_style.max_lines * 2); double expected_y = 24; ASSERT_TRUE(paragraph->records_[0].style().equals(text_style)); @@ -540,39 +542,39 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(CenterAlignParagraph)) { 2, 2.0); - ASSERT_TRUE(paragraph->records_[1].style().equals(text_style)); - ASSERT_DOUBLE_EQ(paragraph->records_[1].offset().y(), expected_y); + ASSERT_TRUE(paragraph->records_[2].style().equals(text_style)); + ASSERT_DOUBLE_EQ(paragraph->records_[2].offset().y(), expected_y); expected_y += 30; - ASSERT_NEAR(paragraph->records_[1].offset().x(), + ASSERT_NEAR(paragraph->records_[2].offset().x(), (paragraph->width_ - - paragraph->breaker_.getWidths()[paragraph->records_[1].line()]) / + paragraph->breaker_.getWidths()[paragraph->records_[2].line()]) / 2, 2.0); - ASSERT_TRUE(paragraph->records_[2].style().equals(text_style)); - ASSERT_DOUBLE_EQ(paragraph->records_[2].offset().y(), expected_y); + ASSERT_TRUE(paragraph->records_[4].style().equals(text_style)); + ASSERT_DOUBLE_EQ(paragraph->records_[4].offset().y(), expected_y); expected_y += 30; - ASSERT_NEAR(paragraph->records_[2].offset().x(), + ASSERT_NEAR(paragraph->records_[4].offset().x(), (paragraph->width_ - - paragraph->breaker_.getWidths()[paragraph->records_[2].line()]) / + paragraph->breaker_.getWidths()[paragraph->records_[4].line()]) / 2, 2.0); - ASSERT_TRUE(paragraph->records_[3].style().equals(text_style)); - ASSERT_DOUBLE_EQ(paragraph->records_[3].offset().y(), expected_y); + ASSERT_TRUE(paragraph->records_[6].style().equals(text_style)); + ASSERT_DOUBLE_EQ(paragraph->records_[6].offset().y(), expected_y); expected_y += 30 * 10; - ASSERT_NEAR(paragraph->records_[3].offset().x(), + ASSERT_NEAR(paragraph->records_[6].offset().x(), (paragraph->width_ - - paragraph->breaker_.getWidths()[paragraph->records_[3].line()]) / + paragraph->breaker_.getWidths()[paragraph->records_[6].line()]) / 2, 2.0); - ASSERT_TRUE(paragraph->records_[13].style().equals(text_style)); - ASSERT_DOUBLE_EQ(paragraph->records_[13].offset().y(), expected_y); + ASSERT_TRUE(paragraph->records_[26].style().equals(text_style)); + ASSERT_DOUBLE_EQ(paragraph->records_[26].offset().y(), expected_y); ASSERT_NEAR( - paragraph->records_[13].offset().x(), + paragraph->records_[26].offset().x(), (paragraph->width_ - - paragraph->breaker_.getWidths()[paragraph->records_[13].line()]) / + paragraph->breaker_.getWidths()[paragraph->records_[26].line()]) / 2, 2.0); @@ -1760,7 +1762,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeCenterParagraph)) { EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 346.04492); EXPECT_FLOAT_EQ(boxes[0].rect.top(), 0.40625); - EXPECT_FLOAT_EQ(boxes[0].rect.right(), 346.04492); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 358.49414); EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 59); paint.setColor(SK_ColorRED); @@ -1868,7 +1870,7 @@ TEST_F(ParagraphTest, EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 346.04492); EXPECT_FLOAT_EQ(boxes[0].rect.top(), 0.40625); - EXPECT_FLOAT_EQ(boxes[0].rect.right(), 346.04492); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 358.49414); EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 59); paint.setColor(SK_ColorBLACK); @@ -1892,7 +1894,7 @@ TEST_F(ParagraphTest, EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 331.83594); EXPECT_FLOAT_EQ(boxes[0].rect.top(), 59.40625); - EXPECT_FLOAT_EQ(boxes[0].rect.right(), 331.83594); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 419.18359); EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 118); paint.setColor(SK_ColorRED); @@ -2413,7 +2415,7 @@ TEST_F(ParagraphTest, Ellipsize) { // Check that the ellipsizer limited the text to one line and did not wrap // to a second line. - ASSERT_EQ(paragraph->records_.size(), 1ull); + ASSERT_EQ(paragraph->records_.size(), 2ull); } // Test for shifting when identical runs of text are built as multiple runs. From 1f2cbf792b25f5c173fcfb28f7ba5c154ba65f7f Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 13 Feb 2019 15:47:57 -0800 Subject: [PATCH 0161/1117] Roll src/third_party/dart 0a7dcf17eb..c92d5ca288 (64 commits) c92d5ca288 Migrate ClassElementImplTest from task model. d566a674d0 Revert "[standalone] Name dart:io threads." cc3218b771 [standalone] Name dart:io threads. 525b43d747 [vm] Decouple intrinsifier code from runtime 4510fa08ca [vm / library] reduce dart:ffi test recursion depth def7e2dac7 Migrate ConstantVisitorTest from task model. 010a12330e [vm] Fix ThrowErrorSlowPath-derived instructions (e.g. CheckNull) in JIT mode. 76f531e742 [vm / library] dart:ffi status file entry for flaky dartkb crash c8a2a7b719 [vm/ffi] Move FFI transformations from pkg/kernel to pkg/vm. 7fe7e28c46 [vm] Fix location of Flutter 3xH patch file. d1bf6ae7d2 Track nonNullIntent in unconditional control flow. 13c4b160ba Add migration tool support for bare "return;" statements 3796dd8ba1 [vm] Pass --enable-asserts to analyze.dart in analyze_flutter.sh. 809d8123d3 [vm] Add FFI library to more targets and Flutter file libraries.json (in patch). d6a763ebd1 [vm / library] dart:ffi fix android build cf5a7cf36a Simplify class_hierarchy_test: Move tests of getLegacyLeastUpperBound to own file a92ddcf34b Add package:expect/matchers_lite.dart 0dfac95dac Simplify class_hierarchy_test: don't use package:test 5bf0065b46 Simplify class_hierarchy_test: don't use package:test_reflective_loader f954c0535c Simplify class_hierarchy_test: remove abstract class a200ef3124 Don't include main in computeTransitiveClosure 0651c8c4fd [vm / library] dart:ffi status file entry for reload crash 4fa1e3a3ca [vm / library] dart:ffi status file entry for appjitk crashes 3236ac15a1 Fix flutter-analyze bot. 3196b87f10 Incremental compiler: Include right libraries when entry point is translated e6a181a583 Add set literal release comment to changelog. 7d46d4b5cb [vm / library] Foreign function interface prototype 671865cd1a Fix JSON parser. bffa51efa2 Add ClassHierarchyBuilder.getKernelTypeAsInstanceOf 857d834e64 Remove obsolete expectMoreSpecific parameter 9c1b50b1aa Copy inferred mixin application type arguments to builder hierarchy f815b4cba7 Add Loader.computeTypeBuilder a31a72521b Don't include declarations of the library itself. c8b28c4cf9 [vm/compiler] graph checker addition f21fafd411 Migrate SimpleResolverTest from task model. 80e43c6a75 Remove the Modification class; use SourceEdit instead. 3e5a4f1a5d Sort declarations in file inferred_type_test.dart 1e72e9c985 Fix tests now that set literal support is enabled by default. f841096701 Fix for crash if MixinDeclaration has a const constructor. 80c8848624 Support for enums in available suggestions, getDetails, boost relevance. 6588eaf794 Fix calls to generator-bodies to correctly model elided parameters 3f96de7855 Cleanup intermediate control flow collection structures in AstBuilder ca32bef641 Add migration support for the `@required` annotation. 8d5958bd9a Migrate ErrorResolverTest. 9d280198a4 Prepare to publish analyzer version 0.35.1. 135abb41f7 Migrate ElementResolverCodeTest from task model. 6d2daa692c Set non_nullable experiments flag during migration tests. c507acfae4 Fix Js-interop factory calls which broke when eliding optional parameters. 0541640e37 [testing] Create list from test list iterable 66c404a26e dart2js: Reduce assert helpers c812d5a373 Fix available suggestions tests on Windows. 78509055b6 [vm] Add names for more types to the V8 snapshot profile output. 80e85d06ab Fixes for enum constants in available declarations. cccaae2b01 bump to linter 0.1.82 5fe0202b0b Unify MapElement and CollectionElement 92227c05fc [infra] Remove ContentShell support in test driver interface js. f54650ccaf Add LineInfo to Declaration search results ce91bcb442 Add migration support for named parameters. 69589be237 [infra] Rename analyzer-stable branch builders to have branch suffix. ed5bdfa227 [CFE] Fix check for unavailable constructors. 660cf26dbb Reland "[vm] Decouple stub code from runtime" 250f9665fb [CFE] Get constants backend from backend target. b7afb22323 [CFE] Eliminate redundant coreTypes parameter. 44681fa98e [CFE] Move DDC specific behavior into ConstantsBackend. --- DEPS | 4 +- ci/licenses_golden/licenses_third_party | 57 ++++++++++++++++++++----- 2 files changed, 48 insertions(+), 13 deletions(-) diff --git a/DEPS b/DEPS index c9cdcfbfccfff..07d9334063c1c 100644 --- a/DEPS +++ b/DEPS @@ -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': '0a7dcf17eb5f2450480527d6ad1e201fb47f1e36', + 'dart_revision': 'c92d5ca288da15b54b04c0a40ffe5d94a8883d77', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -60,7 +60,7 @@ vars = { 'dart_http_throttle_tag': '1.0.2', 'dart_intl_tag': '0.15.7', 'dart_json_rpc_2_tag': '2.0.9', - 'dart_linter_tag': '0.1.80', + 'dart_linter_tag': '0.1.82', 'dart_logging_tag': '0.11.3+2', 'dart_markdown_tag': '2.0.2', 'dart_matcher_tag': '0.12.3', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 26dd013bb3bc0..e97f942e5ae7c 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 8a314b3884017fae7b125cb423fa8d3f +Signature: a76c88a9ff389b1401e9df71fb13c1f6 UNUSED LICENSES: @@ -5604,6 +5604,7 @@ FILE: ../../../third_party/dart/runtime/platform/utils_fuchsia.h FILE: ../../../third_party/dart/runtime/vm/clustered_snapshot.cc FILE: ../../../third_party/dart/runtime/vm/clustered_snapshot.h FILE: ../../../third_party/dart/runtime/vm/code_patcher_dbc.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_dbc.cc FILE: ../../../third_party/dart/runtime/vm/compiler/assembler/assembler_dbc.cc FILE: ../../../third_party/dart/runtime/vm/compiler/assembler/assembler_dbc.h FILE: ../../../third_party/dart/runtime/vm/compiler/assembler/assembler_dbc_test.cc @@ -5617,7 +5618,6 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/backend/redundancy_eliminati 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 -FILE: ../../../third_party/dart/runtime/vm/compiler/intrinsifier_dbc.cc FILE: ../../../third_party/dart/runtime/vm/constants_dbc.h FILE: ../../../third_party/dart/runtime/vm/cpu_dbc.cc FILE: ../../../third_party/dart/runtime/vm/cpu_dbc.h @@ -5653,7 +5653,6 @@ FILE: ../../../third_party/dart/runtime/vm/signal_handler_fuchsia.cc FILE: ../../../third_party/dart/runtime/vm/simulator_dbc.cc FILE: ../../../third_party/dart/runtime/vm/simulator_dbc.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_dbc.h -FILE: ../../../third_party/dart/runtime/vm/stub_code_dbc.cc FILE: ../../../third_party/dart/runtime/vm/thread_interrupter_fuchsia.cc FILE: ../../../third_party/dart/runtime/vm/token_position.cc FILE: ../../../third_party/dart/runtime/vm/token_position.h @@ -5700,24 +5699,68 @@ ORIGIN: ../../../third_party/dart/runtime/bin/entrypoints_verification_test_exte TYPE: LicenseType.bsd FILE: ../../../third_party/dart/runtime/bin/entrypoints_verification_test_extension.cc FILE: ../../../third_party/dart/runtime/bin/entrypoints_verification_test_extension_dllmain_win.cc +FILE: ../../../third_party/dart/runtime/bin/ffi_test_dynamic_library.cc +FILE: ../../../third_party/dart/runtime/bin/ffi_test_functions.cc FILE: ../../../third_party/dart/runtime/bin/namespace_fuchsia.h +FILE: ../../../third_party/dart/runtime/lib/ffi.cc +FILE: ../../../third_party/dart/runtime/lib/ffi_dynamic_library.cc +FILE: ../../../third_party/dart/runtime/lib/ffi_dynamic_library_patch.dart +FILE: ../../../third_party/dart/runtime/lib/ffi_native_type_patch.dart +FILE: ../../../third_party/dart/runtime/lib/ffi_patch.dart FILE: ../../../third_party/dart/runtime/vm/class_id.h FILE: ../../../third_party/dart/runtime/vm/code_entry_kind.h +FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier.h +FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_arm.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_arm64.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_ia32.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_x64.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/flow_graph_checker.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/flow_graph_checker.h FILE: ../../../third_party/dart/runtime/vm/compiler/backend/slot_test.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier.h +FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier_arm.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier_arm64.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier_ia32.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier_x64.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/recognized_methods_list.h FILE: ../../../third_party/dart/runtime/vm/compiler/relocation.cc FILE: ../../../third_party/dart/runtime/vm/compiler/runtime_api.cc FILE: ../../../third_party/dart/runtime/vm/compiler/runtime_api.h +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler.h +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm64.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_dbc.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_ia32.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_x64.cc +FILE: ../../../third_party/dart/runtime/vm/constants_x64.cc +FILE: ../../../third_party/dart/runtime/vm/ffi_trampoline_stubs_x64.cc FILE: ../../../third_party/dart/runtime/vm/frame_layout.h FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist.h FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist_test.cc FILE: ../../../third_party/dart/runtime/vm/longjump.h FILE: ../../../third_party/dart/runtime/vm/pointer_tagging.h +FILE: ../../../third_party/dart/runtime/vm/static_type_exactness_state.h +FILE: ../../../third_party/dart/runtime/vm/stub_code_list.h FILE: ../../../third_party/dart/runtime/vm/thread_stack_resource.cc FILE: ../../../third_party/dart/runtime/vm/thread_stack_resource.h FILE: ../../../third_party/dart/runtime/vm/thread_state.cc FILE: ../../../third_party/dart/runtime/vm/thread_state.h +FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm.cc +FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm64.cc +FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_x64.cc +FILE: ../../../third_party/dart/samples/ffi/coordinate.dart +FILE: ../../../third_party/dart/samples/ffi/sample_ffi_data.dart +FILE: ../../../third_party/dart/samples/ffi/sample_ffi_dynamic_library.dart +FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions.dart +FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions_callbacks.dart +FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions_structs.dart +FILE: ../../../third_party/dart/samples/ffi/sample_ffi_structs.dart +FILE: ../../../third_party/dart/sdk/lib/ffi/annotations.dart +FILE: ../../../third_party/dart/sdk/lib/ffi/dynamic_library.dart +FILE: ../../../third_party/dart/sdk/lib/ffi/ffi.dart +FILE: ../../../third_party/dart/sdk/lib/ffi/native_type.dart ---------------------------------------------------------------------------------------------------- Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file for details. All rights reserved. @@ -6145,9 +6188,6 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/backend/locations.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/locations.h FILE: ../../../third_party/dart/runtime/vm/compiler/backend/type_propagator.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/type_propagator.h -FILE: ../../../third_party/dart/runtime/vm/compiler/intrinsifier_arm.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/intrinsifier_ia32.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/intrinsifier_x64.cc FILE: ../../../third_party/dart/runtime/vm/compiler/jit/jit_call_specializer.cc FILE: ../../../third_party/dart/runtime/vm/constants_arm.h FILE: ../../../third_party/dart/runtime/vm/constants_ia32.h @@ -6201,10 +6241,7 @@ FILE: ../../../third_party/dart/runtime/vm/simulator_arm.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_arm.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_ia32.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_x64.h -FILE: ../../../third_party/dart/runtime/vm/stub_code_arm.cc FILE: ../../../third_party/dart/runtime/vm/stub_code_arm_test.cc -FILE: ../../../third_party/dart/runtime/vm/stub_code_ia32.cc -FILE: ../../../third_party/dart/runtime/vm/stub_code_x64.cc FILE: ../../../third_party/dart/runtime/vm/tags.h FILE: ../../../third_party/dart/runtime/vm/thread_interrupter.cc FILE: ../../../third_party/dart/runtime/vm/thread_interrupter.h @@ -6415,7 +6452,6 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/backend/il_arm64.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/range_analysis.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/range_analysis.h FILE: ../../../third_party/dart/runtime/vm/compiler/backend/range_analysis_test.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/intrinsifier_arm64.cc FILE: ../../../third_party/dart/runtime/vm/compiler/method_recognizer.cc FILE: ../../../third_party/dart/runtime/vm/compiler/method_recognizer.h FILE: ../../../third_party/dart/runtime/vm/constants_arm64.h @@ -6466,7 +6502,6 @@ FILE: ../../../third_party/dart/runtime/vm/runtime_entry_arm64.cc FILE: ../../../third_party/dart/runtime/vm/simulator_arm64.cc FILE: ../../../third_party/dart/runtime/vm/simulator_arm64.h FILE: ../../../third_party/dart/runtime/vm/stack_frame_arm64.h -FILE: ../../../third_party/dart/runtime/vm/stub_code_arm64.cc FILE: ../../../third_party/dart/runtime/vm/stub_code_arm64_test.cc FILE: ../../../third_party/dart/runtime/vm/tags.cc FILE: ../../../third_party/dart/runtime/vm/unibrow-inl.h From af39e22c318a5d39dec3c9453c8f2e77ea76af79 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Wed, 13 Feb 2019 16:27:15 -0800 Subject: [PATCH 0162/1117] Fix tests that were committed after cirrus ran (#7819) --- third_party/txt/tests/paragraph_unittests.cc | 30 +++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index 0c2f9df3dd2c4..89a1186202d84 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -638,7 +638,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(JustifyAlignParagraph)) { 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_.size(), paragraph_style.max_lines); + ASSERT_EQ(paragraph->records_.size(), 27ull); double expected_y = 24; ASSERT_TRUE(paragraph->records_[0].style().equals(text_style)); @@ -646,24 +646,24 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(JustifyAlignParagraph)) { expected_y += 30; ASSERT_DOUBLE_EQ(paragraph->records_[0].offset().x(), 0); - ASSERT_TRUE(paragraph->records_[1].style().equals(text_style)); - ASSERT_DOUBLE_EQ(paragraph->records_[1].offset().y(), expected_y); - expected_y += 30; - ASSERT_DOUBLE_EQ(paragraph->records_[1].offset().x(), 0); - ASSERT_TRUE(paragraph->records_[2].style().equals(text_style)); ASSERT_DOUBLE_EQ(paragraph->records_[2].offset().y(), expected_y); expected_y += 30; ASSERT_DOUBLE_EQ(paragraph->records_[2].offset().x(), 0); - ASSERT_TRUE(paragraph->records_[3].style().equals(text_style)); - ASSERT_DOUBLE_EQ(paragraph->records_[3].offset().y(), expected_y); + ASSERT_TRUE(paragraph->records_[4].style().equals(text_style)); + ASSERT_DOUBLE_EQ(paragraph->records_[4].offset().y(), expected_y); + expected_y += 30; + ASSERT_DOUBLE_EQ(paragraph->records_[4].offset().x(), 0); + + ASSERT_TRUE(paragraph->records_[6].style().equals(text_style)); + ASSERT_DOUBLE_EQ(paragraph->records_[6].offset().y(), expected_y); expected_y += 30 * 10; - ASSERT_DOUBLE_EQ(paragraph->records_[3].offset().x(), 0); + ASSERT_DOUBLE_EQ(paragraph->records_[6].offset().x(), 0); - ASSERT_TRUE(paragraph->records_[13].style().equals(text_style)); - ASSERT_DOUBLE_EQ(paragraph->records_[13].offset().y(), expected_y); - ASSERT_DOUBLE_EQ(paragraph->records_[13].offset().x(), 0); + ASSERT_TRUE(paragraph->records_[26].style().equals(text_style)); + ASSERT_DOUBLE_EQ(paragraph->records_[26].offset().y(), expected_y); + ASSERT_DOUBLE_EQ(paragraph->records_[26].offset().x(), 0); ASSERT_EQ(paragraph_style.text_align, paragraph->GetParagraphStyle().text_align); @@ -706,7 +706,11 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(JustifyRTL)) { ASSERT_TRUE(Snapshot()); auto glyph_line_width = [¶graph](int index) { - return paragraph->glyph_lines_[index].positions.back().x_pos.end; + size_t second_to_last_position_index = + paragraph->glyph_lines_[index].positions.size() - 2; + return paragraph->glyph_lines_[index] + .positions[second_to_last_position_index] + .x_pos.end; }; // All lines except the last should be justified to the width of the From b867f4858ba1d59376062207cc5465568a9b8c9f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 13 Feb 2019 20:21:35 -0500 Subject: [PATCH 0163/1117] Roll src/third_party/skia 186669c4128b..09c01e9df260 (5 commits) (#7820) https://skia.googlesource.com/skia.git/%2Blog/186669c4128b..09c01e9df260 git log 186669c4128bf9de63453e238d7c2e6ffbf34bca..09c01e9df260053399eb22efcfd6b248d66a2492 --date=short --no-merges --format=%ad %ae %s 2019-02-13 rmistry@google.com Make Housekeeper-PerCommit-Bookmaker a tryjob only bot 2019-02-13 herb@google.com Remove empty processing from drawGlyphRunAsBMPWithPathFallback 2019-02-13 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-13 brianosman@google.com Use half-floats for out-of-gamut color in GrAAFillRRectOp 2019-02-13 nigeltao@google.com Keep scaledHeight calculation across oID calls The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 07d9334063c1c..fa85ede20c275 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': '186669c4128bf9de63453e238d7c2e6ffbf34bca', + 'skia_revision': '09c01e9df260053399eb22efcfd6b248d66a2492', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 4779e7753c66c..f237676dfde72 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 50103e41a09677a1a5eba1e1e6e3b3f8 +Signature: e3ce43a011f4c900bdb29fb2a33f69c9 UNUSED LICENSES: From 0a5a7c56dd2b9714f459b40d3dc29722ee078444 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 14 Feb 2019 00:36:21 -0500 Subject: [PATCH 0164/1117] Roll src/third_party/skia 09c01e9df260..4037f7f5d8b4 (3 commits) (#7821) https://skia.googlesource.com/skia.git/%2Blog/09c01e9df260..4037f7f5d8b4 git log 09c01e9df260053399eb22efcfd6b248d66a2492..4037f7f5d8b465f50f28135bfe0e532e2154089f --date=short --no-merges --format=%ad %ae %s 2019-02-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 6fc22a13d45d..52047de4d41f (3 commits) 2019-02-13 reed@google.com remove unused variable 2019-02-13 zhuo@hexoasis.com Fix bug of SkSVGCanvas::Make The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index fa85ede20c275..9121125bb1b77 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': '09c01e9df260053399eb22efcfd6b248d66a2492', + 'skia_revision': '4037f7f5d8b465f50f28135bfe0e532e2154089f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index f237676dfde72..99e4d0ef3c252 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: e3ce43a011f4c900bdb29fb2a33f69c9 +Signature: 35cfaa0386f42e330e737a56d69fe391 UNUSED LICENSES: From e2394ad77e2dbfe007f437e01f8bb35f87ce97cc Mon Sep 17 00:00:00 2001 From: nathanrogersgoogle Date: Wed, 13 Feb 2019 22:27:12 -0800 Subject: [PATCH 0165/1117] Add flow events connecting pointer events to frames (#7807) --- shell/common/animator.cc | 18 ++++++++++++++++++ shell/common/animator.h | 7 +++++++ shell/common/engine.cc | 6 +++++- shell/common/engine.h | 3 ++- shell/common/shell.cc | 8 ++++++-- shell/common/shell.h | 2 ++ shell/platform/android/android_shell_holder.cc | 10 ++++++++-- shell/platform/android/android_shell_holder.h | 1 + shell/platform/embedder/embedder_engine.cc | 9 +++++++-- shell/platform/embedder/embedder_engine.h | 1 + 10 files changed, 57 insertions(+), 8 deletions(-) diff --git a/shell/common/animator.cc b/shell/common/animator.cc index 9d31a0c2eabab..78fdd98b3206f 100644 --- a/shell/common/animator.cc +++ b/shell/common/animator.cc @@ -62,6 +62,17 @@ void Animator::SetDimensionChangePending() { dimension_change_pending_ = true; } +void Animator::EnqueueTraceFlowId(uint64_t trace_flow_id) { + fml::TaskRunner::RunNowOrPostTask( + task_runners_.GetUITaskRunner(), + [self = weak_factory_.GetWeakPtr(), trace_flow_id] { + if (!self) { + return; + } + self->trace_flow_ids_.push_back(trace_flow_id); + }); +} + // This Parity is used by the timeline component to correctly align // GPU Workloads events with their respective Framework Workload. const char* Animator::FrameParity() { @@ -78,6 +89,13 @@ void Animator::BeginFrame(fml::TimePoint frame_start_time, fml::TimePoint frame_target_time) { TRACE_EVENT_ASYNC_END0("flutter", "Frame Request Pending", frame_number_++); + TRACE_EVENT0("flutter", "Animator::BeginFrame"); + while (!trace_flow_ids_.empty()) { + uint64_t trace_flow_id = trace_flow_ids_.front(); + TRACE_FLOW_END("flutter", "DispatchPointerDataPacket", trace_flow_id); + trace_flow_ids_.pop_front(); + } + frame_scheduled_ = false; notify_idle_task_id_++; regenerate_layer_tree_ = false; diff --git a/shell/common/animator.h b/shell/common/animator.h index 4f75b8fb3cb4d..15f8b8c745e67 100644 --- a/shell/common/animator.h +++ b/shell/common/animator.h @@ -5,6 +5,8 @@ #ifndef FLUTTER_SHELL_COMMON_ANIMATOR_H_ #define FLUTTER_SHELL_COMMON_ANIMATOR_H_ +#include + #include "flutter/common/task_runners.h" #include "flutter/fml/memory/ref_ptr.h" #include "flutter/fml/memory/weak_ptr.h" @@ -48,6 +50,10 @@ class Animator final { void SetDimensionChangePending(); + // Enqueue |trace_flow_id| into |trace_flow_ids_|. The corresponding flow + // will be ended during the next |BeginFrame|. + void EnqueueTraceFlowId(uint64_t trace_flow_id); + private: using LayerTreePipeline = flutter::Pipeline; @@ -77,6 +83,7 @@ class Animator final { int notify_idle_task_id_; bool dimension_change_pending_; SkISize last_layer_tree_size_; + std::deque trace_flow_ids_; fml::WeakPtrFactory weak_factory_; diff --git a/shell/common/engine.cc b/shell/common/engine.cc index c0aec58ee9900..084216072e988 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -355,7 +355,11 @@ void Engine::HandleSettingsPlatformMessage(blink::PlatformMessage* message) { } } -void Engine::DispatchPointerDataPacket(const blink::PointerDataPacket& packet) { +void Engine::DispatchPointerDataPacket(const blink::PointerDataPacket& packet, + uint64_t trace_flow_id) { + TRACE_EVENT0("flutter", "Engine::DispatchPointerDataPacket"); + TRACE_FLOW_STEP("flutter", "PointerEvent", trace_flow_id); + animator_->EnqueueTraceFlowId(trace_flow_id); runtime_controller_->DispatchPointerDataPacket(packet); } diff --git a/shell/common/engine.h b/shell/common/engine.h index 1c241a57a732a..b390b36a2b197 100644 --- a/shell/common/engine.h +++ b/shell/common/engine.h @@ -104,7 +104,8 @@ class Engine final : public blink::RuntimeDelegate { void DispatchPlatformMessage(fml::RefPtr message); - void DispatchPointerDataPacket(const blink::PointerDataPacket& packet); + void DispatchPointerDataPacket(const blink::PointerDataPacket& packet, + uint64_t trace_flow_id); void DispatchSemanticsAction(int id, blink::SemanticsAction action, diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 2a00a44605bc4..c1dec19f6ae67 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -546,14 +546,18 @@ void Shell::OnPlatformViewDispatchPlatformMessage( // |shell::PlatformView::Delegate| void Shell::OnPlatformViewDispatchPointerDataPacket( std::unique_ptr packet) { + TRACE_EVENT0("flutter", "Shell::OnPlatformViewDispatchPointerDataPacket"); + TRACE_FLOW_BEGIN("flutter", "PointerEvent", next_pointer_flow_id_); FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); task_runners_.GetUITaskRunner()->PostTask(fml::MakeCopyable( - [engine = engine_->GetWeakPtr(), packet = std::move(packet)] { + [engine = engine_->GetWeakPtr(), packet = std::move(packet), + flow_id = next_pointer_flow_id_] { if (engine) { - engine->DispatchPointerDataPacket(*packet); + engine->DispatchPointerDataPacket(*packet, flow_id); } })); + next_pointer_flow_id_++; } // |shell::PlatformView::Delegate| diff --git a/shell/common/shell.h b/shell/common/shell.h index 2222fa45367c9..17b0f170561d5 100644 --- a/shell/common/shell.h +++ b/shell/common/shell.h @@ -99,6 +99,8 @@ class Shell final : public PlatformView::Delegate, service_protocol_handlers_; bool is_setup_ = false; + uint64_t next_pointer_flow_id_ = 0; + Shell(blink::TaskRunners task_runners, blink::Settings settings); static std::unique_ptr CreateShellOnPlatformThread( diff --git a/shell/platform/android/android_shell_holder.cc b/shell/platform/android/android_shell_holder.cc index 4c9a1ba076ba4..06a3697da36ce 100644 --- a/shell/platform/android/android_shell_holder.cc +++ b/shell/platform/android/android_shell_holder.cc @@ -192,12 +192,18 @@ void AndroidShellHolder::DispatchPointerDataPacket( return; } + TRACE_EVENT0("flutter", "AndroidShellHolder::DispatchPointerDataPacket"); + TRACE_FLOW_BEGIN("flutter", "PointerEvent", next_pointer_flow_id_); + shell_->GetTaskRunners().GetUITaskRunner()->PostTask(fml::MakeCopyable( - [engine = shell_->GetEngine(), packet = std::move(packet)] { + [engine = shell_->GetEngine(), packet = std::move(packet), + flow_id = next_pointer_flow_id_] { if (engine) { - engine->DispatchPointerDataPacket(*packet); + engine->DispatchPointerDataPacket(*packet, flow_id); } })); + + next_pointer_flow_id_++; } Rasterizer::Screenshot AndroidShellHolder::Screenshot( diff --git a/shell/platform/android/android_shell_holder.h b/shell/platform/android/android_shell_holder.h index 1fbca8a288f3c..d01cc5d43d5e4 100644 --- a/shell/platform/android/android_shell_holder.h +++ b/shell/platform/android/android_shell_holder.h @@ -52,6 +52,7 @@ class AndroidShellHolder { std::unique_ptr shell_; bool is_valid_ = false; pthread_key_t thread_destruct_key_; + uint64_t next_pointer_flow_id_; static void ThreadDestructCallback(void* value); diff --git a/shell/platform/embedder/embedder_engine.cc b/shell/platform/embedder/embedder_engine.cc index 9061bd3e8ae1d..168de1b83b49c 100644 --- a/shell/platform/embedder/embedder_engine.cc +++ b/shell/platform/embedder/embedder_engine.cc @@ -89,12 +89,17 @@ bool EmbedderEngine::DispatchPointerDataPacket( return false; } + TRACE_EVENT0("flutter", "EmbedderEngine::DispatchPointerDataPacket"); + TRACE_FLOW_BEGIN("flutter", "PointerEvent", next_pointer_flow_id_); + shell_->GetTaskRunners().GetUITaskRunner()->PostTask(fml::MakeCopyable( - [engine = shell_->GetEngine(), packet = std::move(packet)] { + [engine = shell_->GetEngine(), packet = std::move(packet), + flow_id = next_pointer_flow_id_] { if (engine) { - engine->DispatchPointerDataPacket(*packet); + engine->DispatchPointerDataPacket(*packet, flow_id); } })); + next_pointer_flow_id_++; return true; } diff --git a/shell/platform/embedder/embedder_engine.h b/shell/platform/embedder/embedder_engine.h index b8110f02a7fef..204776554679d 100644 --- a/shell/platform/embedder/embedder_engine.h +++ b/shell/platform/embedder/embedder_engine.h @@ -56,6 +56,7 @@ class EmbedderEngine { const EmbedderExternalTextureGL::ExternalTextureCallback external_texture_callback_; bool is_valid_ = false; + uint64_t next_pointer_flow_id_; FML_DISALLOW_COPY_AND_ASSIGN(EmbedderEngine); }; From 942677695f6e043387542dd632dc6081145f45d9 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 14 Feb 2019 04:49:27 -0500 Subject: [PATCH 0166/1117] Roll src/third_party/skia 4037f7f5d8b4..6152470dc69e (1 commits) (#7823) https://skia.googlesource.com/skia.git/%2Blog/4037f7f5d8b4..6152470dc69e git log 4037f7f5d8b465f50f28135bfe0e532e2154089f..6152470dc69ee96172e5f4c3270f98e47ff9693d --date=short --no-merges --format=%ad %ae %s 2019-02-14 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 9121125bb1b77..c61c1133bbf3b 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': '4037f7f5d8b465f50f28135bfe0e532e2154089f', + 'skia_revision': '6152470dc69ee96172e5f4c3270f98e47ff9693d', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 99e4d0ef3c252..05456ef90229d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 35cfaa0386f42e330e737a56d69fe391 +Signature: 8dd31eea1060c69f45da135643063d62 UNUSED LICENSES: From dbc1663876e0c8c94ec11c761ec35462ed0a7e94 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 14 Feb 2019 09:15:00 -0500 Subject: [PATCH 0167/1117] Roll src/third_party/skia 6152470dc69e..a0dcd29f536b (2 commits) (#7824) https://skia.googlesource.com/skia.git/%2Blog/6152470dc69e..a0dcd29f536b git log 6152470dc69ee96172e5f4c3270f98e47ff9693d..a0dcd29f536b195681684b3105842970d82383a5 --date=short --no-merges --format=%ad %ae %s 2019-02-14 zhuo@hexoasis.com Fix bug of the destructor of SkSVGDevice 2019-02-13 reed@google.com Update examples to use SkFont The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c61c1133bbf3b..2c341aadb4c38 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': '6152470dc69ee96172e5f4c3270f98e47ff9693d', + 'skia_revision': 'a0dcd29f536b195681684b3105842970d82383a5', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 05456ef90229d..15ee0eac48864 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8dd31eea1060c69f45da135643063d62 +Signature: 07399cb7f27bd6fad75965582e8f2f97 UNUSED LICENSES: From b1ce6b72ff02f5b66410707dd3a3f94556897320 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 14 Feb 2019 13:10:59 -0500 Subject: [PATCH 0168/1117] Roll src/third_party/skia a0dcd29f536b..9a88bee122f1 (4 commits) (#7825) https://skia.googlesource.com/skia.git/%2Blog/a0dcd29f536b..9a88bee122f1 git log a0dcd29f536b195681684b3105842970d82383a5..9a88bee122f145014ce246ba872b1738b79efe83 --date=short --no-merges --format=%ad %ae %s 2019-02-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 1f0e830f475f..b698b62f407e (516 commits) 2019-02-14 halcanary@google.com resources: add text for testing shaper 2019-02-14 egdaniel@google.com Add kRGB_888X_GrPixelConfig 2019-02-14 rmistry@google.com Bring back PerCommit-Bookmaker to the waterfall The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 2c341aadb4c38..8168e1e68020e 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': 'a0dcd29f536b195681684b3105842970d82383a5', + 'skia_revision': '9a88bee122f145014ce246ba872b1738b79efe83', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 15ee0eac48864..97856f2c19115 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 07399cb7f27bd6fad75965582e8f2f97 +Signature: 119ea9bd2d4f00768d7dad1e40337bfb UNUSED LICENSES: From a8aa1ee060acde704833bee4c940a83e16e47ef4 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Thu, 14 Feb 2019 12:30:29 -0800 Subject: [PATCH 0169/1117] Track flow id (#7826) (Authored by @nathanrogersgoogle ) --- .../darwin/ios/framework/Source/FlutterEngine.mm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm index 6a855650b9125..8b8bd33fdba2a 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -10,6 +10,7 @@ #include "flutter/fml/message_loop.h" #include "flutter/fml/platform/darwin/platform_version.h" +#include "flutter/fml/trace_event.h" #include "flutter/shell/common/engine.h" #include "flutter/shell/common/platform_view.h" #include "flutter/shell/common/shell.h" @@ -61,6 +62,8 @@ @implementation FlutterEngine { int64_t _nextTextureId; + uint64_t _nextPointerFlowId; + BOOL _allowHeadlessExecution; } @@ -117,12 +120,15 @@ - (void)updateViewportMetrics:(blink::ViewportMetrics)viewportMetrics { } - (void)dispatchPointerDataPacket:(std::unique_ptr)packet { - self.shell.GetTaskRunners().GetUITaskRunner()->PostTask( - fml::MakeCopyable([engine = self.shell.GetEngine(), packet = std::move(packet)] { + TRACE_EVENT0("flutter", "dispatchPointerDataPacket"); + TRACE_FLOW_BEGIN("flutter", "PointerEvent", _nextPointerFlowId); + self.shell.GetTaskRunners().GetUITaskRunner()->PostTask(fml::MakeCopyable( + [engine = self.shell.GetEngine(), packet = std::move(packet), flow_id = _nextPointerFlowId] { if (engine) { - engine->DispatchPointerDataPacket(*packet); + engine->DispatchPointerDataPacket(*packet, flow_id); } })); + _nextPointerFlowId++; } - (fml::WeakPtr)platformView { From 6f318efe0bf0f85f3e0ed4c35abb6133bb5ddc18 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Thu, 14 Feb 2019 15:16:44 -0800 Subject: [PATCH 0170/1117] Move up ndk version that is being downloaded(old one no longer available) (#7830) --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 8168e1e68020e..b139fb364e171 100644 --- a/DEPS +++ b/DEPS @@ -451,7 +451,7 @@ hooks = [ '--build-tools-version=28.0.3', '--platform-tools-version=28.0.1', '--tools-version=26.1.1', - '--ndk-version=19.0.5232133' + '--ndk-version=19.1.5304403' ], }, # TODO(dnfield): This can be enabled when we actually support building From 733739938bb4f841320e12e32a52c3ba7d69558c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 14 Feb 2019 19:22:35 -0500 Subject: [PATCH 0171/1117] Roll src/third_party/skia 9a88bee122f1..b00f7b34751b (24 commits) (#7831) https://skia.googlesource.com/skia.git/%2Blog/9a88bee122f1..b00f7b34751b git log 9a88bee122f145014ce246ba872b1738b79efe83..b00f7b34751b64a7dc3051e452f5a63afe222891 --date=short --no-merges --format=%ad %ae %s 2019-02-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader de16f327d051..2bb0864b22e7 (1 commits) 2019-02-14 bungeman@google.com Fix signed/unsigned mismatch in shaper assert. 2019-02-14 bungeman@google.com Fix assert in shaper. 2019-02-14 robertphillips@google.com Allow GrRecordingContext to create surfaceContexts 2019-02-14 bungeman@google.com Remove typeface from SkShaper constructor. 2019-02-14 herb@google.com Calculate strike in path case 2019-02-13 bungeman@google.com Add HarfBuzz callbacks. 2019-02-14 bungeman@google.com Fix calculating clusters from start of input. 2019-02-14 jvanverth@google.com Add MoltenVK support to Viewer. 2019-02-13 michaelludwig@google.com Clean up GrQuad ctors 2019-02-14 nigeltao@google.com Have Wuffs output to BGRA, not indexed color 2019-02-14 herb@google.com Use bulk interface for paths 2019-02-14 brianosman@google.com Various particle system improvements 2019-02-14 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-14 brianosman@google.com Particles/SkReflected: Generalize array reflection 2019-02-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 52047de4d41f..77874e2ca341 (1 commits) 2019-02-14 bsalomon@google.com Use destructors to free resources owned by lazy proxy callbacks 2019-02-14 bungeman@google.com Don't respect FontConfig matrix for bitmap fonts. 2019-02-14 fmalita@chromium.org [SVGCanvas] Clean up public factories 2019-02-14 bungeman@google.com Defer loading particle effect to load time. 2019-02-14 robertphillips@google.com Baulk at creating wait semaphores if we can't always delete them 2019-02-13 michaelludwig@google.com Add blendmode to GrRTC::drawTexture 2019-02-14 egdaniel@google.com Use kRGB_888x_SkColorType when importing R8G8B8X8 AHB. 2019-02-14 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index b139fb364e171..8f024639f5eee 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': '9a88bee122f145014ce246ba872b1738b79efe83', + 'skia_revision': 'b00f7b34751b64a7dc3051e452f5a63afe222891', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 97856f2c19115..002ae9106b748 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 119ea9bd2d4f00768d7dad1e40337bfb +Signature: c3ff674ef4f594eb35142e6f6fbfc552 UNUSED LICENSES: From 5d3f7145a1cd8dd439e937dc7eb4b471026e9bc3 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 15 Feb 2019 01:07:41 -0500 Subject: [PATCH 0172/1117] Roll src/third_party/skia b00f7b34751b..7a74c7cb6da0 (1 commits) (#7835) https://skia.googlesource.com/skia.git/%2Blog/b00f7b34751b..7a74c7cb6da0 git log b00f7b34751b64a7dc3051e452f5a63afe222891..7a74c7cb6da0809e2ea2121932b889844e249157 --date=short --no-merges --format=%ad %ae %s 2019-02-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 77874e2ca341..559aaca5abd8 (4 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 8f024639f5eee..af2a12340cea0 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': 'b00f7b34751b64a7dc3051e452f5a63afe222891', + 'skia_revision': '7a74c7cb6da0809e2ea2121932b889844e249157', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 002ae9106b748..6f1dbd0e8cf9b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c3ff674ef4f594eb35142e6f6fbfc552 +Signature: 1f9c300dc4669de6fc08fe0216393438 UNUSED LICENSES: From ecbaea10a4f2daf32ad0ff27c7f5917b4b8b87b6 Mon Sep 17 00:00:00 2001 From: Martin Kustermann Date: Fri, 15 Feb 2019 15:17:54 +0100 Subject: [PATCH 0173/1117] Ensure to pass dill file after VM options for gen_snapshot (#7839) --- lib/snapshot/BUILD.gn | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn index 601cee102ead1..42d37626f5e4b 100644 --- a/lib/snapshot/BUILD.gn +++ b/lib/snapshot/BUILD.gn @@ -60,17 +60,15 @@ compiled_action("generate_snapshot_bin") { "--isolate_snapshot_data=" + rebase_path(isolate_snapshot_data), "--isolate_snapshot_instructions=" + rebase_path(isolate_snapshot_instructions), - rebase_path(platform_kernel), ] if (is_debug) { args += [ "--enable_asserts", - "--enable_type_checks", - "--error_on_bad_type", - "--error_on_bad_override", ] } + + args += [rebase_path(platform_kernel)] } # Generates an assembly file defining a given symbol with the bytes from a From c51ea41578e1c40c22fb73c82bdb692d86d8b2fc Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 15 Feb 2019 09:34:17 -0500 Subject: [PATCH 0174/1117] Roll src/third_party/skia 7a74c7cb6da0..154acd7a1374 (1 commits) (#7840) https://skia.googlesource.com/skia.git/%2Blog/7a74c7cb6da0..154acd7a1374 git log 7a74c7cb6da0809e2ea2121932b889844e249157..154acd7a137438b2e7f0c7c1803a3e9d969e867c --date=short --no-merges --format=%ad %ae %s 2019-02-15 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index af2a12340cea0..9130e78e8ab62 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': '7a74c7cb6da0809e2ea2121932b889844e249157', + 'skia_revision': '154acd7a137438b2e7f0c7c1803a3e9d969e867c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6f1dbd0e8cf9b..b67c0646e1850 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 1f9c300dc4669de6fc08fe0216393438 +Signature: aa69fcf66c040783f2ae8a3bc268345e UNUSED LICENSES: From 0ca1d1f318e6a4964a9c2b957524d3fb8d38b3ac Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Fri, 15 Feb 2019 09:43:23 -0800 Subject: [PATCH 0175/1117] Remove the Dart JIT snapshot data from AOT builds of the embedder library (#7806) Also extend the embedder unit tests to cover AOT execution --- DEPS | 2 +- shell/platform/embedder/BUILD.gn | 6 +- .../embedder/tests/embedder_unittests.cc | 46 ++++++++++++ testing/testing.gni | 71 +++++++++++++++++-- 4 files changed, 115 insertions(+), 10 deletions(-) diff --git a/DEPS b/DEPS index 9130e78e8ab62..94d94fc5b3a77 100644 --- a/DEPS +++ b/DEPS @@ -116,7 +116,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'c82412bcdcd593f1385a478ae2c4b8eb9814f3b8', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '4d5aa40f7424aa6bfbe0b27af1067ffd2e6ec25a', # Fuchsia compatibility # diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index 042d3ceced5cc..0d4aedb0ddecd 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -38,7 +38,6 @@ source_set("embedder") { "$flutter_root/common", "$flutter_root/flow", "$flutter_root/fml", - "$flutter_root/lib/snapshot", "$flutter_root/shell/common", "//third_party/dart/runtime/bin:dart_io_api", "//third_party/skia", @@ -48,7 +47,10 @@ source_set("embedder") { if (flutter_runtime_mode == "profile" || flutter_runtime_mode == "release") { deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ] } else { - deps += [ "//third_party/dart/runtime:libdart_jit" ] + deps += [ + "$flutter_root/lib/snapshot", + "//third_party/dart/runtime:libdart_jit", + ] } public_configs = [ "$flutter_root:config" ] diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc index 7ddff1e96aafd..f1345227c3aa8 100644 --- a/shell/platform/embedder/tests/embedder_unittests.cc +++ b/shell/platform/embedder/tests/embedder_unittests.cc @@ -4,8 +4,38 @@ #include #include "embedder.h" +#include "flutter/fml/file.h" +#include "flutter/fml/mapping.h" #include "flutter/testing/testing.h" +namespace { + +void MapAOTAsset(std::vector>& aot_mappings, + const fml::UniqueFD& fixtures_dir, + const char* path, + bool executable, + const uint8_t** data, + size_t* size) { + fml::UniqueFD file = + fml::OpenFile(fixtures_dir, path, false, fml::FilePermission::kRead); + std::unique_ptr mapping; + if (executable) { + mapping = std::make_unique( + file, std::initializer_list{ + fml::FileMapping::Protection::kRead, + fml::FileMapping::Protection::kExecute}); + } else { + mapping = std::make_unique( + file, std::initializer_list{ + fml::FileMapping::Protection::kRead}); + } + *data = mapping->GetMapping(); + *size = mapping->GetSize(); + aot_mappings.emplace_back(std::move(mapping)); +} + +} // anonymous namespace + TEST(EmbedderTest, MustNotRunWithInvalidArgs) { FlutterEngine engine = nullptr; FlutterRendererConfig config = {}; @@ -34,6 +64,22 @@ TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) { ASSERT_EQ(str_data, "Data"); }; + fml::UniqueFD fixtures_dir = fml::OpenDirectory( + testing::GetFixturesPath(), false, fml::FilePermission::kRead); + std::vector> aot_mappings; + if (fml::FileExists(fixtures_dir, "vm_snapshot_data")) { + MapAOTAsset(aot_mappings, fixtures_dir, "vm_snapshot_data", false, + &args.vm_snapshot_data, &args.vm_snapshot_data_size); + MapAOTAsset(aot_mappings, fixtures_dir, "vm_snapshot_instr", true, + &args.vm_snapshot_instructions, + &args.vm_snapshot_instructions_size); + MapAOTAsset(aot_mappings, fixtures_dir, "isolate_snapshot_data", false, + &args.isolate_snapshot_data, &args.isolate_snapshot_data_size); + MapAOTAsset(aot_mappings, fixtures_dir, "isolate_snapshot_instr", true, + &args.isolate_snapshot_instructions, + &args.isolate_snapshot_instructions_size); + } + std::string str_data = "Data"; void* user_data = const_cast(str_data.c_str()); FlutterEngine engine = nullptr; diff --git a/testing/testing.gni b/testing/testing.gni index 1bb519b999330..8d01b6810c044 100644 --- a/testing/testing.gni +++ b/testing/testing.gni @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("$flutter_root/common/config.gni") +import("//build/compiled_action.gni") import("//third_party/dart/build/dart/dart_action.gni") # Builds test fixtures for a unit test. @@ -21,7 +23,11 @@ template("test_fixtures") { testonly = true assert(defined(invoker.fixtures), "Test fixtures must be specified.") - kernel_out = "kernel_blob.bin" + if (flutter_runtime_mode == "profile" || flutter_runtime_mode == "release") { + kernel_out = "kernel_snapshot.dill" + } else { + kernel_out = "kernel_blob.bin" + } if (defined(invoker.kernel_out)) { kernel_out = invoker.kernel_out } @@ -69,21 +75,72 @@ template("test_fixtures") { inputs = fixture_paths outputs = ["$fixtures_location/$kernel_out"] - args = [ - "--sdk-root", rebase_path("$root_out_dir/flutter_patched_sdk"), - "--target", "flutter", - "--output-dill", rebase_path("$fixtures_location/$kernel_out"), - ] + fixture_paths deps = [ "//third_party/dart/utils/kernel-service:frontend_server" ] + + if (flutter_runtime_mode == "profile" || flutter_runtime_mode == "release") { + args = [ + "--sdk-root", rebase_path("$root_out_dir/flutter_patched_sdk"), + "--strong", + "--target=flutter", + "--aot", + "--tfa", + "-Ddart.vm.product=true", + "--output-dill", rebase_path("$fixtures_location/$kernel_out"), + ] + fixture_paths + + deps += [ "//flutter/lib/snapshot:strong_platform" ] + } else { + args = [ + "--sdk-root", rebase_path("$root_out_dir/flutter_patched_sdk"), + "--target", "flutter", + "--output-dill", rebase_path("$fixtures_location/$kernel_out"), + ] + fixture_paths + } } - group(target_name) { + fixtures_aot_target_name = target_name + "_aot" + compiled_action(fixtures_aot_target_name) { testonly = true + tool = "//third_party/dart/runtime/bin:gen_snapshot" + + inputs = [ + "$fixtures_location/$kernel_out" + ] + + outputs = [ + "$fixtures_location/vm_snapshot_data", + "$fixtures_location/vm_snapshot_instr", + "$fixtures_location/isolate_snapshot_data", + "$fixtures_location/isolate_snapshot_instr", + ] + + args = [ + "--causal_async_stacks", + "--deterministic", + "--snapshot_kind=app-aot-blobs", + "--vm_snapshot_data=" + rebase_path("$fixtures_location/vm_snapshot_data"), + "--vm_snapshot_instructions=" + rebase_path("$fixtures_location/vm_snapshot_instr"), + "--isolate_snapshot_data=" + rebase_path("$fixtures_location/isolate_snapshot_data"), + "--isolate_snapshot_instructions=" + rebase_path("$fixtures_location/isolate_snapshot_instr"), + rebase_path("$fixtures_location/$kernel_out") + ] + deps = [ ":$fixtures_kernel_target_name", + ] + } + + group(target_name) { + testonly = true + deps = [ ":$fixtures_source_set_target_name", ] + if (flutter_runtime_mode == "profile" || flutter_runtime_mode == "release") { + deps += [ ":$fixtures_aot_target_name" ] + } else { + deps += [ ":$fixtures_kernel_target_name" ] + } } } From df2fc973abaa1e623adebbe64ed299b433c47352 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 15 Feb 2019 13:36:59 -0500 Subject: [PATCH 0176/1117] Roll src/third_party/skia 154acd7a1374..be9aff25bddc (13 commits) (#7842) https://skia.googlesource.com/skia.git/%2Blog/154acd7a1374..be9aff25bddc git log 154acd7a137438b2e7f0c7c1803a3e9d969e867c..be9aff25bddc3eecf84d9c37af222ea40c261cb1 --date=short --no-merges --format=%ad %ae %s 2019-02-15 robertphillips@google.com Remove GrContextPriv.h from GrRenderTargetContext.h 2019-02-14 herb@google.com Reland "Use bulk interface for paths" 2019-02-15 halcanary@google.com SkPDF: simplify subsetting code 2019-02-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src b698b62f407e..5862f084f69f (425 commits) 2019-02-15 herb@google.com Revert "Use bulk interface for paths" 2019-02-15 brianosman@google.com Add curve visualization back, guard eval 2019-02-15 herb@google.com Revert "Calculate strike in path case" 2019-02-15 bsalomon@google.com Add option to force GLSL string caching rather than program binaries. 2019-02-14 robertphillips@google.com Switch GPU blur code over to using GrRecordingContext 2019-02-15 bsalomon@google.com Add SK_API to GrContextOptions and GrContextOptions::PersistentCache 2019-02-15 bsalomon@google.com Remove unused fields related to old multitexturing TextureOp. 2019-02-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 559aaca5abd8..aead8edf8c46 (1 commits) 2019-02-14 brianosman@google.com New SkCurve type with multiple curve segments The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 94d94fc5b3a77..d2a79ea073197 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': '154acd7a137438b2e7f0c7c1803a3e9d969e867c', + 'skia_revision': 'be9aff25bddc3eecf84d9c37af222ea40c261cb1', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b67c0646e1850..fdc607c115497 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: aa69fcf66c040783f2ae8a3bc268345e +Signature: a5fd73a8d92635818c8fb0f596b19547 UNUSED LICENSES: From 1ba32955066954f7fb5bbc793a4954b529a4a8c8 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 15 Feb 2019 11:18:56 -0800 Subject: [PATCH 0177/1117] Add support for calling into other plugins from a background context on iOS (#7843) Added `FlutterPluginRegistrantCallback` typedef and optional `setPluginRegistrantCallback` static method in `FlutterPlugin`. `setPluginRegistrantCallback` is used to set a callback defined in AppDelegate.m which registers some subset of plugins with a `FlutterPluginRegistry` (for example, a headless FlutterEngine). This allows for plugins which utilize background execution functionality to enable the use of other plugins on the background isolate. This puts iOS on par with Android for background execution. Along with updated examples and Medium posts, this fixes [flutter/flutter#21925](https://github.com/flutter/flutter/issues/21925). --- .../ios/framework/Headers/FlutterPlugin.h | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h b/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h index bc6997f48b2be..4b340bf7b9e78 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h @@ -16,6 +16,17 @@ NS_ASSUME_NONNULL_BEGIN @protocol FlutterPluginRegistrar; +@protocol FlutterPluginRegistry; + +/** + * A plugin registration callback. + * + * Used for registering plugins with additional instances of + * `FlutterPluginRegistry`. + * + * @param registry The registry to register plugins with. + */ +typedef void (*FlutterPluginRegistrantCallback)(NSObject* registry); /** * Implemented by the iOS part of a Flutter plugin. @@ -44,6 +55,19 @@ NS_ASSUME_NONNULL_BEGIN */ + (void)registerWithRegistrar:(NSObject*)registrar; @optional +/** + * Set a callback for registering plugins to an additional `FlutterPluginRegistry`, + * including headless `FlutterEngine` instances. + * + * This method is typically called from within an application's `AppDelegate` at + * startup to allow for plugins which create additional `FlutterEngine` instances + * to register the application's plugins. + * + * @param callback A callback for registering some set of plugins with a + * `FlutterPluginRegistry`. + */ ++ (void)setPluginRegistrantCallback:(FlutterPluginRegistrantCallback)callback; +@optional /** * Called if this plugin has been registered to receive `FlutterMethodCall`s. * From fa38a985c4f0e754cf224af2a73b19d5c1c7019f Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 15 Feb 2019 12:35:07 -0800 Subject: [PATCH 0178/1117] Update buildroot to 7f64ff4928e to unblock Mac builds. (#7846) --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index d2a79ea073197..0e447b111a832 100644 --- a/DEPS +++ b/DEPS @@ -116,7 +116,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '4d5aa40f7424aa6bfbe0b27af1067ffd2e6ec25a', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '7f64ff4928e7106cd8d81c6397fba4b7c1cdbb96', # Fuchsia compatibility # From 2acd79480a47127545f0402d3ffea342438e24f2 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Fri, 15 Feb 2019 12:42:41 -0800 Subject: [PATCH 0179/1117] Add fml::FileExists implementation for Windows (#7845) --- fml/platform/win/file_win.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fml/platform/win/file_win.cc b/fml/platform/win/file_win.cc index dfb3d8dd36f30..bad9d052fb942 100644 --- a/fml/platform/win/file_win.cc +++ b/fml/platform/win/file_win.cc @@ -316,6 +316,10 @@ bool TruncateFile(const fml::UniqueFD& file, size_t size) { return true; } +bool FileExists(const fml::UniqueFD& base_directory, const char* path) { + return IsFile(GetAbsolutePath(base_directory, path).c_str()); +} + bool WriteAtomically(const fml::UniqueFD& base_directory, const char* file_name, const Mapping& mapping) { From 9a965bc3d9d1fae8ba13ab4915cbf2457f459b0c Mon Sep 17 00:00:00 2001 From: najeira Date: Sat, 16 Feb 2019 05:56:37 +0900 Subject: [PATCH 0180/1117] Fix NullPointerException in ResourceCleaner (#7838) --- shell/platform/android/io/flutter/view/ResourceCleaner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/android/io/flutter/view/ResourceCleaner.java b/shell/platform/android/io/flutter/view/ResourceCleaner.java index c45d2a22a4e41..babc53f6e0dfd 100644 --- a/shell/platform/android/io/flutter/view/ResourceCleaner.java +++ b/shell/platform/android/io/flutter/view/ResourceCleaner.java @@ -27,7 +27,7 @@ private class CleanTask extends AsyncTask { } boolean hasFilesToDelete() { - return mFilesToDelete.length > 0; + return mFilesToDelete != null && mFilesToDelete.length > 0; } @Override From 69e46060775ab427029fd5cc2b2ef265178faf91 Mon Sep 17 00:00:00 2001 From: najeira Date: Sat, 16 Feb 2019 06:01:41 +0900 Subject: [PATCH 0181/1117] Fix NullPointerException in SurfaceTextureRegistryEntry (#7837) --- shell/platform/android/io/flutter/view/FlutterView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index b5126c31d5418..14c4c42cefba4 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -1102,7 +1102,7 @@ final class SurfaceTextureRegistryEntry implements TextureRegistry.SurfaceTextur private SurfaceTexture.OnFrameAvailableListener onFrameListener = new SurfaceTexture.OnFrameAvailableListener() { @Override public void onFrameAvailable(SurfaceTexture texture) { - if (released) { + if (released || mNativeView == null) { // 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. From 10cee612bb1d3abeef0497329d508c2ddf760bc9 Mon Sep 17 00:00:00 2001 From: Amir Hardon Date: Fri, 15 Feb 2019 13:11:49 -0800 Subject: [PATCH 0182/1117] Delete GL textures when they are released from the texture registry. (#7836) On Android we were never deleting the textures allocated for the texture registry, which resulted in a memory leak, see: https://github.com/flutter/flutter/issues/24145 --- shell/platform/android/android_external_texture_gl.cc | 6 +++++- .../flutter/embedding/engine/renderer/FlutterRenderer.java | 2 +- shell/platform/android/io/flutter/view/FlutterView.java | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/shell/platform/android/android_external_texture_gl.cc b/shell/platform/android/android_external_texture_gl.cc index ead73ccddef79..0d21841338a37 100644 --- a/shell/platform/android/android_external_texture_gl.cc +++ b/shell/platform/android/android_external_texture_gl.cc @@ -16,7 +16,11 @@ AndroidExternalTextureGL::AndroidExternalTextureGL( const fml::jni::JavaObjectWeakGlobalRef& surfaceTexture) : Texture(id), surface_texture_(surfaceTexture), transform(SkMatrix::I()) {} -AndroidExternalTextureGL::~AndroidExternalTextureGL() = default; +AndroidExternalTextureGL::~AndroidExternalTextureGL() { + if (state_ == AttachmentState::attached) { + glDeleteTextures(1, &texture_name_); + } +} void AndroidExternalTextureGL::OnGrContextCreated() { state_ = AttachmentState::uninitialized; 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 6048cd4ab59aa..130f04d6e4551 100644 --- a/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java +++ b/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java @@ -134,8 +134,8 @@ public void release() { if (released) { return; } - unregisterTexture(id); surfaceTexture.release(); + unregisterTexture(id); released = true; } } diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 14c4c42cefba4..6fcdc0a3850b1 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -1128,11 +1128,16 @@ public void release() { return; } released = true; - mNativeView.getFlutterJNI().unregisterTexture(id); + + // The ordering of the next 3 calls is important: + // First we remove the frame listener, then we release the SurfaceTexture, and only after we unregister + // the texture which actually deletes the GL texture. + // Otherwise onFrameAvailableListener might be called after mNativeView==null // (https://github.com/flutter/flutter/issues/20951). See also the check in onFrameAvailable. surfaceTexture.setOnFrameAvailableListener(null); surfaceTexture.release(); + mNativeView.getFlutterJNI().unregisterTexture(id); } } } From 02d7ca31d8b019af3771cb5a2c6dd6b170bde5ed Mon Sep 17 00:00:00 2001 From: Todd Volkert Date: Fri, 15 Feb 2019 16:18:02 -0500 Subject: [PATCH 0183/1117] Don't call static method from instance variable (#7841) --- shell/platform/android/io/flutter/view/FlutterView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 6fcdc0a3850b1..c6927a3245711 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -26,11 +26,11 @@ import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; import io.flutter.app.FlutterPluginRegistry; +import io.flutter.embedding.engine.FlutterJNI; import io.flutter.embedding.engine.android.AndroidKeyProcessor; import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.embedding.engine.systemchannels.KeyEventChannel; import io.flutter.embedding.engine.systemchannels.LifecycleChannel; -import io.flutter.embedding.engine.systemchannels.LocalizationChannel; import io.flutter.embedding.engine.systemchannels.NavigationChannel; import io.flutter.embedding.engine.systemchannels.SettingsChannel; import io.flutter.embedding.engine.systemchannels.SystemChannel; @@ -125,7 +125,7 @@ public FlutterView(Context context, AttributeSet attrs, FlutterNativeView native mNativeView = nativeView; } dartExecutor = new DartExecutor(mNativeView.getFlutterJNI()); - mIsSoftwareRenderingEnabled = mNativeView.getFlutterJNI().nativeGetIsSoftwareRenderingEnabled(); + mIsSoftwareRenderingEnabled = FlutterJNI.nativeGetIsSoftwareRenderingEnabled(); mAnimationScaleObserver = new AnimationScaleObserver(new Handler()); mMetrics = new ViewportMetrics(); mMetrics.devicePixelRatio = context.getResources().getDisplayMetrics().density; From 256db4bc23b7931509233df0dc04e44e16608229 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Fri, 15 Feb 2019 13:45:24 -0800 Subject: [PATCH 0184/1117] Android embedding refactor pr3 add remaining systemchannels (#7738) --- ci/licenses_golden/licenses_flutter | 2 + shell/platform/android/BUILD.gn | 2 + .../systemchannels/AccessibilityChannel.java | 120 ++++ .../systemchannels/LocalizationChannel.java | 23 +- .../systemchannels/PlatformChannel.java | 597 +++++++++++++++++- .../systemchannels/TextInputChannel.java | 406 ++++++++++++ .../editing/InputConnectionAdaptor.java | 58 +- .../plugin/editing/TextInputPlugin.java | 181 +++--- .../plugin/platform/PlatformPlugin.java | 375 +++++------ .../io/flutter/view/AccessibilityBridge.java | 294 ++++----- .../android/io/flutter/view/FlutterView.java | 74 +-- 11 files changed, 1570 insertions(+), 562 deletions(-) create mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java create mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 761a54549f62f..8696116e1a11d 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -446,6 +446,7 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/D 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/engine/systemchannels/AccessibilityChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/KeyEventChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/LifecycleChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java @@ -453,6 +454,7 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/system FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/SettingsChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/SystemChannel.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.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 diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index 37002cf5fd4eb..73e9b462b4b48 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -114,6 +114,7 @@ java_library("flutter_shell_java") { "io/flutter/embedding/engine/dart/PlatformMessageHandler.java", "io/flutter/embedding/engine/renderer/FlutterRenderer.java", "io/flutter/embedding/engine/renderer/OnFirstFrameRenderedListener.java", + "io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java", "io/flutter/embedding/engine/systemchannels/KeyEventChannel.java", "io/flutter/embedding/engine/systemchannels/LifecycleChannel.java", "io/flutter/embedding/engine/systemchannels/LocalizationChannel.java", @@ -121,6 +122,7 @@ java_library("flutter_shell_java") { "io/flutter/embedding/engine/systemchannels/PlatformChannel.java", "io/flutter/embedding/engine/systemchannels/SettingsChannel.java", "io/flutter/embedding/engine/systemchannels/SystemChannel.java", + "io/flutter/embedding/engine/systemchannels/TextInputChannel.java", "io/flutter/plugin/common/ActivityLifecycleListener.java", "io/flutter/plugin/common/BasicMessageChannel.java", "io/flutter/plugin/common/BinaryCodec.java", diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java new file mode 100644 index 0000000000000..4bfcd37973b58 --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java @@ -0,0 +1,120 @@ +package io.flutter.embedding.engine.systemchannels; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; + +import java.util.HashMap; + +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.plugin.common.BasicMessageChannel; +import io.flutter.plugin.common.StandardMessageCodec; + +/** + * System channel that sends accessibility requests and events from Flutter to Android. + *

+ * See {@link AccessibilityMessageHandler}, which lists all accessibility requests and + * events that might be sent from Flutter to the Android platform. + */ +public class AccessibilityChannel { + @NonNull + public BasicMessageChannel channel; + @Nullable + private AccessibilityMessageHandler handler; + + private final BasicMessageChannel.MessageHandler parsingMessageHandler = new BasicMessageChannel.MessageHandler() { + @Override + public void onMessage(Object message, BasicMessageChannel.Reply reply) { + // If there is no handler to respond to this message then we don't need to + // parse it. Return. + if (handler == null) { + return; + } + + @SuppressWarnings("unchecked") + final HashMap annotatedEvent = (HashMap) message; + final String type = (String) annotatedEvent.get("type"); + @SuppressWarnings("unchecked") + final HashMap data = (HashMap) annotatedEvent.get("data"); + + switch (type) { + case "announce": + String announceMessage = (String) data.get("message"); + if (announceMessage != null) { + handler.announce(announceMessage); + } + break; + case "tap": { + Integer nodeId = (Integer) annotatedEvent.get("nodeId"); + if (nodeId != null) { + handler.onTap(nodeId); + } + break; + } + case "longPress": { + Integer nodeId = (Integer) annotatedEvent.get("nodeId"); + if (nodeId != null) { + handler.onLongPress(nodeId); + } + break; + } + case "tooltip": { + String tooltipMessage = (String) data.get("message"); + if (tooltipMessage != null) { + handler.onTooltip(tooltipMessage); + } + break; + } + } + } + }; + + /** + * Constructs an {@code AccessibilityChannel} that connects Android to the Dart code + * running in {@code dartExecutor}. + * + * The given {@code dartExecutor} is permitted to be idle or executing code. + * + * See {@link DartExecutor}. + */ + public AccessibilityChannel(@NonNull DartExecutor dartExecutor) { + channel = new BasicMessageChannel<>(dartExecutor, "flutter/accessibility", StandardMessageCodec.INSTANCE); + channel.setMessageHandler(parsingMessageHandler); + } + + /** + * Sets the {@link AccessibilityMessageHandler} which receives all events and requests + * that are parsed from the underlying accessibility channel. + */ + public void setAccessibilityMessageHandler(@Nullable AccessibilityMessageHandler handler) { + this.handler = handler; + } + + /** + * Handler that receives accessibility messages sent from Flutter to Android + * through a given {@link AccessibilityChannel}. + * + * To register an {@code AccessibilityMessageHandler} with a {@link AccessibilityChannel}, + * see {@link AccessibilityChannel#setAccessibilityMessageHandler(AccessibilityMessageHandler)}. + */ + public interface AccessibilityMessageHandler { + /** + * The Dart application would like the given {@code message} to be announced. + */ + void announce(@NonNull String message); + + /** + * The user has tapped on the artifact with the given {@code nodeId}. + */ + void onTap(int nodeId); + + /** + * The user has long pressed on the artifact with the given {@code nodeId}. + */ + void onLongPress(int nodeId); + + /** + * The user has opened a popup window, menu, dialog, etc. + */ + void onTooltip(@NonNull String message); + } +} diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java index ffb8f1f84a155..52e4fbb46171d 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java @@ -6,14 +6,17 @@ import android.support.annotation.NonNull; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; +import java.util.Locale; import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.plugin.common.JSONMethodCodec; import io.flutter.plugin.common.MethodChannel; /** - * TODO(mattcarroll): fill in javadoc for LocalizationChannel. + * Sends the platform's locales to Dart. */ public class LocalizationChannel { @@ -24,12 +27,18 @@ public LocalizationChannel(@NonNull DartExecutor dartExecutor) { this.channel = new MethodChannel(dartExecutor, "flutter/localization", JSONMethodCodec.INSTANCE); } - public void setLocale(String language, String country) { - channel.invokeMethod("setLocale", Arrays.asList(language, country)); - } - - public void setMethodCallHandler(MethodChannel.MethodCallHandler handler) { - channel.setMethodCallHandler(handler); + /** + * Send the given {@code locales} to Dart. + */ + public void sendLocales(List locales) { + List data = new ArrayList<>(); + for (Locale locale : locales) { + data.add(locale.getLanguage()); + data.add(locale.getCountry()); + data.add(locale.getScript()); + data.add(locale.getVariant()); + } + channel.invokeMethod("setLocale", data); } } diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java index b1ceb82b7a74d..44269313bb983 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java @@ -4,26 +4,613 @@ package io.flutter.embedding.engine.systemchannels; +import android.content.pm.ActivityInfo; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.List; + import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.plugin.common.JSONMethodCodec; +import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; /** - * TODO(mattcarroll): fill in javadoc for PlatformChannel. + * System channel that receives requests for host platform behavior, e.g., haptic and sound + * effects, system chrome configurations, and clipboard interaction. */ public class PlatformChannel { - + @NonNull public final MethodChannel channel; + @Nullable + private PlatformMessageHandler platformMessageHandler; + + private final MethodChannel.MethodCallHandler parsingMethodCallHandler = new MethodChannel.MethodCallHandler() { + @Override + public void onMethodCall(MethodCall call, MethodChannel.Result result) { + if (platformMessageHandler == null) { + // If no explicit PlatformMessageHandler has been registered then we don't + // need to forward this call to an API. Return. + return; + } + + String method = call.method; + Object arguments = call.arguments; + try { + switch (method) { + case "SystemSound.play": + try { + SoundType soundType = SoundType.fromValue((String) arguments); + platformMessageHandler.playSystemSound(soundType); + result.success(null); + } catch (NoSuchFieldException exception) { + // The desired sound type does not exist. + result.error("error", exception.getMessage(), null); + } + break; + case "HapticFeedback.vibrate": + try { + HapticFeedbackType feedbackType = HapticFeedbackType.fromValue((String) arguments); + platformMessageHandler.vibrateHapticFeedback(feedbackType); + result.success(null); + } catch (NoSuchFieldException exception) { + // The desired feedback type does not exist. + result.error("error", exception.getMessage(), null); + } + break; + case "SystemChrome.setPreferredOrientations": + try { + int androidOrientation = decodeOrientations((JSONArray) arguments); + platformMessageHandler.setPreferredOrientations(androidOrientation); + result.success(null); + } catch (JSONException | NoSuchFieldException exception) { + // JSONException: One or more expected fields were either omitted or referenced an invalid type. + // NoSuchFieldException: One or more expected fields were either omitted or referenced an invalid type. + result.error("error", exception.getMessage(), null); + } + break; + case "SystemChrome.setApplicationSwitcherDescription": + try { + AppSwitcherDescription description = decodeAppSwitcherDescription((JSONObject) arguments); + platformMessageHandler.setApplicationSwitcherDescription(description); + result.success(null); + } catch (JSONException exception) { + // One or more expected fields were either omitted or referenced an invalid type. + result.error("error", exception.getMessage(), null); + } + break; + case "SystemChrome.setEnabledSystemUIOverlays": + try { + List overlays = decodeSystemUiOverlays((JSONArray) arguments); + platformMessageHandler.showSystemOverlays(overlays); + result.success(null); + } catch (JSONException | NoSuchFieldException exception) { + // JSONException: One or more expected fields were either omitted or referenced an invalid type. + // NoSuchFieldException: One or more of the overlay names are invalid. + result.error("error", exception.getMessage(), null); + } + break; + case "SystemChrome.restoreSystemUIOverlays": + platformMessageHandler.restoreSystemUiOverlays(); + result.success(null); + break; + case "SystemChrome.setSystemUIOverlayStyle": + try { + SystemChromeStyle systemChromeStyle = decodeSystemChromeStyle((JSONObject) arguments); + platformMessageHandler.setSystemUiOverlayStyle(systemChromeStyle); + result.success(null); + } catch (JSONException | NoSuchFieldException exception) { + // JSONException: One or more expected fields were either omitted or referenced an invalid type. + // NoSuchFieldException: One or more of the brightness names are invalid. + result.error("error", exception.getMessage(), null); + } + break; + case "SystemNavigator.pop": + platformMessageHandler.popSystemNavigator(); + result.success(null); + break; + case "Clipboard.getData": { + String contentFormatName = (String) arguments; + ClipboardContentFormat clipboardFormat = null; + if (contentFormatName != null) { + try { + clipboardFormat = ClipboardContentFormat.fromValue(contentFormatName); + } catch (NoSuchFieldException exception) { + // An unsupported content format was requested. Return failure. + result.error("error", "No such clipboard content format: " + contentFormatName, null); + } + } + CharSequence clipboardContent = platformMessageHandler.getClipboardData(clipboardFormat); + if (clipboardContent != null) { + JSONObject response = new JSONObject(); + response.put("text", clipboardContent); + result.success(response); + } else { + result.success(null); + } + break; + } + case "Clipboard.setData": { + String clipboardContent = ((JSONObject) arguments).getString("text"); + platformMessageHandler.setClipboardData(clipboardContent); + result.success(null); + break; + } + default: + result.notImplemented(); + break; + } + } catch (JSONException e) { + result.error("error", "JSON error: " + e.getMessage(), null); + } + } + }; + + /** + * Constructs a {@code PlatformChannel} that connects Android to the Dart code + * running in {@code dartExecutor}. + * + * The given {@code dartExecutor} is permitted to be idle or executing code. + * + * See {@link DartExecutor}. + */ public PlatformChannel(@NonNull DartExecutor dartExecutor) { - this.channel = new MethodChannel(dartExecutor, "flutter/platform", JSONMethodCodec.INSTANCE); + channel = new MethodChannel(dartExecutor, "flutter/platform", JSONMethodCodec.INSTANCE); + channel.setMethodCallHandler(parsingMethodCallHandler); + } + + /** + * Sets the {@link PlatformMessageHandler} which receives all events and requests + * that are parsed from the underlying platform channel. + */ + public void setPlatformMessageHandler(@Nullable PlatformMessageHandler platformMessageHandler) { + this.platformMessageHandler = platformMessageHandler; + } + + // TODO(mattcarroll): add support for IntDef annotations, then add @ScreenOrientation + + /** + * Decodes a series of orientations to an aggregate desired orientation. + * + * @throws JSONException if {@code encodedOrientations} does not contain expected keys and value types. + * @throws NoSuchFieldException if any given encoded orientation is not a valid orientation name. + */ + private int decodeOrientations(@NonNull JSONArray encodedOrientations) throws JSONException, NoSuchFieldException { + int requestedOrientation = 0x00; + int firstRequestedOrientation = 0x00; + for (int index = 0; index < encodedOrientations.length(); index += 1) { + String encodedOrientation = encodedOrientations.getString(index); + DeviceOrientation orientation = DeviceOrientation.fromValue(encodedOrientation); + + switch (orientation) { + case PORTRAIT_UP: + requestedOrientation |= 0x01; + break; + case PORTRAIT_DOWN: + requestedOrientation |= 0x04; + break; + case LANDSCAPE_LEFT: + requestedOrientation |= 0x02; + break; + case LANDSCAPE_RIGHT: + requestedOrientation |= 0x08; + break; + } + + if (firstRequestedOrientation == 0x00) { + firstRequestedOrientation = requestedOrientation; + } + } + + switch (requestedOrientation) { + case 0x00: + return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; + case 0x01: + return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; + case 0x02: + return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; + case 0x04: + return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; + case 0x05: + return ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT; + case 0x08: + return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; + case 0x0a: + return ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE; + case 0x0b: + return ActivityInfo.SCREEN_ORIENTATION_USER; + case 0x0f: + return ActivityInfo.SCREEN_ORIENTATION_FULL_USER; + case 0x03: // portraitUp and landscapeLeft + case 0x06: // portraitDown and landscapeLeft + case 0x07: // portraitUp, portraitDown, and landscapeLeft + case 0x09: // portraitUp and landscapeRight + case 0x0c: // portraitDown and landscapeRight + case 0x0d: // portraitUp, portraitDown, and landscapeRight + case 0x0e: // portraitDown, landscapeLeft, and landscapeRight + // Android can't describe these cases, so just default to whatever the first + // specified value was. + switch (firstRequestedOrientation) { + case 0x01: + return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; + case 0x02: + return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; + case 0x04: + return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; + case 0x08: + return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; + } + } + + // Execution should never get this far, but if it does then we default + // to a portrait orientation. + return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; + } + + private AppSwitcherDescription decodeAppSwitcherDescription(@NonNull JSONObject encodedDescription) throws JSONException { + int color = encodedDescription.getInt("primaryColor"); + if (color != 0) { // 0 means color isn't set, use system default + color = color | 0xFF000000; // color must be opaque if set + } + String label = encodedDescription.getString("label"); + return new AppSwitcherDescription(color, label); + } + + /** + * Decodes a list of JSON-encoded overlays to a list of {@link SystemUiOverlay}. + * + * @throws JSONException if {@code encodedSystemUiOverlay} does not contain expected keys and value types. + * @throws NoSuchFieldException if any of the given encoded overlay names are invalid. + */ + private List decodeSystemUiOverlays(@NonNull JSONArray encodedSystemUiOverlay) throws JSONException, NoSuchFieldException { + List overlays = new ArrayList<>(); + for (int i = 0; i < encodedSystemUiOverlay.length(); ++i) { + String encodedOverlay = encodedSystemUiOverlay.getString(i); + SystemUiOverlay overlay = SystemUiOverlay.fromValue(encodedOverlay); + switch(overlay) { + case TOP_OVERLAYS: + overlays.add(SystemUiOverlay.TOP_OVERLAYS); + break; + case BOTTOM_OVERLAYS: + overlays.add(SystemUiOverlay.BOTTOM_OVERLAYS); + break; + } + } + return overlays; + } + + /** + * Decodes a JSON-encoded {@code encodedStyle} to a {@link SystemChromeStyle}. + * + * @throws JSONException if {@code encodedStyle} does not contain expected keys and value types. + * @throws NoSuchFieldException if any provided brightness name is invalid. + */ + private SystemChromeStyle decodeSystemChromeStyle(@NonNull JSONObject encodedStyle) throws JSONException, NoSuchFieldException { + Brightness systemNavigationBarIconBrightness = null; + // TODO(mattcarroll): add color annotation + Integer systemNavigationBarColor = null; + // TODO(mattcarroll): add color annotation + Integer systemNavigationBarDividerColor = null; + Brightness statusBarIconBrightness = null; + // TODO(mattcarroll): add color annotation + Integer statusBarColor = null; + + if (!encodedStyle.isNull("systemNavigationBarIconBrightness")) { + systemNavigationBarIconBrightness = Brightness.fromValue(encodedStyle.getString("systemNavigationBarIconBrightness")); + } + + if (!encodedStyle.isNull("systemNavigationBarColor")) { + systemNavigationBarColor = encodedStyle.getInt("systemNavigationBarColor"); + } + + if (!encodedStyle.isNull("statusBarIconBrightness")) { + statusBarIconBrightness = Brightness.fromValue(encodedStyle.getString("statusBarIconBrightness")); + } + + if (!encodedStyle.isNull("statusBarColor")) { + statusBarColor = encodedStyle.getInt("statusBarColor"); + } + + if (!encodedStyle.isNull("systemNavigationBarDividerColor")) { + systemNavigationBarDividerColor = encodedStyle.getInt("systemNavigationBarDividerColor"); + } + + return new SystemChromeStyle( + statusBarColor, + statusBarIconBrightness, + systemNavigationBarColor, + systemNavigationBarIconBrightness, + systemNavigationBarDividerColor + ); } - public void setMethodCallHandler(@Nullable MethodChannel.MethodCallHandler handler) { - channel.setMethodCallHandler(handler); + /** + * Handler that receives platform messages sent from Flutter to Android + * through a given {@link PlatformChannel}. + * + * To register a {@code PlatformMessageHandler} with a {@link PlatformChannel}, + * see {@link PlatformChannel#setPlatformMessageHandler(PlatformMessageHandler)}. + */ + public interface PlatformMessageHandler { + /** + * The Flutter application would like to play the given {@code soundType}. + */ + void playSystemSound(@NonNull SoundType soundType); + + /** + * The Flutter application would like to play the given haptic {@code feedbackType}. + */ + void vibrateHapticFeedback(@NonNull HapticFeedbackType feedbackType); + + /** + * The Flutter application would like to display in the given {@code androidOrientation}. + */ + // TODO(mattcarroll): add @ScreenOrientation annotation + void setPreferredOrientations(int androidOrientation); + + /** + * The Flutter application would like to be displayed in Android's app switcher with + * the visual representation described in the given {@code description}. + *

+ * See the related Android documentation: + * https://developer.android.com/guide/components/activities/recents + */ + void setApplicationSwitcherDescription(@NonNull AppSwitcherDescription description); + + /** + * The Flutter application would like the Android system to display the given + * {@code overlays}. + *

+ * {@link SystemUiOverlay#TOP_OVERLAYS} refers to system overlays such as the + * status bar, while {@link SystemUiOverlay#BOTTOM_OVERLAYS} refers to system + * overlays such as the back/home/recents navigation on the bottom of the screen. + *

+ * An empty list of {@code overlays} should hide all system overlays. + */ + void showSystemOverlays(@NonNull List overlays); + + /** + * The Flutter application would like to restore the visibility of system + * overlays to the last set of overlays sent via {@link #showSystemOverlays(List)}. + *

+ * If {@link #showSystemOverlays(List)} has yet to be called, then a default + * system overlay appearance is desired: + *

+ * {@code + * View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + * } + */ + void restoreSystemUiOverlays(); + + /** + * The Flutter application would like the system chrome to present itself with + * the given {@code systemUiOverlayStyle}, i.e., the given status bar and + * navigation bar colors and brightness. + */ + void setSystemUiOverlayStyle(@NonNull SystemChromeStyle systemUiOverlayStyle); + + /** + * The Flutter application would like to pop the top item off of the Android + * app's navigation back stack. + */ + void popSystemNavigator(); + + /** + * The Flutter application would like to receive the current data in the + * clipboard and have it returned in the given {@code format}. + */ + @Nullable + CharSequence getClipboardData(@Nullable ClipboardContentFormat format); + + /** + * The Flutter application would like to set the current data in the + * clipboard to the given {@code text}. + */ + void setClipboardData(@NonNull String text); } + /** + * Types of sounds the Android OS can play on behalf of an application. + */ + public enum SoundType { + CLICK("SoundType.click"); + + static SoundType fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (SoundType soundType : SoundType.values()) { + if (soundType.encodedName.equals(encodedName)) { + return soundType; + } + } + throw new NoSuchFieldException("No such SoundType: " + encodedName); + } + + @NonNull + private final String encodedName; + + SoundType(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * The types of haptic feedback that the Android OS can generate on behalf + * of an application. + */ + public enum HapticFeedbackType { + STANDARD(null), + LIGHT_IMPACT("HapticFeedbackType.lightImpact"), + MEDIUM_IMPACT("HapticFeedbackType.mediumImpact"), + HEAVY_IMPACT("HapticFeedbackType.heavyImpact"), + SELECTION_CLICK("HapticFeedbackType.selectionClick"); + + static HapticFeedbackType fromValue(@Nullable String encodedName) throws NoSuchFieldException { + for (HapticFeedbackType feedbackType : HapticFeedbackType.values()) { + if ((feedbackType.encodedName == null && encodedName == null) + || (feedbackType.encodedName != null && feedbackType.encodedName.equals(encodedName))) { + return feedbackType; + } + } + throw new NoSuchFieldException("No such HapticFeedbackType: " + encodedName); + } + + @Nullable + private final String encodedName; + + HapticFeedbackType(@Nullable String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * The possible desired orientations of a Flutter application. + */ + public enum DeviceOrientation { + PORTRAIT_UP("DeviceOrientation.portraitUp"), + PORTRAIT_DOWN("DeviceOrientation.portraitDown"), + LANDSCAPE_LEFT("DeviceOrientation.landscapeLeft"), + LANDSCAPE_RIGHT("DeviceOrientation.landscapeRight"); + + static DeviceOrientation fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (DeviceOrientation orientation : DeviceOrientation.values()) { + if (orientation.encodedName.equals(encodedName)) { + return orientation; + } + } + throw new NoSuchFieldException("No such DeviceOrientation: " + encodedName); + } + + @NonNull + private String encodedName; + + DeviceOrientation(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * The set of Android system UI overlays as perceived by the Flutter application. + *

+ * Android includes many more overlay options and flags than what is provided by + * {@code SystemUiOverlay}. Flutter only requires control over a subset of the + * overlays and those overlays are represented by {@code SystemUiOverlay} values. + */ + public enum SystemUiOverlay { + TOP_OVERLAYS("SystemUiOverlay.top"), + BOTTOM_OVERLAYS("SystemUiOverlay.bottom"); + + static SystemUiOverlay fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (SystemUiOverlay overlay : SystemUiOverlay.values()) { + if (overlay.encodedName.equals(encodedName)) { + return overlay; + } + } + throw new NoSuchFieldException("No such SystemUiOverlay: " + encodedName); + } + + @NonNull + private String encodedName; + + SystemUiOverlay(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * The color and label of an application that appears in Android's app switcher, AKA + * recents screen. + */ + public static class AppSwitcherDescription { + // TODO(mattcarroll): add color annotation + public final int color; + @NonNull + public final String label; + + public AppSwitcherDescription(int color, @NonNull String label) { + this.color = color; + this.label = label; + } + } + + /** + * The color and brightness of system chrome, e.g., status bar and system navigation bar. + */ + public static class SystemChromeStyle { + // TODO(mattcarroll): add color annotation + @Nullable + public final Integer statusBarColor; + @Nullable + public final Brightness statusBarIconBrightness; + // TODO(mattcarroll): add color annotation + @Nullable + public final Integer systemNavigationBarColor; + @Nullable + public final Brightness systemNavigationBarIconBrightness; + // TODO(mattcarroll): add color annotation + @Nullable + public final Integer systemNavigationBarDividerColor; + + public SystemChromeStyle( + @Nullable Integer statusBarColor, + @Nullable Brightness statusBarIconBrightness, + @Nullable Integer systemNavigationBarColor, + @Nullable Brightness systemNavigationBarIconBrightness, + @Nullable Integer systemNavigationBarDividerColor + ) { + this.statusBarColor = statusBarColor; + this.statusBarIconBrightness = statusBarIconBrightness; + this.systemNavigationBarColor = systemNavigationBarColor; + this.systemNavigationBarIconBrightness = systemNavigationBarIconBrightness; + this.systemNavigationBarDividerColor = systemNavigationBarDividerColor; + } + } + + public enum Brightness { + LIGHT("Brightness.light"), + DARK("Brightness.dark"); + + static Brightness fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (Brightness brightness : Brightness.values()) { + if (brightness.encodedName.equals(encodedName)) { + return brightness; + } + } + throw new NoSuchFieldException("No such Brightness: " + encodedName); + } + + @NonNull + private String encodedName; + + Brightness(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * Data formats of clipboard content. + */ + public enum ClipboardContentFormat { + PLAIN_TEXT("text/plain"); + + static ClipboardContentFormat fromValue(String encodedName) throws NoSuchFieldException { + for (ClipboardContentFormat format : ClipboardContentFormat.values()) { + if (format.encodedName.equals(encodedName)) { + return format; + } + } + throw new NoSuchFieldException("No such ClipboardContentFormat: " + encodedName); + } + + @NonNull + private String encodedName; + + ClipboardContentFormat(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } } diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java new file mode 100644 index 0000000000000..fc4b75521549d --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java @@ -0,0 +1,406 @@ +package io.flutter.embedding.engine.systemchannels; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.view.inputmethod.EditorInfo; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.Arrays; +import java.util.HashMap; + +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.plugin.common.JSONMethodCodec; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; + +/** + * {@link TextInputChannel} is a platform channel between Android and Flutter that is used to + * communicate information about the user's text input. + *

+ * When the user presses an action button like "done" or "next", that action is sent from Android + * to Flutter through this {@link TextInputChannel}. + *

+ * When an input system in the Flutter app wants to show the keyboard, or hide it, or configure + * editing state, etc. a message is sent from Flutter to Android through this {@link TextInputChannel}. + *

+ * {@link TextInputChannel} comes with a default {@link io.flutter.plugin.common.MethodChannel.MethodCallHandler} + * that parses incoming messages from Flutter. Register a {@link TextInputMethodHandler} to respond + * to standard Flutter text input messages. + */ +public class TextInputChannel { + @NonNull + public final MethodChannel channel; + @Nullable + private TextInputMethodHandler textInputMethodHandler; + + private final MethodChannel.MethodCallHandler parsingMethodHandler = new MethodChannel.MethodCallHandler() { + @Override + public void onMethodCall(MethodCall call, MethodChannel.Result result) { + if (textInputMethodHandler == null) { + // If no explicit TextInputMethodHandler has been registered then we don't + // need to forward this call to an API. Return. + return; + } + + String method = call.method; + Object args = call.arguments; + switch (method) { + case "TextInput.show": + textInputMethodHandler.show(); + result.success(null); + break; + case "TextInput.hide": + textInputMethodHandler.hide(); + result.success(null); + break; + case "TextInput.setClient": + try { + final JSONArray argumentList = (JSONArray) args; + final int textInputClientId = argumentList.getInt(0); + final JSONObject jsonConfiguration = argumentList.getJSONObject(1); + textInputMethodHandler.setClient(textInputClientId, Configuration.fromJson(jsonConfiguration)); + result.success(null); + } catch (JSONException | NoSuchFieldException exception) { + // JSONException: missing keys or bad value types. + // NoSuchFieldException: one or more values were invalid. + result.error("error", exception.getMessage(), null); + } + break; + case "TextInput.setEditingState": + try { + final JSONObject editingState = (JSONObject) args; + textInputMethodHandler.setEditingState(TextEditState.fromJson(editingState)); + result.success(null); + } catch (JSONException exception) { + result.error("error", exception.getMessage(), null); + } + break; + case "TextInput.clearClient": + textInputMethodHandler.clearClient(); + result.success(null); + break; + default: + result.notImplemented(); + break; + } + } + }; + + /** + * Constructs a {@code TextInputChannel} that connects Android to the Dart code + * running in {@code dartExecutor}. + * + * The given {@code dartExecutor} is permitted to be idle or executing code. + * + * See {@link DartExecutor}. + */ + public TextInputChannel(@NonNull DartExecutor dartExecutor) { + this.channel = new MethodChannel(dartExecutor, "flutter/textinput", JSONMethodCodec.INSTANCE); + channel.setMethodCallHandler(parsingMethodHandler); + } + + /** + * Instructs Flutter to update its text input editing state to reflect the given configuration. + */ + public void updateEditingState(int inputClientId, String text, int selectionStart, int selectionEnd, int composingStart, int composingEnd) { + HashMap state = new HashMap<>(); + state.put("text", text); + state.put("selectionBase", selectionStart); + state.put("selectionExtent", selectionEnd); + state.put("composingBase", composingStart); + state.put("composingExtent", composingEnd); + + channel.invokeMethod( + "TextInputClient.updateEditingState", + Arrays.asList(inputClientId, state) + ); + } + + /** + * Instructs Flutter to execute a "newline" action. + */ + public void newline(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.newline") + ); + } + + /** + * Instructs Flutter to execute a "go" action. + */ + public void go(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.go") + ); + } + + /** + * Instructs Flutter to execute a "search" action. + */ + public void search(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.search") + ); + } + + /** + * Instructs Flutter to execute a "send" action. + */ + public void send(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.send") + ); + } + + /** + * Instructs Flutter to execute a "done" action. + */ + public void done(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.done") + ); + } + + /** + * Instructs Flutter to execute a "next" action. + */ + public void next(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.next") + ); + } + + /** + * Instructs Flutter to execute a "previous" action. + */ + public void previous(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.previous") + ); + } + + /** + * Instructs Flutter to execute an "unspecified" action. + */ + public void unspecifiedAction(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.unspecified") + ); + } + + /** + * Sets the {@link TextInputMethodHandler} which receives all events and requests + * that are parsed from the underlying platform channel. + */ + public void setTextInputMethodHandler(@Nullable TextInputMethodHandler textInputMethodHandler) { + this.textInputMethodHandler = textInputMethodHandler; + } + + public interface TextInputMethodHandler { + // TODO(mattcarroll): javadoc + void show(); + + // TODO(mattcarroll): javadoc + void hide(); + + // TODO(mattcarroll): javadoc + void setClient(int textInputClientId, @NonNull Configuration configuration); + + // TODO(mattcarroll): javadoc + void setEditingState(@NonNull TextEditState editingState); + + // TODO(mattcarroll): javadoc + void clearClient(); + } + + /** + * A text editing configuration. + */ + public static class Configuration { + public static Configuration fromJson(@NonNull JSONObject json) throws JSONException, NoSuchFieldException { + final String inputActionName = json.getString("inputAction"); + if (inputActionName == null) { + throw new JSONException("Configuration JSON missing 'inputAction' property."); + } + + final Integer inputAction = inputActionFromTextInputAction(inputActionName); + return new Configuration( + json.optBoolean("obscureText"), + json.optBoolean("autocorrect", true), + TextCapitalization.fromValue(json.getString("textCapitalization")), + InputType.fromJson(json.getJSONObject("inputType")), + inputAction, + json.optString("actionLabel") + ); + } + + private static Integer inputActionFromTextInputAction(@NonNull String inputAction) { + switch (inputAction) { + case "TextInputAction.newline": + return EditorInfo.IME_ACTION_NONE; + case "TextInputAction.none": + return EditorInfo.IME_ACTION_NONE; + case "TextInputAction.unspecified": + return EditorInfo.IME_ACTION_UNSPECIFIED; + case "TextInputAction.done": + return EditorInfo.IME_ACTION_DONE; + case "TextInputAction.go": + return EditorInfo.IME_ACTION_GO; + case "TextInputAction.search": + return EditorInfo.IME_ACTION_SEARCH; + case "TextInputAction.send": + return EditorInfo.IME_ACTION_SEND; + case "TextInputAction.next": + return EditorInfo.IME_ACTION_NEXT; + case "TextInputAction.previous": + return EditorInfo.IME_ACTION_PREVIOUS; + default: + // Present default key if bad input type is given. + return EditorInfo.IME_ACTION_UNSPECIFIED; + } + } + + public final boolean obscureText; + public final boolean autocorrect; + @NonNull + public final TextCapitalization textCapitalization; + @NonNull + public final InputType inputType; + @Nullable + public final Integer inputAction; + @Nullable + public final String actionLabel; + + public Configuration( + boolean obscureText, + boolean autocorrect, + @NonNull TextCapitalization textCapitalization, + @NonNull InputType inputType, + @Nullable Integer inputAction, + @Nullable String actionLabel + ) { + this.obscureText = obscureText; + this.autocorrect = autocorrect; + this.textCapitalization = textCapitalization; + this.inputType = inputType; + this.inputAction = inputAction; + this.actionLabel = actionLabel; + } + } + + /** + * A text input type. + * + * If the {@link #type} is {@link TextInputType#NUMBER}, this {@code InputType} also + * reports whether that number {@link #isSigned} and {@link #isDecimal}. + */ + public static class InputType { + @NonNull + public static InputType fromJson(@NonNull JSONObject json) throws JSONException, NoSuchFieldException { + return new InputType( + TextInputType.fromValue(json.getString("name")), + json.optBoolean("signed", false), + json.optBoolean("decimal", false) + ); + } + + @NonNull + public final TextInputType type; + public final boolean isSigned; + public final boolean isDecimal; + + public InputType(@NonNull TextInputType type, boolean isSigned, boolean isDecimal) { + this.type = type; + this.isSigned = isSigned; + this.isDecimal = isDecimal; + } + } + + /** + * Types of text input. + */ + public enum TextInputType { + DATETIME("TextInputType.datetime"), + NUMBER("TextInputType.number"), + PHONE("TextInputType.phone"), + MULTILINE("TextInputType.multiline"), + EMAIL_ADDRESS("TextInputType.emailAddress"), + URL("TextInputType.url"); + + static TextInputType fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (TextInputType textInputType : TextInputType.values()) { + if (textInputType.encodedName.equals(encodedName)) { + return textInputType; + } + } + throw new NoSuchFieldException("No such TextInputType: " + encodedName); + } + + @NonNull + private final String encodedName; + + TextInputType(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * Text capitalization schemes. + */ + public enum TextCapitalization { + CHARACTERS("TextCapitalization.characters"), + WORDS("TextCapitalization.words"), + SENTENCES("TextCapitalization.sentences"); + + static TextCapitalization fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (TextCapitalization textCapitalization : TextCapitalization.values()) { + if (textCapitalization.encodedName.equals(encodedName)) { + return textCapitalization; + } + } + throw new NoSuchFieldException("No such TextCapitalization: " + encodedName); + } + + @NonNull + private final String encodedName; + + TextCapitalization(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * State of an on-going text editing session. + */ + public static class TextEditState { + public static TextEditState fromJson(@NonNull JSONObject textEditState) throws JSONException { + return new TextEditState( + textEditState.getString("text"), + textEditState.getInt("selectionBase"), + textEditState.getInt("selectionExtent") + ); + } + + @NonNull + public final String text; + public final int selectionStart; + public final int selectionEnd; + + public TextEditState(@NonNull String text, int selectionStart, int selectionEnd) { + this.text = text; + this.selectionStart = selectionStart; + this.selectionEnd = selectionEnd; + } + } +} diff --git a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java index df907be0b70a1..b3a287820bfe9 100644 --- a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java +++ b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java @@ -11,17 +11,16 @@ import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; + +import io.flutter.embedding.engine.systemchannels.TextInputChannel; import io.flutter.plugin.common.ErrorLogResult; import io.flutter.plugin.common.MethodChannel; import io.flutter.view.FlutterView; -import java.util.Arrays; -import java.util.HashMap; - class InputConnectionAdaptor extends BaseInputConnection { private final FlutterView mFlutterView; private final int mClient; - private final MethodChannel mFlutterChannel; + private final TextInputChannel textInputChannel; private final Editable mEditable; private int mBatchCount; private InputMethodManager mImm; @@ -29,12 +28,16 @@ class InputConnectionAdaptor extends BaseInputConnection { private static final MethodChannel.Result logger = new ErrorLogResult("FlutterTextInput"); - public InputConnectionAdaptor(FlutterView view, int client, - MethodChannel flutterChannel, Editable editable) { + public InputConnectionAdaptor( + FlutterView view, + int client, + TextInputChannel textInputChannel, + Editable editable + ) { super(view, true); mFlutterView = view; mClient = client; - mFlutterChannel = flutterChannel; + this.textInputChannel = textInputChannel; mEditable = editable; mBatchCount = 0; mImm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); @@ -55,14 +58,14 @@ private void updateEditingState() { selectionStart, selectionEnd, composingStart, composingEnd); - HashMap state = new HashMap<>(); - state.put("text", mEditable.toString()); - state.put("selectionBase", selectionStart); - state.put("selectionExtent", selectionEnd); - state.put("composingBase", composingStart); - state.put("composingExtent", composingEnd); - mFlutterChannel.invokeMethod("TextInputClient.updateEditingState", - Arrays.asList(mClient, state), logger); + textInputChannel.updateEditingState( + mClient, + mEditable.toString(), + selectionStart, + selectionEnd, + composingStart, + composingEnd + ); } @Override @@ -178,39 +181,30 @@ public boolean sendKeyEvent(KeyEvent event) { @Override public boolean performEditorAction(int actionCode) { switch (actionCode) { - // TODO(mattcarroll): is newline an appropriate action for "none"? case EditorInfo.IME_ACTION_NONE: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.newline"), logger); + textInputChannel.newline(mClient); break; case EditorInfo.IME_ACTION_UNSPECIFIED: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.unspecified"), logger); + textInputChannel.unspecifiedAction(mClient); break; case EditorInfo.IME_ACTION_GO: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.go"), logger); + textInputChannel.go(mClient); break; case EditorInfo.IME_ACTION_SEARCH: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.search"), logger); + textInputChannel.search(mClient); break; case EditorInfo.IME_ACTION_SEND: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.send"), logger); + textInputChannel.send(mClient); break; case EditorInfo.IME_ACTION_NEXT: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.next"), logger); + textInputChannel.next(mClient); break; case EditorInfo.IME_ACTION_PREVIOUS: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.previous"), logger); + textInputChannel.previous(mClient); break; default: case EditorInfo.IME_ACTION_DONE: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.done"), logger); + textInputChannel.done(mClient); break; } return true; diff --git a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java index c59ee25148e2d..bc54b3ed045ac 100644 --- a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java +++ b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java @@ -5,6 +5,7 @@ package io.flutter.plugin.editing; import android.content.Context; +import android.support.annotation.NonNull; import android.text.Editable; import android.text.InputType; import android.text.Selection; @@ -12,84 +13,87 @@ import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; -import io.flutter.plugin.common.JSONMethodCodec; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; -import io.flutter.plugin.common.MethodChannel.MethodCallHandler; -import io.flutter.plugin.common.MethodChannel.Result; + +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.embedding.engine.systemchannels.TextInputChannel; import io.flutter.view.FlutterView; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; /** * Android implementation of the text input plugin. */ -public class TextInputPlugin implements MethodCallHandler { +public class TextInputPlugin { private final FlutterView mView; private final InputMethodManager mImm; - private final MethodChannel mFlutterChannel; + private final TextInputChannel textInputChannel; private int mClient = 0; - private JSONObject mConfiguration; + private TextInputChannel.Configuration configuration; private Editable mEditable; private boolean mRestartInputPending; - public TextInputPlugin(FlutterView view) { + public TextInputPlugin(FlutterView view, @NonNull DartExecutor dartExecutor) { mView = view; mImm = (InputMethodManager) view.getContext().getSystemService( Context.INPUT_METHOD_SERVICE); - mFlutterChannel = new MethodChannel(view, "flutter/textinput", JSONMethodCodec.INSTANCE); - mFlutterChannel.setMethodCallHandler(this); - } - @Override - public void onMethodCall(MethodCall call, Result result) { - String method = call.method; - Object args = call.arguments; - try { - if (method.equals("TextInput.show")) { + textInputChannel = new TextInputChannel(dartExecutor); + textInputChannel.setTextInputMethodHandler(new TextInputChannel.TextInputMethodHandler() { + @Override + public void show() { showTextInput(mView); - result.success(null); - } else if (method.equals("TextInput.hide")) { + } + + @Override + public void hide() { hideTextInput(mView); - result.success(null); - } else if (method.equals("TextInput.setClient")) { - final JSONArray argumentList = (JSONArray) args; - setTextInputClient(mView, argumentList.getInt(0), argumentList.getJSONObject(1)); - result.success(null); - } else if (method.equals("TextInput.setEditingState")) { - setTextInputEditingState(mView, (JSONObject) args); - result.success(null); - } else if (method.equals("TextInput.clearClient")) { + } + + @Override + public void setClient(int textInputClientId, TextInputChannel.Configuration configuration) { + setTextInputClient(textInputClientId, configuration); + } + + @Override + public void setEditingState(TextInputChannel.TextEditState editingState) { + setTextInputEditingState(mView, editingState); + } + + @Override + public void clearClient() { clearTextInputClient(); - result.success(null); - } else { - result.notImplemented(); } - } catch (JSONException e) { - result.error("error", "JSON error: " + e.getMessage(), null); - } + }); } - private static int inputTypeFromTextInputType(JSONObject type, boolean obscureText, - boolean autocorrect, String textCapitalization) throws JSONException { - String inputType = type.getString("name"); - if (inputType.equals("TextInputType.datetime")) return InputType.TYPE_CLASS_DATETIME; - if (inputType.equals("TextInputType.number")) { + private static int inputTypeFromTextInputType( + TextInputChannel.InputType type, + boolean obscureText, + boolean autocorrect, + TextInputChannel.TextCapitalization textCapitalization + ) { + if (type.type == TextInputChannel.TextInputType.DATETIME) { + return InputType.TYPE_CLASS_DATETIME; + } else if (type.type == TextInputChannel.TextInputType.NUMBER) { int textType = InputType.TYPE_CLASS_NUMBER; - if (type.optBoolean("signed")) textType |= InputType.TYPE_NUMBER_FLAG_SIGNED; - if (type.optBoolean("decimal")) textType |= InputType.TYPE_NUMBER_FLAG_DECIMAL; + if (type.isSigned) { + textType |= InputType.TYPE_NUMBER_FLAG_SIGNED; + } + if (type.isDecimal) { + textType |= InputType.TYPE_NUMBER_FLAG_DECIMAL; + } return textType; + } else if (type.type == TextInputChannel.TextInputType.PHONE) { + return InputType.TYPE_CLASS_PHONE; } - if (inputType.equals("TextInputType.phone")) return InputType.TYPE_CLASS_PHONE; int textType = InputType.TYPE_CLASS_TEXT; - if (inputType.equals("TextInputType.multiline")) + if (type.type == TextInputChannel.TextInputType.MULTILINE) { textType |= InputType.TYPE_TEXT_FLAG_MULTI_LINE; - else if (inputType.equals("TextInputType.emailAddress")) + } else if (type.type == TextInputChannel.TextInputType.EMAIL_ADDRESS) { textType |= InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; - else if (inputType.equals("TextInputType.url")) + } else if (type.type == TextInputChannel.TextInputType.URL) { textType |= InputType.TYPE_TEXT_VARIATION_URI; + } + if (obscureText) { // Note: both required. Some devices ignore TYPE_TEXT_FLAG_NO_SUGGESTIONS. textType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; @@ -97,69 +101,50 @@ else if (inputType.equals("TextInputType.url")) } else { if (autocorrect) textType |= InputType.TYPE_TEXT_FLAG_AUTO_CORRECT; } - if (textCapitalization.equals("TextCapitalization.characters")) { + + if (textCapitalization == TextInputChannel.TextCapitalization.CHARACTERS) { textType |= InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; - } else if (textCapitalization.equals("TextCapitalization.words")) { + } else if (textCapitalization == TextInputChannel.TextCapitalization.WORDS) { textType |= InputType.TYPE_TEXT_FLAG_CAP_WORDS; - } else if (textCapitalization.equals("TextCapitalization.sentences")) { + } else if (textCapitalization == TextInputChannel.TextCapitalization.SENTENCES) { textType |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; } - return textType; - } - private static int inputActionFromTextInputAction(String inputAction) { - switch (inputAction) { - case "TextInputAction.newline": - return EditorInfo.IME_ACTION_NONE; - case "TextInputAction.none": - return EditorInfo.IME_ACTION_NONE; - case "TextInputAction.unspecified": - return EditorInfo.IME_ACTION_UNSPECIFIED; - case "TextInputAction.done": - return EditorInfo.IME_ACTION_DONE; - case "TextInputAction.go": - return EditorInfo.IME_ACTION_GO; - case "TextInputAction.search": - return EditorInfo.IME_ACTION_SEARCH; - case "TextInputAction.send": - return EditorInfo.IME_ACTION_SEND; - case "TextInputAction.next": - return EditorInfo.IME_ACTION_NEXT; - case "TextInputAction.previous": - return EditorInfo.IME_ACTION_PREVIOUS; - default: - // Present default key if bad input type is given. - return EditorInfo.IME_ACTION_UNSPECIFIED; - } + return textType; } - public InputConnection createInputConnection(FlutterView view, EditorInfo outAttrs) - throws JSONException { + public InputConnection createInputConnection(FlutterView view, EditorInfo outAttrs) { if (mClient == 0) return null; - outAttrs.inputType = inputTypeFromTextInputType(mConfiguration.getJSONObject("inputType"), - mConfiguration.optBoolean("obscureText"), - mConfiguration.optBoolean("autocorrect", true), - mConfiguration.getString("textCapitalization")); + outAttrs.inputType = inputTypeFromTextInputType( + configuration.inputType, + configuration.obscureText, + configuration.autocorrect, + configuration.textCapitalization + ); outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN; int enterAction; - if (mConfiguration.isNull("inputAction")) { + if (configuration.inputAction == null) { // If an explicit input action isn't set, then default to none for multi-line fields // and done for single line fields. enterAction = (InputType.TYPE_TEXT_FLAG_MULTI_LINE & outAttrs.inputType) != 0 ? EditorInfo.IME_ACTION_NONE : EditorInfo.IME_ACTION_DONE; } else { - enterAction = inputActionFromTextInputAction(mConfiguration.getString("inputAction")); + enterAction = configuration.inputAction; } - if (!mConfiguration.isNull("actionLabel")) { - outAttrs.actionLabel = mConfiguration.getString("actionLabel"); + if (configuration.actionLabel != null) { + outAttrs.actionLabel = configuration.actionLabel; outAttrs.actionId = enterAction; } outAttrs.imeOptions |= enterAction; - InputConnectionAdaptor connection = - new InputConnectionAdaptor(view, mClient, mFlutterChannel, mEditable); + InputConnectionAdaptor connection = new InputConnectionAdaptor( + view, + mClient, + textInputChannel, + mEditable + ); outAttrs.initialSelStart = Selection.getSelectionStart(mEditable); outAttrs.initialSelEnd = Selection.getSelectionEnd(mEditable); @@ -175,9 +160,9 @@ private void hideTextInput(FlutterView view) { mImm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0); } - private void setTextInputClient(FlutterView view, int client, JSONObject configuration) { + private void setTextInputClient(int client, TextInputChannel.Configuration configuration) { mClient = client; - mConfiguration = configuration; + this.configuration = configuration; mEditable = Editable.Factory.getInstance().newEditable(""); // setTextInputClient will be followed by a call to setTextInputEditingState. @@ -185,9 +170,9 @@ private void setTextInputClient(FlutterView view, int client, JSONObject configu mRestartInputPending = true; } - private void applyStateToSelection(JSONObject state) throws JSONException { - int selStart = state.getInt("selectionBase"); - int selEnd = state.getInt("selectionExtent"); + private void applyStateToSelection(TextInputChannel.TextEditState state) { + int selStart = state.selectionStart; + int selEnd = state.selectionEnd; if (selStart >= 0 && selStart <= mEditable.length() && selEnd >= 0 && selEnd <= mEditable.length()) { Selection.setSelection(mEditable, selStart, selEnd); @@ -196,15 +181,15 @@ private void applyStateToSelection(JSONObject state) throws JSONException { } } - private void setTextInputEditingState(FlutterView view, JSONObject state) throws JSONException { - if (!mRestartInputPending && state.getString("text").equals(mEditable.toString())) { + private void setTextInputEditingState(FlutterView view, TextInputChannel.TextEditState state) { + if (!mRestartInputPending && state.text.equals(mEditable.toString())) { applyStateToSelection(state); mImm.updateSelection(mView, Math.max(Selection.getSelectionStart(mEditable), 0), Math.max(Selection.getSelectionEnd(mEditable), 0), BaseInputConnection.getComposingSpanStart(mEditable), BaseInputConnection.getComposingSpanEnd(mEditable)); } else { - mEditable.replace(0, mEditable.length(), state.getString("text")); + mEditable.replace(0, mEditable.length(), state.text); applyStateToSelection(state); mImm.restartInput(view); mRestartInputPending = false; diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java index b6f53d45741f1..e9d44001ef0f5 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java @@ -9,212 +9,159 @@ import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; -import android.content.pm.ActivityInfo; import android.os.Build; -import android.util.Log; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.view.HapticFeedbackConstants; import android.view.SoundEffectConstants; import android.view.View; import android.view.Window; + +import java.util.List; + +import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.plugin.common.ActivityLifecycleListener; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel.MethodCallHandler; -import io.flutter.plugin.common.MethodChannel.Result; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; /** * Android implementation of the platform plugin. */ -public class PlatformPlugin implements MethodCallHandler, ActivityLifecycleListener { - private final Activity mActivity; - private JSONObject mCurrentTheme; +public class PlatformPlugin implements ActivityLifecycleListener { public static final int DEFAULT_SYSTEM_UI = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; - private static final String kTextPlainFormat = "text/plain"; - public PlatformPlugin(Activity activity) { - mActivity = activity; - mEnabledOverlays = DEFAULT_SYSTEM_UI; - } + private final Activity activity; + private final PlatformChannel platformChannel; + private PlatformChannel.SystemChromeStyle currentTheme; + private int mEnabledOverlays; - @Override - public void onMethodCall(MethodCall call, Result result) { - String method = call.method; - Object arguments = call.arguments; - try { - if (method.equals("SystemSound.play")) { - playSystemSound((String) arguments); - result.success(null); - } else if (method.equals("HapticFeedback.vibrate")) { - vibrateHapticFeedback((String) arguments); - result.success(null); - } else if (method.equals("SystemChrome.setPreferredOrientations")) { - setSystemChromePreferredOrientations((JSONArray) arguments); - result.success(null); - } else if (method.equals("SystemChrome.setApplicationSwitcherDescription")) { - setSystemChromeApplicationSwitcherDescription((JSONObject) arguments); - result.success(null); - } else if (method.equals("SystemChrome.setEnabledSystemUIOverlays")) { - setSystemChromeEnabledSystemUIOverlays((JSONArray) arguments); - result.success(null); - } else if (method.equals("SystemChrome.restoreSystemUIOverlays")) { - restoreSystemChromeSystemUIOverlays(); - result.success(null); - } else if (method.equals("SystemChrome.setSystemUIOverlayStyle")) { - setSystemChromeSystemUIOverlayStyle((JSONObject) arguments); - result.success(null); - } else if (method.equals("SystemNavigator.pop")) { - popSystemNavigator(); - result.success(null); - } else if (method.equals("Clipboard.getData")) { - result.success(getClipboardData((String) arguments)); - } else if (method.equals("Clipboard.setData")) { - setClipboardData((JSONObject) arguments); - result.success(null); - } else { - result.notImplemented(); - } - } catch (JSONException e) { - result.error("error", "JSON error: " + e.getMessage(), null); + private final PlatformChannel.PlatformMessageHandler mPlatformMessageHandler = new PlatformChannel.PlatformMessageHandler() { + @Override + public void playSystemSound(@NonNull PlatformChannel.SoundType soundType) { + PlatformPlugin.this.playSystemSound(soundType); } - } - private void playSystemSound(String soundType) { - if (soundType.equals("SystemSoundType.click")) { - View view = mActivity.getWindow().getDecorView(); - view.playSoundEffect(SoundEffectConstants.CLICK); + @Override + public void vibrateHapticFeedback(@NonNull PlatformChannel.HapticFeedbackType feedbackType) { + PlatformPlugin.this.vibrateHapticFeedback(feedbackType); + } + + @Override + public void setPreferredOrientations(int androidOrientation) { + setSystemChromePreferredOrientations(androidOrientation); + } + + @Override + public void setApplicationSwitcherDescription(@NonNull PlatformChannel.AppSwitcherDescription description) { + setSystemChromeApplicationSwitcherDescription(description); + } + + @Override + public void showSystemOverlays(@NonNull List overlays) { + setSystemChromeEnabledSystemUIOverlays(overlays); + } + + @Override + public void restoreSystemUiOverlays() { + restoreSystemChromeSystemUIOverlays(); + } + + @Override + public void setSystemUiOverlayStyle(@NonNull PlatformChannel.SystemChromeStyle systemUiOverlayStyle) { + setSystemChromeSystemUIOverlayStyle(systemUiOverlayStyle); + } + + @Override + public void popSystemNavigator() { + PlatformPlugin.this.popSystemNavigator(); } - } - private void vibrateHapticFeedback(String feedbackType) { - View view = mActivity.getWindow().getDecorView(); - if (feedbackType == null) { - view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); - } else if (feedbackType.equals("HapticFeedbackType.lightImpact")) { - view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); - } else if (feedbackType.equals("HapticFeedbackType.mediumImpact")) { - view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); - } else if (feedbackType.equals("HapticFeedbackType.heavyImpact")) { - // HapticFeedbackConstants.CONTEXT_CLICK from API level 23. - view.performHapticFeedback(6); - } else if (feedbackType.equals("HapticFeedbackType.selectionClick")) { - view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK); + @Override + public CharSequence getClipboardData(@Nullable PlatformChannel.ClipboardContentFormat format) { + return PlatformPlugin.this.getClipboardData(format); } + + @Override + public void setClipboardData(@NonNull String text) { + PlatformPlugin.this.setClipboardData(text); + } + }; + + public PlatformPlugin(Activity activity, PlatformChannel platformChannel) { + this.activity = activity; + this.platformChannel = platformChannel; + this.platformChannel.setPlatformMessageHandler(mPlatformMessageHandler); + + mEnabledOverlays = DEFAULT_SYSTEM_UI; } - private void setSystemChromePreferredOrientations(JSONArray orientations) throws JSONException { - int requestedOrientation = 0x00; - int firstRequestedOrientation = 0x00; - for (int index = 0; index < orientations.length(); index += 1) { - if (orientations.getString(index).equals("DeviceOrientation.portraitUp")) { - requestedOrientation |= 0x01; - } else if (orientations.getString(index).equals("DeviceOrientation.landscapeLeft")) { - requestedOrientation |= 0x02; - } else if (orientations.getString(index).equals("DeviceOrientation.portraitDown")) { - requestedOrientation |= 0x04; - } else if (orientations.getString(index).equals("DeviceOrientation.landscapeRight")) { - requestedOrientation |= 0x08; - } - if (firstRequestedOrientation == 0x00) { - firstRequestedOrientation = requestedOrientation; - } + private void playSystemSound(PlatformChannel.SoundType soundType) { + if (soundType == PlatformChannel.SoundType.CLICK) { + View view = activity.getWindow().getDecorView(); + view.playSoundEffect(SoundEffectConstants.CLICK); } - switch (requestedOrientation) { - case 0x00: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); - break; - case 0x01: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - break; - case 0x02: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); - break; - case 0x04: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); - break; - case 0x05: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT); + } + + private void vibrateHapticFeedback(PlatformChannel.HapticFeedbackType feedbackType) { + View view = activity.getWindow().getDecorView(); + switch (feedbackType) { + case STANDARD: + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); break; - case 0x08: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); + case LIGHT_IMPACT: + view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); break; - case 0x0a: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE); + case MEDIUM_IMPACT: + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); break; - case 0x0b: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER); + case HEAVY_IMPACT: + // HapticFeedbackConstants.CONTEXT_CLICK from API level 23. + view.performHapticFeedback(6); break; - case 0x0f: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER); + case SELECTION_CLICK: + view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK); break; - case 0x03: // portraitUp and landscapeLeft - case 0x06: // portraitDown and landscapeLeft - case 0x07: // portraitUp, portraitDown, and landscapeLeft - case 0x09: // portraitUp and landscapeRight - case 0x0c: // portraitDown and landscapeRight - case 0x0d: // portraitUp, portraitDown, and landscapeRight - case 0x0e: // portraitDown, landscapeLeft, and landscapeRight - // Android can't describe these cases, so just default to whatever the first - // specified value was. - switch (firstRequestedOrientation) { - case 0x01: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - break; - case 0x02: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); - break; - case 0x04: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); - break; - case 0x08: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); - break; - } - break; - } + } + } + + private void setSystemChromePreferredOrientations(int androidOrientation) { + activity.setRequestedOrientation(androidOrientation); } - private void setSystemChromeApplicationSwitcherDescription(JSONObject description) throws JSONException { + private void setSystemChromeApplicationSwitcherDescription(PlatformChannel.AppSwitcherDescription description) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return; } - int color = description.getInt("primaryColor"); - if (color != 0) { // 0 means color isn't set, use system default - color = color | 0xFF000000; // color must be opaque if set - } - - String label = description.getString("label"); - @SuppressWarnings("deprecation") TaskDescription taskDescription = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) - ? new TaskDescription(label, 0, color) - : new TaskDescription(label, null, color); + ? new TaskDescription(description.label, 0, description.color) + : new TaskDescription(description.label, null, description.color); - mActivity.setTaskDescription(taskDescription); + activity.setTaskDescription(taskDescription); } - private int mEnabledOverlays; - - private void setSystemChromeEnabledSystemUIOverlays(JSONArray overlays) throws JSONException { + private void setSystemChromeEnabledSystemUIOverlays(List overlaysToShow) { + // Start by assuming we want to hide all system overlays (like an immersive game). int enabledOverlays = DEFAULT_SYSTEM_UI | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; - if (overlays.length() == 0) { + if (overlaysToShow.size() == 0) { enabledOverlays |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; } - for (int i = 0; i < overlays.length(); ++i) { - String overlay = overlays.getString(i); - if (overlay.equals("SystemUiOverlay.top")) { - enabledOverlays &= ~View.SYSTEM_UI_FLAG_FULLSCREEN; - } else if (overlay.equals("SystemUiOverlay.bottom")) { - enabledOverlays &= ~View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; - enabledOverlays &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; + // Re-add any desired system overlays. + for (int i = 0; i < overlaysToShow.size(); ++i) { + PlatformChannel.SystemUiOverlay overlayToShow = overlaysToShow.get(i); + switch (overlayToShow) { + case TOP_OVERLAYS: + enabledOverlays &= ~View.SYSTEM_UI_FLAG_FULLSCREEN; + break; + case BOTTOM_OVERLAYS: + enabledOverlays &= ~View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; + enabledOverlays &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; + break; } } @@ -223,9 +170,9 @@ private void setSystemChromeEnabledSystemUIOverlays(JSONArray overlays) throws J } private void updateSystemUiOverlays(){ - mActivity.getWindow().getDecorView().setSystemUiVisibility(mEnabledOverlays); - if (mCurrentTheme != null) { - setSystemChromeSystemUIOverlayStyle(mCurrentTheme); + activity.getWindow().getDecorView().setSystemUiVisibility(mEnabledOverlays); + if (currentTheme != null) { + setSystemChromeSystemUIOverlayStyle(currentTheme); } } @@ -233,83 +180,75 @@ private void restoreSystemChromeSystemUIOverlays() { updateSystemUiOverlays(); } - private void setSystemChromeSystemUIOverlayStyle(JSONObject message) { - Window window = mActivity.getWindow(); + private void setSystemChromeSystemUIOverlayStyle(PlatformChannel.SystemChromeStyle systemChromeStyle) { + Window window = activity.getWindow(); View view = window.getDecorView(); int flags = view.getSystemUiVisibility(); - try { - // You can change the navigation bar color (including translucent colors) - // in Android, but you can't change the color of the navigation buttons until Android O. - // LIGHT vs DARK effectively isn't supported until then. - // Build.VERSION_CODES.O - if (Build.VERSION.SDK_INT >= 26) { - if (!message.isNull("systemNavigationBarIconBrightness")) { - String systemNavigationBarIconBrightness = message.getString("systemNavigationBarIconBrightness"); - switch (systemNavigationBarIconBrightness) { - case "Brightness.dark": - //View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR - flags |= 0x10; - break; - case "Brightness.light": - flags &= ~0x10; - break; - } - } - if (!message.isNull("systemNavigationBarColor")) { - window.setNavigationBarColor(message.getInt("systemNavigationBarColor")); + // You can change the navigation bar color (including translucent colors) + // in Android, but you can't change the color of the navigation buttons until Android O. + // LIGHT vs DARK effectively isn't supported until then. + // Build.VERSION_CODES.O + if (Build.VERSION.SDK_INT >= 26) { + if (systemChromeStyle.systemNavigationBarIconBrightness != null) { + switch (systemChromeStyle.systemNavigationBarIconBrightness) { + case DARK: + //View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR + flags |= 0x10; + break; + case LIGHT: + flags &= ~0x10; + break; } } - // Build.VERSION_CODES.M - if (Build.VERSION.SDK_INT >= 23) { - if (!message.isNull("statusBarIconBrightness")) { - String statusBarIconBrightness = message.getString("statusBarIconBrightness"); - switch (statusBarIconBrightness) { - case "Brightness.dark": - // View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR - flags |= 0x2000; - break; - case "Brightness.light": - flags &= ~0x2000; - break; - } - } - if (!message.isNull("statusBarColor")) { - window.setStatusBarColor(message.getInt("statusBarColor")); + if (systemChromeStyle.systemNavigationBarColor != null) { + window.setNavigationBarColor(systemChromeStyle.systemNavigationBarColor); + } + } + // Build.VERSION_CODES.M + if (Build.VERSION.SDK_INT >= 23) { + if (systemChromeStyle.statusBarIconBrightness != null) { + switch (systemChromeStyle.statusBarIconBrightness) { + case DARK: + // View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR + flags |= 0x2000; + break; + case LIGHT: + flags &= ~0x2000; + break; } } - if (!message.isNull("systemNavigationBarDividerColor")) { - // Not availible until Android P. - // window.setNavigationBarDividerColor(systemNavigationBarDividerColor); + if (systemChromeStyle.statusBarColor != null) { + window.setStatusBarColor(systemChromeStyle.statusBarColor); } - view.setSystemUiVisibility(flags); - mCurrentTheme = message; - } catch (JSONException err) { - Log.i("PlatformPlugin", err.toString()); } + if (systemChromeStyle.systemNavigationBarDividerColor != null) { + // Not availible until Android P. + // window.setNavigationBarDividerColor(systemNavigationBarDividerColor); + } + view.setSystemUiVisibility(flags); + currentTheme = systemChromeStyle; } private void popSystemNavigator() { - mActivity.finish(); + activity.finish(); } - private JSONObject getClipboardData(String format) throws JSONException { - ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE); + private CharSequence getClipboardData(PlatformChannel.ClipboardContentFormat format) { + ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = clipboard.getPrimaryClip(); if (clip == null) return null; - if (format == null || format.equals(kTextPlainFormat)) { - JSONObject result = new JSONObject(); - result.put("text", clip.getItemAt(0).coerceToText(mActivity)); - return result; + if (format == null || format == PlatformChannel.ClipboardContentFormat.PLAIN_TEXT) { + return clip.getItemAt(0).coerceToText(activity); } return null; } - private void setClipboardData(JSONObject data) throws JSONException { - ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE); - ClipData clip = ClipData.newPlainText("text label?", data.getString("text")); + private void setClipboardData(String text) { + ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); + ClipData clip = ClipData.newPlainText("text label?", text); clipboard.setPrimaryClip(clip); } diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index d8c2de3749195..ac5e2f8f3d995 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -9,20 +9,21 @@ import android.opengl.Matrix; import android.os.Build; import android.os.Bundle; +import android.support.annotation.NonNull; import android.util.Log; import android.view.View; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeProvider; -import io.flutter.plugin.common.BasicMessageChannel; -import io.flutter.plugin.common.StandardMessageCodec; + +import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; import io.flutter.util.Predicate; import java.nio.ByteBuffer; import java.util.*; class AccessibilityBridge - extends AccessibilityNodeProvider implements BasicMessageChannel.MessageHandler { + extends AccessibilityNodeProvider { private static final String TAG = "FlutterView"; // Constants from higher API levels. @@ -34,19 +35,42 @@ class AccessibilityBridge private static final float SCROLL_POSITION_CAP_FOR_INFINITY = 70000.0f; private static final int ROOT_NODE_ID = 0; - private Map mObjects; - private Map mCustomAccessibilityActions; - private final FlutterView mOwner; - private boolean mAccessibilityEnabled = false; - private SemanticsObject mA11yFocusedObject; - private SemanticsObject mInputFocusedObject; - private SemanticsObject mHoveredObject; + private final FlutterView owner; + private final AccessibilityChannel accessibilityChannel; + private final View decorView; + private Map objects; + private Map customAccessibilityActions; + private boolean accessibilityEnabled = false; + private SemanticsObject a11yFocusedObject; + private SemanticsObject inputFocusedObject; + private SemanticsObject hoveredObject; private int previousRouteId = ROOT_NODE_ID; private List previousRoutes; - private final View mDecorView; - private Integer mLastLeftFrameInset = 0; + private Integer lastLeftFrameInset = 0; + + private final AccessibilityChannel.AccessibilityMessageHandler accessibilityMessageHandler = new AccessibilityChannel.AccessibilityMessageHandler() { + @Override + public void announce(@NonNull String message) { + owner.announceForAccessibility(message); + } + + @Override + public void onTap(int nodeId) { + sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_CLICKED); + } - private final BasicMessageChannel mFlutterAccessibilityChannel; + @Override + public void onLongPress(int nodeId) { + sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); + } + + @Override + public void onTooltip(@NonNull String message) { + AccessibilityEvent e = obtainAccessibilityEvent(ROOT_NODE_ID, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); + e.getText().add(message); + sendAccessibilityEvent(e); + } + }; enum Action { TAP(1 << 0), @@ -106,23 +130,21 @@ enum Flag { final int value; } - AccessibilityBridge(FlutterView owner) { - assert owner != null; - mOwner = owner; - mObjects = new HashMap<>(); - mCustomAccessibilityActions = new HashMap<>(); + AccessibilityBridge(@NonNull FlutterView owner, @NonNull AccessibilityChannel accessibilityChannel) { + this.owner = owner; + this.accessibilityChannel = accessibilityChannel; + decorView = ((Activity) owner.getContext()).getWindow().getDecorView(); + objects = new HashMap<>(); + customAccessibilityActions = new HashMap<>(); previousRoutes = new ArrayList<>(); - mFlutterAccessibilityChannel = new BasicMessageChannel<>( - owner, "flutter/accessibility", StandardMessageCodec.INSTANCE); - mDecorView = ((Activity) owner.getContext()).getWindow().getDecorView(); } void setAccessibilityEnabled(boolean accessibilityEnabled) { - mAccessibilityEnabled = accessibilityEnabled; + this.accessibilityEnabled = accessibilityEnabled; if (accessibilityEnabled) { - mFlutterAccessibilityChannel.setMessageHandler(this); + this.accessibilityChannel.setAccessibilityMessageHandler(accessibilityMessageHandler); } else { - mFlutterAccessibilityChannel.setMessageHandler(null); + this.accessibilityChannel.setAccessibilityMessageHandler(null); } } @@ -137,42 +159,42 @@ private boolean shouldSetCollectionInfo(final SemanticsObject object) { // to set it if we're exiting a list to a non-list, so that we can get the "out of list" // announcement when A11y focus moves out of a list and not into another list. return object.scrollChildren > 0 - && (hasSemanticsObjectAncestor(mA11yFocusedObject, o -> o == object) - || !hasSemanticsObjectAncestor(mA11yFocusedObject, o -> o.hasFlag(Flag.HAS_IMPLICIT_SCROLLING))); + && (hasSemanticsObjectAncestor(a11yFocusedObject, o -> o == object) + || !hasSemanticsObjectAncestor(a11yFocusedObject, o -> o.hasFlag(Flag.HAS_IMPLICIT_SCROLLING))); } @Override @SuppressWarnings("deprecation") public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (virtualViewId == View.NO_ID) { - AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(mOwner); - mOwner.onInitializeAccessibilityNodeInfo(result); - if (mObjects.containsKey(ROOT_NODE_ID)) { - result.addChild(mOwner, ROOT_NODE_ID); + AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(owner); + owner.onInitializeAccessibilityNodeInfo(result); + if (objects.containsKey(ROOT_NODE_ID)) { + result.addChild(owner, ROOT_NODE_ID); } return result; } - SemanticsObject object = mObjects.get(virtualViewId); + SemanticsObject object = objects.get(virtualViewId); if (object == null) { return null; } - AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(mOwner, virtualViewId); + AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(owner, virtualViewId); // Work around for https://github.com/flutter/flutter/issues/2101 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { result.setViewIdResourceName(""); } - result.setPackageName(mOwner.getContext().getPackageName()); + result.setPackageName(owner.getContext().getPackageName()); result.setClassName("android.view.View"); - result.setSource(mOwner, virtualViewId); + result.setSource(owner, virtualViewId); result.setFocusable(object.isFocusable()); - if (mInputFocusedObject != null) { - result.setFocused(mInputFocusedObject.id == virtualViewId); + if (inputFocusedObject != null) { + result.setFocused(inputFocusedObject.id == virtualViewId); } - if (mA11yFocusedObject != null) { - result.setAccessibilityFocused(mA11yFocusedObject.id == virtualViewId); + if (a11yFocusedObject != null) { + result.setAccessibilityFocused(a11yFocusedObject.id == virtualViewId); } if (object.hasFlag(Flag.IS_TEXT_FIELD)) { @@ -186,7 +208,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { // 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) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 && a11yFocusedObject != null && a11yFocusedObject.id == virtualViewId) { result.setLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); } } @@ -239,10 +261,10 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (object.parent != null) { assert object.id > ROOT_NODE_ID; - result.setParent(mOwner, object.parent.id); + result.setParent(owner, object.parent.id); } else { assert object.id == ROOT_NODE_ID; - result.setParent(mOwner); + result.setParent(owner); } Rect bounds = object.getGlobalRect(); @@ -362,7 +384,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { result.setSelected(object.hasFlag(Flag.IS_SELECTED)); // Accessibility Focus - if (mA11yFocusedObject != null && mA11yFocusedObject.id == virtualViewId) { + if (a11yFocusedObject != null && a11yFocusedObject.id == virtualViewId) { result.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } else { result.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); @@ -381,7 +403,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (object.childrenInTraversalOrder != null) { for (SemanticsObject child : object.childrenInTraversalOrder) { if (!child.hasFlag(Flag.IS_HIDDEN)) { - result.addChild(mOwner, child.id); + result.addChild(owner, child.id); } } } @@ -391,7 +413,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { @Override public boolean performAction(int virtualViewId, int action, Bundle arguments) { - SemanticsObject object = mObjects.get(virtualViewId); + SemanticsObject object = objects.get(virtualViewId); if (object == null) { return false; } @@ -400,27 +422,27 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { // Note: TalkBack prior to Oreo doesn't use this handler and instead simulates a // click event at the center of the SemanticsNode. Other a11y services might go // through this handler though. - mOwner.dispatchSemanticsAction(virtualViewId, Action.TAP); + owner.dispatchSemanticsAction(virtualViewId, Action.TAP); return true; } case AccessibilityNodeInfo.ACTION_LONG_CLICK: { // Note: TalkBack doesn't use this handler and instead simulates a long click event // at the center of the SemanticsNode. Other a11y services might go through this // handler though. - mOwner.dispatchSemanticsAction(virtualViewId, Action.LONG_PRESS); + owner.dispatchSemanticsAction(virtualViewId, Action.LONG_PRESS); return true; } case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: { if (object.hasAction(Action.SCROLL_UP)) { - mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_UP); + owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_UP); } else if (object.hasAction(Action.SCROLL_LEFT)) { // TODO(ianh): bidi support using textDirection - mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_LEFT); + owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_LEFT); } else if (object.hasAction(Action.INCREASE)) { object.value = object.increasedValue; // Event causes Android to read out the updated value. sendAccessibilityEvent(virtualViewId, AccessibilityEvent.TYPE_VIEW_SELECTED); - mOwner.dispatchSemanticsAction(virtualViewId, Action.INCREASE); + owner.dispatchSemanticsAction(virtualViewId, Action.INCREASE); } else { return false; } @@ -428,15 +450,15 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { } case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: { if (object.hasAction(Action.SCROLL_DOWN)) { - mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_DOWN); + owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_DOWN); } else if (object.hasAction(Action.SCROLL_RIGHT)) { // TODO(ianh): bidi support using textDirection - mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_RIGHT); + owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_RIGHT); } else if (object.hasAction(Action.DECREASE)) { object.value = object.decreasedValue; // Event causes Android to read out the updated value. sendAccessibilityEvent(virtualViewId, AccessibilityEvent.TYPE_VIEW_SELECTED); - mOwner.dispatchSemanticsAction(virtualViewId, Action.DECREASE); + owner.dispatchSemanticsAction(virtualViewId, Action.DECREASE); } else { return false; } @@ -449,24 +471,24 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { return performCursorMoveAction(object, virtualViewId, arguments, true); } case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.DID_LOSE_ACCESSIBILITY_FOCUS); + owner.dispatchSemanticsAction(virtualViewId, Action.DID_LOSE_ACCESSIBILITY_FOCUS); sendAccessibilityEvent( virtualViewId, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - mA11yFocusedObject = null; + a11yFocusedObject = null; return true; } case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.DID_GAIN_ACCESSIBILITY_FOCUS); + owner.dispatchSemanticsAction(virtualViewId, Action.DID_GAIN_ACCESSIBILITY_FOCUS); sendAccessibilityEvent( virtualViewId, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED); - if (mA11yFocusedObject == null) { + if (a11yFocusedObject == null) { // When Android focuses a node, it doesn't invalidate the view. // (It does when it sends ACTION_CLEAR_ACCESSIBILITY_FOCUS, so // we only have to worry about this when the focused node is null.) - mOwner.invalidate(); + owner.invalidate(); } - mA11yFocusedObject = object; + a11yFocusedObject = object; if (object.hasAction(Action.INCREASE) || object.hasAction(Action.DECREASE)) { // SeekBars only announce themselves after this event. @@ -476,7 +498,7 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { return true; } case ACTION_SHOW_ON_SCREEN: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.SHOW_ON_SCREEN); + owner.dispatchSemanticsAction(virtualViewId, Action.SHOW_ON_SCREEN); return true; } case AccessibilityNodeInfo.ACTION_SET_SELECTION: { @@ -498,32 +520,32 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { selection.put("base", object.textSelectionExtent); selection.put("extent", object.textSelectionExtent); } - mOwner.dispatchSemanticsAction(virtualViewId, Action.SET_SELECTION, selection); + owner.dispatchSemanticsAction(virtualViewId, Action.SET_SELECTION, selection); return true; } case AccessibilityNodeInfo.ACTION_COPY: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.COPY); + owner.dispatchSemanticsAction(virtualViewId, Action.COPY); return true; } case AccessibilityNodeInfo.ACTION_CUT: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.CUT); + owner.dispatchSemanticsAction(virtualViewId, Action.CUT); return true; } case AccessibilityNodeInfo.ACTION_PASTE: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.PASTE); + owner.dispatchSemanticsAction(virtualViewId, Action.PASTE); return true; } case AccessibilityNodeInfo.ACTION_DISMISS: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.DISMISS); + owner.dispatchSemanticsAction(virtualViewId, Action.DISMISS); return true; } default: // might be a custom accessibility action. final int flutterId = action - firstResourceId; CustomAccessibilityAction contextAction = - mCustomAccessibilityActions.get(flutterId); + customAccessibilityActions.get(flutterId); if (contextAction != null) { - mOwner.dispatchSemanticsAction( + owner.dispatchSemanticsAction( virtualViewId, Action.CUSTOM_ACTION, contextAction.id); return true; } @@ -540,12 +562,12 @@ boolean performCursorMoveAction( switch (granularity) { case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER: { if (forward && object.hasAction(Action.MOVE_CURSOR_FORWARD_BY_CHARACTER)) { - mOwner.dispatchSemanticsAction(virtualViewId, + owner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_FORWARD_BY_CHARACTER, extendSelection); return true; } if (!forward && object.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER)) { - mOwner.dispatchSemanticsAction(virtualViewId, + owner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER, extendSelection); return true; } @@ -553,12 +575,12 @@ boolean performCursorMoveAction( } case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD: if (forward && object.hasAction(Action.MOVE_CURSOR_FORWARD_BY_WORD)) { - mOwner.dispatchSemanticsAction(virtualViewId, + owner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_FORWARD_BY_WORD, extendSelection); return true; } if (!forward && object.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_WORD)) { - mOwner.dispatchSemanticsAction(virtualViewId, + owner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_BACKWARD_BY_WORD, extendSelection); return true; } @@ -573,65 +595,65 @@ boolean performCursorMoveAction( public AccessibilityNodeInfo findFocus(int focus) { switch (focus) { case AccessibilityNodeInfo.FOCUS_INPUT: { - if (mInputFocusedObject != null) - return createAccessibilityNodeInfo(mInputFocusedObject.id); + if (inputFocusedObject != null) + return createAccessibilityNodeInfo(inputFocusedObject.id); } // Fall through to check FOCUS_ACCESSIBILITY case AccessibilityNodeInfo.FOCUS_ACCESSIBILITY: { - if (mA11yFocusedObject != null) - return createAccessibilityNodeInfo(mA11yFocusedObject.id); + if (a11yFocusedObject != null) + return createAccessibilityNodeInfo(a11yFocusedObject.id); } } return null; } private SemanticsObject getRootObject() { - assert mObjects.containsKey(0); - return mObjects.get(0); + assert objects.containsKey(0); + return objects.get(0); } private SemanticsObject getOrCreateObject(int id) { - SemanticsObject object = mObjects.get(id); + SemanticsObject object = objects.get(id); if (object == null) { object = new SemanticsObject(); object.id = id; - mObjects.put(id, object); + objects.put(id, object); } return object; } private CustomAccessibilityAction getOrCreateAction(int id) { - CustomAccessibilityAction action = mCustomAccessibilityActions.get(id); + CustomAccessibilityAction action = customAccessibilityActions.get(id); if (action == null) { action = new CustomAccessibilityAction(); action.id = id; action.resourceId = id + firstResourceId; - mCustomAccessibilityActions.put(id, action); + customAccessibilityActions.put(id, action); } return action; } void handleTouchExplorationExit() { - if (mHoveredObject != null) { - sendAccessibilityEvent(mHoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); - mHoveredObject = null; + if (hoveredObject != null) { + sendAccessibilityEvent(hoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); + hoveredObject = null; } } void handleTouchExploration(float x, float y) { - if (mObjects.isEmpty()) { + if (objects.isEmpty()) { return; } SemanticsObject newObject = getRootObject().hitTest(new float[] {x, y, 0, 1}); - if (newObject != mHoveredObject) { + if (newObject != hoveredObject) { // sending ENTER before EXIT is how Android wants it if (newObject != null) { sendAccessibilityEvent(newObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_ENTER); } - if (mHoveredObject != null) { - sendAccessibilityEvent(mHoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); + if (hoveredObject != null) { + sendAccessibilityEvent(hoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); } - mHoveredObject = newObject; + hoveredObject = newObject; } } @@ -657,7 +679,7 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { continue; } if (object.hasFlag(Flag.IS_FOCUSED)) { - mInputFocusedObject = object; + inputFocusedObject = object; } if (object.hadPreviousConfig) { updated.add(object); @@ -675,12 +697,12 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { // a11y nodes. if (Build.VERSION.SDK_INT >= 23) { Rect visibleFrame = new Rect(); - mDecorView.getWindowVisibleDisplayFrame(visibleFrame); - if (!mLastLeftFrameInset.equals(visibleFrame.left)) { + decorView.getWindowVisibleDisplayFrame(visibleFrame); + if (!lastLeftFrameInset.equals(visibleFrame.left)) { rootObject.globalGeometryDirty = true; rootObject.inverseTransformDirty = true; } - mLastLeftFrameInset = visibleFrame.left; + lastLeftFrameInset = visibleFrame.left; Matrix.translateM(identity, 0, visibleFrame.left, 0, 0); } rootObject.updateRecursively(identity, visitedObjects, false); @@ -707,7 +729,7 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { previousRoutes.add(semanticsObject.id); } - Iterator> it = mObjects.entrySet().iterator(); + Iterator> it = objects.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = it.next(); SemanticsObject object = entry.getValue(); @@ -787,25 +809,25 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } } else if (object.hasFlag(Flag.IS_TEXT_FIELD) && object.didChangeLabel() - && mInputFocusedObject != null && mInputFocusedObject.id == object.id) { + && inputFocusedObject != null && inputFocusedObject.id == object.id) { // Text fields should announce when their label changes while focused. We use a live // region tag to do so, and this event triggers that update. sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } - if (mA11yFocusedObject != null && mA11yFocusedObject.id == object.id + if (a11yFocusedObject != null && a11yFocusedObject.id == object.id && !object.hadFlag(Flag.IS_SELECTED) && object.hasFlag(Flag.IS_SELECTED)) { AccessibilityEvent event = obtainAccessibilityEvent(object.id, AccessibilityEvent.TYPE_VIEW_SELECTED); event.getText().add(object.label); sendAccessibilityEvent(event); } - if (mInputFocusedObject != null && mInputFocusedObject.id == object.id + if (inputFocusedObject != null && inputFocusedObject.id == object.id && 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))) { + && (a11yFocusedObject == null || (a11yFocusedObject.id == inputFocusedObject.id))) { String oldValue = object.previousValue != null ? object.previousValue : ""; String newValue = object.value != null ? object.value : ""; AccessibilityEvent event = createTextChangedEvent(object.id, oldValue, newValue); @@ -863,65 +885,27 @@ private AccessibilityEvent createTextChangedEvent(int id, String oldValue, Strin private AccessibilityEvent obtainAccessibilityEvent(int virtualViewId, int eventType) { assert virtualViewId != ROOT_NODE_ID; AccessibilityEvent event = AccessibilityEvent.obtain(eventType); - event.setPackageName(mOwner.getContext().getPackageName()); - event.setSource(mOwner, virtualViewId); + event.setPackageName(owner.getContext().getPackageName()); + event.setSource(owner, virtualViewId); return event; } private void sendAccessibilityEvent(int virtualViewId, int eventType) { - if (!mAccessibilityEnabled) { + if (!accessibilityEnabled) { return; } if (virtualViewId == ROOT_NODE_ID) { - mOwner.sendAccessibilityEvent(eventType); + owner.sendAccessibilityEvent(eventType); } else { sendAccessibilityEvent(obtainAccessibilityEvent(virtualViewId, eventType)); } } private void sendAccessibilityEvent(AccessibilityEvent event) { - if (!mAccessibilityEnabled) { + if (!accessibilityEnabled) { return; } - mOwner.getParent().requestSendAccessibilityEvent(mOwner, event); - } - - // Message Handler for [mFlutterAccessibilityChannel]. - public void onMessage(Object message, BasicMessageChannel.Reply reply) { - @SuppressWarnings("unchecked") - final HashMap annotatedEvent = (HashMap) message; - final String type = (String) annotatedEvent.get("type"); - @SuppressWarnings("unchecked") - final HashMap data = (HashMap) annotatedEvent.get("data"); - - switch (type) { - case "announce": - mOwner.announceForAccessibility((String) data.get("message")); - break; - case "longPress": { - Integer nodeId = (Integer) annotatedEvent.get("nodeId"); - if (nodeId == null) { - return; - } - sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); - break; - } - case "tap": { - Integer nodeId = (Integer) annotatedEvent.get("nodeId"); - if (nodeId == null) { - return; - } - sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_CLICKED); - break; - } - case "tooltip": { - AccessibilityEvent e = obtainAccessibilityEvent( - ROOT_NODE_ID, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); - e.getText().add((String) data.get("message")); - sendAccessibilityEvent(e); - break; - } - } + owner.getParent().requestSendAccessibilityEvent(owner, event); } private void createWindowChangeEvent(SemanticsObject route) { @@ -933,29 +917,29 @@ private void createWindowChangeEvent(SemanticsObject route) { } private void willRemoveSemanticsObject(SemanticsObject object) { - assert mObjects.containsKey(object.id); - assert mObjects.get(object.id) == object; + assert objects.containsKey(object.id); + assert objects.get(object.id) == object; object.parent = null; - if (mA11yFocusedObject == object) { - sendAccessibilityEvent(mA11yFocusedObject.id, + if (a11yFocusedObject == object) { + sendAccessibilityEvent(a11yFocusedObject.id, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - mA11yFocusedObject = null; + a11yFocusedObject = null; } - if (mInputFocusedObject == object) { - mInputFocusedObject = null; + if (inputFocusedObject == object) { + inputFocusedObject = null; } - if (mHoveredObject == object) { - mHoveredObject = null; + if (hoveredObject == object) { + hoveredObject = null; } } void reset() { - mObjects.clear(); - if (mA11yFocusedObject != null) - sendAccessibilityEvent(mA11yFocusedObject.id, + objects.clear(); + if (a11yFocusedObject != null) + sendAccessibilityEvent(a11yFocusedObject.id, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - mA11yFocusedObject = null; - mHoveredObject = null; + a11yFocusedObject = null; + hoveredObject = null; sendAccessibilityEvent(0, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index c6927a3245711..00bd03663ae8f 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -15,6 +15,7 @@ import android.net.Uri; import android.os.Build; import android.os.Handler; +import android.os.LocaleList; import android.provider.Settings; import android.text.format.DateFormat; import android.util.AttributeSet; @@ -29,17 +30,17 @@ import io.flutter.embedding.engine.FlutterJNI; import io.flutter.embedding.engine.android.AndroidKeyProcessor; import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; import io.flutter.embedding.engine.systemchannels.KeyEventChannel; import io.flutter.embedding.engine.systemchannels.LifecycleChannel; import io.flutter.embedding.engine.systemchannels.NavigationChannel; +import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.embedding.engine.systemchannels.SettingsChannel; import io.flutter.embedding.engine.systemchannels.SystemChannel; import io.flutter.plugin.common.*; import io.flutter.plugin.editing.TextInputPlugin; import io.flutter.plugin.platform.PlatformPlugin; -import org.json.JSONException; -import java.lang.reflect.Method; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.*; @@ -87,18 +88,21 @@ static final class ViewportMetrics { } private final DartExecutor dartExecutor; + private final AccessibilityChannel accessibilityChannel; private final NavigationChannel navigationChannel; private final KeyEventChannel keyEventChannel; private final LifecycleChannel lifecycleChannel; + private final LocalizationChannel localizationChannel; + private final PlatformChannel platformChannel; private final SettingsChannel settingsChannel; private final SystemChannel systemChannel; private final InputMethodManager mImm; private final TextInputPlugin mTextInputPlugin; private final AndroidKeyProcessor androidKeyProcessor; + private AccessibilityBridge mAccessibilityNodeProvider; private final SurfaceHolder.Callback mSurfaceCallback; private final ViewportMetrics mMetrics; private final AccessibilityManager mAccessibilityManager; - private final MethodChannel mFlutterLocalizationChannel; private final List mActivityLifecycleListeners; private final List mFirstFrameListeners; private final AtomicLong nextTextureId = new AtomicLong(0L); @@ -160,23 +164,25 @@ public void surfaceDestroyed(SurfaceHolder holder) { mActivityLifecycleListeners = new ArrayList<>(); mFirstFrameListeners = new ArrayList<>(); - // Configure the platform plugins and flutter channels. + // Create all platform channels + accessibilityChannel = new AccessibilityChannel(dartExecutor); navigationChannel = new NavigationChannel(dartExecutor); keyEventChannel = new KeyEventChannel(dartExecutor); lifecycleChannel = new LifecycleChannel(dartExecutor); + localizationChannel = new LocalizationChannel(dartExecutor); + platformChannel = new PlatformChannel(dartExecutor); systemChannel = new SystemChannel(dartExecutor); settingsChannel = new SettingsChannel(dartExecutor); - mFlutterLocalizationChannel = new MethodChannel(this, "flutter/localization", JSONMethodCodec.INSTANCE); - PlatformPlugin platformPlugin = new PlatformPlugin(activity); - MethodChannel flutterPlatformChannel = new MethodChannel(this, "flutter/platform", JSONMethodCodec.INSTANCE); - flutterPlatformChannel.setMethodCallHandler(platformPlugin); + // Create and setup plugins + PlatformPlugin platformPlugin = new PlatformPlugin(activity, platformChannel); addActivityLifecycleListener(platformPlugin); mImm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - mTextInputPlugin = new TextInputPlugin(this); + mTextInputPlugin = new TextInputPlugin(this, dartExecutor); androidKeyProcessor = new AndroidKeyProcessor(keyEventChannel); - setLocales(getResources().getConfiguration()); + // Send initial platform information to Dart + sendLocalesToDart(getResources().getConfiguration()); sendUserPlatformSettingsToDart(); } @@ -311,39 +317,21 @@ private void sendUserPlatformSettingsToDart() { .send(); } - 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. - } + private void sendLocalesToDart(Configuration config) { + LocaleList localeList = config.getLocales(); + int localeCount = localeList.size(); + List locales = new ArrayList<>(); + for (int index = 0; index < localeCount; ++index) { + Locale locale = localeList.get(index); + locales.add(locale); } - // Fallback single locale passing for android API < 24. Should work always. - @SuppressWarnings("deprecation") - 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())); + localizationChannel.sendLocales(locales); } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); - setLocales(newConfig); + sendLocalesToDart(newConfig); sendUserPlatformSettingsToDart(); } @@ -374,13 +362,7 @@ public void destroy() { @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { - try { - mLastInputConnection = mTextInputPlugin.createInputConnection(this, outAttrs); - return mLastInputConnection; - } catch (JSONException e) { - Log.e(TAG, "Failed to create input connection", e); - return null; - } + return mTextInputPlugin.createInputConnection(this, outAttrs); } // Must match the PointerChange enum in pointer.dart. @@ -1006,14 +988,12 @@ public AccessibilityNodeProvider getAccessibilityNodeProvider() { return null; } - private AccessibilityBridge mAccessibilityNodeProvider; - void ensureAccessibilityEnabled() { if (!isAttached()) return; mAccessibilityEnabled = true; if (mAccessibilityNodeProvider == null) { - mAccessibilityNodeProvider = new AccessibilityBridge(this); + mAccessibilityNodeProvider = new AccessibilityBridge(this, accessibilityChannel); } mNativeView.getFlutterJNI().setSemanticsEnabled(true); mAccessibilityNodeProvider.setAccessibilityEnabled(true); From 0d6ff1669c4a765774b91e37353b4392408d112a Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 15 Feb 2019 14:16:17 -0800 Subject: [PATCH 0185/1117] Shut down and restart the Dart VM as needed. (#7832) The shell was already designed to cleanly shut down the VM but it couldnt earlier as |Dart_Initialize| could never be called after a |Dart_Cleanup|. This meant that shutting down an engine instance could not shut down the VM to save memory because newly created engines in the process after that point couldn't restart the VM. There can only be one VM running in a process at a time. This patch separate the previous DartVM object into one that references a running instance of the DartVM and a set of immutable dependencies that components can reference even as the VM is shutting down. Unit tests have been added to assert that non-overlapping engine launches use difference VM instances. --- ci/licenses_golden/licenses_flutter | 4 + .../isolate_name_server_natives.cc | 18 +- lib/ui/ui_dart_state.cc | 6 +- lib/ui/ui_dart_state.h | 6 +- runtime/BUILD.gn | 9 +- runtime/dart_isolate.cc | 100 +++++------ runtime/dart_isolate.h | 26 +-- runtime/dart_isolate_unittests.cc | 115 +++++++------ runtime/dart_vm.cc | 156 ++++++++---------- runtime/dart_vm.h | 58 +++---- runtime/dart_vm_data.cc | 79 +++++++++ runtime/dart_vm_data.h | 47 ++++++ runtime/dart_vm_lifecycle.cc | 112 +++++++++++++ runtime/dart_vm_lifecycle.h | 72 ++++++++ runtime/dart_vm_unittests.cc | 104 +++++++++++- runtime/runtime_controller.cc | 10 +- runtime/runtime_controller.h | 12 +- shell/common/engine.cc | 4 +- shell/common/engine.h | 4 +- shell/common/shell.cc | 88 ++++++---- shell/common/shell.h | 21 ++- testing/testing.cc | 4 +- testing/testing.h | 4 + 23 files changed, 740 insertions(+), 319 deletions(-) create mode 100644 runtime/dart_vm_data.cc create mode 100644 runtime/dart_vm_data.h create mode 100644 runtime/dart_vm_lifecycle.cc create mode 100644 runtime/dart_vm_lifecycle.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 8696116e1a11d..718c74a1c038a 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -355,6 +355,10 @@ FILE: ../../../flutter/runtime/dart_snapshot_buffer.cc FILE: ../../../flutter/runtime/dart_snapshot_buffer.h FILE: ../../../flutter/runtime/dart_vm.cc FILE: ../../../flutter/runtime/dart_vm.h +FILE: ../../../flutter/runtime/dart_vm_data.cc +FILE: ../../../flutter/runtime/dart_vm_data.h +FILE: ../../../flutter/runtime/dart_vm_lifecycle.cc +FILE: ../../../flutter/runtime/dart_vm_lifecycle.h FILE: ../../../flutter/runtime/dart_vm_unittests.cc FILE: ../../../flutter/runtime/embedder_resources.cc FILE: ../../../flutter/runtime/embedder_resources.h 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 7f4467886f4fa..3f7f80ef05fd7 100644 --- a/lib/ui/isolate_name_server/isolate_name_server_natives.cc +++ b/lib/ui/isolate_name_server/isolate_name_server_natives.cc @@ -14,8 +14,10 @@ namespace blink { Dart_Handle IsolateNameServerNatives::LookupPortByName( const std::string& name) { - IsolateNameServer* name_server = - UIDartState::Current()->GetIsolateNameServer(); + auto name_server = UIDartState::Current()->GetIsolateNameServer(); + if (!name_server) { + return Dart_Null(); + } Dart_Port port = name_server->LookupIsolatePortByName(name); if (port == ILLEGAL_PORT) { return Dart_Null(); @@ -26,8 +28,10 @@ Dart_Handle IsolateNameServerNatives::LookupPortByName( Dart_Handle IsolateNameServerNatives::RegisterPortWithName( Dart_Handle port_handle, const std::string& name) { - IsolateNameServer* name_server = - UIDartState::Current()->GetIsolateNameServer(); + auto name_server = UIDartState::Current()->GetIsolateNameServer(); + if (!name_server) { + return Dart_False(); + } Dart_Port port = ILLEGAL_PORT; Dart_SendPortGetId(port_handle, &port); if (!name_server->RegisterIsolatePortWithName(port, name)) { @@ -38,8 +42,10 @@ Dart_Handle IsolateNameServerNatives::RegisterPortWithName( Dart_Handle IsolateNameServerNatives::RemovePortNameMapping( const std::string& name) { - IsolateNameServer* name_server = - UIDartState::Current()->GetIsolateNameServer(); + auto name_server = UIDartState::Current()->GetIsolateNameServer(); + if (!name_server) { + return Dart_False(); + } if (!name_server->RemoveIsolateNameMapping(name)) { return Dart_False(); } diff --git a/lib/ui/ui_dart_state.cc b/lib/ui/ui_dart_state.cc index b42cbaf5ba607..be0a5348f31a1 100644 --- a/lib/ui/ui_dart_state.cc +++ b/lib/ui/ui_dart_state.cc @@ -23,7 +23,7 @@ UIDartState::UIDartState( std::string advisory_script_entrypoint, std::string logger_prefix, UnhandledExceptionCallback unhandled_exception_callback, - IsolateNameServer* isolate_name_server) + std::shared_ptr isolate_name_server) : task_runners_(std::move(task_runners)), add_callback_(std::move(add_callback)), remove_callback_(std::move(remove_callback)), @@ -33,7 +33,7 @@ UIDartState::UIDartState( advisory_script_entrypoint_(std::move(advisory_script_entrypoint)), logger_prefix_(std::move(logger_prefix)), unhandled_exception_callback_(unhandled_exception_callback), - isolate_name_server_(isolate_name_server) { + isolate_name_server_(std::move(isolate_name_server)) { AddOrRemoveTaskObserver(true /* add */); } @@ -124,7 +124,7 @@ fml::WeakPtr UIDartState::GetResourceContext() const { return io_manager_->GetResourceContext(); } -IsolateNameServer* UIDartState::GetIsolateNameServer() { +std::shared_ptr UIDartState::GetIsolateNameServer() const { return isolate_name_server_; } diff --git a/lib/ui/ui_dart_state.h b/lib/ui/ui_dart_state.h index f2c63cbacef60..afa5e47e83de8 100644 --- a/lib/ui/ui_dart_state.h +++ b/lib/ui/ui_dart_state.h @@ -53,7 +53,7 @@ class UIDartState : public tonic::DartState { fml::WeakPtr GetResourceContext() const; - IsolateNameServer* GetIsolateNameServer(); + std::shared_ptr GetIsolateNameServer() const; tonic::DartErrorHandleType GetLastError(); @@ -81,7 +81,7 @@ class UIDartState : public tonic::DartState { std::string advisory_script_entrypoint, std::string logger_prefix, UnhandledExceptionCallback unhandled_exception_callback, - IsolateNameServer* isolate_name_server); + std::shared_ptr isolate_name_server); ~UIDartState() override; @@ -107,7 +107,7 @@ class UIDartState : public tonic::DartState { std::unique_ptr window_; tonic::DartMicrotaskQueue microtask_queue_; UnhandledExceptionCallback unhandled_exception_callback_; - IsolateNameServer* isolate_name_server_; + const std::shared_ptr isolate_name_server_; void AddOrRemoveTaskObserver(bool add); }; diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index 5df979ed689a9..5619851dfee99 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -36,6 +36,10 @@ source_set("runtime") { "dart_snapshot_buffer.h", "dart_vm.cc", "dart_vm.h", + "dart_vm_data.cc", + "dart_vm_data.h", + "dart_vm_lifecycle.cc", + "dart_vm_lifecycle.h", "embedder_resources.cc", "embedder_resources.h", "runtime_controller.cc", @@ -73,7 +77,9 @@ source_set("runtime") { flutter_runtime_mode != "dynamic_release" && !is_fuchsia) { # Only link in Observatory in non-release modes on non-Fuchsia. Fuchsia # instead puts Observatory into the runner's package. - deps += [ "//third_party/dart/runtime/observatory:embedded_observatory_archive" ] + deps += [ + "//third_party/dart/runtime/observatory:embedded_observatory_archive", + ] } } @@ -95,6 +101,7 @@ executable("runtime_unittests") { ":runtime_fixtures", "$flutter_root/fml", "$flutter_root/lib/snapshot", + "$flutter_root/shell/common", "$flutter_root/testing", "//third_party/dart/runtime:libdart_jit", "//third_party/skia", diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 4340ccdc3918c..77e55afd69bba 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -14,6 +14,7 @@ #include "flutter/lib/ui/dart_ui.h" #include "flutter/runtime/dart_service_isolate.h" #include "flutter/runtime/dart_vm.h" +#include "flutter/runtime/dart_vm_lifecycle.h" #include "third_party/dart/runtime/include/dart_api.h" #include "third_party/dart/runtime/include/dart_tools_api.h" #include "third_party/tonic/converter/dart_converter.h" @@ -29,9 +30,9 @@ namespace blink { std::weak_ptr DartIsolate::CreateRootIsolate( - DartVM* vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + const Settings& settings, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, TaskRunners task_runners, std::unique_ptr window, fml::WeakPtr snapshot_delegate, @@ -50,7 +51,7 @@ 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 + settings, // settings std::move(isolate_snapshot), // isolate snapshot std::move(shared_snapshot), // shared snapshot task_runners, // task runners @@ -93,9 +94,9 @@ std::weak_ptr DartIsolate::CreateRootIsolate( return embedder_isolate; } -DartIsolate::DartIsolate(DartVM* vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, +DartIsolate::DartIsolate(const Settings& settings, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, TaskRunners task_runners, fml::WeakPtr snapshot_delegate, fml::WeakPtr io_manager, @@ -103,36 +104,31 @@ DartIsolate::DartIsolate(DartVM* vm, std::string advisory_script_entrypoint, ChildIsolatePreparer child_isolate_preparer) : UIDartState(std::move(task_runners), - vm->GetSettings().task_observer_add, - vm->GetSettings().task_observer_remove, + settings.task_observer_add, + settings.task_observer_remove, std::move(snapshot_delegate), std::move(io_manager), advisory_script_uri, advisory_script_entrypoint, - vm->GetSettings().log_tag, - vm->GetSettings().unhandled_exception_callback, - vm->GetIsolateNameServer()), - vm_(vm), + settings.log_tag, + settings.unhandled_exception_callback, + DartVMRef::GetIsolateNameServer()), + settings_(settings), isolate_snapshot_(std::move(isolate_snapshot)), shared_snapshot_(std::move(shared_snapshot)), child_isolate_preparer_(std::move(child_isolate_preparer)) { FML_DCHECK(isolate_snapshot_) << "Must contain a valid isolate snapshot."; - - if (vm_ == nullptr) { - return; - } - phase_ = Phase::Uninitialized; } DartIsolate::~DartIsolate() = default; -DartIsolate::Phase DartIsolate::GetPhase() const { - return phase_; +const Settings& DartIsolate::GetSettings() const { + return settings_; } -DartVM* DartIsolate::GetDartVM() const { - return vm_; +DartIsolate::Phase DartIsolate::GetPhase() const { + return phase_; } bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) { @@ -493,16 +489,16 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( const char* package_config, Dart_IsolateFlags* flags, char** error) { - auto vm = DartVM::ForProcessIfInitialized(); + auto vm_data = DartVMRef::GetVMData(); - if (!vm) { + if (!vm_data) { *error = strdup( - "Could not resolve the VM when attempting to create the service " - "isolate."); + "Could not access VM data to initialize isolates. This may be because " + "the VM has initialized shutdown on another thread already."); return nullptr; } - const auto& settings = vm->GetSettings(); + const auto& settings = vm_data->GetSettings(); if (!settings.enable_observatory) { FML_DLOG(INFO) << "Observatory is disabled."; @@ -515,21 +511,26 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( flags->load_vmservice_library = true; + if (advisory_script_uri == nullptr) { + advisory_script_uri = ""; + } + + if (advisory_script_entrypoint == nullptr) { + advisory_script_entrypoint = ""; + } + std::weak_ptr weak_service_isolate = DartIsolate::CreateRootIsolate( - vm.get(), // vm - vm->GetIsolateSnapshot(), // isolate snapshot - vm->GetSharedSnapshot(), // shared snapshot - null_task_runners, // task runners - nullptr, // window - {}, // snapshot delegate - {}, // IO Manager - advisory_script_uri == nullptr ? "" - : advisory_script_uri, // script uri - advisory_script_entrypoint == nullptr - ? "" - : advisory_script_entrypoint, // script entrypoint - flags // flags + vm_data->GetSettings(), // settings + vm_data->GetIsolateSnapshot(), // service isolate snapshot + vm_data->GetSharedSnapshot(), // shared snapshot + null_task_runners, // service isolate task runners + nullptr, // window + {}, // snapshot delegate + {}, // IO Manager + advisory_script_uri, // script uri + advisory_script_entrypoint, // script entrypoint + flags // flags ); std::shared_ptr service_isolate = weak_service_isolate.lock(); @@ -552,7 +553,13 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( return nullptr; } - vm->GetServiceProtocol().ToggleHooks(true); + if (auto service_protocol = DartVMRef::GetServiceProtocol()) { + service_protocol->ToggleHooks(true); + } else { + FML_DLOG(ERROR) + << "Could not acquire the service protocol handlers. This might be " + "because the VM has already begun teardown on another thread."; + } return service_isolate->isolate(); } @@ -610,16 +617,13 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( std::unique_ptr> embedder_isolate( p_parent_embedder_isolate); - if (embedder_isolate == nullptr || - (*embedder_isolate)->GetDartVM() == nullptr) { + if (embedder_isolate == nullptr) { *error = strdup("Parent isolate did not have embedder specific callback data."); FML_DLOG(ERROR) << *error; return {nullptr, {}}; } - DartVM* const vm = (*embedder_isolate)->GetDartVM(); - if (!is_root_isolate) { auto* raw_embedder_isolate = embedder_isolate.release(); @@ -628,7 +632,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( embedder_isolate = std::make_unique>( std::make_shared( - vm, // vm + (*raw_embedder_isolate)->GetSettings(), // settings (*raw_embedder_isolate)->GetIsolateSnapshot(), // isolate_snapshot (*raw_embedder_isolate)->GetSharedSnapshot(), // shared_snapshot null_task_runners, // task_runners @@ -701,11 +705,11 @@ void DartIsolate::DartIsolateCleanupCallback( delete embedder_isolate; } -fml::RefPtr DartIsolate::GetIsolateSnapshot() const { +fml::RefPtr DartIsolate::GetIsolateSnapshot() const { return isolate_snapshot_; } -fml::RefPtr DartIsolate::GetSharedSnapshot() const { +fml::RefPtr DartIsolate::GetSharedSnapshot() const { return shared_snapshot_; } diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index bcd90a80d112a..31a0ca9c99df4 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -41,9 +41,9 @@ class DartIsolate : public UIDartState { // bindings. From the VM's perspective, this isolate is not special in any // way. static std::weak_ptr CreateRootIsolate( - DartVM* vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + const Settings& settings, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, TaskRunners task_runners, std::unique_ptr window, fml::WeakPtr snapshot_delegate, @@ -52,9 +52,9 @@ class DartIsolate : public UIDartState { std::string advisory_script_entrypoint, Dart_IsolateFlags* flags = nullptr); - DartIsolate(DartVM* vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + DartIsolate(const Settings& settings, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, TaskRunners task_runners, fml::WeakPtr snapshot_delegate, fml::WeakPtr io_manager, @@ -64,6 +64,8 @@ class DartIsolate : public UIDartState { ~DartIsolate() override; + const Settings& GetSettings() const; + Phase GetPhase() const; FML_WARN_UNUSED_RESULT @@ -85,11 +87,9 @@ class DartIsolate : public UIDartState { void AddIsolateShutdownCallback(fml::closure closure); - DartVM* GetDartVM() const; - - fml::RefPtr GetIsolateSnapshot() const; + fml::RefPtr GetIsolateSnapshot() const; - fml::RefPtr GetSharedSnapshot() const; + fml::RefPtr GetSharedSnapshot() const; std::weak_ptr GetWeakIsolatePtr(); @@ -108,10 +108,10 @@ class DartIsolate : public UIDartState { }; friend class DartVM; - DartVM* const vm_ = nullptr; Phase phase_ = Phase::Unknown; - const fml::RefPtr isolate_snapshot_; - const fml::RefPtr shared_snapshot_; + const Settings settings_; + const fml::RefPtr isolate_snapshot_; + const fml::RefPtr shared_snapshot_; std::vector> kernel_buffers_; std::vector> shutdown_callbacks_; ChildIsolatePreparer child_isolate_preparer_ = nullptr; diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc index ab6c29617ecf3..1ebb335be0817 100644 --- a/runtime/dart_isolate_unittests.cc +++ b/runtime/dart_isolate_unittests.cc @@ -7,15 +7,11 @@ #include "flutter/fml/thread.h" #include "flutter/runtime/dart_isolate.h" #include "flutter/runtime/dart_vm.h" +#include "flutter/runtime/dart_vm_lifecycle.h" #include "flutter/testing/testing.h" #include "flutter/testing/thread_test.h" #include "third_party/tonic/scopes/dart_isolate_scope.h" -#define CURRENT_TEST_NAME \ - std::string { \ - ::testing::UnitTest::GetInstance()->current_test_info()->name() \ - } - namespace blink { using DartIsolateTest = ::testing::ThreadTest; @@ -24,24 +20,26 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) { Settings settings = {}; settings.task_observer_add = [](intptr_t, fml::closure) {}; settings.task_observer_remove = [](intptr_t) {}; - auto vm = DartVM::ForProcess(settings); + auto vm = DartVMRef::Create(settings); ASSERT_TRUE(vm); - TaskRunners task_runners(CURRENT_TEST_NAME, // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner() // + auto vm_data = vm->GetVMData(); + ASSERT_TRUE(vm_data); + TaskRunners task_runners(testing::GetCurrentTestName(), // + 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 - {}, // io manager - "main.dart", // advisory uri - "main" // advisory entrypoint + vm_data->GetSettings(), // settings + vm_data->GetIsolateSnapshot(), // isolate snapshot + vm_data->GetSharedSnapshot(), // shared snapshot + std::move(task_runners), // task runners + nullptr, // window + {}, // snapshot delegate + {}, // io manager + "main.dart", // advisory uri + "main" // advisory entrypoint ); auto root_isolate = weak_isolate.lock(); ASSERT_TRUE(root_isolate); @@ -53,24 +51,26 @@ 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); + auto vm = DartVMRef::Create(settings); ASSERT_TRUE(vm); - TaskRunners task_runners(CURRENT_TEST_NAME, // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner() // + auto vm_data = vm->GetVMData(); + ASSERT_TRUE(vm_data); + TaskRunners task_runners(testing::GetCurrentTestName(), // + 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 - {}, // io manager - "main.dart", // advisory uri - "main" // advisory entrypoint + vm_data->GetSettings(), // settings + vm_data->GetIsolateSnapshot(), // isolate snapshot + vm_data->GetSharedSnapshot(), // shared snapshot + std::move(task_runners), // task runners + nullptr, // window + {}, // snapshot delegate + {}, // io manager + "main.dart", // advisory uri + "main" // advisory entrypoint ); auto root_isolate = weak_isolate.lock(); ASSERT_TRUE(root_isolate); @@ -86,8 +86,11 @@ TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) { class AutoIsolateShutdown { public: - AutoIsolateShutdown(std::shared_ptr isolate) - : isolate_(std::move(isolate)) {} + AutoIsolateShutdown(blink::DartVMRef vm, + std::shared_ptr isolate) + : vm_(std::move(vm)), isolate_(std::move(isolate)) { + FML_CHECK(vm_); + } ~AutoIsolateShutdown() { if (isolate_) { @@ -119,6 +122,7 @@ class AutoIsolateShutdown { } private: + blink::DartVMRef vm_; std::shared_ptr isolate_; FML_DISALLOW_COPY_AND_ASSIGN(AutoIsolateShutdown); @@ -128,35 +132,38 @@ std::unique_ptr RunDartCodeInIsolate( fml::RefPtr task_runner, std::string entrypoint) { Settings settings = {}; + settings.enable_observatory = true; settings.task_observer_add = [](intptr_t, fml::closure) {}; settings.task_observer_remove = [](intptr_t) {}; - auto vm = DartVM::ForProcess(settings); - + auto vm = DartVMRef::Create(settings); if (!vm) { return {}; } - TaskRunners task_runners(CURRENT_TEST_NAME, // - task_runner, // - task_runner, // - task_runner, // - task_runner // + + auto vm_data = vm->GetVMData(); + + TaskRunners task_runners(testing::GetCurrentTestName(), // + task_runner, // + task_runner, // + task_runner, // + task_runner // ); 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 - {}, // io manager - "main.dart", // advisory uri - "main" // advisory entrypoint + vm_data->GetSettings(), // settings + vm_data->GetIsolateSnapshot(), // isolate snapshot + vm_data->GetSharedSnapshot(), // shared snapshot + std::move(task_runners), // task runners + nullptr, // window + {}, // snapshot delegate + {}, // io manager + "main.dart", // advisory uri + "main" // advisory entrypoint ); auto root_isolate = - std::make_unique(weak_isolate.lock()); + std::make_unique(std::move(vm), weak_isolate.lock()); if (!root_isolate->IsValid()) { FML_LOG(ERROR) << "Could not create isolate."; diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 382ab05c344f2..fd75c3039e42b 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -15,6 +15,7 @@ #include "flutter/fml/file.h" #include "flutter/fml/logging.h" #include "flutter/fml/mapping.h" +#include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/time/time_delta.h" #include "flutter/fml/trace_event.h" #include "flutter/lib/io/dart_io.h" @@ -239,66 +240,48 @@ static void EmbedderInformationCallback(Dart_EmbedderInformation* info) { info->name = "Flutter"; } -fml::RefPtr DartVM::ForProcess(Settings settings) { - return ForProcess(settings, nullptr, nullptr, nullptr); -} - -static std::once_flag gVMInitialization; -static std::mutex gVMMutex; -static fml::RefPtr gVM; - -fml::RefPtr DartVM::ForProcess( +std::shared_ptr DartVM::Create( Settings settings, fml::RefPtr vm_snapshot, fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot) { - std::lock_guard lock(gVMMutex); - std::call_once(gVMInitialization, [settings, // - vm_snapshot, // - isolate_snapshot, // - shared_snapshot // - ]() mutable { - if (!vm_snapshot) { - vm_snapshot = DartSnapshot::VMSnapshotFromSettings(settings); - } - if (!(vm_snapshot && vm_snapshot->IsValid())) { - FML_LOG(ERROR) << "VM snapshot must be valid."; - return; - } - if (!isolate_snapshot) { - isolate_snapshot = DartSnapshot::IsolateSnapshotFromSettings(settings); - } - if (!(isolate_snapshot && isolate_snapshot->IsValid())) { - FML_LOG(ERROR) << "Isolate snapshot must be valid."; - return; - } - if (!shared_snapshot) { - shared_snapshot = DartSnapshot::Empty(); - } - gVM = fml::MakeRefCounted(settings, // - std::move(vm_snapshot), // - std::move(isolate_snapshot), // - std::move(shared_snapshot) // - ); - }); - return gVM; + fml::RefPtr shared_snapshot, + std::shared_ptr isolate_name_server) { + auto vm_data = DartVMData::Create(settings, // + std::move(vm_snapshot), // + std::move(isolate_snapshot), // + std::move(shared_snapshot) // + ); + + if (!vm_data) { + FML_LOG(ERROR) << "Could not setup VM data to bootstrap the VM from."; + return {}; + } + + // Note: std::make_shared unviable due to hidden constructor. + return std::shared_ptr( + new DartVM(std::move(vm_data), std::move(isolate_name_server))); } -fml::RefPtr DartVM::ForProcessIfInitialized() { - std::lock_guard lock(gVMMutex); - return gVM; +static std::atomic_size_t gVMLaunchCount; + +size_t DartVM::GetVMLaunchCount() { + return gVMLaunchCount; } -DartVM::DartVM(const Settings& settings, - fml::RefPtr vm_snapshot, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot) - : settings_(settings), - vm_snapshot_(std::move(vm_snapshot)), - isolate_snapshot_(std::move(isolate_snapshot)), - shared_snapshot_(std::move(shared_snapshot)), - weak_factory_(this) { +DartVM::DartVM(std::shared_ptr vm_data, + std::shared_ptr isolate_name_server) + : settings_(vm_data->GetSettings()), + vm_data_(vm_data), + isolate_name_server_(std::move(isolate_name_server)), + service_protocol_(std::make_shared()) { TRACE_EVENT0("flutter", "DartVMInitializer"); + + gVMLaunchCount++; + + FML_DCHECK(vm_data_); + FML_DCHECK(isolate_name_server_); + FML_DCHECK(service_protocol_); + FML_DLOG(INFO) << "Attempting Dart VM launch for mode: " << (IsRunningPrecompiledCode() ? "AOT" : "Interpreter"); @@ -306,8 +289,8 @@ DartVM::DartVM(const Settings& settings, TRACE_EVENT0("flutter", "dart::bin::BootstrapDartIo"); dart::bin::BootstrapDartIo(); - if (!settings.temp_directory_path.empty()) { - dart::bin::SetSystemTempDirectory(settings.temp_directory_path.c_str()); + if (!settings_.temp_directory_path.empty()) { + dart::bin::SetSystemTempDirectory(settings_.temp_directory_path.c_str()); } } @@ -320,7 +303,7 @@ DartVM::DartVM(const Settings& settings, args.push_back("--ignore-unrecognized-flags"); for (auto* const profiler_flag : - ProfilingFlags(settings.enable_dart_profiling)) { + ProfilingFlags(settings_.enable_dart_profiling)) { args.push_back(profiler_flag); } @@ -333,7 +316,7 @@ DartVM::DartVM(const Settings& settings, // Enable Dart assertions if we are not running precompiled code. We run non- // precompiled code only in the debug product mode. - bool enable_asserts = !settings.disable_dart_asserts; + bool enable_asserts = !settings_.disable_dart_asserts; #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_PROFILE || \ FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE @@ -357,24 +340,24 @@ DartVM::DartVM(const Settings& settings, PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); } - if (settings.start_paused) { + if (settings_.start_paused) { PushBackAll(&args, kDartStartPausedArgs, arraysize(kDartStartPausedArgs)); } - if (settings.endless_trace_buffer || settings.trace_startup) { + if (settings_.endless_trace_buffer || settings_.trace_startup) { // If we are tracing startup, make sure the trace buffer is endless so we // don't lose early traces. PushBackAll(&args, kDartEndlessTraceBufferArgs, arraysize(kDartEndlessTraceBufferArgs)); } - if (settings.trace_systrace) { + if (settings_.trace_systrace) { PushBackAll(&args, kDartSystraceTraceBufferArgs, arraysize(kDartSystraceTraceBufferArgs)); PushBackAll(&args, kDartTraceStreamsArgs, arraysize(kDartTraceStreamsArgs)); } - if (settings.trace_startup) { + if (settings_.trace_startup) { PushBackAll(&args, kDartTraceStartupArgs, arraysize(kDartTraceStartupArgs)); } @@ -383,8 +366,8 @@ DartVM::DartVM(const Settings& settings, PushBackAll(&args, kDartTraceStreamsArgs, arraysize(kDartTraceStreamsArgs)); #endif - for (size_t i = 0; i < settings.dart_flags.size(); i++) - args.push_back(settings.dart_flags[i].c_str()); + for (size_t i = 0; i < settings_.dart_flags.size(); i++) + args.push_back(settings_.dart_flags[i].c_str()); char* flags_error = Dart_SetVMFlags(args.size(), args.data()); if (flags_error) { @@ -394,14 +377,14 @@ DartVM::DartVM(const Settings& settings, DartUI::InitForGlobal(); - Dart_SetFileModifiedCallback(&DartFileModifiedCallback); - { TRACE_EVENT0("flutter", "Dart_Initialize"); Dart_InitializeParams params = {}; params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION; - params.vm_snapshot_data = vm_snapshot_->GetData()->GetSnapshotPointer(); - params.vm_snapshot_instructions = vm_snapshot_->GetInstructionsIfPresent(); + params.vm_snapshot_data = + vm_data_->GetVMSnapshot().GetData()->GetSnapshotPointer(); + params.vm_snapshot_instructions = + vm_data_->GetVMSnapshot().GetInstructionsIfPresent(); params.create = reinterpret_cast( DartIsolate::DartIsolateCreateCallback); params.shutdown = reinterpret_cast( @@ -433,51 +416,50 @@ DartVM::DartVM(const Settings& settings, } } + Dart_SetFileModifiedCallback(&DartFileModifiedCallback); + // Allow streaming of stdout and stderr by the Dart vm. Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback, &ServiceStreamCancelCallback); Dart_SetEmbedderInformationCallback(&EmbedderInformationCallback); + + FML_DLOG(INFO) << "New Dart VM instance created. Instance count: " + << gVMLaunchCount; } DartVM::~DartVM() { if (Dart_CurrentIsolate() != nullptr) { Dart_ExitIsolate(); } + char* result = Dart_Cleanup(); - if (result != nullptr) { - FML_LOG(ERROR) << "Could not cleanly shut down the Dart VM. Message: \"" - << result << "\"."; - free(result); - } -} -const Settings& DartVM::GetSettings() const { - return settings_; -} + dart::bin::CleanupDartIo(); -const DartSnapshot& DartVM::GetVMSnapshot() const { - return *vm_snapshot_.get(); -} + FML_CHECK(result == nullptr) + << "Could not cleanly shut down the Dart VM. Error: \"" << result + << "\"."; + free(result); -IsolateNameServer* DartVM::GetIsolateNameServer() { - return &isolate_name_server_; + FML_DLOG(INFO) << "Dart VM instance destroyed. Instance count: " + << gVMLaunchCount; } -fml::RefPtr DartVM::GetIsolateSnapshot() const { - return isolate_snapshot_; +std::shared_ptr DartVM::GetVMData() const { + return vm_data_; } -fml::RefPtr DartVM::GetSharedSnapshot() const { - return shared_snapshot_; +const Settings& DartVM::GetSettings() const { + return settings_; } -ServiceProtocol& DartVM::GetServiceProtocol() { +std::shared_ptr DartVM::GetServiceProtocol() const { return service_protocol_; } -fml::WeakPtr DartVM::GetWeakPtr() { - return weak_factory_.GetWeakPtr(); +std::shared_ptr DartVM::GetIsolateNameServer() const { + return isolate_name_server_; } } // namespace blink diff --git a/runtime/dart_vm.h b/runtime/dart_vm.h index 9a1bde888dd86..1249490880dc0 100644 --- a/runtime/dart_vm.h +++ b/runtime/dart_vm.h @@ -5,9 +5,8 @@ #ifndef FLUTTER_RUNTIME_DART_VM_H_ #define FLUTTER_RUNTIME_DART_VM_H_ -#include +#include #include -#include #include "flutter/common/settings.h" #include "flutter/fml/build_config.h" @@ -19,59 +18,48 @@ #include "flutter/lib/ui/isolate_name_server/isolate_name_server.h" #include "flutter/runtime/dart_isolate.h" #include "flutter/runtime/dart_snapshot.h" +#include "flutter/runtime/dart_vm_data.h" #include "flutter/runtime/service_protocol.h" #include "third_party/dart/runtime/include/dart_api.h" namespace blink { -class DartVM : public fml::RefCountedThreadSafe { +class DartVM { public: - static fml::RefPtr ForProcess(Settings settings); - - static fml::RefPtr ForProcess( - Settings settings, - fml::RefPtr vm_snapshot, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot); - - static fml::RefPtr ForProcessIfInitialized(); + ~DartVM(); static bool IsRunningPrecompiledCode(); static bool IsKernelMapping(const fml::FileMapping* mapping); - const Settings& GetSettings() const; - - const DartSnapshot& GetVMSnapshot() const; + static size_t GetVMLaunchCount(); - IsolateNameServer* GetIsolateNameServer(); - - fml::RefPtr GetIsolateSnapshot() const; + const Settings& GetSettings() const; - fml::RefPtr GetSharedSnapshot() const; + std::shared_ptr GetVMData() const; - fml::WeakPtr GetWeakPtr(); + std::shared_ptr GetServiceProtocol() const; - ServiceProtocol& GetServiceProtocol(); + std::shared_ptr GetIsolateNameServer() const; private: const Settings settings_; - const fml::RefPtr vm_snapshot_; - IsolateNameServer isolate_name_server_; - const fml::RefPtr isolate_snapshot_; - const fml::RefPtr shared_snapshot_; - ServiceProtocol service_protocol_; - fml::WeakPtrFactory weak_factory_; - - DartVM(const Settings& settings, - fml::RefPtr vm_snapshot, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot); + std::shared_ptr vm_data_; + const std::shared_ptr isolate_name_server_; + const std::shared_ptr service_protocol_; - ~DartVM(); + friend class DartVMRef; + + static std::shared_ptr Create( + Settings settings, + fml::RefPtr vm_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, + std::shared_ptr isolate_name_server); + + DartVM(std::shared_ptr data, + std::shared_ptr isolate_name_server); - FML_FRIEND_REF_COUNTED_THREAD_SAFE(DartVM); - FML_FRIEND_MAKE_REF_COUNTED(DartVM); FML_DISALLOW_COPY_AND_ASSIGN(DartVM); }; diff --git a/runtime/dart_vm_data.cc b/runtime/dart_vm_data.cc new file mode 100644 index 0000000000000..a29074f79c92e --- /dev/null +++ b/runtime/dart_vm_data.cc @@ -0,0 +1,79 @@ +// Copyright 2013 The Flutter 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_vm_data.h" + +namespace blink { + +std::shared_ptr DartVMData::Create( + Settings settings, + fml::RefPtr vm_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot) { + if (!vm_snapshot || !vm_snapshot->IsValid()) { + // Caller did not provide a valid VM snapshot. Attempt to infer one + // from the settings. + vm_snapshot = DartSnapshot::VMSnapshotFromSettings(settings); + if (!vm_snapshot) { + FML_LOG(ERROR) + << "VM snapshot invalid and could not be inferred from settings."; + return {}; + } + } + + if (!isolate_snapshot || !isolate_snapshot->IsValid()) { + // Caller did not provide a valid isolate snapshot. Attempt to infer one + // from the settings. + isolate_snapshot = DartSnapshot::IsolateSnapshotFromSettings(settings); + if (!isolate_snapshot) { + FML_LOG(ERROR) << "Isolate snapshot invalid and could not be inferred " + "from settings."; + return {}; + } + } + + if (!shared_snapshot || !shared_snapshot->IsValid()) { + shared_snapshot = DartSnapshot::Empty(); + if (!shared_snapshot) { + FML_LOG(ERROR) << "Shared snapshot invalid."; + return {}; + } + } + + return std::shared_ptr(new DartVMData( + std::move(settings), // + std::move(vm_snapshot), // + std::move(isolate_snapshot), // + std::move(shared_snapshot) // + )); +} + +DartVMData::DartVMData(Settings settings, + fml::RefPtr vm_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot) + : settings_(settings), + vm_snapshot_(vm_snapshot), + isolate_snapshot_(isolate_snapshot), + shared_snapshot_(shared_snapshot) {} + +DartVMData::~DartVMData() = default; + +const Settings& DartVMData::GetSettings() const { + return settings_; +} + +const DartSnapshot& DartVMData::GetVMSnapshot() const { + return *vm_snapshot_; +} + +fml::RefPtr DartVMData::GetIsolateSnapshot() const { + return isolate_snapshot_; +} + +fml::RefPtr DartVMData::GetSharedSnapshot() const { + return shared_snapshot_; +} + +} // namespace blink diff --git a/runtime/dart_vm_data.h b/runtime/dart_vm_data.h new file mode 100644 index 0000000000000..906cad1a4ca05 --- /dev/null +++ b/runtime/dart_vm_data.h @@ -0,0 +1,47 @@ +// Copyright 2013 The Flutter 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_VM_DATA_H_ +#define FLUTTER_RUNTIME_DART_VM_DATA_H_ + +#include "flutter/fml/macros.h" +#include "flutter/runtime/dart_snapshot.h" + +namespace blink { + +class DartVMData { + public: + static std::shared_ptr Create( + Settings settings, + fml::RefPtr vm_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot); + + ~DartVMData(); + + const Settings& GetSettings() const; + + const DartSnapshot& GetVMSnapshot() const; + + fml::RefPtr GetIsolateSnapshot() const; + + fml::RefPtr GetSharedSnapshot() const; + + private: + const Settings settings_; + const fml::RefPtr vm_snapshot_; + const fml::RefPtr isolate_snapshot_; + const fml::RefPtr shared_snapshot_; + + DartVMData(Settings settings, + fml::RefPtr vm_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot); + + FML_DISALLOW_COPY_AND_ASSIGN(DartVMData); +}; + +} // namespace blink + +#endif // FLUTTER_RUNTIME_DART_VM_DATA_H_ diff --git a/runtime/dart_vm_lifecycle.cc b/runtime/dart_vm_lifecycle.cc new file mode 100644 index 0000000000000..e34132dd6b4cd --- /dev/null +++ b/runtime/dart_vm_lifecycle.cc @@ -0,0 +1,112 @@ +// Copyright 2013 The Flutter 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_vm_lifecycle.h" + +#include + +namespace blink { + +// We need to explicitly put the constructor and destructor of the DartVM in the +// critical section. All accesses (not just const members) to the global VM +// object weak pointer are behind this mutex. +static std::mutex gVMMutex; +static std::weak_ptr gVM FML_GUARDED_BY(gVMMutex); + +// We are going to be modifying more than just the control blocks of the +// following weak pointers (in the |Create| case where an old VM could not be +// reused). Ideally, we would use |std::atomic>| specialization +// but that is only available since C++20. We don't expect contention on these +// locks so we just use one mutex for all. +static std::mutex gVMDependentsMutex; +static std::weak_ptr gVMData + FML_GUARDED_BY(gVMDependentsMutex); +static std::weak_ptr gVMServiceProtocol + FML_GUARDED_BY(gVMDependentsMutex); +static std::weak_ptr gVMIsolateNameServer + FML_GUARDED_BY(gVMDependentsMutex); + +DartVMRef::DartVMRef(std::shared_ptr vm) : vm_(vm) {} + +DartVMRef::DartVMRef(DartVMRef&& other) = default; + +DartVMRef::~DartVMRef() { + if (!vm_) { + // If there is no valid VM (possible via a move), there is no way that the + // decrement on the shared pointer can cause a collection. Avoid acquiring + // the lifecycle lock in this case. This is just working around a + // pessimization and not required for correctness. + return; + } + std::lock_guard lifecycle_lock(gVMMutex); + vm_.reset(); +} + +DartVMRef DartVMRef::Create(Settings settings, + fml::RefPtr vm_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot) { + std::lock_guard lifecycle_lock(gVMMutex); + + // If there is already a running VM in the process, grab a strong reference to + // it. + if (auto vm = gVM.lock()) { + FML_DLOG(WARNING) << "Attempted to create a VM in a process where one was " + "already running. Ignoring arguments for current VM " + "create call and reusing the old VM."; + // There was already a running VM in the process, + return DartVMRef{std::move(vm)}; + } + + std::lock_guard dependents_lock(gVMDependentsMutex); + + gVMData.reset(); + gVMServiceProtocol.reset(); + gVMIsolateNameServer.reset(); + gVM.reset(); + + // If there is no VM in the process. Initialize one, hold the weak reference + // and pass a strong reference to the caller. + auto isolate_name_server = std::make_shared(); + auto vm = DartVM::Create(std::move(settings), // + std::move(vm_snapshot), // + std::move(isolate_snapshot), // + std::move(shared_snapshot), // + isolate_name_server // + ); + + if (!vm) { + FML_LOG(ERROR) << "Could not create Dart VM instance."; + return {nullptr}; + } + + gVMData = vm->GetVMData(); + gVMServiceProtocol = vm->GetServiceProtocol(); + gVMIsolateNameServer = isolate_name_server; + + gVM = vm; + return DartVMRef{std::move(vm)}; +} + +bool DartVMRef::IsInstanceRunning() { + std::lock_guard lock(gVMMutex); + return !gVM.expired(); +} + +std::shared_ptr DartVMRef::GetVMData() { + std::lock_guard lock(gVMDependentsMutex); + return gVMData.lock(); +} + +std::shared_ptr DartVMRef::GetServiceProtocol() { + std::lock_guard lock(gVMDependentsMutex); + return gVMServiceProtocol.lock(); +} + +std::shared_ptr DartVMRef::GetIsolateNameServer() { + std::lock_guard lock(gVMDependentsMutex); + return gVMIsolateNameServer.lock(); +} + +} // namespace blink diff --git a/runtime/dart_vm_lifecycle.h b/runtime/dart_vm_lifecycle.h new file mode 100644 index 0000000000000..cfe1f1b646469 --- /dev/null +++ b/runtime/dart_vm_lifecycle.h @@ -0,0 +1,72 @@ +// Copyright 2013 The Flutter 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_VM_LIFECYCLE_H_ +#define FLUTTER_RUNTIME_DART_VM_LIFECYCLE_H_ + +#include + +#include "flutter/fml/macros.h" +#include "flutter/lib/ui/isolate_name_server/isolate_name_server.h" +#include "flutter/runtime/dart_vm.h" +#include "flutter/runtime/service_protocol.h" + +namespace blink { + +// A strong reference to the Dart VM. There can only be one VM running in the +// process at any given time. A reference to the VM may only be obtained via the +// |Create| method. In case there is already a running instance of the VM in the +// process, a strong reference to that VM is obtained and the arguments to the +// |Create| call ignored. If there is no VM already running in the process, a VM +// is initialized in a thread safe manner and returned to the caller. The VM +// will shutdown only when all callers relinquish their references (by +// collecting their instances of this class). +// +// DartVMRef instances may be created on any thread. +class DartVMRef { + public: + FML_WARN_UNUSED_RESULT + static DartVMRef Create(Settings settings, + fml::RefPtr vm_snapshot = nullptr, + fml::RefPtr isolate_snapshot = nullptr, + fml::RefPtr shared_snapshot = nullptr); + + DartVMRef(DartVMRef&&); + + ~DartVMRef(); + + // This is an inherently racy way to check if a VM instance is running and + // should not be used outside of unit-tests where there is a known threading + // model. + static bool IsInstanceRunning(); + + static std::shared_ptr GetVMData(); + + static std::shared_ptr GetServiceProtocol(); + + static std::shared_ptr GetIsolateNameServer(); + + operator bool() const { return static_cast(vm_); } + + DartVM* operator->() { + FML_DCHECK(vm_); + return vm_.get(); + } + + DartVM* operator&() { + FML_DCHECK(vm_); + return vm_.get(); + } + + private: + std::shared_ptr vm_; + + DartVMRef(std::shared_ptr vm); + + FML_DISALLOW_COPY_AND_ASSIGN(DartVMRef); +}; + +} // namespace blink + +#endif // FLUTTER_RUNTIME_DART_VM_LIFECYCLE_H_ diff --git a/runtime/dart_vm_unittests.cc b/runtime/dart_vm_unittests.cc index 21e3d3d3fa58f..b3653333b51de 100644 --- a/runtime/dart_vm_unittests.cc +++ b/runtime/dart_vm_unittests.cc @@ -3,25 +3,36 @@ // found in the LICENSE file. #include "flutter/runtime/dart_vm.h" +#include "flutter/runtime/dart_vm_lifecycle.h" +#include "flutter/shell/common/thread_host.h" +#include "flutter/testing/testing.h" +#include "flutter/testing/thread_test.h" #include "gtest/gtest.h" namespace blink { -TEST(DartVM, SimpleInitialization) { - Settings settings = {}; +static Settings GetTestSettings() { + Settings settings; + settings.verbose_logging = true; settings.task_observer_add = [](intptr_t, fml::closure) {}; settings.task_observer_remove = [](intptr_t) {}; - auto vm = DartVM::ForProcess(settings); - ASSERT_TRUE(vm); - ASSERT_EQ(vm, DartVM::ForProcess(settings)); + return settings; +} + +TEST(DartVM, SimpleInitialization) { + auto vm1 = DartVMRef::Create(GetTestSettings()); + ASSERT_TRUE(vm1); + + // Multiple initializations should return the same VM. + auto vm2 = DartVMRef::Create(GetTestSettings()); + ASSERT_TRUE(vm2); + + ASSERT_EQ(&vm1, &vm2); ASSERT_FALSE(DartVM::IsRunningPrecompiledCode()); } TEST(DartVM, SimpleIsolateNameServer) { - Settings settings = {}; - settings.task_observer_add = [](intptr_t, fml::closure) {}; - settings.task_observer_remove = [](intptr_t) {}; - auto vm = DartVM::ForProcess(settings); + auto vm = DartVMRef::Create(GetTestSettings()); auto ns = vm->GetIsolateNameServer(); ASSERT_EQ(ns->LookupIsolatePortByName("foobar"), ILLEGAL_PORT); ASSERT_FALSE(ns->RemoveIsolateNameMapping("foobar")); @@ -31,4 +42,79 @@ TEST(DartVM, SimpleIsolateNameServer) { ASSERT_TRUE(ns->RemoveIsolateNameMapping("foobar")); } +TEST(DartVM, CanReinitializeVMOverAndOver) { + size_t vm_launch_count = DartVM::GetVMLaunchCount(); + for (size_t i = 0; i < 1000; ++i) { + FML_LOG(INFO) << "Run " << i + 1; + + // VM should not already be running. + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); + + auto vm = DartVMRef::Create(GetTestSettings()); + ASSERT_TRUE(vm); + size_t new_vm_launch_count = DartVM::GetVMLaunchCount(); + ASSERT_EQ(vm_launch_count + 1, new_vm_launch_count); + vm_launch_count = new_vm_launch_count; + + // VM should now be running + ASSERT_TRUE(DartVMRef::IsInstanceRunning()); + } +} + +using DartVMThreadTest = ::testing::ThreadTest; + +TEST_F(DartVMThreadTest, CanRunIsolatesInANewVM) { + for (size_t i = 0; i < 1000; ++i) { + FML_LOG(INFO) << "Run " << i + 1; + size_t vm_launch_count = DartVM::GetVMLaunchCount(); + + // VM should not already be running. + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); + + auto vm = DartVMRef::Create(GetTestSettings()); + ASSERT_TRUE(vm); + + // VM should not already be running. + ASSERT_TRUE(DartVMRef::IsInstanceRunning()); + + size_t new_vm_launch_count = DartVM::GetVMLaunchCount(); + ASSERT_EQ(vm_launch_count + 1, new_vm_launch_count); + + Settings settings = {}; + + settings.task_observer_add = [](intptr_t, fml::closure) {}; + settings.task_observer_remove = [](intptr_t) {}; + + auto labels = testing::GetCurrentTestName() + std::to_string(i); + shell::ThreadHost host(labels, shell::ThreadHost::Type::UI | + shell::ThreadHost::Type::GPU | + shell::ThreadHost::Type::IO); + + TaskRunners task_runners( + labels, // task runner labels + GetCurrentTaskRunner(), // platform task runner + host.gpu_thread->GetTaskRunner(), // GPU task runner + host.ui_thread->GetTaskRunner(), // UI task runner + host.io_thread->GetTaskRunner() // IO task runner + ); + + auto weak_isolate = DartIsolate::CreateRootIsolate( + vm->GetVMData()->GetSettings(), // settings + vm->GetVMData()->GetIsolateSnapshot(), // isolate snapshot + vm->GetVMData()->GetSharedSnapshot(), // shared snapshot + std::move(task_runners), // task runners + nullptr, // window + {}, // snapshot delegate + {}, // io manager + "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); + ASSERT_TRUE(root_isolate->Shutdown()); + } +} + } // namespace blink diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc index b57f2232acc47..d3850398d5b2e 100644 --- a/runtime/runtime_controller.cc +++ b/runtime/runtime_controller.cc @@ -17,8 +17,8 @@ namespace blink { RuntimeController::RuntimeController( RuntimeDelegate& p_client, DartVM* p_vm, - fml::RefPtr p_isolate_snapshot, - fml::RefPtr p_shared_snapshot, + fml::RefPtr p_isolate_snapshot, + fml::RefPtr p_shared_snapshot, TaskRunners p_task_runners, fml::WeakPtr p_snapshot_delegate, fml::WeakPtr p_io_manager, @@ -40,8 +40,8 @@ RuntimeController::RuntimeController( RuntimeController::RuntimeController( RuntimeDelegate& p_client, DartVM* p_vm, - fml::RefPtr p_isolate_snapshot, - fml::RefPtr p_shared_snapshot, + fml::RefPtr p_isolate_snapshot, + fml::RefPtr p_shared_snapshot, TaskRunners p_task_runners, fml::WeakPtr p_snapshot_delegate, fml::WeakPtr p_io_manager, @@ -61,7 +61,7 @@ RuntimeController::RuntimeController( idle_notification_callback_(idle_notification_callback), window_data_(std::move(p_window_data)), root_isolate_( - DartIsolate::CreateRootIsolate(vm_, + DartIsolate::CreateRootIsolate(vm_->GetVMData()->GetSettings(), isolate_snapshot_, shared_snapshot_, task_runners_, diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h index c913795b8eba2..6d9baf75732a6 100644 --- a/runtime/runtime_controller.h +++ b/runtime/runtime_controller.h @@ -30,8 +30,8 @@ class RuntimeController final : public WindowClient { public: RuntimeController(RuntimeDelegate& client, DartVM* vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, TaskRunners task_runners, fml::WeakPtr snapshot_delegate, fml::WeakPtr io_manager, @@ -118,8 +118,8 @@ class RuntimeController final : public WindowClient { RuntimeDelegate& client_; DartVM* const vm_; - fml::RefPtr isolate_snapshot_; - fml::RefPtr shared_snapshot_; + fml::RefPtr isolate_snapshot_; + fml::RefPtr shared_snapshot_; TaskRunners task_runners_; fml::WeakPtr snapshot_delegate_; fml::WeakPtr io_manager_; @@ -132,8 +132,8 @@ class RuntimeController final : public WindowClient { RuntimeController(RuntimeDelegate& client, DartVM* vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, TaskRunners task_runners, fml::WeakPtr snapshot_delegate, fml::WeakPtr io_manager, diff --git a/shell/common/engine.cc b/shell/common/engine.cc index 084216072e988..d6a790be403e3 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -37,8 +37,8 @@ static constexpr char kSettingsChannel[] = "flutter/settings"; Engine::Engine(Delegate& delegate, blink::DartVM& vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, blink::TaskRunners task_runners, blink::Settings settings, std::unique_ptr animator, diff --git a/shell/common/engine.h b/shell/common/engine.h index b390b36a2b197..22160cb7ee3c9 100644 --- a/shell/common/engine.h +++ b/shell/common/engine.h @@ -56,8 +56,8 @@ class Engine final : public blink::RuntimeDelegate { Engine(Delegate& delegate, blink::DartVM& vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, blink::TaskRunners task_runners, blink::Settings settings, std::unique_ptr animator, diff --git a/shell/common/shell.cc b/shell/common/shell.cc index c1dec19f6ae67..2949e6dec502f 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -36,17 +36,20 @@ namespace shell { constexpr char kSkiaChannel[] = "flutter/skia"; std::unique_ptr Shell::CreateShellOnPlatformThread( + blink::DartVMRef vm, blink::TaskRunners task_runners, blink::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, Shell::CreateCallback on_create_platform_view, Shell::CreateCallback on_create_rasterizer) { if (!task_runners.IsValid()) { + FML_LOG(ERROR) << "Task runners to run the shell were invalid."; return nullptr; } - auto shell = std::unique_ptr(new Shell(task_runners, settings)); + auto shell = + std::unique_ptr(new Shell(std::move(vm), task_runners, settings)); // Create the platform view on the platform thread (this thread). auto platform_view = on_create_platform_view(*shell.get()); @@ -75,6 +78,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( &platform_view, // io_task_runner // ]() { + TRACE_EVENT0("flutter", "ShellSetupIOSubsystem"); io_manager = std::make_unique( platform_view->CreateResourceContext(), io_task_runner); io_latch.Signal(); @@ -92,6 +96,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( shell = shell.get(), // &snapshot_delegate // ]() { + TRACE_EVENT0("flutter", "ShellSetupGPUSubsystem"); if (auto new_rasterizer = on_create_rasterizer(*shell)) { rasterizer = std::move(new_rasterizer); snapshot_delegate = rasterizer->GetSnapshotDelegate(); @@ -115,6 +120,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( snapshot_delegate = std::move(snapshot_delegate), // io_manager = io_manager->GetWeakPtr() // ]() mutable { + TRACE_EVENT0("flutter", "ShellSetupUISubsystem"); const auto& task_runners = shell->GetTaskRunners(); // The animator is owned by the UI thread but it gets its vsync pulses @@ -123,7 +129,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( std::move(vsync_waiter)); engine = std::make_unique(*shell, // - shell->GetDartVM(), // + *shell->GetDartVM(), // std::move(isolate_snapshot), // std::move(shared_snapshot), // task_runners, // @@ -204,26 +210,35 @@ std::unique_ptr Shell::Create( Shell::CreateCallback on_create_rasterizer) { PerformInitializationTasks(settings); - auto vm = blink::DartVM::ForProcess(settings); + TRACE_EVENT0("flutter", "Shell::Create"); + + auto vm = blink::DartVMRef::Create(settings); FML_CHECK(vm) << "Must be able to initialize the VM."; + + auto vm_data = vm->GetVMData(); + return Shell::Create(std::move(task_runners), // std::move(settings), // - vm->GetIsolateSnapshot(), // - blink::DartSnapshot::Empty(), // + vm_data->GetIsolateSnapshot(), // isolate snapshot + blink::DartSnapshot::Empty(), // shared snapshot std::move(on_create_platform_view), // - std::move(on_create_rasterizer) // + std::move(on_create_rasterizer), // + std::move(vm) // ); } std::unique_ptr Shell::Create( blink::TaskRunners task_runners, blink::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, Shell::CreateCallback on_create_platform_view, - Shell::CreateCallback on_create_rasterizer) { + Shell::CreateCallback on_create_rasterizer, + blink::DartVMRef vm) { PerformInitializationTasks(settings); + TRACE_EVENT0("flutter", "Shell::CreateWithSnapshots"); + if (!task_runners.IsValid() || !on_create_platform_view || !on_create_rasterizer) { return nullptr; @@ -233,16 +248,18 @@ std::unique_ptr Shell::Create( std::unique_ptr shell; fml::TaskRunner::RunNowOrPostTask( task_runners.GetPlatformTaskRunner(), - [&latch, // - &shell, // - task_runners = std::move(task_runners), // - settings, // - isolate_snapshot = std::move(isolate_snapshot), // - shared_snapshot = std::move(shared_snapshot), // - on_create_platform_view, // - on_create_rasterizer // - ]() { - shell = CreateShellOnPlatformThread(std::move(task_runners), // + fml::MakeCopyable([&latch, // + vm = std::move(vm), // + &shell, // + task_runners = std::move(task_runners), // + settings, // + isolate_snapshot = std::move(isolate_snapshot), // + shared_snapshot = std::move(shared_snapshot), // + on_create_platform_view, // + on_create_rasterizer // + ]() mutable { + shell = CreateShellOnPlatformThread(std::move(vm), + std::move(task_runners), // settings, // std::move(isolate_snapshot), // std::move(shared_snapshot), // @@ -250,15 +267,18 @@ std::unique_ptr Shell::Create( on_create_rasterizer // ); latch.Signal(); - }); + })); latch.Wait(); return shell; } -Shell::Shell(blink::TaskRunners task_runners, blink::Settings settings) +Shell::Shell(blink::DartVMRef vm, + blink::TaskRunners task_runners, + blink::Settings settings) : task_runners_(std::move(task_runners)), settings_(std::move(settings)), - vm_(blink::DartVM::ForProcess(settings_)) { + vm_(std::move(vm)) { + FML_CHECK(vm_) << "Must have access to VM to create a shell."; FML_DCHECK(task_runners_.IsValid()); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -300,9 +320,7 @@ Shell::~Shell() { PersistentCache::GetCacheForProcess()->RemoveWorkerTaskRunner( task_runners_.GetIOTaskRunner()); - if (auto vm = blink::DartVM::ForProcessIfInitialized()) { - vm->GetServiceProtocol().RemoveHandler(this); - } + vm_->GetServiceProtocol()->RemoveHandler(this); fml::AutoResetWaitableEvent ui_latch, gpu_latch, platform_latch, io_latch; @@ -373,9 +391,7 @@ bool Shell::Setup(std::unique_ptr platform_view, is_setup_ = true; - if (auto vm = blink::DartVM::ForProcessIfInitialized()) { - vm->GetServiceProtocol().AddHandler(this, GetServiceProtocolDescription()); - } + vm_->GetServiceProtocol()->AddHandler(this, GetServiceProtocolDescription()); PersistentCache::GetCacheForProcess()->AddWorkerTaskRunner( task_runners_.GetIOTaskRunner()); @@ -406,12 +422,13 @@ fml::WeakPtr Shell::GetPlatformView() { return platform_view_->GetWeakPtr(); } -blink::DartVM& Shell::GetDartVM() const { - return *vm_; +blink::DartVM* Shell::GetDartVM() { + return &vm_; } // |shell::PlatformView::Delegate| void Shell::OnPlatformViewCreated(std::unique_ptr surface) { + TRACE_EVENT0("flutter", "Shell::OnPlatformViewCreated"); FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -469,6 +486,7 @@ void Shell::OnPlatformViewCreated(std::unique_ptr surface) { // |shell::PlatformView::Delegate| void Shell::OnPlatformViewDestroyed() { + TRACE_EVENT0("flutter", "Shell::OnPlatformViewDestroyed"); FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -804,10 +822,8 @@ void Shell::OnPreEngineRestart() { // |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); - } + Handler::Description description(isolate_port, isolate_name); + vm_->GetServiceProtocol()->SetHandlerDescription(this, description); } // |blink::ServiceProtocol::Handler| diff --git a/shell/common/shell.h b/shell/common/shell.h index 17b0f170561d5..864235473c934 100644 --- a/shell/common/shell.h +++ b/shell/common/shell.h @@ -23,6 +23,7 @@ #include "flutter/lib/ui/semantics/custom_accessibility_action.h" #include "flutter/lib/ui/semantics/semantics_node.h" #include "flutter/lib/ui/window/platform_message.h" +#include "flutter/runtime/dart_vm_lifecycle.h" #include "flutter/runtime/service_protocol.h" #include "flutter/shell/common/animator.h" #include "flutter/shell/common/engine.h" @@ -54,10 +55,11 @@ class Shell final : public PlatformView::Delegate, static std::unique_ptr Create( blink::TaskRunners task_runners, blink::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, CreateCallback on_create_platform_view, - CreateCallback on_create_rasterizer); + CreateCallback on_create_rasterizer, + blink::DartVMRef vm); ~Shell(); @@ -71,7 +73,7 @@ class Shell final : public PlatformView::Delegate, fml::WeakPtr GetPlatformView(); - blink::DartVM& GetDartVM() const; + blink::DartVM* GetDartVM(); bool IsSetup() const; @@ -85,7 +87,7 @@ class Shell final : public PlatformView::Delegate, const blink::TaskRunners task_runners_; const blink::Settings settings_; - fml::RefPtr vm_; + blink::DartVMRef vm_; std::unique_ptr platform_view_; // on platform task runner std::unique_ptr engine_; // on UI task runner std::unique_ptr rasterizer_; // on GPU task runner @@ -98,16 +100,19 @@ class Shell final : public PlatformView::Delegate, > service_protocol_handlers_; bool is_setup_ = false; - uint64_t next_pointer_flow_id_ = 0; Shell(blink::TaskRunners task_runners, blink::Settings settings); + Shell(blink::DartVMRef vm, + blink::TaskRunners task_runners, + blink::Settings settings); static std::unique_ptr CreateShellOnPlatformThread( + blink::DartVMRef vm, blink::TaskRunners task_runners, blink::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, Shell::CreateCallback on_create_platform_view, Shell::CreateCallback on_create_rasterizer); diff --git a/testing/testing.cc b/testing/testing.cc index 93e135e7ab43d..c738219541452 100644 --- a/testing/testing.cc +++ b/testing/testing.cc @@ -6,6 +6,8 @@ namespace testing { -// +std::string GetCurrentTestName() { + return UnitTest::GetInstance()->current_test_info()->name(); +} } // namespace testing diff --git a/testing/testing.h b/testing/testing.h index dac2d229b9169..0662055fea502 100644 --- a/testing/testing.h +++ b/testing/testing.h @@ -5,6 +5,8 @@ #ifndef TESTING_TESTING_H_ #define TESTING_TESTING_H_ +#include + #include "gtest/gtest.h" namespace testing { @@ -14,6 +16,8 @@ namespace testing { // error. const char* GetFixturesPath(); +std::string GetCurrentTestName(); + } // namespace testing #endif // TESTING_TESTING_H_ From 163a2fd5e140d10a30645e73031054ef39105d87 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Fri, 15 Feb 2019 15:03:19 -0800 Subject: [PATCH 0186/1117] Revert "Android embedding refactor pr3 add remaining systemchannels (#7738)" (#7849) From build log: ``` ../../flutter/shell/platform/android/io/flutter/view/FlutterView.java:95: error: cannot find symbol private final LocalizationChannel localizationChannel; ^ symbol: class LocalizationChannel location: class FlutterView ../../flutter/shell/platform/android/io/flutter/view/FlutterView.java:172: error: cannot find symbol localizationChannel = new LocalizationChannel(dartExecutor); ^ symbol: class LocalizationChannel location: class FlutterView 2 errors ``` This reverts commit 256db4bc23b7931509233df0dc04e44e16608229. --- ci/licenses_golden/licenses_flutter | 2 - shell/platform/android/BUILD.gn | 2 - .../systemchannels/AccessibilityChannel.java | 120 ---- .../systemchannels/LocalizationChannel.java | 23 +- .../systemchannels/PlatformChannel.java | 597 +----------------- .../systemchannels/TextInputChannel.java | 406 ------------ .../editing/InputConnectionAdaptor.java | 58 +- .../plugin/editing/TextInputPlugin.java | 181 +++--- .../plugin/platform/PlatformPlugin.java | 375 ++++++----- .../io/flutter/view/AccessibilityBridge.java | 294 +++++---- .../android/io/flutter/view/FlutterView.java | 74 ++- 11 files changed, 562 insertions(+), 1570 deletions(-) delete mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java delete mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 718c74a1c038a..ada715328d999 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -450,7 +450,6 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/D 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/engine/systemchannels/AccessibilityChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/KeyEventChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/LifecycleChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java @@ -458,7 +457,6 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/system FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/SettingsChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/SystemChannel.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.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 diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index 73e9b462b4b48..37002cf5fd4eb 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -114,7 +114,6 @@ java_library("flutter_shell_java") { "io/flutter/embedding/engine/dart/PlatformMessageHandler.java", "io/flutter/embedding/engine/renderer/FlutterRenderer.java", "io/flutter/embedding/engine/renderer/OnFirstFrameRenderedListener.java", - "io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java", "io/flutter/embedding/engine/systemchannels/KeyEventChannel.java", "io/flutter/embedding/engine/systemchannels/LifecycleChannel.java", "io/flutter/embedding/engine/systemchannels/LocalizationChannel.java", @@ -122,7 +121,6 @@ java_library("flutter_shell_java") { "io/flutter/embedding/engine/systemchannels/PlatformChannel.java", "io/flutter/embedding/engine/systemchannels/SettingsChannel.java", "io/flutter/embedding/engine/systemchannels/SystemChannel.java", - "io/flutter/embedding/engine/systemchannels/TextInputChannel.java", "io/flutter/plugin/common/ActivityLifecycleListener.java", "io/flutter/plugin/common/BasicMessageChannel.java", "io/flutter/plugin/common/BinaryCodec.java", diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java deleted file mode 100644 index 4bfcd37973b58..0000000000000 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java +++ /dev/null @@ -1,120 +0,0 @@ -package io.flutter.embedding.engine.systemchannels; - -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; - -import java.util.HashMap; - -import io.flutter.embedding.engine.dart.DartExecutor; -import io.flutter.plugin.common.BasicMessageChannel; -import io.flutter.plugin.common.StandardMessageCodec; - -/** - * System channel that sends accessibility requests and events from Flutter to Android. - *

- * See {@link AccessibilityMessageHandler}, which lists all accessibility requests and - * events that might be sent from Flutter to the Android platform. - */ -public class AccessibilityChannel { - @NonNull - public BasicMessageChannel channel; - @Nullable - private AccessibilityMessageHandler handler; - - private final BasicMessageChannel.MessageHandler parsingMessageHandler = new BasicMessageChannel.MessageHandler() { - @Override - public void onMessage(Object message, BasicMessageChannel.Reply reply) { - // If there is no handler to respond to this message then we don't need to - // parse it. Return. - if (handler == null) { - return; - } - - @SuppressWarnings("unchecked") - final HashMap annotatedEvent = (HashMap) message; - final String type = (String) annotatedEvent.get("type"); - @SuppressWarnings("unchecked") - final HashMap data = (HashMap) annotatedEvent.get("data"); - - switch (type) { - case "announce": - String announceMessage = (String) data.get("message"); - if (announceMessage != null) { - handler.announce(announceMessage); - } - break; - case "tap": { - Integer nodeId = (Integer) annotatedEvent.get("nodeId"); - if (nodeId != null) { - handler.onTap(nodeId); - } - break; - } - case "longPress": { - Integer nodeId = (Integer) annotatedEvent.get("nodeId"); - if (nodeId != null) { - handler.onLongPress(nodeId); - } - break; - } - case "tooltip": { - String tooltipMessage = (String) data.get("message"); - if (tooltipMessage != null) { - handler.onTooltip(tooltipMessage); - } - break; - } - } - } - }; - - /** - * Constructs an {@code AccessibilityChannel} that connects Android to the Dart code - * running in {@code dartExecutor}. - * - * The given {@code dartExecutor} is permitted to be idle or executing code. - * - * See {@link DartExecutor}. - */ - public AccessibilityChannel(@NonNull DartExecutor dartExecutor) { - channel = new BasicMessageChannel<>(dartExecutor, "flutter/accessibility", StandardMessageCodec.INSTANCE); - channel.setMessageHandler(parsingMessageHandler); - } - - /** - * Sets the {@link AccessibilityMessageHandler} which receives all events and requests - * that are parsed from the underlying accessibility channel. - */ - public void setAccessibilityMessageHandler(@Nullable AccessibilityMessageHandler handler) { - this.handler = handler; - } - - /** - * Handler that receives accessibility messages sent from Flutter to Android - * through a given {@link AccessibilityChannel}. - * - * To register an {@code AccessibilityMessageHandler} with a {@link AccessibilityChannel}, - * see {@link AccessibilityChannel#setAccessibilityMessageHandler(AccessibilityMessageHandler)}. - */ - public interface AccessibilityMessageHandler { - /** - * The Dart application would like the given {@code message} to be announced. - */ - void announce(@NonNull String message); - - /** - * The user has tapped on the artifact with the given {@code nodeId}. - */ - void onTap(int nodeId); - - /** - * The user has long pressed on the artifact with the given {@code nodeId}. - */ - void onLongPress(int nodeId); - - /** - * The user has opened a popup window, menu, dialog, etc. - */ - void onTooltip(@NonNull String message); - } -} diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java index 52e4fbb46171d..ffb8f1f84a155 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java @@ -6,17 +6,14 @@ import android.support.annotation.NonNull; -import java.util.ArrayList; import java.util.Arrays; -import java.util.List; -import java.util.Locale; import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.plugin.common.JSONMethodCodec; import io.flutter.plugin.common.MethodChannel; /** - * Sends the platform's locales to Dart. + * TODO(mattcarroll): fill in javadoc for LocalizationChannel. */ public class LocalizationChannel { @@ -27,18 +24,12 @@ public LocalizationChannel(@NonNull DartExecutor dartExecutor) { this.channel = new MethodChannel(dartExecutor, "flutter/localization", JSONMethodCodec.INSTANCE); } - /** - * Send the given {@code locales} to Dart. - */ - public void sendLocales(List locales) { - List data = new ArrayList<>(); - for (Locale locale : locales) { - data.add(locale.getLanguage()); - data.add(locale.getCountry()); - data.add(locale.getScript()); - data.add(locale.getVariant()); - } - channel.invokeMethod("setLocale", data); + public void setLocale(String language, String country) { + channel.invokeMethod("setLocale", Arrays.asList(language, country)); + } + + public void setMethodCallHandler(MethodChannel.MethodCallHandler handler) { + channel.setMethodCallHandler(handler); } } diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java index 44269313bb983..b1ceb82b7a74d 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java @@ -4,613 +4,26 @@ package io.flutter.embedding.engine.systemchannels; -import android.content.pm.ActivityInfo; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import java.util.ArrayList; -import java.util.List; - import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.plugin.common.JSONMethodCodec; -import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; /** - * System channel that receives requests for host platform behavior, e.g., haptic and sound - * effects, system chrome configurations, and clipboard interaction. + * TODO(mattcarroll): fill in javadoc for PlatformChannel. */ public class PlatformChannel { - @NonNull - public final MethodChannel channel; - @Nullable - private PlatformMessageHandler platformMessageHandler; - - private final MethodChannel.MethodCallHandler parsingMethodCallHandler = new MethodChannel.MethodCallHandler() { - @Override - public void onMethodCall(MethodCall call, MethodChannel.Result result) { - if (platformMessageHandler == null) { - // If no explicit PlatformMessageHandler has been registered then we don't - // need to forward this call to an API. Return. - return; - } - - String method = call.method; - Object arguments = call.arguments; - try { - switch (method) { - case "SystemSound.play": - try { - SoundType soundType = SoundType.fromValue((String) arguments); - platformMessageHandler.playSystemSound(soundType); - result.success(null); - } catch (NoSuchFieldException exception) { - // The desired sound type does not exist. - result.error("error", exception.getMessage(), null); - } - break; - case "HapticFeedback.vibrate": - try { - HapticFeedbackType feedbackType = HapticFeedbackType.fromValue((String) arguments); - platformMessageHandler.vibrateHapticFeedback(feedbackType); - result.success(null); - } catch (NoSuchFieldException exception) { - // The desired feedback type does not exist. - result.error("error", exception.getMessage(), null); - } - break; - case "SystemChrome.setPreferredOrientations": - try { - int androidOrientation = decodeOrientations((JSONArray) arguments); - platformMessageHandler.setPreferredOrientations(androidOrientation); - result.success(null); - } catch (JSONException | NoSuchFieldException exception) { - // JSONException: One or more expected fields were either omitted or referenced an invalid type. - // NoSuchFieldException: One or more expected fields were either omitted or referenced an invalid type. - result.error("error", exception.getMessage(), null); - } - break; - case "SystemChrome.setApplicationSwitcherDescription": - try { - AppSwitcherDescription description = decodeAppSwitcherDescription((JSONObject) arguments); - platformMessageHandler.setApplicationSwitcherDescription(description); - result.success(null); - } catch (JSONException exception) { - // One or more expected fields were either omitted or referenced an invalid type. - result.error("error", exception.getMessage(), null); - } - break; - case "SystemChrome.setEnabledSystemUIOverlays": - try { - List overlays = decodeSystemUiOverlays((JSONArray) arguments); - platformMessageHandler.showSystemOverlays(overlays); - result.success(null); - } catch (JSONException | NoSuchFieldException exception) { - // JSONException: One or more expected fields were either omitted or referenced an invalid type. - // NoSuchFieldException: One or more of the overlay names are invalid. - result.error("error", exception.getMessage(), null); - } - break; - case "SystemChrome.restoreSystemUIOverlays": - platformMessageHandler.restoreSystemUiOverlays(); - result.success(null); - break; - case "SystemChrome.setSystemUIOverlayStyle": - try { - SystemChromeStyle systemChromeStyle = decodeSystemChromeStyle((JSONObject) arguments); - platformMessageHandler.setSystemUiOverlayStyle(systemChromeStyle); - result.success(null); - } catch (JSONException | NoSuchFieldException exception) { - // JSONException: One or more expected fields were either omitted or referenced an invalid type. - // NoSuchFieldException: One or more of the brightness names are invalid. - result.error("error", exception.getMessage(), null); - } - break; - case "SystemNavigator.pop": - platformMessageHandler.popSystemNavigator(); - result.success(null); - break; - case "Clipboard.getData": { - String contentFormatName = (String) arguments; - ClipboardContentFormat clipboardFormat = null; - if (contentFormatName != null) { - try { - clipboardFormat = ClipboardContentFormat.fromValue(contentFormatName); - } catch (NoSuchFieldException exception) { - // An unsupported content format was requested. Return failure. - result.error("error", "No such clipboard content format: " + contentFormatName, null); - } - } - CharSequence clipboardContent = platformMessageHandler.getClipboardData(clipboardFormat); - if (clipboardContent != null) { - JSONObject response = new JSONObject(); - response.put("text", clipboardContent); - result.success(response); - } else { - result.success(null); - } - break; - } - case "Clipboard.setData": { - String clipboardContent = ((JSONObject) arguments).getString("text"); - platformMessageHandler.setClipboardData(clipboardContent); - result.success(null); - break; - } - default: - result.notImplemented(); - break; - } - } catch (JSONException e) { - result.error("error", "JSON error: " + e.getMessage(), null); - } - } - }; + public final MethodChannel channel; - /** - * Constructs a {@code PlatformChannel} that connects Android to the Dart code - * running in {@code dartExecutor}. - * - * The given {@code dartExecutor} is permitted to be idle or executing code. - * - * See {@link DartExecutor}. - */ public PlatformChannel(@NonNull DartExecutor dartExecutor) { - channel = new MethodChannel(dartExecutor, "flutter/platform", JSONMethodCodec.INSTANCE); - channel.setMethodCallHandler(parsingMethodCallHandler); - } - - /** - * Sets the {@link PlatformMessageHandler} which receives all events and requests - * that are parsed from the underlying platform channel. - */ - public void setPlatformMessageHandler(@Nullable PlatformMessageHandler platformMessageHandler) { - this.platformMessageHandler = platformMessageHandler; - } - - // TODO(mattcarroll): add support for IntDef annotations, then add @ScreenOrientation - - /** - * Decodes a series of orientations to an aggregate desired orientation. - * - * @throws JSONException if {@code encodedOrientations} does not contain expected keys and value types. - * @throws NoSuchFieldException if any given encoded orientation is not a valid orientation name. - */ - private int decodeOrientations(@NonNull JSONArray encodedOrientations) throws JSONException, NoSuchFieldException { - int requestedOrientation = 0x00; - int firstRequestedOrientation = 0x00; - for (int index = 0; index < encodedOrientations.length(); index += 1) { - String encodedOrientation = encodedOrientations.getString(index); - DeviceOrientation orientation = DeviceOrientation.fromValue(encodedOrientation); - - switch (orientation) { - case PORTRAIT_UP: - requestedOrientation |= 0x01; - break; - case PORTRAIT_DOWN: - requestedOrientation |= 0x04; - break; - case LANDSCAPE_LEFT: - requestedOrientation |= 0x02; - break; - case LANDSCAPE_RIGHT: - requestedOrientation |= 0x08; - break; - } - - if (firstRequestedOrientation == 0x00) { - firstRequestedOrientation = requestedOrientation; - } - } - - switch (requestedOrientation) { - case 0x00: - return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; - case 0x01: - return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; - case 0x02: - return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; - case 0x04: - return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; - case 0x05: - return ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT; - case 0x08: - return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; - case 0x0a: - return ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE; - case 0x0b: - return ActivityInfo.SCREEN_ORIENTATION_USER; - case 0x0f: - return ActivityInfo.SCREEN_ORIENTATION_FULL_USER; - case 0x03: // portraitUp and landscapeLeft - case 0x06: // portraitDown and landscapeLeft - case 0x07: // portraitUp, portraitDown, and landscapeLeft - case 0x09: // portraitUp and landscapeRight - case 0x0c: // portraitDown and landscapeRight - case 0x0d: // portraitUp, portraitDown, and landscapeRight - case 0x0e: // portraitDown, landscapeLeft, and landscapeRight - // Android can't describe these cases, so just default to whatever the first - // specified value was. - switch (firstRequestedOrientation) { - case 0x01: - return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; - case 0x02: - return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; - case 0x04: - return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; - case 0x08: - return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; - } - } - - // Execution should never get this far, but if it does then we default - // to a portrait orientation. - return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; - } - - private AppSwitcherDescription decodeAppSwitcherDescription(@NonNull JSONObject encodedDescription) throws JSONException { - int color = encodedDescription.getInt("primaryColor"); - if (color != 0) { // 0 means color isn't set, use system default - color = color | 0xFF000000; // color must be opaque if set - } - String label = encodedDescription.getString("label"); - return new AppSwitcherDescription(color, label); - } - - /** - * Decodes a list of JSON-encoded overlays to a list of {@link SystemUiOverlay}. - * - * @throws JSONException if {@code encodedSystemUiOverlay} does not contain expected keys and value types. - * @throws NoSuchFieldException if any of the given encoded overlay names are invalid. - */ - private List decodeSystemUiOverlays(@NonNull JSONArray encodedSystemUiOverlay) throws JSONException, NoSuchFieldException { - List overlays = new ArrayList<>(); - for (int i = 0; i < encodedSystemUiOverlay.length(); ++i) { - String encodedOverlay = encodedSystemUiOverlay.getString(i); - SystemUiOverlay overlay = SystemUiOverlay.fromValue(encodedOverlay); - switch(overlay) { - case TOP_OVERLAYS: - overlays.add(SystemUiOverlay.TOP_OVERLAYS); - break; - case BOTTOM_OVERLAYS: - overlays.add(SystemUiOverlay.BOTTOM_OVERLAYS); - break; - } - } - return overlays; - } - - /** - * Decodes a JSON-encoded {@code encodedStyle} to a {@link SystemChromeStyle}. - * - * @throws JSONException if {@code encodedStyle} does not contain expected keys and value types. - * @throws NoSuchFieldException if any provided brightness name is invalid. - */ - private SystemChromeStyle decodeSystemChromeStyle(@NonNull JSONObject encodedStyle) throws JSONException, NoSuchFieldException { - Brightness systemNavigationBarIconBrightness = null; - // TODO(mattcarroll): add color annotation - Integer systemNavigationBarColor = null; - // TODO(mattcarroll): add color annotation - Integer systemNavigationBarDividerColor = null; - Brightness statusBarIconBrightness = null; - // TODO(mattcarroll): add color annotation - Integer statusBarColor = null; - - if (!encodedStyle.isNull("systemNavigationBarIconBrightness")) { - systemNavigationBarIconBrightness = Brightness.fromValue(encodedStyle.getString("systemNavigationBarIconBrightness")); - } - - if (!encodedStyle.isNull("systemNavigationBarColor")) { - systemNavigationBarColor = encodedStyle.getInt("systemNavigationBarColor"); - } - - if (!encodedStyle.isNull("statusBarIconBrightness")) { - statusBarIconBrightness = Brightness.fromValue(encodedStyle.getString("statusBarIconBrightness")); - } - - if (!encodedStyle.isNull("statusBarColor")) { - statusBarColor = encodedStyle.getInt("statusBarColor"); - } - - if (!encodedStyle.isNull("systemNavigationBarDividerColor")) { - systemNavigationBarDividerColor = encodedStyle.getInt("systemNavigationBarDividerColor"); - } - - return new SystemChromeStyle( - statusBarColor, - statusBarIconBrightness, - systemNavigationBarColor, - systemNavigationBarIconBrightness, - systemNavigationBarDividerColor - ); + this.channel = new MethodChannel(dartExecutor, "flutter/platform", JSONMethodCodec.INSTANCE); } - /** - * Handler that receives platform messages sent from Flutter to Android - * through a given {@link PlatformChannel}. - * - * To register a {@code PlatformMessageHandler} with a {@link PlatformChannel}, - * see {@link PlatformChannel#setPlatformMessageHandler(PlatformMessageHandler)}. - */ - public interface PlatformMessageHandler { - /** - * The Flutter application would like to play the given {@code soundType}. - */ - void playSystemSound(@NonNull SoundType soundType); - - /** - * The Flutter application would like to play the given haptic {@code feedbackType}. - */ - void vibrateHapticFeedback(@NonNull HapticFeedbackType feedbackType); - - /** - * The Flutter application would like to display in the given {@code androidOrientation}. - */ - // TODO(mattcarroll): add @ScreenOrientation annotation - void setPreferredOrientations(int androidOrientation); - - /** - * The Flutter application would like to be displayed in Android's app switcher with - * the visual representation described in the given {@code description}. - *

- * See the related Android documentation: - * https://developer.android.com/guide/components/activities/recents - */ - void setApplicationSwitcherDescription(@NonNull AppSwitcherDescription description); - - /** - * The Flutter application would like the Android system to display the given - * {@code overlays}. - *

- * {@link SystemUiOverlay#TOP_OVERLAYS} refers to system overlays such as the - * status bar, while {@link SystemUiOverlay#BOTTOM_OVERLAYS} refers to system - * overlays such as the back/home/recents navigation on the bottom of the screen. - *

- * An empty list of {@code overlays} should hide all system overlays. - */ - void showSystemOverlays(@NonNull List overlays); - - /** - * The Flutter application would like to restore the visibility of system - * overlays to the last set of overlays sent via {@link #showSystemOverlays(List)}. - *

- * If {@link #showSystemOverlays(List)} has yet to be called, then a default - * system overlay appearance is desired: - *

- * {@code - * View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - * } - */ - void restoreSystemUiOverlays(); - - /** - * The Flutter application would like the system chrome to present itself with - * the given {@code systemUiOverlayStyle}, i.e., the given status bar and - * navigation bar colors and brightness. - */ - void setSystemUiOverlayStyle(@NonNull SystemChromeStyle systemUiOverlayStyle); - - /** - * The Flutter application would like to pop the top item off of the Android - * app's navigation back stack. - */ - void popSystemNavigator(); - - /** - * The Flutter application would like to receive the current data in the - * clipboard and have it returned in the given {@code format}. - */ - @Nullable - CharSequence getClipboardData(@Nullable ClipboardContentFormat format); - - /** - * The Flutter application would like to set the current data in the - * clipboard to the given {@code text}. - */ - void setClipboardData(@NonNull String text); + public void setMethodCallHandler(@Nullable MethodChannel.MethodCallHandler handler) { + channel.setMethodCallHandler(handler); } - /** - * Types of sounds the Android OS can play on behalf of an application. - */ - public enum SoundType { - CLICK("SoundType.click"); - - static SoundType fromValue(@NonNull String encodedName) throws NoSuchFieldException { - for (SoundType soundType : SoundType.values()) { - if (soundType.encodedName.equals(encodedName)) { - return soundType; - } - } - throw new NoSuchFieldException("No such SoundType: " + encodedName); - } - - @NonNull - private final String encodedName; - - SoundType(@NonNull String encodedName) { - this.encodedName = encodedName; - } - } - - /** - * The types of haptic feedback that the Android OS can generate on behalf - * of an application. - */ - public enum HapticFeedbackType { - STANDARD(null), - LIGHT_IMPACT("HapticFeedbackType.lightImpact"), - MEDIUM_IMPACT("HapticFeedbackType.mediumImpact"), - HEAVY_IMPACT("HapticFeedbackType.heavyImpact"), - SELECTION_CLICK("HapticFeedbackType.selectionClick"); - - static HapticFeedbackType fromValue(@Nullable String encodedName) throws NoSuchFieldException { - for (HapticFeedbackType feedbackType : HapticFeedbackType.values()) { - if ((feedbackType.encodedName == null && encodedName == null) - || (feedbackType.encodedName != null && feedbackType.encodedName.equals(encodedName))) { - return feedbackType; - } - } - throw new NoSuchFieldException("No such HapticFeedbackType: " + encodedName); - } - - @Nullable - private final String encodedName; - - HapticFeedbackType(@Nullable String encodedName) { - this.encodedName = encodedName; - } - } - - /** - * The possible desired orientations of a Flutter application. - */ - public enum DeviceOrientation { - PORTRAIT_UP("DeviceOrientation.portraitUp"), - PORTRAIT_DOWN("DeviceOrientation.portraitDown"), - LANDSCAPE_LEFT("DeviceOrientation.landscapeLeft"), - LANDSCAPE_RIGHT("DeviceOrientation.landscapeRight"); - - static DeviceOrientation fromValue(@NonNull String encodedName) throws NoSuchFieldException { - for (DeviceOrientation orientation : DeviceOrientation.values()) { - if (orientation.encodedName.equals(encodedName)) { - return orientation; - } - } - throw new NoSuchFieldException("No such DeviceOrientation: " + encodedName); - } - - @NonNull - private String encodedName; - - DeviceOrientation(@NonNull String encodedName) { - this.encodedName = encodedName; - } - } - - /** - * The set of Android system UI overlays as perceived by the Flutter application. - *

- * Android includes many more overlay options and flags than what is provided by - * {@code SystemUiOverlay}. Flutter only requires control over a subset of the - * overlays and those overlays are represented by {@code SystemUiOverlay} values. - */ - public enum SystemUiOverlay { - TOP_OVERLAYS("SystemUiOverlay.top"), - BOTTOM_OVERLAYS("SystemUiOverlay.bottom"); - - static SystemUiOverlay fromValue(@NonNull String encodedName) throws NoSuchFieldException { - for (SystemUiOverlay overlay : SystemUiOverlay.values()) { - if (overlay.encodedName.equals(encodedName)) { - return overlay; - } - } - throw new NoSuchFieldException("No such SystemUiOverlay: " + encodedName); - } - - @NonNull - private String encodedName; - - SystemUiOverlay(@NonNull String encodedName) { - this.encodedName = encodedName; - } - } - - /** - * The color and label of an application that appears in Android's app switcher, AKA - * recents screen. - */ - public static class AppSwitcherDescription { - // TODO(mattcarroll): add color annotation - public final int color; - @NonNull - public final String label; - - public AppSwitcherDescription(int color, @NonNull String label) { - this.color = color; - this.label = label; - } - } - - /** - * The color and brightness of system chrome, e.g., status bar and system navigation bar. - */ - public static class SystemChromeStyle { - // TODO(mattcarroll): add color annotation - @Nullable - public final Integer statusBarColor; - @Nullable - public final Brightness statusBarIconBrightness; - // TODO(mattcarroll): add color annotation - @Nullable - public final Integer systemNavigationBarColor; - @Nullable - public final Brightness systemNavigationBarIconBrightness; - // TODO(mattcarroll): add color annotation - @Nullable - public final Integer systemNavigationBarDividerColor; - - public SystemChromeStyle( - @Nullable Integer statusBarColor, - @Nullable Brightness statusBarIconBrightness, - @Nullable Integer systemNavigationBarColor, - @Nullable Brightness systemNavigationBarIconBrightness, - @Nullable Integer systemNavigationBarDividerColor - ) { - this.statusBarColor = statusBarColor; - this.statusBarIconBrightness = statusBarIconBrightness; - this.systemNavigationBarColor = systemNavigationBarColor; - this.systemNavigationBarIconBrightness = systemNavigationBarIconBrightness; - this.systemNavigationBarDividerColor = systemNavigationBarDividerColor; - } - } - - public enum Brightness { - LIGHT("Brightness.light"), - DARK("Brightness.dark"); - - static Brightness fromValue(@NonNull String encodedName) throws NoSuchFieldException { - for (Brightness brightness : Brightness.values()) { - if (brightness.encodedName.equals(encodedName)) { - return brightness; - } - } - throw new NoSuchFieldException("No such Brightness: " + encodedName); - } - - @NonNull - private String encodedName; - - Brightness(@NonNull String encodedName) { - this.encodedName = encodedName; - } - } - - /** - * Data formats of clipboard content. - */ - public enum ClipboardContentFormat { - PLAIN_TEXT("text/plain"); - - static ClipboardContentFormat fromValue(String encodedName) throws NoSuchFieldException { - for (ClipboardContentFormat format : ClipboardContentFormat.values()) { - if (format.encodedName.equals(encodedName)) { - return format; - } - } - throw new NoSuchFieldException("No such ClipboardContentFormat: " + encodedName); - } - - @NonNull - private String encodedName; - - ClipboardContentFormat(@NonNull String encodedName) { - this.encodedName = encodedName; - } - } } diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java deleted file mode 100644 index fc4b75521549d..0000000000000 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java +++ /dev/null @@ -1,406 +0,0 @@ -package io.flutter.embedding.engine.systemchannels; - -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.view.inputmethod.EditorInfo; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import java.util.Arrays; -import java.util.HashMap; - -import io.flutter.embedding.engine.dart.DartExecutor; -import io.flutter.plugin.common.JSONMethodCodec; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -/** - * {@link TextInputChannel} is a platform channel between Android and Flutter that is used to - * communicate information about the user's text input. - *

- * When the user presses an action button like "done" or "next", that action is sent from Android - * to Flutter through this {@link TextInputChannel}. - *

- * When an input system in the Flutter app wants to show the keyboard, or hide it, or configure - * editing state, etc. a message is sent from Flutter to Android through this {@link TextInputChannel}. - *

- * {@link TextInputChannel} comes with a default {@link io.flutter.plugin.common.MethodChannel.MethodCallHandler} - * that parses incoming messages from Flutter. Register a {@link TextInputMethodHandler} to respond - * to standard Flutter text input messages. - */ -public class TextInputChannel { - @NonNull - public final MethodChannel channel; - @Nullable - private TextInputMethodHandler textInputMethodHandler; - - private final MethodChannel.MethodCallHandler parsingMethodHandler = new MethodChannel.MethodCallHandler() { - @Override - public void onMethodCall(MethodCall call, MethodChannel.Result result) { - if (textInputMethodHandler == null) { - // If no explicit TextInputMethodHandler has been registered then we don't - // need to forward this call to an API. Return. - return; - } - - String method = call.method; - Object args = call.arguments; - switch (method) { - case "TextInput.show": - textInputMethodHandler.show(); - result.success(null); - break; - case "TextInput.hide": - textInputMethodHandler.hide(); - result.success(null); - break; - case "TextInput.setClient": - try { - final JSONArray argumentList = (JSONArray) args; - final int textInputClientId = argumentList.getInt(0); - final JSONObject jsonConfiguration = argumentList.getJSONObject(1); - textInputMethodHandler.setClient(textInputClientId, Configuration.fromJson(jsonConfiguration)); - result.success(null); - } catch (JSONException | NoSuchFieldException exception) { - // JSONException: missing keys or bad value types. - // NoSuchFieldException: one or more values were invalid. - result.error("error", exception.getMessage(), null); - } - break; - case "TextInput.setEditingState": - try { - final JSONObject editingState = (JSONObject) args; - textInputMethodHandler.setEditingState(TextEditState.fromJson(editingState)); - result.success(null); - } catch (JSONException exception) { - result.error("error", exception.getMessage(), null); - } - break; - case "TextInput.clearClient": - textInputMethodHandler.clearClient(); - result.success(null); - break; - default: - result.notImplemented(); - break; - } - } - }; - - /** - * Constructs a {@code TextInputChannel} that connects Android to the Dart code - * running in {@code dartExecutor}. - * - * The given {@code dartExecutor} is permitted to be idle or executing code. - * - * See {@link DartExecutor}. - */ - public TextInputChannel(@NonNull DartExecutor dartExecutor) { - this.channel = new MethodChannel(dartExecutor, "flutter/textinput", JSONMethodCodec.INSTANCE); - channel.setMethodCallHandler(parsingMethodHandler); - } - - /** - * Instructs Flutter to update its text input editing state to reflect the given configuration. - */ - public void updateEditingState(int inputClientId, String text, int selectionStart, int selectionEnd, int composingStart, int composingEnd) { - HashMap state = new HashMap<>(); - state.put("text", text); - state.put("selectionBase", selectionStart); - state.put("selectionExtent", selectionEnd); - state.put("composingBase", composingStart); - state.put("composingExtent", composingEnd); - - channel.invokeMethod( - "TextInputClient.updateEditingState", - Arrays.asList(inputClientId, state) - ); - } - - /** - * Instructs Flutter to execute a "newline" action. - */ - public void newline(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.newline") - ); - } - - /** - * Instructs Flutter to execute a "go" action. - */ - public void go(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.go") - ); - } - - /** - * Instructs Flutter to execute a "search" action. - */ - public void search(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.search") - ); - } - - /** - * Instructs Flutter to execute a "send" action. - */ - public void send(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.send") - ); - } - - /** - * Instructs Flutter to execute a "done" action. - */ - public void done(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.done") - ); - } - - /** - * Instructs Flutter to execute a "next" action. - */ - public void next(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.next") - ); - } - - /** - * Instructs Flutter to execute a "previous" action. - */ - public void previous(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.previous") - ); - } - - /** - * Instructs Flutter to execute an "unspecified" action. - */ - public void unspecifiedAction(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.unspecified") - ); - } - - /** - * Sets the {@link TextInputMethodHandler} which receives all events and requests - * that are parsed from the underlying platform channel. - */ - public void setTextInputMethodHandler(@Nullable TextInputMethodHandler textInputMethodHandler) { - this.textInputMethodHandler = textInputMethodHandler; - } - - public interface TextInputMethodHandler { - // TODO(mattcarroll): javadoc - void show(); - - // TODO(mattcarroll): javadoc - void hide(); - - // TODO(mattcarroll): javadoc - void setClient(int textInputClientId, @NonNull Configuration configuration); - - // TODO(mattcarroll): javadoc - void setEditingState(@NonNull TextEditState editingState); - - // TODO(mattcarroll): javadoc - void clearClient(); - } - - /** - * A text editing configuration. - */ - public static class Configuration { - public static Configuration fromJson(@NonNull JSONObject json) throws JSONException, NoSuchFieldException { - final String inputActionName = json.getString("inputAction"); - if (inputActionName == null) { - throw new JSONException("Configuration JSON missing 'inputAction' property."); - } - - final Integer inputAction = inputActionFromTextInputAction(inputActionName); - return new Configuration( - json.optBoolean("obscureText"), - json.optBoolean("autocorrect", true), - TextCapitalization.fromValue(json.getString("textCapitalization")), - InputType.fromJson(json.getJSONObject("inputType")), - inputAction, - json.optString("actionLabel") - ); - } - - private static Integer inputActionFromTextInputAction(@NonNull String inputAction) { - switch (inputAction) { - case "TextInputAction.newline": - return EditorInfo.IME_ACTION_NONE; - case "TextInputAction.none": - return EditorInfo.IME_ACTION_NONE; - case "TextInputAction.unspecified": - return EditorInfo.IME_ACTION_UNSPECIFIED; - case "TextInputAction.done": - return EditorInfo.IME_ACTION_DONE; - case "TextInputAction.go": - return EditorInfo.IME_ACTION_GO; - case "TextInputAction.search": - return EditorInfo.IME_ACTION_SEARCH; - case "TextInputAction.send": - return EditorInfo.IME_ACTION_SEND; - case "TextInputAction.next": - return EditorInfo.IME_ACTION_NEXT; - case "TextInputAction.previous": - return EditorInfo.IME_ACTION_PREVIOUS; - default: - // Present default key if bad input type is given. - return EditorInfo.IME_ACTION_UNSPECIFIED; - } - } - - public final boolean obscureText; - public final boolean autocorrect; - @NonNull - public final TextCapitalization textCapitalization; - @NonNull - public final InputType inputType; - @Nullable - public final Integer inputAction; - @Nullable - public final String actionLabel; - - public Configuration( - boolean obscureText, - boolean autocorrect, - @NonNull TextCapitalization textCapitalization, - @NonNull InputType inputType, - @Nullable Integer inputAction, - @Nullable String actionLabel - ) { - this.obscureText = obscureText; - this.autocorrect = autocorrect; - this.textCapitalization = textCapitalization; - this.inputType = inputType; - this.inputAction = inputAction; - this.actionLabel = actionLabel; - } - } - - /** - * A text input type. - * - * If the {@link #type} is {@link TextInputType#NUMBER}, this {@code InputType} also - * reports whether that number {@link #isSigned} and {@link #isDecimal}. - */ - public static class InputType { - @NonNull - public static InputType fromJson(@NonNull JSONObject json) throws JSONException, NoSuchFieldException { - return new InputType( - TextInputType.fromValue(json.getString("name")), - json.optBoolean("signed", false), - json.optBoolean("decimal", false) - ); - } - - @NonNull - public final TextInputType type; - public final boolean isSigned; - public final boolean isDecimal; - - public InputType(@NonNull TextInputType type, boolean isSigned, boolean isDecimal) { - this.type = type; - this.isSigned = isSigned; - this.isDecimal = isDecimal; - } - } - - /** - * Types of text input. - */ - public enum TextInputType { - DATETIME("TextInputType.datetime"), - NUMBER("TextInputType.number"), - PHONE("TextInputType.phone"), - MULTILINE("TextInputType.multiline"), - EMAIL_ADDRESS("TextInputType.emailAddress"), - URL("TextInputType.url"); - - static TextInputType fromValue(@NonNull String encodedName) throws NoSuchFieldException { - for (TextInputType textInputType : TextInputType.values()) { - if (textInputType.encodedName.equals(encodedName)) { - return textInputType; - } - } - throw new NoSuchFieldException("No such TextInputType: " + encodedName); - } - - @NonNull - private final String encodedName; - - TextInputType(@NonNull String encodedName) { - this.encodedName = encodedName; - } - } - - /** - * Text capitalization schemes. - */ - public enum TextCapitalization { - CHARACTERS("TextCapitalization.characters"), - WORDS("TextCapitalization.words"), - SENTENCES("TextCapitalization.sentences"); - - static TextCapitalization fromValue(@NonNull String encodedName) throws NoSuchFieldException { - for (TextCapitalization textCapitalization : TextCapitalization.values()) { - if (textCapitalization.encodedName.equals(encodedName)) { - return textCapitalization; - } - } - throw new NoSuchFieldException("No such TextCapitalization: " + encodedName); - } - - @NonNull - private final String encodedName; - - TextCapitalization(@NonNull String encodedName) { - this.encodedName = encodedName; - } - } - - /** - * State of an on-going text editing session. - */ - public static class TextEditState { - public static TextEditState fromJson(@NonNull JSONObject textEditState) throws JSONException { - return new TextEditState( - textEditState.getString("text"), - textEditState.getInt("selectionBase"), - textEditState.getInt("selectionExtent") - ); - } - - @NonNull - public final String text; - public final int selectionStart; - public final int selectionEnd; - - public TextEditState(@NonNull String text, int selectionStart, int selectionEnd) { - this.text = text; - this.selectionStart = selectionStart; - this.selectionEnd = selectionEnd; - } - } -} diff --git a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java index b3a287820bfe9..df907be0b70a1 100644 --- a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java +++ b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java @@ -11,16 +11,17 @@ import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; - -import io.flutter.embedding.engine.systemchannels.TextInputChannel; import io.flutter.plugin.common.ErrorLogResult; import io.flutter.plugin.common.MethodChannel; import io.flutter.view.FlutterView; +import java.util.Arrays; +import java.util.HashMap; + class InputConnectionAdaptor extends BaseInputConnection { private final FlutterView mFlutterView; private final int mClient; - private final TextInputChannel textInputChannel; + private final MethodChannel mFlutterChannel; private final Editable mEditable; private int mBatchCount; private InputMethodManager mImm; @@ -28,16 +29,12 @@ class InputConnectionAdaptor extends BaseInputConnection { private static final MethodChannel.Result logger = new ErrorLogResult("FlutterTextInput"); - public InputConnectionAdaptor( - FlutterView view, - int client, - TextInputChannel textInputChannel, - Editable editable - ) { + public InputConnectionAdaptor(FlutterView view, int client, + MethodChannel flutterChannel, Editable editable) { super(view, true); mFlutterView = view; mClient = client; - this.textInputChannel = textInputChannel; + mFlutterChannel = flutterChannel; mEditable = editable; mBatchCount = 0; mImm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); @@ -58,14 +55,14 @@ private void updateEditingState() { selectionStart, selectionEnd, composingStart, composingEnd); - textInputChannel.updateEditingState( - mClient, - mEditable.toString(), - selectionStart, - selectionEnd, - composingStart, - composingEnd - ); + HashMap state = new HashMap<>(); + state.put("text", mEditable.toString()); + state.put("selectionBase", selectionStart); + state.put("selectionExtent", selectionEnd); + state.put("composingBase", composingStart); + state.put("composingExtent", composingEnd); + mFlutterChannel.invokeMethod("TextInputClient.updateEditingState", + Arrays.asList(mClient, state), logger); } @Override @@ -181,30 +178,39 @@ public boolean sendKeyEvent(KeyEvent event) { @Override public boolean performEditorAction(int actionCode) { switch (actionCode) { + // TODO(mattcarroll): is newline an appropriate action for "none"? case EditorInfo.IME_ACTION_NONE: - textInputChannel.newline(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.newline"), logger); break; case EditorInfo.IME_ACTION_UNSPECIFIED: - textInputChannel.unspecifiedAction(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.unspecified"), logger); break; case EditorInfo.IME_ACTION_GO: - textInputChannel.go(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.go"), logger); break; case EditorInfo.IME_ACTION_SEARCH: - textInputChannel.search(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.search"), logger); break; case EditorInfo.IME_ACTION_SEND: - textInputChannel.send(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.send"), logger); break; case EditorInfo.IME_ACTION_NEXT: - textInputChannel.next(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.next"), logger); break; case EditorInfo.IME_ACTION_PREVIOUS: - textInputChannel.previous(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.previous"), logger); break; default: case EditorInfo.IME_ACTION_DONE: - textInputChannel.done(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.done"), logger); break; } return true; diff --git a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java index bc54b3ed045ac..c59ee25148e2d 100644 --- a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java +++ b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java @@ -5,7 +5,6 @@ package io.flutter.plugin.editing; import android.content.Context; -import android.support.annotation.NonNull; import android.text.Editable; import android.text.InputType; import android.text.Selection; @@ -13,87 +12,84 @@ import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; - -import io.flutter.embedding.engine.dart.DartExecutor; -import io.flutter.embedding.engine.systemchannels.TextInputChannel; +import io.flutter.plugin.common.JSONMethodCodec; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.flutter.plugin.common.MethodChannel.MethodCallHandler; +import io.flutter.plugin.common.MethodChannel.Result; import io.flutter.view.FlutterView; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; /** * Android implementation of the text input plugin. */ -public class TextInputPlugin { +public class TextInputPlugin implements MethodCallHandler { private final FlutterView mView; private final InputMethodManager mImm; - private final TextInputChannel textInputChannel; + private final MethodChannel mFlutterChannel; private int mClient = 0; - private TextInputChannel.Configuration configuration; + private JSONObject mConfiguration; private Editable mEditable; private boolean mRestartInputPending; - public TextInputPlugin(FlutterView view, @NonNull DartExecutor dartExecutor) { + public TextInputPlugin(FlutterView view) { mView = view; mImm = (InputMethodManager) view.getContext().getSystemService( Context.INPUT_METHOD_SERVICE); + mFlutterChannel = new MethodChannel(view, "flutter/textinput", JSONMethodCodec.INSTANCE); + mFlutterChannel.setMethodCallHandler(this); + } - textInputChannel = new TextInputChannel(dartExecutor); - textInputChannel.setTextInputMethodHandler(new TextInputChannel.TextInputMethodHandler() { - @Override - public void show() { + @Override + public void onMethodCall(MethodCall call, Result result) { + String method = call.method; + Object args = call.arguments; + try { + if (method.equals("TextInput.show")) { showTextInput(mView); - } - - @Override - public void hide() { + result.success(null); + } else if (method.equals("TextInput.hide")) { hideTextInput(mView); - } - - @Override - public void setClient(int textInputClientId, TextInputChannel.Configuration configuration) { - setTextInputClient(textInputClientId, configuration); - } - - @Override - public void setEditingState(TextInputChannel.TextEditState editingState) { - setTextInputEditingState(mView, editingState); - } - - @Override - public void clearClient() { + result.success(null); + } else if (method.equals("TextInput.setClient")) { + final JSONArray argumentList = (JSONArray) args; + setTextInputClient(mView, argumentList.getInt(0), argumentList.getJSONObject(1)); + result.success(null); + } else if (method.equals("TextInput.setEditingState")) { + setTextInputEditingState(mView, (JSONObject) args); + result.success(null); + } else if (method.equals("TextInput.clearClient")) { clearTextInputClient(); + result.success(null); + } else { + result.notImplemented(); } - }); + } catch (JSONException e) { + result.error("error", "JSON error: " + e.getMessage(), null); + } } - private static int inputTypeFromTextInputType( - TextInputChannel.InputType type, - boolean obscureText, - boolean autocorrect, - TextInputChannel.TextCapitalization textCapitalization - ) { - if (type.type == TextInputChannel.TextInputType.DATETIME) { - return InputType.TYPE_CLASS_DATETIME; - } else if (type.type == TextInputChannel.TextInputType.NUMBER) { + private static int inputTypeFromTextInputType(JSONObject type, boolean obscureText, + boolean autocorrect, String textCapitalization) throws JSONException { + String inputType = type.getString("name"); + if (inputType.equals("TextInputType.datetime")) return InputType.TYPE_CLASS_DATETIME; + if (inputType.equals("TextInputType.number")) { int textType = InputType.TYPE_CLASS_NUMBER; - if (type.isSigned) { - textType |= InputType.TYPE_NUMBER_FLAG_SIGNED; - } - if (type.isDecimal) { - textType |= InputType.TYPE_NUMBER_FLAG_DECIMAL; - } + if (type.optBoolean("signed")) textType |= InputType.TYPE_NUMBER_FLAG_SIGNED; + if (type.optBoolean("decimal")) textType |= InputType.TYPE_NUMBER_FLAG_DECIMAL; return textType; - } else if (type.type == TextInputChannel.TextInputType.PHONE) { - return InputType.TYPE_CLASS_PHONE; } + if (inputType.equals("TextInputType.phone")) return InputType.TYPE_CLASS_PHONE; int textType = InputType.TYPE_CLASS_TEXT; - if (type.type == TextInputChannel.TextInputType.MULTILINE) { + if (inputType.equals("TextInputType.multiline")) textType |= InputType.TYPE_TEXT_FLAG_MULTI_LINE; - } else if (type.type == TextInputChannel.TextInputType.EMAIL_ADDRESS) { + else if (inputType.equals("TextInputType.emailAddress")) textType |= InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; - } else if (type.type == TextInputChannel.TextInputType.URL) { + else if (inputType.equals("TextInputType.url")) textType |= InputType.TYPE_TEXT_VARIATION_URI; - } - if (obscureText) { // Note: both required. Some devices ignore TYPE_TEXT_FLAG_NO_SUGGESTIONS. textType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; @@ -101,50 +97,69 @@ private static int inputTypeFromTextInputType( } else { if (autocorrect) textType |= InputType.TYPE_TEXT_FLAG_AUTO_CORRECT; } - - if (textCapitalization == TextInputChannel.TextCapitalization.CHARACTERS) { + if (textCapitalization.equals("TextCapitalization.characters")) { textType |= InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; - } else if (textCapitalization == TextInputChannel.TextCapitalization.WORDS) { + } else if (textCapitalization.equals("TextCapitalization.words")) { textType |= InputType.TYPE_TEXT_FLAG_CAP_WORDS; - } else if (textCapitalization == TextInputChannel.TextCapitalization.SENTENCES) { + } else if (textCapitalization.equals("TextCapitalization.sentences")) { textType |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; } - return textType; } - public InputConnection createInputConnection(FlutterView view, EditorInfo outAttrs) { + private static int inputActionFromTextInputAction(String inputAction) { + switch (inputAction) { + case "TextInputAction.newline": + return EditorInfo.IME_ACTION_NONE; + case "TextInputAction.none": + return EditorInfo.IME_ACTION_NONE; + case "TextInputAction.unspecified": + return EditorInfo.IME_ACTION_UNSPECIFIED; + case "TextInputAction.done": + return EditorInfo.IME_ACTION_DONE; + case "TextInputAction.go": + return EditorInfo.IME_ACTION_GO; + case "TextInputAction.search": + return EditorInfo.IME_ACTION_SEARCH; + case "TextInputAction.send": + return EditorInfo.IME_ACTION_SEND; + case "TextInputAction.next": + return EditorInfo.IME_ACTION_NEXT; + case "TextInputAction.previous": + return EditorInfo.IME_ACTION_PREVIOUS; + default: + // Present default key if bad input type is given. + return EditorInfo.IME_ACTION_UNSPECIFIED; + } + } + + public InputConnection createInputConnection(FlutterView view, EditorInfo outAttrs) + throws JSONException { if (mClient == 0) return null; - outAttrs.inputType = inputTypeFromTextInputType( - configuration.inputType, - configuration.obscureText, - configuration.autocorrect, - configuration.textCapitalization - ); + outAttrs.inputType = inputTypeFromTextInputType(mConfiguration.getJSONObject("inputType"), + mConfiguration.optBoolean("obscureText"), + mConfiguration.optBoolean("autocorrect", true), + mConfiguration.getString("textCapitalization")); outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN; int enterAction; - if (configuration.inputAction == null) { + if (mConfiguration.isNull("inputAction")) { // If an explicit input action isn't set, then default to none for multi-line fields // and done for single line fields. enterAction = (InputType.TYPE_TEXT_FLAG_MULTI_LINE & outAttrs.inputType) != 0 ? EditorInfo.IME_ACTION_NONE : EditorInfo.IME_ACTION_DONE; } else { - enterAction = configuration.inputAction; + enterAction = inputActionFromTextInputAction(mConfiguration.getString("inputAction")); } - if (configuration.actionLabel != null) { - outAttrs.actionLabel = configuration.actionLabel; + if (!mConfiguration.isNull("actionLabel")) { + outAttrs.actionLabel = mConfiguration.getString("actionLabel"); outAttrs.actionId = enterAction; } outAttrs.imeOptions |= enterAction; - InputConnectionAdaptor connection = new InputConnectionAdaptor( - view, - mClient, - textInputChannel, - mEditable - ); + InputConnectionAdaptor connection = + new InputConnectionAdaptor(view, mClient, mFlutterChannel, mEditable); outAttrs.initialSelStart = Selection.getSelectionStart(mEditable); outAttrs.initialSelEnd = Selection.getSelectionEnd(mEditable); @@ -160,9 +175,9 @@ private void hideTextInput(FlutterView view) { mImm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0); } - private void setTextInputClient(int client, TextInputChannel.Configuration configuration) { + private void setTextInputClient(FlutterView view, int client, JSONObject configuration) { mClient = client; - this.configuration = configuration; + mConfiguration = configuration; mEditable = Editable.Factory.getInstance().newEditable(""); // setTextInputClient will be followed by a call to setTextInputEditingState. @@ -170,9 +185,9 @@ private void setTextInputClient(int client, TextInputChannel.Configuration confi mRestartInputPending = true; } - private void applyStateToSelection(TextInputChannel.TextEditState state) { - int selStart = state.selectionStart; - int selEnd = state.selectionEnd; + private void applyStateToSelection(JSONObject state) throws JSONException { + int selStart = state.getInt("selectionBase"); + int selEnd = state.getInt("selectionExtent"); if (selStart >= 0 && selStart <= mEditable.length() && selEnd >= 0 && selEnd <= mEditable.length()) { Selection.setSelection(mEditable, selStart, selEnd); @@ -181,15 +196,15 @@ private void applyStateToSelection(TextInputChannel.TextEditState state) { } } - private void setTextInputEditingState(FlutterView view, TextInputChannel.TextEditState state) { - if (!mRestartInputPending && state.text.equals(mEditable.toString())) { + private void setTextInputEditingState(FlutterView view, JSONObject state) throws JSONException { + if (!mRestartInputPending && state.getString("text").equals(mEditable.toString())) { applyStateToSelection(state); mImm.updateSelection(mView, Math.max(Selection.getSelectionStart(mEditable), 0), Math.max(Selection.getSelectionEnd(mEditable), 0), BaseInputConnection.getComposingSpanStart(mEditable), BaseInputConnection.getComposingSpanEnd(mEditable)); } else { - mEditable.replace(0, mEditable.length(), state.text); + mEditable.replace(0, mEditable.length(), state.getString("text")); applyStateToSelection(state); mImm.restartInput(view); mRestartInputPending = false; diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java index e9d44001ef0f5..b6f53d45741f1 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java @@ -9,159 +9,212 @@ import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; +import android.content.pm.ActivityInfo; import android.os.Build; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import android.util.Log; import android.view.HapticFeedbackConstants; import android.view.SoundEffectConstants; import android.view.View; import android.view.Window; - -import java.util.List; - -import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.plugin.common.ActivityLifecycleListener; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel.MethodCallHandler; +import io.flutter.plugin.common.MethodChannel.Result; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; /** * Android implementation of the platform plugin. */ -public class PlatformPlugin implements ActivityLifecycleListener { +public class PlatformPlugin implements MethodCallHandler, ActivityLifecycleListener { + private final Activity mActivity; + private JSONObject mCurrentTheme; public static final int DEFAULT_SYSTEM_UI = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; + private static final String kTextPlainFormat = "text/plain"; - private final Activity activity; - private final PlatformChannel platformChannel; - private PlatformChannel.SystemChromeStyle currentTheme; - private int mEnabledOverlays; - - private final PlatformChannel.PlatformMessageHandler mPlatformMessageHandler = new PlatformChannel.PlatformMessageHandler() { - @Override - public void playSystemSound(@NonNull PlatformChannel.SoundType soundType) { - PlatformPlugin.this.playSystemSound(soundType); - } - - @Override - public void vibrateHapticFeedback(@NonNull PlatformChannel.HapticFeedbackType feedbackType) { - PlatformPlugin.this.vibrateHapticFeedback(feedbackType); - } - - @Override - public void setPreferredOrientations(int androidOrientation) { - setSystemChromePreferredOrientations(androidOrientation); - } - - @Override - public void setApplicationSwitcherDescription(@NonNull PlatformChannel.AppSwitcherDescription description) { - setSystemChromeApplicationSwitcherDescription(description); - } - - @Override - public void showSystemOverlays(@NonNull List overlays) { - setSystemChromeEnabledSystemUIOverlays(overlays); - } - - @Override - public void restoreSystemUiOverlays() { - restoreSystemChromeSystemUIOverlays(); - } - - @Override - public void setSystemUiOverlayStyle(@NonNull PlatformChannel.SystemChromeStyle systemUiOverlayStyle) { - setSystemChromeSystemUIOverlayStyle(systemUiOverlayStyle); - } - - @Override - public void popSystemNavigator() { - PlatformPlugin.this.popSystemNavigator(); - } + public PlatformPlugin(Activity activity) { + mActivity = activity; + mEnabledOverlays = DEFAULT_SYSTEM_UI; + } - @Override - public CharSequence getClipboardData(@Nullable PlatformChannel.ClipboardContentFormat format) { - return PlatformPlugin.this.getClipboardData(format); + @Override + public void onMethodCall(MethodCall call, Result result) { + String method = call.method; + Object arguments = call.arguments; + try { + if (method.equals("SystemSound.play")) { + playSystemSound((String) arguments); + result.success(null); + } else if (method.equals("HapticFeedback.vibrate")) { + vibrateHapticFeedback((String) arguments); + result.success(null); + } else if (method.equals("SystemChrome.setPreferredOrientations")) { + setSystemChromePreferredOrientations((JSONArray) arguments); + result.success(null); + } else if (method.equals("SystemChrome.setApplicationSwitcherDescription")) { + setSystemChromeApplicationSwitcherDescription((JSONObject) arguments); + result.success(null); + } else if (method.equals("SystemChrome.setEnabledSystemUIOverlays")) { + setSystemChromeEnabledSystemUIOverlays((JSONArray) arguments); + result.success(null); + } else if (method.equals("SystemChrome.restoreSystemUIOverlays")) { + restoreSystemChromeSystemUIOverlays(); + result.success(null); + } else if (method.equals("SystemChrome.setSystemUIOverlayStyle")) { + setSystemChromeSystemUIOverlayStyle((JSONObject) arguments); + result.success(null); + } else if (method.equals("SystemNavigator.pop")) { + popSystemNavigator(); + result.success(null); + } else if (method.equals("Clipboard.getData")) { + result.success(getClipboardData((String) arguments)); + } else if (method.equals("Clipboard.setData")) { + setClipboardData((JSONObject) arguments); + result.success(null); + } else { + result.notImplemented(); + } + } catch (JSONException e) { + result.error("error", "JSON error: " + e.getMessage(), null); } + } - @Override - public void setClipboardData(@NonNull String text) { - PlatformPlugin.this.setClipboardData(text); + private void playSystemSound(String soundType) { + if (soundType.equals("SystemSoundType.click")) { + View view = mActivity.getWindow().getDecorView(); + view.playSoundEffect(SoundEffectConstants.CLICK); } - }; - - public PlatformPlugin(Activity activity, PlatformChannel platformChannel) { - this.activity = activity; - this.platformChannel = platformChannel; - this.platformChannel.setPlatformMessageHandler(mPlatformMessageHandler); - - mEnabledOverlays = DEFAULT_SYSTEM_UI; } - private void playSystemSound(PlatformChannel.SoundType soundType) { - if (soundType == PlatformChannel.SoundType.CLICK) { - View view = activity.getWindow().getDecorView(); - view.playSoundEffect(SoundEffectConstants.CLICK); + private void vibrateHapticFeedback(String feedbackType) { + View view = mActivity.getWindow().getDecorView(); + if (feedbackType == null) { + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } else if (feedbackType.equals("HapticFeedbackType.lightImpact")) { + view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); + } else if (feedbackType.equals("HapticFeedbackType.mediumImpact")) { + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } else if (feedbackType.equals("HapticFeedbackType.heavyImpact")) { + // HapticFeedbackConstants.CONTEXT_CLICK from API level 23. + view.performHapticFeedback(6); + } else if (feedbackType.equals("HapticFeedbackType.selectionClick")) { + view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK); } } - private void vibrateHapticFeedback(PlatformChannel.HapticFeedbackType feedbackType) { - View view = activity.getWindow().getDecorView(); - switch (feedbackType) { - case STANDARD: - view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + private void setSystemChromePreferredOrientations(JSONArray orientations) throws JSONException { + int requestedOrientation = 0x00; + int firstRequestedOrientation = 0x00; + for (int index = 0; index < orientations.length(); index += 1) { + if (orientations.getString(index).equals("DeviceOrientation.portraitUp")) { + requestedOrientation |= 0x01; + } else if (orientations.getString(index).equals("DeviceOrientation.landscapeLeft")) { + requestedOrientation |= 0x02; + } else if (orientations.getString(index).equals("DeviceOrientation.portraitDown")) { + requestedOrientation |= 0x04; + } else if (orientations.getString(index).equals("DeviceOrientation.landscapeRight")) { + requestedOrientation |= 0x08; + } + if (firstRequestedOrientation == 0x00) { + firstRequestedOrientation = requestedOrientation; + } + } + switch (requestedOrientation) { + case 0x00: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); break; - case LIGHT_IMPACT: - view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); + case 0x01: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); break; - case MEDIUM_IMPACT: - view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + case 0x02: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); break; - case HEAVY_IMPACT: - // HapticFeedbackConstants.CONTEXT_CLICK from API level 23. - view.performHapticFeedback(6); + case 0x04: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); break; - case SELECTION_CLICK: - view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK); + case 0x05: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT); break; - } - } - - private void setSystemChromePreferredOrientations(int androidOrientation) { - activity.setRequestedOrientation(androidOrientation); + case 0x08: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); + break; + case 0x0a: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE); + break; + case 0x0b: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER); + break; + case 0x0f: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER); + break; + case 0x03: // portraitUp and landscapeLeft + case 0x06: // portraitDown and landscapeLeft + case 0x07: // portraitUp, portraitDown, and landscapeLeft + case 0x09: // portraitUp and landscapeRight + case 0x0c: // portraitDown and landscapeRight + case 0x0d: // portraitUp, portraitDown, and landscapeRight + case 0x0e: // portraitDown, landscapeLeft, and landscapeRight + // Android can't describe these cases, so just default to whatever the first + // specified value was. + switch (firstRequestedOrientation) { + case 0x01: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + break; + case 0x02: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); + break; + case 0x04: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); + break; + case 0x08: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); + break; + } + break; + } } - private void setSystemChromeApplicationSwitcherDescription(PlatformChannel.AppSwitcherDescription description) { + private void setSystemChromeApplicationSwitcherDescription(JSONObject description) throws JSONException { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return; } + int color = description.getInt("primaryColor"); + if (color != 0) { // 0 means color isn't set, use system default + color = color | 0xFF000000; // color must be opaque if set + } + + String label = description.getString("label"); + @SuppressWarnings("deprecation") TaskDescription taskDescription = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) - ? new TaskDescription(description.label, 0, description.color) - : new TaskDescription(description.label, null, description.color); + ? new TaskDescription(label, 0, color) + : new TaskDescription(label, null, color); - activity.setTaskDescription(taskDescription); + mActivity.setTaskDescription(taskDescription); } - private void setSystemChromeEnabledSystemUIOverlays(List overlaysToShow) { - // Start by assuming we want to hide all system overlays (like an immersive game). + private int mEnabledOverlays; + + private void setSystemChromeEnabledSystemUIOverlays(JSONArray overlays) throws JSONException { int enabledOverlays = DEFAULT_SYSTEM_UI | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; - if (overlaysToShow.size() == 0) { + if (overlays.length() == 0) { enabledOverlays |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; } - // Re-add any desired system overlays. - for (int i = 0; i < overlaysToShow.size(); ++i) { - PlatformChannel.SystemUiOverlay overlayToShow = overlaysToShow.get(i); - switch (overlayToShow) { - case TOP_OVERLAYS: - enabledOverlays &= ~View.SYSTEM_UI_FLAG_FULLSCREEN; - break; - case BOTTOM_OVERLAYS: - enabledOverlays &= ~View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; - enabledOverlays &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; - break; + for (int i = 0; i < overlays.length(); ++i) { + String overlay = overlays.getString(i); + if (overlay.equals("SystemUiOverlay.top")) { + enabledOverlays &= ~View.SYSTEM_UI_FLAG_FULLSCREEN; + } else if (overlay.equals("SystemUiOverlay.bottom")) { + enabledOverlays &= ~View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; + enabledOverlays &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; } } @@ -170,9 +223,9 @@ private void setSystemChromeEnabledSystemUIOverlays(List= 26) { - if (systemChromeStyle.systemNavigationBarIconBrightness != null) { - switch (systemChromeStyle.systemNavigationBarIconBrightness) { - case DARK: - //View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR - flags |= 0x10; - break; - case LIGHT: - flags &= ~0x10; - break; + try { + // You can change the navigation bar color (including translucent colors) + // in Android, but you can't change the color of the navigation buttons until Android O. + // LIGHT vs DARK effectively isn't supported until then. + // Build.VERSION_CODES.O + if (Build.VERSION.SDK_INT >= 26) { + if (!message.isNull("systemNavigationBarIconBrightness")) { + String systemNavigationBarIconBrightness = message.getString("systemNavigationBarIconBrightness"); + switch (systemNavigationBarIconBrightness) { + case "Brightness.dark": + //View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR + flags |= 0x10; + break; + case "Brightness.light": + flags &= ~0x10; + break; + } + } + if (!message.isNull("systemNavigationBarColor")) { + window.setNavigationBarColor(message.getInt("systemNavigationBarColor")); } } - if (systemChromeStyle.systemNavigationBarColor != null) { - window.setNavigationBarColor(systemChromeStyle.systemNavigationBarColor); - } - } - // Build.VERSION_CODES.M - if (Build.VERSION.SDK_INT >= 23) { - if (systemChromeStyle.statusBarIconBrightness != null) { - switch (systemChromeStyle.statusBarIconBrightness) { - case DARK: - // View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR - flags |= 0x2000; - break; - case LIGHT: - flags &= ~0x2000; - break; + // Build.VERSION_CODES.M + if (Build.VERSION.SDK_INT >= 23) { + if (!message.isNull("statusBarIconBrightness")) { + String statusBarIconBrightness = message.getString("statusBarIconBrightness"); + switch (statusBarIconBrightness) { + case "Brightness.dark": + // View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR + flags |= 0x2000; + break; + case "Brightness.light": + flags &= ~0x2000; + break; + } + } + if (!message.isNull("statusBarColor")) { + window.setStatusBarColor(message.getInt("statusBarColor")); } } - if (systemChromeStyle.statusBarColor != null) { - window.setStatusBarColor(systemChromeStyle.statusBarColor); + if (!message.isNull("systemNavigationBarDividerColor")) { + // Not availible until Android P. + // window.setNavigationBarDividerColor(systemNavigationBarDividerColor); } + view.setSystemUiVisibility(flags); + mCurrentTheme = message; + } catch (JSONException err) { + Log.i("PlatformPlugin", err.toString()); } - if (systemChromeStyle.systemNavigationBarDividerColor != null) { - // Not availible until Android P. - // window.setNavigationBarDividerColor(systemNavigationBarDividerColor); - } - view.setSystemUiVisibility(flags); - currentTheme = systemChromeStyle; } private void popSystemNavigator() { - activity.finish(); + mActivity.finish(); } - private CharSequence getClipboardData(PlatformChannel.ClipboardContentFormat format) { - ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); + private JSONObject getClipboardData(String format) throws JSONException { + ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = clipboard.getPrimaryClip(); if (clip == null) return null; - if (format == null || format == PlatformChannel.ClipboardContentFormat.PLAIN_TEXT) { - return clip.getItemAt(0).coerceToText(activity); + if (format == null || format.equals(kTextPlainFormat)) { + JSONObject result = new JSONObject(); + result.put("text", clip.getItemAt(0).coerceToText(mActivity)); + return result; } return null; } - private void setClipboardData(String text) { - ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); - ClipData clip = ClipData.newPlainText("text label?", text); + private void setClipboardData(JSONObject data) throws JSONException { + ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE); + ClipData clip = ClipData.newPlainText("text label?", data.getString("text")); clipboard.setPrimaryClip(clip); } diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index ac5e2f8f3d995..d8c2de3749195 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -9,21 +9,20 @@ import android.opengl.Matrix; import android.os.Build; import android.os.Bundle; -import android.support.annotation.NonNull; import android.util.Log; import android.view.View; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeProvider; - -import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; +import io.flutter.plugin.common.BasicMessageChannel; +import io.flutter.plugin.common.StandardMessageCodec; import io.flutter.util.Predicate; import java.nio.ByteBuffer; import java.util.*; class AccessibilityBridge - extends AccessibilityNodeProvider { + extends AccessibilityNodeProvider implements BasicMessageChannel.MessageHandler { private static final String TAG = "FlutterView"; // Constants from higher API levels. @@ -35,42 +34,19 @@ class AccessibilityBridge private static final float SCROLL_POSITION_CAP_FOR_INFINITY = 70000.0f; private static final int ROOT_NODE_ID = 0; - private final FlutterView owner; - private final AccessibilityChannel accessibilityChannel; - private final View decorView; - private Map objects; - private Map customAccessibilityActions; - private boolean accessibilityEnabled = false; - private SemanticsObject a11yFocusedObject; - private SemanticsObject inputFocusedObject; - private SemanticsObject hoveredObject; + private Map mObjects; + private Map mCustomAccessibilityActions; + private final FlutterView mOwner; + private boolean mAccessibilityEnabled = false; + private SemanticsObject mA11yFocusedObject; + private SemanticsObject mInputFocusedObject; + private SemanticsObject mHoveredObject; private int previousRouteId = ROOT_NODE_ID; private List previousRoutes; - private Integer lastLeftFrameInset = 0; - - private final AccessibilityChannel.AccessibilityMessageHandler accessibilityMessageHandler = new AccessibilityChannel.AccessibilityMessageHandler() { - @Override - public void announce(@NonNull String message) { - owner.announceForAccessibility(message); - } - - @Override - public void onTap(int nodeId) { - sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_CLICKED); - } + private final View mDecorView; + private Integer mLastLeftFrameInset = 0; - @Override - public void onLongPress(int nodeId) { - sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); - } - - @Override - public void onTooltip(@NonNull String message) { - AccessibilityEvent e = obtainAccessibilityEvent(ROOT_NODE_ID, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); - e.getText().add(message); - sendAccessibilityEvent(e); - } - }; + private final BasicMessageChannel mFlutterAccessibilityChannel; enum Action { TAP(1 << 0), @@ -130,21 +106,23 @@ enum Flag { final int value; } - AccessibilityBridge(@NonNull FlutterView owner, @NonNull AccessibilityChannel accessibilityChannel) { - this.owner = owner; - this.accessibilityChannel = accessibilityChannel; - decorView = ((Activity) owner.getContext()).getWindow().getDecorView(); - objects = new HashMap<>(); - customAccessibilityActions = new HashMap<>(); + AccessibilityBridge(FlutterView owner) { + assert owner != null; + mOwner = owner; + mObjects = new HashMap<>(); + mCustomAccessibilityActions = new HashMap<>(); previousRoutes = new ArrayList<>(); + mFlutterAccessibilityChannel = new BasicMessageChannel<>( + owner, "flutter/accessibility", StandardMessageCodec.INSTANCE); + mDecorView = ((Activity) owner.getContext()).getWindow().getDecorView(); } void setAccessibilityEnabled(boolean accessibilityEnabled) { - this.accessibilityEnabled = accessibilityEnabled; + mAccessibilityEnabled = accessibilityEnabled; if (accessibilityEnabled) { - this.accessibilityChannel.setAccessibilityMessageHandler(accessibilityMessageHandler); + mFlutterAccessibilityChannel.setMessageHandler(this); } else { - this.accessibilityChannel.setAccessibilityMessageHandler(null); + mFlutterAccessibilityChannel.setMessageHandler(null); } } @@ -159,42 +137,42 @@ private boolean shouldSetCollectionInfo(final SemanticsObject object) { // to set it if we're exiting a list to a non-list, so that we can get the "out of list" // announcement when A11y focus moves out of a list and not into another list. return object.scrollChildren > 0 - && (hasSemanticsObjectAncestor(a11yFocusedObject, o -> o == object) - || !hasSemanticsObjectAncestor(a11yFocusedObject, o -> o.hasFlag(Flag.HAS_IMPLICIT_SCROLLING))); + && (hasSemanticsObjectAncestor(mA11yFocusedObject, o -> o == object) + || !hasSemanticsObjectAncestor(mA11yFocusedObject, o -> o.hasFlag(Flag.HAS_IMPLICIT_SCROLLING))); } @Override @SuppressWarnings("deprecation") public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (virtualViewId == View.NO_ID) { - AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(owner); - owner.onInitializeAccessibilityNodeInfo(result); - if (objects.containsKey(ROOT_NODE_ID)) { - result.addChild(owner, ROOT_NODE_ID); + AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(mOwner); + mOwner.onInitializeAccessibilityNodeInfo(result); + if (mObjects.containsKey(ROOT_NODE_ID)) { + result.addChild(mOwner, ROOT_NODE_ID); } return result; } - SemanticsObject object = objects.get(virtualViewId); + SemanticsObject object = mObjects.get(virtualViewId); if (object == null) { return null; } - AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(owner, virtualViewId); + AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(mOwner, virtualViewId); // Work around for https://github.com/flutter/flutter/issues/2101 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { result.setViewIdResourceName(""); } - result.setPackageName(owner.getContext().getPackageName()); + result.setPackageName(mOwner.getContext().getPackageName()); result.setClassName("android.view.View"); - result.setSource(owner, virtualViewId); + result.setSource(mOwner, virtualViewId); result.setFocusable(object.isFocusable()); - if (inputFocusedObject != null) { - result.setFocused(inputFocusedObject.id == virtualViewId); + if (mInputFocusedObject != null) { + result.setFocused(mInputFocusedObject.id == virtualViewId); } - if (a11yFocusedObject != null) { - result.setAccessibilityFocused(a11yFocusedObject.id == virtualViewId); + if (mA11yFocusedObject != null) { + result.setAccessibilityFocused(mA11yFocusedObject.id == virtualViewId); } if (object.hasFlag(Flag.IS_TEXT_FIELD)) { @@ -208,7 +186,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { // 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 && a11yFocusedObject != null && a11yFocusedObject.id == virtualViewId) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 && mA11yFocusedObject != null && mA11yFocusedObject.id == virtualViewId) { result.setLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); } } @@ -261,10 +239,10 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (object.parent != null) { assert object.id > ROOT_NODE_ID; - result.setParent(owner, object.parent.id); + result.setParent(mOwner, object.parent.id); } else { assert object.id == ROOT_NODE_ID; - result.setParent(owner); + result.setParent(mOwner); } Rect bounds = object.getGlobalRect(); @@ -384,7 +362,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { result.setSelected(object.hasFlag(Flag.IS_SELECTED)); // Accessibility Focus - if (a11yFocusedObject != null && a11yFocusedObject.id == virtualViewId) { + if (mA11yFocusedObject != null && mA11yFocusedObject.id == virtualViewId) { result.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } else { result.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); @@ -403,7 +381,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (object.childrenInTraversalOrder != null) { for (SemanticsObject child : object.childrenInTraversalOrder) { if (!child.hasFlag(Flag.IS_HIDDEN)) { - result.addChild(owner, child.id); + result.addChild(mOwner, child.id); } } } @@ -413,7 +391,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { @Override public boolean performAction(int virtualViewId, int action, Bundle arguments) { - SemanticsObject object = objects.get(virtualViewId); + SemanticsObject object = mObjects.get(virtualViewId); if (object == null) { return false; } @@ -422,27 +400,27 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { // Note: TalkBack prior to Oreo doesn't use this handler and instead simulates a // click event at the center of the SemanticsNode. Other a11y services might go // through this handler though. - owner.dispatchSemanticsAction(virtualViewId, Action.TAP); + mOwner.dispatchSemanticsAction(virtualViewId, Action.TAP); return true; } case AccessibilityNodeInfo.ACTION_LONG_CLICK: { // Note: TalkBack doesn't use this handler and instead simulates a long click event // at the center of the SemanticsNode. Other a11y services might go through this // handler though. - owner.dispatchSemanticsAction(virtualViewId, Action.LONG_PRESS); + mOwner.dispatchSemanticsAction(virtualViewId, Action.LONG_PRESS); return true; } case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: { if (object.hasAction(Action.SCROLL_UP)) { - owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_UP); + mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_UP); } else if (object.hasAction(Action.SCROLL_LEFT)) { // TODO(ianh): bidi support using textDirection - owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_LEFT); + mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_LEFT); } else if (object.hasAction(Action.INCREASE)) { object.value = object.increasedValue; // Event causes Android to read out the updated value. sendAccessibilityEvent(virtualViewId, AccessibilityEvent.TYPE_VIEW_SELECTED); - owner.dispatchSemanticsAction(virtualViewId, Action.INCREASE); + mOwner.dispatchSemanticsAction(virtualViewId, Action.INCREASE); } else { return false; } @@ -450,15 +428,15 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { } case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: { if (object.hasAction(Action.SCROLL_DOWN)) { - owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_DOWN); + mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_DOWN); } else if (object.hasAction(Action.SCROLL_RIGHT)) { // TODO(ianh): bidi support using textDirection - owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_RIGHT); + mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_RIGHT); } else if (object.hasAction(Action.DECREASE)) { object.value = object.decreasedValue; // Event causes Android to read out the updated value. sendAccessibilityEvent(virtualViewId, AccessibilityEvent.TYPE_VIEW_SELECTED); - owner.dispatchSemanticsAction(virtualViewId, Action.DECREASE); + mOwner.dispatchSemanticsAction(virtualViewId, Action.DECREASE); } else { return false; } @@ -471,24 +449,24 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { return performCursorMoveAction(object, virtualViewId, arguments, true); } case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: { - owner.dispatchSemanticsAction(virtualViewId, Action.DID_LOSE_ACCESSIBILITY_FOCUS); + mOwner.dispatchSemanticsAction(virtualViewId, Action.DID_LOSE_ACCESSIBILITY_FOCUS); sendAccessibilityEvent( virtualViewId, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - a11yFocusedObject = null; + mA11yFocusedObject = null; return true; } case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: { - owner.dispatchSemanticsAction(virtualViewId, Action.DID_GAIN_ACCESSIBILITY_FOCUS); + mOwner.dispatchSemanticsAction(virtualViewId, Action.DID_GAIN_ACCESSIBILITY_FOCUS); sendAccessibilityEvent( virtualViewId, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED); - if (a11yFocusedObject == null) { + if (mA11yFocusedObject == null) { // When Android focuses a node, it doesn't invalidate the view. // (It does when it sends ACTION_CLEAR_ACCESSIBILITY_FOCUS, so // we only have to worry about this when the focused node is null.) - owner.invalidate(); + mOwner.invalidate(); } - a11yFocusedObject = object; + mA11yFocusedObject = object; if (object.hasAction(Action.INCREASE) || object.hasAction(Action.DECREASE)) { // SeekBars only announce themselves after this event. @@ -498,7 +476,7 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { return true; } case ACTION_SHOW_ON_SCREEN: { - owner.dispatchSemanticsAction(virtualViewId, Action.SHOW_ON_SCREEN); + mOwner.dispatchSemanticsAction(virtualViewId, Action.SHOW_ON_SCREEN); return true; } case AccessibilityNodeInfo.ACTION_SET_SELECTION: { @@ -520,32 +498,32 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { selection.put("base", object.textSelectionExtent); selection.put("extent", object.textSelectionExtent); } - owner.dispatchSemanticsAction(virtualViewId, Action.SET_SELECTION, selection); + mOwner.dispatchSemanticsAction(virtualViewId, Action.SET_SELECTION, selection); return true; } case AccessibilityNodeInfo.ACTION_COPY: { - owner.dispatchSemanticsAction(virtualViewId, Action.COPY); + mOwner.dispatchSemanticsAction(virtualViewId, Action.COPY); return true; } case AccessibilityNodeInfo.ACTION_CUT: { - owner.dispatchSemanticsAction(virtualViewId, Action.CUT); + mOwner.dispatchSemanticsAction(virtualViewId, Action.CUT); return true; } case AccessibilityNodeInfo.ACTION_PASTE: { - owner.dispatchSemanticsAction(virtualViewId, Action.PASTE); + mOwner.dispatchSemanticsAction(virtualViewId, Action.PASTE); return true; } case AccessibilityNodeInfo.ACTION_DISMISS: { - owner.dispatchSemanticsAction(virtualViewId, Action.DISMISS); + mOwner.dispatchSemanticsAction(virtualViewId, Action.DISMISS); return true; } default: // might be a custom accessibility action. final int flutterId = action - firstResourceId; CustomAccessibilityAction contextAction = - customAccessibilityActions.get(flutterId); + mCustomAccessibilityActions.get(flutterId); if (contextAction != null) { - owner.dispatchSemanticsAction( + mOwner.dispatchSemanticsAction( virtualViewId, Action.CUSTOM_ACTION, contextAction.id); return true; } @@ -562,12 +540,12 @@ boolean performCursorMoveAction( switch (granularity) { case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER: { if (forward && object.hasAction(Action.MOVE_CURSOR_FORWARD_BY_CHARACTER)) { - owner.dispatchSemanticsAction(virtualViewId, + mOwner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_FORWARD_BY_CHARACTER, extendSelection); return true; } if (!forward && object.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER)) { - owner.dispatchSemanticsAction(virtualViewId, + mOwner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER, extendSelection); return true; } @@ -575,12 +553,12 @@ boolean performCursorMoveAction( } case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD: if (forward && object.hasAction(Action.MOVE_CURSOR_FORWARD_BY_WORD)) { - owner.dispatchSemanticsAction(virtualViewId, + mOwner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_FORWARD_BY_WORD, extendSelection); return true; } if (!forward && object.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_WORD)) { - owner.dispatchSemanticsAction(virtualViewId, + mOwner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_BACKWARD_BY_WORD, extendSelection); return true; } @@ -595,65 +573,65 @@ boolean performCursorMoveAction( public AccessibilityNodeInfo findFocus(int focus) { switch (focus) { case AccessibilityNodeInfo.FOCUS_INPUT: { - if (inputFocusedObject != null) - return createAccessibilityNodeInfo(inputFocusedObject.id); + if (mInputFocusedObject != null) + return createAccessibilityNodeInfo(mInputFocusedObject.id); } // Fall through to check FOCUS_ACCESSIBILITY case AccessibilityNodeInfo.FOCUS_ACCESSIBILITY: { - if (a11yFocusedObject != null) - return createAccessibilityNodeInfo(a11yFocusedObject.id); + if (mA11yFocusedObject != null) + return createAccessibilityNodeInfo(mA11yFocusedObject.id); } } return null; } private SemanticsObject getRootObject() { - assert objects.containsKey(0); - return objects.get(0); + assert mObjects.containsKey(0); + return mObjects.get(0); } private SemanticsObject getOrCreateObject(int id) { - SemanticsObject object = objects.get(id); + SemanticsObject object = mObjects.get(id); if (object == null) { object = new SemanticsObject(); object.id = id; - objects.put(id, object); + mObjects.put(id, object); } return object; } private CustomAccessibilityAction getOrCreateAction(int id) { - CustomAccessibilityAction action = customAccessibilityActions.get(id); + CustomAccessibilityAction action = mCustomAccessibilityActions.get(id); if (action == null) { action = new CustomAccessibilityAction(); action.id = id; action.resourceId = id + firstResourceId; - customAccessibilityActions.put(id, action); + mCustomAccessibilityActions.put(id, action); } return action; } void handleTouchExplorationExit() { - if (hoveredObject != null) { - sendAccessibilityEvent(hoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); - hoveredObject = null; + if (mHoveredObject != null) { + sendAccessibilityEvent(mHoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); + mHoveredObject = null; } } void handleTouchExploration(float x, float y) { - if (objects.isEmpty()) { + if (mObjects.isEmpty()) { return; } SemanticsObject newObject = getRootObject().hitTest(new float[] {x, y, 0, 1}); - if (newObject != hoveredObject) { + if (newObject != mHoveredObject) { // sending ENTER before EXIT is how Android wants it if (newObject != null) { sendAccessibilityEvent(newObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_ENTER); } - if (hoveredObject != null) { - sendAccessibilityEvent(hoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); + if (mHoveredObject != null) { + sendAccessibilityEvent(mHoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); } - hoveredObject = newObject; + mHoveredObject = newObject; } } @@ -679,7 +657,7 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { continue; } if (object.hasFlag(Flag.IS_FOCUSED)) { - inputFocusedObject = object; + mInputFocusedObject = object; } if (object.hadPreviousConfig) { updated.add(object); @@ -697,12 +675,12 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { // a11y nodes. if (Build.VERSION.SDK_INT >= 23) { Rect visibleFrame = new Rect(); - decorView.getWindowVisibleDisplayFrame(visibleFrame); - if (!lastLeftFrameInset.equals(visibleFrame.left)) { + mDecorView.getWindowVisibleDisplayFrame(visibleFrame); + if (!mLastLeftFrameInset.equals(visibleFrame.left)) { rootObject.globalGeometryDirty = true; rootObject.inverseTransformDirty = true; } - lastLeftFrameInset = visibleFrame.left; + mLastLeftFrameInset = visibleFrame.left; Matrix.translateM(identity, 0, visibleFrame.left, 0, 0); } rootObject.updateRecursively(identity, visitedObjects, false); @@ -729,7 +707,7 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { previousRoutes.add(semanticsObject.id); } - Iterator> it = objects.entrySet().iterator(); + Iterator> it = mObjects.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = it.next(); SemanticsObject object = entry.getValue(); @@ -809,25 +787,25 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } } else if (object.hasFlag(Flag.IS_TEXT_FIELD) && object.didChangeLabel() - && inputFocusedObject != null && inputFocusedObject.id == object.id) { + && mInputFocusedObject != null && mInputFocusedObject.id == object.id) { // Text fields should announce when their label changes while focused. We use a live // region tag to do so, and this event triggers that update. sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } - if (a11yFocusedObject != null && a11yFocusedObject.id == object.id + if (mA11yFocusedObject != null && mA11yFocusedObject.id == object.id && !object.hadFlag(Flag.IS_SELECTED) && object.hasFlag(Flag.IS_SELECTED)) { AccessibilityEvent event = obtainAccessibilityEvent(object.id, AccessibilityEvent.TYPE_VIEW_SELECTED); event.getText().add(object.label); sendAccessibilityEvent(event); } - if (inputFocusedObject != null && inputFocusedObject.id == object.id + if (mInputFocusedObject != null && mInputFocusedObject.id == object.id && 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 - && (a11yFocusedObject == null || (a11yFocusedObject.id == inputFocusedObject.id))) { + && (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); @@ -885,27 +863,65 @@ private AccessibilityEvent createTextChangedEvent(int id, String oldValue, Strin private AccessibilityEvent obtainAccessibilityEvent(int virtualViewId, int eventType) { assert virtualViewId != ROOT_NODE_ID; AccessibilityEvent event = AccessibilityEvent.obtain(eventType); - event.setPackageName(owner.getContext().getPackageName()); - event.setSource(owner, virtualViewId); + event.setPackageName(mOwner.getContext().getPackageName()); + event.setSource(mOwner, virtualViewId); return event; } private void sendAccessibilityEvent(int virtualViewId, int eventType) { - if (!accessibilityEnabled) { + if (!mAccessibilityEnabled) { return; } if (virtualViewId == ROOT_NODE_ID) { - owner.sendAccessibilityEvent(eventType); + mOwner.sendAccessibilityEvent(eventType); } else { sendAccessibilityEvent(obtainAccessibilityEvent(virtualViewId, eventType)); } } private void sendAccessibilityEvent(AccessibilityEvent event) { - if (!accessibilityEnabled) { + if (!mAccessibilityEnabled) { return; } - owner.getParent().requestSendAccessibilityEvent(owner, event); + mOwner.getParent().requestSendAccessibilityEvent(mOwner, event); + } + + // Message Handler for [mFlutterAccessibilityChannel]. + public void onMessage(Object message, BasicMessageChannel.Reply reply) { + @SuppressWarnings("unchecked") + final HashMap annotatedEvent = (HashMap) message; + final String type = (String) annotatedEvent.get("type"); + @SuppressWarnings("unchecked") + final HashMap data = (HashMap) annotatedEvent.get("data"); + + switch (type) { + case "announce": + mOwner.announceForAccessibility((String) data.get("message")); + break; + case "longPress": { + Integer nodeId = (Integer) annotatedEvent.get("nodeId"); + if (nodeId == null) { + return; + } + sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); + break; + } + case "tap": { + Integer nodeId = (Integer) annotatedEvent.get("nodeId"); + if (nodeId == null) { + return; + } + sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_CLICKED); + break; + } + case "tooltip": { + AccessibilityEvent e = obtainAccessibilityEvent( + ROOT_NODE_ID, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); + e.getText().add((String) data.get("message")); + sendAccessibilityEvent(e); + break; + } + } } private void createWindowChangeEvent(SemanticsObject route) { @@ -917,29 +933,29 @@ private void createWindowChangeEvent(SemanticsObject route) { } private void willRemoveSemanticsObject(SemanticsObject object) { - assert objects.containsKey(object.id); - assert objects.get(object.id) == object; + assert mObjects.containsKey(object.id); + assert mObjects.get(object.id) == object; object.parent = null; - if (a11yFocusedObject == object) { - sendAccessibilityEvent(a11yFocusedObject.id, + if (mA11yFocusedObject == object) { + sendAccessibilityEvent(mA11yFocusedObject.id, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - a11yFocusedObject = null; + mA11yFocusedObject = null; } - if (inputFocusedObject == object) { - inputFocusedObject = null; + if (mInputFocusedObject == object) { + mInputFocusedObject = null; } - if (hoveredObject == object) { - hoveredObject = null; + if (mHoveredObject == object) { + mHoveredObject = null; } } void reset() { - objects.clear(); - if (a11yFocusedObject != null) - sendAccessibilityEvent(a11yFocusedObject.id, + mObjects.clear(); + if (mA11yFocusedObject != null) + sendAccessibilityEvent(mA11yFocusedObject.id, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - a11yFocusedObject = null; - hoveredObject = null; + mA11yFocusedObject = null; + mHoveredObject = null; sendAccessibilityEvent(0, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 00bd03663ae8f..c6927a3245711 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -15,7 +15,6 @@ import android.net.Uri; import android.os.Build; import android.os.Handler; -import android.os.LocaleList; import android.provider.Settings; import android.text.format.DateFormat; import android.util.AttributeSet; @@ -30,17 +29,17 @@ import io.flutter.embedding.engine.FlutterJNI; import io.flutter.embedding.engine.android.AndroidKeyProcessor; import io.flutter.embedding.engine.dart.DartExecutor; -import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; import io.flutter.embedding.engine.systemchannels.KeyEventChannel; import io.flutter.embedding.engine.systemchannels.LifecycleChannel; import io.flutter.embedding.engine.systemchannels.NavigationChannel; -import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.embedding.engine.systemchannels.SettingsChannel; import io.flutter.embedding.engine.systemchannels.SystemChannel; import io.flutter.plugin.common.*; import io.flutter.plugin.editing.TextInputPlugin; import io.flutter.plugin.platform.PlatformPlugin; +import org.json.JSONException; +import java.lang.reflect.Method; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.*; @@ -88,21 +87,18 @@ static final class ViewportMetrics { } private final DartExecutor dartExecutor; - private final AccessibilityChannel accessibilityChannel; private final NavigationChannel navigationChannel; private final KeyEventChannel keyEventChannel; private final LifecycleChannel lifecycleChannel; - private final LocalizationChannel localizationChannel; - private final PlatformChannel platformChannel; private final SettingsChannel settingsChannel; private final SystemChannel systemChannel; private final InputMethodManager mImm; private final TextInputPlugin mTextInputPlugin; private final AndroidKeyProcessor androidKeyProcessor; - private AccessibilityBridge mAccessibilityNodeProvider; private final SurfaceHolder.Callback mSurfaceCallback; private final ViewportMetrics mMetrics; private final AccessibilityManager mAccessibilityManager; + private final MethodChannel mFlutterLocalizationChannel; private final List mActivityLifecycleListeners; private final List mFirstFrameListeners; private final AtomicLong nextTextureId = new AtomicLong(0L); @@ -164,25 +160,23 @@ public void surfaceDestroyed(SurfaceHolder holder) { mActivityLifecycleListeners = new ArrayList<>(); mFirstFrameListeners = new ArrayList<>(); - // Create all platform channels - accessibilityChannel = new AccessibilityChannel(dartExecutor); + // Configure the platform plugins and flutter channels. navigationChannel = new NavigationChannel(dartExecutor); keyEventChannel = new KeyEventChannel(dartExecutor); lifecycleChannel = new LifecycleChannel(dartExecutor); - localizationChannel = new LocalizationChannel(dartExecutor); - platformChannel = new PlatformChannel(dartExecutor); systemChannel = new SystemChannel(dartExecutor); settingsChannel = new SettingsChannel(dartExecutor); + mFlutterLocalizationChannel = new MethodChannel(this, "flutter/localization", JSONMethodCodec.INSTANCE); - // Create and setup plugins - PlatformPlugin platformPlugin = new PlatformPlugin(activity, platformChannel); + PlatformPlugin platformPlugin = new PlatformPlugin(activity); + MethodChannel flutterPlatformChannel = new MethodChannel(this, "flutter/platform", JSONMethodCodec.INSTANCE); + flutterPlatformChannel.setMethodCallHandler(platformPlugin); addActivityLifecycleListener(platformPlugin); mImm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - mTextInputPlugin = new TextInputPlugin(this, dartExecutor); + mTextInputPlugin = new TextInputPlugin(this); androidKeyProcessor = new AndroidKeyProcessor(keyEventChannel); - // Send initial platform information to Dart - sendLocalesToDart(getResources().getConfiguration()); + setLocales(getResources().getConfiguration()); sendUserPlatformSettingsToDart(); } @@ -317,21 +311,39 @@ private void sendUserPlatformSettingsToDart() { .send(); } - private void sendLocalesToDart(Configuration config) { - LocaleList localeList = config.getLocales(); - int localeCount = localeList.size(); - List locales = new ArrayList<>(); - for (int index = 0; index < localeCount; ++index) { - Locale locale = localeList.get(index); - locales.add(locale); + 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. + } } - localizationChannel.sendLocales(locales); + // Fallback single locale passing for android API < 24. Should work always. + @SuppressWarnings("deprecation") + 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); - sendLocalesToDart(newConfig); + setLocales(newConfig); sendUserPlatformSettingsToDart(); } @@ -362,7 +374,13 @@ public void destroy() { @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { - return mTextInputPlugin.createInputConnection(this, outAttrs); + try { + mLastInputConnection = mTextInputPlugin.createInputConnection(this, outAttrs); + return mLastInputConnection; + } catch (JSONException e) { + Log.e(TAG, "Failed to create input connection", e); + return null; + } } // Must match the PointerChange enum in pointer.dart. @@ -988,12 +1006,14 @@ public AccessibilityNodeProvider getAccessibilityNodeProvider() { return null; } + private AccessibilityBridge mAccessibilityNodeProvider; + void ensureAccessibilityEnabled() { if (!isAttached()) return; mAccessibilityEnabled = true; if (mAccessibilityNodeProvider == null) { - mAccessibilityNodeProvider = new AccessibilityBridge(this, accessibilityChannel); + mAccessibilityNodeProvider = new AccessibilityBridge(this); } mNativeView.getFlutterJNI().setSemanticsEnabled(true); mAccessibilityNodeProvider.setAccessibilityEnabled(true); From f37b09a11b281b2a4e5dfcb45029069c3ac6e460 Mon Sep 17 00:00:00 2001 From: freiling Date: Fri, 15 Feb 2019 15:32:56 -0800 Subject: [PATCH 0187/1117] [fuchsia][SCN-1054] Map elevation onto -Z in Scenic (#7834) Note: the SetTranslationRH function is temporary and part of the smooth transition plan for Scenics handedness inversion. See SCN-1054 for details. We will follow this will a change to migrate back off SetTranslationRH Submit after https://fuchsia-review.googlesource.com/c/fuchsia/+/255056 lands in fuchsia.git --- flow/export_node.cc | 2 +- flow/scene_update_context.cc | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/flow/export_node.cc b/flow/export_node.cc index acf7e42da3215..3bf840dbc6a89 100644 --- a/flow/export_node.cc +++ b/flow/export_node.cc @@ -56,7 +56,7 @@ void ExportNode::Bind(SceneUpdateContext& context, if (node_) { container.AddChild(*node_); - node_->SetTranslation(offset.x(), offset.y(), 0.f); + node_->SetTranslationRH(offset.x(), offset.y(), 0.f); node_->SetHitTestBehavior( hit_testable ? fuchsia::ui::gfx::HitTestBehavior::kDefault : fuchsia::ui::gfx::HitTestBehavior::kSuppress); diff --git a/flow/scene_update_context.cc b/flow/scene_update_context.cc index c02332d83fb19..0e057edc2f0a7 100644 --- a/flow/scene_update_context.cc +++ b/flow/scene_update_context.cc @@ -110,9 +110,9 @@ void SceneUpdateContext::CreateFrame( ); scenic::ShapeNode shape_node(session_); shape_node.SetShape(shape); - shape_node.SetTranslation(shape_bounds.width() * 0.5f + shape_bounds.left(), - shape_bounds.height() * 0.5f + shape_bounds.top(), - 0.f); + shape_node.SetTranslationRH(shape_bounds.width() * 0.5f + shape_bounds.left(), + shape_bounds.height() * 0.5f + shape_bounds.top(), + 0.f); // TODO(SCN-1274): AddPart() and SetClip() will be deleted. entity_node->AddPart(shape_node); @@ -141,9 +141,9 @@ void SceneUpdateContext::CreateFrame( inner_bounds.height()); scenic::ShapeNode inner_node(session_); inner_node.SetShape(inner_shape); - inner_node.SetTranslation(inner_bounds.width() * 0.5f + inner_bounds.left(), - inner_bounds.height() * 0.5f + inner_bounds.top(), - 0.f); + inner_node.SetTranslationRH( + inner_bounds.width() * 0.5f + inner_bounds.left(), + inner_bounds.height() * 0.5f + inner_bounds.top(), 0.f); entity_node->AddPart(inner_node); SetShapeTextureOrColor(inner_node, color, scale_x, scale_y, inner_bounds, std::move(paint_layers), layer, @@ -282,9 +282,9 @@ SceneUpdateContext::Clip::Clip(SceneUpdateContext& context, : Entity(context) { scenic::ShapeNode shape_node(context.session()); shape_node.SetShape(shape); - shape_node.SetTranslation(shape_bounds.width() * 0.5f + shape_bounds.left(), - shape_bounds.height() * 0.5f + shape_bounds.top(), - 0.f); + shape_node.SetTranslationRH(shape_bounds.width() * 0.5f + shape_bounds.left(), + shape_bounds.height() * 0.5f + shape_bounds.top(), + 0.f); // TODO(SCN-1274): AddPart() and SetClip() will be deleted. entity_node().AddPart(shape_node); @@ -305,9 +305,9 @@ SceneUpdateContext::Transform::Transform(SceneUpdateContext& context, // are not handled correctly. MatrixDecomposition decomposition(transform); if (decomposition.IsValid()) { - entity_node().SetTranslation(decomposition.translation().x(), // - decomposition.translation().y(), // - decomposition.translation().z() // + entity_node().SetTranslationRH(decomposition.translation().x(), // + decomposition.translation().y(), // + decomposition.translation().z() // ); entity_node().SetScale(decomposition.scale().x(), // @@ -356,7 +356,7 @@ SceneUpdateContext::Frame::Frame(SceneUpdateContext& context, paint_bounds_(SkRect::MakeEmpty()), layer_(layer) { if (elevation != 0.0) - entity_node().SetTranslation(0.f, 0.f, elevation); + entity_node().SetTranslationRH(0.f, 0.f, -elevation); } SceneUpdateContext::Frame::~Frame() { From 04728cb0595771036c89b0e818ab450006039139 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 15 Feb 2019 19:20:12 -0500 Subject: [PATCH 0188/1117] Roll src/third_party/skia be9aff25bddc..b7c7b7883b23 (17 commits) (#7852) https://skia.googlesource.com/skia.git/%2Blog/be9aff25bddc..b7c7b7883b23 git log be9aff25bddc3eecf84d9c37af222ea40c261cb1..b7c7b7883b2377e55e5def16560b1429958e0ec3 --date=short --no-merges --format=%ad %ae %s 2019-02-15 herb@google.com Remove all empty glyph processing 2019-02-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 0eba65b14b60..a0a80b160c6b (1 commits) 2019-02-15 robertphillips@google.com Revert "Make asFragmentProcessor entry point only take a GrRecordingContext" 2019-02-15 reed@google.com make float more primary API for paint (esp. for alpha) 2019-02-15 halcanary@google.com tools/skqp/release.sh: Add Instant and ABI XML tags 2019-02-15 robertphillips@google.com Make asFragmentProcessor entry point only take a GrRecordingContext 2019-02-15 robertphillips@google.com Switch GrSurfaceProxy's Copy methods over to GrRecordingContext 2019-02-15 robertphillips@google.com Begin switching GrRecordingContext over to having the GrDrawingManager 2019-02-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 2bb0864b22e7..0eba65b14b60 (21 commits) 2019-02-15 robertphillips@google.com Add addOnFlushCallbackObject at GrRecordingContext level 2019-02-15 brianosman@google.com Moved image params out to SkParticleDrawable 2019-02-15 scroggo@google.com Remove assert that BGRA and RGBA are not opaque 2019-02-15 herb@google.com Revert of CL/192440 which would not reland cleanly. 2019-02-15 fmalita@chromium.org add mixer colorfilter 2019-02-13 csmartdalton@google.com Remove shader caps argument from GrGLSLTypeString 2019-02-15 robertphillips@google.com Stop using resourceProvider in GrRenderTargetContext's ctor 2019-02-15 halcanary@google.com ICU: enable on wasm The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 0e447b111a832..de71f66201b38 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': 'be9aff25bddc3eecf84d9c37af222ea40c261cb1', + 'skia_revision': 'b7c7b7883b2377e55e5def16560b1429958e0ec3', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index fdc607c115497..71cf4903f6fc8 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: a5fd73a8d92635818c8fb0f596b19547 +Signature: ed2d1aa421644a29414ee77b0a91d235 UNUSED LICENSES: @@ -4329,6 +4329,7 @@ FILE: ../../../third_party/skia/modules/sksg/src/SkSGTrimEffect.cpp FILE: ../../../third_party/skia/samplecode/SampleCCPRGeometry.cpp FILE: ../../../third_party/skia/samplecode/SampleChineseFling.cpp FILE: ../../../third_party/skia/samplecode/SampleCowboy.cpp +FILE: ../../../third_party/skia/samplecode/SampleMixer.cpp FILE: ../../../third_party/skia/samplecode/SamplePathText.cpp FILE: ../../../third_party/skia/samplecode/SampleShadowColor.cpp FILE: ../../../third_party/skia/samplecode/SampleShadowReference.cpp @@ -4686,12 +4687,14 @@ FILE: ../../../third_party/skia/experimental/canvaskit/skottie_bindings.cpp FILE: ../../../third_party/skia/modules/particles/include/SkCurve.h FILE: ../../../third_party/skia/modules/particles/include/SkParticleAffector.h FILE: ../../../third_party/skia/modules/particles/include/SkParticleData.h +FILE: ../../../third_party/skia/modules/particles/include/SkParticleDrawable.h FILE: ../../../third_party/skia/modules/particles/include/SkParticleEffect.h FILE: ../../../third_party/skia/modules/particles/include/SkParticleEmitter.h FILE: ../../../third_party/skia/modules/particles/include/SkParticleSerialization.h FILE: ../../../third_party/skia/modules/particles/include/SkReflected.h FILE: ../../../third_party/skia/modules/particles/src/SkCurve.cpp FILE: ../../../third_party/skia/modules/particles/src/SkParticleAffector.cpp +FILE: ../../../third_party/skia/modules/particles/src/SkParticleDrawable.cpp FILE: ../../../third_party/skia/modules/particles/src/SkParticleEffect.cpp FILE: ../../../third_party/skia/modules/particles/src/SkParticleEmitter.cpp FILE: ../../../third_party/skia/modules/particles/src/SkReflected.cpp From 514168028729f6fe649f846fe60bf4e9c77f23c7 Mon Sep 17 00:00:00 2001 From: Stanislav Baranov Date: Fri, 15 Feb 2019 17:07:06 -0800 Subject: [PATCH 0189/1117] Revert "Support for binary decompression of dynamic patches. (#7777)" (#7853) This reverts commit d48de7a3ec97ebf7ffe543aa74993efa51064789. --- ci/licenses.sh | 2 +- ci/licenses_golden/licenses_flutter | 36 +------- shell/platform/android/BUILD.gn | 1 - .../android/io/flutter/util/BSDiff.java | 92 ------------------- .../io/flutter/view/ResourceExtractor.java | 65 +++++-------- 5 files changed, 27 insertions(+), 169 deletions(-) delete mode 100644 shell/platform/android/io/flutter/util/BSDiff.java diff --git a/ci/licenses.sh b/ci/licenses.sh index 40bb4b9eb559a..a8452f36edcc5 100755 --- a/ci/licenses.sh +++ b/ci/licenses.sh @@ -42,7 +42,7 @@ fi echo "Checking license count in licenses_flutter..." actualLicenseCount=`tail -n 1 flutter/ci/licenses_golden/licenses_flutter | tr -dc '0-9'` -expectedLicenseCount=3 # When changing this number: Update the error message below as well describing all expected license types. +expectedLicenseCount=2 # When changing this number: Update the error message below as well describing all expected license types. if [ "$actualLicenseCount" -ne "$expectedLicenseCount" ] then diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index ada715328d999..3860a973fe467 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -695,40 +695,6 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== -==================================================================================================== -LIBRARY: engine -ORIGIN: ../../../flutter/shell/platform/android/io/flutter/util/BSDiff.java + ../../../flutter/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../flutter/shell/platform/android/io/flutter/util/BSDiff.java ----------------------------------------------------------------------------------------------------- -Copyright 2003-2005 Colin Percival. 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 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: txt ORIGIN: ../../../flutter/third_party/txt/LICENSE @@ -1015,4 +981,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: 3 +Total license count: 2 diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index 37002cf5fd4eb..b6560fca38737 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -149,7 +149,6 @@ java_library("flutter_shell_java") { "io/flutter/plugin/platform/PlatformViewsController.java", "io/flutter/plugin/platform/SingleViewPresentation.java", "io/flutter/plugin/platform/VirtualDisplayController.java", - "io/flutter/util/BSDiff.java", "io/flutter/util/PathUtils.java", "io/flutter/util/Preconditions.java", "io/flutter/util/Predicate.java", diff --git a/shell/platform/android/io/flutter/util/BSDiff.java b/shell/platform/android/io/flutter/util/BSDiff.java deleted file mode 100644 index 3b0295dc68b26..0000000000000 --- a/shell/platform/android/io/flutter/util/BSDiff.java +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2003-2005 Colin Percival. All rights reserved. -// Copyright 2013 The Flutter 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.util; - -import java.io.*; -import java.util.zip.GZIPInputStream; - -/** - * This is a Java port of algorithm from Flutter framework bsdiff.dart. - * Note that this port uses 32-bit ints, which limits data size to 2GB. - **/ -public abstract class BSDiff { - public static byte[] bspatch(byte[] olddata, byte[] diffdata) throws IOException { - InputStream in = new ByteArrayInputStream(diffdata, 0, diffdata.length); - DataInputStream header = new DataInputStream(in); - - byte[] magic = new byte[8]; - header.read(magic); - if (!new String(magic).equals("BZDIFF40")) { - throw new IOException("Invalid magic"); - } - - int ctrllen = (int) header.readLong(); - int datalen = (int) header.readLong(); - int newsize = (int) header.readLong(); - header.close(); - - in = new ByteArrayInputStream(diffdata, 0, diffdata.length); - in.skip(32); - DataInputStream cpf = new DataInputStream(new GZIPInputStream(in)); - - in = new ByteArrayInputStream(diffdata, 0, diffdata.length); - in.skip(32 + ctrllen); - InputStream dpf = new GZIPInputStream(in); - - in = new ByteArrayInputStream(diffdata, 0, diffdata.length); - in.skip(32 + ctrllen + datalen); - InputStream epf = new GZIPInputStream(in); - - byte[] newdata = new byte[newsize]; - - int oldpos = 0; - int newpos = 0; - - while (newpos < newsize) { - int[] ctrl = new int[3]; - for (int i = 0; i <= 2; i++) { - ctrl[i] = (int) cpf.readLong(); - } - if (newpos + ctrl[0] > newsize) { - throw new IOException("Invalid ctrl[0]"); - } - - read(dpf, newdata, newpos, ctrl[0]); - - for (int i = 0; i < ctrl[0]; i++) { - if ((oldpos + i >= 0) && (oldpos + i < olddata.length)) { - newdata[newpos + i] += olddata[oldpos + i]; - } - } - - newpos += ctrl[0]; - oldpos += ctrl[0]; - - if (newpos + ctrl[1] > newsize) { - throw new IOException("Invalid ctrl[0]"); - } - - read(epf, newdata, newpos, ctrl[1]); - - newpos += ctrl[1]; - oldpos += ctrl[2]; - } - - cpf.close(); - dpf.close(); - epf.close(); - - return newdata; - } - - private static void read(InputStream in, byte[] buf, int off, int len) throws IOException { - for (int i, n = 0; n < len; n += i) { - if ((i = in.read(buf, off + n, len - n)) < 0) { - throw new IOException("Unexpected EOF"); - } - } - } -} diff --git a/shell/platform/android/io/flutter/view/ResourceExtractor.java b/shell/platform/android/io/flutter/view/ResourceExtractor.java index b44bace5f0a4e..a0e2f0965ad4d 100644 --- a/shell/platform/android/io/flutter/view/ResourceExtractor.java +++ b/shell/platform/android/io/flutter/view/ResourceExtractor.java @@ -11,7 +11,6 @@ import android.os.AsyncTask; import android.os.Build; import android.util.Log; -import io.flutter.util.BSDiff; import io.flutter.util.PathUtils; import org.json.JSONObject; @@ -20,7 +19,6 @@ import java.util.HashSet; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; -import java.util.zip.GZIPInputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -31,6 +29,8 @@ class ResourceExtractor { private static final String TAG = "ResourceExtractor"; private static final String TIMESTAMP_PREFIX = "res_timestamp-"; + private static final int BUFFER_SIZE = 16 * 1024; + @SuppressWarnings("deprecation") static long getVersionCode(PackageInfo packageInfo) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { @@ -177,6 +177,7 @@ private void deleteFiles() { private boolean extractAPK(File dataDir) { final AssetManager manager = mContext.getResources().getAssets(); + byte[] buffer = null; for (String asset : mResources) { try { final File output = new File(dataDir, asset); @@ -189,10 +190,18 @@ private boolean extractAPK(File dataDir) { try (InputStream is = manager.open(asset); OutputStream os = new FileOutputStream(output)) { - copy(is, os); - } + if (buffer == null) { + buffer = new byte[BUFFER_SIZE]; + } - Log.i(TAG, "Extracted baseline resource " + asset); + int count = 0; + while ((count = is.read(buffer, 0, BUFFER_SIZE)) != -1) { + os.write(buffer, 0, count); + } + + os.flush(); + Log.i(TAG, "Extracted baseline resource " + asset); + } } catch (FileNotFoundException fnfe) { continue; @@ -210,8 +219,6 @@ private boolean extractAPK(File dataDir) { /// Returns true if successfully unpacked update resources or if there is no update, /// otherwise deletes all resources and returns false. private boolean extractUpdate(File dataDir) { - final AssetManager manager = mContext.getResources().getAssets(); - ResourceUpdater resourceUpdater = FlutterMain.getResourceUpdater(); if (resourceUpdater == null) { return true; @@ -238,15 +245,11 @@ private boolean extractUpdate(File dataDir) { return false; } + byte[] buffer = null; for (String asset : mResources) { - boolean useDiff = false; ZipEntry entry = zipFile.getEntry(asset); if (entry == null) { - useDiff = true; - entry = zipFile.getEntry(asset + ".bzdiff40"); - if (entry == null) { - continue; - } + continue; } final File output = new File(dataDir, asset); @@ -257,29 +260,18 @@ private boolean extractUpdate(File dataDir) { output.getParentFile().mkdirs(); } - try { - if (useDiff) { - ByteArrayOutputStream diff = new ByteArrayOutputStream(); - try (InputStream is = zipFile.getInputStream(entry)) { - copy(is, diff); - } - - ByteArrayOutputStream orig = new ByteArrayOutputStream(); - try (InputStream is = manager.open(asset)) { - copy(is, orig); - } - - try (OutputStream os = new FileOutputStream(output)) { - os.write(BSDiff.bspatch(orig.toByteArray(), diff.toByteArray())); - } + try (InputStream is = zipFile.getInputStream(entry); + OutputStream os = new FileOutputStream(output)) { + if (buffer == null) { + buffer = new byte[BUFFER_SIZE]; + } - } else { - try (InputStream is = zipFile.getInputStream(entry); - OutputStream os = new FileOutputStream(output)) { - copy(is, os); - } + int count = 0; + while ((count = is.read(buffer, 0, BUFFER_SIZE)) != -1) { + os.write(buffer, 0, count); } + os.flush(); Log.i(TAG, "Extracted override resource " + asset); } catch (FileNotFoundException fnfe) { @@ -347,11 +339,4 @@ private String checkTimestamp(File dataDir) { return null; } - - private static void copy(InputStream in, OutputStream out) throws IOException { - byte[] buf = new byte[16 * 1024]; - for (int i; (i = in.read(buf)) >= 0; ) { - out.write(buf, 0, i); - } - } } From 465bbec15fad100dd7a877bd7963a9a71efb4b68 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 16 Feb 2019 09:56:08 -0500 Subject: [PATCH 0190/1117] Roll src/third_party/skia b7c7b7883b23..e876ec79ceff (5 commits) (#7855) https://skia.googlesource.com/skia.git/%2Blog/b7c7b7883b23..e876ec79ceff git log b7c7b7883b2377e55e5def16560b1429958e0ec3..e876ec79ceff47b3ebf669b6d65686517ee3585d --date=short --no-merges --format=%ad %ae %s 2019-02-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader a0a80b160c6b..6d74ab852bf2 (1 commits) 2019-02-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 aead8edf8c46..b6c1c66d2547 (3 commits) 2019-02-15 robertphillips@google.com Make asFragmentProcessor entry point only take a GrRecordingContext (take 2) 2019-02-16 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-02-15 reed@google.com update docs for paint The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- sky/packages/sky_engine/LICENSE | 29 ----------------------------- 3 files changed, 2 insertions(+), 31 deletions(-) diff --git a/DEPS b/DEPS index de71f66201b38..97ebd22506d9d 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': 'b7c7b7883b2377e55e5def16560b1429958e0ec3', + 'skia_revision': 'e876ec79ceff47b3ebf669b6d65686517ee3585d', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 71cf4903f6fc8..6c1385515aac8 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ed2d1aa421644a29414ee77b0a91d235 +Signature: 69f9f8464ce83e77b7e9c259c3efcff8 UNUSED LICENSES: diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index 7105cca3faac3..edab381ceabd6 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -3493,35 +3493,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- engine - -Copyright 2003-2005 Colin Percival. 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 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 txt Copyright 2013 The Flutter Authors. All rights reserved. From 6941c11aae4b7cf60bd8281f0c34b71e7385a4dd Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 16 Feb 2019 13:42:25 -0500 Subject: [PATCH 0191/1117] Roll src/third_party/skia e876ec79ceff..0b496ff92fce (1 commits) (#7856) https://skia.googlesource.com/skia.git/%2Blog/e876ec79ceff..0b496ff92fce git log e876ec79ceff47b3ebf669b6d65686517ee3585d..0b496ff92fce253b21ed9e72ab796de0ba50526b --date=short --no-merges --format=%ad %ae %s 2019-02-16 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 5862f084f69f..eda06a0b859a (305 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 97ebd22506d9d..46a47b245f178 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': 'e876ec79ceff47b3ebf669b6d65686517ee3585d', + 'skia_revision': '0b496ff92fce253b21ed9e72ab796de0ba50526b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6c1385515aac8..f5e2a34f83e15 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 69f9f8464ce83e77b7e9c259c3efcff8 +Signature: 762d2906533f62ab9c466f588a8764c0 UNUSED LICENSES: From abf8bee9ac20ae7fe45acaf0e59a1c46c7898506 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 16 Feb 2019 17:41:04 -0500 Subject: [PATCH 0192/1117] Roll src/third_party/skia 0b496ff92fce..6cd82342937a (1 commits) (#7857) https://skia.googlesource.com/skia.git/%2Blog/0b496ff92fce..6cd82342937a git log 0b496ff92fce253b21ed9e72ab796de0ba50526b..6cd82342937a2835129fea44b6f62b0d23dc2d35 --date=short --no-merges --format=%ad %ae %s 2019-02-16 fmalita@chromium.org Simplify optional input handling in SkMixerColorFilter The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stephana@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 46a47b245f178..e0c67796420a4 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': '0b496ff92fce253b21ed9e72ab796de0ba50526b', + 'skia_revision': '6cd82342937a2835129fea44b6f62b0d23dc2d35', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index f5e2a34f83e15..991d49346908d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 762d2906533f62ab9c466f588a8764c0 +Signature: a0668a31e154ad409e5f8687d0601046 UNUSED LICENSES: From 2f36805fabecadfc3b3144b88e5b2d9db7527d30 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 16 Feb 2019 21:49:03 -0500 Subject: [PATCH 0193/1117] Roll src/third_party/skia 6cd82342937a..eda2a8112596 (1 commits) (#7858) https://skia.googlesource.com/skia.git/%2Blog/6cd82342937a..eda2a8112596 git log 6cd82342937a2835129fea44b6f62b0d23dc2d35..eda2a8112596dff766b24abdcedf981e5a69015d --date=short --no-merges --format=%ad %ae %s 2019-02-16 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 b6c1c66d2547..028df5f51e45 (4 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index e0c67796420a4..3708cc0b4309b 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': '6cd82342937a2835129fea44b6f62b0d23dc2d35', + 'skia_revision': 'eda2a8112596dff766b24abdcedf981e5a69015d', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 991d49346908d..fff8aa4e57e08 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: a0668a31e154ad409e5f8687d0601046 +Signature: 072f2861c543070d55d06c357a882319 UNUSED LICENSES: From 688f1db44f34f79065276729398fa49203127fe4 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 17 Feb 2019 02:19:05 -0500 Subject: [PATCH 0194/1117] Roll src/third_party/skia eda2a8112596..21950b9e9236 (1 commits) (#7859) https://skia.googlesource.com/skia.git/%2Blog/eda2a8112596..21950b9e9236 git log eda2a8112596dff766b24abdcedf981e5a69015d..21950b9e92367948439000448e62079ccd5e84f1 --date=short --no-merges --format=%ad %ae %s 2019-02-17 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 3708cc0b4309b..df2a4e00243eb 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': 'eda2a8112596dff766b24abdcedf981e5a69015d', + 'skia_revision': '21950b9e92367948439000448e62079ccd5e84f1', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index fff8aa4e57e08..4bb85c4fc4466 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 072f2861c543070d55d06c357a882319 +Signature: 755d3d0ade4e2b193839f37af2fe20d2 UNUSED LICENSES: From 745e1cacc731a75f41d697c7f9cd7dec62d9702e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 17 Feb 2019 06:19:25 -0500 Subject: [PATCH 0195/1117] Roll src/third_party/skia 21950b9e9236..880b6ea52bf0 (1 commits) (#7860) https://skia.googlesource.com/skia.git/%2Blog/21950b9e9236..880b6ea52bf0 git log 21950b9e92367948439000448e62079ccd5e84f1..880b6ea52bf00ea9621ee90e6b48f7fbc453fe8d --date=short --no-merges --format=%ad %ae %s 2019-02-17 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update SKP version The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index df2a4e00243eb..dff3db7901fba 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': '21950b9e92367948439000448e62079ccd5e84f1', + 'skia_revision': '880b6ea52bf00ea9621ee90e6b48f7fbc453fe8d', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 4bb85c4fc4466..c75b8b2129da9 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 755d3d0ade4e2b193839f37af2fe20d2 +Signature: fdad52cc7a1181ea7c03fa13bccd2cd1 UNUSED LICENSES: From 2349c3bc64d6b62db6b4a39bf1346d8bce015229 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 17 Feb 2019 10:24:34 -0500 Subject: [PATCH 0196/1117] Roll src/third_party/skia 880b6ea52bf0..346ce63daa51 (1 commits) (#7861) https://skia.googlesource.com/skia.git/%2Blog/880b6ea52bf0..346ce63daa51 git log 880b6ea52bf00ea9621ee90e6b48f7fbc453fe8d..346ce63daa511ffc7fd728aa0698097274b91462 --date=short --no-merges --format=%ad %ae %s 2019-02-16 fmalita@chromium.org Add a SkMixerColorFilter GM The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index dff3db7901fba..e2f72b78a57fd 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': '880b6ea52bf00ea9621ee90e6b48f7fbc453fe8d', + 'skia_revision': '346ce63daa511ffc7fd728aa0698097274b91462', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index c75b8b2129da9..8a8597c78cf42 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: fdad52cc7a1181ea7c03fa13bccd2cd1 +Signature: 94017eaa2abe4dcf08db41c433b0850e UNUSED LICENSES: @@ -4930,8 +4930,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== LIBRARY: skia -ORIGIN: ../../../third_party/skia/gm/skbug_8664.cpp + ../../../third_party/skia/LICENSE +ORIGIN: ../../../third_party/skia/gm/mixercolorfilter.cpp + ../../../third_party/skia/LICENSE TYPE: LicenseType.bsd +FILE: ../../../third_party/skia/gm/mixercolorfilter.cpp FILE: ../../../third_party/skia/gm/skbug_8664.cpp FILE: ../../../third_party/skia/include/gpu/GrContextThreadSafeProxy.h FILE: ../../../third_party/skia/include/private/GrContext_Base.h From 686e9fbf09c4169b21d47eea4af9580f4dafda60 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 17 Feb 2019 14:51:12 -0500 Subject: [PATCH 0197/1117] Roll src/third_party/skia 346ce63daa51..f2cf73c8cd46 (1 commits) (#7864) https://skia.googlesource.com/skia.git/%2Blog/346ce63daa51..f2cf73c8cd46 git log 346ce63daa511ffc7fd728aa0698097274b91462..f2cf73c8cd46891dd21ce028c54312148a32775e --date=short --no-merges --format=%ad %ae %s 2019-02-17 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src eda06a0b859a..6d56209983a0 (38 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index e2f72b78a57fd..be4597d3cff6b 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': '346ce63daa511ffc7fd728aa0698097274b91462', + 'skia_revision': 'f2cf73c8cd46891dd21ce028c54312148a32775e', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 8a8597c78cf42..3cfce643e671e 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 94017eaa2abe4dcf08db41c433b0850e +Signature: 8f886aca23b111e8f055d7c1bbc2f484 UNUSED LICENSES: From 62d05c27ada27d8c90a5663a8f994c5334c461a8 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 17 Feb 2019 18:38:09 -0500 Subject: [PATCH 0198/1117] Roll src/third_party/skia f2cf73c8cd46..5ba2a8a5b24f (2 commits) (#7865) https://skia.googlesource.com/skia.git/%2Blog/f2cf73c8cd46..5ba2a8a5b24f git log f2cf73c8cd46891dd21ce028c54312148a32775e..5ba2a8a5b24f6ad0e2f05b2c80e25b31b842d0e7 --date=short --no-merges --format=%ad %ae %s 2019-02-17 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-16 iannucci@chromium.org [recipes] Manual roll. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index be4597d3cff6b..36821ad377760 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': 'f2cf73c8cd46891dd21ce028c54312148a32775e', + 'skia_revision': '5ba2a8a5b24f6ad0e2f05b2c80e25b31b842d0e7', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3cfce643e671e..dc9c3b42f9f99 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8f886aca23b111e8f055d7c1bbc2f484 +Signature: 5c9abd3efd523781e68f06646bd8a65e UNUSED LICENSES: From 3a1b9b3d85cc5521b8da85a019cb260e27c6576b Mon Sep 17 00:00:00 2001 From: sjindel-google Date: Mon, 18 Feb 2019 14:23:17 +0100 Subject: [PATCH 0199/1117] Remove unnecessary entry-point closurization. (#7827) --- lib/stub_ui/natives.dart | 2 +- lib/ui/hooks.dart | 24 ++++++++++++------------ lib/ui/natives.dart | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/stub_ui/natives.dart b/lib/stub_ui/natives.dart index d8388a8640e5f..b4325ff356a9c 100644 --- a/lib/stub_ui/natives.dart +++ b/lib/stub_ui/natives.dart @@ -20,7 +20,7 @@ Future _scheduleFrame( })); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') void _setupHooks() { // ignore: unused_element assert(() { // In debug mode, register the schedule frame extension. diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index b1550bf90b1ee..7386663ee5402 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -16,7 +16,7 @@ dynamic _decodeJSON(String message) { return message != null ? json.decode(message) : null; } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _updateWindowMetrics(double devicePixelRatio, double width, @@ -54,11 +54,11 @@ String _localeClosure() { return window.locale.toString(); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element _LocaleClosure _getLocaleClosure() => _localeClosure; -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _updateLocales(List locales) { const int stringsPerLocale = 4; @@ -77,7 +77,7 @@ void _updateLocales(List locales) { _invoke(window.onLocaleChanged, window._onLocaleChangedZone); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _updateUserSettingsData(String jsonData) { final Map data = json.decode(jsonData); @@ -103,14 +103,14 @@ void _updatePlatformBrightness(String brightnessName) { _invoke(window.onPlatformBrightnessChanged, window._onPlatformBrightnessChangedZone); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _updateSemanticsEnabled(bool enabled) { window._semanticsEnabled = enabled; _invoke(window.onSemanticsEnabledChanged, window._onSemanticsEnabledChangedZone); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _updateAccessibilityFeatures(int values) { final AccessibilityFeatures newFeatures = new AccessibilityFeatures._(values); @@ -120,7 +120,7 @@ void _updateAccessibilityFeatures(int values) { _invoke(window.onAccessibilityFeaturesChanged, window._onAccessibilityFlagsChangedZone); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') void _dispatchPlatformMessage(String name, ByteData data, int responseId) { if (window.onPlatformMessage != null) { _invoke3( @@ -137,14 +137,14 @@ void _dispatchPlatformMessage(String name, ByteData data, int responseId) { } } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _dispatchPointerDataPacket(ByteData packet) { if (window.onPointerDataPacket != null) _invoke1(window.onPointerDataPacket, window._onPointerDataPacketZone, _unpackPointerDataPacket(packet)); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _dispatchSemanticsAction(int id, int action, ByteData args) { _invoke3( @@ -156,13 +156,13 @@ void _dispatchSemanticsAction(int id, int action, ByteData args) { ); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _beginFrame(int microseconds) { _invoke1(window.onBeginFrame, window._onBeginFrameZone, new Duration(microseconds: microseconds)); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _drawFrame() { _invoke(window.onDrawFrame, window._onDrawFrameZone); @@ -173,7 +173,7 @@ typedef _UnaryFunction(Null args); // ignore: always_declare_return_types, prefer_generic_function_type_aliases typedef _BinaryFunction(Null args, Null message); -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _runMainZoned(Function startMainIsolateFunction, Function userMainFunction) { startMainIsolateFunction((){ diff --git a/lib/ui/natives.dart b/lib/ui/natives.dart index 1e9a0798f96f6..ed83b92e4fdc9 100644 --- a/lib/ui/natives.dart +++ b/lib/ui/natives.dart @@ -29,7 +29,7 @@ Future _scheduleFrame( })); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') void _setupHooks() { // ignore: unused_element assert(() { // In debug mode, register the schedule frame extension. @@ -71,7 +71,7 @@ Function _getCallbackFromHandle(int handle) native 'GetCallbackFromHandle'; // Required for gen_snapshot to work correctly. int _isolateId; // ignore: unused_element -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') Function _getPrintClosure() => _print; // ignore: unused_element -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') Function _getScheduleMicrotaskClosure() => _scheduleMicrotask; // ignore: unused_element From f55e931255189b7efc094b1ce77c881d8c184d3e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 18 Feb 2019 10:53:33 -0500 Subject: [PATCH 0200/1117] Roll src/third_party/skia 5ba2a8a5b24f..068f3418a2db (1 commits) (#7866) https://skia.googlesource.com/skia.git/%2Blog/5ba2a8a5b24f..068f3418a2db git log 5ba2a8a5b24f6ad0e2f05b2c80e25b31b842d0e7..068f3418a2db3d6b3bb92d28e8f6d482d5d820cd --date=short --no-merges --format=%ad %ae %s 2019-02-18 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 36821ad377760..dd54a8552f2dd 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': '5ba2a8a5b24f6ad0e2f05b2c80e25b31b842d0e7', + 'skia_revision': '068f3418a2db3d6b3bb92d28e8f6d482d5d820cd', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index dc9c3b42f9f99..6c64661b12b42 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 5c9abd3efd523781e68f06646bd8a65e +Signature: 8ba5d04d22d7ee7ec10b19fa953da72a UNUSED LICENSES: From 27cea51f2fecf6450c700e45d707e6db66710848 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 18 Feb 2019 14:49:31 -0500 Subject: [PATCH 0201/1117] Roll src/third_party/skia 068f3418a2db..2ccdd2bc1d01 (2 commits) (#7867) https://skia.googlesource.com/skia.git/%2Blog/068f3418a2db..2ccdd2bc1d01 git log 068f3418a2db3d6b3bb92d28e8f6d482d5d820cd..2ccdd2bc1d01566210bcba5fbac2a4bf31f15845 --date=short --no-merges --format=%ad %ae %s 2019-02-15 halcanary@google.com SkQP: android.support.test -> androidx.test 2019-02-18 halcanary@google.com DEPS: follow on to Bug: skia:8772 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index dd54a8552f2dd..f76d722aea48c 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': '068f3418a2db3d6b3bb92d28e8f6d482d5d820cd', + 'skia_revision': '2ccdd2bc1d01566210bcba5fbac2a4bf31f15845', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6c64661b12b42..b189dad8310ac 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8ba5d04d22d7ee7ec10b19fa953da72a +Signature: b61e30b036eb8bad2b3dcc6913ff6549 UNUSED LICENSES: From 16398d88ef9b9ea628f45dfd6438505b37895594 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 18 Feb 2019 19:51:17 -0500 Subject: [PATCH 0202/1117] Roll src/third_party/skia 2ccdd2bc1d01..d6c69d21635e (2 commits) (#7868) https://skia.googlesource.com/skia.git/%2Blog/2ccdd2bc1d01..d6c69d21635e git log 2ccdd2bc1d01566210bcba5fbac2a4bf31f15845..d6c69d21635e08acaaec167d77773e2557f8969a --date=short --no-merges --format=%ad %ae %s 2019-02-18 reed@google.com Experiment: always use doubles for setLength 2019-02-18 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 6d56209983a0..ee506c5149cb (152 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f76d722aea48c..67e29cd7d2032 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': '2ccdd2bc1d01566210bcba5fbac2a4bf31f15845', + 'skia_revision': 'd6c69d21635e08acaaec167d77773e2557f8969a', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b189dad8310ac..cf03983b4a589 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b61e30b036eb8bad2b3dcc6913ff6549 +Signature: 3a7446fe43e3d3b5c42ce6a573bd0d6d UNUSED LICENSES: From 0581a3104b56895c7dceeb99026cb9b5b3d4393e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 18 Feb 2019 23:48:47 -0500 Subject: [PATCH 0203/1117] Roll src/third_party/skia d6c69d21635e..2afee77b48ab (1 commits) (#7869) https://skia.googlesource.com/skia.git/%2Blog/d6c69d21635e..2afee77b48ab git log d6c69d21635e08acaaec167d77773e2557f8969a..2afee77b48ab0cf942f4211599643897c3d08f87 --date=short --no-merges --format=%ad %ae %s 2019-02-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 028df5f51e45..6a492c277e9f (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 67e29cd7d2032..1ae80c711877e 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': 'd6c69d21635e08acaaec167d77773e2557f8969a', + 'skia_revision': '2afee77b48ab0cf942f4211599643897c3d08f87', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index cf03983b4a589..7d723bb2df3b1 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 3a7446fe43e3d3b5c42ce6a573bd0d6d +Signature: 0adbca84d6b0813c2a9b79de64468079 UNUSED LICENSES: From 486d76bc87ea92f33feb8c41a048ec46ffaead2d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 19 Feb 2019 03:40:05 -0500 Subject: [PATCH 0204/1117] Roll src/third_party/skia 2afee77b48ab..ef2489f8b0bb (1 commits) (#7870) https://skia.googlesource.com/skia.git/%2Blog/2afee77b48ab..ef2489f8b0bb git log 2afee77b48ab0cf942f4211599643897c3d08f87..ef2489f8b0bb1c831a239389e2686bc54a1890df --date=short --no-merges --format=%ad %ae %s 2019-02-19 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 1ae80c711877e..ca2add9be66bf 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': '2afee77b48ab0cf942f4211599643897c3d08f87', + 'skia_revision': 'ef2489f8b0bb1c831a239389e2686bc54a1890df', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 7d723bb2df3b1..25b3cb85bbbb3 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 0adbca84d6b0813c2a9b79de64468079 +Signature: e33605284245215afe913e483d47c69d UNUSED LICENSES: From b414767d79ed10c104dcf283579b48836509d86d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 19 Feb 2019 07:21:17 -0500 Subject: [PATCH 0205/1117] Roll src/third_party/skia ef2489f8b0bb..e27ee6c503cf (1 commits) (#7871) https://skia.googlesource.com/skia.git/%2Blog/ef2489f8b0bb..e27ee6c503cf git log ef2489f8b0bb1c831a239389e2686bc54a1890df..e27ee6c503cf94cae4987414047a1bd250703ecf --date=short --no-merges --format=%ad %ae %s 2019-02-15 bungeman@google.com Remove build work-around. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index ca2add9be66bf..112b010733e70 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': 'ef2489f8b0bb1c831a239389e2686bc54a1890df', + 'skia_revision': 'e27ee6c503cf94cae4987414047a1bd250703ecf', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the From ed73fc39cdafc2ce0980aa8ea6b7044e0c678b62 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Tue, 19 Feb 2019 07:06:57 -0800 Subject: [PATCH 0206/1117] Expose more pointer phases in embedder.h (#7813) Adds 'add', 'remove', and 'hover' to the set of pointer phases that are available to embedders. This is necessary for them to send hover events to the engine. --- shell/platform/embedder/embedder.cc | 7 +++++++ shell/platform/embedder/embedder.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 165610d8caf2f..d134847ed62f2 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -540,6 +540,7 @@ FlutterEngineResult FlutterEngineSendWindowMetricsEvent( : kInvalidArguments; } +// Returns the blink::PointerData::Change for the given FlutterPointerPhase. inline blink::PointerData::Change ToPointerDataChange( FlutterPointerPhase phase) { switch (phase) { @@ -551,6 +552,12 @@ inline blink::PointerData::Change ToPointerDataChange( return blink::PointerData::Change::kDown; case kMove: return blink::PointerData::Change::kMove; + case kAdd: + return blink::PointerData::Change::kAdd; + case kRemove: + return blink::PointerData::Change::kRemove; + case kHover: + return blink::PointerData::Change::kHover; } return blink::PointerData::Change::kCancel; } diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index d1a997aeca16e..010bfbe336bc2 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -148,6 +148,9 @@ typedef enum { kUp, kDown, kMove, + kAdd, + kRemove, + kHover, } FlutterPointerPhase; typedef struct { From 0fb68a9874d01242dceba61274747299d0cc1666 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 19 Feb 2019 11:34:03 -0500 Subject: [PATCH 0207/1117] Roll src/third_party/skia e27ee6c503cf..90791e27d8a2 (6 commits) (#7872) https://skia.googlesource.com/skia.git/%2Blog/e27ee6c503cf..90791e27d8a2 git log e27ee6c503cf94cae4987414047a1bd250703ecf..90791e27d8a286c50185e000bd9b32bb9a2f557d --date=short --no-merges --format=%ad %ae %s 2019-02-19 halcanary@google.com SkPaint: make bitfield defaults more explicit 2019-02-19 mtklein@google.com add gbr --config 2019-02-15 michaelludwig@google.com Add general quad factories to GrFillRectOp and GrTextureOp 2019-02-19 reed@google.com check math in stroker 2019-02-15 scroggo@google.com SkWuffsCodec: Initialize when incomplete part 3 2019-02-18 benjaminwagner@google.com [infra] Add back valgrind dimension for Valgrind tasks The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 75 ++++++++++++++++---------------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/DEPS b/DEPS index 112b010733e70..5f4877eae86e1 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': 'e27ee6c503cf94cae4987414047a1bd250703ecf', + 'skia_revision': '90791e27d8a286c50185e000bd9b32bb9a2f557d', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 25b3cb85bbbb3..91195b9e39a63 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: e33605284245215afe913e483d47c69d +Signature: 9465728d2ca676112a6b54e175d4d6b6 UNUSED LICENSES: @@ -4895,43 +4895,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== LIBRARY: skia -ORIGIN: ../../../third_party/skia/gm/crbug_918512.cpp + ../../../third_party/skia/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../third_party/skia/gm/crbug_918512.cpp ----------------------------------------------------------------------------------------------------- -Copyright 2019 Google LLC. - -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/gm/mixercolorfilter.cpp + ../../../third_party/skia/LICENSE +ORIGIN: ../../../third_party/skia/gm/compositor_quads.cpp + ../../../third_party/skia/LICENSE TYPE: LicenseType.bsd +FILE: ../../../third_party/skia/gm/compositor_quads.cpp FILE: ../../../third_party/skia/gm/mixercolorfilter.cpp FILE: ../../../third_party/skia/gm/skbug_8664.cpp FILE: ../../../third_party/skia/include/gpu/GrContextThreadSafeProxy.h @@ -4993,6 +4959,41 @@ 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/gm/crbug_918512.cpp + ../../../third_party/skia/LICENSE +TYPE: LicenseType.bsd +FILE: ../../../third_party/skia/gm/crbug_918512.cpp +---------------------------------------------------------------------------------------------------- +Copyright 2019 Google LLC. + +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/include/config/SkUserConfig.h + ../../../third_party/skia/LICENSE From 044ff18463d6872b152fe4a9f308d449f6ce2f6f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 19 Feb 2019 15:25:36 -0500 Subject: [PATCH 0208/1117] Roll src/third_party/skia 90791e27d8a2..ce62dec02293 (8 commits) (#7873) https://skia.googlesource.com/skia.git/%2Blog/90791e27d8a2..ce62dec02293 git log 90791e27d8a286c50185e000bd9b32bb9a2f557d..ce62dec02293670e2941be8bef87b8f3d5da6c35 --date=short --no-merges --format=%ad %ae %s 2019-02-19 michaelludwig@google.com Add general quad methods to GrRTC 2019-02-19 robertphillips@google.com Switch FP creation over to GrRecordingContext 2019-02-19 michaelludwig@google.com Formalize edge-aa interaction with GrAA 2019-02-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 6a492c277e9f..aca30f56ddc0 (1 commits) 2019-02-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 6d74ab852bf2..24021a2d7ea5 (1 commits) 2019-02-19 reed@google.com simplify even more the new setlength impl 2019-02-19 brianosman@google.com Remove SkField, it's no longer used 2019-02-15 bungeman@google.com Add asserts to SkTextBlobBuilderRunHandler. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 5f4877eae86e1..f9a0f6bb258cd 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': '90791e27d8a286c50185e000bd9b32bb9a2f557d', + 'skia_revision': 'ce62dec02293670e2941be8bef87b8f3d5da6c35', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 91195b9e39a63..dad4f06e8bf9d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 9465728d2ca676112a6b54e175d4d6b6 +Signature: a26275873f3c9ff43b88472a8529a9fd UNUSED LICENSES: From ed3123dff0bac1679e4da26217409cfea2955839 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Tue, 19 Feb 2019 14:46:42 -0800 Subject: [PATCH 0209/1117] Reland "Lower the threshold to raster cache pictures (#7687)" (#7862) This reverts commit 68d9ac44ec530a22beda85fcdf01871770a710d7. https://github.com/flutter/engine/pull/7759 has landed without any unexpected regressions. Hence we'll reland this as planned. --- flow/raster_cache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index fe42639fe7899..1927321a03238 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -87,7 +87,7 @@ static bool IsPictureWorthRasterizing(SkPicture* picture, // TODO(abarth): We should find a better heuristic here that lets us avoid // wasting memory on trivial layers that are easy to re-rasterize every frame. - return picture->approximateOpCount() > 10; + return picture->approximateOpCount() > 5; } static RasterCacheResult Rasterize( From f4fba6d7110338caf3878cf42e26e17744108d00 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Tue, 19 Feb 2019 15:51:13 -0800 Subject: [PATCH 0210/1117] Android embedding refactor pr3 add remaining systemchannels (#7874) --- ci/licenses_golden/licenses_flutter | 2 + shell/platform/android/BUILD.gn | 2 + .../systemchannels/AccessibilityChannel.java | 120 ++++ .../systemchannels/LocalizationChannel.java | 23 +- .../systemchannels/PlatformChannel.java | 597 +++++++++++++++++- .../systemchannels/TextInputChannel.java | 406 ++++++++++++ .../editing/InputConnectionAdaptor.java | 58 +- .../plugin/editing/TextInputPlugin.java | 181 +++--- .../plugin/platform/PlatformPlugin.java | 375 +++++------ .../io/flutter/view/AccessibilityBridge.java | 294 ++++----- .../android/io/flutter/view/FlutterView.java | 75 +-- 11 files changed, 1571 insertions(+), 562 deletions(-) create mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java create mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 3860a973fe467..fd2a6ae0ec841 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -450,6 +450,7 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/D 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/engine/systemchannels/AccessibilityChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/KeyEventChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/LifecycleChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java @@ -457,6 +458,7 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/system FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/SettingsChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/SystemChannel.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.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 diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index b6560fca38737..ea6ee243977d3 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -114,6 +114,7 @@ java_library("flutter_shell_java") { "io/flutter/embedding/engine/dart/PlatformMessageHandler.java", "io/flutter/embedding/engine/renderer/FlutterRenderer.java", "io/flutter/embedding/engine/renderer/OnFirstFrameRenderedListener.java", + "io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java", "io/flutter/embedding/engine/systemchannels/KeyEventChannel.java", "io/flutter/embedding/engine/systemchannels/LifecycleChannel.java", "io/flutter/embedding/engine/systemchannels/LocalizationChannel.java", @@ -121,6 +122,7 @@ java_library("flutter_shell_java") { "io/flutter/embedding/engine/systemchannels/PlatformChannel.java", "io/flutter/embedding/engine/systemchannels/SettingsChannel.java", "io/flutter/embedding/engine/systemchannels/SystemChannel.java", + "io/flutter/embedding/engine/systemchannels/TextInputChannel.java", "io/flutter/plugin/common/ActivityLifecycleListener.java", "io/flutter/plugin/common/BasicMessageChannel.java", "io/flutter/plugin/common/BinaryCodec.java", diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java new file mode 100644 index 0000000000000..4bfcd37973b58 --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java @@ -0,0 +1,120 @@ +package io.flutter.embedding.engine.systemchannels; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; + +import java.util.HashMap; + +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.plugin.common.BasicMessageChannel; +import io.flutter.plugin.common.StandardMessageCodec; + +/** + * System channel that sends accessibility requests and events from Flutter to Android. + *

+ * See {@link AccessibilityMessageHandler}, which lists all accessibility requests and + * events that might be sent from Flutter to the Android platform. + */ +public class AccessibilityChannel { + @NonNull + public BasicMessageChannel channel; + @Nullable + private AccessibilityMessageHandler handler; + + private final BasicMessageChannel.MessageHandler parsingMessageHandler = new BasicMessageChannel.MessageHandler() { + @Override + public void onMessage(Object message, BasicMessageChannel.Reply reply) { + // If there is no handler to respond to this message then we don't need to + // parse it. Return. + if (handler == null) { + return; + } + + @SuppressWarnings("unchecked") + final HashMap annotatedEvent = (HashMap) message; + final String type = (String) annotatedEvent.get("type"); + @SuppressWarnings("unchecked") + final HashMap data = (HashMap) annotatedEvent.get("data"); + + switch (type) { + case "announce": + String announceMessage = (String) data.get("message"); + if (announceMessage != null) { + handler.announce(announceMessage); + } + break; + case "tap": { + Integer nodeId = (Integer) annotatedEvent.get("nodeId"); + if (nodeId != null) { + handler.onTap(nodeId); + } + break; + } + case "longPress": { + Integer nodeId = (Integer) annotatedEvent.get("nodeId"); + if (nodeId != null) { + handler.onLongPress(nodeId); + } + break; + } + case "tooltip": { + String tooltipMessage = (String) data.get("message"); + if (tooltipMessage != null) { + handler.onTooltip(tooltipMessage); + } + break; + } + } + } + }; + + /** + * Constructs an {@code AccessibilityChannel} that connects Android to the Dart code + * running in {@code dartExecutor}. + * + * The given {@code dartExecutor} is permitted to be idle or executing code. + * + * See {@link DartExecutor}. + */ + public AccessibilityChannel(@NonNull DartExecutor dartExecutor) { + channel = new BasicMessageChannel<>(dartExecutor, "flutter/accessibility", StandardMessageCodec.INSTANCE); + channel.setMessageHandler(parsingMessageHandler); + } + + /** + * Sets the {@link AccessibilityMessageHandler} which receives all events and requests + * that are parsed from the underlying accessibility channel. + */ + public void setAccessibilityMessageHandler(@Nullable AccessibilityMessageHandler handler) { + this.handler = handler; + } + + /** + * Handler that receives accessibility messages sent from Flutter to Android + * through a given {@link AccessibilityChannel}. + * + * To register an {@code AccessibilityMessageHandler} with a {@link AccessibilityChannel}, + * see {@link AccessibilityChannel#setAccessibilityMessageHandler(AccessibilityMessageHandler)}. + */ + public interface AccessibilityMessageHandler { + /** + * The Dart application would like the given {@code message} to be announced. + */ + void announce(@NonNull String message); + + /** + * The user has tapped on the artifact with the given {@code nodeId}. + */ + void onTap(int nodeId); + + /** + * The user has long pressed on the artifact with the given {@code nodeId}. + */ + void onLongPress(int nodeId); + + /** + * The user has opened a popup window, menu, dialog, etc. + */ + void onTooltip(@NonNull String message); + } +} diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java index ffb8f1f84a155..52e4fbb46171d 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java @@ -6,14 +6,17 @@ import android.support.annotation.NonNull; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; +import java.util.Locale; import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.plugin.common.JSONMethodCodec; import io.flutter.plugin.common.MethodChannel; /** - * TODO(mattcarroll): fill in javadoc for LocalizationChannel. + * Sends the platform's locales to Dart. */ public class LocalizationChannel { @@ -24,12 +27,18 @@ public LocalizationChannel(@NonNull DartExecutor dartExecutor) { this.channel = new MethodChannel(dartExecutor, "flutter/localization", JSONMethodCodec.INSTANCE); } - public void setLocale(String language, String country) { - channel.invokeMethod("setLocale", Arrays.asList(language, country)); - } - - public void setMethodCallHandler(MethodChannel.MethodCallHandler handler) { - channel.setMethodCallHandler(handler); + /** + * Send the given {@code locales} to Dart. + */ + public void sendLocales(List locales) { + List data = new ArrayList<>(); + for (Locale locale : locales) { + data.add(locale.getLanguage()); + data.add(locale.getCountry()); + data.add(locale.getScript()); + data.add(locale.getVariant()); + } + channel.invokeMethod("setLocale", data); } } diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java index b1ceb82b7a74d..44269313bb983 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java @@ -4,26 +4,613 @@ package io.flutter.embedding.engine.systemchannels; +import android.content.pm.ActivityInfo; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.List; + import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.plugin.common.JSONMethodCodec; +import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; /** - * TODO(mattcarroll): fill in javadoc for PlatformChannel. + * System channel that receives requests for host platform behavior, e.g., haptic and sound + * effects, system chrome configurations, and clipboard interaction. */ public class PlatformChannel { - + @NonNull public final MethodChannel channel; + @Nullable + private PlatformMessageHandler platformMessageHandler; + + private final MethodChannel.MethodCallHandler parsingMethodCallHandler = new MethodChannel.MethodCallHandler() { + @Override + public void onMethodCall(MethodCall call, MethodChannel.Result result) { + if (platformMessageHandler == null) { + // If no explicit PlatformMessageHandler has been registered then we don't + // need to forward this call to an API. Return. + return; + } + + String method = call.method; + Object arguments = call.arguments; + try { + switch (method) { + case "SystemSound.play": + try { + SoundType soundType = SoundType.fromValue((String) arguments); + platformMessageHandler.playSystemSound(soundType); + result.success(null); + } catch (NoSuchFieldException exception) { + // The desired sound type does not exist. + result.error("error", exception.getMessage(), null); + } + break; + case "HapticFeedback.vibrate": + try { + HapticFeedbackType feedbackType = HapticFeedbackType.fromValue((String) arguments); + platformMessageHandler.vibrateHapticFeedback(feedbackType); + result.success(null); + } catch (NoSuchFieldException exception) { + // The desired feedback type does not exist. + result.error("error", exception.getMessage(), null); + } + break; + case "SystemChrome.setPreferredOrientations": + try { + int androidOrientation = decodeOrientations((JSONArray) arguments); + platformMessageHandler.setPreferredOrientations(androidOrientation); + result.success(null); + } catch (JSONException | NoSuchFieldException exception) { + // JSONException: One or more expected fields were either omitted or referenced an invalid type. + // NoSuchFieldException: One or more expected fields were either omitted or referenced an invalid type. + result.error("error", exception.getMessage(), null); + } + break; + case "SystemChrome.setApplicationSwitcherDescription": + try { + AppSwitcherDescription description = decodeAppSwitcherDescription((JSONObject) arguments); + platformMessageHandler.setApplicationSwitcherDescription(description); + result.success(null); + } catch (JSONException exception) { + // One or more expected fields were either omitted or referenced an invalid type. + result.error("error", exception.getMessage(), null); + } + break; + case "SystemChrome.setEnabledSystemUIOverlays": + try { + List overlays = decodeSystemUiOverlays((JSONArray) arguments); + platformMessageHandler.showSystemOverlays(overlays); + result.success(null); + } catch (JSONException | NoSuchFieldException exception) { + // JSONException: One or more expected fields were either omitted or referenced an invalid type. + // NoSuchFieldException: One or more of the overlay names are invalid. + result.error("error", exception.getMessage(), null); + } + break; + case "SystemChrome.restoreSystemUIOverlays": + platformMessageHandler.restoreSystemUiOverlays(); + result.success(null); + break; + case "SystemChrome.setSystemUIOverlayStyle": + try { + SystemChromeStyle systemChromeStyle = decodeSystemChromeStyle((JSONObject) arguments); + platformMessageHandler.setSystemUiOverlayStyle(systemChromeStyle); + result.success(null); + } catch (JSONException | NoSuchFieldException exception) { + // JSONException: One or more expected fields were either omitted or referenced an invalid type. + // NoSuchFieldException: One or more of the brightness names are invalid. + result.error("error", exception.getMessage(), null); + } + break; + case "SystemNavigator.pop": + platformMessageHandler.popSystemNavigator(); + result.success(null); + break; + case "Clipboard.getData": { + String contentFormatName = (String) arguments; + ClipboardContentFormat clipboardFormat = null; + if (contentFormatName != null) { + try { + clipboardFormat = ClipboardContentFormat.fromValue(contentFormatName); + } catch (NoSuchFieldException exception) { + // An unsupported content format was requested. Return failure. + result.error("error", "No such clipboard content format: " + contentFormatName, null); + } + } + CharSequence clipboardContent = platformMessageHandler.getClipboardData(clipboardFormat); + if (clipboardContent != null) { + JSONObject response = new JSONObject(); + response.put("text", clipboardContent); + result.success(response); + } else { + result.success(null); + } + break; + } + case "Clipboard.setData": { + String clipboardContent = ((JSONObject) arguments).getString("text"); + platformMessageHandler.setClipboardData(clipboardContent); + result.success(null); + break; + } + default: + result.notImplemented(); + break; + } + } catch (JSONException e) { + result.error("error", "JSON error: " + e.getMessage(), null); + } + } + }; + + /** + * Constructs a {@code PlatformChannel} that connects Android to the Dart code + * running in {@code dartExecutor}. + * + * The given {@code dartExecutor} is permitted to be idle or executing code. + * + * See {@link DartExecutor}. + */ public PlatformChannel(@NonNull DartExecutor dartExecutor) { - this.channel = new MethodChannel(dartExecutor, "flutter/platform", JSONMethodCodec.INSTANCE); + channel = new MethodChannel(dartExecutor, "flutter/platform", JSONMethodCodec.INSTANCE); + channel.setMethodCallHandler(parsingMethodCallHandler); + } + + /** + * Sets the {@link PlatformMessageHandler} which receives all events and requests + * that are parsed from the underlying platform channel. + */ + public void setPlatformMessageHandler(@Nullable PlatformMessageHandler platformMessageHandler) { + this.platformMessageHandler = platformMessageHandler; + } + + // TODO(mattcarroll): add support for IntDef annotations, then add @ScreenOrientation + + /** + * Decodes a series of orientations to an aggregate desired orientation. + * + * @throws JSONException if {@code encodedOrientations} does not contain expected keys and value types. + * @throws NoSuchFieldException if any given encoded orientation is not a valid orientation name. + */ + private int decodeOrientations(@NonNull JSONArray encodedOrientations) throws JSONException, NoSuchFieldException { + int requestedOrientation = 0x00; + int firstRequestedOrientation = 0x00; + for (int index = 0; index < encodedOrientations.length(); index += 1) { + String encodedOrientation = encodedOrientations.getString(index); + DeviceOrientation orientation = DeviceOrientation.fromValue(encodedOrientation); + + switch (orientation) { + case PORTRAIT_UP: + requestedOrientation |= 0x01; + break; + case PORTRAIT_DOWN: + requestedOrientation |= 0x04; + break; + case LANDSCAPE_LEFT: + requestedOrientation |= 0x02; + break; + case LANDSCAPE_RIGHT: + requestedOrientation |= 0x08; + break; + } + + if (firstRequestedOrientation == 0x00) { + firstRequestedOrientation = requestedOrientation; + } + } + + switch (requestedOrientation) { + case 0x00: + return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; + case 0x01: + return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; + case 0x02: + return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; + case 0x04: + return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; + case 0x05: + return ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT; + case 0x08: + return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; + case 0x0a: + return ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE; + case 0x0b: + return ActivityInfo.SCREEN_ORIENTATION_USER; + case 0x0f: + return ActivityInfo.SCREEN_ORIENTATION_FULL_USER; + case 0x03: // portraitUp and landscapeLeft + case 0x06: // portraitDown and landscapeLeft + case 0x07: // portraitUp, portraitDown, and landscapeLeft + case 0x09: // portraitUp and landscapeRight + case 0x0c: // portraitDown and landscapeRight + case 0x0d: // portraitUp, portraitDown, and landscapeRight + case 0x0e: // portraitDown, landscapeLeft, and landscapeRight + // Android can't describe these cases, so just default to whatever the first + // specified value was. + switch (firstRequestedOrientation) { + case 0x01: + return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; + case 0x02: + return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; + case 0x04: + return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; + case 0x08: + return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; + } + } + + // Execution should never get this far, but if it does then we default + // to a portrait orientation. + return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; + } + + private AppSwitcherDescription decodeAppSwitcherDescription(@NonNull JSONObject encodedDescription) throws JSONException { + int color = encodedDescription.getInt("primaryColor"); + if (color != 0) { // 0 means color isn't set, use system default + color = color | 0xFF000000; // color must be opaque if set + } + String label = encodedDescription.getString("label"); + return new AppSwitcherDescription(color, label); + } + + /** + * Decodes a list of JSON-encoded overlays to a list of {@link SystemUiOverlay}. + * + * @throws JSONException if {@code encodedSystemUiOverlay} does not contain expected keys and value types. + * @throws NoSuchFieldException if any of the given encoded overlay names are invalid. + */ + private List decodeSystemUiOverlays(@NonNull JSONArray encodedSystemUiOverlay) throws JSONException, NoSuchFieldException { + List overlays = new ArrayList<>(); + for (int i = 0; i < encodedSystemUiOverlay.length(); ++i) { + String encodedOverlay = encodedSystemUiOverlay.getString(i); + SystemUiOverlay overlay = SystemUiOverlay.fromValue(encodedOverlay); + switch(overlay) { + case TOP_OVERLAYS: + overlays.add(SystemUiOverlay.TOP_OVERLAYS); + break; + case BOTTOM_OVERLAYS: + overlays.add(SystemUiOverlay.BOTTOM_OVERLAYS); + break; + } + } + return overlays; + } + + /** + * Decodes a JSON-encoded {@code encodedStyle} to a {@link SystemChromeStyle}. + * + * @throws JSONException if {@code encodedStyle} does not contain expected keys and value types. + * @throws NoSuchFieldException if any provided brightness name is invalid. + */ + private SystemChromeStyle decodeSystemChromeStyle(@NonNull JSONObject encodedStyle) throws JSONException, NoSuchFieldException { + Brightness systemNavigationBarIconBrightness = null; + // TODO(mattcarroll): add color annotation + Integer systemNavigationBarColor = null; + // TODO(mattcarroll): add color annotation + Integer systemNavigationBarDividerColor = null; + Brightness statusBarIconBrightness = null; + // TODO(mattcarroll): add color annotation + Integer statusBarColor = null; + + if (!encodedStyle.isNull("systemNavigationBarIconBrightness")) { + systemNavigationBarIconBrightness = Brightness.fromValue(encodedStyle.getString("systemNavigationBarIconBrightness")); + } + + if (!encodedStyle.isNull("systemNavigationBarColor")) { + systemNavigationBarColor = encodedStyle.getInt("systemNavigationBarColor"); + } + + if (!encodedStyle.isNull("statusBarIconBrightness")) { + statusBarIconBrightness = Brightness.fromValue(encodedStyle.getString("statusBarIconBrightness")); + } + + if (!encodedStyle.isNull("statusBarColor")) { + statusBarColor = encodedStyle.getInt("statusBarColor"); + } + + if (!encodedStyle.isNull("systemNavigationBarDividerColor")) { + systemNavigationBarDividerColor = encodedStyle.getInt("systemNavigationBarDividerColor"); + } + + return new SystemChromeStyle( + statusBarColor, + statusBarIconBrightness, + systemNavigationBarColor, + systemNavigationBarIconBrightness, + systemNavigationBarDividerColor + ); } - public void setMethodCallHandler(@Nullable MethodChannel.MethodCallHandler handler) { - channel.setMethodCallHandler(handler); + /** + * Handler that receives platform messages sent from Flutter to Android + * through a given {@link PlatformChannel}. + * + * To register a {@code PlatformMessageHandler} with a {@link PlatformChannel}, + * see {@link PlatformChannel#setPlatformMessageHandler(PlatformMessageHandler)}. + */ + public interface PlatformMessageHandler { + /** + * The Flutter application would like to play the given {@code soundType}. + */ + void playSystemSound(@NonNull SoundType soundType); + + /** + * The Flutter application would like to play the given haptic {@code feedbackType}. + */ + void vibrateHapticFeedback(@NonNull HapticFeedbackType feedbackType); + + /** + * The Flutter application would like to display in the given {@code androidOrientation}. + */ + // TODO(mattcarroll): add @ScreenOrientation annotation + void setPreferredOrientations(int androidOrientation); + + /** + * The Flutter application would like to be displayed in Android's app switcher with + * the visual representation described in the given {@code description}. + *

+ * See the related Android documentation: + * https://developer.android.com/guide/components/activities/recents + */ + void setApplicationSwitcherDescription(@NonNull AppSwitcherDescription description); + + /** + * The Flutter application would like the Android system to display the given + * {@code overlays}. + *

+ * {@link SystemUiOverlay#TOP_OVERLAYS} refers to system overlays such as the + * status bar, while {@link SystemUiOverlay#BOTTOM_OVERLAYS} refers to system + * overlays such as the back/home/recents navigation on the bottom of the screen. + *

+ * An empty list of {@code overlays} should hide all system overlays. + */ + void showSystemOverlays(@NonNull List overlays); + + /** + * The Flutter application would like to restore the visibility of system + * overlays to the last set of overlays sent via {@link #showSystemOverlays(List)}. + *

+ * If {@link #showSystemOverlays(List)} has yet to be called, then a default + * system overlay appearance is desired: + *

+ * {@code + * View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + * } + */ + void restoreSystemUiOverlays(); + + /** + * The Flutter application would like the system chrome to present itself with + * the given {@code systemUiOverlayStyle}, i.e., the given status bar and + * navigation bar colors and brightness. + */ + void setSystemUiOverlayStyle(@NonNull SystemChromeStyle systemUiOverlayStyle); + + /** + * The Flutter application would like to pop the top item off of the Android + * app's navigation back stack. + */ + void popSystemNavigator(); + + /** + * The Flutter application would like to receive the current data in the + * clipboard and have it returned in the given {@code format}. + */ + @Nullable + CharSequence getClipboardData(@Nullable ClipboardContentFormat format); + + /** + * The Flutter application would like to set the current data in the + * clipboard to the given {@code text}. + */ + void setClipboardData(@NonNull String text); } + /** + * Types of sounds the Android OS can play on behalf of an application. + */ + public enum SoundType { + CLICK("SoundType.click"); + + static SoundType fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (SoundType soundType : SoundType.values()) { + if (soundType.encodedName.equals(encodedName)) { + return soundType; + } + } + throw new NoSuchFieldException("No such SoundType: " + encodedName); + } + + @NonNull + private final String encodedName; + + SoundType(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * The types of haptic feedback that the Android OS can generate on behalf + * of an application. + */ + public enum HapticFeedbackType { + STANDARD(null), + LIGHT_IMPACT("HapticFeedbackType.lightImpact"), + MEDIUM_IMPACT("HapticFeedbackType.mediumImpact"), + HEAVY_IMPACT("HapticFeedbackType.heavyImpact"), + SELECTION_CLICK("HapticFeedbackType.selectionClick"); + + static HapticFeedbackType fromValue(@Nullable String encodedName) throws NoSuchFieldException { + for (HapticFeedbackType feedbackType : HapticFeedbackType.values()) { + if ((feedbackType.encodedName == null && encodedName == null) + || (feedbackType.encodedName != null && feedbackType.encodedName.equals(encodedName))) { + return feedbackType; + } + } + throw new NoSuchFieldException("No such HapticFeedbackType: " + encodedName); + } + + @Nullable + private final String encodedName; + + HapticFeedbackType(@Nullable String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * The possible desired orientations of a Flutter application. + */ + public enum DeviceOrientation { + PORTRAIT_UP("DeviceOrientation.portraitUp"), + PORTRAIT_DOWN("DeviceOrientation.portraitDown"), + LANDSCAPE_LEFT("DeviceOrientation.landscapeLeft"), + LANDSCAPE_RIGHT("DeviceOrientation.landscapeRight"); + + static DeviceOrientation fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (DeviceOrientation orientation : DeviceOrientation.values()) { + if (orientation.encodedName.equals(encodedName)) { + return orientation; + } + } + throw new NoSuchFieldException("No such DeviceOrientation: " + encodedName); + } + + @NonNull + private String encodedName; + + DeviceOrientation(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * The set of Android system UI overlays as perceived by the Flutter application. + *

+ * Android includes many more overlay options and flags than what is provided by + * {@code SystemUiOverlay}. Flutter only requires control over a subset of the + * overlays and those overlays are represented by {@code SystemUiOverlay} values. + */ + public enum SystemUiOverlay { + TOP_OVERLAYS("SystemUiOverlay.top"), + BOTTOM_OVERLAYS("SystemUiOverlay.bottom"); + + static SystemUiOverlay fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (SystemUiOverlay overlay : SystemUiOverlay.values()) { + if (overlay.encodedName.equals(encodedName)) { + return overlay; + } + } + throw new NoSuchFieldException("No such SystemUiOverlay: " + encodedName); + } + + @NonNull + private String encodedName; + + SystemUiOverlay(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * The color and label of an application that appears in Android's app switcher, AKA + * recents screen. + */ + public static class AppSwitcherDescription { + // TODO(mattcarroll): add color annotation + public final int color; + @NonNull + public final String label; + + public AppSwitcherDescription(int color, @NonNull String label) { + this.color = color; + this.label = label; + } + } + + /** + * The color and brightness of system chrome, e.g., status bar and system navigation bar. + */ + public static class SystemChromeStyle { + // TODO(mattcarroll): add color annotation + @Nullable + public final Integer statusBarColor; + @Nullable + public final Brightness statusBarIconBrightness; + // TODO(mattcarroll): add color annotation + @Nullable + public final Integer systemNavigationBarColor; + @Nullable + public final Brightness systemNavigationBarIconBrightness; + // TODO(mattcarroll): add color annotation + @Nullable + public final Integer systemNavigationBarDividerColor; + + public SystemChromeStyle( + @Nullable Integer statusBarColor, + @Nullable Brightness statusBarIconBrightness, + @Nullable Integer systemNavigationBarColor, + @Nullable Brightness systemNavigationBarIconBrightness, + @Nullable Integer systemNavigationBarDividerColor + ) { + this.statusBarColor = statusBarColor; + this.statusBarIconBrightness = statusBarIconBrightness; + this.systemNavigationBarColor = systemNavigationBarColor; + this.systemNavigationBarIconBrightness = systemNavigationBarIconBrightness; + this.systemNavigationBarDividerColor = systemNavigationBarDividerColor; + } + } + + public enum Brightness { + LIGHT("Brightness.light"), + DARK("Brightness.dark"); + + static Brightness fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (Brightness brightness : Brightness.values()) { + if (brightness.encodedName.equals(encodedName)) { + return brightness; + } + } + throw new NoSuchFieldException("No such Brightness: " + encodedName); + } + + @NonNull + private String encodedName; + + Brightness(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * Data formats of clipboard content. + */ + public enum ClipboardContentFormat { + PLAIN_TEXT("text/plain"); + + static ClipboardContentFormat fromValue(String encodedName) throws NoSuchFieldException { + for (ClipboardContentFormat format : ClipboardContentFormat.values()) { + if (format.encodedName.equals(encodedName)) { + return format; + } + } + throw new NoSuchFieldException("No such ClipboardContentFormat: " + encodedName); + } + + @NonNull + private String encodedName; + + ClipboardContentFormat(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } } diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java new file mode 100644 index 0000000000000..fc4b75521549d --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java @@ -0,0 +1,406 @@ +package io.flutter.embedding.engine.systemchannels; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.view.inputmethod.EditorInfo; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.Arrays; +import java.util.HashMap; + +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.plugin.common.JSONMethodCodec; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; + +/** + * {@link TextInputChannel} is a platform channel between Android and Flutter that is used to + * communicate information about the user's text input. + *

+ * When the user presses an action button like "done" or "next", that action is sent from Android + * to Flutter through this {@link TextInputChannel}. + *

+ * When an input system in the Flutter app wants to show the keyboard, or hide it, or configure + * editing state, etc. a message is sent from Flutter to Android through this {@link TextInputChannel}. + *

+ * {@link TextInputChannel} comes with a default {@link io.flutter.plugin.common.MethodChannel.MethodCallHandler} + * that parses incoming messages from Flutter. Register a {@link TextInputMethodHandler} to respond + * to standard Flutter text input messages. + */ +public class TextInputChannel { + @NonNull + public final MethodChannel channel; + @Nullable + private TextInputMethodHandler textInputMethodHandler; + + private final MethodChannel.MethodCallHandler parsingMethodHandler = new MethodChannel.MethodCallHandler() { + @Override + public void onMethodCall(MethodCall call, MethodChannel.Result result) { + if (textInputMethodHandler == null) { + // If no explicit TextInputMethodHandler has been registered then we don't + // need to forward this call to an API. Return. + return; + } + + String method = call.method; + Object args = call.arguments; + switch (method) { + case "TextInput.show": + textInputMethodHandler.show(); + result.success(null); + break; + case "TextInput.hide": + textInputMethodHandler.hide(); + result.success(null); + break; + case "TextInput.setClient": + try { + final JSONArray argumentList = (JSONArray) args; + final int textInputClientId = argumentList.getInt(0); + final JSONObject jsonConfiguration = argumentList.getJSONObject(1); + textInputMethodHandler.setClient(textInputClientId, Configuration.fromJson(jsonConfiguration)); + result.success(null); + } catch (JSONException | NoSuchFieldException exception) { + // JSONException: missing keys or bad value types. + // NoSuchFieldException: one or more values were invalid. + result.error("error", exception.getMessage(), null); + } + break; + case "TextInput.setEditingState": + try { + final JSONObject editingState = (JSONObject) args; + textInputMethodHandler.setEditingState(TextEditState.fromJson(editingState)); + result.success(null); + } catch (JSONException exception) { + result.error("error", exception.getMessage(), null); + } + break; + case "TextInput.clearClient": + textInputMethodHandler.clearClient(); + result.success(null); + break; + default: + result.notImplemented(); + break; + } + } + }; + + /** + * Constructs a {@code TextInputChannel} that connects Android to the Dart code + * running in {@code dartExecutor}. + * + * The given {@code dartExecutor} is permitted to be idle or executing code. + * + * See {@link DartExecutor}. + */ + public TextInputChannel(@NonNull DartExecutor dartExecutor) { + this.channel = new MethodChannel(dartExecutor, "flutter/textinput", JSONMethodCodec.INSTANCE); + channel.setMethodCallHandler(parsingMethodHandler); + } + + /** + * Instructs Flutter to update its text input editing state to reflect the given configuration. + */ + public void updateEditingState(int inputClientId, String text, int selectionStart, int selectionEnd, int composingStart, int composingEnd) { + HashMap state = new HashMap<>(); + state.put("text", text); + state.put("selectionBase", selectionStart); + state.put("selectionExtent", selectionEnd); + state.put("composingBase", composingStart); + state.put("composingExtent", composingEnd); + + channel.invokeMethod( + "TextInputClient.updateEditingState", + Arrays.asList(inputClientId, state) + ); + } + + /** + * Instructs Flutter to execute a "newline" action. + */ + public void newline(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.newline") + ); + } + + /** + * Instructs Flutter to execute a "go" action. + */ + public void go(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.go") + ); + } + + /** + * Instructs Flutter to execute a "search" action. + */ + public void search(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.search") + ); + } + + /** + * Instructs Flutter to execute a "send" action. + */ + public void send(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.send") + ); + } + + /** + * Instructs Flutter to execute a "done" action. + */ + public void done(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.done") + ); + } + + /** + * Instructs Flutter to execute a "next" action. + */ + public void next(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.next") + ); + } + + /** + * Instructs Flutter to execute a "previous" action. + */ + public void previous(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.previous") + ); + } + + /** + * Instructs Flutter to execute an "unspecified" action. + */ + public void unspecifiedAction(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.unspecified") + ); + } + + /** + * Sets the {@link TextInputMethodHandler} which receives all events and requests + * that are parsed from the underlying platform channel. + */ + public void setTextInputMethodHandler(@Nullable TextInputMethodHandler textInputMethodHandler) { + this.textInputMethodHandler = textInputMethodHandler; + } + + public interface TextInputMethodHandler { + // TODO(mattcarroll): javadoc + void show(); + + // TODO(mattcarroll): javadoc + void hide(); + + // TODO(mattcarroll): javadoc + void setClient(int textInputClientId, @NonNull Configuration configuration); + + // TODO(mattcarroll): javadoc + void setEditingState(@NonNull TextEditState editingState); + + // TODO(mattcarroll): javadoc + void clearClient(); + } + + /** + * A text editing configuration. + */ + public static class Configuration { + public static Configuration fromJson(@NonNull JSONObject json) throws JSONException, NoSuchFieldException { + final String inputActionName = json.getString("inputAction"); + if (inputActionName == null) { + throw new JSONException("Configuration JSON missing 'inputAction' property."); + } + + final Integer inputAction = inputActionFromTextInputAction(inputActionName); + return new Configuration( + json.optBoolean("obscureText"), + json.optBoolean("autocorrect", true), + TextCapitalization.fromValue(json.getString("textCapitalization")), + InputType.fromJson(json.getJSONObject("inputType")), + inputAction, + json.optString("actionLabel") + ); + } + + private static Integer inputActionFromTextInputAction(@NonNull String inputAction) { + switch (inputAction) { + case "TextInputAction.newline": + return EditorInfo.IME_ACTION_NONE; + case "TextInputAction.none": + return EditorInfo.IME_ACTION_NONE; + case "TextInputAction.unspecified": + return EditorInfo.IME_ACTION_UNSPECIFIED; + case "TextInputAction.done": + return EditorInfo.IME_ACTION_DONE; + case "TextInputAction.go": + return EditorInfo.IME_ACTION_GO; + case "TextInputAction.search": + return EditorInfo.IME_ACTION_SEARCH; + case "TextInputAction.send": + return EditorInfo.IME_ACTION_SEND; + case "TextInputAction.next": + return EditorInfo.IME_ACTION_NEXT; + case "TextInputAction.previous": + return EditorInfo.IME_ACTION_PREVIOUS; + default: + // Present default key if bad input type is given. + return EditorInfo.IME_ACTION_UNSPECIFIED; + } + } + + public final boolean obscureText; + public final boolean autocorrect; + @NonNull + public final TextCapitalization textCapitalization; + @NonNull + public final InputType inputType; + @Nullable + public final Integer inputAction; + @Nullable + public final String actionLabel; + + public Configuration( + boolean obscureText, + boolean autocorrect, + @NonNull TextCapitalization textCapitalization, + @NonNull InputType inputType, + @Nullable Integer inputAction, + @Nullable String actionLabel + ) { + this.obscureText = obscureText; + this.autocorrect = autocorrect; + this.textCapitalization = textCapitalization; + this.inputType = inputType; + this.inputAction = inputAction; + this.actionLabel = actionLabel; + } + } + + /** + * A text input type. + * + * If the {@link #type} is {@link TextInputType#NUMBER}, this {@code InputType} also + * reports whether that number {@link #isSigned} and {@link #isDecimal}. + */ + public static class InputType { + @NonNull + public static InputType fromJson(@NonNull JSONObject json) throws JSONException, NoSuchFieldException { + return new InputType( + TextInputType.fromValue(json.getString("name")), + json.optBoolean("signed", false), + json.optBoolean("decimal", false) + ); + } + + @NonNull + public final TextInputType type; + public final boolean isSigned; + public final boolean isDecimal; + + public InputType(@NonNull TextInputType type, boolean isSigned, boolean isDecimal) { + this.type = type; + this.isSigned = isSigned; + this.isDecimal = isDecimal; + } + } + + /** + * Types of text input. + */ + public enum TextInputType { + DATETIME("TextInputType.datetime"), + NUMBER("TextInputType.number"), + PHONE("TextInputType.phone"), + MULTILINE("TextInputType.multiline"), + EMAIL_ADDRESS("TextInputType.emailAddress"), + URL("TextInputType.url"); + + static TextInputType fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (TextInputType textInputType : TextInputType.values()) { + if (textInputType.encodedName.equals(encodedName)) { + return textInputType; + } + } + throw new NoSuchFieldException("No such TextInputType: " + encodedName); + } + + @NonNull + private final String encodedName; + + TextInputType(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * Text capitalization schemes. + */ + public enum TextCapitalization { + CHARACTERS("TextCapitalization.characters"), + WORDS("TextCapitalization.words"), + SENTENCES("TextCapitalization.sentences"); + + static TextCapitalization fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (TextCapitalization textCapitalization : TextCapitalization.values()) { + if (textCapitalization.encodedName.equals(encodedName)) { + return textCapitalization; + } + } + throw new NoSuchFieldException("No such TextCapitalization: " + encodedName); + } + + @NonNull + private final String encodedName; + + TextCapitalization(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * State of an on-going text editing session. + */ + public static class TextEditState { + public static TextEditState fromJson(@NonNull JSONObject textEditState) throws JSONException { + return new TextEditState( + textEditState.getString("text"), + textEditState.getInt("selectionBase"), + textEditState.getInt("selectionExtent") + ); + } + + @NonNull + public final String text; + public final int selectionStart; + public final int selectionEnd; + + public TextEditState(@NonNull String text, int selectionStart, int selectionEnd) { + this.text = text; + this.selectionStart = selectionStart; + this.selectionEnd = selectionEnd; + } + } +} diff --git a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java index df907be0b70a1..b3a287820bfe9 100644 --- a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java +++ b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java @@ -11,17 +11,16 @@ import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; + +import io.flutter.embedding.engine.systemchannels.TextInputChannel; import io.flutter.plugin.common.ErrorLogResult; import io.flutter.plugin.common.MethodChannel; import io.flutter.view.FlutterView; -import java.util.Arrays; -import java.util.HashMap; - class InputConnectionAdaptor extends BaseInputConnection { private final FlutterView mFlutterView; private final int mClient; - private final MethodChannel mFlutterChannel; + private final TextInputChannel textInputChannel; private final Editable mEditable; private int mBatchCount; private InputMethodManager mImm; @@ -29,12 +28,16 @@ class InputConnectionAdaptor extends BaseInputConnection { private static final MethodChannel.Result logger = new ErrorLogResult("FlutterTextInput"); - public InputConnectionAdaptor(FlutterView view, int client, - MethodChannel flutterChannel, Editable editable) { + public InputConnectionAdaptor( + FlutterView view, + int client, + TextInputChannel textInputChannel, + Editable editable + ) { super(view, true); mFlutterView = view; mClient = client; - mFlutterChannel = flutterChannel; + this.textInputChannel = textInputChannel; mEditable = editable; mBatchCount = 0; mImm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); @@ -55,14 +58,14 @@ private void updateEditingState() { selectionStart, selectionEnd, composingStart, composingEnd); - HashMap state = new HashMap<>(); - state.put("text", mEditable.toString()); - state.put("selectionBase", selectionStart); - state.put("selectionExtent", selectionEnd); - state.put("composingBase", composingStart); - state.put("composingExtent", composingEnd); - mFlutterChannel.invokeMethod("TextInputClient.updateEditingState", - Arrays.asList(mClient, state), logger); + textInputChannel.updateEditingState( + mClient, + mEditable.toString(), + selectionStart, + selectionEnd, + composingStart, + composingEnd + ); } @Override @@ -178,39 +181,30 @@ public boolean sendKeyEvent(KeyEvent event) { @Override public boolean performEditorAction(int actionCode) { switch (actionCode) { - // TODO(mattcarroll): is newline an appropriate action for "none"? case EditorInfo.IME_ACTION_NONE: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.newline"), logger); + textInputChannel.newline(mClient); break; case EditorInfo.IME_ACTION_UNSPECIFIED: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.unspecified"), logger); + textInputChannel.unspecifiedAction(mClient); break; case EditorInfo.IME_ACTION_GO: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.go"), logger); + textInputChannel.go(mClient); break; case EditorInfo.IME_ACTION_SEARCH: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.search"), logger); + textInputChannel.search(mClient); break; case EditorInfo.IME_ACTION_SEND: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.send"), logger); + textInputChannel.send(mClient); break; case EditorInfo.IME_ACTION_NEXT: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.next"), logger); + textInputChannel.next(mClient); break; case EditorInfo.IME_ACTION_PREVIOUS: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.previous"), logger); + textInputChannel.previous(mClient); break; default: case EditorInfo.IME_ACTION_DONE: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.done"), logger); + textInputChannel.done(mClient); break; } return true; diff --git a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java index c59ee25148e2d..bc54b3ed045ac 100644 --- a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java +++ b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java @@ -5,6 +5,7 @@ package io.flutter.plugin.editing; import android.content.Context; +import android.support.annotation.NonNull; import android.text.Editable; import android.text.InputType; import android.text.Selection; @@ -12,84 +13,87 @@ import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; -import io.flutter.plugin.common.JSONMethodCodec; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; -import io.flutter.plugin.common.MethodChannel.MethodCallHandler; -import io.flutter.plugin.common.MethodChannel.Result; + +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.embedding.engine.systemchannels.TextInputChannel; import io.flutter.view.FlutterView; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; /** * Android implementation of the text input plugin. */ -public class TextInputPlugin implements MethodCallHandler { +public class TextInputPlugin { private final FlutterView mView; private final InputMethodManager mImm; - private final MethodChannel mFlutterChannel; + private final TextInputChannel textInputChannel; private int mClient = 0; - private JSONObject mConfiguration; + private TextInputChannel.Configuration configuration; private Editable mEditable; private boolean mRestartInputPending; - public TextInputPlugin(FlutterView view) { + public TextInputPlugin(FlutterView view, @NonNull DartExecutor dartExecutor) { mView = view; mImm = (InputMethodManager) view.getContext().getSystemService( Context.INPUT_METHOD_SERVICE); - mFlutterChannel = new MethodChannel(view, "flutter/textinput", JSONMethodCodec.INSTANCE); - mFlutterChannel.setMethodCallHandler(this); - } - @Override - public void onMethodCall(MethodCall call, Result result) { - String method = call.method; - Object args = call.arguments; - try { - if (method.equals("TextInput.show")) { + textInputChannel = new TextInputChannel(dartExecutor); + textInputChannel.setTextInputMethodHandler(new TextInputChannel.TextInputMethodHandler() { + @Override + public void show() { showTextInput(mView); - result.success(null); - } else if (method.equals("TextInput.hide")) { + } + + @Override + public void hide() { hideTextInput(mView); - result.success(null); - } else if (method.equals("TextInput.setClient")) { - final JSONArray argumentList = (JSONArray) args; - setTextInputClient(mView, argumentList.getInt(0), argumentList.getJSONObject(1)); - result.success(null); - } else if (method.equals("TextInput.setEditingState")) { - setTextInputEditingState(mView, (JSONObject) args); - result.success(null); - } else if (method.equals("TextInput.clearClient")) { + } + + @Override + public void setClient(int textInputClientId, TextInputChannel.Configuration configuration) { + setTextInputClient(textInputClientId, configuration); + } + + @Override + public void setEditingState(TextInputChannel.TextEditState editingState) { + setTextInputEditingState(mView, editingState); + } + + @Override + public void clearClient() { clearTextInputClient(); - result.success(null); - } else { - result.notImplemented(); } - } catch (JSONException e) { - result.error("error", "JSON error: " + e.getMessage(), null); - } + }); } - private static int inputTypeFromTextInputType(JSONObject type, boolean obscureText, - boolean autocorrect, String textCapitalization) throws JSONException { - String inputType = type.getString("name"); - if (inputType.equals("TextInputType.datetime")) return InputType.TYPE_CLASS_DATETIME; - if (inputType.equals("TextInputType.number")) { + private static int inputTypeFromTextInputType( + TextInputChannel.InputType type, + boolean obscureText, + boolean autocorrect, + TextInputChannel.TextCapitalization textCapitalization + ) { + if (type.type == TextInputChannel.TextInputType.DATETIME) { + return InputType.TYPE_CLASS_DATETIME; + } else if (type.type == TextInputChannel.TextInputType.NUMBER) { int textType = InputType.TYPE_CLASS_NUMBER; - if (type.optBoolean("signed")) textType |= InputType.TYPE_NUMBER_FLAG_SIGNED; - if (type.optBoolean("decimal")) textType |= InputType.TYPE_NUMBER_FLAG_DECIMAL; + if (type.isSigned) { + textType |= InputType.TYPE_NUMBER_FLAG_SIGNED; + } + if (type.isDecimal) { + textType |= InputType.TYPE_NUMBER_FLAG_DECIMAL; + } return textType; + } else if (type.type == TextInputChannel.TextInputType.PHONE) { + return InputType.TYPE_CLASS_PHONE; } - if (inputType.equals("TextInputType.phone")) return InputType.TYPE_CLASS_PHONE; int textType = InputType.TYPE_CLASS_TEXT; - if (inputType.equals("TextInputType.multiline")) + if (type.type == TextInputChannel.TextInputType.MULTILINE) { textType |= InputType.TYPE_TEXT_FLAG_MULTI_LINE; - else if (inputType.equals("TextInputType.emailAddress")) + } else if (type.type == TextInputChannel.TextInputType.EMAIL_ADDRESS) { textType |= InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; - else if (inputType.equals("TextInputType.url")) + } else if (type.type == TextInputChannel.TextInputType.URL) { textType |= InputType.TYPE_TEXT_VARIATION_URI; + } + if (obscureText) { // Note: both required. Some devices ignore TYPE_TEXT_FLAG_NO_SUGGESTIONS. textType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; @@ -97,69 +101,50 @@ else if (inputType.equals("TextInputType.url")) } else { if (autocorrect) textType |= InputType.TYPE_TEXT_FLAG_AUTO_CORRECT; } - if (textCapitalization.equals("TextCapitalization.characters")) { + + if (textCapitalization == TextInputChannel.TextCapitalization.CHARACTERS) { textType |= InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; - } else if (textCapitalization.equals("TextCapitalization.words")) { + } else if (textCapitalization == TextInputChannel.TextCapitalization.WORDS) { textType |= InputType.TYPE_TEXT_FLAG_CAP_WORDS; - } else if (textCapitalization.equals("TextCapitalization.sentences")) { + } else if (textCapitalization == TextInputChannel.TextCapitalization.SENTENCES) { textType |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; } - return textType; - } - private static int inputActionFromTextInputAction(String inputAction) { - switch (inputAction) { - case "TextInputAction.newline": - return EditorInfo.IME_ACTION_NONE; - case "TextInputAction.none": - return EditorInfo.IME_ACTION_NONE; - case "TextInputAction.unspecified": - return EditorInfo.IME_ACTION_UNSPECIFIED; - case "TextInputAction.done": - return EditorInfo.IME_ACTION_DONE; - case "TextInputAction.go": - return EditorInfo.IME_ACTION_GO; - case "TextInputAction.search": - return EditorInfo.IME_ACTION_SEARCH; - case "TextInputAction.send": - return EditorInfo.IME_ACTION_SEND; - case "TextInputAction.next": - return EditorInfo.IME_ACTION_NEXT; - case "TextInputAction.previous": - return EditorInfo.IME_ACTION_PREVIOUS; - default: - // Present default key if bad input type is given. - return EditorInfo.IME_ACTION_UNSPECIFIED; - } + return textType; } - public InputConnection createInputConnection(FlutterView view, EditorInfo outAttrs) - throws JSONException { + public InputConnection createInputConnection(FlutterView view, EditorInfo outAttrs) { if (mClient == 0) return null; - outAttrs.inputType = inputTypeFromTextInputType(mConfiguration.getJSONObject("inputType"), - mConfiguration.optBoolean("obscureText"), - mConfiguration.optBoolean("autocorrect", true), - mConfiguration.getString("textCapitalization")); + outAttrs.inputType = inputTypeFromTextInputType( + configuration.inputType, + configuration.obscureText, + configuration.autocorrect, + configuration.textCapitalization + ); outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN; int enterAction; - if (mConfiguration.isNull("inputAction")) { + if (configuration.inputAction == null) { // If an explicit input action isn't set, then default to none for multi-line fields // and done for single line fields. enterAction = (InputType.TYPE_TEXT_FLAG_MULTI_LINE & outAttrs.inputType) != 0 ? EditorInfo.IME_ACTION_NONE : EditorInfo.IME_ACTION_DONE; } else { - enterAction = inputActionFromTextInputAction(mConfiguration.getString("inputAction")); + enterAction = configuration.inputAction; } - if (!mConfiguration.isNull("actionLabel")) { - outAttrs.actionLabel = mConfiguration.getString("actionLabel"); + if (configuration.actionLabel != null) { + outAttrs.actionLabel = configuration.actionLabel; outAttrs.actionId = enterAction; } outAttrs.imeOptions |= enterAction; - InputConnectionAdaptor connection = - new InputConnectionAdaptor(view, mClient, mFlutterChannel, mEditable); + InputConnectionAdaptor connection = new InputConnectionAdaptor( + view, + mClient, + textInputChannel, + mEditable + ); outAttrs.initialSelStart = Selection.getSelectionStart(mEditable); outAttrs.initialSelEnd = Selection.getSelectionEnd(mEditable); @@ -175,9 +160,9 @@ private void hideTextInput(FlutterView view) { mImm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0); } - private void setTextInputClient(FlutterView view, int client, JSONObject configuration) { + private void setTextInputClient(int client, TextInputChannel.Configuration configuration) { mClient = client; - mConfiguration = configuration; + this.configuration = configuration; mEditable = Editable.Factory.getInstance().newEditable(""); // setTextInputClient will be followed by a call to setTextInputEditingState. @@ -185,9 +170,9 @@ private void setTextInputClient(FlutterView view, int client, JSONObject configu mRestartInputPending = true; } - private void applyStateToSelection(JSONObject state) throws JSONException { - int selStart = state.getInt("selectionBase"); - int selEnd = state.getInt("selectionExtent"); + private void applyStateToSelection(TextInputChannel.TextEditState state) { + int selStart = state.selectionStart; + int selEnd = state.selectionEnd; if (selStart >= 0 && selStart <= mEditable.length() && selEnd >= 0 && selEnd <= mEditable.length()) { Selection.setSelection(mEditable, selStart, selEnd); @@ -196,15 +181,15 @@ private void applyStateToSelection(JSONObject state) throws JSONException { } } - private void setTextInputEditingState(FlutterView view, JSONObject state) throws JSONException { - if (!mRestartInputPending && state.getString("text").equals(mEditable.toString())) { + private void setTextInputEditingState(FlutterView view, TextInputChannel.TextEditState state) { + if (!mRestartInputPending && state.text.equals(mEditable.toString())) { applyStateToSelection(state); mImm.updateSelection(mView, Math.max(Selection.getSelectionStart(mEditable), 0), Math.max(Selection.getSelectionEnd(mEditable), 0), BaseInputConnection.getComposingSpanStart(mEditable), BaseInputConnection.getComposingSpanEnd(mEditable)); } else { - mEditable.replace(0, mEditable.length(), state.getString("text")); + mEditable.replace(0, mEditable.length(), state.text); applyStateToSelection(state); mImm.restartInput(view); mRestartInputPending = false; diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java index b6f53d45741f1..e9d44001ef0f5 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java @@ -9,212 +9,159 @@ import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; -import android.content.pm.ActivityInfo; import android.os.Build; -import android.util.Log; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.view.HapticFeedbackConstants; import android.view.SoundEffectConstants; import android.view.View; import android.view.Window; + +import java.util.List; + +import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.plugin.common.ActivityLifecycleListener; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel.MethodCallHandler; -import io.flutter.plugin.common.MethodChannel.Result; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; /** * Android implementation of the platform plugin. */ -public class PlatformPlugin implements MethodCallHandler, ActivityLifecycleListener { - private final Activity mActivity; - private JSONObject mCurrentTheme; +public class PlatformPlugin implements ActivityLifecycleListener { public static final int DEFAULT_SYSTEM_UI = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; - private static final String kTextPlainFormat = "text/plain"; - public PlatformPlugin(Activity activity) { - mActivity = activity; - mEnabledOverlays = DEFAULT_SYSTEM_UI; - } + private final Activity activity; + private final PlatformChannel platformChannel; + private PlatformChannel.SystemChromeStyle currentTheme; + private int mEnabledOverlays; - @Override - public void onMethodCall(MethodCall call, Result result) { - String method = call.method; - Object arguments = call.arguments; - try { - if (method.equals("SystemSound.play")) { - playSystemSound((String) arguments); - result.success(null); - } else if (method.equals("HapticFeedback.vibrate")) { - vibrateHapticFeedback((String) arguments); - result.success(null); - } else if (method.equals("SystemChrome.setPreferredOrientations")) { - setSystemChromePreferredOrientations((JSONArray) arguments); - result.success(null); - } else if (method.equals("SystemChrome.setApplicationSwitcherDescription")) { - setSystemChromeApplicationSwitcherDescription((JSONObject) arguments); - result.success(null); - } else if (method.equals("SystemChrome.setEnabledSystemUIOverlays")) { - setSystemChromeEnabledSystemUIOverlays((JSONArray) arguments); - result.success(null); - } else if (method.equals("SystemChrome.restoreSystemUIOverlays")) { - restoreSystemChromeSystemUIOverlays(); - result.success(null); - } else if (method.equals("SystemChrome.setSystemUIOverlayStyle")) { - setSystemChromeSystemUIOverlayStyle((JSONObject) arguments); - result.success(null); - } else if (method.equals("SystemNavigator.pop")) { - popSystemNavigator(); - result.success(null); - } else if (method.equals("Clipboard.getData")) { - result.success(getClipboardData((String) arguments)); - } else if (method.equals("Clipboard.setData")) { - setClipboardData((JSONObject) arguments); - result.success(null); - } else { - result.notImplemented(); - } - } catch (JSONException e) { - result.error("error", "JSON error: " + e.getMessage(), null); + private final PlatformChannel.PlatformMessageHandler mPlatformMessageHandler = new PlatformChannel.PlatformMessageHandler() { + @Override + public void playSystemSound(@NonNull PlatformChannel.SoundType soundType) { + PlatformPlugin.this.playSystemSound(soundType); } - } - private void playSystemSound(String soundType) { - if (soundType.equals("SystemSoundType.click")) { - View view = mActivity.getWindow().getDecorView(); - view.playSoundEffect(SoundEffectConstants.CLICK); + @Override + public void vibrateHapticFeedback(@NonNull PlatformChannel.HapticFeedbackType feedbackType) { + PlatformPlugin.this.vibrateHapticFeedback(feedbackType); + } + + @Override + public void setPreferredOrientations(int androidOrientation) { + setSystemChromePreferredOrientations(androidOrientation); + } + + @Override + public void setApplicationSwitcherDescription(@NonNull PlatformChannel.AppSwitcherDescription description) { + setSystemChromeApplicationSwitcherDescription(description); + } + + @Override + public void showSystemOverlays(@NonNull List overlays) { + setSystemChromeEnabledSystemUIOverlays(overlays); + } + + @Override + public void restoreSystemUiOverlays() { + restoreSystemChromeSystemUIOverlays(); + } + + @Override + public void setSystemUiOverlayStyle(@NonNull PlatformChannel.SystemChromeStyle systemUiOverlayStyle) { + setSystemChromeSystemUIOverlayStyle(systemUiOverlayStyle); + } + + @Override + public void popSystemNavigator() { + PlatformPlugin.this.popSystemNavigator(); } - } - private void vibrateHapticFeedback(String feedbackType) { - View view = mActivity.getWindow().getDecorView(); - if (feedbackType == null) { - view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); - } else if (feedbackType.equals("HapticFeedbackType.lightImpact")) { - view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); - } else if (feedbackType.equals("HapticFeedbackType.mediumImpact")) { - view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); - } else if (feedbackType.equals("HapticFeedbackType.heavyImpact")) { - // HapticFeedbackConstants.CONTEXT_CLICK from API level 23. - view.performHapticFeedback(6); - } else if (feedbackType.equals("HapticFeedbackType.selectionClick")) { - view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK); + @Override + public CharSequence getClipboardData(@Nullable PlatformChannel.ClipboardContentFormat format) { + return PlatformPlugin.this.getClipboardData(format); } + + @Override + public void setClipboardData(@NonNull String text) { + PlatformPlugin.this.setClipboardData(text); + } + }; + + public PlatformPlugin(Activity activity, PlatformChannel platformChannel) { + this.activity = activity; + this.platformChannel = platformChannel; + this.platformChannel.setPlatformMessageHandler(mPlatformMessageHandler); + + mEnabledOverlays = DEFAULT_SYSTEM_UI; } - private void setSystemChromePreferredOrientations(JSONArray orientations) throws JSONException { - int requestedOrientation = 0x00; - int firstRequestedOrientation = 0x00; - for (int index = 0; index < orientations.length(); index += 1) { - if (orientations.getString(index).equals("DeviceOrientation.portraitUp")) { - requestedOrientation |= 0x01; - } else if (orientations.getString(index).equals("DeviceOrientation.landscapeLeft")) { - requestedOrientation |= 0x02; - } else if (orientations.getString(index).equals("DeviceOrientation.portraitDown")) { - requestedOrientation |= 0x04; - } else if (orientations.getString(index).equals("DeviceOrientation.landscapeRight")) { - requestedOrientation |= 0x08; - } - if (firstRequestedOrientation == 0x00) { - firstRequestedOrientation = requestedOrientation; - } + private void playSystemSound(PlatformChannel.SoundType soundType) { + if (soundType == PlatformChannel.SoundType.CLICK) { + View view = activity.getWindow().getDecorView(); + view.playSoundEffect(SoundEffectConstants.CLICK); } - switch (requestedOrientation) { - case 0x00: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); - break; - case 0x01: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - break; - case 0x02: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); - break; - case 0x04: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); - break; - case 0x05: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT); + } + + private void vibrateHapticFeedback(PlatformChannel.HapticFeedbackType feedbackType) { + View view = activity.getWindow().getDecorView(); + switch (feedbackType) { + case STANDARD: + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); break; - case 0x08: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); + case LIGHT_IMPACT: + view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); break; - case 0x0a: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE); + case MEDIUM_IMPACT: + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); break; - case 0x0b: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER); + case HEAVY_IMPACT: + // HapticFeedbackConstants.CONTEXT_CLICK from API level 23. + view.performHapticFeedback(6); break; - case 0x0f: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER); + case SELECTION_CLICK: + view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK); break; - case 0x03: // portraitUp and landscapeLeft - case 0x06: // portraitDown and landscapeLeft - case 0x07: // portraitUp, portraitDown, and landscapeLeft - case 0x09: // portraitUp and landscapeRight - case 0x0c: // portraitDown and landscapeRight - case 0x0d: // portraitUp, portraitDown, and landscapeRight - case 0x0e: // portraitDown, landscapeLeft, and landscapeRight - // Android can't describe these cases, so just default to whatever the first - // specified value was. - switch (firstRequestedOrientation) { - case 0x01: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - break; - case 0x02: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); - break; - case 0x04: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); - break; - case 0x08: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); - break; - } - break; - } + } + } + + private void setSystemChromePreferredOrientations(int androidOrientation) { + activity.setRequestedOrientation(androidOrientation); } - private void setSystemChromeApplicationSwitcherDescription(JSONObject description) throws JSONException { + private void setSystemChromeApplicationSwitcherDescription(PlatformChannel.AppSwitcherDescription description) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return; } - int color = description.getInt("primaryColor"); - if (color != 0) { // 0 means color isn't set, use system default - color = color | 0xFF000000; // color must be opaque if set - } - - String label = description.getString("label"); - @SuppressWarnings("deprecation") TaskDescription taskDescription = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) - ? new TaskDescription(label, 0, color) - : new TaskDescription(label, null, color); + ? new TaskDescription(description.label, 0, description.color) + : new TaskDescription(description.label, null, description.color); - mActivity.setTaskDescription(taskDescription); + activity.setTaskDescription(taskDescription); } - private int mEnabledOverlays; - - private void setSystemChromeEnabledSystemUIOverlays(JSONArray overlays) throws JSONException { + private void setSystemChromeEnabledSystemUIOverlays(List overlaysToShow) { + // Start by assuming we want to hide all system overlays (like an immersive game). int enabledOverlays = DEFAULT_SYSTEM_UI | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; - if (overlays.length() == 0) { + if (overlaysToShow.size() == 0) { enabledOverlays |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; } - for (int i = 0; i < overlays.length(); ++i) { - String overlay = overlays.getString(i); - if (overlay.equals("SystemUiOverlay.top")) { - enabledOverlays &= ~View.SYSTEM_UI_FLAG_FULLSCREEN; - } else if (overlay.equals("SystemUiOverlay.bottom")) { - enabledOverlays &= ~View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; - enabledOverlays &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; + // Re-add any desired system overlays. + for (int i = 0; i < overlaysToShow.size(); ++i) { + PlatformChannel.SystemUiOverlay overlayToShow = overlaysToShow.get(i); + switch (overlayToShow) { + case TOP_OVERLAYS: + enabledOverlays &= ~View.SYSTEM_UI_FLAG_FULLSCREEN; + break; + case BOTTOM_OVERLAYS: + enabledOverlays &= ~View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; + enabledOverlays &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; + break; } } @@ -223,9 +170,9 @@ private void setSystemChromeEnabledSystemUIOverlays(JSONArray overlays) throws J } private void updateSystemUiOverlays(){ - mActivity.getWindow().getDecorView().setSystemUiVisibility(mEnabledOverlays); - if (mCurrentTheme != null) { - setSystemChromeSystemUIOverlayStyle(mCurrentTheme); + activity.getWindow().getDecorView().setSystemUiVisibility(mEnabledOverlays); + if (currentTheme != null) { + setSystemChromeSystemUIOverlayStyle(currentTheme); } } @@ -233,83 +180,75 @@ private void restoreSystemChromeSystemUIOverlays() { updateSystemUiOverlays(); } - private void setSystemChromeSystemUIOverlayStyle(JSONObject message) { - Window window = mActivity.getWindow(); + private void setSystemChromeSystemUIOverlayStyle(PlatformChannel.SystemChromeStyle systemChromeStyle) { + Window window = activity.getWindow(); View view = window.getDecorView(); int flags = view.getSystemUiVisibility(); - try { - // You can change the navigation bar color (including translucent colors) - // in Android, but you can't change the color of the navigation buttons until Android O. - // LIGHT vs DARK effectively isn't supported until then. - // Build.VERSION_CODES.O - if (Build.VERSION.SDK_INT >= 26) { - if (!message.isNull("systemNavigationBarIconBrightness")) { - String systemNavigationBarIconBrightness = message.getString("systemNavigationBarIconBrightness"); - switch (systemNavigationBarIconBrightness) { - case "Brightness.dark": - //View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR - flags |= 0x10; - break; - case "Brightness.light": - flags &= ~0x10; - break; - } - } - if (!message.isNull("systemNavigationBarColor")) { - window.setNavigationBarColor(message.getInt("systemNavigationBarColor")); + // You can change the navigation bar color (including translucent colors) + // in Android, but you can't change the color of the navigation buttons until Android O. + // LIGHT vs DARK effectively isn't supported until then. + // Build.VERSION_CODES.O + if (Build.VERSION.SDK_INT >= 26) { + if (systemChromeStyle.systemNavigationBarIconBrightness != null) { + switch (systemChromeStyle.systemNavigationBarIconBrightness) { + case DARK: + //View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR + flags |= 0x10; + break; + case LIGHT: + flags &= ~0x10; + break; } } - // Build.VERSION_CODES.M - if (Build.VERSION.SDK_INT >= 23) { - if (!message.isNull("statusBarIconBrightness")) { - String statusBarIconBrightness = message.getString("statusBarIconBrightness"); - switch (statusBarIconBrightness) { - case "Brightness.dark": - // View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR - flags |= 0x2000; - break; - case "Brightness.light": - flags &= ~0x2000; - break; - } - } - if (!message.isNull("statusBarColor")) { - window.setStatusBarColor(message.getInt("statusBarColor")); + if (systemChromeStyle.systemNavigationBarColor != null) { + window.setNavigationBarColor(systemChromeStyle.systemNavigationBarColor); + } + } + // Build.VERSION_CODES.M + if (Build.VERSION.SDK_INT >= 23) { + if (systemChromeStyle.statusBarIconBrightness != null) { + switch (systemChromeStyle.statusBarIconBrightness) { + case DARK: + // View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR + flags |= 0x2000; + break; + case LIGHT: + flags &= ~0x2000; + break; } } - if (!message.isNull("systemNavigationBarDividerColor")) { - // Not availible until Android P. - // window.setNavigationBarDividerColor(systemNavigationBarDividerColor); + if (systemChromeStyle.statusBarColor != null) { + window.setStatusBarColor(systemChromeStyle.statusBarColor); } - view.setSystemUiVisibility(flags); - mCurrentTheme = message; - } catch (JSONException err) { - Log.i("PlatformPlugin", err.toString()); } + if (systemChromeStyle.systemNavigationBarDividerColor != null) { + // Not availible until Android P. + // window.setNavigationBarDividerColor(systemNavigationBarDividerColor); + } + view.setSystemUiVisibility(flags); + currentTheme = systemChromeStyle; } private void popSystemNavigator() { - mActivity.finish(); + activity.finish(); } - private JSONObject getClipboardData(String format) throws JSONException { - ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE); + private CharSequence getClipboardData(PlatformChannel.ClipboardContentFormat format) { + ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = clipboard.getPrimaryClip(); if (clip == null) return null; - if (format == null || format.equals(kTextPlainFormat)) { - JSONObject result = new JSONObject(); - result.put("text", clip.getItemAt(0).coerceToText(mActivity)); - return result; + if (format == null || format == PlatformChannel.ClipboardContentFormat.PLAIN_TEXT) { + return clip.getItemAt(0).coerceToText(activity); } return null; } - private void setClipboardData(JSONObject data) throws JSONException { - ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE); - ClipData clip = ClipData.newPlainText("text label?", data.getString("text")); + private void setClipboardData(String text) { + ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); + ClipData clip = ClipData.newPlainText("text label?", text); clipboard.setPrimaryClip(clip); } diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index d8c2de3749195..ac5e2f8f3d995 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -9,20 +9,21 @@ import android.opengl.Matrix; import android.os.Build; import android.os.Bundle; +import android.support.annotation.NonNull; import android.util.Log; import android.view.View; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeProvider; -import io.flutter.plugin.common.BasicMessageChannel; -import io.flutter.plugin.common.StandardMessageCodec; + +import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; import io.flutter.util.Predicate; import java.nio.ByteBuffer; import java.util.*; class AccessibilityBridge - extends AccessibilityNodeProvider implements BasicMessageChannel.MessageHandler { + extends AccessibilityNodeProvider { private static final String TAG = "FlutterView"; // Constants from higher API levels. @@ -34,19 +35,42 @@ class AccessibilityBridge private static final float SCROLL_POSITION_CAP_FOR_INFINITY = 70000.0f; private static final int ROOT_NODE_ID = 0; - private Map mObjects; - private Map mCustomAccessibilityActions; - private final FlutterView mOwner; - private boolean mAccessibilityEnabled = false; - private SemanticsObject mA11yFocusedObject; - private SemanticsObject mInputFocusedObject; - private SemanticsObject mHoveredObject; + private final FlutterView owner; + private final AccessibilityChannel accessibilityChannel; + private final View decorView; + private Map objects; + private Map customAccessibilityActions; + private boolean accessibilityEnabled = false; + private SemanticsObject a11yFocusedObject; + private SemanticsObject inputFocusedObject; + private SemanticsObject hoveredObject; private int previousRouteId = ROOT_NODE_ID; private List previousRoutes; - private final View mDecorView; - private Integer mLastLeftFrameInset = 0; + private Integer lastLeftFrameInset = 0; + + private final AccessibilityChannel.AccessibilityMessageHandler accessibilityMessageHandler = new AccessibilityChannel.AccessibilityMessageHandler() { + @Override + public void announce(@NonNull String message) { + owner.announceForAccessibility(message); + } + + @Override + public void onTap(int nodeId) { + sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_CLICKED); + } - private final BasicMessageChannel mFlutterAccessibilityChannel; + @Override + public void onLongPress(int nodeId) { + sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); + } + + @Override + public void onTooltip(@NonNull String message) { + AccessibilityEvent e = obtainAccessibilityEvent(ROOT_NODE_ID, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); + e.getText().add(message); + sendAccessibilityEvent(e); + } + }; enum Action { TAP(1 << 0), @@ -106,23 +130,21 @@ enum Flag { final int value; } - AccessibilityBridge(FlutterView owner) { - assert owner != null; - mOwner = owner; - mObjects = new HashMap<>(); - mCustomAccessibilityActions = new HashMap<>(); + AccessibilityBridge(@NonNull FlutterView owner, @NonNull AccessibilityChannel accessibilityChannel) { + this.owner = owner; + this.accessibilityChannel = accessibilityChannel; + decorView = ((Activity) owner.getContext()).getWindow().getDecorView(); + objects = new HashMap<>(); + customAccessibilityActions = new HashMap<>(); previousRoutes = new ArrayList<>(); - mFlutterAccessibilityChannel = new BasicMessageChannel<>( - owner, "flutter/accessibility", StandardMessageCodec.INSTANCE); - mDecorView = ((Activity) owner.getContext()).getWindow().getDecorView(); } void setAccessibilityEnabled(boolean accessibilityEnabled) { - mAccessibilityEnabled = accessibilityEnabled; + this.accessibilityEnabled = accessibilityEnabled; if (accessibilityEnabled) { - mFlutterAccessibilityChannel.setMessageHandler(this); + this.accessibilityChannel.setAccessibilityMessageHandler(accessibilityMessageHandler); } else { - mFlutterAccessibilityChannel.setMessageHandler(null); + this.accessibilityChannel.setAccessibilityMessageHandler(null); } } @@ -137,42 +159,42 @@ private boolean shouldSetCollectionInfo(final SemanticsObject object) { // to set it if we're exiting a list to a non-list, so that we can get the "out of list" // announcement when A11y focus moves out of a list and not into another list. return object.scrollChildren > 0 - && (hasSemanticsObjectAncestor(mA11yFocusedObject, o -> o == object) - || !hasSemanticsObjectAncestor(mA11yFocusedObject, o -> o.hasFlag(Flag.HAS_IMPLICIT_SCROLLING))); + && (hasSemanticsObjectAncestor(a11yFocusedObject, o -> o == object) + || !hasSemanticsObjectAncestor(a11yFocusedObject, o -> o.hasFlag(Flag.HAS_IMPLICIT_SCROLLING))); } @Override @SuppressWarnings("deprecation") public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (virtualViewId == View.NO_ID) { - AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(mOwner); - mOwner.onInitializeAccessibilityNodeInfo(result); - if (mObjects.containsKey(ROOT_NODE_ID)) { - result.addChild(mOwner, ROOT_NODE_ID); + AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(owner); + owner.onInitializeAccessibilityNodeInfo(result); + if (objects.containsKey(ROOT_NODE_ID)) { + result.addChild(owner, ROOT_NODE_ID); } return result; } - SemanticsObject object = mObjects.get(virtualViewId); + SemanticsObject object = objects.get(virtualViewId); if (object == null) { return null; } - AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(mOwner, virtualViewId); + AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(owner, virtualViewId); // Work around for https://github.com/flutter/flutter/issues/2101 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { result.setViewIdResourceName(""); } - result.setPackageName(mOwner.getContext().getPackageName()); + result.setPackageName(owner.getContext().getPackageName()); result.setClassName("android.view.View"); - result.setSource(mOwner, virtualViewId); + result.setSource(owner, virtualViewId); result.setFocusable(object.isFocusable()); - if (mInputFocusedObject != null) { - result.setFocused(mInputFocusedObject.id == virtualViewId); + if (inputFocusedObject != null) { + result.setFocused(inputFocusedObject.id == virtualViewId); } - if (mA11yFocusedObject != null) { - result.setAccessibilityFocused(mA11yFocusedObject.id == virtualViewId); + if (a11yFocusedObject != null) { + result.setAccessibilityFocused(a11yFocusedObject.id == virtualViewId); } if (object.hasFlag(Flag.IS_TEXT_FIELD)) { @@ -186,7 +208,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { // 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) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 && a11yFocusedObject != null && a11yFocusedObject.id == virtualViewId) { result.setLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); } } @@ -239,10 +261,10 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (object.parent != null) { assert object.id > ROOT_NODE_ID; - result.setParent(mOwner, object.parent.id); + result.setParent(owner, object.parent.id); } else { assert object.id == ROOT_NODE_ID; - result.setParent(mOwner); + result.setParent(owner); } Rect bounds = object.getGlobalRect(); @@ -362,7 +384,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { result.setSelected(object.hasFlag(Flag.IS_SELECTED)); // Accessibility Focus - if (mA11yFocusedObject != null && mA11yFocusedObject.id == virtualViewId) { + if (a11yFocusedObject != null && a11yFocusedObject.id == virtualViewId) { result.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } else { result.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); @@ -381,7 +403,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (object.childrenInTraversalOrder != null) { for (SemanticsObject child : object.childrenInTraversalOrder) { if (!child.hasFlag(Flag.IS_HIDDEN)) { - result.addChild(mOwner, child.id); + result.addChild(owner, child.id); } } } @@ -391,7 +413,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { @Override public boolean performAction(int virtualViewId, int action, Bundle arguments) { - SemanticsObject object = mObjects.get(virtualViewId); + SemanticsObject object = objects.get(virtualViewId); if (object == null) { return false; } @@ -400,27 +422,27 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { // Note: TalkBack prior to Oreo doesn't use this handler and instead simulates a // click event at the center of the SemanticsNode. Other a11y services might go // through this handler though. - mOwner.dispatchSemanticsAction(virtualViewId, Action.TAP); + owner.dispatchSemanticsAction(virtualViewId, Action.TAP); return true; } case AccessibilityNodeInfo.ACTION_LONG_CLICK: { // Note: TalkBack doesn't use this handler and instead simulates a long click event // at the center of the SemanticsNode. Other a11y services might go through this // handler though. - mOwner.dispatchSemanticsAction(virtualViewId, Action.LONG_PRESS); + owner.dispatchSemanticsAction(virtualViewId, Action.LONG_PRESS); return true; } case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: { if (object.hasAction(Action.SCROLL_UP)) { - mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_UP); + owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_UP); } else if (object.hasAction(Action.SCROLL_LEFT)) { // TODO(ianh): bidi support using textDirection - mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_LEFT); + owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_LEFT); } else if (object.hasAction(Action.INCREASE)) { object.value = object.increasedValue; // Event causes Android to read out the updated value. sendAccessibilityEvent(virtualViewId, AccessibilityEvent.TYPE_VIEW_SELECTED); - mOwner.dispatchSemanticsAction(virtualViewId, Action.INCREASE); + owner.dispatchSemanticsAction(virtualViewId, Action.INCREASE); } else { return false; } @@ -428,15 +450,15 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { } case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: { if (object.hasAction(Action.SCROLL_DOWN)) { - mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_DOWN); + owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_DOWN); } else if (object.hasAction(Action.SCROLL_RIGHT)) { // TODO(ianh): bidi support using textDirection - mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_RIGHT); + owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_RIGHT); } else if (object.hasAction(Action.DECREASE)) { object.value = object.decreasedValue; // Event causes Android to read out the updated value. sendAccessibilityEvent(virtualViewId, AccessibilityEvent.TYPE_VIEW_SELECTED); - mOwner.dispatchSemanticsAction(virtualViewId, Action.DECREASE); + owner.dispatchSemanticsAction(virtualViewId, Action.DECREASE); } else { return false; } @@ -449,24 +471,24 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { return performCursorMoveAction(object, virtualViewId, arguments, true); } case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.DID_LOSE_ACCESSIBILITY_FOCUS); + owner.dispatchSemanticsAction(virtualViewId, Action.DID_LOSE_ACCESSIBILITY_FOCUS); sendAccessibilityEvent( virtualViewId, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - mA11yFocusedObject = null; + a11yFocusedObject = null; return true; } case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.DID_GAIN_ACCESSIBILITY_FOCUS); + owner.dispatchSemanticsAction(virtualViewId, Action.DID_GAIN_ACCESSIBILITY_FOCUS); sendAccessibilityEvent( virtualViewId, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED); - if (mA11yFocusedObject == null) { + if (a11yFocusedObject == null) { // When Android focuses a node, it doesn't invalidate the view. // (It does when it sends ACTION_CLEAR_ACCESSIBILITY_FOCUS, so // we only have to worry about this when the focused node is null.) - mOwner.invalidate(); + owner.invalidate(); } - mA11yFocusedObject = object; + a11yFocusedObject = object; if (object.hasAction(Action.INCREASE) || object.hasAction(Action.DECREASE)) { // SeekBars only announce themselves after this event. @@ -476,7 +498,7 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { return true; } case ACTION_SHOW_ON_SCREEN: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.SHOW_ON_SCREEN); + owner.dispatchSemanticsAction(virtualViewId, Action.SHOW_ON_SCREEN); return true; } case AccessibilityNodeInfo.ACTION_SET_SELECTION: { @@ -498,32 +520,32 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { selection.put("base", object.textSelectionExtent); selection.put("extent", object.textSelectionExtent); } - mOwner.dispatchSemanticsAction(virtualViewId, Action.SET_SELECTION, selection); + owner.dispatchSemanticsAction(virtualViewId, Action.SET_SELECTION, selection); return true; } case AccessibilityNodeInfo.ACTION_COPY: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.COPY); + owner.dispatchSemanticsAction(virtualViewId, Action.COPY); return true; } case AccessibilityNodeInfo.ACTION_CUT: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.CUT); + owner.dispatchSemanticsAction(virtualViewId, Action.CUT); return true; } case AccessibilityNodeInfo.ACTION_PASTE: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.PASTE); + owner.dispatchSemanticsAction(virtualViewId, Action.PASTE); return true; } case AccessibilityNodeInfo.ACTION_DISMISS: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.DISMISS); + owner.dispatchSemanticsAction(virtualViewId, Action.DISMISS); return true; } default: // might be a custom accessibility action. final int flutterId = action - firstResourceId; CustomAccessibilityAction contextAction = - mCustomAccessibilityActions.get(flutterId); + customAccessibilityActions.get(flutterId); if (contextAction != null) { - mOwner.dispatchSemanticsAction( + owner.dispatchSemanticsAction( virtualViewId, Action.CUSTOM_ACTION, contextAction.id); return true; } @@ -540,12 +562,12 @@ boolean performCursorMoveAction( switch (granularity) { case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER: { if (forward && object.hasAction(Action.MOVE_CURSOR_FORWARD_BY_CHARACTER)) { - mOwner.dispatchSemanticsAction(virtualViewId, + owner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_FORWARD_BY_CHARACTER, extendSelection); return true; } if (!forward && object.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER)) { - mOwner.dispatchSemanticsAction(virtualViewId, + owner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER, extendSelection); return true; } @@ -553,12 +575,12 @@ boolean performCursorMoveAction( } case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD: if (forward && object.hasAction(Action.MOVE_CURSOR_FORWARD_BY_WORD)) { - mOwner.dispatchSemanticsAction(virtualViewId, + owner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_FORWARD_BY_WORD, extendSelection); return true; } if (!forward && object.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_WORD)) { - mOwner.dispatchSemanticsAction(virtualViewId, + owner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_BACKWARD_BY_WORD, extendSelection); return true; } @@ -573,65 +595,65 @@ boolean performCursorMoveAction( public AccessibilityNodeInfo findFocus(int focus) { switch (focus) { case AccessibilityNodeInfo.FOCUS_INPUT: { - if (mInputFocusedObject != null) - return createAccessibilityNodeInfo(mInputFocusedObject.id); + if (inputFocusedObject != null) + return createAccessibilityNodeInfo(inputFocusedObject.id); } // Fall through to check FOCUS_ACCESSIBILITY case AccessibilityNodeInfo.FOCUS_ACCESSIBILITY: { - if (mA11yFocusedObject != null) - return createAccessibilityNodeInfo(mA11yFocusedObject.id); + if (a11yFocusedObject != null) + return createAccessibilityNodeInfo(a11yFocusedObject.id); } } return null; } private SemanticsObject getRootObject() { - assert mObjects.containsKey(0); - return mObjects.get(0); + assert objects.containsKey(0); + return objects.get(0); } private SemanticsObject getOrCreateObject(int id) { - SemanticsObject object = mObjects.get(id); + SemanticsObject object = objects.get(id); if (object == null) { object = new SemanticsObject(); object.id = id; - mObjects.put(id, object); + objects.put(id, object); } return object; } private CustomAccessibilityAction getOrCreateAction(int id) { - CustomAccessibilityAction action = mCustomAccessibilityActions.get(id); + CustomAccessibilityAction action = customAccessibilityActions.get(id); if (action == null) { action = new CustomAccessibilityAction(); action.id = id; action.resourceId = id + firstResourceId; - mCustomAccessibilityActions.put(id, action); + customAccessibilityActions.put(id, action); } return action; } void handleTouchExplorationExit() { - if (mHoveredObject != null) { - sendAccessibilityEvent(mHoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); - mHoveredObject = null; + if (hoveredObject != null) { + sendAccessibilityEvent(hoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); + hoveredObject = null; } } void handleTouchExploration(float x, float y) { - if (mObjects.isEmpty()) { + if (objects.isEmpty()) { return; } SemanticsObject newObject = getRootObject().hitTest(new float[] {x, y, 0, 1}); - if (newObject != mHoveredObject) { + if (newObject != hoveredObject) { // sending ENTER before EXIT is how Android wants it if (newObject != null) { sendAccessibilityEvent(newObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_ENTER); } - if (mHoveredObject != null) { - sendAccessibilityEvent(mHoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); + if (hoveredObject != null) { + sendAccessibilityEvent(hoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); } - mHoveredObject = newObject; + hoveredObject = newObject; } } @@ -657,7 +679,7 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { continue; } if (object.hasFlag(Flag.IS_FOCUSED)) { - mInputFocusedObject = object; + inputFocusedObject = object; } if (object.hadPreviousConfig) { updated.add(object); @@ -675,12 +697,12 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { // a11y nodes. if (Build.VERSION.SDK_INT >= 23) { Rect visibleFrame = new Rect(); - mDecorView.getWindowVisibleDisplayFrame(visibleFrame); - if (!mLastLeftFrameInset.equals(visibleFrame.left)) { + decorView.getWindowVisibleDisplayFrame(visibleFrame); + if (!lastLeftFrameInset.equals(visibleFrame.left)) { rootObject.globalGeometryDirty = true; rootObject.inverseTransformDirty = true; } - mLastLeftFrameInset = visibleFrame.left; + lastLeftFrameInset = visibleFrame.left; Matrix.translateM(identity, 0, visibleFrame.left, 0, 0); } rootObject.updateRecursively(identity, visitedObjects, false); @@ -707,7 +729,7 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { previousRoutes.add(semanticsObject.id); } - Iterator> it = mObjects.entrySet().iterator(); + Iterator> it = objects.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = it.next(); SemanticsObject object = entry.getValue(); @@ -787,25 +809,25 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } } else if (object.hasFlag(Flag.IS_TEXT_FIELD) && object.didChangeLabel() - && mInputFocusedObject != null && mInputFocusedObject.id == object.id) { + && inputFocusedObject != null && inputFocusedObject.id == object.id) { // Text fields should announce when their label changes while focused. We use a live // region tag to do so, and this event triggers that update. sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } - if (mA11yFocusedObject != null && mA11yFocusedObject.id == object.id + if (a11yFocusedObject != null && a11yFocusedObject.id == object.id && !object.hadFlag(Flag.IS_SELECTED) && object.hasFlag(Flag.IS_SELECTED)) { AccessibilityEvent event = obtainAccessibilityEvent(object.id, AccessibilityEvent.TYPE_VIEW_SELECTED); event.getText().add(object.label); sendAccessibilityEvent(event); } - if (mInputFocusedObject != null && mInputFocusedObject.id == object.id + if (inputFocusedObject != null && inputFocusedObject.id == object.id && 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))) { + && (a11yFocusedObject == null || (a11yFocusedObject.id == inputFocusedObject.id))) { String oldValue = object.previousValue != null ? object.previousValue : ""; String newValue = object.value != null ? object.value : ""; AccessibilityEvent event = createTextChangedEvent(object.id, oldValue, newValue); @@ -863,65 +885,27 @@ private AccessibilityEvent createTextChangedEvent(int id, String oldValue, Strin private AccessibilityEvent obtainAccessibilityEvent(int virtualViewId, int eventType) { assert virtualViewId != ROOT_NODE_ID; AccessibilityEvent event = AccessibilityEvent.obtain(eventType); - event.setPackageName(mOwner.getContext().getPackageName()); - event.setSource(mOwner, virtualViewId); + event.setPackageName(owner.getContext().getPackageName()); + event.setSource(owner, virtualViewId); return event; } private void sendAccessibilityEvent(int virtualViewId, int eventType) { - if (!mAccessibilityEnabled) { + if (!accessibilityEnabled) { return; } if (virtualViewId == ROOT_NODE_ID) { - mOwner.sendAccessibilityEvent(eventType); + owner.sendAccessibilityEvent(eventType); } else { sendAccessibilityEvent(obtainAccessibilityEvent(virtualViewId, eventType)); } } private void sendAccessibilityEvent(AccessibilityEvent event) { - if (!mAccessibilityEnabled) { + if (!accessibilityEnabled) { return; } - mOwner.getParent().requestSendAccessibilityEvent(mOwner, event); - } - - // Message Handler for [mFlutterAccessibilityChannel]. - public void onMessage(Object message, BasicMessageChannel.Reply reply) { - @SuppressWarnings("unchecked") - final HashMap annotatedEvent = (HashMap) message; - final String type = (String) annotatedEvent.get("type"); - @SuppressWarnings("unchecked") - final HashMap data = (HashMap) annotatedEvent.get("data"); - - switch (type) { - case "announce": - mOwner.announceForAccessibility((String) data.get("message")); - break; - case "longPress": { - Integer nodeId = (Integer) annotatedEvent.get("nodeId"); - if (nodeId == null) { - return; - } - sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); - break; - } - case "tap": { - Integer nodeId = (Integer) annotatedEvent.get("nodeId"); - if (nodeId == null) { - return; - } - sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_CLICKED); - break; - } - case "tooltip": { - AccessibilityEvent e = obtainAccessibilityEvent( - ROOT_NODE_ID, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); - e.getText().add((String) data.get("message")); - sendAccessibilityEvent(e); - break; - } - } + owner.getParent().requestSendAccessibilityEvent(owner, event); } private void createWindowChangeEvent(SemanticsObject route) { @@ -933,29 +917,29 @@ private void createWindowChangeEvent(SemanticsObject route) { } private void willRemoveSemanticsObject(SemanticsObject object) { - assert mObjects.containsKey(object.id); - assert mObjects.get(object.id) == object; + assert objects.containsKey(object.id); + assert objects.get(object.id) == object; object.parent = null; - if (mA11yFocusedObject == object) { - sendAccessibilityEvent(mA11yFocusedObject.id, + if (a11yFocusedObject == object) { + sendAccessibilityEvent(a11yFocusedObject.id, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - mA11yFocusedObject = null; + a11yFocusedObject = null; } - if (mInputFocusedObject == object) { - mInputFocusedObject = null; + if (inputFocusedObject == object) { + inputFocusedObject = null; } - if (mHoveredObject == object) { - mHoveredObject = null; + if (hoveredObject == object) { + hoveredObject = null; } } void reset() { - mObjects.clear(); - if (mA11yFocusedObject != null) - sendAccessibilityEvent(mA11yFocusedObject.id, + objects.clear(); + if (a11yFocusedObject != null) + sendAccessibilityEvent(a11yFocusedObject.id, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - mA11yFocusedObject = null; - mHoveredObject = null; + a11yFocusedObject = null; + hoveredObject = null; sendAccessibilityEvent(0, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index c6927a3245711..b76c1fee832f7 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -15,6 +15,7 @@ import android.net.Uri; import android.os.Build; import android.os.Handler; +import android.os.LocaleList; import android.provider.Settings; import android.text.format.DateFormat; import android.util.AttributeSet; @@ -29,17 +30,18 @@ import io.flutter.embedding.engine.FlutterJNI; import io.flutter.embedding.engine.android.AndroidKeyProcessor; import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; import io.flutter.embedding.engine.systemchannels.KeyEventChannel; import io.flutter.embedding.engine.systemchannels.LifecycleChannel; +import io.flutter.embedding.engine.systemchannels.LocalizationChannel; import io.flutter.embedding.engine.systemchannels.NavigationChannel; +import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.embedding.engine.systemchannels.SettingsChannel; import io.flutter.embedding.engine.systemchannels.SystemChannel; import io.flutter.plugin.common.*; import io.flutter.plugin.editing.TextInputPlugin; import io.flutter.plugin.platform.PlatformPlugin; -import org.json.JSONException; -import java.lang.reflect.Method; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.*; @@ -87,18 +89,21 @@ static final class ViewportMetrics { } private final DartExecutor dartExecutor; + private final AccessibilityChannel accessibilityChannel; private final NavigationChannel navigationChannel; private final KeyEventChannel keyEventChannel; private final LifecycleChannel lifecycleChannel; + private final LocalizationChannel localizationChannel; + private final PlatformChannel platformChannel; private final SettingsChannel settingsChannel; private final SystemChannel systemChannel; private final InputMethodManager mImm; private final TextInputPlugin mTextInputPlugin; private final AndroidKeyProcessor androidKeyProcessor; + private AccessibilityBridge mAccessibilityNodeProvider; private final SurfaceHolder.Callback mSurfaceCallback; private final ViewportMetrics mMetrics; private final AccessibilityManager mAccessibilityManager; - private final MethodChannel mFlutterLocalizationChannel; private final List mActivityLifecycleListeners; private final List mFirstFrameListeners; private final AtomicLong nextTextureId = new AtomicLong(0L); @@ -160,23 +165,25 @@ public void surfaceDestroyed(SurfaceHolder holder) { mActivityLifecycleListeners = new ArrayList<>(); mFirstFrameListeners = new ArrayList<>(); - // Configure the platform plugins and flutter channels. + // Create all platform channels + accessibilityChannel = new AccessibilityChannel(dartExecutor); navigationChannel = new NavigationChannel(dartExecutor); keyEventChannel = new KeyEventChannel(dartExecutor); lifecycleChannel = new LifecycleChannel(dartExecutor); + localizationChannel = new LocalizationChannel(dartExecutor); + platformChannel = new PlatformChannel(dartExecutor); systemChannel = new SystemChannel(dartExecutor); settingsChannel = new SettingsChannel(dartExecutor); - mFlutterLocalizationChannel = new MethodChannel(this, "flutter/localization", JSONMethodCodec.INSTANCE); - PlatformPlugin platformPlugin = new PlatformPlugin(activity); - MethodChannel flutterPlatformChannel = new MethodChannel(this, "flutter/platform", JSONMethodCodec.INSTANCE); - flutterPlatformChannel.setMethodCallHandler(platformPlugin); + // Create and setup plugins + PlatformPlugin platformPlugin = new PlatformPlugin(activity, platformChannel); addActivityLifecycleListener(platformPlugin); mImm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - mTextInputPlugin = new TextInputPlugin(this); + mTextInputPlugin = new TextInputPlugin(this, dartExecutor); androidKeyProcessor = new AndroidKeyProcessor(keyEventChannel); - setLocales(getResources().getConfiguration()); + // Send initial platform information to Dart + sendLocalesToDart(getResources().getConfiguration()); sendUserPlatformSettingsToDart(); } @@ -311,39 +318,21 @@ private void sendUserPlatformSettingsToDart() { .send(); } - 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. - } + private void sendLocalesToDart(Configuration config) { + LocaleList localeList = config.getLocales(); + int localeCount = localeList.size(); + List locales = new ArrayList<>(); + for (int index = 0; index < localeCount; ++index) { + Locale locale = localeList.get(index); + locales.add(locale); } - // Fallback single locale passing for android API < 24. Should work always. - @SuppressWarnings("deprecation") - 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())); + localizationChannel.sendLocales(locales); } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); - setLocales(newConfig); + sendLocalesToDart(newConfig); sendUserPlatformSettingsToDart(); } @@ -374,13 +363,7 @@ public void destroy() { @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { - try { - mLastInputConnection = mTextInputPlugin.createInputConnection(this, outAttrs); - return mLastInputConnection; - } catch (JSONException e) { - Log.e(TAG, "Failed to create input connection", e); - return null; - } + return mTextInputPlugin.createInputConnection(this, outAttrs); } // Must match the PointerChange enum in pointer.dart. @@ -1006,14 +989,12 @@ public AccessibilityNodeProvider getAccessibilityNodeProvider() { return null; } - private AccessibilityBridge mAccessibilityNodeProvider; - void ensureAccessibilityEnabled() { if (!isAttached()) return; mAccessibilityEnabled = true; if (mAccessibilityNodeProvider == null) { - mAccessibilityNodeProvider = new AccessibilityBridge(this); + mAccessibilityNodeProvider = new AccessibilityBridge(this, accessibilityChannel); } mNativeView.getFlutterJNI().setSemanticsEnabled(true); mAccessibilityNodeProvider.setAccessibilityEnabled(true); From 572fea361c00d9007640857445f078d20a52525d Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 19 Feb 2019 16:14:18 -0800 Subject: [PATCH 0211/1117] Revert "Shut down and restart the Dart VM as needed. (#7832)" (#7877) This reverts commit 0d6ff1669c4a765774b91e37353b4392408d112a. --- ci/licenses_golden/licenses_flutter | 4 - .../isolate_name_server_natives.cc | 18 +- lib/ui/ui_dart_state.cc | 6 +- lib/ui/ui_dart_state.h | 6 +- runtime/BUILD.gn | 9 +- runtime/dart_isolate.cc | 100 ++++++----- runtime/dart_isolate.h | 26 +-- runtime/dart_isolate_unittests.cc | 115 ++++++------- runtime/dart_vm.cc | 156 ++++++++++-------- runtime/dart_vm.h | 58 ++++--- runtime/dart_vm_data.cc | 79 --------- runtime/dart_vm_data.h | 47 ------ runtime/dart_vm_lifecycle.cc | 112 ------------- runtime/dart_vm_lifecycle.h | 72 -------- runtime/dart_vm_unittests.cc | 104 +----------- runtime/runtime_controller.cc | 10 +- runtime/runtime_controller.h | 12 +- shell/common/engine.cc | 4 +- shell/common/engine.h | 4 +- shell/common/shell.cc | 88 ++++------ shell/common/shell.h | 21 +-- testing/testing.cc | 4 +- testing/testing.h | 4 - 23 files changed, 319 insertions(+), 740 deletions(-) delete mode 100644 runtime/dart_vm_data.cc delete mode 100644 runtime/dart_vm_data.h delete mode 100644 runtime/dart_vm_lifecycle.cc delete mode 100644 runtime/dart_vm_lifecycle.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index fd2a6ae0ec841..39c7d860100c5 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -355,10 +355,6 @@ FILE: ../../../flutter/runtime/dart_snapshot_buffer.cc FILE: ../../../flutter/runtime/dart_snapshot_buffer.h FILE: ../../../flutter/runtime/dart_vm.cc FILE: ../../../flutter/runtime/dart_vm.h -FILE: ../../../flutter/runtime/dart_vm_data.cc -FILE: ../../../flutter/runtime/dart_vm_data.h -FILE: ../../../flutter/runtime/dart_vm_lifecycle.cc -FILE: ../../../flutter/runtime/dart_vm_lifecycle.h FILE: ../../../flutter/runtime/dart_vm_unittests.cc FILE: ../../../flutter/runtime/embedder_resources.cc FILE: ../../../flutter/runtime/embedder_resources.h 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 3f7f80ef05fd7..7f4467886f4fa 100644 --- a/lib/ui/isolate_name_server/isolate_name_server_natives.cc +++ b/lib/ui/isolate_name_server/isolate_name_server_natives.cc @@ -14,10 +14,8 @@ namespace blink { Dart_Handle IsolateNameServerNatives::LookupPortByName( const std::string& name) { - auto name_server = UIDartState::Current()->GetIsolateNameServer(); - if (!name_server) { - return Dart_Null(); - } + IsolateNameServer* name_server = + UIDartState::Current()->GetIsolateNameServer(); Dart_Port port = name_server->LookupIsolatePortByName(name); if (port == ILLEGAL_PORT) { return Dart_Null(); @@ -28,10 +26,8 @@ Dart_Handle IsolateNameServerNatives::LookupPortByName( Dart_Handle IsolateNameServerNatives::RegisterPortWithName( Dart_Handle port_handle, const std::string& name) { - auto name_server = UIDartState::Current()->GetIsolateNameServer(); - if (!name_server) { - return Dart_False(); - } + IsolateNameServer* name_server = + UIDartState::Current()->GetIsolateNameServer(); Dart_Port port = ILLEGAL_PORT; Dart_SendPortGetId(port_handle, &port); if (!name_server->RegisterIsolatePortWithName(port, name)) { @@ -42,10 +38,8 @@ Dart_Handle IsolateNameServerNatives::RegisterPortWithName( Dart_Handle IsolateNameServerNatives::RemovePortNameMapping( const std::string& name) { - auto name_server = UIDartState::Current()->GetIsolateNameServer(); - if (!name_server) { - return Dart_False(); - } + IsolateNameServer* name_server = + UIDartState::Current()->GetIsolateNameServer(); if (!name_server->RemoveIsolateNameMapping(name)) { return Dart_False(); } diff --git a/lib/ui/ui_dart_state.cc b/lib/ui/ui_dart_state.cc index be0a5348f31a1..b42cbaf5ba607 100644 --- a/lib/ui/ui_dart_state.cc +++ b/lib/ui/ui_dart_state.cc @@ -23,7 +23,7 @@ UIDartState::UIDartState( std::string advisory_script_entrypoint, std::string logger_prefix, UnhandledExceptionCallback unhandled_exception_callback, - std::shared_ptr isolate_name_server) + IsolateNameServer* isolate_name_server) : task_runners_(std::move(task_runners)), add_callback_(std::move(add_callback)), remove_callback_(std::move(remove_callback)), @@ -33,7 +33,7 @@ UIDartState::UIDartState( advisory_script_entrypoint_(std::move(advisory_script_entrypoint)), logger_prefix_(std::move(logger_prefix)), unhandled_exception_callback_(unhandled_exception_callback), - isolate_name_server_(std::move(isolate_name_server)) { + isolate_name_server_(isolate_name_server) { AddOrRemoveTaskObserver(true /* add */); } @@ -124,7 +124,7 @@ fml::WeakPtr UIDartState::GetResourceContext() const { return io_manager_->GetResourceContext(); } -std::shared_ptr UIDartState::GetIsolateNameServer() const { +IsolateNameServer* UIDartState::GetIsolateNameServer() { return isolate_name_server_; } diff --git a/lib/ui/ui_dart_state.h b/lib/ui/ui_dart_state.h index afa5e47e83de8..f2c63cbacef60 100644 --- a/lib/ui/ui_dart_state.h +++ b/lib/ui/ui_dart_state.h @@ -53,7 +53,7 @@ class UIDartState : public tonic::DartState { fml::WeakPtr GetResourceContext() const; - std::shared_ptr GetIsolateNameServer() const; + IsolateNameServer* GetIsolateNameServer(); tonic::DartErrorHandleType GetLastError(); @@ -81,7 +81,7 @@ class UIDartState : public tonic::DartState { std::string advisory_script_entrypoint, std::string logger_prefix, UnhandledExceptionCallback unhandled_exception_callback, - std::shared_ptr isolate_name_server); + IsolateNameServer* isolate_name_server); ~UIDartState() override; @@ -107,7 +107,7 @@ class UIDartState : public tonic::DartState { std::unique_ptr window_; tonic::DartMicrotaskQueue microtask_queue_; UnhandledExceptionCallback unhandled_exception_callback_; - const std::shared_ptr isolate_name_server_; + IsolateNameServer* isolate_name_server_; void AddOrRemoveTaskObserver(bool add); }; diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index 5619851dfee99..5df979ed689a9 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -36,10 +36,6 @@ source_set("runtime") { "dart_snapshot_buffer.h", "dart_vm.cc", "dart_vm.h", - "dart_vm_data.cc", - "dart_vm_data.h", - "dart_vm_lifecycle.cc", - "dart_vm_lifecycle.h", "embedder_resources.cc", "embedder_resources.h", "runtime_controller.cc", @@ -77,9 +73,7 @@ source_set("runtime") { flutter_runtime_mode != "dynamic_release" && !is_fuchsia) { # Only link in Observatory in non-release modes on non-Fuchsia. Fuchsia # instead puts Observatory into the runner's package. - deps += [ - "//third_party/dart/runtime/observatory:embedded_observatory_archive", - ] + deps += [ "//third_party/dart/runtime/observatory:embedded_observatory_archive" ] } } @@ -101,7 +95,6 @@ executable("runtime_unittests") { ":runtime_fixtures", "$flutter_root/fml", "$flutter_root/lib/snapshot", - "$flutter_root/shell/common", "$flutter_root/testing", "//third_party/dart/runtime:libdart_jit", "//third_party/skia", diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 77e55afd69bba..4340ccdc3918c 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -14,7 +14,6 @@ #include "flutter/lib/ui/dart_ui.h" #include "flutter/runtime/dart_service_isolate.h" #include "flutter/runtime/dart_vm.h" -#include "flutter/runtime/dart_vm_lifecycle.h" #include "third_party/dart/runtime/include/dart_api.h" #include "third_party/dart/runtime/include/dart_tools_api.h" #include "third_party/tonic/converter/dart_converter.h" @@ -30,9 +29,9 @@ namespace blink { std::weak_ptr DartIsolate::CreateRootIsolate( - const Settings& settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + DartVM* vm, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, TaskRunners task_runners, std::unique_ptr window, fml::WeakPtr snapshot_delegate, @@ -51,7 +50,7 @@ std::weak_ptr DartIsolate::CreateRootIsolate( // isolate lifecycle is entirely managed by the VM). auto root_embedder_data = std::make_unique>( std::make_shared( - settings, // settings + vm, // VM std::move(isolate_snapshot), // isolate snapshot std::move(shared_snapshot), // shared snapshot task_runners, // task runners @@ -94,9 +93,9 @@ std::weak_ptr DartIsolate::CreateRootIsolate( return embedder_isolate; } -DartIsolate::DartIsolate(const Settings& settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, +DartIsolate::DartIsolate(DartVM* vm, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, TaskRunners task_runners, fml::WeakPtr snapshot_delegate, fml::WeakPtr io_manager, @@ -104,33 +103,38 @@ DartIsolate::DartIsolate(const Settings& settings, std::string advisory_script_entrypoint, ChildIsolatePreparer child_isolate_preparer) : UIDartState(std::move(task_runners), - settings.task_observer_add, - settings.task_observer_remove, + vm->GetSettings().task_observer_add, + vm->GetSettings().task_observer_remove, std::move(snapshot_delegate), std::move(io_manager), advisory_script_uri, advisory_script_entrypoint, - settings.log_tag, - settings.unhandled_exception_callback, - DartVMRef::GetIsolateNameServer()), - settings_(settings), + vm->GetSettings().log_tag, + vm->GetSettings().unhandled_exception_callback, + vm->GetIsolateNameServer()), + vm_(vm), isolate_snapshot_(std::move(isolate_snapshot)), shared_snapshot_(std::move(shared_snapshot)), child_isolate_preparer_(std::move(child_isolate_preparer)) { FML_DCHECK(isolate_snapshot_) << "Must contain a valid isolate snapshot."; + + if (vm_ == nullptr) { + return; + } + phase_ = Phase::Uninitialized; } DartIsolate::~DartIsolate() = default; -const Settings& DartIsolate::GetSettings() const { - return settings_; -} - DartIsolate::Phase DartIsolate::GetPhase() const { return phase_; } +DartVM* DartIsolate::GetDartVM() const { + return vm_; +} + bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) { TRACE_EVENT0("flutter", "DartIsolate::Initialize"); if (phase_ != Phase::Uninitialized) { @@ -489,16 +493,16 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( const char* package_config, Dart_IsolateFlags* flags, char** error) { - auto vm_data = DartVMRef::GetVMData(); + auto vm = DartVM::ForProcessIfInitialized(); - if (!vm_data) { + if (!vm) { *error = strdup( - "Could not access VM data to initialize isolates. This may be because " - "the VM has initialized shutdown on another thread already."); + "Could not resolve the VM when attempting to create the service " + "isolate."); return nullptr; } - const auto& settings = vm_data->GetSettings(); + const auto& settings = vm->GetSettings(); if (!settings.enable_observatory) { FML_DLOG(INFO) << "Observatory is disabled."; @@ -511,26 +515,21 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( flags->load_vmservice_library = true; - if (advisory_script_uri == nullptr) { - advisory_script_uri = ""; - } - - if (advisory_script_entrypoint == nullptr) { - advisory_script_entrypoint = ""; - } - std::weak_ptr weak_service_isolate = DartIsolate::CreateRootIsolate( - vm_data->GetSettings(), // settings - vm_data->GetIsolateSnapshot(), // service isolate snapshot - vm_data->GetSharedSnapshot(), // shared snapshot - null_task_runners, // service isolate task runners - nullptr, // window - {}, // snapshot delegate - {}, // IO Manager - advisory_script_uri, // script uri - advisory_script_entrypoint, // script entrypoint - flags // flags + vm.get(), // vm + vm->GetIsolateSnapshot(), // isolate snapshot + vm->GetSharedSnapshot(), // shared snapshot + null_task_runners, // task runners + nullptr, // window + {}, // snapshot delegate + {}, // IO Manager + advisory_script_uri == nullptr ? "" + : advisory_script_uri, // script uri + advisory_script_entrypoint == nullptr + ? "" + : advisory_script_entrypoint, // script entrypoint + flags // flags ); std::shared_ptr service_isolate = weak_service_isolate.lock(); @@ -553,13 +552,7 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( return nullptr; } - if (auto service_protocol = DartVMRef::GetServiceProtocol()) { - service_protocol->ToggleHooks(true); - } else { - FML_DLOG(ERROR) - << "Could not acquire the service protocol handlers. This might be " - "because the VM has already begun teardown on another thread."; - } + vm->GetServiceProtocol().ToggleHooks(true); return service_isolate->isolate(); } @@ -617,13 +610,16 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( std::unique_ptr> embedder_isolate( p_parent_embedder_isolate); - if (embedder_isolate == nullptr) { + if (embedder_isolate == nullptr || + (*embedder_isolate)->GetDartVM() == nullptr) { *error = strdup("Parent isolate did not have embedder specific callback data."); FML_DLOG(ERROR) << *error; return {nullptr, {}}; } + DartVM* const vm = (*embedder_isolate)->GetDartVM(); + if (!is_root_isolate) { auto* raw_embedder_isolate = embedder_isolate.release(); @@ -632,7 +628,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( embedder_isolate = std::make_unique>( std::make_shared( - (*raw_embedder_isolate)->GetSettings(), // settings + vm, // vm (*raw_embedder_isolate)->GetIsolateSnapshot(), // isolate_snapshot (*raw_embedder_isolate)->GetSharedSnapshot(), // shared_snapshot null_task_runners, // task_runners @@ -705,11 +701,11 @@ void DartIsolate::DartIsolateCleanupCallback( delete embedder_isolate; } -fml::RefPtr DartIsolate::GetIsolateSnapshot() const { +fml::RefPtr DartIsolate::GetIsolateSnapshot() const { return isolate_snapshot_; } -fml::RefPtr DartIsolate::GetSharedSnapshot() const { +fml::RefPtr DartIsolate::GetSharedSnapshot() const { return shared_snapshot_; } diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index 31a0ca9c99df4..bcd90a80d112a 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -41,9 +41,9 @@ class DartIsolate : public UIDartState { // bindings. From the VM's perspective, this isolate is not special in any // way. static std::weak_ptr CreateRootIsolate( - const Settings& settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + DartVM* vm, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, TaskRunners task_runners, std::unique_ptr window, fml::WeakPtr snapshot_delegate, @@ -52,9 +52,9 @@ class DartIsolate : public UIDartState { std::string advisory_script_entrypoint, Dart_IsolateFlags* flags = nullptr); - DartIsolate(const Settings& settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + DartIsolate(DartVM* vm, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, TaskRunners task_runners, fml::WeakPtr snapshot_delegate, fml::WeakPtr io_manager, @@ -64,8 +64,6 @@ class DartIsolate : public UIDartState { ~DartIsolate() override; - const Settings& GetSettings() const; - Phase GetPhase() const; FML_WARN_UNUSED_RESULT @@ -87,9 +85,11 @@ class DartIsolate : public UIDartState { void AddIsolateShutdownCallback(fml::closure closure); - fml::RefPtr GetIsolateSnapshot() const; + DartVM* GetDartVM() const; + + fml::RefPtr GetIsolateSnapshot() const; - fml::RefPtr GetSharedSnapshot() const; + fml::RefPtr GetSharedSnapshot() const; std::weak_ptr GetWeakIsolatePtr(); @@ -108,10 +108,10 @@ class DartIsolate : public UIDartState { }; friend class DartVM; + DartVM* const vm_ = nullptr; Phase phase_ = Phase::Unknown; - const Settings settings_; - const fml::RefPtr isolate_snapshot_; - const fml::RefPtr shared_snapshot_; + const fml::RefPtr isolate_snapshot_; + const fml::RefPtr shared_snapshot_; std::vector> kernel_buffers_; std::vector> shutdown_callbacks_; ChildIsolatePreparer child_isolate_preparer_ = nullptr; diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc index 1ebb335be0817..ab6c29617ecf3 100644 --- a/runtime/dart_isolate_unittests.cc +++ b/runtime/dart_isolate_unittests.cc @@ -7,11 +7,15 @@ #include "flutter/fml/thread.h" #include "flutter/runtime/dart_isolate.h" #include "flutter/runtime/dart_vm.h" -#include "flutter/runtime/dart_vm_lifecycle.h" #include "flutter/testing/testing.h" #include "flutter/testing/thread_test.h" #include "third_party/tonic/scopes/dart_isolate_scope.h" +#define CURRENT_TEST_NAME \ + std::string { \ + ::testing::UnitTest::GetInstance()->current_test_info()->name() \ + } + namespace blink { using DartIsolateTest = ::testing::ThreadTest; @@ -20,26 +24,24 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) { Settings settings = {}; settings.task_observer_add = [](intptr_t, fml::closure) {}; settings.task_observer_remove = [](intptr_t) {}; - auto vm = DartVMRef::Create(settings); + auto vm = DartVM::ForProcess(settings); ASSERT_TRUE(vm); - auto vm_data = vm->GetVMData(); - ASSERT_TRUE(vm_data); - TaskRunners task_runners(testing::GetCurrentTestName(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner() // + TaskRunners task_runners(CURRENT_TEST_NAME, // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner() // ); auto weak_isolate = DartIsolate::CreateRootIsolate( - vm_data->GetSettings(), // settings - vm_data->GetIsolateSnapshot(), // isolate snapshot - vm_data->GetSharedSnapshot(), // shared snapshot - std::move(task_runners), // task runners - nullptr, // window - {}, // snapshot delegate - {}, // io manager - "main.dart", // advisory uri - "main" // advisory entrypoint + vm.get(), // vm + vm->GetIsolateSnapshot(), // isolate snapshot + vm->GetSharedSnapshot(), // shared snapshot + std::move(task_runners), // task runners + nullptr, // window + {}, // snapshot delegate + {}, // io manager + "main.dart", // advisory uri + "main" // advisory entrypoint ); auto root_isolate = weak_isolate.lock(); ASSERT_TRUE(root_isolate); @@ -51,26 +53,24 @@ TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) { Settings settings = {}; settings.task_observer_add = [](intptr_t, fml::closure) {}; settings.task_observer_remove = [](intptr_t) {}; - auto vm = DartVMRef::Create(settings); + auto vm = DartVM::ForProcess(settings); ASSERT_TRUE(vm); - auto vm_data = vm->GetVMData(); - ASSERT_TRUE(vm_data); - TaskRunners task_runners(testing::GetCurrentTestName(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner() // + TaskRunners task_runners(CURRENT_TEST_NAME, // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner() // ); auto weak_isolate = DartIsolate::CreateRootIsolate( - vm_data->GetSettings(), // settings - vm_data->GetIsolateSnapshot(), // isolate snapshot - vm_data->GetSharedSnapshot(), // shared snapshot - std::move(task_runners), // task runners - nullptr, // window - {}, // snapshot delegate - {}, // io manager - "main.dart", // advisory uri - "main" // advisory entrypoint + vm.get(), // vm + vm->GetIsolateSnapshot(), // isolate snapshot + vm->GetSharedSnapshot(), // shared snapshot + std::move(task_runners), // task runners + nullptr, // window + {}, // snapshot delegate + {}, // io manager + "main.dart", // advisory uri + "main" // advisory entrypoint ); auto root_isolate = weak_isolate.lock(); ASSERT_TRUE(root_isolate); @@ -86,11 +86,8 @@ TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) { class AutoIsolateShutdown { public: - AutoIsolateShutdown(blink::DartVMRef vm, - std::shared_ptr isolate) - : vm_(std::move(vm)), isolate_(std::move(isolate)) { - FML_CHECK(vm_); - } + AutoIsolateShutdown(std::shared_ptr isolate) + : isolate_(std::move(isolate)) {} ~AutoIsolateShutdown() { if (isolate_) { @@ -122,7 +119,6 @@ class AutoIsolateShutdown { } private: - blink::DartVMRef vm_; std::shared_ptr isolate_; FML_DISALLOW_COPY_AND_ASSIGN(AutoIsolateShutdown); @@ -132,38 +128,35 @@ std::unique_ptr RunDartCodeInIsolate( fml::RefPtr task_runner, std::string entrypoint) { Settings settings = {}; - settings.enable_observatory = true; settings.task_observer_add = [](intptr_t, fml::closure) {}; settings.task_observer_remove = [](intptr_t) {}; - auto vm = DartVMRef::Create(settings); + auto vm = DartVM::ForProcess(settings); + if (!vm) { return {}; } - - auto vm_data = vm->GetVMData(); - - TaskRunners task_runners(testing::GetCurrentTestName(), // - task_runner, // - task_runner, // - task_runner, // - task_runner // + TaskRunners task_runners(CURRENT_TEST_NAME, // + task_runner, // + task_runner, // + task_runner, // + task_runner // ); auto weak_isolate = DartIsolate::CreateRootIsolate( - vm_data->GetSettings(), // settings - vm_data->GetIsolateSnapshot(), // isolate snapshot - vm_data->GetSharedSnapshot(), // shared snapshot - std::move(task_runners), // task runners - nullptr, // window - {}, // snapshot delegate - {}, // io manager - "main.dart", // advisory uri - "main" // advisory entrypoint + vm.get(), // vm + vm->GetIsolateSnapshot(), // isolate snapshot + vm->GetSharedSnapshot(), // shared snapshot + std::move(task_runners), // task runners + nullptr, // window + {}, // snapshot delegate + {}, // io manager + "main.dart", // advisory uri + "main" // advisory entrypoint ); auto root_isolate = - std::make_unique(std::move(vm), weak_isolate.lock()); + std::make_unique(weak_isolate.lock()); if (!root_isolate->IsValid()) { FML_LOG(ERROR) << "Could not create isolate."; diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index fd75c3039e42b..382ab05c344f2 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -15,7 +15,6 @@ #include "flutter/fml/file.h" #include "flutter/fml/logging.h" #include "flutter/fml/mapping.h" -#include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/time/time_delta.h" #include "flutter/fml/trace_event.h" #include "flutter/lib/io/dart_io.h" @@ -240,48 +239,66 @@ static void EmbedderInformationCallback(Dart_EmbedderInformation* info) { info->name = "Flutter"; } -std::shared_ptr DartVM::Create( +fml::RefPtr DartVM::ForProcess(Settings settings) { + return ForProcess(settings, nullptr, nullptr, nullptr); +} + +static std::once_flag gVMInitialization; +static std::mutex gVMMutex; +static fml::RefPtr gVM; + +fml::RefPtr DartVM::ForProcess( Settings settings, fml::RefPtr vm_snapshot, fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, - std::shared_ptr isolate_name_server) { - auto vm_data = DartVMData::Create(settings, // - std::move(vm_snapshot), // - std::move(isolate_snapshot), // - std::move(shared_snapshot) // - ); - - if (!vm_data) { - FML_LOG(ERROR) << "Could not setup VM data to bootstrap the VM from."; - return {}; - } - - // Note: std::make_shared unviable due to hidden constructor. - return std::shared_ptr( - new DartVM(std::move(vm_data), std::move(isolate_name_server))); + fml::RefPtr shared_snapshot) { + std::lock_guard lock(gVMMutex); + std::call_once(gVMInitialization, [settings, // + vm_snapshot, // + isolate_snapshot, // + shared_snapshot // + ]() mutable { + if (!vm_snapshot) { + vm_snapshot = DartSnapshot::VMSnapshotFromSettings(settings); + } + if (!(vm_snapshot && vm_snapshot->IsValid())) { + FML_LOG(ERROR) << "VM snapshot must be valid."; + return; + } + if (!isolate_snapshot) { + isolate_snapshot = DartSnapshot::IsolateSnapshotFromSettings(settings); + } + if (!(isolate_snapshot && isolate_snapshot->IsValid())) { + FML_LOG(ERROR) << "Isolate snapshot must be valid."; + return; + } + if (!shared_snapshot) { + shared_snapshot = DartSnapshot::Empty(); + } + gVM = fml::MakeRefCounted(settings, // + std::move(vm_snapshot), // + std::move(isolate_snapshot), // + std::move(shared_snapshot) // + ); + }); + return gVM; } -static std::atomic_size_t gVMLaunchCount; - -size_t DartVM::GetVMLaunchCount() { - return gVMLaunchCount; +fml::RefPtr DartVM::ForProcessIfInitialized() { + std::lock_guard lock(gVMMutex); + return gVM; } -DartVM::DartVM(std::shared_ptr vm_data, - std::shared_ptr isolate_name_server) - : settings_(vm_data->GetSettings()), - vm_data_(vm_data), - isolate_name_server_(std::move(isolate_name_server)), - service_protocol_(std::make_shared()) { +DartVM::DartVM(const Settings& settings, + fml::RefPtr vm_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot) + : settings_(settings), + vm_snapshot_(std::move(vm_snapshot)), + isolate_snapshot_(std::move(isolate_snapshot)), + shared_snapshot_(std::move(shared_snapshot)), + weak_factory_(this) { TRACE_EVENT0("flutter", "DartVMInitializer"); - - gVMLaunchCount++; - - FML_DCHECK(vm_data_); - FML_DCHECK(isolate_name_server_); - FML_DCHECK(service_protocol_); - FML_DLOG(INFO) << "Attempting Dart VM launch for mode: " << (IsRunningPrecompiledCode() ? "AOT" : "Interpreter"); @@ -289,8 +306,8 @@ DartVM::DartVM(std::shared_ptr vm_data, TRACE_EVENT0("flutter", "dart::bin::BootstrapDartIo"); dart::bin::BootstrapDartIo(); - if (!settings_.temp_directory_path.empty()) { - dart::bin::SetSystemTempDirectory(settings_.temp_directory_path.c_str()); + if (!settings.temp_directory_path.empty()) { + dart::bin::SetSystemTempDirectory(settings.temp_directory_path.c_str()); } } @@ -303,7 +320,7 @@ DartVM::DartVM(std::shared_ptr vm_data, args.push_back("--ignore-unrecognized-flags"); for (auto* const profiler_flag : - ProfilingFlags(settings_.enable_dart_profiling)) { + ProfilingFlags(settings.enable_dart_profiling)) { args.push_back(profiler_flag); } @@ -316,7 +333,7 @@ DartVM::DartVM(std::shared_ptr vm_data, // Enable Dart assertions if we are not running precompiled code. We run non- // precompiled code only in the debug product mode. - bool enable_asserts = !settings_.disable_dart_asserts; + bool enable_asserts = !settings.disable_dart_asserts; #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_PROFILE || \ FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE @@ -340,24 +357,24 @@ DartVM::DartVM(std::shared_ptr vm_data, PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); } - if (settings_.start_paused) { + if (settings.start_paused) { PushBackAll(&args, kDartStartPausedArgs, arraysize(kDartStartPausedArgs)); } - if (settings_.endless_trace_buffer || settings_.trace_startup) { + if (settings.endless_trace_buffer || settings.trace_startup) { // If we are tracing startup, make sure the trace buffer is endless so we // don't lose early traces. PushBackAll(&args, kDartEndlessTraceBufferArgs, arraysize(kDartEndlessTraceBufferArgs)); } - if (settings_.trace_systrace) { + if (settings.trace_systrace) { PushBackAll(&args, kDartSystraceTraceBufferArgs, arraysize(kDartSystraceTraceBufferArgs)); PushBackAll(&args, kDartTraceStreamsArgs, arraysize(kDartTraceStreamsArgs)); } - if (settings_.trace_startup) { + if (settings.trace_startup) { PushBackAll(&args, kDartTraceStartupArgs, arraysize(kDartTraceStartupArgs)); } @@ -366,8 +383,8 @@ DartVM::DartVM(std::shared_ptr vm_data, PushBackAll(&args, kDartTraceStreamsArgs, arraysize(kDartTraceStreamsArgs)); #endif - for (size_t i = 0; i < settings_.dart_flags.size(); i++) - args.push_back(settings_.dart_flags[i].c_str()); + for (size_t i = 0; i < settings.dart_flags.size(); i++) + args.push_back(settings.dart_flags[i].c_str()); char* flags_error = Dart_SetVMFlags(args.size(), args.data()); if (flags_error) { @@ -377,14 +394,14 @@ DartVM::DartVM(std::shared_ptr vm_data, DartUI::InitForGlobal(); + Dart_SetFileModifiedCallback(&DartFileModifiedCallback); + { TRACE_EVENT0("flutter", "Dart_Initialize"); Dart_InitializeParams params = {}; params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION; - params.vm_snapshot_data = - vm_data_->GetVMSnapshot().GetData()->GetSnapshotPointer(); - params.vm_snapshot_instructions = - vm_data_->GetVMSnapshot().GetInstructionsIfPresent(); + params.vm_snapshot_data = vm_snapshot_->GetData()->GetSnapshotPointer(); + params.vm_snapshot_instructions = vm_snapshot_->GetInstructionsIfPresent(); params.create = reinterpret_cast( DartIsolate::DartIsolateCreateCallback); params.shutdown = reinterpret_cast( @@ -416,50 +433,51 @@ DartVM::DartVM(std::shared_ptr vm_data, } } - Dart_SetFileModifiedCallback(&DartFileModifiedCallback); - // Allow streaming of stdout and stderr by the Dart vm. Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback, &ServiceStreamCancelCallback); Dart_SetEmbedderInformationCallback(&EmbedderInformationCallback); - - FML_DLOG(INFO) << "New Dart VM instance created. Instance count: " - << gVMLaunchCount; } DartVM::~DartVM() { if (Dart_CurrentIsolate() != nullptr) { Dart_ExitIsolate(); } - char* result = Dart_Cleanup(); + if (result != nullptr) { + FML_LOG(ERROR) << "Could not cleanly shut down the Dart VM. Message: \"" + << result << "\"."; + free(result); + } +} - dart::bin::CleanupDartIo(); +const Settings& DartVM::GetSettings() const { + return settings_; +} - FML_CHECK(result == nullptr) - << "Could not cleanly shut down the Dart VM. Error: \"" << result - << "\"."; - free(result); +const DartSnapshot& DartVM::GetVMSnapshot() const { + return *vm_snapshot_.get(); +} - FML_DLOG(INFO) << "Dart VM instance destroyed. Instance count: " - << gVMLaunchCount; +IsolateNameServer* DartVM::GetIsolateNameServer() { + return &isolate_name_server_; } -std::shared_ptr DartVM::GetVMData() const { - return vm_data_; +fml::RefPtr DartVM::GetIsolateSnapshot() const { + return isolate_snapshot_; } -const Settings& DartVM::GetSettings() const { - return settings_; +fml::RefPtr DartVM::GetSharedSnapshot() const { + return shared_snapshot_; } -std::shared_ptr DartVM::GetServiceProtocol() const { +ServiceProtocol& DartVM::GetServiceProtocol() { return service_protocol_; } -std::shared_ptr DartVM::GetIsolateNameServer() const { - return isolate_name_server_; +fml::WeakPtr DartVM::GetWeakPtr() { + return weak_factory_.GetWeakPtr(); } } // namespace blink diff --git a/runtime/dart_vm.h b/runtime/dart_vm.h index 1249490880dc0..9a1bde888dd86 100644 --- a/runtime/dart_vm.h +++ b/runtime/dart_vm.h @@ -5,8 +5,9 @@ #ifndef FLUTTER_RUNTIME_DART_VM_H_ #define FLUTTER_RUNTIME_DART_VM_H_ -#include +#include #include +#include #include "flutter/common/settings.h" #include "flutter/fml/build_config.h" @@ -18,48 +19,59 @@ #include "flutter/lib/ui/isolate_name_server/isolate_name_server.h" #include "flutter/runtime/dart_isolate.h" #include "flutter/runtime/dart_snapshot.h" -#include "flutter/runtime/dart_vm_data.h" #include "flutter/runtime/service_protocol.h" #include "third_party/dart/runtime/include/dart_api.h" namespace blink { -class DartVM { +class DartVM : public fml::RefCountedThreadSafe { public: - ~DartVM(); + static fml::RefPtr ForProcess(Settings settings); + + static fml::RefPtr ForProcess( + Settings settings, + fml::RefPtr vm_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot); + + static fml::RefPtr ForProcessIfInitialized(); static bool IsRunningPrecompiledCode(); static bool IsKernelMapping(const fml::FileMapping* mapping); - static size_t GetVMLaunchCount(); - const Settings& GetSettings() const; - std::shared_ptr GetVMData() const; + const DartSnapshot& GetVMSnapshot() const; - std::shared_ptr GetServiceProtocol() const; + IsolateNameServer* GetIsolateNameServer(); - std::shared_ptr GetIsolateNameServer() const; + fml::RefPtr GetIsolateSnapshot() const; - private: - const Settings settings_; - std::shared_ptr vm_data_; - const std::shared_ptr isolate_name_server_; - const std::shared_ptr service_protocol_; + fml::RefPtr GetSharedSnapshot() const; - friend class DartVMRef; + fml::WeakPtr GetWeakPtr(); - static std::shared_ptr Create( - Settings settings, - fml::RefPtr vm_snapshot, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, - std::shared_ptr isolate_name_server); + ServiceProtocol& GetServiceProtocol(); - DartVM(std::shared_ptr data, - std::shared_ptr isolate_name_server); + private: + const Settings settings_; + const fml::RefPtr vm_snapshot_; + IsolateNameServer isolate_name_server_; + const fml::RefPtr isolate_snapshot_; + const fml::RefPtr shared_snapshot_; + ServiceProtocol service_protocol_; + fml::WeakPtrFactory weak_factory_; + + DartVM(const Settings& settings, + fml::RefPtr vm_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot); + + ~DartVM(); + FML_FRIEND_REF_COUNTED_THREAD_SAFE(DartVM); + FML_FRIEND_MAKE_REF_COUNTED(DartVM); FML_DISALLOW_COPY_AND_ASSIGN(DartVM); }; diff --git a/runtime/dart_vm_data.cc b/runtime/dart_vm_data.cc deleted file mode 100644 index a29074f79c92e..0000000000000 --- a/runtime/dart_vm_data.cc +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2013 The Flutter 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_vm_data.h" - -namespace blink { - -std::shared_ptr DartVMData::Create( - Settings settings, - fml::RefPtr vm_snapshot, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot) { - if (!vm_snapshot || !vm_snapshot->IsValid()) { - // Caller did not provide a valid VM snapshot. Attempt to infer one - // from the settings. - vm_snapshot = DartSnapshot::VMSnapshotFromSettings(settings); - if (!vm_snapshot) { - FML_LOG(ERROR) - << "VM snapshot invalid and could not be inferred from settings."; - return {}; - } - } - - if (!isolate_snapshot || !isolate_snapshot->IsValid()) { - // Caller did not provide a valid isolate snapshot. Attempt to infer one - // from the settings. - isolate_snapshot = DartSnapshot::IsolateSnapshotFromSettings(settings); - if (!isolate_snapshot) { - FML_LOG(ERROR) << "Isolate snapshot invalid and could not be inferred " - "from settings."; - return {}; - } - } - - if (!shared_snapshot || !shared_snapshot->IsValid()) { - shared_snapshot = DartSnapshot::Empty(); - if (!shared_snapshot) { - FML_LOG(ERROR) << "Shared snapshot invalid."; - return {}; - } - } - - return std::shared_ptr(new DartVMData( - std::move(settings), // - std::move(vm_snapshot), // - std::move(isolate_snapshot), // - std::move(shared_snapshot) // - )); -} - -DartVMData::DartVMData(Settings settings, - fml::RefPtr vm_snapshot, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot) - : settings_(settings), - vm_snapshot_(vm_snapshot), - isolate_snapshot_(isolate_snapshot), - shared_snapshot_(shared_snapshot) {} - -DartVMData::~DartVMData() = default; - -const Settings& DartVMData::GetSettings() const { - return settings_; -} - -const DartSnapshot& DartVMData::GetVMSnapshot() const { - return *vm_snapshot_; -} - -fml::RefPtr DartVMData::GetIsolateSnapshot() const { - return isolate_snapshot_; -} - -fml::RefPtr DartVMData::GetSharedSnapshot() const { - return shared_snapshot_; -} - -} // namespace blink diff --git a/runtime/dart_vm_data.h b/runtime/dart_vm_data.h deleted file mode 100644 index 906cad1a4ca05..0000000000000 --- a/runtime/dart_vm_data.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2013 The Flutter 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_VM_DATA_H_ -#define FLUTTER_RUNTIME_DART_VM_DATA_H_ - -#include "flutter/fml/macros.h" -#include "flutter/runtime/dart_snapshot.h" - -namespace blink { - -class DartVMData { - public: - static std::shared_ptr Create( - Settings settings, - fml::RefPtr vm_snapshot, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot); - - ~DartVMData(); - - const Settings& GetSettings() const; - - const DartSnapshot& GetVMSnapshot() const; - - fml::RefPtr GetIsolateSnapshot() const; - - fml::RefPtr GetSharedSnapshot() const; - - private: - const Settings settings_; - const fml::RefPtr vm_snapshot_; - const fml::RefPtr isolate_snapshot_; - const fml::RefPtr shared_snapshot_; - - DartVMData(Settings settings, - fml::RefPtr vm_snapshot, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot); - - FML_DISALLOW_COPY_AND_ASSIGN(DartVMData); -}; - -} // namespace blink - -#endif // FLUTTER_RUNTIME_DART_VM_DATA_H_ diff --git a/runtime/dart_vm_lifecycle.cc b/runtime/dart_vm_lifecycle.cc deleted file mode 100644 index e34132dd6b4cd..0000000000000 --- a/runtime/dart_vm_lifecycle.cc +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2013 The Flutter 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_vm_lifecycle.h" - -#include - -namespace blink { - -// We need to explicitly put the constructor and destructor of the DartVM in the -// critical section. All accesses (not just const members) to the global VM -// object weak pointer are behind this mutex. -static std::mutex gVMMutex; -static std::weak_ptr gVM FML_GUARDED_BY(gVMMutex); - -// We are going to be modifying more than just the control blocks of the -// following weak pointers (in the |Create| case where an old VM could not be -// reused). Ideally, we would use |std::atomic>| specialization -// but that is only available since C++20. We don't expect contention on these -// locks so we just use one mutex for all. -static std::mutex gVMDependentsMutex; -static std::weak_ptr gVMData - FML_GUARDED_BY(gVMDependentsMutex); -static std::weak_ptr gVMServiceProtocol - FML_GUARDED_BY(gVMDependentsMutex); -static std::weak_ptr gVMIsolateNameServer - FML_GUARDED_BY(gVMDependentsMutex); - -DartVMRef::DartVMRef(std::shared_ptr vm) : vm_(vm) {} - -DartVMRef::DartVMRef(DartVMRef&& other) = default; - -DartVMRef::~DartVMRef() { - if (!vm_) { - // If there is no valid VM (possible via a move), there is no way that the - // decrement on the shared pointer can cause a collection. Avoid acquiring - // the lifecycle lock in this case. This is just working around a - // pessimization and not required for correctness. - return; - } - std::lock_guard lifecycle_lock(gVMMutex); - vm_.reset(); -} - -DartVMRef DartVMRef::Create(Settings settings, - fml::RefPtr vm_snapshot, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot) { - std::lock_guard lifecycle_lock(gVMMutex); - - // If there is already a running VM in the process, grab a strong reference to - // it. - if (auto vm = gVM.lock()) { - FML_DLOG(WARNING) << "Attempted to create a VM in a process where one was " - "already running. Ignoring arguments for current VM " - "create call and reusing the old VM."; - // There was already a running VM in the process, - return DartVMRef{std::move(vm)}; - } - - std::lock_guard dependents_lock(gVMDependentsMutex); - - gVMData.reset(); - gVMServiceProtocol.reset(); - gVMIsolateNameServer.reset(); - gVM.reset(); - - // If there is no VM in the process. Initialize one, hold the weak reference - // and pass a strong reference to the caller. - auto isolate_name_server = std::make_shared(); - auto vm = DartVM::Create(std::move(settings), // - std::move(vm_snapshot), // - std::move(isolate_snapshot), // - std::move(shared_snapshot), // - isolate_name_server // - ); - - if (!vm) { - FML_LOG(ERROR) << "Could not create Dart VM instance."; - return {nullptr}; - } - - gVMData = vm->GetVMData(); - gVMServiceProtocol = vm->GetServiceProtocol(); - gVMIsolateNameServer = isolate_name_server; - - gVM = vm; - return DartVMRef{std::move(vm)}; -} - -bool DartVMRef::IsInstanceRunning() { - std::lock_guard lock(gVMMutex); - return !gVM.expired(); -} - -std::shared_ptr DartVMRef::GetVMData() { - std::lock_guard lock(gVMDependentsMutex); - return gVMData.lock(); -} - -std::shared_ptr DartVMRef::GetServiceProtocol() { - std::lock_guard lock(gVMDependentsMutex); - return gVMServiceProtocol.lock(); -} - -std::shared_ptr DartVMRef::GetIsolateNameServer() { - std::lock_guard lock(gVMDependentsMutex); - return gVMIsolateNameServer.lock(); -} - -} // namespace blink diff --git a/runtime/dart_vm_lifecycle.h b/runtime/dart_vm_lifecycle.h deleted file mode 100644 index cfe1f1b646469..0000000000000 --- a/runtime/dart_vm_lifecycle.h +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2013 The Flutter 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_VM_LIFECYCLE_H_ -#define FLUTTER_RUNTIME_DART_VM_LIFECYCLE_H_ - -#include - -#include "flutter/fml/macros.h" -#include "flutter/lib/ui/isolate_name_server/isolate_name_server.h" -#include "flutter/runtime/dart_vm.h" -#include "flutter/runtime/service_protocol.h" - -namespace blink { - -// A strong reference to the Dart VM. There can only be one VM running in the -// process at any given time. A reference to the VM may only be obtained via the -// |Create| method. In case there is already a running instance of the VM in the -// process, a strong reference to that VM is obtained and the arguments to the -// |Create| call ignored. If there is no VM already running in the process, a VM -// is initialized in a thread safe manner and returned to the caller. The VM -// will shutdown only when all callers relinquish their references (by -// collecting their instances of this class). -// -// DartVMRef instances may be created on any thread. -class DartVMRef { - public: - FML_WARN_UNUSED_RESULT - static DartVMRef Create(Settings settings, - fml::RefPtr vm_snapshot = nullptr, - fml::RefPtr isolate_snapshot = nullptr, - fml::RefPtr shared_snapshot = nullptr); - - DartVMRef(DartVMRef&&); - - ~DartVMRef(); - - // This is an inherently racy way to check if a VM instance is running and - // should not be used outside of unit-tests where there is a known threading - // model. - static bool IsInstanceRunning(); - - static std::shared_ptr GetVMData(); - - static std::shared_ptr GetServiceProtocol(); - - static std::shared_ptr GetIsolateNameServer(); - - operator bool() const { return static_cast(vm_); } - - DartVM* operator->() { - FML_DCHECK(vm_); - return vm_.get(); - } - - DartVM* operator&() { - FML_DCHECK(vm_); - return vm_.get(); - } - - private: - std::shared_ptr vm_; - - DartVMRef(std::shared_ptr vm); - - FML_DISALLOW_COPY_AND_ASSIGN(DartVMRef); -}; - -} // namespace blink - -#endif // FLUTTER_RUNTIME_DART_VM_LIFECYCLE_H_ diff --git a/runtime/dart_vm_unittests.cc b/runtime/dart_vm_unittests.cc index b3653333b51de..21e3d3d3fa58f 100644 --- a/runtime/dart_vm_unittests.cc +++ b/runtime/dart_vm_unittests.cc @@ -3,36 +3,25 @@ // found in the LICENSE file. #include "flutter/runtime/dart_vm.h" -#include "flutter/runtime/dart_vm_lifecycle.h" -#include "flutter/shell/common/thread_host.h" -#include "flutter/testing/testing.h" -#include "flutter/testing/thread_test.h" #include "gtest/gtest.h" namespace blink { -static Settings GetTestSettings() { - Settings settings; - settings.verbose_logging = true; +TEST(DartVM, SimpleInitialization) { + Settings settings = {}; settings.task_observer_add = [](intptr_t, fml::closure) {}; settings.task_observer_remove = [](intptr_t) {}; - return settings; -} - -TEST(DartVM, SimpleInitialization) { - auto vm1 = DartVMRef::Create(GetTestSettings()); - ASSERT_TRUE(vm1); - - // Multiple initializations should return the same VM. - auto vm2 = DartVMRef::Create(GetTestSettings()); - ASSERT_TRUE(vm2); - - ASSERT_EQ(&vm1, &vm2); + auto vm = DartVM::ForProcess(settings); + ASSERT_TRUE(vm); + ASSERT_EQ(vm, DartVM::ForProcess(settings)); ASSERT_FALSE(DartVM::IsRunningPrecompiledCode()); } TEST(DartVM, SimpleIsolateNameServer) { - auto vm = DartVMRef::Create(GetTestSettings()); + Settings settings = {}; + settings.task_observer_add = [](intptr_t, fml::closure) {}; + settings.task_observer_remove = [](intptr_t) {}; + auto vm = DartVM::ForProcess(settings); auto ns = vm->GetIsolateNameServer(); ASSERT_EQ(ns->LookupIsolatePortByName("foobar"), ILLEGAL_PORT); ASSERT_FALSE(ns->RemoveIsolateNameMapping("foobar")); @@ -42,79 +31,4 @@ TEST(DartVM, SimpleIsolateNameServer) { ASSERT_TRUE(ns->RemoveIsolateNameMapping("foobar")); } -TEST(DartVM, CanReinitializeVMOverAndOver) { - size_t vm_launch_count = DartVM::GetVMLaunchCount(); - for (size_t i = 0; i < 1000; ++i) { - FML_LOG(INFO) << "Run " << i + 1; - - // VM should not already be running. - ASSERT_FALSE(DartVMRef::IsInstanceRunning()); - - auto vm = DartVMRef::Create(GetTestSettings()); - ASSERT_TRUE(vm); - size_t new_vm_launch_count = DartVM::GetVMLaunchCount(); - ASSERT_EQ(vm_launch_count + 1, new_vm_launch_count); - vm_launch_count = new_vm_launch_count; - - // VM should now be running - ASSERT_TRUE(DartVMRef::IsInstanceRunning()); - } -} - -using DartVMThreadTest = ::testing::ThreadTest; - -TEST_F(DartVMThreadTest, CanRunIsolatesInANewVM) { - for (size_t i = 0; i < 1000; ++i) { - FML_LOG(INFO) << "Run " << i + 1; - size_t vm_launch_count = DartVM::GetVMLaunchCount(); - - // VM should not already be running. - ASSERT_FALSE(DartVMRef::IsInstanceRunning()); - - auto vm = DartVMRef::Create(GetTestSettings()); - ASSERT_TRUE(vm); - - // VM should not already be running. - ASSERT_TRUE(DartVMRef::IsInstanceRunning()); - - size_t new_vm_launch_count = DartVM::GetVMLaunchCount(); - ASSERT_EQ(vm_launch_count + 1, new_vm_launch_count); - - Settings settings = {}; - - settings.task_observer_add = [](intptr_t, fml::closure) {}; - settings.task_observer_remove = [](intptr_t) {}; - - auto labels = testing::GetCurrentTestName() + std::to_string(i); - shell::ThreadHost host(labels, shell::ThreadHost::Type::UI | - shell::ThreadHost::Type::GPU | - shell::ThreadHost::Type::IO); - - TaskRunners task_runners( - labels, // task runner labels - GetCurrentTaskRunner(), // platform task runner - host.gpu_thread->GetTaskRunner(), // GPU task runner - host.ui_thread->GetTaskRunner(), // UI task runner - host.io_thread->GetTaskRunner() // IO task runner - ); - - auto weak_isolate = DartIsolate::CreateRootIsolate( - vm->GetVMData()->GetSettings(), // settings - vm->GetVMData()->GetIsolateSnapshot(), // isolate snapshot - vm->GetVMData()->GetSharedSnapshot(), // shared snapshot - std::move(task_runners), // task runners - nullptr, // window - {}, // snapshot delegate - {}, // io manager - "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); - ASSERT_TRUE(root_isolate->Shutdown()); - } -} - } // namespace blink diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc index d3850398d5b2e..b57f2232acc47 100644 --- a/runtime/runtime_controller.cc +++ b/runtime/runtime_controller.cc @@ -17,8 +17,8 @@ namespace blink { RuntimeController::RuntimeController( RuntimeDelegate& p_client, DartVM* p_vm, - fml::RefPtr p_isolate_snapshot, - fml::RefPtr p_shared_snapshot, + fml::RefPtr p_isolate_snapshot, + fml::RefPtr p_shared_snapshot, TaskRunners p_task_runners, fml::WeakPtr p_snapshot_delegate, fml::WeakPtr p_io_manager, @@ -40,8 +40,8 @@ RuntimeController::RuntimeController( RuntimeController::RuntimeController( RuntimeDelegate& p_client, DartVM* p_vm, - fml::RefPtr p_isolate_snapshot, - fml::RefPtr p_shared_snapshot, + fml::RefPtr p_isolate_snapshot, + fml::RefPtr p_shared_snapshot, TaskRunners p_task_runners, fml::WeakPtr p_snapshot_delegate, fml::WeakPtr p_io_manager, @@ -61,7 +61,7 @@ RuntimeController::RuntimeController( idle_notification_callback_(idle_notification_callback), window_data_(std::move(p_window_data)), root_isolate_( - DartIsolate::CreateRootIsolate(vm_->GetVMData()->GetSettings(), + DartIsolate::CreateRootIsolate(vm_, isolate_snapshot_, shared_snapshot_, task_runners_, diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h index 6d9baf75732a6..c913795b8eba2 100644 --- a/runtime/runtime_controller.h +++ b/runtime/runtime_controller.h @@ -30,8 +30,8 @@ class RuntimeController final : public WindowClient { public: RuntimeController(RuntimeDelegate& client, DartVM* vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, TaskRunners task_runners, fml::WeakPtr snapshot_delegate, fml::WeakPtr io_manager, @@ -118,8 +118,8 @@ class RuntimeController final : public WindowClient { RuntimeDelegate& client_; DartVM* const vm_; - fml::RefPtr isolate_snapshot_; - fml::RefPtr shared_snapshot_; + fml::RefPtr isolate_snapshot_; + fml::RefPtr shared_snapshot_; TaskRunners task_runners_; fml::WeakPtr snapshot_delegate_; fml::WeakPtr io_manager_; @@ -132,8 +132,8 @@ class RuntimeController final : public WindowClient { RuntimeController(RuntimeDelegate& client, DartVM* vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, TaskRunners task_runners, fml::WeakPtr snapshot_delegate, fml::WeakPtr io_manager, diff --git a/shell/common/engine.cc b/shell/common/engine.cc index d6a790be403e3..084216072e988 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -37,8 +37,8 @@ static constexpr char kSettingsChannel[] = "flutter/settings"; Engine::Engine(Delegate& delegate, blink::DartVM& vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, blink::TaskRunners task_runners, blink::Settings settings, std::unique_ptr animator, diff --git a/shell/common/engine.h b/shell/common/engine.h index 22160cb7ee3c9..b390b36a2b197 100644 --- a/shell/common/engine.h +++ b/shell/common/engine.h @@ -56,8 +56,8 @@ class Engine final : public blink::RuntimeDelegate { Engine(Delegate& delegate, blink::DartVM& vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, blink::TaskRunners task_runners, blink::Settings settings, std::unique_ptr animator, diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 2949e6dec502f..c1dec19f6ae67 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -36,20 +36,17 @@ namespace shell { constexpr char kSkiaChannel[] = "flutter/skia"; std::unique_ptr Shell::CreateShellOnPlatformThread( - blink::DartVMRef vm, blink::TaskRunners task_runners, blink::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, Shell::CreateCallback on_create_platform_view, Shell::CreateCallback on_create_rasterizer) { if (!task_runners.IsValid()) { - FML_LOG(ERROR) << "Task runners to run the shell were invalid."; return nullptr; } - auto shell = - std::unique_ptr(new Shell(std::move(vm), task_runners, settings)); + auto shell = std::unique_ptr(new Shell(task_runners, settings)); // Create the platform view on the platform thread (this thread). auto platform_view = on_create_platform_view(*shell.get()); @@ -78,7 +75,6 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( &platform_view, // io_task_runner // ]() { - TRACE_EVENT0("flutter", "ShellSetupIOSubsystem"); io_manager = std::make_unique( platform_view->CreateResourceContext(), io_task_runner); io_latch.Signal(); @@ -96,7 +92,6 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( shell = shell.get(), // &snapshot_delegate // ]() { - TRACE_EVENT0("flutter", "ShellSetupGPUSubsystem"); if (auto new_rasterizer = on_create_rasterizer(*shell)) { rasterizer = std::move(new_rasterizer); snapshot_delegate = rasterizer->GetSnapshotDelegate(); @@ -120,7 +115,6 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( snapshot_delegate = std::move(snapshot_delegate), // io_manager = io_manager->GetWeakPtr() // ]() mutable { - TRACE_EVENT0("flutter", "ShellSetupUISubsystem"); const auto& task_runners = shell->GetTaskRunners(); // The animator is owned by the UI thread but it gets its vsync pulses @@ -129,7 +123,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( std::move(vsync_waiter)); engine = std::make_unique(*shell, // - *shell->GetDartVM(), // + shell->GetDartVM(), // std::move(isolate_snapshot), // std::move(shared_snapshot), // task_runners, // @@ -210,35 +204,26 @@ std::unique_ptr Shell::Create( Shell::CreateCallback on_create_rasterizer) { PerformInitializationTasks(settings); - TRACE_EVENT0("flutter", "Shell::Create"); - - auto vm = blink::DartVMRef::Create(settings); + auto vm = blink::DartVM::ForProcess(settings); FML_CHECK(vm) << "Must be able to initialize the VM."; - - auto vm_data = vm->GetVMData(); - return Shell::Create(std::move(task_runners), // std::move(settings), // - vm_data->GetIsolateSnapshot(), // isolate snapshot - blink::DartSnapshot::Empty(), // shared snapshot + vm->GetIsolateSnapshot(), // + blink::DartSnapshot::Empty(), // std::move(on_create_platform_view), // - std::move(on_create_rasterizer), // - std::move(vm) // + std::move(on_create_rasterizer) // ); } std::unique_ptr Shell::Create( blink::TaskRunners task_runners, blink::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, Shell::CreateCallback on_create_platform_view, - Shell::CreateCallback on_create_rasterizer, - blink::DartVMRef vm) { + Shell::CreateCallback on_create_rasterizer) { PerformInitializationTasks(settings); - TRACE_EVENT0("flutter", "Shell::CreateWithSnapshots"); - if (!task_runners.IsValid() || !on_create_platform_view || !on_create_rasterizer) { return nullptr; @@ -248,18 +233,16 @@ std::unique_ptr Shell::Create( std::unique_ptr shell; fml::TaskRunner::RunNowOrPostTask( task_runners.GetPlatformTaskRunner(), - fml::MakeCopyable([&latch, // - vm = std::move(vm), // - &shell, // - task_runners = std::move(task_runners), // - settings, // - isolate_snapshot = std::move(isolate_snapshot), // - shared_snapshot = std::move(shared_snapshot), // - on_create_platform_view, // - on_create_rasterizer // - ]() mutable { - shell = CreateShellOnPlatformThread(std::move(vm), - std::move(task_runners), // + [&latch, // + &shell, // + task_runners = std::move(task_runners), // + settings, // + isolate_snapshot = std::move(isolate_snapshot), // + shared_snapshot = std::move(shared_snapshot), // + on_create_platform_view, // + on_create_rasterizer // + ]() { + shell = CreateShellOnPlatformThread(std::move(task_runners), // settings, // std::move(isolate_snapshot), // std::move(shared_snapshot), // @@ -267,18 +250,15 @@ std::unique_ptr Shell::Create( on_create_rasterizer // ); latch.Signal(); - })); + }); latch.Wait(); return shell; } -Shell::Shell(blink::DartVMRef vm, - blink::TaskRunners task_runners, - blink::Settings settings) +Shell::Shell(blink::TaskRunners task_runners, blink::Settings settings) : task_runners_(std::move(task_runners)), settings_(std::move(settings)), - vm_(std::move(vm)) { - FML_CHECK(vm_) << "Must have access to VM to create a shell."; + vm_(blink::DartVM::ForProcess(settings_)) { FML_DCHECK(task_runners_.IsValid()); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -320,7 +300,9 @@ Shell::~Shell() { PersistentCache::GetCacheForProcess()->RemoveWorkerTaskRunner( task_runners_.GetIOTaskRunner()); - vm_->GetServiceProtocol()->RemoveHandler(this); + if (auto vm = blink::DartVM::ForProcessIfInitialized()) { + vm->GetServiceProtocol().RemoveHandler(this); + } fml::AutoResetWaitableEvent ui_latch, gpu_latch, platform_latch, io_latch; @@ -391,7 +373,9 @@ bool Shell::Setup(std::unique_ptr platform_view, is_setup_ = true; - vm_->GetServiceProtocol()->AddHandler(this, GetServiceProtocolDescription()); + if (auto vm = blink::DartVM::ForProcessIfInitialized()) { + vm->GetServiceProtocol().AddHandler(this, GetServiceProtocolDescription()); + } PersistentCache::GetCacheForProcess()->AddWorkerTaskRunner( task_runners_.GetIOTaskRunner()); @@ -422,13 +406,12 @@ fml::WeakPtr Shell::GetPlatformView() { return platform_view_->GetWeakPtr(); } -blink::DartVM* Shell::GetDartVM() { - return &vm_; +blink::DartVM& Shell::GetDartVM() const { + return *vm_; } // |shell::PlatformView::Delegate| void Shell::OnPlatformViewCreated(std::unique_ptr surface) { - TRACE_EVENT0("flutter", "Shell::OnPlatformViewCreated"); FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -486,7 +469,6 @@ void Shell::OnPlatformViewCreated(std::unique_ptr surface) { // |shell::PlatformView::Delegate| void Shell::OnPlatformViewDestroyed() { - TRACE_EVENT0("flutter", "Shell::OnPlatformViewDestroyed"); FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -822,8 +804,10 @@ void Shell::OnPreEngineRestart() { // |shell::Engine::Delegate| void Shell::UpdateIsolateDescription(const std::string isolate_name, int64_t isolate_port) { - Handler::Description description(isolate_port, isolate_name); - vm_->GetServiceProtocol()->SetHandlerDescription(this, description); + if (auto vm = blink::DartVM::ForProcessIfInitialized()) { + Handler::Description description(isolate_port, isolate_name); + vm->GetServiceProtocol().SetHandlerDescription(this, description); + } } // |blink::ServiceProtocol::Handler| diff --git a/shell/common/shell.h b/shell/common/shell.h index 864235473c934..17b0f170561d5 100644 --- a/shell/common/shell.h +++ b/shell/common/shell.h @@ -23,7 +23,6 @@ #include "flutter/lib/ui/semantics/custom_accessibility_action.h" #include "flutter/lib/ui/semantics/semantics_node.h" #include "flutter/lib/ui/window/platform_message.h" -#include "flutter/runtime/dart_vm_lifecycle.h" #include "flutter/runtime/service_protocol.h" #include "flutter/shell/common/animator.h" #include "flutter/shell/common/engine.h" @@ -55,11 +54,10 @@ class Shell final : public PlatformView::Delegate, static std::unique_ptr Create( blink::TaskRunners task_runners, blink::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, CreateCallback on_create_platform_view, - CreateCallback on_create_rasterizer, - blink::DartVMRef vm); + CreateCallback on_create_rasterizer); ~Shell(); @@ -73,7 +71,7 @@ class Shell final : public PlatformView::Delegate, fml::WeakPtr GetPlatformView(); - blink::DartVM* GetDartVM(); + blink::DartVM& GetDartVM() const; bool IsSetup() const; @@ -87,7 +85,7 @@ class Shell final : public PlatformView::Delegate, const blink::TaskRunners task_runners_; const blink::Settings settings_; - blink::DartVMRef vm_; + fml::RefPtr vm_; std::unique_ptr platform_view_; // on platform task runner std::unique_ptr engine_; // on UI task runner std::unique_ptr rasterizer_; // on GPU task runner @@ -100,19 +98,16 @@ class Shell final : public PlatformView::Delegate, > service_protocol_handlers_; bool is_setup_ = false; + uint64_t next_pointer_flow_id_ = 0; Shell(blink::TaskRunners task_runners, blink::Settings settings); - Shell(blink::DartVMRef vm, - blink::TaskRunners task_runners, - blink::Settings settings); static std::unique_ptr CreateShellOnPlatformThread( - blink::DartVMRef vm, blink::TaskRunners task_runners, blink::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, Shell::CreateCallback on_create_platform_view, Shell::CreateCallback on_create_rasterizer); diff --git a/testing/testing.cc b/testing/testing.cc index c738219541452..93e135e7ab43d 100644 --- a/testing/testing.cc +++ b/testing/testing.cc @@ -6,8 +6,6 @@ namespace testing { -std::string GetCurrentTestName() { - return UnitTest::GetInstance()->current_test_info()->name(); -} +// } // namespace testing diff --git a/testing/testing.h b/testing/testing.h index 0662055fea502..dac2d229b9169 100644 --- a/testing/testing.h +++ b/testing/testing.h @@ -5,8 +5,6 @@ #ifndef TESTING_TESTING_H_ #define TESTING_TESTING_H_ -#include - #include "gtest/gtest.h" namespace testing { @@ -16,8 +14,6 @@ namespace testing { // error. const char* GetFixturesPath(); -std::string GetCurrentTestName(); - } // namespace testing #endif // TESTING_TESTING_H_ From f45572e95f93edb89b6750a4f36ad8ed7c0a2560 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 19 Feb 2019 16:14:31 -0800 Subject: [PATCH 0212/1117] Revert "Remove unnecessary entry-point closurization. (#7827)" (#7876) This reverts commit 3a1b9b3d85cc5521b8da85a019cb260e27c6576b. --- lib/stub_ui/natives.dart | 2 +- lib/ui/hooks.dart | 24 ++++++++++++------------ lib/ui/natives.dart | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/stub_ui/natives.dart b/lib/stub_ui/natives.dart index b4325ff356a9c..d8388a8640e5f 100644 --- a/lib/stub_ui/natives.dart +++ b/lib/stub_ui/natives.dart @@ -20,7 +20,7 @@ Future _scheduleFrame( })); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') void _setupHooks() { // ignore: unused_element assert(() { // In debug mode, register the schedule frame extension. diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index 7386663ee5402..b1550bf90b1ee 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -16,7 +16,7 @@ dynamic _decodeJSON(String message) { return message != null ? json.decode(message) : null; } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _updateWindowMetrics(double devicePixelRatio, double width, @@ -54,11 +54,11 @@ String _localeClosure() { return window.locale.toString(); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element _LocaleClosure _getLocaleClosure() => _localeClosure; -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _updateLocales(List locales) { const int stringsPerLocale = 4; @@ -77,7 +77,7 @@ void _updateLocales(List locales) { _invoke(window.onLocaleChanged, window._onLocaleChangedZone); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _updateUserSettingsData(String jsonData) { final Map data = json.decode(jsonData); @@ -103,14 +103,14 @@ void _updatePlatformBrightness(String brightnessName) { _invoke(window.onPlatformBrightnessChanged, window._onPlatformBrightnessChangedZone); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _updateSemanticsEnabled(bool enabled) { window._semanticsEnabled = enabled; _invoke(window.onSemanticsEnabledChanged, window._onSemanticsEnabledChangedZone); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _updateAccessibilityFeatures(int values) { final AccessibilityFeatures newFeatures = new AccessibilityFeatures._(values); @@ -120,7 +120,7 @@ void _updateAccessibilityFeatures(int values) { _invoke(window.onAccessibilityFeaturesChanged, window._onAccessibilityFlagsChangedZone); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') void _dispatchPlatformMessage(String name, ByteData data, int responseId) { if (window.onPlatformMessage != null) { _invoke3( @@ -137,14 +137,14 @@ void _dispatchPlatformMessage(String name, ByteData data, int responseId) { } } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _dispatchPointerDataPacket(ByteData packet) { if (window.onPointerDataPacket != null) _invoke1(window.onPointerDataPacket, window._onPointerDataPacketZone, _unpackPointerDataPacket(packet)); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _dispatchSemanticsAction(int id, int action, ByteData args) { _invoke3( @@ -156,13 +156,13 @@ void _dispatchSemanticsAction(int id, int action, ByteData args) { ); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _beginFrame(int microseconds) { _invoke1(window.onBeginFrame, window._onBeginFrameZone, new Duration(microseconds: microseconds)); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _drawFrame() { _invoke(window.onDrawFrame, window._onDrawFrameZone); @@ -173,7 +173,7 @@ typedef _UnaryFunction(Null args); // ignore: always_declare_return_types, prefer_generic_function_type_aliases typedef _BinaryFunction(Null args, Null message); -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _runMainZoned(Function startMainIsolateFunction, Function userMainFunction) { startMainIsolateFunction((){ diff --git a/lib/ui/natives.dart b/lib/ui/natives.dart index ed83b92e4fdc9..1e9a0798f96f6 100644 --- a/lib/ui/natives.dart +++ b/lib/ui/natives.dart @@ -29,7 +29,7 @@ Future _scheduleFrame( })); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') void _setupHooks() { // ignore: unused_element assert(() { // In debug mode, register the schedule frame extension. @@ -71,7 +71,7 @@ Function _getCallbackFromHandle(int handle) native 'GetCallbackFromHandle'; // Required for gen_snapshot to work correctly. int _isolateId; // ignore: unused_element -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') Function _getPrintClosure() => _print; // ignore: unused_element -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') Function _getScheduleMicrotaskClosure() => _scheduleMicrotask; // ignore: unused_element From 1263d28abfcd9d8b63b91653ae35aafd7d4efa88 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Tue, 19 Feb 2019 16:25:42 -0800 Subject: [PATCH 0213/1117] Fix caret being at left edge when newline pressed on centered text (#7875) --- third_party/txt/src/txt/paragraph.cc | 5 ++ third_party/txt/tests/paragraph_unittests.cc | 77 ++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index df40bd1cc2041..e8a83b96d2464 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -1302,6 +1302,11 @@ std::vector Paragraph::GetRectsForRange( if (line.end != line.end_including_newline && line.end >= start && line.end_including_newline <= end) { SkScalar x = line_widths_[line_number]; + // Move empty box to center if center aligned and is an empty line. + if (x == 0 && !isinf(width_) && + paragraph_style_.effective_align() == TextAlign::center) { + x = width_ / 2; + } SkScalar top = (line_number > 0) ? line_heights_[line_number - 1] : 0; SkScalar bottom = line_heights_[line_number]; line_metrics[line_number].boxes.emplace_back( diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index 89a1186202d84..622bca0b0fa17 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -1780,6 +1780,83 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeCenterParagraph)) { ASSERT_TRUE(Snapshot()); } +TEST_F(ParagraphTest, + DISABLE_ON_WINDOWS(GetRectsForRangeCenterParagraphNewlineCentered)) { + const char* text = "01234\n"; + 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::center; + txt::ParagraphBuilder builder(paragraph_style, GetTestFontCollection()); + + txt::TextStyle text_style; + text_style.font_families = std::vector(1, "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; + 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() + 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, 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(), 203.95508); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 0.40625); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 232.37305); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 59); + + paint.setColor(SK_ColorGREEN); + boxes = + paragraph->GetRectsForRange(6, 7, 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(), 275); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 275); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), + 75); // TODO(garyq): This value can be improved... Should be + // taller, but we need a good way to obtain a height + // without any glyphs on the line. + + ASSERT_TRUE(Snapshot()); +} + TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeCenterMultiLineParagraph)) { const char* text = "01234   \n0123  "; // includes ideographic From d60ef0c36c15876577a605059934f76cba6e755b Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 19 Feb 2019 19:35:46 -0500 Subject: [PATCH 0214/1117] Roll src/third_party/skia ce62dec02293..249a25730521 (15 commits) (#7879) https://skia.googlesource.com/skia.git/%2Blog/ce62dec02293..249a25730521 git log ce62dec02293670e2941be8bef87b8f3d5da6c35..249a2573052167220fdb90828a5df43bfcaa3a07 --date=short --no-merges --format=%ad %ae %s 2019-02-19 robertphillips@google.com Fix bookmaker dox for SkSurface::MakeRenderTarget 2019-02-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 6397ed0fc311..0a60818466f1 (2 commits) 2019-02-19 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-19 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-15 bungeman@google.com Make SkShaper an interface. 2019-02-19 brianosman@google.com Fix layout feedback loop in particle GUI 2019-02-19 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-19 michaelludwig@google.com Only perform matrix concat when actually logging histograms 2019-02-19 brianosman@google.com Add comments to document SkCurve 2019-02-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader a63e5f9685a6..6397ed0fc311 (1 commits) 2019-02-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src ee506c5149cb..bf1a36e53e69 (229 commits) 2019-02-19 brianosman@google.com First pass comments to document SkReflected.h 2019-02-19 herb@google.com Clarify parameter naming for setMinAndMaxScale 2019-02-19 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 24021a2d7ea5..a63e5f9685a6 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f9a0f6bb258cd..43fc1d92819ab 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': 'ce62dec02293670e2941be8bef87b8f3d5da6c35', + 'skia_revision': '249a2573052167220fdb90828a5df43bfcaa3a07', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index dad4f06e8bf9d..962a0e3f3dfa5 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: a26275873f3c9ff43b88472a8529a9fd +Signature: 065d625f48aad9c609619d5839bea2e2 UNUSED LICENSES: From bf16544508b615b48a21bce28475f557bd8f5551 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 20 Feb 2019 00:39:07 -0500 Subject: [PATCH 0215/1117] Roll src/third_party/skia 249a25730521..e0a6a048bc4a (2 commits) (#7881) https://skia.googlesource.com/skia.git/%2Blog/249a25730521..e0a6a048bc4a git log 249a2573052167220fdb90828a5df43bfcaa3a07..e0a6a048bc4a9cd29e2d1d4ac6d36153c1bce3c1 --date=short --no-merges --format=%ad %ae %s 2019-02-19 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-19 reed@google.com add colorspace param to textblobdiff canvas The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 43fc1d92819ab..ce904aa583988 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': '249a2573052167220fdb90828a5df43bfcaa3a07', + 'skia_revision': 'e0a6a048bc4a9cd29e2d1d4ac6d36153c1bce3c1', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 962a0e3f3dfa5..57f7dbb264176 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 065d625f48aad9c609619d5839bea2e2 +Signature: b948e989fcf379ec8fa710a4bb0e6690 UNUSED LICENSES: From a150cc125a39666dacffb24c2dc87fcf242b29b5 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Tue, 19 Feb 2019 23:27:37 -0800 Subject: [PATCH 0216/1117] Fix minor typos in accessibility action docs (#7882) Fixes a minor pluralisation error in docs for didGainAccessibilityFocus, didLoseAccessibilityFocus. --- lib/stub_ui/semantics.dart | 4 ++-- lib/ui/semantics.dart | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/stub_ui/semantics.dart b/lib/stub_ui/semantics.dart index 97996270303d9..6f052f3851a21 100644 --- a/lib/stub_ui/semantics.dart +++ b/lib/stub_ui/semantics.dart @@ -124,7 +124,7 @@ class SemanticsAction { /// Paste the current content of the clipboard. static const SemanticsAction paste = const SemanticsAction._(_kPasteIndex); - /// Indicates that the nodes has gained accessibility focus. + /// Indicates that the node has gained accessibility focus. /// /// This handler is invoked when the node annotated with this handler gains /// the accessibility focus. The accessibility focus is the @@ -137,7 +137,7 @@ class SemanticsAction { /// Accessibility focus and input focus can be held by two different nodes! static const SemanticsAction didGainAccessibilityFocus = const SemanticsAction._(_kDidGainAccessibilityFocusIndex); - /// Indicates that the nodes has lost accessibility focus. + /// Indicates that the node has lost accessibility focus. /// /// This handler is invoked when the node annotated with this handler /// loses the accessibility focus. The accessibility focus is diff --git a/lib/ui/semantics.dart b/lib/ui/semantics.dart index ea963e64cad96..750f7f0175b79 100644 --- a/lib/ui/semantics.dart +++ b/lib/ui/semantics.dart @@ -124,7 +124,7 @@ class SemanticsAction { /// Paste the current content of the clipboard. static const SemanticsAction paste = const SemanticsAction._(_kPasteIndex); - /// Indicates that the nodes has gained accessibility focus. + /// Indicates that the node has gained accessibility focus. /// /// This handler is invoked when the node annotated with this handler gains /// the accessibility focus. The accessibility focus is the @@ -137,7 +137,7 @@ class SemanticsAction { /// Accessibility focus and input focus can be held by two different nodes! static const SemanticsAction didGainAccessibilityFocus = const SemanticsAction._(_kDidGainAccessibilityFocusIndex); - /// Indicates that the nodes has lost accessibility focus. + /// Indicates that the node has lost accessibility focus. /// /// This handler is invoked when the node annotated with this handler /// loses the accessibility focus. The accessibility focus is From fc1a68ea108abc93e4685903bde3c6f7af57420d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 20 Feb 2019 04:33:06 -0500 Subject: [PATCH 0217/1117] Roll src/third_party/skia e0a6a048bc4a..7738736f9622 (4 commits) (#7884) https://skia.googlesource.com/skia.git/%2Blog/e0a6a048bc4a..7738736f9622 git log e0a6a048bc4a9cd29e2d1d4ac6d36153c1bce3c1..7738736f96222dd326129095cc95f31845ba57be --date=short --no-merges --format=%ad %ae %s 2019-02-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 0a60818466f1..7f8fa973f84b (1 commits) 2019-02-20 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-02-19 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 aca30f56ddc0..3d544fffe7ff (3 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index ce904aa583988..5abbd7f3bc9dc 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': 'e0a6a048bc4a9cd29e2d1d4ac6d36153c1bce3c1', + 'skia_revision': '7738736f96222dd326129095cc95f31845ba57be', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 57f7dbb264176..12653a1b5938e 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b948e989fcf379ec8fa710a4bb0e6690 +Signature: 836e5418237608196869a1f870df54d4 UNUSED LICENSES: From dad6ec01c3420a9a05982e46209fbcbfbf532287 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 20 Feb 2019 08:53:12 -0800 Subject: [PATCH 0218/1117] Correct onAccessibilityFeaturesChanged docs (#7883) Reference to `accessibilityFlags` corrected to `accessibilityFeatures`. --- lib/stub_ui/window.dart | 2 +- lib/ui/window.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/stub_ui/window.dart b/lib/stub_ui/window.dart index bf81854896cc7..bc08ca95c3313 100644 --- a/lib/stub_ui/window.dart +++ b/lib/stub_ui/window.dart @@ -791,7 +791,7 @@ class Window { AccessibilityFeatures get accessibilityFeatures => _accessibilityFeatures; AccessibilityFeatures _accessibilityFeatures; - /// A callback that is invoked when the value of [accessibilityFlags] changes. + /// A callback that is invoked when the value of [accessibilityFeatures] changes. /// /// The framework invokes this callback in the same zone in which the /// callback was set. diff --git a/lib/ui/window.dart b/lib/ui/window.dart index 16dc145a06fdd..c33ed641e875c 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -786,7 +786,7 @@ class Window { AccessibilityFeatures get accessibilityFeatures => _accessibilityFeatures; AccessibilityFeatures _accessibilityFeatures; - /// A callback that is invoked when the value of [accessibilityFlags] changes. + /// A callback that is invoked when the value of [accessibilityFeatures] changes. /// /// The framework invokes this callback in the same zone in which the /// callback was set. From 6d7eb52185b117a3972cac4e23625f97198114d9 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Wed, 20 Feb 2019 11:18:12 -0800 Subject: [PATCH 0219/1117] Revert "Android embedding refactor pr3 add remaining systemchannels (#7874)" (#7886) This reverts commit f4fba6d7110338caf3878cf42e26e17744108d00. --- ci/licenses_golden/licenses_flutter | 2 - shell/platform/android/BUILD.gn | 2 - .../systemchannels/AccessibilityChannel.java | 120 ---- .../systemchannels/LocalizationChannel.java | 23 +- .../systemchannels/PlatformChannel.java | 597 +----------------- .../systemchannels/TextInputChannel.java | 406 ------------ .../editing/InputConnectionAdaptor.java | 58 +- .../plugin/editing/TextInputPlugin.java | 181 +++--- .../plugin/platform/PlatformPlugin.java | 375 ++++++----- .../io/flutter/view/AccessibilityBridge.java | 294 +++++---- .../android/io/flutter/view/FlutterView.java | 75 ++- 11 files changed, 562 insertions(+), 1571 deletions(-) delete mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java delete mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 39c7d860100c5..cea4f342c6317 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -446,7 +446,6 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/D 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/engine/systemchannels/AccessibilityChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/KeyEventChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/LifecycleChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java @@ -454,7 +453,6 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/system FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/SettingsChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/SystemChannel.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.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 diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index ea6ee243977d3..b6560fca38737 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -114,7 +114,6 @@ java_library("flutter_shell_java") { "io/flutter/embedding/engine/dart/PlatformMessageHandler.java", "io/flutter/embedding/engine/renderer/FlutterRenderer.java", "io/flutter/embedding/engine/renderer/OnFirstFrameRenderedListener.java", - "io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java", "io/flutter/embedding/engine/systemchannels/KeyEventChannel.java", "io/flutter/embedding/engine/systemchannels/LifecycleChannel.java", "io/flutter/embedding/engine/systemchannels/LocalizationChannel.java", @@ -122,7 +121,6 @@ java_library("flutter_shell_java") { "io/flutter/embedding/engine/systemchannels/PlatformChannel.java", "io/flutter/embedding/engine/systemchannels/SettingsChannel.java", "io/flutter/embedding/engine/systemchannels/SystemChannel.java", - "io/flutter/embedding/engine/systemchannels/TextInputChannel.java", "io/flutter/plugin/common/ActivityLifecycleListener.java", "io/flutter/plugin/common/BasicMessageChannel.java", "io/flutter/plugin/common/BinaryCodec.java", diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java deleted file mode 100644 index 4bfcd37973b58..0000000000000 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java +++ /dev/null @@ -1,120 +0,0 @@ -package io.flutter.embedding.engine.systemchannels; - -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; - -import java.util.HashMap; - -import io.flutter.embedding.engine.dart.DartExecutor; -import io.flutter.plugin.common.BasicMessageChannel; -import io.flutter.plugin.common.StandardMessageCodec; - -/** - * System channel that sends accessibility requests and events from Flutter to Android. - *

- * See {@link AccessibilityMessageHandler}, which lists all accessibility requests and - * events that might be sent from Flutter to the Android platform. - */ -public class AccessibilityChannel { - @NonNull - public BasicMessageChannel channel; - @Nullable - private AccessibilityMessageHandler handler; - - private final BasicMessageChannel.MessageHandler parsingMessageHandler = new BasicMessageChannel.MessageHandler() { - @Override - public void onMessage(Object message, BasicMessageChannel.Reply reply) { - // If there is no handler to respond to this message then we don't need to - // parse it. Return. - if (handler == null) { - return; - } - - @SuppressWarnings("unchecked") - final HashMap annotatedEvent = (HashMap) message; - final String type = (String) annotatedEvent.get("type"); - @SuppressWarnings("unchecked") - final HashMap data = (HashMap) annotatedEvent.get("data"); - - switch (type) { - case "announce": - String announceMessage = (String) data.get("message"); - if (announceMessage != null) { - handler.announce(announceMessage); - } - break; - case "tap": { - Integer nodeId = (Integer) annotatedEvent.get("nodeId"); - if (nodeId != null) { - handler.onTap(nodeId); - } - break; - } - case "longPress": { - Integer nodeId = (Integer) annotatedEvent.get("nodeId"); - if (nodeId != null) { - handler.onLongPress(nodeId); - } - break; - } - case "tooltip": { - String tooltipMessage = (String) data.get("message"); - if (tooltipMessage != null) { - handler.onTooltip(tooltipMessage); - } - break; - } - } - } - }; - - /** - * Constructs an {@code AccessibilityChannel} that connects Android to the Dart code - * running in {@code dartExecutor}. - * - * The given {@code dartExecutor} is permitted to be idle or executing code. - * - * See {@link DartExecutor}. - */ - public AccessibilityChannel(@NonNull DartExecutor dartExecutor) { - channel = new BasicMessageChannel<>(dartExecutor, "flutter/accessibility", StandardMessageCodec.INSTANCE); - channel.setMessageHandler(parsingMessageHandler); - } - - /** - * Sets the {@link AccessibilityMessageHandler} which receives all events and requests - * that are parsed from the underlying accessibility channel. - */ - public void setAccessibilityMessageHandler(@Nullable AccessibilityMessageHandler handler) { - this.handler = handler; - } - - /** - * Handler that receives accessibility messages sent from Flutter to Android - * through a given {@link AccessibilityChannel}. - * - * To register an {@code AccessibilityMessageHandler} with a {@link AccessibilityChannel}, - * see {@link AccessibilityChannel#setAccessibilityMessageHandler(AccessibilityMessageHandler)}. - */ - public interface AccessibilityMessageHandler { - /** - * The Dart application would like the given {@code message} to be announced. - */ - void announce(@NonNull String message); - - /** - * The user has tapped on the artifact with the given {@code nodeId}. - */ - void onTap(int nodeId); - - /** - * The user has long pressed on the artifact with the given {@code nodeId}. - */ - void onLongPress(int nodeId); - - /** - * The user has opened a popup window, menu, dialog, etc. - */ - void onTooltip(@NonNull String message); - } -} diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java index 52e4fbb46171d..ffb8f1f84a155 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java @@ -6,17 +6,14 @@ import android.support.annotation.NonNull; -import java.util.ArrayList; import java.util.Arrays; -import java.util.List; -import java.util.Locale; import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.plugin.common.JSONMethodCodec; import io.flutter.plugin.common.MethodChannel; /** - * Sends the platform's locales to Dart. + * TODO(mattcarroll): fill in javadoc for LocalizationChannel. */ public class LocalizationChannel { @@ -27,18 +24,12 @@ public LocalizationChannel(@NonNull DartExecutor dartExecutor) { this.channel = new MethodChannel(dartExecutor, "flutter/localization", JSONMethodCodec.INSTANCE); } - /** - * Send the given {@code locales} to Dart. - */ - public void sendLocales(List locales) { - List data = new ArrayList<>(); - for (Locale locale : locales) { - data.add(locale.getLanguage()); - data.add(locale.getCountry()); - data.add(locale.getScript()); - data.add(locale.getVariant()); - } - channel.invokeMethod("setLocale", data); + public void setLocale(String language, String country) { + channel.invokeMethod("setLocale", Arrays.asList(language, country)); + } + + public void setMethodCallHandler(MethodChannel.MethodCallHandler handler) { + channel.setMethodCallHandler(handler); } } diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java index 44269313bb983..b1ceb82b7a74d 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java @@ -4,613 +4,26 @@ package io.flutter.embedding.engine.systemchannels; -import android.content.pm.ActivityInfo; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import java.util.ArrayList; -import java.util.List; - import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.plugin.common.JSONMethodCodec; -import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; /** - * System channel that receives requests for host platform behavior, e.g., haptic and sound - * effects, system chrome configurations, and clipboard interaction. + * TODO(mattcarroll): fill in javadoc for PlatformChannel. */ public class PlatformChannel { - @NonNull - public final MethodChannel channel; - @Nullable - private PlatformMessageHandler platformMessageHandler; - - private final MethodChannel.MethodCallHandler parsingMethodCallHandler = new MethodChannel.MethodCallHandler() { - @Override - public void onMethodCall(MethodCall call, MethodChannel.Result result) { - if (platformMessageHandler == null) { - // If no explicit PlatformMessageHandler has been registered then we don't - // need to forward this call to an API. Return. - return; - } - - String method = call.method; - Object arguments = call.arguments; - try { - switch (method) { - case "SystemSound.play": - try { - SoundType soundType = SoundType.fromValue((String) arguments); - platformMessageHandler.playSystemSound(soundType); - result.success(null); - } catch (NoSuchFieldException exception) { - // The desired sound type does not exist. - result.error("error", exception.getMessage(), null); - } - break; - case "HapticFeedback.vibrate": - try { - HapticFeedbackType feedbackType = HapticFeedbackType.fromValue((String) arguments); - platformMessageHandler.vibrateHapticFeedback(feedbackType); - result.success(null); - } catch (NoSuchFieldException exception) { - // The desired feedback type does not exist. - result.error("error", exception.getMessage(), null); - } - break; - case "SystemChrome.setPreferredOrientations": - try { - int androidOrientation = decodeOrientations((JSONArray) arguments); - platformMessageHandler.setPreferredOrientations(androidOrientation); - result.success(null); - } catch (JSONException | NoSuchFieldException exception) { - // JSONException: One or more expected fields were either omitted or referenced an invalid type. - // NoSuchFieldException: One or more expected fields were either omitted or referenced an invalid type. - result.error("error", exception.getMessage(), null); - } - break; - case "SystemChrome.setApplicationSwitcherDescription": - try { - AppSwitcherDescription description = decodeAppSwitcherDescription((JSONObject) arguments); - platformMessageHandler.setApplicationSwitcherDescription(description); - result.success(null); - } catch (JSONException exception) { - // One or more expected fields were either omitted or referenced an invalid type. - result.error("error", exception.getMessage(), null); - } - break; - case "SystemChrome.setEnabledSystemUIOverlays": - try { - List overlays = decodeSystemUiOverlays((JSONArray) arguments); - platformMessageHandler.showSystemOverlays(overlays); - result.success(null); - } catch (JSONException | NoSuchFieldException exception) { - // JSONException: One or more expected fields were either omitted or referenced an invalid type. - // NoSuchFieldException: One or more of the overlay names are invalid. - result.error("error", exception.getMessage(), null); - } - break; - case "SystemChrome.restoreSystemUIOverlays": - platformMessageHandler.restoreSystemUiOverlays(); - result.success(null); - break; - case "SystemChrome.setSystemUIOverlayStyle": - try { - SystemChromeStyle systemChromeStyle = decodeSystemChromeStyle((JSONObject) arguments); - platformMessageHandler.setSystemUiOverlayStyle(systemChromeStyle); - result.success(null); - } catch (JSONException | NoSuchFieldException exception) { - // JSONException: One or more expected fields were either omitted or referenced an invalid type. - // NoSuchFieldException: One or more of the brightness names are invalid. - result.error("error", exception.getMessage(), null); - } - break; - case "SystemNavigator.pop": - platformMessageHandler.popSystemNavigator(); - result.success(null); - break; - case "Clipboard.getData": { - String contentFormatName = (String) arguments; - ClipboardContentFormat clipboardFormat = null; - if (contentFormatName != null) { - try { - clipboardFormat = ClipboardContentFormat.fromValue(contentFormatName); - } catch (NoSuchFieldException exception) { - // An unsupported content format was requested. Return failure. - result.error("error", "No such clipboard content format: " + contentFormatName, null); - } - } - CharSequence clipboardContent = platformMessageHandler.getClipboardData(clipboardFormat); - if (clipboardContent != null) { - JSONObject response = new JSONObject(); - response.put("text", clipboardContent); - result.success(response); - } else { - result.success(null); - } - break; - } - case "Clipboard.setData": { - String clipboardContent = ((JSONObject) arguments).getString("text"); - platformMessageHandler.setClipboardData(clipboardContent); - result.success(null); - break; - } - default: - result.notImplemented(); - break; - } - } catch (JSONException e) { - result.error("error", "JSON error: " + e.getMessage(), null); - } - } - }; + public final MethodChannel channel; - /** - * Constructs a {@code PlatformChannel} that connects Android to the Dart code - * running in {@code dartExecutor}. - * - * The given {@code dartExecutor} is permitted to be idle or executing code. - * - * See {@link DartExecutor}. - */ public PlatformChannel(@NonNull DartExecutor dartExecutor) { - channel = new MethodChannel(dartExecutor, "flutter/platform", JSONMethodCodec.INSTANCE); - channel.setMethodCallHandler(parsingMethodCallHandler); - } - - /** - * Sets the {@link PlatformMessageHandler} which receives all events and requests - * that are parsed from the underlying platform channel. - */ - public void setPlatformMessageHandler(@Nullable PlatformMessageHandler platformMessageHandler) { - this.platformMessageHandler = platformMessageHandler; - } - - // TODO(mattcarroll): add support for IntDef annotations, then add @ScreenOrientation - - /** - * Decodes a series of orientations to an aggregate desired orientation. - * - * @throws JSONException if {@code encodedOrientations} does not contain expected keys and value types. - * @throws NoSuchFieldException if any given encoded orientation is not a valid orientation name. - */ - private int decodeOrientations(@NonNull JSONArray encodedOrientations) throws JSONException, NoSuchFieldException { - int requestedOrientation = 0x00; - int firstRequestedOrientation = 0x00; - for (int index = 0; index < encodedOrientations.length(); index += 1) { - String encodedOrientation = encodedOrientations.getString(index); - DeviceOrientation orientation = DeviceOrientation.fromValue(encodedOrientation); - - switch (orientation) { - case PORTRAIT_UP: - requestedOrientation |= 0x01; - break; - case PORTRAIT_DOWN: - requestedOrientation |= 0x04; - break; - case LANDSCAPE_LEFT: - requestedOrientation |= 0x02; - break; - case LANDSCAPE_RIGHT: - requestedOrientation |= 0x08; - break; - } - - if (firstRequestedOrientation == 0x00) { - firstRequestedOrientation = requestedOrientation; - } - } - - switch (requestedOrientation) { - case 0x00: - return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; - case 0x01: - return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; - case 0x02: - return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; - case 0x04: - return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; - case 0x05: - return ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT; - case 0x08: - return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; - case 0x0a: - return ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE; - case 0x0b: - return ActivityInfo.SCREEN_ORIENTATION_USER; - case 0x0f: - return ActivityInfo.SCREEN_ORIENTATION_FULL_USER; - case 0x03: // portraitUp and landscapeLeft - case 0x06: // portraitDown and landscapeLeft - case 0x07: // portraitUp, portraitDown, and landscapeLeft - case 0x09: // portraitUp and landscapeRight - case 0x0c: // portraitDown and landscapeRight - case 0x0d: // portraitUp, portraitDown, and landscapeRight - case 0x0e: // portraitDown, landscapeLeft, and landscapeRight - // Android can't describe these cases, so just default to whatever the first - // specified value was. - switch (firstRequestedOrientation) { - case 0x01: - return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; - case 0x02: - return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; - case 0x04: - return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; - case 0x08: - return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; - } - } - - // Execution should never get this far, but if it does then we default - // to a portrait orientation. - return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; - } - - private AppSwitcherDescription decodeAppSwitcherDescription(@NonNull JSONObject encodedDescription) throws JSONException { - int color = encodedDescription.getInt("primaryColor"); - if (color != 0) { // 0 means color isn't set, use system default - color = color | 0xFF000000; // color must be opaque if set - } - String label = encodedDescription.getString("label"); - return new AppSwitcherDescription(color, label); - } - - /** - * Decodes a list of JSON-encoded overlays to a list of {@link SystemUiOverlay}. - * - * @throws JSONException if {@code encodedSystemUiOverlay} does not contain expected keys and value types. - * @throws NoSuchFieldException if any of the given encoded overlay names are invalid. - */ - private List decodeSystemUiOverlays(@NonNull JSONArray encodedSystemUiOverlay) throws JSONException, NoSuchFieldException { - List overlays = new ArrayList<>(); - for (int i = 0; i < encodedSystemUiOverlay.length(); ++i) { - String encodedOverlay = encodedSystemUiOverlay.getString(i); - SystemUiOverlay overlay = SystemUiOverlay.fromValue(encodedOverlay); - switch(overlay) { - case TOP_OVERLAYS: - overlays.add(SystemUiOverlay.TOP_OVERLAYS); - break; - case BOTTOM_OVERLAYS: - overlays.add(SystemUiOverlay.BOTTOM_OVERLAYS); - break; - } - } - return overlays; - } - - /** - * Decodes a JSON-encoded {@code encodedStyle} to a {@link SystemChromeStyle}. - * - * @throws JSONException if {@code encodedStyle} does not contain expected keys and value types. - * @throws NoSuchFieldException if any provided brightness name is invalid. - */ - private SystemChromeStyle decodeSystemChromeStyle(@NonNull JSONObject encodedStyle) throws JSONException, NoSuchFieldException { - Brightness systemNavigationBarIconBrightness = null; - // TODO(mattcarroll): add color annotation - Integer systemNavigationBarColor = null; - // TODO(mattcarroll): add color annotation - Integer systemNavigationBarDividerColor = null; - Brightness statusBarIconBrightness = null; - // TODO(mattcarroll): add color annotation - Integer statusBarColor = null; - - if (!encodedStyle.isNull("systemNavigationBarIconBrightness")) { - systemNavigationBarIconBrightness = Brightness.fromValue(encodedStyle.getString("systemNavigationBarIconBrightness")); - } - - if (!encodedStyle.isNull("systemNavigationBarColor")) { - systemNavigationBarColor = encodedStyle.getInt("systemNavigationBarColor"); - } - - if (!encodedStyle.isNull("statusBarIconBrightness")) { - statusBarIconBrightness = Brightness.fromValue(encodedStyle.getString("statusBarIconBrightness")); - } - - if (!encodedStyle.isNull("statusBarColor")) { - statusBarColor = encodedStyle.getInt("statusBarColor"); - } - - if (!encodedStyle.isNull("systemNavigationBarDividerColor")) { - systemNavigationBarDividerColor = encodedStyle.getInt("systemNavigationBarDividerColor"); - } - - return new SystemChromeStyle( - statusBarColor, - statusBarIconBrightness, - systemNavigationBarColor, - systemNavigationBarIconBrightness, - systemNavigationBarDividerColor - ); + this.channel = new MethodChannel(dartExecutor, "flutter/platform", JSONMethodCodec.INSTANCE); } - /** - * Handler that receives platform messages sent from Flutter to Android - * through a given {@link PlatformChannel}. - * - * To register a {@code PlatformMessageHandler} with a {@link PlatformChannel}, - * see {@link PlatformChannel#setPlatformMessageHandler(PlatformMessageHandler)}. - */ - public interface PlatformMessageHandler { - /** - * The Flutter application would like to play the given {@code soundType}. - */ - void playSystemSound(@NonNull SoundType soundType); - - /** - * The Flutter application would like to play the given haptic {@code feedbackType}. - */ - void vibrateHapticFeedback(@NonNull HapticFeedbackType feedbackType); - - /** - * The Flutter application would like to display in the given {@code androidOrientation}. - */ - // TODO(mattcarroll): add @ScreenOrientation annotation - void setPreferredOrientations(int androidOrientation); - - /** - * The Flutter application would like to be displayed in Android's app switcher with - * the visual representation described in the given {@code description}. - *

- * See the related Android documentation: - * https://developer.android.com/guide/components/activities/recents - */ - void setApplicationSwitcherDescription(@NonNull AppSwitcherDescription description); - - /** - * The Flutter application would like the Android system to display the given - * {@code overlays}. - *

- * {@link SystemUiOverlay#TOP_OVERLAYS} refers to system overlays such as the - * status bar, while {@link SystemUiOverlay#BOTTOM_OVERLAYS} refers to system - * overlays such as the back/home/recents navigation on the bottom of the screen. - *

- * An empty list of {@code overlays} should hide all system overlays. - */ - void showSystemOverlays(@NonNull List overlays); - - /** - * The Flutter application would like to restore the visibility of system - * overlays to the last set of overlays sent via {@link #showSystemOverlays(List)}. - *

- * If {@link #showSystemOverlays(List)} has yet to be called, then a default - * system overlay appearance is desired: - *

- * {@code - * View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - * } - */ - void restoreSystemUiOverlays(); - - /** - * The Flutter application would like the system chrome to present itself with - * the given {@code systemUiOverlayStyle}, i.e., the given status bar and - * navigation bar colors and brightness. - */ - void setSystemUiOverlayStyle(@NonNull SystemChromeStyle systemUiOverlayStyle); - - /** - * The Flutter application would like to pop the top item off of the Android - * app's navigation back stack. - */ - void popSystemNavigator(); - - /** - * The Flutter application would like to receive the current data in the - * clipboard and have it returned in the given {@code format}. - */ - @Nullable - CharSequence getClipboardData(@Nullable ClipboardContentFormat format); - - /** - * The Flutter application would like to set the current data in the - * clipboard to the given {@code text}. - */ - void setClipboardData(@NonNull String text); + public void setMethodCallHandler(@Nullable MethodChannel.MethodCallHandler handler) { + channel.setMethodCallHandler(handler); } - /** - * Types of sounds the Android OS can play on behalf of an application. - */ - public enum SoundType { - CLICK("SoundType.click"); - - static SoundType fromValue(@NonNull String encodedName) throws NoSuchFieldException { - for (SoundType soundType : SoundType.values()) { - if (soundType.encodedName.equals(encodedName)) { - return soundType; - } - } - throw new NoSuchFieldException("No such SoundType: " + encodedName); - } - - @NonNull - private final String encodedName; - - SoundType(@NonNull String encodedName) { - this.encodedName = encodedName; - } - } - - /** - * The types of haptic feedback that the Android OS can generate on behalf - * of an application. - */ - public enum HapticFeedbackType { - STANDARD(null), - LIGHT_IMPACT("HapticFeedbackType.lightImpact"), - MEDIUM_IMPACT("HapticFeedbackType.mediumImpact"), - HEAVY_IMPACT("HapticFeedbackType.heavyImpact"), - SELECTION_CLICK("HapticFeedbackType.selectionClick"); - - static HapticFeedbackType fromValue(@Nullable String encodedName) throws NoSuchFieldException { - for (HapticFeedbackType feedbackType : HapticFeedbackType.values()) { - if ((feedbackType.encodedName == null && encodedName == null) - || (feedbackType.encodedName != null && feedbackType.encodedName.equals(encodedName))) { - return feedbackType; - } - } - throw new NoSuchFieldException("No such HapticFeedbackType: " + encodedName); - } - - @Nullable - private final String encodedName; - - HapticFeedbackType(@Nullable String encodedName) { - this.encodedName = encodedName; - } - } - - /** - * The possible desired orientations of a Flutter application. - */ - public enum DeviceOrientation { - PORTRAIT_UP("DeviceOrientation.portraitUp"), - PORTRAIT_DOWN("DeviceOrientation.portraitDown"), - LANDSCAPE_LEFT("DeviceOrientation.landscapeLeft"), - LANDSCAPE_RIGHT("DeviceOrientation.landscapeRight"); - - static DeviceOrientation fromValue(@NonNull String encodedName) throws NoSuchFieldException { - for (DeviceOrientation orientation : DeviceOrientation.values()) { - if (orientation.encodedName.equals(encodedName)) { - return orientation; - } - } - throw new NoSuchFieldException("No such DeviceOrientation: " + encodedName); - } - - @NonNull - private String encodedName; - - DeviceOrientation(@NonNull String encodedName) { - this.encodedName = encodedName; - } - } - - /** - * The set of Android system UI overlays as perceived by the Flutter application. - *

- * Android includes many more overlay options and flags than what is provided by - * {@code SystemUiOverlay}. Flutter only requires control over a subset of the - * overlays and those overlays are represented by {@code SystemUiOverlay} values. - */ - public enum SystemUiOverlay { - TOP_OVERLAYS("SystemUiOverlay.top"), - BOTTOM_OVERLAYS("SystemUiOverlay.bottom"); - - static SystemUiOverlay fromValue(@NonNull String encodedName) throws NoSuchFieldException { - for (SystemUiOverlay overlay : SystemUiOverlay.values()) { - if (overlay.encodedName.equals(encodedName)) { - return overlay; - } - } - throw new NoSuchFieldException("No such SystemUiOverlay: " + encodedName); - } - - @NonNull - private String encodedName; - - SystemUiOverlay(@NonNull String encodedName) { - this.encodedName = encodedName; - } - } - - /** - * The color and label of an application that appears in Android's app switcher, AKA - * recents screen. - */ - public static class AppSwitcherDescription { - // TODO(mattcarroll): add color annotation - public final int color; - @NonNull - public final String label; - - public AppSwitcherDescription(int color, @NonNull String label) { - this.color = color; - this.label = label; - } - } - - /** - * The color and brightness of system chrome, e.g., status bar and system navigation bar. - */ - public static class SystemChromeStyle { - // TODO(mattcarroll): add color annotation - @Nullable - public final Integer statusBarColor; - @Nullable - public final Brightness statusBarIconBrightness; - // TODO(mattcarroll): add color annotation - @Nullable - public final Integer systemNavigationBarColor; - @Nullable - public final Brightness systemNavigationBarIconBrightness; - // TODO(mattcarroll): add color annotation - @Nullable - public final Integer systemNavigationBarDividerColor; - - public SystemChromeStyle( - @Nullable Integer statusBarColor, - @Nullable Brightness statusBarIconBrightness, - @Nullable Integer systemNavigationBarColor, - @Nullable Brightness systemNavigationBarIconBrightness, - @Nullable Integer systemNavigationBarDividerColor - ) { - this.statusBarColor = statusBarColor; - this.statusBarIconBrightness = statusBarIconBrightness; - this.systemNavigationBarColor = systemNavigationBarColor; - this.systemNavigationBarIconBrightness = systemNavigationBarIconBrightness; - this.systemNavigationBarDividerColor = systemNavigationBarDividerColor; - } - } - - public enum Brightness { - LIGHT("Brightness.light"), - DARK("Brightness.dark"); - - static Brightness fromValue(@NonNull String encodedName) throws NoSuchFieldException { - for (Brightness brightness : Brightness.values()) { - if (brightness.encodedName.equals(encodedName)) { - return brightness; - } - } - throw new NoSuchFieldException("No such Brightness: " + encodedName); - } - - @NonNull - private String encodedName; - - Brightness(@NonNull String encodedName) { - this.encodedName = encodedName; - } - } - - /** - * Data formats of clipboard content. - */ - public enum ClipboardContentFormat { - PLAIN_TEXT("text/plain"); - - static ClipboardContentFormat fromValue(String encodedName) throws NoSuchFieldException { - for (ClipboardContentFormat format : ClipboardContentFormat.values()) { - if (format.encodedName.equals(encodedName)) { - return format; - } - } - throw new NoSuchFieldException("No such ClipboardContentFormat: " + encodedName); - } - - @NonNull - private String encodedName; - - ClipboardContentFormat(@NonNull String encodedName) { - this.encodedName = encodedName; - } - } } diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java deleted file mode 100644 index fc4b75521549d..0000000000000 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java +++ /dev/null @@ -1,406 +0,0 @@ -package io.flutter.embedding.engine.systemchannels; - -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.view.inputmethod.EditorInfo; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import java.util.Arrays; -import java.util.HashMap; - -import io.flutter.embedding.engine.dart.DartExecutor; -import io.flutter.plugin.common.JSONMethodCodec; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; - -/** - * {@link TextInputChannel} is a platform channel between Android and Flutter that is used to - * communicate information about the user's text input. - *

- * When the user presses an action button like "done" or "next", that action is sent from Android - * to Flutter through this {@link TextInputChannel}. - *

- * When an input system in the Flutter app wants to show the keyboard, or hide it, or configure - * editing state, etc. a message is sent from Flutter to Android through this {@link TextInputChannel}. - *

- * {@link TextInputChannel} comes with a default {@link io.flutter.plugin.common.MethodChannel.MethodCallHandler} - * that parses incoming messages from Flutter. Register a {@link TextInputMethodHandler} to respond - * to standard Flutter text input messages. - */ -public class TextInputChannel { - @NonNull - public final MethodChannel channel; - @Nullable - private TextInputMethodHandler textInputMethodHandler; - - private final MethodChannel.MethodCallHandler parsingMethodHandler = new MethodChannel.MethodCallHandler() { - @Override - public void onMethodCall(MethodCall call, MethodChannel.Result result) { - if (textInputMethodHandler == null) { - // If no explicit TextInputMethodHandler has been registered then we don't - // need to forward this call to an API. Return. - return; - } - - String method = call.method; - Object args = call.arguments; - switch (method) { - case "TextInput.show": - textInputMethodHandler.show(); - result.success(null); - break; - case "TextInput.hide": - textInputMethodHandler.hide(); - result.success(null); - break; - case "TextInput.setClient": - try { - final JSONArray argumentList = (JSONArray) args; - final int textInputClientId = argumentList.getInt(0); - final JSONObject jsonConfiguration = argumentList.getJSONObject(1); - textInputMethodHandler.setClient(textInputClientId, Configuration.fromJson(jsonConfiguration)); - result.success(null); - } catch (JSONException | NoSuchFieldException exception) { - // JSONException: missing keys or bad value types. - // NoSuchFieldException: one or more values were invalid. - result.error("error", exception.getMessage(), null); - } - break; - case "TextInput.setEditingState": - try { - final JSONObject editingState = (JSONObject) args; - textInputMethodHandler.setEditingState(TextEditState.fromJson(editingState)); - result.success(null); - } catch (JSONException exception) { - result.error("error", exception.getMessage(), null); - } - break; - case "TextInput.clearClient": - textInputMethodHandler.clearClient(); - result.success(null); - break; - default: - result.notImplemented(); - break; - } - } - }; - - /** - * Constructs a {@code TextInputChannel} that connects Android to the Dart code - * running in {@code dartExecutor}. - * - * The given {@code dartExecutor} is permitted to be idle or executing code. - * - * See {@link DartExecutor}. - */ - public TextInputChannel(@NonNull DartExecutor dartExecutor) { - this.channel = new MethodChannel(dartExecutor, "flutter/textinput", JSONMethodCodec.INSTANCE); - channel.setMethodCallHandler(parsingMethodHandler); - } - - /** - * Instructs Flutter to update its text input editing state to reflect the given configuration. - */ - public void updateEditingState(int inputClientId, String text, int selectionStart, int selectionEnd, int composingStart, int composingEnd) { - HashMap state = new HashMap<>(); - state.put("text", text); - state.put("selectionBase", selectionStart); - state.put("selectionExtent", selectionEnd); - state.put("composingBase", composingStart); - state.put("composingExtent", composingEnd); - - channel.invokeMethod( - "TextInputClient.updateEditingState", - Arrays.asList(inputClientId, state) - ); - } - - /** - * Instructs Flutter to execute a "newline" action. - */ - public void newline(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.newline") - ); - } - - /** - * Instructs Flutter to execute a "go" action. - */ - public void go(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.go") - ); - } - - /** - * Instructs Flutter to execute a "search" action. - */ - public void search(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.search") - ); - } - - /** - * Instructs Flutter to execute a "send" action. - */ - public void send(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.send") - ); - } - - /** - * Instructs Flutter to execute a "done" action. - */ - public void done(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.done") - ); - } - - /** - * Instructs Flutter to execute a "next" action. - */ - public void next(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.next") - ); - } - - /** - * Instructs Flutter to execute a "previous" action. - */ - public void previous(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.previous") - ); - } - - /** - * Instructs Flutter to execute an "unspecified" action. - */ - public void unspecifiedAction(int inputClientId) { - channel.invokeMethod( - "TextInputClient.performAction", - Arrays.asList(inputClientId, "TextInputAction.unspecified") - ); - } - - /** - * Sets the {@link TextInputMethodHandler} which receives all events and requests - * that are parsed from the underlying platform channel. - */ - public void setTextInputMethodHandler(@Nullable TextInputMethodHandler textInputMethodHandler) { - this.textInputMethodHandler = textInputMethodHandler; - } - - public interface TextInputMethodHandler { - // TODO(mattcarroll): javadoc - void show(); - - // TODO(mattcarroll): javadoc - void hide(); - - // TODO(mattcarroll): javadoc - void setClient(int textInputClientId, @NonNull Configuration configuration); - - // TODO(mattcarroll): javadoc - void setEditingState(@NonNull TextEditState editingState); - - // TODO(mattcarroll): javadoc - void clearClient(); - } - - /** - * A text editing configuration. - */ - public static class Configuration { - public static Configuration fromJson(@NonNull JSONObject json) throws JSONException, NoSuchFieldException { - final String inputActionName = json.getString("inputAction"); - if (inputActionName == null) { - throw new JSONException("Configuration JSON missing 'inputAction' property."); - } - - final Integer inputAction = inputActionFromTextInputAction(inputActionName); - return new Configuration( - json.optBoolean("obscureText"), - json.optBoolean("autocorrect", true), - TextCapitalization.fromValue(json.getString("textCapitalization")), - InputType.fromJson(json.getJSONObject("inputType")), - inputAction, - json.optString("actionLabel") - ); - } - - private static Integer inputActionFromTextInputAction(@NonNull String inputAction) { - switch (inputAction) { - case "TextInputAction.newline": - return EditorInfo.IME_ACTION_NONE; - case "TextInputAction.none": - return EditorInfo.IME_ACTION_NONE; - case "TextInputAction.unspecified": - return EditorInfo.IME_ACTION_UNSPECIFIED; - case "TextInputAction.done": - return EditorInfo.IME_ACTION_DONE; - case "TextInputAction.go": - return EditorInfo.IME_ACTION_GO; - case "TextInputAction.search": - return EditorInfo.IME_ACTION_SEARCH; - case "TextInputAction.send": - return EditorInfo.IME_ACTION_SEND; - case "TextInputAction.next": - return EditorInfo.IME_ACTION_NEXT; - case "TextInputAction.previous": - return EditorInfo.IME_ACTION_PREVIOUS; - default: - // Present default key if bad input type is given. - return EditorInfo.IME_ACTION_UNSPECIFIED; - } - } - - public final boolean obscureText; - public final boolean autocorrect; - @NonNull - public final TextCapitalization textCapitalization; - @NonNull - public final InputType inputType; - @Nullable - public final Integer inputAction; - @Nullable - public final String actionLabel; - - public Configuration( - boolean obscureText, - boolean autocorrect, - @NonNull TextCapitalization textCapitalization, - @NonNull InputType inputType, - @Nullable Integer inputAction, - @Nullable String actionLabel - ) { - this.obscureText = obscureText; - this.autocorrect = autocorrect; - this.textCapitalization = textCapitalization; - this.inputType = inputType; - this.inputAction = inputAction; - this.actionLabel = actionLabel; - } - } - - /** - * A text input type. - * - * If the {@link #type} is {@link TextInputType#NUMBER}, this {@code InputType} also - * reports whether that number {@link #isSigned} and {@link #isDecimal}. - */ - public static class InputType { - @NonNull - public static InputType fromJson(@NonNull JSONObject json) throws JSONException, NoSuchFieldException { - return new InputType( - TextInputType.fromValue(json.getString("name")), - json.optBoolean("signed", false), - json.optBoolean("decimal", false) - ); - } - - @NonNull - public final TextInputType type; - public final boolean isSigned; - public final boolean isDecimal; - - public InputType(@NonNull TextInputType type, boolean isSigned, boolean isDecimal) { - this.type = type; - this.isSigned = isSigned; - this.isDecimal = isDecimal; - } - } - - /** - * Types of text input. - */ - public enum TextInputType { - DATETIME("TextInputType.datetime"), - NUMBER("TextInputType.number"), - PHONE("TextInputType.phone"), - MULTILINE("TextInputType.multiline"), - EMAIL_ADDRESS("TextInputType.emailAddress"), - URL("TextInputType.url"); - - static TextInputType fromValue(@NonNull String encodedName) throws NoSuchFieldException { - for (TextInputType textInputType : TextInputType.values()) { - if (textInputType.encodedName.equals(encodedName)) { - return textInputType; - } - } - throw new NoSuchFieldException("No such TextInputType: " + encodedName); - } - - @NonNull - private final String encodedName; - - TextInputType(@NonNull String encodedName) { - this.encodedName = encodedName; - } - } - - /** - * Text capitalization schemes. - */ - public enum TextCapitalization { - CHARACTERS("TextCapitalization.characters"), - WORDS("TextCapitalization.words"), - SENTENCES("TextCapitalization.sentences"); - - static TextCapitalization fromValue(@NonNull String encodedName) throws NoSuchFieldException { - for (TextCapitalization textCapitalization : TextCapitalization.values()) { - if (textCapitalization.encodedName.equals(encodedName)) { - return textCapitalization; - } - } - throw new NoSuchFieldException("No such TextCapitalization: " + encodedName); - } - - @NonNull - private final String encodedName; - - TextCapitalization(@NonNull String encodedName) { - this.encodedName = encodedName; - } - } - - /** - * State of an on-going text editing session. - */ - public static class TextEditState { - public static TextEditState fromJson(@NonNull JSONObject textEditState) throws JSONException { - return new TextEditState( - textEditState.getString("text"), - textEditState.getInt("selectionBase"), - textEditState.getInt("selectionExtent") - ); - } - - @NonNull - public final String text; - public final int selectionStart; - public final int selectionEnd; - - public TextEditState(@NonNull String text, int selectionStart, int selectionEnd) { - this.text = text; - this.selectionStart = selectionStart; - this.selectionEnd = selectionEnd; - } - } -} diff --git a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java index b3a287820bfe9..df907be0b70a1 100644 --- a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java +++ b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java @@ -11,16 +11,17 @@ import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; - -import io.flutter.embedding.engine.systemchannels.TextInputChannel; import io.flutter.plugin.common.ErrorLogResult; import io.flutter.plugin.common.MethodChannel; import io.flutter.view.FlutterView; +import java.util.Arrays; +import java.util.HashMap; + class InputConnectionAdaptor extends BaseInputConnection { private final FlutterView mFlutterView; private final int mClient; - private final TextInputChannel textInputChannel; + private final MethodChannel mFlutterChannel; private final Editable mEditable; private int mBatchCount; private InputMethodManager mImm; @@ -28,16 +29,12 @@ class InputConnectionAdaptor extends BaseInputConnection { private static final MethodChannel.Result logger = new ErrorLogResult("FlutterTextInput"); - public InputConnectionAdaptor( - FlutterView view, - int client, - TextInputChannel textInputChannel, - Editable editable - ) { + public InputConnectionAdaptor(FlutterView view, int client, + MethodChannel flutterChannel, Editable editable) { super(view, true); mFlutterView = view; mClient = client; - this.textInputChannel = textInputChannel; + mFlutterChannel = flutterChannel; mEditable = editable; mBatchCount = 0; mImm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); @@ -58,14 +55,14 @@ private void updateEditingState() { selectionStart, selectionEnd, composingStart, composingEnd); - textInputChannel.updateEditingState( - mClient, - mEditable.toString(), - selectionStart, - selectionEnd, - composingStart, - composingEnd - ); + HashMap state = new HashMap<>(); + state.put("text", mEditable.toString()); + state.put("selectionBase", selectionStart); + state.put("selectionExtent", selectionEnd); + state.put("composingBase", composingStart); + state.put("composingExtent", composingEnd); + mFlutterChannel.invokeMethod("TextInputClient.updateEditingState", + Arrays.asList(mClient, state), logger); } @Override @@ -181,30 +178,39 @@ public boolean sendKeyEvent(KeyEvent event) { @Override public boolean performEditorAction(int actionCode) { switch (actionCode) { + // TODO(mattcarroll): is newline an appropriate action for "none"? case EditorInfo.IME_ACTION_NONE: - textInputChannel.newline(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.newline"), logger); break; case EditorInfo.IME_ACTION_UNSPECIFIED: - textInputChannel.unspecifiedAction(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.unspecified"), logger); break; case EditorInfo.IME_ACTION_GO: - textInputChannel.go(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.go"), logger); break; case EditorInfo.IME_ACTION_SEARCH: - textInputChannel.search(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.search"), logger); break; case EditorInfo.IME_ACTION_SEND: - textInputChannel.send(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.send"), logger); break; case EditorInfo.IME_ACTION_NEXT: - textInputChannel.next(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.next"), logger); break; case EditorInfo.IME_ACTION_PREVIOUS: - textInputChannel.previous(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.previous"), logger); break; default: case EditorInfo.IME_ACTION_DONE: - textInputChannel.done(mClient); + mFlutterChannel.invokeMethod("TextInputClient.performAction", + Arrays.asList(mClient, "TextInputAction.done"), logger); break; } return true; diff --git a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java index bc54b3ed045ac..c59ee25148e2d 100644 --- a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java +++ b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java @@ -5,7 +5,6 @@ package io.flutter.plugin.editing; import android.content.Context; -import android.support.annotation.NonNull; import android.text.Editable; import android.text.InputType; import android.text.Selection; @@ -13,87 +12,84 @@ import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; - -import io.flutter.embedding.engine.dart.DartExecutor; -import io.flutter.embedding.engine.systemchannels.TextInputChannel; +import io.flutter.plugin.common.JSONMethodCodec; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; +import io.flutter.plugin.common.MethodChannel.MethodCallHandler; +import io.flutter.plugin.common.MethodChannel.Result; import io.flutter.view.FlutterView; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; /** * Android implementation of the text input plugin. */ -public class TextInputPlugin { +public class TextInputPlugin implements MethodCallHandler { private final FlutterView mView; private final InputMethodManager mImm; - private final TextInputChannel textInputChannel; + private final MethodChannel mFlutterChannel; private int mClient = 0; - private TextInputChannel.Configuration configuration; + private JSONObject mConfiguration; private Editable mEditable; private boolean mRestartInputPending; - public TextInputPlugin(FlutterView view, @NonNull DartExecutor dartExecutor) { + public TextInputPlugin(FlutterView view) { mView = view; mImm = (InputMethodManager) view.getContext().getSystemService( Context.INPUT_METHOD_SERVICE); + mFlutterChannel = new MethodChannel(view, "flutter/textinput", JSONMethodCodec.INSTANCE); + mFlutterChannel.setMethodCallHandler(this); + } - textInputChannel = new TextInputChannel(dartExecutor); - textInputChannel.setTextInputMethodHandler(new TextInputChannel.TextInputMethodHandler() { - @Override - public void show() { + @Override + public void onMethodCall(MethodCall call, Result result) { + String method = call.method; + Object args = call.arguments; + try { + if (method.equals("TextInput.show")) { showTextInput(mView); - } - - @Override - public void hide() { + result.success(null); + } else if (method.equals("TextInput.hide")) { hideTextInput(mView); - } - - @Override - public void setClient(int textInputClientId, TextInputChannel.Configuration configuration) { - setTextInputClient(textInputClientId, configuration); - } - - @Override - public void setEditingState(TextInputChannel.TextEditState editingState) { - setTextInputEditingState(mView, editingState); - } - - @Override - public void clearClient() { + result.success(null); + } else if (method.equals("TextInput.setClient")) { + final JSONArray argumentList = (JSONArray) args; + setTextInputClient(mView, argumentList.getInt(0), argumentList.getJSONObject(1)); + result.success(null); + } else if (method.equals("TextInput.setEditingState")) { + setTextInputEditingState(mView, (JSONObject) args); + result.success(null); + } else if (method.equals("TextInput.clearClient")) { clearTextInputClient(); + result.success(null); + } else { + result.notImplemented(); } - }); + } catch (JSONException e) { + result.error("error", "JSON error: " + e.getMessage(), null); + } } - private static int inputTypeFromTextInputType( - TextInputChannel.InputType type, - boolean obscureText, - boolean autocorrect, - TextInputChannel.TextCapitalization textCapitalization - ) { - if (type.type == TextInputChannel.TextInputType.DATETIME) { - return InputType.TYPE_CLASS_DATETIME; - } else if (type.type == TextInputChannel.TextInputType.NUMBER) { + private static int inputTypeFromTextInputType(JSONObject type, boolean obscureText, + boolean autocorrect, String textCapitalization) throws JSONException { + String inputType = type.getString("name"); + if (inputType.equals("TextInputType.datetime")) return InputType.TYPE_CLASS_DATETIME; + if (inputType.equals("TextInputType.number")) { int textType = InputType.TYPE_CLASS_NUMBER; - if (type.isSigned) { - textType |= InputType.TYPE_NUMBER_FLAG_SIGNED; - } - if (type.isDecimal) { - textType |= InputType.TYPE_NUMBER_FLAG_DECIMAL; - } + if (type.optBoolean("signed")) textType |= InputType.TYPE_NUMBER_FLAG_SIGNED; + if (type.optBoolean("decimal")) textType |= InputType.TYPE_NUMBER_FLAG_DECIMAL; return textType; - } else if (type.type == TextInputChannel.TextInputType.PHONE) { - return InputType.TYPE_CLASS_PHONE; } + if (inputType.equals("TextInputType.phone")) return InputType.TYPE_CLASS_PHONE; int textType = InputType.TYPE_CLASS_TEXT; - if (type.type == TextInputChannel.TextInputType.MULTILINE) { + if (inputType.equals("TextInputType.multiline")) textType |= InputType.TYPE_TEXT_FLAG_MULTI_LINE; - } else if (type.type == TextInputChannel.TextInputType.EMAIL_ADDRESS) { + else if (inputType.equals("TextInputType.emailAddress")) textType |= InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; - } else if (type.type == TextInputChannel.TextInputType.URL) { + else if (inputType.equals("TextInputType.url")) textType |= InputType.TYPE_TEXT_VARIATION_URI; - } - if (obscureText) { // Note: both required. Some devices ignore TYPE_TEXT_FLAG_NO_SUGGESTIONS. textType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; @@ -101,50 +97,69 @@ private static int inputTypeFromTextInputType( } else { if (autocorrect) textType |= InputType.TYPE_TEXT_FLAG_AUTO_CORRECT; } - - if (textCapitalization == TextInputChannel.TextCapitalization.CHARACTERS) { + if (textCapitalization.equals("TextCapitalization.characters")) { textType |= InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; - } else if (textCapitalization == TextInputChannel.TextCapitalization.WORDS) { + } else if (textCapitalization.equals("TextCapitalization.words")) { textType |= InputType.TYPE_TEXT_FLAG_CAP_WORDS; - } else if (textCapitalization == TextInputChannel.TextCapitalization.SENTENCES) { + } else if (textCapitalization.equals("TextCapitalization.sentences")) { textType |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; } - return textType; } - public InputConnection createInputConnection(FlutterView view, EditorInfo outAttrs) { + private static int inputActionFromTextInputAction(String inputAction) { + switch (inputAction) { + case "TextInputAction.newline": + return EditorInfo.IME_ACTION_NONE; + case "TextInputAction.none": + return EditorInfo.IME_ACTION_NONE; + case "TextInputAction.unspecified": + return EditorInfo.IME_ACTION_UNSPECIFIED; + case "TextInputAction.done": + return EditorInfo.IME_ACTION_DONE; + case "TextInputAction.go": + return EditorInfo.IME_ACTION_GO; + case "TextInputAction.search": + return EditorInfo.IME_ACTION_SEARCH; + case "TextInputAction.send": + return EditorInfo.IME_ACTION_SEND; + case "TextInputAction.next": + return EditorInfo.IME_ACTION_NEXT; + case "TextInputAction.previous": + return EditorInfo.IME_ACTION_PREVIOUS; + default: + // Present default key if bad input type is given. + return EditorInfo.IME_ACTION_UNSPECIFIED; + } + } + + public InputConnection createInputConnection(FlutterView view, EditorInfo outAttrs) + throws JSONException { if (mClient == 0) return null; - outAttrs.inputType = inputTypeFromTextInputType( - configuration.inputType, - configuration.obscureText, - configuration.autocorrect, - configuration.textCapitalization - ); + outAttrs.inputType = inputTypeFromTextInputType(mConfiguration.getJSONObject("inputType"), + mConfiguration.optBoolean("obscureText"), + mConfiguration.optBoolean("autocorrect", true), + mConfiguration.getString("textCapitalization")); outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN; int enterAction; - if (configuration.inputAction == null) { + if (mConfiguration.isNull("inputAction")) { // If an explicit input action isn't set, then default to none for multi-line fields // and done for single line fields. enterAction = (InputType.TYPE_TEXT_FLAG_MULTI_LINE & outAttrs.inputType) != 0 ? EditorInfo.IME_ACTION_NONE : EditorInfo.IME_ACTION_DONE; } else { - enterAction = configuration.inputAction; + enterAction = inputActionFromTextInputAction(mConfiguration.getString("inputAction")); } - if (configuration.actionLabel != null) { - outAttrs.actionLabel = configuration.actionLabel; + if (!mConfiguration.isNull("actionLabel")) { + outAttrs.actionLabel = mConfiguration.getString("actionLabel"); outAttrs.actionId = enterAction; } outAttrs.imeOptions |= enterAction; - InputConnectionAdaptor connection = new InputConnectionAdaptor( - view, - mClient, - textInputChannel, - mEditable - ); + InputConnectionAdaptor connection = + new InputConnectionAdaptor(view, mClient, mFlutterChannel, mEditable); outAttrs.initialSelStart = Selection.getSelectionStart(mEditable); outAttrs.initialSelEnd = Selection.getSelectionEnd(mEditable); @@ -160,9 +175,9 @@ private void hideTextInput(FlutterView view) { mImm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0); } - private void setTextInputClient(int client, TextInputChannel.Configuration configuration) { + private void setTextInputClient(FlutterView view, int client, JSONObject configuration) { mClient = client; - this.configuration = configuration; + mConfiguration = configuration; mEditable = Editable.Factory.getInstance().newEditable(""); // setTextInputClient will be followed by a call to setTextInputEditingState. @@ -170,9 +185,9 @@ private void setTextInputClient(int client, TextInputChannel.Configuration confi mRestartInputPending = true; } - private void applyStateToSelection(TextInputChannel.TextEditState state) { - int selStart = state.selectionStart; - int selEnd = state.selectionEnd; + private void applyStateToSelection(JSONObject state) throws JSONException { + int selStart = state.getInt("selectionBase"); + int selEnd = state.getInt("selectionExtent"); if (selStart >= 0 && selStart <= mEditable.length() && selEnd >= 0 && selEnd <= mEditable.length()) { Selection.setSelection(mEditable, selStart, selEnd); @@ -181,15 +196,15 @@ private void applyStateToSelection(TextInputChannel.TextEditState state) { } } - private void setTextInputEditingState(FlutterView view, TextInputChannel.TextEditState state) { - if (!mRestartInputPending && state.text.equals(mEditable.toString())) { + private void setTextInputEditingState(FlutterView view, JSONObject state) throws JSONException { + if (!mRestartInputPending && state.getString("text").equals(mEditable.toString())) { applyStateToSelection(state); mImm.updateSelection(mView, Math.max(Selection.getSelectionStart(mEditable), 0), Math.max(Selection.getSelectionEnd(mEditable), 0), BaseInputConnection.getComposingSpanStart(mEditable), BaseInputConnection.getComposingSpanEnd(mEditable)); } else { - mEditable.replace(0, mEditable.length(), state.text); + mEditable.replace(0, mEditable.length(), state.getString("text")); applyStateToSelection(state); mImm.restartInput(view); mRestartInputPending = false; diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java index e9d44001ef0f5..b6f53d45741f1 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java @@ -9,159 +9,212 @@ import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; +import android.content.pm.ActivityInfo; import android.os.Build; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import android.util.Log; import android.view.HapticFeedbackConstants; import android.view.SoundEffectConstants; import android.view.View; import android.view.Window; - -import java.util.List; - -import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.plugin.common.ActivityLifecycleListener; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel.MethodCallHandler; +import io.flutter.plugin.common.MethodChannel.Result; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; /** * Android implementation of the platform plugin. */ -public class PlatformPlugin implements ActivityLifecycleListener { +public class PlatformPlugin implements MethodCallHandler, ActivityLifecycleListener { + private final Activity mActivity; + private JSONObject mCurrentTheme; public static final int DEFAULT_SYSTEM_UI = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; + private static final String kTextPlainFormat = "text/plain"; - private final Activity activity; - private final PlatformChannel platformChannel; - private PlatformChannel.SystemChromeStyle currentTheme; - private int mEnabledOverlays; - - private final PlatformChannel.PlatformMessageHandler mPlatformMessageHandler = new PlatformChannel.PlatformMessageHandler() { - @Override - public void playSystemSound(@NonNull PlatformChannel.SoundType soundType) { - PlatformPlugin.this.playSystemSound(soundType); - } - - @Override - public void vibrateHapticFeedback(@NonNull PlatformChannel.HapticFeedbackType feedbackType) { - PlatformPlugin.this.vibrateHapticFeedback(feedbackType); - } - - @Override - public void setPreferredOrientations(int androidOrientation) { - setSystemChromePreferredOrientations(androidOrientation); - } - - @Override - public void setApplicationSwitcherDescription(@NonNull PlatformChannel.AppSwitcherDescription description) { - setSystemChromeApplicationSwitcherDescription(description); - } - - @Override - public void showSystemOverlays(@NonNull List overlays) { - setSystemChromeEnabledSystemUIOverlays(overlays); - } - - @Override - public void restoreSystemUiOverlays() { - restoreSystemChromeSystemUIOverlays(); - } - - @Override - public void setSystemUiOverlayStyle(@NonNull PlatformChannel.SystemChromeStyle systemUiOverlayStyle) { - setSystemChromeSystemUIOverlayStyle(systemUiOverlayStyle); - } - - @Override - public void popSystemNavigator() { - PlatformPlugin.this.popSystemNavigator(); - } + public PlatformPlugin(Activity activity) { + mActivity = activity; + mEnabledOverlays = DEFAULT_SYSTEM_UI; + } - @Override - public CharSequence getClipboardData(@Nullable PlatformChannel.ClipboardContentFormat format) { - return PlatformPlugin.this.getClipboardData(format); + @Override + public void onMethodCall(MethodCall call, Result result) { + String method = call.method; + Object arguments = call.arguments; + try { + if (method.equals("SystemSound.play")) { + playSystemSound((String) arguments); + result.success(null); + } else if (method.equals("HapticFeedback.vibrate")) { + vibrateHapticFeedback((String) arguments); + result.success(null); + } else if (method.equals("SystemChrome.setPreferredOrientations")) { + setSystemChromePreferredOrientations((JSONArray) arguments); + result.success(null); + } else if (method.equals("SystemChrome.setApplicationSwitcherDescription")) { + setSystemChromeApplicationSwitcherDescription((JSONObject) arguments); + result.success(null); + } else if (method.equals("SystemChrome.setEnabledSystemUIOverlays")) { + setSystemChromeEnabledSystemUIOverlays((JSONArray) arguments); + result.success(null); + } else if (method.equals("SystemChrome.restoreSystemUIOverlays")) { + restoreSystemChromeSystemUIOverlays(); + result.success(null); + } else if (method.equals("SystemChrome.setSystemUIOverlayStyle")) { + setSystemChromeSystemUIOverlayStyle((JSONObject) arguments); + result.success(null); + } else if (method.equals("SystemNavigator.pop")) { + popSystemNavigator(); + result.success(null); + } else if (method.equals("Clipboard.getData")) { + result.success(getClipboardData((String) arguments)); + } else if (method.equals("Clipboard.setData")) { + setClipboardData((JSONObject) arguments); + result.success(null); + } else { + result.notImplemented(); + } + } catch (JSONException e) { + result.error("error", "JSON error: " + e.getMessage(), null); } + } - @Override - public void setClipboardData(@NonNull String text) { - PlatformPlugin.this.setClipboardData(text); + private void playSystemSound(String soundType) { + if (soundType.equals("SystemSoundType.click")) { + View view = mActivity.getWindow().getDecorView(); + view.playSoundEffect(SoundEffectConstants.CLICK); } - }; - - public PlatformPlugin(Activity activity, PlatformChannel platformChannel) { - this.activity = activity; - this.platformChannel = platformChannel; - this.platformChannel.setPlatformMessageHandler(mPlatformMessageHandler); - - mEnabledOverlays = DEFAULT_SYSTEM_UI; } - private void playSystemSound(PlatformChannel.SoundType soundType) { - if (soundType == PlatformChannel.SoundType.CLICK) { - View view = activity.getWindow().getDecorView(); - view.playSoundEffect(SoundEffectConstants.CLICK); + private void vibrateHapticFeedback(String feedbackType) { + View view = mActivity.getWindow().getDecorView(); + if (feedbackType == null) { + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } else if (feedbackType.equals("HapticFeedbackType.lightImpact")) { + view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); + } else if (feedbackType.equals("HapticFeedbackType.mediumImpact")) { + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + } else if (feedbackType.equals("HapticFeedbackType.heavyImpact")) { + // HapticFeedbackConstants.CONTEXT_CLICK from API level 23. + view.performHapticFeedback(6); + } else if (feedbackType.equals("HapticFeedbackType.selectionClick")) { + view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK); } } - private void vibrateHapticFeedback(PlatformChannel.HapticFeedbackType feedbackType) { - View view = activity.getWindow().getDecorView(); - switch (feedbackType) { - case STANDARD: - view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + private void setSystemChromePreferredOrientations(JSONArray orientations) throws JSONException { + int requestedOrientation = 0x00; + int firstRequestedOrientation = 0x00; + for (int index = 0; index < orientations.length(); index += 1) { + if (orientations.getString(index).equals("DeviceOrientation.portraitUp")) { + requestedOrientation |= 0x01; + } else if (orientations.getString(index).equals("DeviceOrientation.landscapeLeft")) { + requestedOrientation |= 0x02; + } else if (orientations.getString(index).equals("DeviceOrientation.portraitDown")) { + requestedOrientation |= 0x04; + } else if (orientations.getString(index).equals("DeviceOrientation.landscapeRight")) { + requestedOrientation |= 0x08; + } + if (firstRequestedOrientation == 0x00) { + firstRequestedOrientation = requestedOrientation; + } + } + switch (requestedOrientation) { + case 0x00: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); break; - case LIGHT_IMPACT: - view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); + case 0x01: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); break; - case MEDIUM_IMPACT: - view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); + case 0x02: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); break; - case HEAVY_IMPACT: - // HapticFeedbackConstants.CONTEXT_CLICK from API level 23. - view.performHapticFeedback(6); + case 0x04: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); break; - case SELECTION_CLICK: - view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK); + case 0x05: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT); break; - } - } - - private void setSystemChromePreferredOrientations(int androidOrientation) { - activity.setRequestedOrientation(androidOrientation); + case 0x08: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); + break; + case 0x0a: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE); + break; + case 0x0b: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER); + break; + case 0x0f: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER); + break; + case 0x03: // portraitUp and landscapeLeft + case 0x06: // portraitDown and landscapeLeft + case 0x07: // portraitUp, portraitDown, and landscapeLeft + case 0x09: // portraitUp and landscapeRight + case 0x0c: // portraitDown and landscapeRight + case 0x0d: // portraitUp, portraitDown, and landscapeRight + case 0x0e: // portraitDown, landscapeLeft, and landscapeRight + // Android can't describe these cases, so just default to whatever the first + // specified value was. + switch (firstRequestedOrientation) { + case 0x01: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + break; + case 0x02: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); + break; + case 0x04: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); + break; + case 0x08: + mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); + break; + } + break; + } } - private void setSystemChromeApplicationSwitcherDescription(PlatformChannel.AppSwitcherDescription description) { + private void setSystemChromeApplicationSwitcherDescription(JSONObject description) throws JSONException { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return; } + int color = description.getInt("primaryColor"); + if (color != 0) { // 0 means color isn't set, use system default + color = color | 0xFF000000; // color must be opaque if set + } + + String label = description.getString("label"); + @SuppressWarnings("deprecation") TaskDescription taskDescription = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) - ? new TaskDescription(description.label, 0, description.color) - : new TaskDescription(description.label, null, description.color); + ? new TaskDescription(label, 0, color) + : new TaskDescription(label, null, color); - activity.setTaskDescription(taskDescription); + mActivity.setTaskDescription(taskDescription); } - private void setSystemChromeEnabledSystemUIOverlays(List overlaysToShow) { - // Start by assuming we want to hide all system overlays (like an immersive game). + private int mEnabledOverlays; + + private void setSystemChromeEnabledSystemUIOverlays(JSONArray overlays) throws JSONException { int enabledOverlays = DEFAULT_SYSTEM_UI | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; - if (overlaysToShow.size() == 0) { + if (overlays.length() == 0) { enabledOverlays |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; } - // Re-add any desired system overlays. - for (int i = 0; i < overlaysToShow.size(); ++i) { - PlatformChannel.SystemUiOverlay overlayToShow = overlaysToShow.get(i); - switch (overlayToShow) { - case TOP_OVERLAYS: - enabledOverlays &= ~View.SYSTEM_UI_FLAG_FULLSCREEN; - break; - case BOTTOM_OVERLAYS: - enabledOverlays &= ~View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; - enabledOverlays &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; - break; + for (int i = 0; i < overlays.length(); ++i) { + String overlay = overlays.getString(i); + if (overlay.equals("SystemUiOverlay.top")) { + enabledOverlays &= ~View.SYSTEM_UI_FLAG_FULLSCREEN; + } else if (overlay.equals("SystemUiOverlay.bottom")) { + enabledOverlays &= ~View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; + enabledOverlays &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; } } @@ -170,9 +223,9 @@ private void setSystemChromeEnabledSystemUIOverlays(List= 26) { - if (systemChromeStyle.systemNavigationBarIconBrightness != null) { - switch (systemChromeStyle.systemNavigationBarIconBrightness) { - case DARK: - //View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR - flags |= 0x10; - break; - case LIGHT: - flags &= ~0x10; - break; + try { + // You can change the navigation bar color (including translucent colors) + // in Android, but you can't change the color of the navigation buttons until Android O. + // LIGHT vs DARK effectively isn't supported until then. + // Build.VERSION_CODES.O + if (Build.VERSION.SDK_INT >= 26) { + if (!message.isNull("systemNavigationBarIconBrightness")) { + String systemNavigationBarIconBrightness = message.getString("systemNavigationBarIconBrightness"); + switch (systemNavigationBarIconBrightness) { + case "Brightness.dark": + //View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR + flags |= 0x10; + break; + case "Brightness.light": + flags &= ~0x10; + break; + } + } + if (!message.isNull("systemNavigationBarColor")) { + window.setNavigationBarColor(message.getInt("systemNavigationBarColor")); } } - if (systemChromeStyle.systemNavigationBarColor != null) { - window.setNavigationBarColor(systemChromeStyle.systemNavigationBarColor); - } - } - // Build.VERSION_CODES.M - if (Build.VERSION.SDK_INT >= 23) { - if (systemChromeStyle.statusBarIconBrightness != null) { - switch (systemChromeStyle.statusBarIconBrightness) { - case DARK: - // View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR - flags |= 0x2000; - break; - case LIGHT: - flags &= ~0x2000; - break; + // Build.VERSION_CODES.M + if (Build.VERSION.SDK_INT >= 23) { + if (!message.isNull("statusBarIconBrightness")) { + String statusBarIconBrightness = message.getString("statusBarIconBrightness"); + switch (statusBarIconBrightness) { + case "Brightness.dark": + // View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR + flags |= 0x2000; + break; + case "Brightness.light": + flags &= ~0x2000; + break; + } + } + if (!message.isNull("statusBarColor")) { + window.setStatusBarColor(message.getInt("statusBarColor")); } } - if (systemChromeStyle.statusBarColor != null) { - window.setStatusBarColor(systemChromeStyle.statusBarColor); + if (!message.isNull("systemNavigationBarDividerColor")) { + // Not availible until Android P. + // window.setNavigationBarDividerColor(systemNavigationBarDividerColor); } + view.setSystemUiVisibility(flags); + mCurrentTheme = message; + } catch (JSONException err) { + Log.i("PlatformPlugin", err.toString()); } - if (systemChromeStyle.systemNavigationBarDividerColor != null) { - // Not availible until Android P. - // window.setNavigationBarDividerColor(systemNavigationBarDividerColor); - } - view.setSystemUiVisibility(flags); - currentTheme = systemChromeStyle; } private void popSystemNavigator() { - activity.finish(); + mActivity.finish(); } - private CharSequence getClipboardData(PlatformChannel.ClipboardContentFormat format) { - ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); + private JSONObject getClipboardData(String format) throws JSONException { + ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = clipboard.getPrimaryClip(); if (clip == null) return null; - if (format == null || format == PlatformChannel.ClipboardContentFormat.PLAIN_TEXT) { - return clip.getItemAt(0).coerceToText(activity); + if (format == null || format.equals(kTextPlainFormat)) { + JSONObject result = new JSONObject(); + result.put("text", clip.getItemAt(0).coerceToText(mActivity)); + return result; } return null; } - private void setClipboardData(String text) { - ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); - ClipData clip = ClipData.newPlainText("text label?", text); + private void setClipboardData(JSONObject data) throws JSONException { + ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE); + ClipData clip = ClipData.newPlainText("text label?", data.getString("text")); clipboard.setPrimaryClip(clip); } diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index ac5e2f8f3d995..d8c2de3749195 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -9,21 +9,20 @@ import android.opengl.Matrix; import android.os.Build; import android.os.Bundle; -import android.support.annotation.NonNull; import android.util.Log; import android.view.View; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeProvider; - -import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; +import io.flutter.plugin.common.BasicMessageChannel; +import io.flutter.plugin.common.StandardMessageCodec; import io.flutter.util.Predicate; import java.nio.ByteBuffer; import java.util.*; class AccessibilityBridge - extends AccessibilityNodeProvider { + extends AccessibilityNodeProvider implements BasicMessageChannel.MessageHandler { private static final String TAG = "FlutterView"; // Constants from higher API levels. @@ -35,42 +34,19 @@ class AccessibilityBridge private static final float SCROLL_POSITION_CAP_FOR_INFINITY = 70000.0f; private static final int ROOT_NODE_ID = 0; - private final FlutterView owner; - private final AccessibilityChannel accessibilityChannel; - private final View decorView; - private Map objects; - private Map customAccessibilityActions; - private boolean accessibilityEnabled = false; - private SemanticsObject a11yFocusedObject; - private SemanticsObject inputFocusedObject; - private SemanticsObject hoveredObject; + private Map mObjects; + private Map mCustomAccessibilityActions; + private final FlutterView mOwner; + private boolean mAccessibilityEnabled = false; + private SemanticsObject mA11yFocusedObject; + private SemanticsObject mInputFocusedObject; + private SemanticsObject mHoveredObject; private int previousRouteId = ROOT_NODE_ID; private List previousRoutes; - private Integer lastLeftFrameInset = 0; - - private final AccessibilityChannel.AccessibilityMessageHandler accessibilityMessageHandler = new AccessibilityChannel.AccessibilityMessageHandler() { - @Override - public void announce(@NonNull String message) { - owner.announceForAccessibility(message); - } - - @Override - public void onTap(int nodeId) { - sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_CLICKED); - } + private final View mDecorView; + private Integer mLastLeftFrameInset = 0; - @Override - public void onLongPress(int nodeId) { - sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); - } - - @Override - public void onTooltip(@NonNull String message) { - AccessibilityEvent e = obtainAccessibilityEvent(ROOT_NODE_ID, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); - e.getText().add(message); - sendAccessibilityEvent(e); - } - }; + private final BasicMessageChannel mFlutterAccessibilityChannel; enum Action { TAP(1 << 0), @@ -130,21 +106,23 @@ enum Flag { final int value; } - AccessibilityBridge(@NonNull FlutterView owner, @NonNull AccessibilityChannel accessibilityChannel) { - this.owner = owner; - this.accessibilityChannel = accessibilityChannel; - decorView = ((Activity) owner.getContext()).getWindow().getDecorView(); - objects = new HashMap<>(); - customAccessibilityActions = new HashMap<>(); + AccessibilityBridge(FlutterView owner) { + assert owner != null; + mOwner = owner; + mObjects = new HashMap<>(); + mCustomAccessibilityActions = new HashMap<>(); previousRoutes = new ArrayList<>(); + mFlutterAccessibilityChannel = new BasicMessageChannel<>( + owner, "flutter/accessibility", StandardMessageCodec.INSTANCE); + mDecorView = ((Activity) owner.getContext()).getWindow().getDecorView(); } void setAccessibilityEnabled(boolean accessibilityEnabled) { - this.accessibilityEnabled = accessibilityEnabled; + mAccessibilityEnabled = accessibilityEnabled; if (accessibilityEnabled) { - this.accessibilityChannel.setAccessibilityMessageHandler(accessibilityMessageHandler); + mFlutterAccessibilityChannel.setMessageHandler(this); } else { - this.accessibilityChannel.setAccessibilityMessageHandler(null); + mFlutterAccessibilityChannel.setMessageHandler(null); } } @@ -159,42 +137,42 @@ private boolean shouldSetCollectionInfo(final SemanticsObject object) { // to set it if we're exiting a list to a non-list, so that we can get the "out of list" // announcement when A11y focus moves out of a list and not into another list. return object.scrollChildren > 0 - && (hasSemanticsObjectAncestor(a11yFocusedObject, o -> o == object) - || !hasSemanticsObjectAncestor(a11yFocusedObject, o -> o.hasFlag(Flag.HAS_IMPLICIT_SCROLLING))); + && (hasSemanticsObjectAncestor(mA11yFocusedObject, o -> o == object) + || !hasSemanticsObjectAncestor(mA11yFocusedObject, o -> o.hasFlag(Flag.HAS_IMPLICIT_SCROLLING))); } @Override @SuppressWarnings("deprecation") public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (virtualViewId == View.NO_ID) { - AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(owner); - owner.onInitializeAccessibilityNodeInfo(result); - if (objects.containsKey(ROOT_NODE_ID)) { - result.addChild(owner, ROOT_NODE_ID); + AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(mOwner); + mOwner.onInitializeAccessibilityNodeInfo(result); + if (mObjects.containsKey(ROOT_NODE_ID)) { + result.addChild(mOwner, ROOT_NODE_ID); } return result; } - SemanticsObject object = objects.get(virtualViewId); + SemanticsObject object = mObjects.get(virtualViewId); if (object == null) { return null; } - AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(owner, virtualViewId); + AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(mOwner, virtualViewId); // Work around for https://github.com/flutter/flutter/issues/2101 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { result.setViewIdResourceName(""); } - result.setPackageName(owner.getContext().getPackageName()); + result.setPackageName(mOwner.getContext().getPackageName()); result.setClassName("android.view.View"); - result.setSource(owner, virtualViewId); + result.setSource(mOwner, virtualViewId); result.setFocusable(object.isFocusable()); - if (inputFocusedObject != null) { - result.setFocused(inputFocusedObject.id == virtualViewId); + if (mInputFocusedObject != null) { + result.setFocused(mInputFocusedObject.id == virtualViewId); } - if (a11yFocusedObject != null) { - result.setAccessibilityFocused(a11yFocusedObject.id == virtualViewId); + if (mA11yFocusedObject != null) { + result.setAccessibilityFocused(mA11yFocusedObject.id == virtualViewId); } if (object.hasFlag(Flag.IS_TEXT_FIELD)) { @@ -208,7 +186,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { // 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 && a11yFocusedObject != null && a11yFocusedObject.id == virtualViewId) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 && mA11yFocusedObject != null && mA11yFocusedObject.id == virtualViewId) { result.setLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); } } @@ -261,10 +239,10 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (object.parent != null) { assert object.id > ROOT_NODE_ID; - result.setParent(owner, object.parent.id); + result.setParent(mOwner, object.parent.id); } else { assert object.id == ROOT_NODE_ID; - result.setParent(owner); + result.setParent(mOwner); } Rect bounds = object.getGlobalRect(); @@ -384,7 +362,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { result.setSelected(object.hasFlag(Flag.IS_SELECTED)); // Accessibility Focus - if (a11yFocusedObject != null && a11yFocusedObject.id == virtualViewId) { + if (mA11yFocusedObject != null && mA11yFocusedObject.id == virtualViewId) { result.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } else { result.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); @@ -403,7 +381,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (object.childrenInTraversalOrder != null) { for (SemanticsObject child : object.childrenInTraversalOrder) { if (!child.hasFlag(Flag.IS_HIDDEN)) { - result.addChild(owner, child.id); + result.addChild(mOwner, child.id); } } } @@ -413,7 +391,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { @Override public boolean performAction(int virtualViewId, int action, Bundle arguments) { - SemanticsObject object = objects.get(virtualViewId); + SemanticsObject object = mObjects.get(virtualViewId); if (object == null) { return false; } @@ -422,27 +400,27 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { // Note: TalkBack prior to Oreo doesn't use this handler and instead simulates a // click event at the center of the SemanticsNode. Other a11y services might go // through this handler though. - owner.dispatchSemanticsAction(virtualViewId, Action.TAP); + mOwner.dispatchSemanticsAction(virtualViewId, Action.TAP); return true; } case AccessibilityNodeInfo.ACTION_LONG_CLICK: { // Note: TalkBack doesn't use this handler and instead simulates a long click event // at the center of the SemanticsNode. Other a11y services might go through this // handler though. - owner.dispatchSemanticsAction(virtualViewId, Action.LONG_PRESS); + mOwner.dispatchSemanticsAction(virtualViewId, Action.LONG_PRESS); return true; } case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: { if (object.hasAction(Action.SCROLL_UP)) { - owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_UP); + mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_UP); } else if (object.hasAction(Action.SCROLL_LEFT)) { // TODO(ianh): bidi support using textDirection - owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_LEFT); + mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_LEFT); } else if (object.hasAction(Action.INCREASE)) { object.value = object.increasedValue; // Event causes Android to read out the updated value. sendAccessibilityEvent(virtualViewId, AccessibilityEvent.TYPE_VIEW_SELECTED); - owner.dispatchSemanticsAction(virtualViewId, Action.INCREASE); + mOwner.dispatchSemanticsAction(virtualViewId, Action.INCREASE); } else { return false; } @@ -450,15 +428,15 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { } case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: { if (object.hasAction(Action.SCROLL_DOWN)) { - owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_DOWN); + mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_DOWN); } else if (object.hasAction(Action.SCROLL_RIGHT)) { // TODO(ianh): bidi support using textDirection - owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_RIGHT); + mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_RIGHT); } else if (object.hasAction(Action.DECREASE)) { object.value = object.decreasedValue; // Event causes Android to read out the updated value. sendAccessibilityEvent(virtualViewId, AccessibilityEvent.TYPE_VIEW_SELECTED); - owner.dispatchSemanticsAction(virtualViewId, Action.DECREASE); + mOwner.dispatchSemanticsAction(virtualViewId, Action.DECREASE); } else { return false; } @@ -471,24 +449,24 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { return performCursorMoveAction(object, virtualViewId, arguments, true); } case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: { - owner.dispatchSemanticsAction(virtualViewId, Action.DID_LOSE_ACCESSIBILITY_FOCUS); + mOwner.dispatchSemanticsAction(virtualViewId, Action.DID_LOSE_ACCESSIBILITY_FOCUS); sendAccessibilityEvent( virtualViewId, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - a11yFocusedObject = null; + mA11yFocusedObject = null; return true; } case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: { - owner.dispatchSemanticsAction(virtualViewId, Action.DID_GAIN_ACCESSIBILITY_FOCUS); + mOwner.dispatchSemanticsAction(virtualViewId, Action.DID_GAIN_ACCESSIBILITY_FOCUS); sendAccessibilityEvent( virtualViewId, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED); - if (a11yFocusedObject == null) { + if (mA11yFocusedObject == null) { // When Android focuses a node, it doesn't invalidate the view. // (It does when it sends ACTION_CLEAR_ACCESSIBILITY_FOCUS, so // we only have to worry about this when the focused node is null.) - owner.invalidate(); + mOwner.invalidate(); } - a11yFocusedObject = object; + mA11yFocusedObject = object; if (object.hasAction(Action.INCREASE) || object.hasAction(Action.DECREASE)) { // SeekBars only announce themselves after this event. @@ -498,7 +476,7 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { return true; } case ACTION_SHOW_ON_SCREEN: { - owner.dispatchSemanticsAction(virtualViewId, Action.SHOW_ON_SCREEN); + mOwner.dispatchSemanticsAction(virtualViewId, Action.SHOW_ON_SCREEN); return true; } case AccessibilityNodeInfo.ACTION_SET_SELECTION: { @@ -520,32 +498,32 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { selection.put("base", object.textSelectionExtent); selection.put("extent", object.textSelectionExtent); } - owner.dispatchSemanticsAction(virtualViewId, Action.SET_SELECTION, selection); + mOwner.dispatchSemanticsAction(virtualViewId, Action.SET_SELECTION, selection); return true; } case AccessibilityNodeInfo.ACTION_COPY: { - owner.dispatchSemanticsAction(virtualViewId, Action.COPY); + mOwner.dispatchSemanticsAction(virtualViewId, Action.COPY); return true; } case AccessibilityNodeInfo.ACTION_CUT: { - owner.dispatchSemanticsAction(virtualViewId, Action.CUT); + mOwner.dispatchSemanticsAction(virtualViewId, Action.CUT); return true; } case AccessibilityNodeInfo.ACTION_PASTE: { - owner.dispatchSemanticsAction(virtualViewId, Action.PASTE); + mOwner.dispatchSemanticsAction(virtualViewId, Action.PASTE); return true; } case AccessibilityNodeInfo.ACTION_DISMISS: { - owner.dispatchSemanticsAction(virtualViewId, Action.DISMISS); + mOwner.dispatchSemanticsAction(virtualViewId, Action.DISMISS); return true; } default: // might be a custom accessibility action. final int flutterId = action - firstResourceId; CustomAccessibilityAction contextAction = - customAccessibilityActions.get(flutterId); + mCustomAccessibilityActions.get(flutterId); if (contextAction != null) { - owner.dispatchSemanticsAction( + mOwner.dispatchSemanticsAction( virtualViewId, Action.CUSTOM_ACTION, contextAction.id); return true; } @@ -562,12 +540,12 @@ boolean performCursorMoveAction( switch (granularity) { case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER: { if (forward && object.hasAction(Action.MOVE_CURSOR_FORWARD_BY_CHARACTER)) { - owner.dispatchSemanticsAction(virtualViewId, + mOwner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_FORWARD_BY_CHARACTER, extendSelection); return true; } if (!forward && object.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER)) { - owner.dispatchSemanticsAction(virtualViewId, + mOwner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER, extendSelection); return true; } @@ -575,12 +553,12 @@ boolean performCursorMoveAction( } case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD: if (forward && object.hasAction(Action.MOVE_CURSOR_FORWARD_BY_WORD)) { - owner.dispatchSemanticsAction(virtualViewId, + mOwner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_FORWARD_BY_WORD, extendSelection); return true; } if (!forward && object.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_WORD)) { - owner.dispatchSemanticsAction(virtualViewId, + mOwner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_BACKWARD_BY_WORD, extendSelection); return true; } @@ -595,65 +573,65 @@ boolean performCursorMoveAction( public AccessibilityNodeInfo findFocus(int focus) { switch (focus) { case AccessibilityNodeInfo.FOCUS_INPUT: { - if (inputFocusedObject != null) - return createAccessibilityNodeInfo(inputFocusedObject.id); + if (mInputFocusedObject != null) + return createAccessibilityNodeInfo(mInputFocusedObject.id); } // Fall through to check FOCUS_ACCESSIBILITY case AccessibilityNodeInfo.FOCUS_ACCESSIBILITY: { - if (a11yFocusedObject != null) - return createAccessibilityNodeInfo(a11yFocusedObject.id); + if (mA11yFocusedObject != null) + return createAccessibilityNodeInfo(mA11yFocusedObject.id); } } return null; } private SemanticsObject getRootObject() { - assert objects.containsKey(0); - return objects.get(0); + assert mObjects.containsKey(0); + return mObjects.get(0); } private SemanticsObject getOrCreateObject(int id) { - SemanticsObject object = objects.get(id); + SemanticsObject object = mObjects.get(id); if (object == null) { object = new SemanticsObject(); object.id = id; - objects.put(id, object); + mObjects.put(id, object); } return object; } private CustomAccessibilityAction getOrCreateAction(int id) { - CustomAccessibilityAction action = customAccessibilityActions.get(id); + CustomAccessibilityAction action = mCustomAccessibilityActions.get(id); if (action == null) { action = new CustomAccessibilityAction(); action.id = id; action.resourceId = id + firstResourceId; - customAccessibilityActions.put(id, action); + mCustomAccessibilityActions.put(id, action); } return action; } void handleTouchExplorationExit() { - if (hoveredObject != null) { - sendAccessibilityEvent(hoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); - hoveredObject = null; + if (mHoveredObject != null) { + sendAccessibilityEvent(mHoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); + mHoveredObject = null; } } void handleTouchExploration(float x, float y) { - if (objects.isEmpty()) { + if (mObjects.isEmpty()) { return; } SemanticsObject newObject = getRootObject().hitTest(new float[] {x, y, 0, 1}); - if (newObject != hoveredObject) { + if (newObject != mHoveredObject) { // sending ENTER before EXIT is how Android wants it if (newObject != null) { sendAccessibilityEvent(newObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_ENTER); } - if (hoveredObject != null) { - sendAccessibilityEvent(hoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); + if (mHoveredObject != null) { + sendAccessibilityEvent(mHoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); } - hoveredObject = newObject; + mHoveredObject = newObject; } } @@ -679,7 +657,7 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { continue; } if (object.hasFlag(Flag.IS_FOCUSED)) { - inputFocusedObject = object; + mInputFocusedObject = object; } if (object.hadPreviousConfig) { updated.add(object); @@ -697,12 +675,12 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { // a11y nodes. if (Build.VERSION.SDK_INT >= 23) { Rect visibleFrame = new Rect(); - decorView.getWindowVisibleDisplayFrame(visibleFrame); - if (!lastLeftFrameInset.equals(visibleFrame.left)) { + mDecorView.getWindowVisibleDisplayFrame(visibleFrame); + if (!mLastLeftFrameInset.equals(visibleFrame.left)) { rootObject.globalGeometryDirty = true; rootObject.inverseTransformDirty = true; } - lastLeftFrameInset = visibleFrame.left; + mLastLeftFrameInset = visibleFrame.left; Matrix.translateM(identity, 0, visibleFrame.left, 0, 0); } rootObject.updateRecursively(identity, visitedObjects, false); @@ -729,7 +707,7 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { previousRoutes.add(semanticsObject.id); } - Iterator> it = objects.entrySet().iterator(); + Iterator> it = mObjects.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = it.next(); SemanticsObject object = entry.getValue(); @@ -809,25 +787,25 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } } else if (object.hasFlag(Flag.IS_TEXT_FIELD) && object.didChangeLabel() - && inputFocusedObject != null && inputFocusedObject.id == object.id) { + && mInputFocusedObject != null && mInputFocusedObject.id == object.id) { // Text fields should announce when their label changes while focused. We use a live // region tag to do so, and this event triggers that update. sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } - if (a11yFocusedObject != null && a11yFocusedObject.id == object.id + if (mA11yFocusedObject != null && mA11yFocusedObject.id == object.id && !object.hadFlag(Flag.IS_SELECTED) && object.hasFlag(Flag.IS_SELECTED)) { AccessibilityEvent event = obtainAccessibilityEvent(object.id, AccessibilityEvent.TYPE_VIEW_SELECTED); event.getText().add(object.label); sendAccessibilityEvent(event); } - if (inputFocusedObject != null && inputFocusedObject.id == object.id + if (mInputFocusedObject != null && mInputFocusedObject.id == object.id && 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 - && (a11yFocusedObject == null || (a11yFocusedObject.id == inputFocusedObject.id))) { + && (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); @@ -885,27 +863,65 @@ private AccessibilityEvent createTextChangedEvent(int id, String oldValue, Strin private AccessibilityEvent obtainAccessibilityEvent(int virtualViewId, int eventType) { assert virtualViewId != ROOT_NODE_ID; AccessibilityEvent event = AccessibilityEvent.obtain(eventType); - event.setPackageName(owner.getContext().getPackageName()); - event.setSource(owner, virtualViewId); + event.setPackageName(mOwner.getContext().getPackageName()); + event.setSource(mOwner, virtualViewId); return event; } private void sendAccessibilityEvent(int virtualViewId, int eventType) { - if (!accessibilityEnabled) { + if (!mAccessibilityEnabled) { return; } if (virtualViewId == ROOT_NODE_ID) { - owner.sendAccessibilityEvent(eventType); + mOwner.sendAccessibilityEvent(eventType); } else { sendAccessibilityEvent(obtainAccessibilityEvent(virtualViewId, eventType)); } } private void sendAccessibilityEvent(AccessibilityEvent event) { - if (!accessibilityEnabled) { + if (!mAccessibilityEnabled) { return; } - owner.getParent().requestSendAccessibilityEvent(owner, event); + mOwner.getParent().requestSendAccessibilityEvent(mOwner, event); + } + + // Message Handler for [mFlutterAccessibilityChannel]. + public void onMessage(Object message, BasicMessageChannel.Reply reply) { + @SuppressWarnings("unchecked") + final HashMap annotatedEvent = (HashMap) message; + final String type = (String) annotatedEvent.get("type"); + @SuppressWarnings("unchecked") + final HashMap data = (HashMap) annotatedEvent.get("data"); + + switch (type) { + case "announce": + mOwner.announceForAccessibility((String) data.get("message")); + break; + case "longPress": { + Integer nodeId = (Integer) annotatedEvent.get("nodeId"); + if (nodeId == null) { + return; + } + sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); + break; + } + case "tap": { + Integer nodeId = (Integer) annotatedEvent.get("nodeId"); + if (nodeId == null) { + return; + } + sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_CLICKED); + break; + } + case "tooltip": { + AccessibilityEvent e = obtainAccessibilityEvent( + ROOT_NODE_ID, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); + e.getText().add((String) data.get("message")); + sendAccessibilityEvent(e); + break; + } + } } private void createWindowChangeEvent(SemanticsObject route) { @@ -917,29 +933,29 @@ private void createWindowChangeEvent(SemanticsObject route) { } private void willRemoveSemanticsObject(SemanticsObject object) { - assert objects.containsKey(object.id); - assert objects.get(object.id) == object; + assert mObjects.containsKey(object.id); + assert mObjects.get(object.id) == object; object.parent = null; - if (a11yFocusedObject == object) { - sendAccessibilityEvent(a11yFocusedObject.id, + if (mA11yFocusedObject == object) { + sendAccessibilityEvent(mA11yFocusedObject.id, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - a11yFocusedObject = null; + mA11yFocusedObject = null; } - if (inputFocusedObject == object) { - inputFocusedObject = null; + if (mInputFocusedObject == object) { + mInputFocusedObject = null; } - if (hoveredObject == object) { - hoveredObject = null; + if (mHoveredObject == object) { + mHoveredObject = null; } } void reset() { - objects.clear(); - if (a11yFocusedObject != null) - sendAccessibilityEvent(a11yFocusedObject.id, + mObjects.clear(); + if (mA11yFocusedObject != null) + sendAccessibilityEvent(mA11yFocusedObject.id, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - a11yFocusedObject = null; - hoveredObject = null; + mA11yFocusedObject = null; + mHoveredObject = null; sendAccessibilityEvent(0, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index b76c1fee832f7..c6927a3245711 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -15,7 +15,6 @@ import android.net.Uri; import android.os.Build; import android.os.Handler; -import android.os.LocaleList; import android.provider.Settings; import android.text.format.DateFormat; import android.util.AttributeSet; @@ -30,18 +29,17 @@ import io.flutter.embedding.engine.FlutterJNI; import io.flutter.embedding.engine.android.AndroidKeyProcessor; import io.flutter.embedding.engine.dart.DartExecutor; -import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; import io.flutter.embedding.engine.systemchannels.KeyEventChannel; import io.flutter.embedding.engine.systemchannels.LifecycleChannel; -import io.flutter.embedding.engine.systemchannels.LocalizationChannel; import io.flutter.embedding.engine.systemchannels.NavigationChannel; -import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.embedding.engine.systemchannels.SettingsChannel; import io.flutter.embedding.engine.systemchannels.SystemChannel; import io.flutter.plugin.common.*; import io.flutter.plugin.editing.TextInputPlugin; import io.flutter.plugin.platform.PlatformPlugin; +import org.json.JSONException; +import java.lang.reflect.Method; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.*; @@ -89,21 +87,18 @@ static final class ViewportMetrics { } private final DartExecutor dartExecutor; - private final AccessibilityChannel accessibilityChannel; private final NavigationChannel navigationChannel; private final KeyEventChannel keyEventChannel; private final LifecycleChannel lifecycleChannel; - private final LocalizationChannel localizationChannel; - private final PlatformChannel platformChannel; private final SettingsChannel settingsChannel; private final SystemChannel systemChannel; private final InputMethodManager mImm; private final TextInputPlugin mTextInputPlugin; private final AndroidKeyProcessor androidKeyProcessor; - private AccessibilityBridge mAccessibilityNodeProvider; private final SurfaceHolder.Callback mSurfaceCallback; private final ViewportMetrics mMetrics; private final AccessibilityManager mAccessibilityManager; + private final MethodChannel mFlutterLocalizationChannel; private final List mActivityLifecycleListeners; private final List mFirstFrameListeners; private final AtomicLong nextTextureId = new AtomicLong(0L); @@ -165,25 +160,23 @@ public void surfaceDestroyed(SurfaceHolder holder) { mActivityLifecycleListeners = new ArrayList<>(); mFirstFrameListeners = new ArrayList<>(); - // Create all platform channels - accessibilityChannel = new AccessibilityChannel(dartExecutor); + // Configure the platform plugins and flutter channels. navigationChannel = new NavigationChannel(dartExecutor); keyEventChannel = new KeyEventChannel(dartExecutor); lifecycleChannel = new LifecycleChannel(dartExecutor); - localizationChannel = new LocalizationChannel(dartExecutor); - platformChannel = new PlatformChannel(dartExecutor); systemChannel = new SystemChannel(dartExecutor); settingsChannel = new SettingsChannel(dartExecutor); + mFlutterLocalizationChannel = new MethodChannel(this, "flutter/localization", JSONMethodCodec.INSTANCE); - // Create and setup plugins - PlatformPlugin platformPlugin = new PlatformPlugin(activity, platformChannel); + PlatformPlugin platformPlugin = new PlatformPlugin(activity); + MethodChannel flutterPlatformChannel = new MethodChannel(this, "flutter/platform", JSONMethodCodec.INSTANCE); + flutterPlatformChannel.setMethodCallHandler(platformPlugin); addActivityLifecycleListener(platformPlugin); mImm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - mTextInputPlugin = new TextInputPlugin(this, dartExecutor); + mTextInputPlugin = new TextInputPlugin(this); androidKeyProcessor = new AndroidKeyProcessor(keyEventChannel); - // Send initial platform information to Dart - sendLocalesToDart(getResources().getConfiguration()); + setLocales(getResources().getConfiguration()); sendUserPlatformSettingsToDart(); } @@ -318,21 +311,39 @@ private void sendUserPlatformSettingsToDart() { .send(); } - private void sendLocalesToDart(Configuration config) { - LocaleList localeList = config.getLocales(); - int localeCount = localeList.size(); - List locales = new ArrayList<>(); - for (int index = 0; index < localeCount; ++index) { - Locale locale = localeList.get(index); - locales.add(locale); + 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. + } } - localizationChannel.sendLocales(locales); + // Fallback single locale passing for android API < 24. Should work always. + @SuppressWarnings("deprecation") + 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); - sendLocalesToDart(newConfig); + setLocales(newConfig); sendUserPlatformSettingsToDart(); } @@ -363,7 +374,13 @@ public void destroy() { @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { - return mTextInputPlugin.createInputConnection(this, outAttrs); + try { + mLastInputConnection = mTextInputPlugin.createInputConnection(this, outAttrs); + return mLastInputConnection; + } catch (JSONException e) { + Log.e(TAG, "Failed to create input connection", e); + return null; + } } // Must match the PointerChange enum in pointer.dart. @@ -989,12 +1006,14 @@ public AccessibilityNodeProvider getAccessibilityNodeProvider() { return null; } + private AccessibilityBridge mAccessibilityNodeProvider; + void ensureAccessibilityEnabled() { if (!isAttached()) return; mAccessibilityEnabled = true; if (mAccessibilityNodeProvider == null) { - mAccessibilityNodeProvider = new AccessibilityBridge(this, accessibilityChannel); + mAccessibilityNodeProvider = new AccessibilityBridge(this); } mNativeView.getFlutterJNI().setSemanticsEnabled(true); mAccessibilityNodeProvider.setAccessibilityEnabled(true); From b0671145a3b93bf3a9652ddf7691f2b204ecff33 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 20 Feb 2019 17:32:10 -0500 Subject: [PATCH 0220/1117] Roll src/third_party/skia 7738736f9622..e471c05f92e8 (23 commits) (#7889) https://skia.googlesource.com/skia.git/%2Blog/7738736f9622..e471c05f92e8 git log 7738736f96222dd326129095cc95f31845ba57be..e471c05f92e86c8f8a460f55c775ca245924519e --date=short --no-merges --format=%ad %ae %s 2019-02-20 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-20 ethannicholas@google.com fixed SkSL parser unary expression recursion depth limit 2019-02-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader e4ef5f77dab4..c1fd4087ddc9 (4 commits) 2019-02-20 bsalomon@google.com Blacklist desk_techcrunck.skp_1_mpd on Iris655 and Iris540 2019-02-20 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-20 brianosman@google.com Refactor particle age logic 2019-02-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms 0c0f6dee2779..9374ba7d790a (1 commits) 2019-02-20 kjlubick@google.com Add dockerfile to cross-compile for arm64 linux 2019-02-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader e205d343d90c..e4ef5f77dab4 (1 commits) 2019-02-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 3d544fffe7ff..902ceed39986 (1 commits) 2019-02-20 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 93317ec84443..e205d343d90c (1 commits) 2019-02-20 brianosman@google.com Refactor and further generalization of particle model 2019-02-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader f4b99b674a1b..93317ec84443 (3 commits) 2019-02-20 egdaniel@google.com Fix setting of GL texture swizzle when using 1 for swizzle. 2019-02-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 8f79d388784c..f4b99b674a1b (1 commits) 2019-02-20 mtklein@google.com update NDK to r19b 2019-02-20 brianosman@google.com Use upper case hex in viewer's zoom window 2019-02-19 herb@google.com Break up InitDistanceFieldPaint 2019-02-20 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-20 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-20 robertphillips@google.com Switch image filters over to GrRecordingContext 2019-02-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 7f8fa973f84b..8f79d388784c (2 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 5abbd7f3bc9dc..e7dc6e133ea48 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': '7738736f96222dd326129095cc95f31845ba57be', + 'skia_revision': 'e471c05f92e86c8f8a460f55c775ca245924519e', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 12653a1b5938e..eedb84c3c709f 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 836e5418237608196869a1f870df54d4 +Signature: b14d48e409320424ded40cdb1731a9a2 UNUSED LICENSES: @@ -2325,6 +2325,7 @@ FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Mac-Clang- 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-NUC8i5BEK-GPU-IntelIris655-x86_64-Release-All-Vulkan.json +FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Win10-Clang-NUC8i5BEK-GPU-IntelIris655-x86_64-Release-All.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 @@ -2431,6 +2432,7 @@ FILE: ../../../third_party/skia/infra/bots/tools/luci-go/linux64/isolate.sha1 FILE: ../../../third_party/skia/infra/bots/tools/luci-go/mac64/isolate.sha1 FILE: ../../../third_party/skia/infra/bots/tools/luci-go/win64/isolate.exe.sha1 FILE: ../../../third_party/skia/infra/config/recipes.cfg +FILE: ../../../third_party/skia/infra/cross-compile/docker/cross-linux-arm64/Dockerfile FILE: ../../../third_party/skia/infra/cts/whitelist_devices.json FILE: ../../../third_party/skia/infra/lottiecap/docker/gold-lottie-web-puppeteer/Dockerfile FILE: ../../../third_party/skia/infra/lottiecap/docker/lottie-web-puppeteer/Dockerfile From 61fc1786fd98f48ee355f800cf5d7aef0fff985b Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 20 Feb 2019 14:42:57 -0800 Subject: [PATCH 0221/1117] Roll src/third_party/dart c92d5ca288..5ddd157809 (153 commits) 5ddd157809 fix uris for libraries to allow the breakpoint to lookup scripts. 7ebd02cdaa Work around for #35908. 3068192450 [vm] Remove deferred canonicalization from isolate message serialization. 0e453c637b [dart2js] Chain static assignments 8b0dd94e11 Revise AstBuilder to generate the new set-or-map AST structure 5e2529c82e Remove 'importUri' from CompletionSuggestion. 1699562dfc Remove unused AbstractSingleUnitTest. 27a805bde8 Add fast case for ASCII in Utf8Decoder, it significantly increases decoding speed 7edb7dddd8 Merge allocator analysis with collection of elided fields 6f8415245d [fasta] Transform set literals in initializers and default values. 9b10476092 [kernel/ffi] fix library paths ef9592a9c7 [kernel] Add (de)serialization for ExpressionStatements 187d6ceb20 [kernel] Add statements to Kernel (de)serialization verifier 395c0e4b98 [kernel] Add text (de)serialization for NamedTypes 14f5936468 [kernel] Simplify (de)serialization encoding for FunctionTypes 5e3e633d5d [kernel] Add text (de)serialization for TypeParameterTypes 923cea6652 [kernel] Add Bind and Binder combinators c19af8cee9 [kernel] Cleanup code for (De)SerializationEnvironment d60354b521 [kernel] Add binders and close terms as separate operations a3736868c0 [kernel] Add text (de)serialization for type parameters d76293a75a [testing] Add shared options on the test.py commandline. 596e0aa645 Include FieldInitializer in allocator analysis 8db489cb10 [vm/aot] Remove unnecessary closurization of some entry-points. c635896e1b [vm] Fix langauge_2_kernel.status after 93301 273856c6e3 Issue 3204. Support for local mixins as types. 45cb49108f Issue 3204. Include mixin(s) into top-level declaration for import Quick Fix. 6cf71022a8 Add a test for type promotion in "if" collection elements. 7df88e5755 Fix the lack of '`' in the doc. b83bcf59f2 Call dart::StubCode::Cleanup in AOT mode as well. 5722ca3126 Include defaultArgumentListString / defaultArgumentListTextRanges into AvailableSuggestion(s). 56356d426a Set 'displayUri' to IncludedSuggestionSet with file:// URIs. 43c4749f7e [dart2js] Turn on local aliases optimization 1ed9a34513 Add defaultArgumentListString / defaultArgumentListTextRanges to Declaration. c338941801 [ddc] Elide continue to next switch case 3a0ded6d54 Use _ExecutableParameters to access named parameter names. 4c1025493a Enhance available suggestions protocol. 28eb8604e3 Correctly handle invocations of top-level functions with an import prefix 0ef30fb86e Protocol for IncludedSuggestionSet.displayUri. bcd2c7fb96 Fix ListLiteral construction and add comments d3fde891bf [VM] Fix deadlock between mutator and BG compiler a85ae4e919 [vm/ffi] fix sizeOf on subtypes of Pointer 98bc608202 [testing] Blacklist tests and repeat options from reproduction commands 48beacfd78 Remove Kernel-based mixin inference e2b7f48333 Implement ClassHierarchyBuilder.getLegacyLeastUpperBound d19d50f45f Support async in LUB test 6a65f84a63 Implement longest path to Object 0720888236 Temporarily ignore context of errors in expression_test 6ccdffdb35 Test for expression compilation, type variables and initialize from dill 4bcc97a3d6 Don't run 'unbindCanonicalNames' in writeComponentToFile c9ef5be8d7 Issue 124524319. Improve getElementDeclaration to support invalid code with synthetic names. f9bb790f43 Add a fix to change invalid named argument names to an existing parameter name 1d1654592a Do not compute any imports for use on paste if import directives are being copied 03932bb852 Convert more diagnostic tests to DriverResolutionTest e1d3186ed9 Make declarations in provisional_api_test.dart private. bb76970857 Sort provisional_api_test.dart db71576ef3 [dart2js] Generator bodies can be on super mixin applications 711dd8e82e [dart2js] Avoid generating 'return' statement in setter f4b649ca4f [CFE] Propagate unevaluated constants upward. 5e70883859 [CFE] Refactor unevaluatedArguments cba4168da3 [CFE] Use _evaluateSubexpression in more places. 8e5f644d0a Use constant evaluation in allocator analysis bfa6041801 Add allocator analysis test for the J model 620743fb6b [vm/ffi] void functions 885f1cbe31 Fix constant folding of type literal equality 3638e433ce Change how DDC writes text when summarize-text is enabled 26970f370c Move source out of PotentialModification. f20ee58aa7 Remove references to the set-literals experiment 7d7d85ffa2 Change the default assumption for named parameters to "assume nullable". fa8c552fd9 Propagate non-null intent from callee to caller. ab38cf7897 Allow non-nullable usage to imply non-null intent. 24928ffcef [dartdevc] hide summarize-text option and change default to off 15e7457519 [dartdevc] change browser tests to wait longer for async completion 6b5424a7e7 Use SSA nodes to infer map key/value types. ec599a5977 [VM] Remove retry logic from close(fd) calls 1ac61b0c35 [dart2js] Basic chaining of field assignments 8cb4d00b0b Remove compareXyz() methods from ResynthesizeTestHelpers. 936b1c0404 Rename _mockOr to _either. 046928d502 [vm/kernel] Ignore package URIs when converting main script to package URI 99a5057bca Add set tracing. c291757bed Finish handling SetLiterals in the inferrer and SSA builder kernels. d11dd982dd Add typeinfo for sets and their elements and start tracing them in the inferrer. 61ab8e7816 Add kernel and backend impacts for set literals. d87482a3e1 Add SetLiteralUse and start tracking them in resolution. 97bfcd4a3a Add remaining support for sets to the abstract value domain. This lets us create set values and access their element types in the inferrer. e53cd30112 Add SetTypeMask. 15cd12beb4 Add SetConstantValue and SetConstantExpression plus their visitors. c841f050c0 Add set types to the abstract value domain. We cannot yet allocate sets. 51db39a6ae Implement basic SetLiteral visitors. Builder kernels will come later. a164e95582 Update CommonElements with set types. cd53e3b4df Patch factories for generating set literals into LinkedHashSet. 6846a7c486 Fix flutter analyzer bot by disabling lint prefer_collection_literals. cf63db2594 [VM/infra] Archive kernel-service.dart.snapshot together with coredumps 015cf88ef6 Disable set literal warning until engine rolls into flutter/flutter fd8b546800 Issue 35940. Clear evaluation results for constants in the library being analyzed. 39afa4e555 Revert "Add ExecutableElement(s) based InheritanceManager3, and switch analyzer to it." 078f8e67f8 Tests for invalid library id, and requested name. 122aa43ef6 Convert ListLiteral and remove uses of ListLiteral2 6df253db27 Update parse/tryParse documentation. 5622925369 Test of class hierachy from dill file f4379435dd Implement DillClassBuilder.typeVariables d1abd84944 [infra] Add named configuration option to test.dart. 20c3cd62fc Revert adding dart:ffi to core_types and fasta kernel_target 185c0f3e89 [gardening] status file entry for entrypoints_verification_test b15fe3a994 pkg:kernel: fix path to pkg:test in pubspec 763589472e [VM / vmservice] - Change setting of silentObservatory to a non const expression 0e62060be4 [test] Mark standalone_2/io/arguments_test as failing due to a bug in the test harness. eb73f132c1 [vm] Add macro for fallthrough annotations b66dc30334 [VM/interpreter] Skip tests enabling interpreter when not supported (fixes #35943). 65290f6e6a Add an option for reusing the previous compiler state in a worker 794e1e3a09 [gen_snapshot] Allow for multiple kernel inputs. c8abe45b00 Retry 'getSuggestionDetails' on InconsistentAnalysisException. 54dbc0068a Migrate resynthesizer tests from task model. 79b4b558ec [vm/tlab] Abandon tlab when thread gets descheduled. Allow all threads to allocate from tlab. Add tlab test. 59efe201fd Fix mistake in CHANGELOG. 48f7364d7b Remove the UX experiment 2 flag from the Dart Analysis Server. 6c96ff0145 Test case reproducing issue #35940 3b2144fa93 [vm] Respect entry-point annotation on constructors during obfuscation. d1b15cc92c Support for FieldFormalParameter in SyntacticScopeNamesCollector. ed94feb30e Update dartdoc version to 0.28.2. 223eaa6fbb Report noSuchMethod forwarders as synthetic in the mirror api 5d6bab4ed2 Add ExecutableElement(s) based InheritanceManager3, and switch analyzer to it. ae7bf9e999 [vm] Support closurization of methods through @pragma entry-points. a5d396cd25 [vm/extensions] Fix native extensions in hot-reload and running from snapshot. 4daabe69c3 [vm/gardening] Mark convert/base64_test/01 as flaky 69a952b195 remove parseSetLiterals flag from tests 3abc7d34d7 [vm/ffi] Remove platform specific logic from DynamicLibrary.open 6a5c9597c6 Revert adding enclosingLibrary to ast.dart 8333c8a4d0 Revert adding dart:ffi to devc libraries e9f239777f Split test so Kernel ClassHierarchy isn't required 25ee9b9d47 Rename test 837145a7c7 Properly restore state of _inConditionalControlFlow upon entering new function/method. dfda06061a Restore state safely in migration visitors. 765e6338a8 [docs] classify dart:ffi as vm on docs site, and exclude it for now 70e300fea0 [co19] DEPS updated 7ff5be0ceb Convert LUB test to use type parser 763035eb40 Clean up and merge dev CHANGELOG entries for stable release. 92460b8923 Migration: use non-null assertions as a hint for parameters that should not be nullable. 80798fad97 [tests] Add missing parenthesis on Equals() calls 46aa511b49 Improve the message when using a prefix to reference an undefined name (issue 35936) f4ec983fec Migrate the rest of element_test from task model. 94d8e730fb Remove parser enableSetLiterals flag 9b45c14c65 First stage cleanup of MapLiteral2 and SetLiteral2 486238df49 Remove the UX experiment 1 flag from the Dart Analysis Server. fa092aa77b [vm/compiler] actual string constant propagation 44eb626186 [VM} Fix script URLs for dart:* libraries 9ca9e66c1b [dartdevc] fix #35928, type literals are now instantiated to bounds 0f24b9e7ae [standalone] Name dart:io threads, take 2. 7a63d31151 Improve the message when importing a deprecated library (issue 35922) 30f9f5b1c7 Add SetOrMapLiteral to support the code-as-ui features 1c534d852c Clean up the tutorial related to implementing a visitor 7f2f840a91 Don't include constants of private enums. 7329247892 [vm/tools] Add Graph Explorer to visualize output of --write_v8_snapshot_profile_to. 5d71308b78 [vm/tools] Don't duplicate "problems" metadata into split package files. --- DEPS | 4 ++-- ci/licenses_golden/licenses_third_party | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index e7dc6e133ea48..ac8c2768e83cf 100644 --- a/DEPS +++ b/DEPS @@ -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': 'c92d5ca288da15b54b04c0a40ffe5d94a8883d77', + 'dart_revision': '5ddd1578096ee1d5bf04be82818f4801d4719a5e', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -49,7 +49,7 @@ vars = { 'dart_csslib_tag': '0.14.4+1', 'dart_dart2js_info_tag': '0.5.15', 'dart_dart_style_tag': '1.2.2', - 'dart_dartdoc_tag': 'v0.28.1+2', + 'dart_dartdoc_tag': 'v0.28.2', 'dart_fixnum_tag': '0.10.9', 'dart_glob_tag': '1.1.7', 'dart_html_tag': '0.13.3+2', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index e97f942e5ae7c..e2c16539748fb 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: a76c88a9ff389b1401e9df71fb13c1f6 +Signature: 5f4a380cb378e7c1d8b1cc1d6742d9a0 UNUSED LICENSES: @@ -5707,6 +5707,8 @@ FILE: ../../../third_party/dart/runtime/lib/ffi_dynamic_library.cc FILE: ../../../third_party/dart/runtime/lib/ffi_dynamic_library_patch.dart FILE: ../../../third_party/dart/runtime/lib/ffi_native_type_patch.dart FILE: ../../../third_party/dart/runtime/lib/ffi_patch.dart +FILE: ../../../third_party/dart/runtime/tools/graphexplorer/graphexplorer.html +FILE: ../../../third_party/dart/runtime/tools/graphexplorer/graphexplorer.js FILE: ../../../third_party/dart/runtime/vm/class_id.h FILE: ../../../third_party/dart/runtime/vm/code_entry_kind.h FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier.cc @@ -5751,6 +5753,7 @@ FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm.cc FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm64.cc FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_x64.cc FILE: ../../../third_party/dart/samples/ffi/coordinate.dart +FILE: ../../../third_party/dart/samples/ffi/dylib_utils.dart FILE: ../../../third_party/dart/samples/ffi/sample_ffi_data.dart FILE: ../../../third_party/dart/samples/ffi/sample_ffi_dynamic_library.dart FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions.dart From 8427d73c8340c9e51492689ee66261a4a72cac9e Mon Sep 17 00:00:00 2001 From: liyuqian Date: Wed, 20 Feb 2019 16:49:39 -0800 Subject: [PATCH 0222/1117] Reland PerformanceOverlayLayer golden test (#7863) * Revert "Revert "Add mock capability to PerformanceOverlayLayer (#7537)" (#7765)" This reverts commit 693645e4645001ae460d5794fa6f5c7066677955. * Add command line args for golden dir and font file --- ci/licenses_golden/licenses_flutter | 5 + flow/BUILD.gn | 7 +- flow/flow_run_all_unittests.cc | 32 ++++++ flow/flow_test_utils.cc | 40 ++++++++ flow/flow_test_utils.h | 29 ++++++ flow/layers/performance_overlay_layer.cc | 31 ++++-- flow/layers/performance_overlay_layer.h | 6 +- .../performance_overlay_layer_unittests.cc | 96 ++++++++++++++++++ .../resources/performance_overlay_gold.png | Bin 0 -> 16572 bytes 9 files changed, 234 insertions(+), 12 deletions(-) create mode 100644 flow/flow_run_all_unittests.cc create mode 100644 flow/flow_test_utils.cc create mode 100644 flow/flow_test_utils.h create mode 100644 flow/layers/performance_overlay_layer_unittests.cc create mode 100644 testing/resources/performance_overlay_gold.png diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index cea4f342c6317..7a1f118b1d09a 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -57,6 +57,7 @@ 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/performance_overlay_layer_unittests.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.h FILE: ../../../flutter/flow/layers/picture_layer.cc @@ -692,9 +693,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== ==================================================================================================== +LIBRARY: engine LIBRARY: txt ORIGIN: ../../../flutter/third_party/txt/LICENSE TYPE: LicenseType.apache +FILE: ../../../flutter/flow/flow_run_all_unittests.cc +FILE: ../../../flutter/flow/flow_test_utils.cc +FILE: ../../../flutter/flow/flow_test_utils.h FILE: ../../../flutter/third_party/txt/benchmarks/paint_record_benchmarks.cc FILE: ../../../flutter/third_party/txt/benchmarks/paragraph_benchmarks.cc FILE: ../../../flutter/third_party/txt/benchmarks/paragraph_builder_benchmarks.cc diff --git a/flow/BUILD.gn b/flow/BUILD.gn index 6b345aa87a35a..fbbf0e49db095 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -93,13 +93,18 @@ executable("flow_unittests") { testonly = true sources = [ + "flow_run_all_unittests.cc", + "flow_test_utils.h", + "flow_test_utils.cc", "matrix_decomposition_unittests.cc", "raster_cache_unittests.cc", + "layers/performance_overlay_layer_unittests.cc", ] deps = [ ":flow", - "$flutter_root/testing", + "$flutter_root/fml", + "//third_party/googletest:gtest", "//third_party/dart/runtime:libdart_jit", # for tracing "//third_party/skia", ] diff --git a/flow/flow_run_all_unittests.cc b/flow/flow_run_all_unittests.cc new file mode 100644 index 0000000000000..c1755e639b037 --- /dev/null +++ b/flow/flow_run_all_unittests.cc @@ -0,0 +1,32 @@ +/* + * Copyright 2017 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 "flutter/fml/command_line.h" +#include "flutter/fml/logging.h" +#include "gtest/gtest.h" + +#include "flow_test_utils.h" + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + fml::CommandLine cmd = fml::CommandLineFromArgcArgv(argc, argv); + flow::SetGoldenDir( + cmd.GetOptionValueWithDefault("golden-dir", "flutter/testing/resources")); + flow::SetFontFile(cmd.GetOptionValueWithDefault( + "font-file", + "flutter/third_party/txt/third_party/fonts/Roboto-Regular.ttf")); + return RUN_ALL_TESTS(); +} diff --git a/flow/flow_test_utils.cc b/flow/flow_test_utils.cc new file mode 100644 index 0000000000000..0bf6d4c31d4d9 --- /dev/null +++ b/flow/flow_test_utils.cc @@ -0,0 +1,40 @@ +/* + * Copyright 2017 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 + +namespace flow { + +static std::string gGoldenDir; +static std::string gFontFile; + +const std::string& GetGoldenDir() { + return gGoldenDir; +} + +void SetGoldenDir(const std::string& dir) { + gGoldenDir = dir; +} + +const std::string& GetFontFile() { + return gFontFile; +} + +void SetFontFile(const std::string& file) { + gFontFile = file; +} + +} // namespace flow diff --git a/flow/flow_test_utils.h b/flow/flow_test_utils.h new file mode 100644 index 0000000000000..58da75b3f4dde --- /dev/null +++ b/flow/flow_test_utils.h @@ -0,0 +1,29 @@ +/* + * Copyright 2017 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 + +namespace flow { + +const std::string& GetGoldenDir(); + +void SetGoldenDir(const std::string& dir); + +const std::string& GetFontFile(); + +void SetFontFile(const std::string& dir); + +} // namespace flow diff --git a/flow/layers/performance_overlay_layer.cc b/flow/layers/performance_overlay_layer.cc index c80786e866e1b..e7f40058c3bfb 100644 --- a/flow/layers/performance_overlay_layer.cc +++ b/flow/layers/performance_overlay_layer.cc @@ -15,8 +15,12 @@ namespace { void DrawStatisticsText(SkCanvas& canvas, const std::string& string, int x, - int y) { + int y, + const std::string& font_path) { SkFont font; + if (font_path != "") { + font = SkFont(SkTypeface::MakeFromFile(font_path.c_str())); + } font.setSize(15); font.setLinearMetrics(false); SkPaint paint; @@ -33,7 +37,8 @@ void VisualizeStopWatch(SkCanvas& canvas, SkScalar height, bool show_graph, bool show_labels, - const std::string& label_prefix) { + const std::string& label_prefix, + const std::string& font_path) { const int label_x = 8; // distance from x const int label_y = -10; // distance from y+height @@ -51,14 +56,20 @@ void VisualizeStopWatch(SkCanvas& canvas, stream << label_prefix << " " << "max " << max_ms_per_frame << " ms/frame, " << "avg " << average_ms_per_frame << " ms/frame"; - DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y); + DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y, + font_path); } } } // namespace -PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options) - : options_(options) {} +PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options, + const char* font_path) + : options_(options) { + if (font_path != nullptr) { + font_path_ = font_path; + } +} void PerformanceOverlayLayer::Paint(PaintContext& context) const { const int padding = 8; @@ -73,15 +84,15 @@ void PerformanceOverlayLayer::Paint(PaintContext& context) const { SkScalar height = paint_bounds().height() / 2; SkAutoCanvasRestore save(context.leaf_nodes_canvas, true); - VisualizeStopWatch(*context.leaf_nodes_canvas, context.frame_time, x, y, - width, height - padding, - options_ & kVisualizeRasterizerStatistics, - options_ & kDisplayRasterizerStatistics, "GPU"); + VisualizeStopWatch( + *context.leaf_nodes_canvas, context.frame_time, x, y, width, + height - padding, options_ & kVisualizeRasterizerStatistics, + options_ & kDisplayRasterizerStatistics, "GPU", font_path_); VisualizeStopWatch(*context.leaf_nodes_canvas, context.engine_time, x, y + height, width, height - padding, options_ & kVisualizeEngineStatistics, - options_ & kDisplayEngineStatistics, "UI"); + options_ & kDisplayEngineStatistics, "UI", font_path_); } } // namespace flow diff --git a/flow/layers/performance_overlay_layer.h b/flow/layers/performance_overlay_layer.h index b5f20ecbd7a6b..a47b836c49f3a 100644 --- a/flow/layers/performance_overlay_layer.h +++ b/flow/layers/performance_overlay_layer.h @@ -5,6 +5,8 @@ #ifndef FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ #define FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ +#include + #include "flutter/flow/layers/layer.h" #include "flutter/fml/macros.h" @@ -17,12 +19,14 @@ const int kVisualizeEngineStatistics = 1 << 3; class PerformanceOverlayLayer : public Layer { public: - explicit PerformanceOverlayLayer(uint64_t options); + explicit PerformanceOverlayLayer(uint64_t options, + const char* font_path = nullptr); void Paint(PaintContext& context) const override; private: int options_; + std::string font_path_; FML_DISALLOW_COPY_AND_ASSIGN(PerformanceOverlayLayer); }; diff --git a/flow/layers/performance_overlay_layer_unittests.cc b/flow/layers/performance_overlay_layer_unittests.cc new file mode 100644 index 0000000000000..f64f53422fb37 --- /dev/null +++ b/flow/layers/performance_overlay_layer_unittests.cc @@ -0,0 +1,96 @@ +// Copyright 2013 The Flutter 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/flow_test_utils.h" +#include "flutter/flow/layers/performance_overlay_layer.h" +#include "flutter/flow/raster_cache.h" + +#include "third_party/skia/include/core/SkSurface.h" +#include "third_party/skia/include/utils/SkBase64.h" + +#include "gtest/gtest.h" + +// To get the size of kMockedTimes in compile time. +template +constexpr int size(const T (&array)[N]) noexcept { + return N; +} + +constexpr int kMockedTimes[] = {17, 1, 4, 24, 4, 25, 30, 4, 13, 34, + 14, 0, 18, 9, 32, 36, 26, 23, 5, 8, + 32, 18, 29, 16, 29, 18, 0, 36, 33, 10}; + +// Relative to the flutter/src/engine/flutter directory +const char* kGoldenFileName = "performance_overlay_gold.png"; + +// Relative to the flutter/src/engine/flutter directory +const char* kNewGoldenFileName = "performance_overlay_gold_new.png"; + +TEST(PerformanceOverlayLayer, Gold) { + const std::string& golden_dir = flow::GetGoldenDir(); + // This unit test should only be run on Linux (not even on Mac since it's a + // golden test). Hence we don't have to worry about the "/" vs. "\". + std::string golden_file_path = golden_dir + "/" + kGoldenFileName; + std::string new_golden_file_path = golden_dir + "/" + kNewGoldenFileName; + + flow::Stopwatch mock_stopwatch; + for (int i = 0; i < size(kMockedTimes); ++i) { + mock_stopwatch.SetLapTime( + fml::TimeDelta::FromMilliseconds(kMockedTimes[i])); + } + + const SkImageInfo image_info = SkImageInfo::MakeN32Premul(1000, 1000); + sk_sp surface = SkSurface::MakeRaster(image_info); + + ASSERT_TRUE(surface != nullptr); + + flow::TextureRegistry unused_texture_registry; + + flow::Layer::PaintContext paintContext = { + nullptr, surface->getCanvas(), nullptr, mock_stopwatch, + mock_stopwatch, unused_texture_registry, nullptr, false}; + + // Specify font file to ensure the same font across different operation + // systems. + flow::PerformanceOverlayLayer layer(flow::kDisplayRasterizerStatistics | + flow::kVisualizeRasterizerStatistics | + flow::kDisplayEngineStatistics | + flow::kVisualizeEngineStatistics, + flow::GetFontFile().c_str()); + layer.set_paint_bounds(SkRect::MakeWH(1000, 400)); + surface->getCanvas()->clear(SK_ColorTRANSPARENT); + layer.Paint(paintContext); + + sk_sp snapshot = surface->makeImageSnapshot(); + sk_sp snapshot_data = snapshot->encodeToData(); + + sk_sp golden_data = + SkData::MakeFromFileName(golden_file_path.c_str()); + EXPECT_TRUE(golden_data != nullptr) + << "Golden file not found: " << golden_file_path << ".\n" + << "Please either set --golden-dir, or make sure that the unit test is " + << "run from the right directory (e.g., flutter/engine/src)."; + + const bool golden_data_matches = golden_data->equals(snapshot_data.get()); + if (!golden_data_matches) { + SkFILEWStream wstream(new_golden_file_path.c_str()); + wstream.write(snapshot_data->data(), snapshot_data->size()); + wstream.flush(); + + size_t b64_size = + SkBase64::Encode(snapshot_data->data(), snapshot_data->size(), nullptr); + char* b64_data = new char[b64_size]; + SkBase64::Encode(snapshot_data->data(), snapshot_data->size(), b64_data); + + EXPECT_TRUE(golden_data_matches) + << "Golden file mismatch. Please check " + << "the difference between " << kGoldenFileName << " and " + << kNewGoldenFileName << ", and replace the former " + << "with the latter if the difference looks good.\n\n" + << "See also the base64 encoded " << kNewGoldenFileName << ":\n" + << b64_data; + + delete[] b64_data; + } +} diff --git a/testing/resources/performance_overlay_gold.png b/testing/resources/performance_overlay_gold.png new file mode 100644 index 0000000000000000000000000000000000000000..119551f705793600890950be96b6b0d60688cc54 GIT binary patch literal 16572 zcmeI4c~n!`mjAIV3ra+AKuQrPN(B`KCqS7}f{4nbGLKOiWeN}=Od*ys2ndu?fJ{L_ zWD*dNAwY;S$`}~~1QHp;lmrMQB#`hssp{_4@As--zt#PIfBe>}yOt|@FWh_XIeYK3 z_xH17^lc+Ok=;jj3kV2^+`Mt^u7JSKIsPA^@4y+uoPlZZ@hx2Yrl}A(LWLZk3JClt zaP!(#)4+_S@gQ$AN~Zi4Wx?Lg)Aj297sJiYOr)UXq_{fiLEFQ;i&NEP8jEUxz@-Ki zk<$v&AhV_Oh3p*7K|AGnzuJD2L<5(O)Wh;dlf`jT#K4_TM)v&hbcg;s?Qgypb0v(E zAg)&)#f9(dJkJX)JSoA-2I1kA%d&fPek?&9{Ew+*5%aQsCpKpZ~h_Kc9_9&E1NRloHH} z8j(*tp*XF2pBy)KVZVfcfcN70$9utz_x<>4r+~oE-wFZK6cF3-jT-p4_UO@nz7*Is zDl%DS2`=nu75dND#U$OL+7sogNl&%C{Lh{}k^986v}kdm=1!$;vCYI0FYzX7?0>Qj zw*|2Dilt>`J_GlNQ5jFPg8iB>pQ_T;kxpI_SLUi4mB&s;F2u?zw|*xwCn6$(J2JGg zL*NnqY0Gyq#}KjVe=@SYYFS5^^|M0fjHLwxHp(yjv#<1TZ;O5+U9!X`qq9T=1U{}i ze)}f|*L5{Ye@~^{r`wDB_OQ6%$1D=}{qN25N1qDeuR~>SW;L*Uj zvLLpu3U1n*-;&{A8-*-(7JtAf8PdvR`T{i~b$BTjiUq7R= z@dM_{AKrt0vKM;$Ang(ush8&Ue>RvUSj9elEj?Zth76qgJ%WCWbNO>q#9fa})8V`3 zlYiQI|7VMJ+$&(m*ySSgh)u5m;2Q#=TF3q*KHS@@20cC73*txh=|8*v--njppL4{k z&eMeb+bNsV`=fdFs-%sIV@TwQ)O5Q81bjNI;R=F98)ujln6B25xwP%V{QNo0i1H4B zk16BI!gI&;RK&Z|)&rb^*wK$I&qyrN6pf|SKFoOt#cB)5I$lVv$8m~q9Gb4Y@o`RP zM@P>)Ta52w#ua#)w$KEOHw)v<%=P9ZXtJjh>Gn1BY+a?eBgzZ6SKLdvxTsRIZi303 zUd%>)P^nqM(Gk<%Qc^@HJ%el1QUC1%IK_=4$c%3By+8UvMBJf`7jO;y>{fSrmg_^$ z%r(qa`J`JdD0U~b#LLYs?Pa^;{@mPL7h1z6P2{3;mn+7{VqLv6S<@oD{dfhj3Yk+` zUw`6?Lu;LxUP6y1Vc=3x1rBF~Gm`b49+0$K{bIz3&|osOb6&oDckE6NB^6f#Ul zr)hvjqxA{Ogf0(`RJh3Co>%VO7{P}HKsBU|Q51D@(B|?)QxdVt)8@QW$8XpQ7rfU= z1%*ZIVg4Kz&!&C5wz`@;-I0Wkr!5^#9mQ@oRH4y*26p4WOpa8Lf2j1b+sp`|VO&@r z8^ExKl@YWtV=#AP7`U!_z|zZ#0P1L|d}4dbTf_8#RqKHRyE;?0ANZX~7A97srmo2) ze(ug-8_lfF;NBq_-HRT6} z>3uq-vvd5jb%V$1>V+~494aXuD>80?*I;y|B_}6yPMN&j3RswPS|GuX$+hc(@vNc@hc1?K0i%+^;yV=9;;PVxRP`ufDx*jT(= zl^1fWxjiv4L|f=Si?%sxUdof1x*o5A*6?==g(A5n`;?XAPN)ZHgig-&Ua`}WVtjsn z%;c?6CWlCb;kZ8w$(mYN;J8yV+Z#|Xu%4?6gGDSmx_j+y{_i4@E%Q}X-(zLNe>Gsv zI$c;9s}!Q}Jvb72->*Auedu$bhScKHy9F5!T%4pTX=rRrW2K~y7VN-YorzN|Y`|9p zF=h*P?by?u7Q1dHF;8&m4WEe}S9*XHSF zhYqea*VT2J)CG)_Rm3hSoK8!ua49V+%y&K2HS++&WY#uhs>^s#7mlQoYJ8?V>A-O` zS!C39k+6iK#*16Ilc;SLYMVMaIoU%GW7R3y1@hwK7X}ncw}?6t4auD?Ja({2kZkxl zuQ6I5li7>4*xwTy(<67c!1Su8r|05FcQZ4y@ra0s@#5lQvlLoZ7CD`@UW!6ZetHs1 zba&f(NJ1j38~0*S>CDnod=@Ui)XB-@J}_)5)gK9r?aR=Jm4B}gx5g(#?~*EhZjWrZ zI&EWQuA{?2S2lckF2~qd%jdx@!fZDVG1;q^g&qSwom04QN+E)f%f|sCW-9JRq3jQLXVTvlX=O#Gx&u4eF#^JW-4?Z?4LLbiT zmh%PPk(nG5GqsCB!CBi`2dj+`EM92&xqiYNzDOz_{V-4LPDy`z`;Jfjy~gm&8JlV? z(glZB^`s|*%#}77 z+YsD)^rhOvzBhcYZ-ekwj)BQ@0Dqs)%i<;aOtmU&tq+*MG`MU1s0%@>(+TP6>1`+W zM-Q+XSXk&$jllPA3zi2Vz@%lai9;rGw{Qv)tU>)fKt%0RaKY5{C{2C_x)S zO;pmmiRDh6i5Dy^a+l!}?0t5B0BK-?vswiA_mK$*N_MLR1aX zF3p>QyhsUizjV^xa(G`tn@Q04_{_Y1wLik*O^Onf6o`3VbGw#k~3r ze*BoW(U*%W!7jf%al&Q4lT-1osJ&#1 zDD1B9(r`xnPC;|@;X-6-)hu`;X)_DNtLdBsnme&(g_Yhv|9Gj~33pT~A@9MH_4eEA ze0zWQPQ(0?cgEHhsXitqx$*7W)XXwV#WPl`p`IG(XiqY4xm`1arlssPhQ?FtcJQxR zz7H_f?;PkkApdp`=GAEGMVG=C?T++>u(cc*ZxG5I+~z(3u~S`A#p9*Qa7cqI5xYf& zMKKEtmy5G_m$pd8s3Wzv^qWd~UquzwW}^?t-vV}Z(QTyMNhV6H(ZpDDeW5G$BH}p6 zBv1?(uNxA!XhRMTxko;x7jJ-8^IvF-l~5ujgW!ROY;WlV1qF@BqXQ>f^rVBPlSm}e zWQu+8e2H)ZWLXM1_d06mkhr)%78n}B69n89Da6Olnvh|rmomlp4I#hCa8$&^F zj!ra1$&-U9nRG4Q#*`9&!EnIbM43#c_40mTp4j`_IRW>sT~0b(lTEa%hLIZ{Y%-|| z-|^5O>Zqc4TW1w4O12zHiYBSPW{zx`BdeIrWavLGP#~eS= zB&_z(wu$F0~Uej9(Ov%p2zQ?*hAkgM^}Ojni0-k387LuQ)VCiXhA_EV44SkQ|EQ z8J6y-Vz^k3sYO(8TYSWdplGC+cHkU_(%5hXuC1t~v?uhd*2dQ-sr(S<=H{lRBlPs_A*AQp>_=J9yVuXUo{l8~%%*j|s) zq9PkslMHWJ6pY*oRgnj3?T_9f>aRq@%N@&E{jUNknUKRa=0nzE+Cs(?pyCV9J?yii+$|uue5fWcxh>Fl1?*T{O=u>_tKX1<7wh!E9)04i(YR&VgBG|y z47=Xe_FWJ0%lmiSL}T*|@TC5{wn}p|DTR#7K6>-HJCN@&ZcH@Ee;2mr2LmV+s*%#!GTW8P znE1#M>3?ge&Ia-BURRV%*ky+A4sPrRI}p`To7DHTUcIIS9v3IN4$N%64iTjef_Aop zv{q=~>K2=U*kcA4l0BZ-Zk(qL@-z>yCu(jkRk-(nT{iPp?rt3+*?{(iKnaqaiKXSR zjJD9s%*^=CQt^Wa*C@UiOB4!~4Rjb&#gtB)YOnD$|HUCYKN^Tuhlr@AAp7J*%!@R^1eaaHTKPgXmckNV)bY5xcWe`#_GczM38c1X^ z^j8D9s0?>x?h(lpw7Xl{Ab+cQv9Qpj8+!ODuF_ZN0pF=&_y*GI%u|#+!fsi#mAF>sPOSOuTWNqr_ct zYJR$p5*!i|Te8utW4ZB3@ID8vIWZN)Xq-4@(#SB@6ql2}EY`5zp9R9mFeuAj0+-Hq z>P$vX)Y;V5*1k}xUv7K?qJyEa7JE9@q4n7n7Ly3Wld3$4F|Wy*HT;qJC`PRHB*)s?(5uAqNoOcC@yhpsugibvXBg zhD?*Ntc->=Oa8R#r|@cNSQhWqd?N)NwOsdnsHCKW*U^!qEBj7E{eAJ9X^-sUV%|kY zVn}dDKby_Q8X6k<%Z9gtc;@b|Fu%B{P*PBUk&AT@Kj_y2!lU6J@JtAB_$6DNrgC_q zoTpOeMaue}mKJI>jTYmF%FFu$r-N=py-;{aRw~3I{h*2x!ZS1SyREI?hK+g! z1*Hz>Lc(kfHQVC5X=%#tcI%*qH_z*D_kc6jXkyxPbNRPsD6E;Jq{`VWb=A}2+CnRV zoN_{W2rJEmzuUqm-1)CoRb73F+pEXQT$pDsaYUS)oLth<)Agdn0z~SEMnJ9#RAjQAXk9Q ziCzE#o|CuXH^7=$=)yuZ^T0MK{4=0mB)Ncv?rUjrIl!N@*tV(p#>Pg4Fe8M+)QbxJ zWDRI_C|k)*R0d7nr!54Q@|OOsQ3iq*`nCKRy=k!bPEyCrB)@Vf(C~BZ#jLI#Xup|Q zW#0S%bMD;T2JZ<-+yby1>Ij@Z&*M#Yt<6iGPLRnO37U_Y$TNzgQx_FF&R8xR=YR~T zr+?n>g1Y}gYmA@Tb9XQFkd(HN;NEwxP`>W~QQ^o)pRWxo{Co8dV50lu;$ra;VvQdj zN}jH*z5e#QSyAJc=Uz{I{q&??)noXJxt$#{03_A=2coZ$vvp&Eg%iO540Ltj6JSke zwwcw4Od}90($b7?_02aL7#jzvNgKCZk5ezWQ0V1zaOaZ?w7t15_()I|1;XKQE|*2#<_sRim6Vidf=J3wJaa)&JOdN6aTy08ya0S*b8%)7d}Ex#6-i@H8c z9l|60ogGGpKqk9b+nWQC z_L=_txI#7qb(G*)?Ri>B33h60E=So@Hr)H`$Bv53%ws0PhwAUb+dqu{3NlKNQxUu8 z{q8vTW=ptRyxU;UIhM;eICUO4yE7-ZySpE#5!gDrQtF`RnJksO<@pRUBNE+Nk>$3E&Z2WHIWJ_u@MYq3C9#g zuKzf-dYgWJ*Dkx2?sQzxPvDBrR6xQFU}Fkazicu1#$>~amlCa3Q8lL5Q>(hgi!2}) z0~*7noIvPML-Kk(k!7Q!kuMq>OYosRr615adKCYRZTeVjBYCJeA?vd^}64-5vh@0WEl2>)=zTiU}fw zee>iTRRquNm5JD9yPyu$>gzXEhjIGFI-Q%6&)Rr(;_>t>5N^!kh6w`$ekJx;4i%_u z7W|ZQQBYJm;{uYiHV!6yV|n7L%z4$9{3>W1h-}6IV24l!h*Gz= zvm0j)J0y4>=?MarJvqAN0ZMH+0Ka!O#$$Ndl<_4*SKn!-tT8e&mr78}0A(L2p;={T z&zjVMq<`G%uCE+w^uv0ROV2avVXw;xF%aGqBrIqS3vT9q^JhwOC7kkv;Mx5c6sMl) zDxS!hH#cRH!OpN$VB!#hpmI3=>N0#lcHqmz=?@7o~X29uxbo~5nOXR3*s=-^YYqB5X`U&K$A3Q>?UPx`YQ_1H{ zy1+bn_lSaAy=?=5iD}=+n_8L3aL8vtqX7f;E}giZF=hRs-`kEJ&~T^( zp>BUuau4fhst5iRnfuuBf@a1Pz<*hTWO5c{m?^9G#iC?M>vG07B`rc6Z@u}_mX7fz zY`mmT-qnMn4{N~hLxl--Ql)Q1B9WPr4-y55V*~;#@xBxYxEs$bJ(kb=!vDag8iG;{ zuTG9V1WPs+{7>U*>54=9bTn(-xt!(JxWZi^;!EQHJ}&?K?aL=&aeI`bj)J>?=kRB& z^g<5YP|H=xj)v(AL(^$P#N!sSnyh)7anVC)uF8`^@hB*sfspLh6xc|g0O=_L#dJY27u|hGi^chK zwxOhYLZM!~$7#+Yu4fA>E-qdS5|)wMP$MKNHs;AOs7tCQMcoZ5l>=6ueCkt zMFvQ?3qdaRd$m78hMvg~&93EmPsE7h~KtN9qjr|u+#1uo78$b(}_A?TeIQ8V^YbNS3Vz0sDIHp z^MGH1?@TqA?GFfX=6T7)w z-PBzDtWv|{9Irsg@%_l4!9l&4f2+F&2cu%OKX+0`*FP5UaUI5X>3Ygq?(>wC=~LH#`L1GhI3*g}5T)`sQ@K~cqp8XmyZpjy1Xwl1D0c%7cuPO1k*4N#sVjWP+n{7#Pa zAfCc`_aU2OQ!9S&Dk=(5@3{+$h`9WMhi690rX~)6`_I?jS+^@m7T&C@uDLv&cURW< z9LQikKlS*TzOZnMMt23mM8H&{Z4@a~7gU=M@29LVLc3AVagp-E}|DooUF1K1aPIqg>Ne!%Yj9gkTxga$bX z-T(5)-qcU!c@{Z^K+>v(eXZmdk}#Oh+YcX(;HFaX4O+E@F$ie_t<@w^f;QS|NS6Lz%5BtaOoB zx%f*}Pfy`MM4ODN7yaq%?BPt1rMF2zB<-w%-kl5=lSZ!1x62zD%#YTySwP4VwakyB%_U(>q&1!rL4WZTAv|`R6IEWj2SPT()`Qz=k7Q5 ztOA$@OFci8+40FuQq>FbFl2L%r0_jOqH3JX9p}lbtE+bkF4D!E!^KJ(a0CnVw$$`I zZmaVgHz%QS3bJVx$Whw9&_ymkaWq5a>@<%?M{kh;V2s6YYH6;0(V-6x4F%Y4NNENv zS#obHi-umW81Y!jO|iEo0j7Tzh_0QToyOxKbgZPDVVa*?e!w>Zk8G@_VLlMQxi8b) zO&A2=?*nI%$YXtsS*-a*|AozCpsw5;0OeZcv~St+Y&tCLY`7SJ$6IVl7V0DjUYpGa zjO#b}v7(Piw5j)==u`%4HT}81r>ZJ?yuul4mc)1K3^wz#W4S85NmRy5sy;>xNOm1i z6n9;{qoczJkJj7_6p{s||MqmM0h2eU2jR^A7dUW^u2k##`9h}RXSqad3N`9KU?3=B zKUC%C=Pv?ORp$;!RV=+`DxM`1`1KdUgEC96uN<(Hz1b;l!1zEL0@oQ>qw$A>pit*m zyVQubGpDX3o>Xu@d)d$Rs-BRn$LJb0nJ@SO8E12$2o>f^tZFmbyJTatd9%ID0j{?9 zsAZ5GKYEudxD+%@Q-kk+|!fzNxPu4T31%}Uk;#s>|zr}SL zT^xoL-yIy%w9S&)b_krNK(_tJ36!qy87i>7d>|Nrq4xv6>_>=b``sRt?lORnvMQUR zM2#C5J?dm6XbFM#fT9|;(jp~OtbKzGaJhkNR}p`L!j^E{(K)a zj#Ld>p9eI~4hXNN13pzB*5VcbU%VC;7RD@VleVz|sJN=8<}%P7_2Q3?kVy^h?2jv2 zTg$J9>S&ymjUdL5d4g0OtofIn3dRV3v$tB?OR~THJF^43(YY(nZ>*sh>EzI$dp2sB zimslXQgz-Fjc2!Ka0ZK6msgs~LH~=)AduJ9{0n*6m{y>PS_;XA^2TUOPETBQnqn^g zu8m%lzvKk)`e>!QjCHNwd~!>ygv@T)aG-vTgX-8CsWo;ma&nTn#cy}AwvlH>iZuf1 zqbmL|!{_FiycuhmhL#`lKZT0#aXY?A}Q4us3X9F5ulgjsWfyQR#uR zTSp%4!b+r+tx~I-RuQD{C*o9(Tue0}QIJ^yv@y(dBMb2DuT22h?X`l#V6bc)4&pQS z<#hpqjAW(nBrYy23~`sEAX`lU^9^k?#!mtzH|b#XBVG_Ap23&`dq}VlfO5GPb%dm3 zx4hOc)rjUig=c)xn$LH(yk|)b4UJu&pYPgr(M1btWlu^oI37GD8!i^hRRnrvvNMyq zIa+W9ZZ9(k7;80Xj&Ttz0&PfX12!-u%N2B|H4hX>D)1=Vq3p715@*VR@8Dl_FvBEl zr+OH7(F_Rl4gVKk^SI~5qMSXWA{GxZWo8-4%8<%QLa@ zCbnZ}h^42_AfQst##zz?6N_qC^F$LveQ{y$ZyzcR=XxAh;UF1m2RK_whyog++K(#| zMfvGbqCBj4W4S5Hc+b`k=UxJE4jNHFD~Z*neAYWYQhI{a3PTuL43VR+q3nSHV}`hy z^*_FE`>)7a)Me=e)Tp!$^17s?q~44#rXCQqVk>~sbSYjim{Q$~BRha*=5P2-@b7>u z760rT%1o{UXnT*;EK&F`37Kp3c-GbLU$w_V= zw!tL@56uanTj^F|k*LI3>os3b8)6SyRBIzZUr2Uf;L;%gM4CZQ-e!bMFfx}KqFm(> zl#QvVxPY8+*U^mP-dcF*mNs(5rAKnG-O-rz`MIGku^Qt0Q#gam(KRp3Qt{+|uCMp= zSecYqIHVLd(NE~?uonJ3VSzQU^Yp&Ep09Hma*M00C1bG|%tTmNSgb}!*ayA`IyT5@ zvO;~jUY@6r!ZxWRU=Oo7KUNC}*Cz{r(tAL9_VD4nq16QF^Uj`3>$*z+onoN^URRWt zS2V16orbmFMAeHI715v-axIq*n3-|jUES2@ z$I^ET+AEw^OTQskcfbWdv1i!>e(_Nj__ z4NNY9envCM_bx&%aXZ4o9ruFC%?3FZ3&`}h?ZdL~eU17RBz>kpEa&tQsikkxAd(@R zDuVdEM@9Yfj#ZeTV1$q?2%ovDjLp@K4r_>1ZbDms3O0GXj*t<&SWK73E*k?gLD>+S zX~4B$`nuobQZk6*LxZ8yz2CXsRfI z?|!*rH1k>~wkIhi>xNOR1d^JLN`=P0^v6UMh9b(L4Nx1NvHiEV`x_b02 z_CP@YBMb_?c~1j>F48|0uxp9H~rDJ0N4OtciH=%?j|3#bfdXLpOce`wekkT zcg$~pNpkhD4FwzTTSMaQ-a+LH%IB(UF+py>+c_RxJWmH~8H|eb*{}B8#rMb>&SvaI zaq;d5kmV(B6UiihHQ++-Zd#{q<_TZa)SQ_I(Ls{m0n9H10T+=0Em5;CvDnxsV#@b+2Vje=`Ks zuRwm`l@t}ZCxGTj1S!a6zA-|Wbrcd-9}MzG1{~ZVvE6nsAp~?eEggo0ZOPXGE&gRz zRu=k#Q^!hVWaN3!s%yD6U}DUzt*T;1YI%tPKblT^_Nw}W!6K=A#-@AMuFPn#N(F$j zq`32Wd%B9|hz6hpMY{zpa_Z`S!nzZ<#ZFH0!pVF>GS@4UaM{=K(}-9PB!01qr~*>m z>Vsixy=hgyFV@URPtWs$UBdPS7(cH-5K=e6{tpsA-Bd71@9fGZDLJ6WZG)eO?s=BX z=O`q=ajMQcFq2CxR~YB{D7VTpWUcvQ{cLXzD`{Xz<)G+M2IxqG_)j)_+JWrauF`h~ zuLoMKTC2T~OEI&TpwYI9hk6LMzk=>5f`2uchid~lZi^~t^X6Y^jU#IQ1Qxs0an~yT zqUol+=Q!w28XFzcz%sxKSiH06b`5`jAmBGDpm}R-z3TNAH+RWfyM^nt7*^Q6;CSgw zf)5V|SK5u@m)bw2cX#rGD0OKBW?o%6xDBrh?a|(0@wJa9y}&pRzBhn#2Ted0pnH=! z-=9}RD6!jIeT}DMOi9oNm6rw!5P_Qhv)BcbI z4;K~W4LR>Mz)~1z9wFAb69}b5HeZT6_KJ}-*mt2aFW1SfzqCS2V z@ztb{{GuUYuoolpGJH+7A!m1y64{C@z; C%{D;* literal 0 HcmV?d00001 From 2f4a38dbd33061e950cf83ddc31785803d58c126 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 20 Feb 2019 17:05:31 -0800 Subject: [PATCH 0223/1117] Android embedding refactor pr3 add remaining systemchannels (#7892) Merging back in after reversion. Fixed some messaging issues in FlutterNativeView and corrected some message parsing. --- ci/licenses_golden/licenses_flutter | 2 + shell/platform/android/BUILD.gn | 2 + .../systemchannels/AccessibilityChannel.java | 120 ++++ .../systemchannels/LocalizationChannel.java | 23 +- .../systemchannels/PlatformChannel.java | 597 +++++++++++++++++- .../systemchannels/TextInputChannel.java | 409 ++++++++++++ .../editing/InputConnectionAdaptor.java | 58 +- .../plugin/editing/TextInputPlugin.java | 181 +++--- .../plugin/platform/PlatformPlugin.java | 375 +++++------ .../io/flutter/view/AccessibilityBridge.java | 294 ++++----- .../io/flutter/view/FlutterNativeView.java | 97 +-- .../android/io/flutter/view/FlutterView.java | 78 +-- 12 files changed, 1595 insertions(+), 641 deletions(-) create mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java create mode 100644 shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 7a1f118b1d09a..d593c12f915ad 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -447,6 +447,7 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/D 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/engine/systemchannels/AccessibilityChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/KeyEventChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/LifecycleChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java @@ -454,6 +455,7 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/system FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/SettingsChannel.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/SystemChannel.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.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 diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index b6560fca38737..ea6ee243977d3 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -114,6 +114,7 @@ java_library("flutter_shell_java") { "io/flutter/embedding/engine/dart/PlatformMessageHandler.java", "io/flutter/embedding/engine/renderer/FlutterRenderer.java", "io/flutter/embedding/engine/renderer/OnFirstFrameRenderedListener.java", + "io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java", "io/flutter/embedding/engine/systemchannels/KeyEventChannel.java", "io/flutter/embedding/engine/systemchannels/LifecycleChannel.java", "io/flutter/embedding/engine/systemchannels/LocalizationChannel.java", @@ -121,6 +122,7 @@ java_library("flutter_shell_java") { "io/flutter/embedding/engine/systemchannels/PlatformChannel.java", "io/flutter/embedding/engine/systemchannels/SettingsChannel.java", "io/flutter/embedding/engine/systemchannels/SystemChannel.java", + "io/flutter/embedding/engine/systemchannels/TextInputChannel.java", "io/flutter/plugin/common/ActivityLifecycleListener.java", "io/flutter/plugin/common/BasicMessageChannel.java", "io/flutter/plugin/common/BinaryCodec.java", diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java new file mode 100644 index 0000000000000..4bfcd37973b58 --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java @@ -0,0 +1,120 @@ +package io.flutter.embedding.engine.systemchannels; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; + +import java.util.HashMap; + +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.plugin.common.BasicMessageChannel; +import io.flutter.plugin.common.StandardMessageCodec; + +/** + * System channel that sends accessibility requests and events from Flutter to Android. + *

+ * See {@link AccessibilityMessageHandler}, which lists all accessibility requests and + * events that might be sent from Flutter to the Android platform. + */ +public class AccessibilityChannel { + @NonNull + public BasicMessageChannel channel; + @Nullable + private AccessibilityMessageHandler handler; + + private final BasicMessageChannel.MessageHandler parsingMessageHandler = new BasicMessageChannel.MessageHandler() { + @Override + public void onMessage(Object message, BasicMessageChannel.Reply reply) { + // If there is no handler to respond to this message then we don't need to + // parse it. Return. + if (handler == null) { + return; + } + + @SuppressWarnings("unchecked") + final HashMap annotatedEvent = (HashMap) message; + final String type = (String) annotatedEvent.get("type"); + @SuppressWarnings("unchecked") + final HashMap data = (HashMap) annotatedEvent.get("data"); + + switch (type) { + case "announce": + String announceMessage = (String) data.get("message"); + if (announceMessage != null) { + handler.announce(announceMessage); + } + break; + case "tap": { + Integer nodeId = (Integer) annotatedEvent.get("nodeId"); + if (nodeId != null) { + handler.onTap(nodeId); + } + break; + } + case "longPress": { + Integer nodeId = (Integer) annotatedEvent.get("nodeId"); + if (nodeId != null) { + handler.onLongPress(nodeId); + } + break; + } + case "tooltip": { + String tooltipMessage = (String) data.get("message"); + if (tooltipMessage != null) { + handler.onTooltip(tooltipMessage); + } + break; + } + } + } + }; + + /** + * Constructs an {@code AccessibilityChannel} that connects Android to the Dart code + * running in {@code dartExecutor}. + * + * The given {@code dartExecutor} is permitted to be idle or executing code. + * + * See {@link DartExecutor}. + */ + public AccessibilityChannel(@NonNull DartExecutor dartExecutor) { + channel = new BasicMessageChannel<>(dartExecutor, "flutter/accessibility", StandardMessageCodec.INSTANCE); + channel.setMessageHandler(parsingMessageHandler); + } + + /** + * Sets the {@link AccessibilityMessageHandler} which receives all events and requests + * that are parsed from the underlying accessibility channel. + */ + public void setAccessibilityMessageHandler(@Nullable AccessibilityMessageHandler handler) { + this.handler = handler; + } + + /** + * Handler that receives accessibility messages sent from Flutter to Android + * through a given {@link AccessibilityChannel}. + * + * To register an {@code AccessibilityMessageHandler} with a {@link AccessibilityChannel}, + * see {@link AccessibilityChannel#setAccessibilityMessageHandler(AccessibilityMessageHandler)}. + */ + public interface AccessibilityMessageHandler { + /** + * The Dart application would like the given {@code message} to be announced. + */ + void announce(@NonNull String message); + + /** + * The user has tapped on the artifact with the given {@code nodeId}. + */ + void onTap(int nodeId); + + /** + * The user has long pressed on the artifact with the given {@code nodeId}. + */ + void onLongPress(int nodeId); + + /** + * The user has opened a popup window, menu, dialog, etc. + */ + void onTooltip(@NonNull String message); + } +} diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java index ffb8f1f84a155..52e4fbb46171d 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java @@ -6,14 +6,17 @@ import android.support.annotation.NonNull; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; +import java.util.Locale; import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.plugin.common.JSONMethodCodec; import io.flutter.plugin.common.MethodChannel; /** - * TODO(mattcarroll): fill in javadoc for LocalizationChannel. + * Sends the platform's locales to Dart. */ public class LocalizationChannel { @@ -24,12 +27,18 @@ public LocalizationChannel(@NonNull DartExecutor dartExecutor) { this.channel = new MethodChannel(dartExecutor, "flutter/localization", JSONMethodCodec.INSTANCE); } - public void setLocale(String language, String country) { - channel.invokeMethod("setLocale", Arrays.asList(language, country)); - } - - public void setMethodCallHandler(MethodChannel.MethodCallHandler handler) { - channel.setMethodCallHandler(handler); + /** + * Send the given {@code locales} to Dart. + */ + public void sendLocales(List locales) { + List data = new ArrayList<>(); + for (Locale locale : locales) { + data.add(locale.getLanguage()); + data.add(locale.getCountry()); + data.add(locale.getScript()); + data.add(locale.getVariant()); + } + channel.invokeMethod("setLocale", data); } } diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java index b1ceb82b7a74d..9de3fe53646da 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java @@ -4,26 +4,613 @@ package io.flutter.embedding.engine.systemchannels; +import android.content.pm.ActivityInfo; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.List; + import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.plugin.common.JSONMethodCodec; +import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; /** - * TODO(mattcarroll): fill in javadoc for PlatformChannel. + * System channel that receives requests for host platform behavior, e.g., haptic and sound + * effects, system chrome configurations, and clipboard interaction. */ public class PlatformChannel { - + @NonNull public final MethodChannel channel; + @Nullable + private PlatformMessageHandler platformMessageHandler; + + private final MethodChannel.MethodCallHandler parsingMethodCallHandler = new MethodChannel.MethodCallHandler() { + @Override + public void onMethodCall(MethodCall call, MethodChannel.Result result) { + if (platformMessageHandler == null) { + // If no explicit PlatformMessageHandler has been registered then we don't + // need to forward this call to an API. Return. + return; + } + + String method = call.method; + Object arguments = call.arguments; + try { + switch (method) { + case "SystemSound.play": + try { + SoundType soundType = SoundType.fromValue((String) arguments); + platformMessageHandler.playSystemSound(soundType); + result.success(null); + } catch (NoSuchFieldException exception) { + // The desired sound type does not exist. + result.error("error", exception.getMessage(), null); + } + break; + case "HapticFeedback.vibrate": + try { + HapticFeedbackType feedbackType = HapticFeedbackType.fromValue((String) arguments); + platformMessageHandler.vibrateHapticFeedback(feedbackType); + result.success(null); + } catch (NoSuchFieldException exception) { + // The desired feedback type does not exist. + result.error("error", exception.getMessage(), null); + } + break; + case "SystemChrome.setPreferredOrientations": + try { + int androidOrientation = decodeOrientations((JSONArray) arguments); + platformMessageHandler.setPreferredOrientations(androidOrientation); + result.success(null); + } catch (JSONException | NoSuchFieldException exception) { + // JSONException: One or more expected fields were either omitted or referenced an invalid type. + // NoSuchFieldException: One or more expected fields were either omitted or referenced an invalid type. + result.error("error", exception.getMessage(), null); + } + break; + case "SystemChrome.setApplicationSwitcherDescription": + try { + AppSwitcherDescription description = decodeAppSwitcherDescription((JSONObject) arguments); + platformMessageHandler.setApplicationSwitcherDescription(description); + result.success(null); + } catch (JSONException exception) { + // One or more expected fields were either omitted or referenced an invalid type. + result.error("error", exception.getMessage(), null); + } + break; + case "SystemChrome.setEnabledSystemUIOverlays": + try { + List overlays = decodeSystemUiOverlays((JSONArray) arguments); + platformMessageHandler.showSystemOverlays(overlays); + result.success(null); + } catch (JSONException | NoSuchFieldException exception) { + // JSONException: One or more expected fields were either omitted or referenced an invalid type. + // NoSuchFieldException: One or more of the overlay names are invalid. + result.error("error", exception.getMessage(), null); + } + break; + case "SystemChrome.restoreSystemUIOverlays": + platformMessageHandler.restoreSystemUiOverlays(); + result.success(null); + break; + case "SystemChrome.setSystemUIOverlayStyle": + try { + SystemChromeStyle systemChromeStyle = decodeSystemChromeStyle((JSONObject) arguments); + platformMessageHandler.setSystemUiOverlayStyle(systemChromeStyle); + result.success(null); + } catch (JSONException | NoSuchFieldException exception) { + // JSONException: One or more expected fields were either omitted or referenced an invalid type. + // NoSuchFieldException: One or more of the brightness names are invalid. + result.error("error", exception.getMessage(), null); + } + break; + case "SystemNavigator.pop": + platformMessageHandler.popSystemNavigator(); + result.success(null); + break; + case "Clipboard.getData": { + String contentFormatName = (String) arguments; + ClipboardContentFormat clipboardFormat = null; + if (contentFormatName != null) { + try { + clipboardFormat = ClipboardContentFormat.fromValue(contentFormatName); + } catch (NoSuchFieldException exception) { + // An unsupported content format was requested. Return failure. + result.error("error", "No such clipboard content format: " + contentFormatName, null); + } + } + CharSequence clipboardContent = platformMessageHandler.getClipboardData(clipboardFormat); + if (clipboardContent != null) { + JSONObject response = new JSONObject(); + response.put("text", clipboardContent); + result.success(response); + } else { + result.success(null); + } + break; + } + case "Clipboard.setData": { + String clipboardContent = ((JSONObject) arguments).getString("text"); + platformMessageHandler.setClipboardData(clipboardContent); + result.success(null); + break; + } + default: + result.notImplemented(); + break; + } + } catch (JSONException e) { + result.error("error", "JSON error: " + e.getMessage(), null); + } + } + }; + + /** + * Constructs a {@code PlatformChannel} that connects Android to the Dart code + * running in {@code dartExecutor}. + * + * The given {@code dartExecutor} is permitted to be idle or executing code. + * + * See {@link DartExecutor}. + */ public PlatformChannel(@NonNull DartExecutor dartExecutor) { - this.channel = new MethodChannel(dartExecutor, "flutter/platform", JSONMethodCodec.INSTANCE); + channel = new MethodChannel(dartExecutor, "flutter/platform", JSONMethodCodec.INSTANCE); + channel.setMethodCallHandler(parsingMethodCallHandler); + } + + /** + * Sets the {@link PlatformMessageHandler} which receives all events and requests + * that are parsed from the underlying platform channel. + */ + public void setPlatformMessageHandler(@Nullable PlatformMessageHandler platformMessageHandler) { + this.platformMessageHandler = platformMessageHandler; + } + + // TODO(mattcarroll): add support for IntDef annotations, then add @ScreenOrientation + + /** + * Decodes a series of orientations to an aggregate desired orientation. + * + * @throws JSONException if {@code encodedOrientations} does not contain expected keys and value types. + * @throws NoSuchFieldException if any given encoded orientation is not a valid orientation name. + */ + private int decodeOrientations(@NonNull JSONArray encodedOrientations) throws JSONException, NoSuchFieldException { + int requestedOrientation = 0x00; + int firstRequestedOrientation = 0x00; + for (int index = 0; index < encodedOrientations.length(); index += 1) { + String encodedOrientation = encodedOrientations.getString(index); + DeviceOrientation orientation = DeviceOrientation.fromValue(encodedOrientation); + + switch (orientation) { + case PORTRAIT_UP: + requestedOrientation |= 0x01; + break; + case PORTRAIT_DOWN: + requestedOrientation |= 0x04; + break; + case LANDSCAPE_LEFT: + requestedOrientation |= 0x02; + break; + case LANDSCAPE_RIGHT: + requestedOrientation |= 0x08; + break; + } + + if (firstRequestedOrientation == 0x00) { + firstRequestedOrientation = requestedOrientation; + } + } + + switch (requestedOrientation) { + case 0x00: + return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; + case 0x01: + return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; + case 0x02: + return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; + case 0x04: + return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; + case 0x05: + return ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT; + case 0x08: + return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; + case 0x0a: + return ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE; + case 0x0b: + return ActivityInfo.SCREEN_ORIENTATION_USER; + case 0x0f: + return ActivityInfo.SCREEN_ORIENTATION_FULL_USER; + case 0x03: // portraitUp and landscapeLeft + case 0x06: // portraitDown and landscapeLeft + case 0x07: // portraitUp, portraitDown, and landscapeLeft + case 0x09: // portraitUp and landscapeRight + case 0x0c: // portraitDown and landscapeRight + case 0x0d: // portraitUp, portraitDown, and landscapeRight + case 0x0e: // portraitDown, landscapeLeft, and landscapeRight + // Android can't describe these cases, so just default to whatever the first + // specified value was. + switch (firstRequestedOrientation) { + case 0x01: + return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; + case 0x02: + return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; + case 0x04: + return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; + case 0x08: + return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; + } + } + + // Execution should never get this far, but if it does then we default + // to a portrait orientation. + return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; + } + + private AppSwitcherDescription decodeAppSwitcherDescription(@NonNull JSONObject encodedDescription) throws JSONException { + int color = encodedDescription.getInt("primaryColor"); + if (color != 0) { // 0 means color isn't set, use system default + color = color | 0xFF000000; // color must be opaque if set + } + String label = encodedDescription.getString("label"); + return new AppSwitcherDescription(color, label); + } + + /** + * Decodes a list of JSON-encoded overlays to a list of {@link SystemUiOverlay}. + * + * @throws JSONException if {@code encodedSystemUiOverlay} does not contain expected keys and value types. + * @throws NoSuchFieldException if any of the given encoded overlay names are invalid. + */ + private List decodeSystemUiOverlays(@NonNull JSONArray encodedSystemUiOverlay) throws JSONException, NoSuchFieldException { + List overlays = new ArrayList<>(); + for (int i = 0; i < encodedSystemUiOverlay.length(); ++i) { + String encodedOverlay = encodedSystemUiOverlay.getString(i); + SystemUiOverlay overlay = SystemUiOverlay.fromValue(encodedOverlay); + switch(overlay) { + case TOP_OVERLAYS: + overlays.add(SystemUiOverlay.TOP_OVERLAYS); + break; + case BOTTOM_OVERLAYS: + overlays.add(SystemUiOverlay.BOTTOM_OVERLAYS); + break; + } + } + return overlays; + } + + /** + * Decodes a JSON-encoded {@code encodedStyle} to a {@link SystemChromeStyle}. + * + * @throws JSONException if {@code encodedStyle} does not contain expected keys and value types. + * @throws NoSuchFieldException if any provided brightness name is invalid. + */ + private SystemChromeStyle decodeSystemChromeStyle(@NonNull JSONObject encodedStyle) throws JSONException, NoSuchFieldException { + Brightness systemNavigationBarIconBrightness = null; + // TODO(mattcarroll): add color annotation + Integer systemNavigationBarColor = null; + // TODO(mattcarroll): add color annotation + Integer systemNavigationBarDividerColor = null; + Brightness statusBarIconBrightness = null; + // TODO(mattcarroll): add color annotation + Integer statusBarColor = null; + + if (!encodedStyle.isNull("systemNavigationBarIconBrightness")) { + systemNavigationBarIconBrightness = Brightness.fromValue(encodedStyle.getString("systemNavigationBarIconBrightness")); + } + + if (!encodedStyle.isNull("systemNavigationBarColor")) { + systemNavigationBarColor = encodedStyle.getInt("systemNavigationBarColor"); + } + + if (!encodedStyle.isNull("statusBarIconBrightness")) { + statusBarIconBrightness = Brightness.fromValue(encodedStyle.getString("statusBarIconBrightness")); + } + + if (!encodedStyle.isNull("statusBarColor")) { + statusBarColor = encodedStyle.getInt("statusBarColor"); + } + + if (!encodedStyle.isNull("systemNavigationBarDividerColor")) { + systemNavigationBarDividerColor = encodedStyle.getInt("systemNavigationBarDividerColor"); + } + + return new SystemChromeStyle( + statusBarColor, + statusBarIconBrightness, + systemNavigationBarColor, + systemNavigationBarIconBrightness, + systemNavigationBarDividerColor + ); } - public void setMethodCallHandler(@Nullable MethodChannel.MethodCallHandler handler) { - channel.setMethodCallHandler(handler); + /** + * Handler that receives platform messages sent from Flutter to Android + * through a given {@link PlatformChannel}. + * + * To register a {@code PlatformMessageHandler} with a {@link PlatformChannel}, + * see {@link PlatformChannel#setPlatformMessageHandler(PlatformMessageHandler)}. + */ + public interface PlatformMessageHandler { + /** + * The Flutter application would like to play the given {@code soundType}. + */ + void playSystemSound(@NonNull SoundType soundType); + + /** + * The Flutter application would like to play the given haptic {@code feedbackType}. + */ + void vibrateHapticFeedback(@NonNull HapticFeedbackType feedbackType); + + /** + * The Flutter application would like to display in the given {@code androidOrientation}. + */ + // TODO(mattcarroll): add @ScreenOrientation annotation + void setPreferredOrientations(int androidOrientation); + + /** + * The Flutter application would like to be displayed in Android's app switcher with + * the visual representation described in the given {@code description}. + *

+ * See the related Android documentation: + * https://developer.android.com/guide/components/activities/recents + */ + void setApplicationSwitcherDescription(@NonNull AppSwitcherDescription description); + + /** + * The Flutter application would like the Android system to display the given + * {@code overlays}. + *

+ * {@link SystemUiOverlay#TOP_OVERLAYS} refers to system overlays such as the + * status bar, while {@link SystemUiOverlay#BOTTOM_OVERLAYS} refers to system + * overlays such as the back/home/recents navigation on the bottom of the screen. + *

+ * An empty list of {@code overlays} should hide all system overlays. + */ + void showSystemOverlays(@NonNull List overlays); + + /** + * The Flutter application would like to restore the visibility of system + * overlays to the last set of overlays sent via {@link #showSystemOverlays(List)}. + *

+ * If {@link #showSystemOverlays(List)} has yet to be called, then a default + * system overlay appearance is desired: + *

+ * {@code + * View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + * } + */ + void restoreSystemUiOverlays(); + + /** + * The Flutter application would like the system chrome to present itself with + * the given {@code systemUiOverlayStyle}, i.e., the given status bar and + * navigation bar colors and brightness. + */ + void setSystemUiOverlayStyle(@NonNull SystemChromeStyle systemUiOverlayStyle); + + /** + * The Flutter application would like to pop the top item off of the Android + * app's navigation back stack. + */ + void popSystemNavigator(); + + /** + * The Flutter application would like to receive the current data in the + * clipboard and have it returned in the given {@code format}. + */ + @Nullable + CharSequence getClipboardData(@Nullable ClipboardContentFormat format); + + /** + * The Flutter application would like to set the current data in the + * clipboard to the given {@code text}. + */ + void setClipboardData(@NonNull String text); } + /** + * Types of sounds the Android OS can play on behalf of an application. + */ + public enum SoundType { + CLICK("SystemSoundType.click"); + + static SoundType fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (SoundType soundType : SoundType.values()) { + if (soundType.encodedName.equals(encodedName)) { + return soundType; + } + } + throw new NoSuchFieldException("No such SoundType: " + encodedName); + } + + @NonNull + private final String encodedName; + + SoundType(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * The types of haptic feedback that the Android OS can generate on behalf + * of an application. + */ + public enum HapticFeedbackType { + STANDARD(null), + LIGHT_IMPACT("HapticFeedbackType.lightImpact"), + MEDIUM_IMPACT("HapticFeedbackType.mediumImpact"), + HEAVY_IMPACT("HapticFeedbackType.heavyImpact"), + SELECTION_CLICK("HapticFeedbackType.selectionClick"); + + static HapticFeedbackType fromValue(@Nullable String encodedName) throws NoSuchFieldException { + for (HapticFeedbackType feedbackType : HapticFeedbackType.values()) { + if ((feedbackType.encodedName == null && encodedName == null) + || (feedbackType.encodedName != null && feedbackType.encodedName.equals(encodedName))) { + return feedbackType; + } + } + throw new NoSuchFieldException("No such HapticFeedbackType: " + encodedName); + } + + @Nullable + private final String encodedName; + + HapticFeedbackType(@Nullable String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * The possible desired orientations of a Flutter application. + */ + public enum DeviceOrientation { + PORTRAIT_UP("DeviceOrientation.portraitUp"), + PORTRAIT_DOWN("DeviceOrientation.portraitDown"), + LANDSCAPE_LEFT("DeviceOrientation.landscapeLeft"), + LANDSCAPE_RIGHT("DeviceOrientation.landscapeRight"); + + static DeviceOrientation fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (DeviceOrientation orientation : DeviceOrientation.values()) { + if (orientation.encodedName.equals(encodedName)) { + return orientation; + } + } + throw new NoSuchFieldException("No such DeviceOrientation: " + encodedName); + } + + @NonNull + private String encodedName; + + DeviceOrientation(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * The set of Android system UI overlays as perceived by the Flutter application. + *

+ * Android includes many more overlay options and flags than what is provided by + * {@code SystemUiOverlay}. Flutter only requires control over a subset of the + * overlays and those overlays are represented by {@code SystemUiOverlay} values. + */ + public enum SystemUiOverlay { + TOP_OVERLAYS("SystemUiOverlay.top"), + BOTTOM_OVERLAYS("SystemUiOverlay.bottom"); + + static SystemUiOverlay fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (SystemUiOverlay overlay : SystemUiOverlay.values()) { + if (overlay.encodedName.equals(encodedName)) { + return overlay; + } + } + throw new NoSuchFieldException("No such SystemUiOverlay: " + encodedName); + } + + @NonNull + private String encodedName; + + SystemUiOverlay(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * The color and label of an application that appears in Android's app switcher, AKA + * recents screen. + */ + public static class AppSwitcherDescription { + // TODO(mattcarroll): add color annotation + public final int color; + @NonNull + public final String label; + + public AppSwitcherDescription(int color, @NonNull String label) { + this.color = color; + this.label = label; + } + } + + /** + * The color and brightness of system chrome, e.g., status bar and system navigation bar. + */ + public static class SystemChromeStyle { + // TODO(mattcarroll): add color annotation + @Nullable + public final Integer statusBarColor; + @Nullable + public final Brightness statusBarIconBrightness; + // TODO(mattcarroll): add color annotation + @Nullable + public final Integer systemNavigationBarColor; + @Nullable + public final Brightness systemNavigationBarIconBrightness; + // TODO(mattcarroll): add color annotation + @Nullable + public final Integer systemNavigationBarDividerColor; + + public SystemChromeStyle( + @Nullable Integer statusBarColor, + @Nullable Brightness statusBarIconBrightness, + @Nullable Integer systemNavigationBarColor, + @Nullable Brightness systemNavigationBarIconBrightness, + @Nullable Integer systemNavigationBarDividerColor + ) { + this.statusBarColor = statusBarColor; + this.statusBarIconBrightness = statusBarIconBrightness; + this.systemNavigationBarColor = systemNavigationBarColor; + this.systemNavigationBarIconBrightness = systemNavigationBarIconBrightness; + this.systemNavigationBarDividerColor = systemNavigationBarDividerColor; + } + } + + public enum Brightness { + LIGHT("Brightness.light"), + DARK("Brightness.dark"); + + static Brightness fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (Brightness brightness : Brightness.values()) { + if (brightness.encodedName.equals(encodedName)) { + return brightness; + } + } + throw new NoSuchFieldException("No such Brightness: " + encodedName); + } + + @NonNull + private String encodedName; + + Brightness(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * Data formats of clipboard content. + */ + public enum ClipboardContentFormat { + PLAIN_TEXT("text/plain"); + + static ClipboardContentFormat fromValue(String encodedName) throws NoSuchFieldException { + for (ClipboardContentFormat format : ClipboardContentFormat.values()) { + if (format.encodedName.equals(encodedName)) { + return format; + } + } + throw new NoSuchFieldException("No such ClipboardContentFormat: " + encodedName); + } + + @NonNull + private String encodedName; + + ClipboardContentFormat(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } } diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java new file mode 100644 index 0000000000000..b23d33fd00996 --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java @@ -0,0 +1,409 @@ +package io.flutter.embedding.engine.systemchannels; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.view.inputmethod.EditorInfo; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.Arrays; +import java.util.HashMap; + +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.plugin.common.JSONMethodCodec; +import io.flutter.plugin.common.MethodCall; +import io.flutter.plugin.common.MethodChannel; + +/** + * {@link TextInputChannel} is a platform channel between Android and Flutter that is used to + * communicate information about the user's text input. + *

+ * When the user presses an action button like "done" or "next", that action is sent from Android + * to Flutter through this {@link TextInputChannel}. + *

+ * When an input system in the Flutter app wants to show the keyboard, or hide it, or configure + * editing state, etc. a message is sent from Flutter to Android through this {@link TextInputChannel}. + *

+ * {@link TextInputChannel} comes with a default {@link io.flutter.plugin.common.MethodChannel.MethodCallHandler} + * that parses incoming messages from Flutter. Register a {@link TextInputMethodHandler} to respond + * to standard Flutter text input messages. + */ +public class TextInputChannel { + private static final String TAG = "TextInputChannel"; + @NonNull + public final MethodChannel channel; + @Nullable + private TextInputMethodHandler textInputMethodHandler; + + private final MethodChannel.MethodCallHandler parsingMethodHandler = new MethodChannel.MethodCallHandler() { + @Override + public void onMethodCall(MethodCall call, MethodChannel.Result result) { + if (textInputMethodHandler == null) { + // If no explicit TextInputMethodHandler has been registered then we don't + // need to forward this call to an API. Return. + return; + } + + String method = call.method; + Object args = call.arguments; + switch (method) { + case "TextInput.show": + textInputMethodHandler.show(); + result.success(null); + break; + case "TextInput.hide": + textInputMethodHandler.hide(); + result.success(null); + break; + case "TextInput.setClient": + try { + final JSONArray argumentList = (JSONArray) args; + final int textInputClientId = argumentList.getInt(0); + final JSONObject jsonConfiguration = argumentList.getJSONObject(1); + textInputMethodHandler.setClient(textInputClientId, Configuration.fromJson(jsonConfiguration)); + result.success(null); + } catch (JSONException | NoSuchFieldException exception) { + // JSONException: missing keys or bad value types. + // NoSuchFieldException: one or more values were invalid. + result.error("error", exception.getMessage(), null); + } + break; + case "TextInput.setEditingState": + try { + final JSONObject editingState = (JSONObject) args; + textInputMethodHandler.setEditingState(TextEditState.fromJson(editingState)); + result.success(null); + } catch (JSONException exception) { + result.error("error", exception.getMessage(), null); + } + break; + case "TextInput.clearClient": + textInputMethodHandler.clearClient(); + result.success(null); + break; + default: + result.notImplemented(); + break; + } + } + }; + + /** + * Constructs a {@code TextInputChannel} that connects Android to the Dart code + * running in {@code dartExecutor}. + * + * The given {@code dartExecutor} is permitted to be idle or executing code. + * + * See {@link DartExecutor}. + */ + public TextInputChannel(@NonNull DartExecutor dartExecutor) { + this.channel = new MethodChannel(dartExecutor, "flutter/textinput", JSONMethodCodec.INSTANCE); + channel.setMethodCallHandler(parsingMethodHandler); + } + + /** + * Instructs Flutter to update its text input editing state to reflect the given configuration. + */ + public void updateEditingState(int inputClientId, String text, int selectionStart, int selectionEnd, int composingStart, int composingEnd) { + HashMap state = new HashMap<>(); + state.put("text", text); + state.put("selectionBase", selectionStart); + state.put("selectionExtent", selectionEnd); + state.put("composingBase", composingStart); + state.put("composingExtent", composingEnd); + + channel.invokeMethod( + "TextInputClient.updateEditingState", + Arrays.asList(inputClientId, state) + ); + } + + /** + * Instructs Flutter to execute a "newline" action. + */ + public void newline(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.newline") + ); + } + + /** + * Instructs Flutter to execute a "go" action. + */ + public void go(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.go") + ); + } + + /** + * Instructs Flutter to execute a "search" action. + */ + public void search(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.search") + ); + } + + /** + * Instructs Flutter to execute a "send" action. + */ + public void send(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.send") + ); + } + + /** + * Instructs Flutter to execute a "done" action. + */ + public void done(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.done") + ); + } + + /** + * Instructs Flutter to execute a "next" action. + */ + public void next(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.next") + ); + } + + /** + * Instructs Flutter to execute a "previous" action. + */ + public void previous(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.previous") + ); + } + + /** + * Instructs Flutter to execute an "unspecified" action. + */ + public void unspecifiedAction(int inputClientId) { + channel.invokeMethod( + "TextInputClient.performAction", + Arrays.asList(inputClientId, "TextInputAction.unspecified") + ); + } + + /** + * Sets the {@link TextInputMethodHandler} which receives all events and requests + * that are parsed from the underlying platform channel. + */ + public void setTextInputMethodHandler(@Nullable TextInputMethodHandler textInputMethodHandler) { + this.textInputMethodHandler = textInputMethodHandler; + } + + public interface TextInputMethodHandler { + // TODO(mattcarroll): javadoc + void show(); + + // TODO(mattcarroll): javadoc + void hide(); + + // TODO(mattcarroll): javadoc + void setClient(int textInputClientId, @NonNull Configuration configuration); + + // TODO(mattcarroll): javadoc + void setEditingState(@NonNull TextEditState editingState); + + // TODO(mattcarroll): javadoc + void clearClient(); + } + + /** + * A text editing configuration. + */ + public static class Configuration { + public static Configuration fromJson(@NonNull JSONObject json) throws JSONException, NoSuchFieldException { + final String inputActionName = json.getString("inputAction"); + if (inputActionName == null) { + throw new JSONException("Configuration JSON missing 'inputAction' property."); + } + + final Integer inputAction = inputActionFromTextInputAction(inputActionName); + return new Configuration( + json.optBoolean("obscureText"), + json.optBoolean("autocorrect", true), + TextCapitalization.fromValue(json.getString("textCapitalization")), + InputType.fromJson(json.getJSONObject("inputType")), + inputAction, + json.optString("actionLabel") + ); + } + + private static Integer inputActionFromTextInputAction(@NonNull String inputAction) { + switch (inputAction) { + case "TextInputAction.newline": + return EditorInfo.IME_ACTION_NONE; + case "TextInputAction.none": + return EditorInfo.IME_ACTION_NONE; + case "TextInputAction.unspecified": + return EditorInfo.IME_ACTION_UNSPECIFIED; + case "TextInputAction.done": + return EditorInfo.IME_ACTION_DONE; + case "TextInputAction.go": + return EditorInfo.IME_ACTION_GO; + case "TextInputAction.search": + return EditorInfo.IME_ACTION_SEARCH; + case "TextInputAction.send": + return EditorInfo.IME_ACTION_SEND; + case "TextInputAction.next": + return EditorInfo.IME_ACTION_NEXT; + case "TextInputAction.previous": + return EditorInfo.IME_ACTION_PREVIOUS; + default: + // Present default key if bad input type is given. + return EditorInfo.IME_ACTION_UNSPECIFIED; + } + } + + public final boolean obscureText; + public final boolean autocorrect; + @NonNull + public final TextCapitalization textCapitalization; + @NonNull + public final InputType inputType; + @Nullable + public final Integer inputAction; + @Nullable + public final String actionLabel; + + public Configuration( + boolean obscureText, + boolean autocorrect, + @NonNull TextCapitalization textCapitalization, + @NonNull InputType inputType, + @Nullable Integer inputAction, + @Nullable String actionLabel + ) { + this.obscureText = obscureText; + this.autocorrect = autocorrect; + this.textCapitalization = textCapitalization; + this.inputType = inputType; + this.inputAction = inputAction; + this.actionLabel = actionLabel; + } + } + + /** + * A text input type. + * + * If the {@link #type} is {@link TextInputType#NUMBER}, this {@code InputType} also + * reports whether that number {@link #isSigned} and {@link #isDecimal}. + */ + public static class InputType { + @NonNull + public static InputType fromJson(@NonNull JSONObject json) throws JSONException, NoSuchFieldException { + return new InputType( + TextInputType.fromValue(json.getString("name")), + json.optBoolean("signed", false), + json.optBoolean("decimal", false) + ); + } + + @NonNull + public final TextInputType type; + public final boolean isSigned; + public final boolean isDecimal; + + public InputType(@NonNull TextInputType type, boolean isSigned, boolean isDecimal) { + this.type = type; + this.isSigned = isSigned; + this.isDecimal = isDecimal; + } + } + + /** + * Types of text input. + */ + public enum TextInputType { + TEXT("TextInputType.text"), + DATETIME("TextInputType.datetime"), + NUMBER("TextInputType.number"), + PHONE("TextInputType.phone"), + MULTILINE("TextInputType.multiline"), + EMAIL_ADDRESS("TextInputType.emailAddress"), + URL("TextInputType.url"); + + static TextInputType fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (TextInputType textInputType : TextInputType.values()) { + if (textInputType.encodedName.equals(encodedName)) { + return textInputType; + } + } + throw new NoSuchFieldException("No such TextInputType: " + encodedName); + } + + @NonNull + private final String encodedName; + + TextInputType(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * Text capitalization schemes. + */ + public enum TextCapitalization { + CHARACTERS("TextCapitalization.characters"), + WORDS("TextCapitalization.words"), + SENTENCES("TextCapitalization.sentences"), + NONE("TextCapitalization.none"); + + static TextCapitalization fromValue(@NonNull String encodedName) throws NoSuchFieldException { + for (TextCapitalization textCapitalization : TextCapitalization.values()) { + if (textCapitalization.encodedName.equals(encodedName)) { + return textCapitalization; + } + } + throw new NoSuchFieldException("No such TextCapitalization: " + encodedName); + } + + @NonNull + private final String encodedName; + + TextCapitalization(@NonNull String encodedName) { + this.encodedName = encodedName; + } + } + + /** + * State of an on-going text editing session. + */ + public static class TextEditState { + public static TextEditState fromJson(@NonNull JSONObject textEditState) throws JSONException { + return new TextEditState( + textEditState.getString("text"), + textEditState.getInt("selectionBase"), + textEditState.getInt("selectionExtent") + ); + } + + @NonNull + public final String text; + public final int selectionStart; + public final int selectionEnd; + + public TextEditState(@NonNull String text, int selectionStart, int selectionEnd) { + this.text = text; + this.selectionStart = selectionStart; + this.selectionEnd = selectionEnd; + } + } +} diff --git a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java index df907be0b70a1..b3a287820bfe9 100644 --- a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java +++ b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java @@ -11,17 +11,16 @@ import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; + +import io.flutter.embedding.engine.systemchannels.TextInputChannel; import io.flutter.plugin.common.ErrorLogResult; import io.flutter.plugin.common.MethodChannel; import io.flutter.view.FlutterView; -import java.util.Arrays; -import java.util.HashMap; - class InputConnectionAdaptor extends BaseInputConnection { private final FlutterView mFlutterView; private final int mClient; - private final MethodChannel mFlutterChannel; + private final TextInputChannel textInputChannel; private final Editable mEditable; private int mBatchCount; private InputMethodManager mImm; @@ -29,12 +28,16 @@ class InputConnectionAdaptor extends BaseInputConnection { private static final MethodChannel.Result logger = new ErrorLogResult("FlutterTextInput"); - public InputConnectionAdaptor(FlutterView view, int client, - MethodChannel flutterChannel, Editable editable) { + public InputConnectionAdaptor( + FlutterView view, + int client, + TextInputChannel textInputChannel, + Editable editable + ) { super(view, true); mFlutterView = view; mClient = client; - mFlutterChannel = flutterChannel; + this.textInputChannel = textInputChannel; mEditable = editable; mBatchCount = 0; mImm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); @@ -55,14 +58,14 @@ private void updateEditingState() { selectionStart, selectionEnd, composingStart, composingEnd); - HashMap state = new HashMap<>(); - state.put("text", mEditable.toString()); - state.put("selectionBase", selectionStart); - state.put("selectionExtent", selectionEnd); - state.put("composingBase", composingStart); - state.put("composingExtent", composingEnd); - mFlutterChannel.invokeMethod("TextInputClient.updateEditingState", - Arrays.asList(mClient, state), logger); + textInputChannel.updateEditingState( + mClient, + mEditable.toString(), + selectionStart, + selectionEnd, + composingStart, + composingEnd + ); } @Override @@ -178,39 +181,30 @@ public boolean sendKeyEvent(KeyEvent event) { @Override public boolean performEditorAction(int actionCode) { switch (actionCode) { - // TODO(mattcarroll): is newline an appropriate action for "none"? case EditorInfo.IME_ACTION_NONE: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.newline"), logger); + textInputChannel.newline(mClient); break; case EditorInfo.IME_ACTION_UNSPECIFIED: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.unspecified"), logger); + textInputChannel.unspecifiedAction(mClient); break; case EditorInfo.IME_ACTION_GO: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.go"), logger); + textInputChannel.go(mClient); break; case EditorInfo.IME_ACTION_SEARCH: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.search"), logger); + textInputChannel.search(mClient); break; case EditorInfo.IME_ACTION_SEND: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.send"), logger); + textInputChannel.send(mClient); break; case EditorInfo.IME_ACTION_NEXT: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.next"), logger); + textInputChannel.next(mClient); break; case EditorInfo.IME_ACTION_PREVIOUS: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.previous"), logger); + textInputChannel.previous(mClient); break; default: case EditorInfo.IME_ACTION_DONE: - mFlutterChannel.invokeMethod("TextInputClient.performAction", - Arrays.asList(mClient, "TextInputAction.done"), logger); + textInputChannel.done(mClient); break; } return true; diff --git a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java index c59ee25148e2d..bc54b3ed045ac 100644 --- a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java +++ b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java @@ -5,6 +5,7 @@ package io.flutter.plugin.editing; import android.content.Context; +import android.support.annotation.NonNull; import android.text.Editable; import android.text.InputType; import android.text.Selection; @@ -12,84 +13,87 @@ import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; -import io.flutter.plugin.common.JSONMethodCodec; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; -import io.flutter.plugin.common.MethodChannel.MethodCallHandler; -import io.flutter.plugin.common.MethodChannel.Result; + +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.embedding.engine.systemchannels.TextInputChannel; import io.flutter.view.FlutterView; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; /** * Android implementation of the text input plugin. */ -public class TextInputPlugin implements MethodCallHandler { +public class TextInputPlugin { private final FlutterView mView; private final InputMethodManager mImm; - private final MethodChannel mFlutterChannel; + private final TextInputChannel textInputChannel; private int mClient = 0; - private JSONObject mConfiguration; + private TextInputChannel.Configuration configuration; private Editable mEditable; private boolean mRestartInputPending; - public TextInputPlugin(FlutterView view) { + public TextInputPlugin(FlutterView view, @NonNull DartExecutor dartExecutor) { mView = view; mImm = (InputMethodManager) view.getContext().getSystemService( Context.INPUT_METHOD_SERVICE); - mFlutterChannel = new MethodChannel(view, "flutter/textinput", JSONMethodCodec.INSTANCE); - mFlutterChannel.setMethodCallHandler(this); - } - @Override - public void onMethodCall(MethodCall call, Result result) { - String method = call.method; - Object args = call.arguments; - try { - if (method.equals("TextInput.show")) { + textInputChannel = new TextInputChannel(dartExecutor); + textInputChannel.setTextInputMethodHandler(new TextInputChannel.TextInputMethodHandler() { + @Override + public void show() { showTextInput(mView); - result.success(null); - } else if (method.equals("TextInput.hide")) { + } + + @Override + public void hide() { hideTextInput(mView); - result.success(null); - } else if (method.equals("TextInput.setClient")) { - final JSONArray argumentList = (JSONArray) args; - setTextInputClient(mView, argumentList.getInt(0), argumentList.getJSONObject(1)); - result.success(null); - } else if (method.equals("TextInput.setEditingState")) { - setTextInputEditingState(mView, (JSONObject) args); - result.success(null); - } else if (method.equals("TextInput.clearClient")) { + } + + @Override + public void setClient(int textInputClientId, TextInputChannel.Configuration configuration) { + setTextInputClient(textInputClientId, configuration); + } + + @Override + public void setEditingState(TextInputChannel.TextEditState editingState) { + setTextInputEditingState(mView, editingState); + } + + @Override + public void clearClient() { clearTextInputClient(); - result.success(null); - } else { - result.notImplemented(); } - } catch (JSONException e) { - result.error("error", "JSON error: " + e.getMessage(), null); - } + }); } - private static int inputTypeFromTextInputType(JSONObject type, boolean obscureText, - boolean autocorrect, String textCapitalization) throws JSONException { - String inputType = type.getString("name"); - if (inputType.equals("TextInputType.datetime")) return InputType.TYPE_CLASS_DATETIME; - if (inputType.equals("TextInputType.number")) { + private static int inputTypeFromTextInputType( + TextInputChannel.InputType type, + boolean obscureText, + boolean autocorrect, + TextInputChannel.TextCapitalization textCapitalization + ) { + if (type.type == TextInputChannel.TextInputType.DATETIME) { + return InputType.TYPE_CLASS_DATETIME; + } else if (type.type == TextInputChannel.TextInputType.NUMBER) { int textType = InputType.TYPE_CLASS_NUMBER; - if (type.optBoolean("signed")) textType |= InputType.TYPE_NUMBER_FLAG_SIGNED; - if (type.optBoolean("decimal")) textType |= InputType.TYPE_NUMBER_FLAG_DECIMAL; + if (type.isSigned) { + textType |= InputType.TYPE_NUMBER_FLAG_SIGNED; + } + if (type.isDecimal) { + textType |= InputType.TYPE_NUMBER_FLAG_DECIMAL; + } return textType; + } else if (type.type == TextInputChannel.TextInputType.PHONE) { + return InputType.TYPE_CLASS_PHONE; } - if (inputType.equals("TextInputType.phone")) return InputType.TYPE_CLASS_PHONE; int textType = InputType.TYPE_CLASS_TEXT; - if (inputType.equals("TextInputType.multiline")) + if (type.type == TextInputChannel.TextInputType.MULTILINE) { textType |= InputType.TYPE_TEXT_FLAG_MULTI_LINE; - else if (inputType.equals("TextInputType.emailAddress")) + } else if (type.type == TextInputChannel.TextInputType.EMAIL_ADDRESS) { textType |= InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; - else if (inputType.equals("TextInputType.url")) + } else if (type.type == TextInputChannel.TextInputType.URL) { textType |= InputType.TYPE_TEXT_VARIATION_URI; + } + if (obscureText) { // Note: both required. Some devices ignore TYPE_TEXT_FLAG_NO_SUGGESTIONS. textType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; @@ -97,69 +101,50 @@ else if (inputType.equals("TextInputType.url")) } else { if (autocorrect) textType |= InputType.TYPE_TEXT_FLAG_AUTO_CORRECT; } - if (textCapitalization.equals("TextCapitalization.characters")) { + + if (textCapitalization == TextInputChannel.TextCapitalization.CHARACTERS) { textType |= InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; - } else if (textCapitalization.equals("TextCapitalization.words")) { + } else if (textCapitalization == TextInputChannel.TextCapitalization.WORDS) { textType |= InputType.TYPE_TEXT_FLAG_CAP_WORDS; - } else if (textCapitalization.equals("TextCapitalization.sentences")) { + } else if (textCapitalization == TextInputChannel.TextCapitalization.SENTENCES) { textType |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; } - return textType; - } - private static int inputActionFromTextInputAction(String inputAction) { - switch (inputAction) { - case "TextInputAction.newline": - return EditorInfo.IME_ACTION_NONE; - case "TextInputAction.none": - return EditorInfo.IME_ACTION_NONE; - case "TextInputAction.unspecified": - return EditorInfo.IME_ACTION_UNSPECIFIED; - case "TextInputAction.done": - return EditorInfo.IME_ACTION_DONE; - case "TextInputAction.go": - return EditorInfo.IME_ACTION_GO; - case "TextInputAction.search": - return EditorInfo.IME_ACTION_SEARCH; - case "TextInputAction.send": - return EditorInfo.IME_ACTION_SEND; - case "TextInputAction.next": - return EditorInfo.IME_ACTION_NEXT; - case "TextInputAction.previous": - return EditorInfo.IME_ACTION_PREVIOUS; - default: - // Present default key if bad input type is given. - return EditorInfo.IME_ACTION_UNSPECIFIED; - } + return textType; } - public InputConnection createInputConnection(FlutterView view, EditorInfo outAttrs) - throws JSONException { + public InputConnection createInputConnection(FlutterView view, EditorInfo outAttrs) { if (mClient == 0) return null; - outAttrs.inputType = inputTypeFromTextInputType(mConfiguration.getJSONObject("inputType"), - mConfiguration.optBoolean("obscureText"), - mConfiguration.optBoolean("autocorrect", true), - mConfiguration.getString("textCapitalization")); + outAttrs.inputType = inputTypeFromTextInputType( + configuration.inputType, + configuration.obscureText, + configuration.autocorrect, + configuration.textCapitalization + ); outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN; int enterAction; - if (mConfiguration.isNull("inputAction")) { + if (configuration.inputAction == null) { // If an explicit input action isn't set, then default to none for multi-line fields // and done for single line fields. enterAction = (InputType.TYPE_TEXT_FLAG_MULTI_LINE & outAttrs.inputType) != 0 ? EditorInfo.IME_ACTION_NONE : EditorInfo.IME_ACTION_DONE; } else { - enterAction = inputActionFromTextInputAction(mConfiguration.getString("inputAction")); + enterAction = configuration.inputAction; } - if (!mConfiguration.isNull("actionLabel")) { - outAttrs.actionLabel = mConfiguration.getString("actionLabel"); + if (configuration.actionLabel != null) { + outAttrs.actionLabel = configuration.actionLabel; outAttrs.actionId = enterAction; } outAttrs.imeOptions |= enterAction; - InputConnectionAdaptor connection = - new InputConnectionAdaptor(view, mClient, mFlutterChannel, mEditable); + InputConnectionAdaptor connection = new InputConnectionAdaptor( + view, + mClient, + textInputChannel, + mEditable + ); outAttrs.initialSelStart = Selection.getSelectionStart(mEditable); outAttrs.initialSelEnd = Selection.getSelectionEnd(mEditable); @@ -175,9 +160,9 @@ private void hideTextInput(FlutterView view) { mImm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0); } - private void setTextInputClient(FlutterView view, int client, JSONObject configuration) { + private void setTextInputClient(int client, TextInputChannel.Configuration configuration) { mClient = client; - mConfiguration = configuration; + this.configuration = configuration; mEditable = Editable.Factory.getInstance().newEditable(""); // setTextInputClient will be followed by a call to setTextInputEditingState. @@ -185,9 +170,9 @@ private void setTextInputClient(FlutterView view, int client, JSONObject configu mRestartInputPending = true; } - private void applyStateToSelection(JSONObject state) throws JSONException { - int selStart = state.getInt("selectionBase"); - int selEnd = state.getInt("selectionExtent"); + private void applyStateToSelection(TextInputChannel.TextEditState state) { + int selStart = state.selectionStart; + int selEnd = state.selectionEnd; if (selStart >= 0 && selStart <= mEditable.length() && selEnd >= 0 && selEnd <= mEditable.length()) { Selection.setSelection(mEditable, selStart, selEnd); @@ -196,15 +181,15 @@ private void applyStateToSelection(JSONObject state) throws JSONException { } } - private void setTextInputEditingState(FlutterView view, JSONObject state) throws JSONException { - if (!mRestartInputPending && state.getString("text").equals(mEditable.toString())) { + private void setTextInputEditingState(FlutterView view, TextInputChannel.TextEditState state) { + if (!mRestartInputPending && state.text.equals(mEditable.toString())) { applyStateToSelection(state); mImm.updateSelection(mView, Math.max(Selection.getSelectionStart(mEditable), 0), Math.max(Selection.getSelectionEnd(mEditable), 0), BaseInputConnection.getComposingSpanStart(mEditable), BaseInputConnection.getComposingSpanEnd(mEditable)); } else { - mEditable.replace(0, mEditable.length(), state.getString("text")); + mEditable.replace(0, mEditable.length(), state.text); applyStateToSelection(state); mImm.restartInput(view); mRestartInputPending = false; diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java index b6f53d45741f1..e9d44001ef0f5 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java @@ -9,212 +9,159 @@ import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; -import android.content.pm.ActivityInfo; import android.os.Build; -import android.util.Log; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.view.HapticFeedbackConstants; import android.view.SoundEffectConstants; import android.view.View; import android.view.Window; + +import java.util.List; + +import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.plugin.common.ActivityLifecycleListener; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel.MethodCallHandler; -import io.flutter.plugin.common.MethodChannel.Result; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; /** * Android implementation of the platform plugin. */ -public class PlatformPlugin implements MethodCallHandler, ActivityLifecycleListener { - private final Activity mActivity; - private JSONObject mCurrentTheme; +public class PlatformPlugin implements ActivityLifecycleListener { public static final int DEFAULT_SYSTEM_UI = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; - private static final String kTextPlainFormat = "text/plain"; - public PlatformPlugin(Activity activity) { - mActivity = activity; - mEnabledOverlays = DEFAULT_SYSTEM_UI; - } + private final Activity activity; + private final PlatformChannel platformChannel; + private PlatformChannel.SystemChromeStyle currentTheme; + private int mEnabledOverlays; - @Override - public void onMethodCall(MethodCall call, Result result) { - String method = call.method; - Object arguments = call.arguments; - try { - if (method.equals("SystemSound.play")) { - playSystemSound((String) arguments); - result.success(null); - } else if (method.equals("HapticFeedback.vibrate")) { - vibrateHapticFeedback((String) arguments); - result.success(null); - } else if (method.equals("SystemChrome.setPreferredOrientations")) { - setSystemChromePreferredOrientations((JSONArray) arguments); - result.success(null); - } else if (method.equals("SystemChrome.setApplicationSwitcherDescription")) { - setSystemChromeApplicationSwitcherDescription((JSONObject) arguments); - result.success(null); - } else if (method.equals("SystemChrome.setEnabledSystemUIOverlays")) { - setSystemChromeEnabledSystemUIOverlays((JSONArray) arguments); - result.success(null); - } else if (method.equals("SystemChrome.restoreSystemUIOverlays")) { - restoreSystemChromeSystemUIOverlays(); - result.success(null); - } else if (method.equals("SystemChrome.setSystemUIOverlayStyle")) { - setSystemChromeSystemUIOverlayStyle((JSONObject) arguments); - result.success(null); - } else if (method.equals("SystemNavigator.pop")) { - popSystemNavigator(); - result.success(null); - } else if (method.equals("Clipboard.getData")) { - result.success(getClipboardData((String) arguments)); - } else if (method.equals("Clipboard.setData")) { - setClipboardData((JSONObject) arguments); - result.success(null); - } else { - result.notImplemented(); - } - } catch (JSONException e) { - result.error("error", "JSON error: " + e.getMessage(), null); + private final PlatformChannel.PlatformMessageHandler mPlatformMessageHandler = new PlatformChannel.PlatformMessageHandler() { + @Override + public void playSystemSound(@NonNull PlatformChannel.SoundType soundType) { + PlatformPlugin.this.playSystemSound(soundType); } - } - private void playSystemSound(String soundType) { - if (soundType.equals("SystemSoundType.click")) { - View view = mActivity.getWindow().getDecorView(); - view.playSoundEffect(SoundEffectConstants.CLICK); + @Override + public void vibrateHapticFeedback(@NonNull PlatformChannel.HapticFeedbackType feedbackType) { + PlatformPlugin.this.vibrateHapticFeedback(feedbackType); + } + + @Override + public void setPreferredOrientations(int androidOrientation) { + setSystemChromePreferredOrientations(androidOrientation); + } + + @Override + public void setApplicationSwitcherDescription(@NonNull PlatformChannel.AppSwitcherDescription description) { + setSystemChromeApplicationSwitcherDescription(description); + } + + @Override + public void showSystemOverlays(@NonNull List overlays) { + setSystemChromeEnabledSystemUIOverlays(overlays); + } + + @Override + public void restoreSystemUiOverlays() { + restoreSystemChromeSystemUIOverlays(); + } + + @Override + public void setSystemUiOverlayStyle(@NonNull PlatformChannel.SystemChromeStyle systemUiOverlayStyle) { + setSystemChromeSystemUIOverlayStyle(systemUiOverlayStyle); + } + + @Override + public void popSystemNavigator() { + PlatformPlugin.this.popSystemNavigator(); } - } - private void vibrateHapticFeedback(String feedbackType) { - View view = mActivity.getWindow().getDecorView(); - if (feedbackType == null) { - view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); - } else if (feedbackType.equals("HapticFeedbackType.lightImpact")) { - view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); - } else if (feedbackType.equals("HapticFeedbackType.mediumImpact")) { - view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); - } else if (feedbackType.equals("HapticFeedbackType.heavyImpact")) { - // HapticFeedbackConstants.CONTEXT_CLICK from API level 23. - view.performHapticFeedback(6); - } else if (feedbackType.equals("HapticFeedbackType.selectionClick")) { - view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK); + @Override + public CharSequence getClipboardData(@Nullable PlatformChannel.ClipboardContentFormat format) { + return PlatformPlugin.this.getClipboardData(format); } + + @Override + public void setClipboardData(@NonNull String text) { + PlatformPlugin.this.setClipboardData(text); + } + }; + + public PlatformPlugin(Activity activity, PlatformChannel platformChannel) { + this.activity = activity; + this.platformChannel = platformChannel; + this.platformChannel.setPlatformMessageHandler(mPlatformMessageHandler); + + mEnabledOverlays = DEFAULT_SYSTEM_UI; } - private void setSystemChromePreferredOrientations(JSONArray orientations) throws JSONException { - int requestedOrientation = 0x00; - int firstRequestedOrientation = 0x00; - for (int index = 0; index < orientations.length(); index += 1) { - if (orientations.getString(index).equals("DeviceOrientation.portraitUp")) { - requestedOrientation |= 0x01; - } else if (orientations.getString(index).equals("DeviceOrientation.landscapeLeft")) { - requestedOrientation |= 0x02; - } else if (orientations.getString(index).equals("DeviceOrientation.portraitDown")) { - requestedOrientation |= 0x04; - } else if (orientations.getString(index).equals("DeviceOrientation.landscapeRight")) { - requestedOrientation |= 0x08; - } - if (firstRequestedOrientation == 0x00) { - firstRequestedOrientation = requestedOrientation; - } + private void playSystemSound(PlatformChannel.SoundType soundType) { + if (soundType == PlatformChannel.SoundType.CLICK) { + View view = activity.getWindow().getDecorView(); + view.playSoundEffect(SoundEffectConstants.CLICK); } - switch (requestedOrientation) { - case 0x00: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); - break; - case 0x01: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - break; - case 0x02: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); - break; - case 0x04: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); - break; - case 0x05: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT); + } + + private void vibrateHapticFeedback(PlatformChannel.HapticFeedbackType feedbackType) { + View view = activity.getWindow().getDecorView(); + switch (feedbackType) { + case STANDARD: + view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); break; - case 0x08: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); + case LIGHT_IMPACT: + view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); break; - case 0x0a: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE); + case MEDIUM_IMPACT: + view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); break; - case 0x0b: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER); + case HEAVY_IMPACT: + // HapticFeedbackConstants.CONTEXT_CLICK from API level 23. + view.performHapticFeedback(6); break; - case 0x0f: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER); + case SELECTION_CLICK: + view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK); break; - case 0x03: // portraitUp and landscapeLeft - case 0x06: // portraitDown and landscapeLeft - case 0x07: // portraitUp, portraitDown, and landscapeLeft - case 0x09: // portraitUp and landscapeRight - case 0x0c: // portraitDown and landscapeRight - case 0x0d: // portraitUp, portraitDown, and landscapeRight - case 0x0e: // portraitDown, landscapeLeft, and landscapeRight - // Android can't describe these cases, so just default to whatever the first - // specified value was. - switch (firstRequestedOrientation) { - case 0x01: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - break; - case 0x02: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); - break; - case 0x04: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); - break; - case 0x08: - mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); - break; - } - break; - } + } + } + + private void setSystemChromePreferredOrientations(int androidOrientation) { + activity.setRequestedOrientation(androidOrientation); } - private void setSystemChromeApplicationSwitcherDescription(JSONObject description) throws JSONException { + private void setSystemChromeApplicationSwitcherDescription(PlatformChannel.AppSwitcherDescription description) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return; } - int color = description.getInt("primaryColor"); - if (color != 0) { // 0 means color isn't set, use system default - color = color | 0xFF000000; // color must be opaque if set - } - - String label = description.getString("label"); - @SuppressWarnings("deprecation") TaskDescription taskDescription = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) - ? new TaskDescription(label, 0, color) - : new TaskDescription(label, null, color); + ? new TaskDescription(description.label, 0, description.color) + : new TaskDescription(description.label, null, description.color); - mActivity.setTaskDescription(taskDescription); + activity.setTaskDescription(taskDescription); } - private int mEnabledOverlays; - - private void setSystemChromeEnabledSystemUIOverlays(JSONArray overlays) throws JSONException { + private void setSystemChromeEnabledSystemUIOverlays(List overlaysToShow) { + // Start by assuming we want to hide all system overlays (like an immersive game). int enabledOverlays = DEFAULT_SYSTEM_UI | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; - if (overlays.length() == 0) { + if (overlaysToShow.size() == 0) { enabledOverlays |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; } - for (int i = 0; i < overlays.length(); ++i) { - String overlay = overlays.getString(i); - if (overlay.equals("SystemUiOverlay.top")) { - enabledOverlays &= ~View.SYSTEM_UI_FLAG_FULLSCREEN; - } else if (overlay.equals("SystemUiOverlay.bottom")) { - enabledOverlays &= ~View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; - enabledOverlays &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; + // Re-add any desired system overlays. + for (int i = 0; i < overlaysToShow.size(); ++i) { + PlatformChannel.SystemUiOverlay overlayToShow = overlaysToShow.get(i); + switch (overlayToShow) { + case TOP_OVERLAYS: + enabledOverlays &= ~View.SYSTEM_UI_FLAG_FULLSCREEN; + break; + case BOTTOM_OVERLAYS: + enabledOverlays &= ~View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; + enabledOverlays &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; + break; } } @@ -223,9 +170,9 @@ private void setSystemChromeEnabledSystemUIOverlays(JSONArray overlays) throws J } private void updateSystemUiOverlays(){ - mActivity.getWindow().getDecorView().setSystemUiVisibility(mEnabledOverlays); - if (mCurrentTheme != null) { - setSystemChromeSystemUIOverlayStyle(mCurrentTheme); + activity.getWindow().getDecorView().setSystemUiVisibility(mEnabledOverlays); + if (currentTheme != null) { + setSystemChromeSystemUIOverlayStyle(currentTheme); } } @@ -233,83 +180,75 @@ private void restoreSystemChromeSystemUIOverlays() { updateSystemUiOverlays(); } - private void setSystemChromeSystemUIOverlayStyle(JSONObject message) { - Window window = mActivity.getWindow(); + private void setSystemChromeSystemUIOverlayStyle(PlatformChannel.SystemChromeStyle systemChromeStyle) { + Window window = activity.getWindow(); View view = window.getDecorView(); int flags = view.getSystemUiVisibility(); - try { - // You can change the navigation bar color (including translucent colors) - // in Android, but you can't change the color of the navigation buttons until Android O. - // LIGHT vs DARK effectively isn't supported until then. - // Build.VERSION_CODES.O - if (Build.VERSION.SDK_INT >= 26) { - if (!message.isNull("systemNavigationBarIconBrightness")) { - String systemNavigationBarIconBrightness = message.getString("systemNavigationBarIconBrightness"); - switch (systemNavigationBarIconBrightness) { - case "Brightness.dark": - //View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR - flags |= 0x10; - break; - case "Brightness.light": - flags &= ~0x10; - break; - } - } - if (!message.isNull("systemNavigationBarColor")) { - window.setNavigationBarColor(message.getInt("systemNavigationBarColor")); + // You can change the navigation bar color (including translucent colors) + // in Android, but you can't change the color of the navigation buttons until Android O. + // LIGHT vs DARK effectively isn't supported until then. + // Build.VERSION_CODES.O + if (Build.VERSION.SDK_INT >= 26) { + if (systemChromeStyle.systemNavigationBarIconBrightness != null) { + switch (systemChromeStyle.systemNavigationBarIconBrightness) { + case DARK: + //View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR + flags |= 0x10; + break; + case LIGHT: + flags &= ~0x10; + break; } } - // Build.VERSION_CODES.M - if (Build.VERSION.SDK_INT >= 23) { - if (!message.isNull("statusBarIconBrightness")) { - String statusBarIconBrightness = message.getString("statusBarIconBrightness"); - switch (statusBarIconBrightness) { - case "Brightness.dark": - // View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR - flags |= 0x2000; - break; - case "Brightness.light": - flags &= ~0x2000; - break; - } - } - if (!message.isNull("statusBarColor")) { - window.setStatusBarColor(message.getInt("statusBarColor")); + if (systemChromeStyle.systemNavigationBarColor != null) { + window.setNavigationBarColor(systemChromeStyle.systemNavigationBarColor); + } + } + // Build.VERSION_CODES.M + if (Build.VERSION.SDK_INT >= 23) { + if (systemChromeStyle.statusBarIconBrightness != null) { + switch (systemChromeStyle.statusBarIconBrightness) { + case DARK: + // View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR + flags |= 0x2000; + break; + case LIGHT: + flags &= ~0x2000; + break; } } - if (!message.isNull("systemNavigationBarDividerColor")) { - // Not availible until Android P. - // window.setNavigationBarDividerColor(systemNavigationBarDividerColor); + if (systemChromeStyle.statusBarColor != null) { + window.setStatusBarColor(systemChromeStyle.statusBarColor); } - view.setSystemUiVisibility(flags); - mCurrentTheme = message; - } catch (JSONException err) { - Log.i("PlatformPlugin", err.toString()); } + if (systemChromeStyle.systemNavigationBarDividerColor != null) { + // Not availible until Android P. + // window.setNavigationBarDividerColor(systemNavigationBarDividerColor); + } + view.setSystemUiVisibility(flags); + currentTheme = systemChromeStyle; } private void popSystemNavigator() { - mActivity.finish(); + activity.finish(); } - private JSONObject getClipboardData(String format) throws JSONException { - ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE); + private CharSequence getClipboardData(PlatformChannel.ClipboardContentFormat format) { + ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = clipboard.getPrimaryClip(); if (clip == null) return null; - if (format == null || format.equals(kTextPlainFormat)) { - JSONObject result = new JSONObject(); - result.put("text", clip.getItemAt(0).coerceToText(mActivity)); - return result; + if (format == null || format == PlatformChannel.ClipboardContentFormat.PLAIN_TEXT) { + return clip.getItemAt(0).coerceToText(activity); } return null; } - private void setClipboardData(JSONObject data) throws JSONException { - ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE); - ClipData clip = ClipData.newPlainText("text label?", data.getString("text")); + private void setClipboardData(String text) { + ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE); + ClipData clip = ClipData.newPlainText("text label?", text); clipboard.setPrimaryClip(clip); } diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index d8c2de3749195..ac5e2f8f3d995 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -9,20 +9,21 @@ import android.opengl.Matrix; import android.os.Build; import android.os.Bundle; +import android.support.annotation.NonNull; import android.util.Log; import android.view.View; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeProvider; -import io.flutter.plugin.common.BasicMessageChannel; -import io.flutter.plugin.common.StandardMessageCodec; + +import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; import io.flutter.util.Predicate; import java.nio.ByteBuffer; import java.util.*; class AccessibilityBridge - extends AccessibilityNodeProvider implements BasicMessageChannel.MessageHandler { + extends AccessibilityNodeProvider { private static final String TAG = "FlutterView"; // Constants from higher API levels. @@ -34,19 +35,42 @@ class AccessibilityBridge private static final float SCROLL_POSITION_CAP_FOR_INFINITY = 70000.0f; private static final int ROOT_NODE_ID = 0; - private Map mObjects; - private Map mCustomAccessibilityActions; - private final FlutterView mOwner; - private boolean mAccessibilityEnabled = false; - private SemanticsObject mA11yFocusedObject; - private SemanticsObject mInputFocusedObject; - private SemanticsObject mHoveredObject; + private final FlutterView owner; + private final AccessibilityChannel accessibilityChannel; + private final View decorView; + private Map objects; + private Map customAccessibilityActions; + private boolean accessibilityEnabled = false; + private SemanticsObject a11yFocusedObject; + private SemanticsObject inputFocusedObject; + private SemanticsObject hoveredObject; private int previousRouteId = ROOT_NODE_ID; private List previousRoutes; - private final View mDecorView; - private Integer mLastLeftFrameInset = 0; + private Integer lastLeftFrameInset = 0; + + private final AccessibilityChannel.AccessibilityMessageHandler accessibilityMessageHandler = new AccessibilityChannel.AccessibilityMessageHandler() { + @Override + public void announce(@NonNull String message) { + owner.announceForAccessibility(message); + } + + @Override + public void onTap(int nodeId) { + sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_CLICKED); + } - private final BasicMessageChannel mFlutterAccessibilityChannel; + @Override + public void onLongPress(int nodeId) { + sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); + } + + @Override + public void onTooltip(@NonNull String message) { + AccessibilityEvent e = obtainAccessibilityEvent(ROOT_NODE_ID, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); + e.getText().add(message); + sendAccessibilityEvent(e); + } + }; enum Action { TAP(1 << 0), @@ -106,23 +130,21 @@ enum Flag { final int value; } - AccessibilityBridge(FlutterView owner) { - assert owner != null; - mOwner = owner; - mObjects = new HashMap<>(); - mCustomAccessibilityActions = new HashMap<>(); + AccessibilityBridge(@NonNull FlutterView owner, @NonNull AccessibilityChannel accessibilityChannel) { + this.owner = owner; + this.accessibilityChannel = accessibilityChannel; + decorView = ((Activity) owner.getContext()).getWindow().getDecorView(); + objects = new HashMap<>(); + customAccessibilityActions = new HashMap<>(); previousRoutes = new ArrayList<>(); - mFlutterAccessibilityChannel = new BasicMessageChannel<>( - owner, "flutter/accessibility", StandardMessageCodec.INSTANCE); - mDecorView = ((Activity) owner.getContext()).getWindow().getDecorView(); } void setAccessibilityEnabled(boolean accessibilityEnabled) { - mAccessibilityEnabled = accessibilityEnabled; + this.accessibilityEnabled = accessibilityEnabled; if (accessibilityEnabled) { - mFlutterAccessibilityChannel.setMessageHandler(this); + this.accessibilityChannel.setAccessibilityMessageHandler(accessibilityMessageHandler); } else { - mFlutterAccessibilityChannel.setMessageHandler(null); + this.accessibilityChannel.setAccessibilityMessageHandler(null); } } @@ -137,42 +159,42 @@ private boolean shouldSetCollectionInfo(final SemanticsObject object) { // to set it if we're exiting a list to a non-list, so that we can get the "out of list" // announcement when A11y focus moves out of a list and not into another list. return object.scrollChildren > 0 - && (hasSemanticsObjectAncestor(mA11yFocusedObject, o -> o == object) - || !hasSemanticsObjectAncestor(mA11yFocusedObject, o -> o.hasFlag(Flag.HAS_IMPLICIT_SCROLLING))); + && (hasSemanticsObjectAncestor(a11yFocusedObject, o -> o == object) + || !hasSemanticsObjectAncestor(a11yFocusedObject, o -> o.hasFlag(Flag.HAS_IMPLICIT_SCROLLING))); } @Override @SuppressWarnings("deprecation") public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (virtualViewId == View.NO_ID) { - AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(mOwner); - mOwner.onInitializeAccessibilityNodeInfo(result); - if (mObjects.containsKey(ROOT_NODE_ID)) { - result.addChild(mOwner, ROOT_NODE_ID); + AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(owner); + owner.onInitializeAccessibilityNodeInfo(result); + if (objects.containsKey(ROOT_NODE_ID)) { + result.addChild(owner, ROOT_NODE_ID); } return result; } - SemanticsObject object = mObjects.get(virtualViewId); + SemanticsObject object = objects.get(virtualViewId); if (object == null) { return null; } - AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(mOwner, virtualViewId); + AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(owner, virtualViewId); // Work around for https://github.com/flutter/flutter/issues/2101 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { result.setViewIdResourceName(""); } - result.setPackageName(mOwner.getContext().getPackageName()); + result.setPackageName(owner.getContext().getPackageName()); result.setClassName("android.view.View"); - result.setSource(mOwner, virtualViewId); + result.setSource(owner, virtualViewId); result.setFocusable(object.isFocusable()); - if (mInputFocusedObject != null) { - result.setFocused(mInputFocusedObject.id == virtualViewId); + if (inputFocusedObject != null) { + result.setFocused(inputFocusedObject.id == virtualViewId); } - if (mA11yFocusedObject != null) { - result.setAccessibilityFocused(mA11yFocusedObject.id == virtualViewId); + if (a11yFocusedObject != null) { + result.setAccessibilityFocused(a11yFocusedObject.id == virtualViewId); } if (object.hasFlag(Flag.IS_TEXT_FIELD)) { @@ -186,7 +208,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { // 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) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 && a11yFocusedObject != null && a11yFocusedObject.id == virtualViewId) { result.setLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); } } @@ -239,10 +261,10 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (object.parent != null) { assert object.id > ROOT_NODE_ID; - result.setParent(mOwner, object.parent.id); + result.setParent(owner, object.parent.id); } else { assert object.id == ROOT_NODE_ID; - result.setParent(mOwner); + result.setParent(owner); } Rect bounds = object.getGlobalRect(); @@ -362,7 +384,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { result.setSelected(object.hasFlag(Flag.IS_SELECTED)); // Accessibility Focus - if (mA11yFocusedObject != null && mA11yFocusedObject.id == virtualViewId) { + if (a11yFocusedObject != null && a11yFocusedObject.id == virtualViewId) { result.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } else { result.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); @@ -381,7 +403,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (object.childrenInTraversalOrder != null) { for (SemanticsObject child : object.childrenInTraversalOrder) { if (!child.hasFlag(Flag.IS_HIDDEN)) { - result.addChild(mOwner, child.id); + result.addChild(owner, child.id); } } } @@ -391,7 +413,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { @Override public boolean performAction(int virtualViewId, int action, Bundle arguments) { - SemanticsObject object = mObjects.get(virtualViewId); + SemanticsObject object = objects.get(virtualViewId); if (object == null) { return false; } @@ -400,27 +422,27 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { // Note: TalkBack prior to Oreo doesn't use this handler and instead simulates a // click event at the center of the SemanticsNode. Other a11y services might go // through this handler though. - mOwner.dispatchSemanticsAction(virtualViewId, Action.TAP); + owner.dispatchSemanticsAction(virtualViewId, Action.TAP); return true; } case AccessibilityNodeInfo.ACTION_LONG_CLICK: { // Note: TalkBack doesn't use this handler and instead simulates a long click event // at the center of the SemanticsNode. Other a11y services might go through this // handler though. - mOwner.dispatchSemanticsAction(virtualViewId, Action.LONG_PRESS); + owner.dispatchSemanticsAction(virtualViewId, Action.LONG_PRESS); return true; } case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: { if (object.hasAction(Action.SCROLL_UP)) { - mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_UP); + owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_UP); } else if (object.hasAction(Action.SCROLL_LEFT)) { // TODO(ianh): bidi support using textDirection - mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_LEFT); + owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_LEFT); } else if (object.hasAction(Action.INCREASE)) { object.value = object.increasedValue; // Event causes Android to read out the updated value. sendAccessibilityEvent(virtualViewId, AccessibilityEvent.TYPE_VIEW_SELECTED); - mOwner.dispatchSemanticsAction(virtualViewId, Action.INCREASE); + owner.dispatchSemanticsAction(virtualViewId, Action.INCREASE); } else { return false; } @@ -428,15 +450,15 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { } case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: { if (object.hasAction(Action.SCROLL_DOWN)) { - mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_DOWN); + owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_DOWN); } else if (object.hasAction(Action.SCROLL_RIGHT)) { // TODO(ianh): bidi support using textDirection - mOwner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_RIGHT); + owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_RIGHT); } else if (object.hasAction(Action.DECREASE)) { object.value = object.decreasedValue; // Event causes Android to read out the updated value. sendAccessibilityEvent(virtualViewId, AccessibilityEvent.TYPE_VIEW_SELECTED); - mOwner.dispatchSemanticsAction(virtualViewId, Action.DECREASE); + owner.dispatchSemanticsAction(virtualViewId, Action.DECREASE); } else { return false; } @@ -449,24 +471,24 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { return performCursorMoveAction(object, virtualViewId, arguments, true); } case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.DID_LOSE_ACCESSIBILITY_FOCUS); + owner.dispatchSemanticsAction(virtualViewId, Action.DID_LOSE_ACCESSIBILITY_FOCUS); sendAccessibilityEvent( virtualViewId, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - mA11yFocusedObject = null; + a11yFocusedObject = null; return true; } case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.DID_GAIN_ACCESSIBILITY_FOCUS); + owner.dispatchSemanticsAction(virtualViewId, Action.DID_GAIN_ACCESSIBILITY_FOCUS); sendAccessibilityEvent( virtualViewId, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED); - if (mA11yFocusedObject == null) { + if (a11yFocusedObject == null) { // When Android focuses a node, it doesn't invalidate the view. // (It does when it sends ACTION_CLEAR_ACCESSIBILITY_FOCUS, so // we only have to worry about this when the focused node is null.) - mOwner.invalidate(); + owner.invalidate(); } - mA11yFocusedObject = object; + a11yFocusedObject = object; if (object.hasAction(Action.INCREASE) || object.hasAction(Action.DECREASE)) { // SeekBars only announce themselves after this event. @@ -476,7 +498,7 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { return true; } case ACTION_SHOW_ON_SCREEN: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.SHOW_ON_SCREEN); + owner.dispatchSemanticsAction(virtualViewId, Action.SHOW_ON_SCREEN); return true; } case AccessibilityNodeInfo.ACTION_SET_SELECTION: { @@ -498,32 +520,32 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { selection.put("base", object.textSelectionExtent); selection.put("extent", object.textSelectionExtent); } - mOwner.dispatchSemanticsAction(virtualViewId, Action.SET_SELECTION, selection); + owner.dispatchSemanticsAction(virtualViewId, Action.SET_SELECTION, selection); return true; } case AccessibilityNodeInfo.ACTION_COPY: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.COPY); + owner.dispatchSemanticsAction(virtualViewId, Action.COPY); return true; } case AccessibilityNodeInfo.ACTION_CUT: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.CUT); + owner.dispatchSemanticsAction(virtualViewId, Action.CUT); return true; } case AccessibilityNodeInfo.ACTION_PASTE: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.PASTE); + owner.dispatchSemanticsAction(virtualViewId, Action.PASTE); return true; } case AccessibilityNodeInfo.ACTION_DISMISS: { - mOwner.dispatchSemanticsAction(virtualViewId, Action.DISMISS); + owner.dispatchSemanticsAction(virtualViewId, Action.DISMISS); return true; } default: // might be a custom accessibility action. final int flutterId = action - firstResourceId; CustomAccessibilityAction contextAction = - mCustomAccessibilityActions.get(flutterId); + customAccessibilityActions.get(flutterId); if (contextAction != null) { - mOwner.dispatchSemanticsAction( + owner.dispatchSemanticsAction( virtualViewId, Action.CUSTOM_ACTION, contextAction.id); return true; } @@ -540,12 +562,12 @@ boolean performCursorMoveAction( switch (granularity) { case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER: { if (forward && object.hasAction(Action.MOVE_CURSOR_FORWARD_BY_CHARACTER)) { - mOwner.dispatchSemanticsAction(virtualViewId, + owner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_FORWARD_BY_CHARACTER, extendSelection); return true; } if (!forward && object.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER)) { - mOwner.dispatchSemanticsAction(virtualViewId, + owner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER, extendSelection); return true; } @@ -553,12 +575,12 @@ boolean performCursorMoveAction( } case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD: if (forward && object.hasAction(Action.MOVE_CURSOR_FORWARD_BY_WORD)) { - mOwner.dispatchSemanticsAction(virtualViewId, + owner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_FORWARD_BY_WORD, extendSelection); return true; } if (!forward && object.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_WORD)) { - mOwner.dispatchSemanticsAction(virtualViewId, + owner.dispatchSemanticsAction(virtualViewId, Action.MOVE_CURSOR_BACKWARD_BY_WORD, extendSelection); return true; } @@ -573,65 +595,65 @@ boolean performCursorMoveAction( public AccessibilityNodeInfo findFocus(int focus) { switch (focus) { case AccessibilityNodeInfo.FOCUS_INPUT: { - if (mInputFocusedObject != null) - return createAccessibilityNodeInfo(mInputFocusedObject.id); + if (inputFocusedObject != null) + return createAccessibilityNodeInfo(inputFocusedObject.id); } // Fall through to check FOCUS_ACCESSIBILITY case AccessibilityNodeInfo.FOCUS_ACCESSIBILITY: { - if (mA11yFocusedObject != null) - return createAccessibilityNodeInfo(mA11yFocusedObject.id); + if (a11yFocusedObject != null) + return createAccessibilityNodeInfo(a11yFocusedObject.id); } } return null; } private SemanticsObject getRootObject() { - assert mObjects.containsKey(0); - return mObjects.get(0); + assert objects.containsKey(0); + return objects.get(0); } private SemanticsObject getOrCreateObject(int id) { - SemanticsObject object = mObjects.get(id); + SemanticsObject object = objects.get(id); if (object == null) { object = new SemanticsObject(); object.id = id; - mObjects.put(id, object); + objects.put(id, object); } return object; } private CustomAccessibilityAction getOrCreateAction(int id) { - CustomAccessibilityAction action = mCustomAccessibilityActions.get(id); + CustomAccessibilityAction action = customAccessibilityActions.get(id); if (action == null) { action = new CustomAccessibilityAction(); action.id = id; action.resourceId = id + firstResourceId; - mCustomAccessibilityActions.put(id, action); + customAccessibilityActions.put(id, action); } return action; } void handleTouchExplorationExit() { - if (mHoveredObject != null) { - sendAccessibilityEvent(mHoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); - mHoveredObject = null; + if (hoveredObject != null) { + sendAccessibilityEvent(hoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); + hoveredObject = null; } } void handleTouchExploration(float x, float y) { - if (mObjects.isEmpty()) { + if (objects.isEmpty()) { return; } SemanticsObject newObject = getRootObject().hitTest(new float[] {x, y, 0, 1}); - if (newObject != mHoveredObject) { + if (newObject != hoveredObject) { // sending ENTER before EXIT is how Android wants it if (newObject != null) { sendAccessibilityEvent(newObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_ENTER); } - if (mHoveredObject != null) { - sendAccessibilityEvent(mHoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); + if (hoveredObject != null) { + sendAccessibilityEvent(hoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); } - mHoveredObject = newObject; + hoveredObject = newObject; } } @@ -657,7 +679,7 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { continue; } if (object.hasFlag(Flag.IS_FOCUSED)) { - mInputFocusedObject = object; + inputFocusedObject = object; } if (object.hadPreviousConfig) { updated.add(object); @@ -675,12 +697,12 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { // a11y nodes. if (Build.VERSION.SDK_INT >= 23) { Rect visibleFrame = new Rect(); - mDecorView.getWindowVisibleDisplayFrame(visibleFrame); - if (!mLastLeftFrameInset.equals(visibleFrame.left)) { + decorView.getWindowVisibleDisplayFrame(visibleFrame); + if (!lastLeftFrameInset.equals(visibleFrame.left)) { rootObject.globalGeometryDirty = true; rootObject.inverseTransformDirty = true; } - mLastLeftFrameInset = visibleFrame.left; + lastLeftFrameInset = visibleFrame.left; Matrix.translateM(identity, 0, visibleFrame.left, 0, 0); } rootObject.updateRecursively(identity, visitedObjects, false); @@ -707,7 +729,7 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { previousRoutes.add(semanticsObject.id); } - Iterator> it = mObjects.entrySet().iterator(); + Iterator> it = objects.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = it.next(); SemanticsObject object = entry.getValue(); @@ -787,25 +809,25 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } } else if (object.hasFlag(Flag.IS_TEXT_FIELD) && object.didChangeLabel() - && mInputFocusedObject != null && mInputFocusedObject.id == object.id) { + && inputFocusedObject != null && inputFocusedObject.id == object.id) { // Text fields should announce when their label changes while focused. We use a live // region tag to do so, and this event triggers that update. sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } - if (mA11yFocusedObject != null && mA11yFocusedObject.id == object.id + if (a11yFocusedObject != null && a11yFocusedObject.id == object.id && !object.hadFlag(Flag.IS_SELECTED) && object.hasFlag(Flag.IS_SELECTED)) { AccessibilityEvent event = obtainAccessibilityEvent(object.id, AccessibilityEvent.TYPE_VIEW_SELECTED); event.getText().add(object.label); sendAccessibilityEvent(event); } - if (mInputFocusedObject != null && mInputFocusedObject.id == object.id + if (inputFocusedObject != null && inputFocusedObject.id == object.id && 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))) { + && (a11yFocusedObject == null || (a11yFocusedObject.id == inputFocusedObject.id))) { String oldValue = object.previousValue != null ? object.previousValue : ""; String newValue = object.value != null ? object.value : ""; AccessibilityEvent event = createTextChangedEvent(object.id, oldValue, newValue); @@ -863,65 +885,27 @@ private AccessibilityEvent createTextChangedEvent(int id, String oldValue, Strin private AccessibilityEvent obtainAccessibilityEvent(int virtualViewId, int eventType) { assert virtualViewId != ROOT_NODE_ID; AccessibilityEvent event = AccessibilityEvent.obtain(eventType); - event.setPackageName(mOwner.getContext().getPackageName()); - event.setSource(mOwner, virtualViewId); + event.setPackageName(owner.getContext().getPackageName()); + event.setSource(owner, virtualViewId); return event; } private void sendAccessibilityEvent(int virtualViewId, int eventType) { - if (!mAccessibilityEnabled) { + if (!accessibilityEnabled) { return; } if (virtualViewId == ROOT_NODE_ID) { - mOwner.sendAccessibilityEvent(eventType); + owner.sendAccessibilityEvent(eventType); } else { sendAccessibilityEvent(obtainAccessibilityEvent(virtualViewId, eventType)); } } private void sendAccessibilityEvent(AccessibilityEvent event) { - if (!mAccessibilityEnabled) { + if (!accessibilityEnabled) { return; } - mOwner.getParent().requestSendAccessibilityEvent(mOwner, event); - } - - // Message Handler for [mFlutterAccessibilityChannel]. - public void onMessage(Object message, BasicMessageChannel.Reply reply) { - @SuppressWarnings("unchecked") - final HashMap annotatedEvent = (HashMap) message; - final String type = (String) annotatedEvent.get("type"); - @SuppressWarnings("unchecked") - final HashMap data = (HashMap) annotatedEvent.get("data"); - - switch (type) { - case "announce": - mOwner.announceForAccessibility((String) data.get("message")); - break; - case "longPress": { - Integer nodeId = (Integer) annotatedEvent.get("nodeId"); - if (nodeId == null) { - return; - } - sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); - break; - } - case "tap": { - Integer nodeId = (Integer) annotatedEvent.get("nodeId"); - if (nodeId == null) { - return; - } - sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_CLICKED); - break; - } - case "tooltip": { - AccessibilityEvent e = obtainAccessibilityEvent( - ROOT_NODE_ID, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); - e.getText().add((String) data.get("message")); - sendAccessibilityEvent(e); - break; - } - } + owner.getParent().requestSendAccessibilityEvent(owner, event); } private void createWindowChangeEvent(SemanticsObject route) { @@ -933,29 +917,29 @@ private void createWindowChangeEvent(SemanticsObject route) { } private void willRemoveSemanticsObject(SemanticsObject object) { - assert mObjects.containsKey(object.id); - assert mObjects.get(object.id) == object; + assert objects.containsKey(object.id); + assert objects.get(object.id) == object; object.parent = null; - if (mA11yFocusedObject == object) { - sendAccessibilityEvent(mA11yFocusedObject.id, + if (a11yFocusedObject == object) { + sendAccessibilityEvent(a11yFocusedObject.id, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - mA11yFocusedObject = null; + a11yFocusedObject = null; } - if (mInputFocusedObject == object) { - mInputFocusedObject = null; + if (inputFocusedObject == object) { + inputFocusedObject = null; } - if (mHoveredObject == object) { - mHoveredObject = null; + if (hoveredObject == object) { + hoveredObject = null; } } void reset() { - mObjects.clear(); - if (mA11yFocusedObject != null) - sendAccessibilityEvent(mA11yFocusedObject.id, + objects.clear(); + if (a11yFocusedObject != null) + sendAccessibilityEvent(a11yFocusedObject.id, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - mA11yFocusedObject = null; - mHoveredObject = null; + a11yFocusedObject = null; + hoveredObject = null; sendAccessibilityEvent(0, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } diff --git a/shell/platform/android/io/flutter/view/FlutterNativeView.java b/shell/platform/android/io/flutter/view/FlutterNativeView.java index 5988840ca7d3e..408449ee518a1 100644 --- a/shell/platform/android/io/flutter/view/FlutterNativeView.java +++ b/shell/platform/android/io/flutter/view/FlutterNativeView.java @@ -6,10 +6,12 @@ import android.app.Activity; import android.content.Context; +import android.support.annotation.NonNull; import android.util.Log; import io.flutter.app.FlutterPluginRegistry; import io.flutter.embedding.engine.FlutterJNI; import io.flutter.embedding.engine.FlutterEngine.EngineLifecycleListener; +import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.embedding.engine.renderer.FlutterRenderer.RenderSurface; import io.flutter.plugin.common.*; import java.nio.ByteBuffer; @@ -22,45 +24,49 @@ public class FlutterNativeView implements BinaryMessenger { private static final String TAG = "FlutterNativeView"; - private final Map mMessageHandlers; - private int mNextReplyId = 1; - private final Map mPendingReplies = new HashMap<>(); - private final FlutterPluginRegistry mPluginRegistry; + private final DartExecutor dartExecutor; private FlutterView mFlutterView; - private FlutterJNI mFlutterJNI; + private final FlutterJNI mFlutterJNI; private final Context mContext; private boolean applicationIsRunning; - public FlutterNativeView(Context context) { + public FlutterNativeView(@NonNull Context context) { this(context, false); } - public FlutterNativeView(Context context, boolean isBackgroundView) { + public FlutterNativeView(@NonNull Context context, boolean isBackgroundView) { mContext = context; mPluginRegistry = new FlutterPluginRegistry(this, context); mFlutterJNI = new FlutterJNI(); mFlutterJNI.setRenderSurface(new RenderSurfaceImpl()); - mFlutterJNI.setPlatformMessageHandler(new PlatformMessageHandlerImpl()); + this.dartExecutor = new DartExecutor(mFlutterJNI); mFlutterJNI.addEngineLifecycleListener(new EngineLifecycleListenerImpl()); attach(this, isBackgroundView); assertAttached(); - mMessageHandlers = new HashMap<>(); } public void detach() { mPluginRegistry.detach(); + dartExecutor.onDetachedFromJNI(); mFlutterView = null; mFlutterJNI.detachFromNativeButKeepNativeResources(); } public void destroy() { mPluginRegistry.destroy(); + dartExecutor.onDetachedFromJNI(); mFlutterView = null; mFlutterJNI.detachFromNativeAndReleaseResources(); applicationIsRunning = false; } + @NonNull + public DartExecutor getDartExecutor() { + return dartExecutor; + } + + @NonNull public FlutterPluginRegistry getPluginRegistry() { return mPluginRegistry; } @@ -133,7 +139,7 @@ public static String getObservatoryUri() { @Override public void send(String channel, ByteBuffer message) { - send(channel, message, null); + dartExecutor.send(channel, message); } @Override @@ -143,30 +149,12 @@ public void send(String channel, ByteBuffer message, BinaryReply callback) { return; } - int replyId = 0; - if (callback != null) { - replyId = mNextReplyId++; - mPendingReplies.put(replyId, callback); - } - if (message == null) { - mFlutterJNI.dispatchEmptyPlatformMessage(channel, replyId); - } else { - mFlutterJNI.dispatchPlatformMessage( - channel, - message, - message.position(), - replyId - ); - } + dartExecutor.send(channel, message, callback); } @Override public void setMessageHandler(String channel, BinaryMessageHandler handler) { - if (handler == null) { - mMessageHandlers.remove(channel); - } else { - mMessageHandlers.put(channel, handler); - } + dartExecutor.setMessageHandler(channel, handler); } /*package*/ FlutterJNI getFlutterJNI() { @@ -175,54 +163,7 @@ public void setMessageHandler(String channel, BinaryMessageHandler handler) { private void attach(FlutterNativeView view, boolean isBackgroundView) { mFlutterJNI.attachToNative(isBackgroundView); - } - - private final class PlatformMessageHandlerImpl implements PlatformMessageHandler { - // Called by native to send us a platform message. - public void handleMessageFromDart(final String channel, byte[] message, final int replyId) { - assertAttached(); - BinaryMessageHandler handler = mMessageHandlers.get(channel); - if (handler != null) { - try { - final ByteBuffer buffer = (message == null ? null : ByteBuffer.wrap(message)); - handler.onMessage(buffer, new BinaryReply() { - private final AtomicBoolean done = new AtomicBoolean(false); - @Override - public void reply(ByteBuffer reply) { - if (!isAttached()) { - Log.d(TAG, "handleMessageFromDart replying ot a detached view, channel=" + channel); - return; - } - if (done.getAndSet(true)) { - throw new IllegalStateException("Reply already submitted"); - } - if (reply == null) { - mFlutterJNI.invokePlatformMessageEmptyResponseCallback(replyId); - } else { - mFlutterJNI.invokePlatformMessageResponseCallback(replyId, reply, reply.position()); - } - } - }); - } catch (Exception exception) { - Log.e(TAG, "Uncaught exception in binary message listener", exception); - mFlutterJNI.invokePlatformMessageEmptyResponseCallback(replyId); - } - return; - } - mFlutterJNI.invokePlatformMessageEmptyResponseCallback(replyId); - } - - // Called by native to respond to a platform message that we sent. - public void handlePlatformMessageResponse(int replyId, byte[] reply) { - BinaryReply callback = mPendingReplies.remove(replyId); - if (callback != null) { - try { - callback.reply(reply == null ? null : ByteBuffer.wrap(reply)); - } catch (Exception ex) { - Log.e(TAG, "Uncaught exception in binary message reply handler", ex); - } - } - } + dartExecutor.onAttachedToJNI(); } private final class RenderSurfaceImpl implements RenderSurface { diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index c6927a3245711..e636506d2297a 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -15,6 +15,7 @@ import android.net.Uri; import android.os.Build; import android.os.Handler; +import android.os.LocaleList; import android.provider.Settings; import android.text.format.DateFormat; import android.util.AttributeSet; @@ -29,17 +30,18 @@ import io.flutter.embedding.engine.FlutterJNI; import io.flutter.embedding.engine.android.AndroidKeyProcessor; import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; import io.flutter.embedding.engine.systemchannels.KeyEventChannel; import io.flutter.embedding.engine.systemchannels.LifecycleChannel; +import io.flutter.embedding.engine.systemchannels.LocalizationChannel; import io.flutter.embedding.engine.systemchannels.NavigationChannel; +import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.embedding.engine.systemchannels.SettingsChannel; import io.flutter.embedding.engine.systemchannels.SystemChannel; import io.flutter.plugin.common.*; import io.flutter.plugin.editing.TextInputPlugin; import io.flutter.plugin.platform.PlatformPlugin; -import org.json.JSONException; -import java.lang.reflect.Method; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.*; @@ -87,18 +89,21 @@ static final class ViewportMetrics { } private final DartExecutor dartExecutor; + private final AccessibilityChannel accessibilityChannel; private final NavigationChannel navigationChannel; private final KeyEventChannel keyEventChannel; private final LifecycleChannel lifecycleChannel; + private final LocalizationChannel localizationChannel; + private final PlatformChannel platformChannel; private final SettingsChannel settingsChannel; private final SystemChannel systemChannel; private final InputMethodManager mImm; private final TextInputPlugin mTextInputPlugin; private final AndroidKeyProcessor androidKeyProcessor; + private AccessibilityBridge mAccessibilityNodeProvider; private final SurfaceHolder.Callback mSurfaceCallback; private final ViewportMetrics mMetrics; private final AccessibilityManager mAccessibilityManager; - private final MethodChannel mFlutterLocalizationChannel; private final List mActivityLifecycleListeners; private final List mFirstFrameListeners; private final AtomicLong nextTextureId = new AtomicLong(0L); @@ -124,7 +129,8 @@ public FlutterView(Context context, AttributeSet attrs, FlutterNativeView native } else { mNativeView = nativeView; } - dartExecutor = new DartExecutor(mNativeView.getFlutterJNI()); + + dartExecutor = mNativeView.getDartExecutor(); mIsSoftwareRenderingEnabled = FlutterJNI.nativeGetIsSoftwareRenderingEnabled(); mAnimationScaleObserver = new AnimationScaleObserver(new Handler()); mMetrics = new ViewportMetrics(); @@ -160,23 +166,25 @@ public void surfaceDestroyed(SurfaceHolder holder) { mActivityLifecycleListeners = new ArrayList<>(); mFirstFrameListeners = new ArrayList<>(); - // Configure the platform plugins and flutter channels. + // Create all platform channels + accessibilityChannel = new AccessibilityChannel(dartExecutor); navigationChannel = new NavigationChannel(dartExecutor); keyEventChannel = new KeyEventChannel(dartExecutor); lifecycleChannel = new LifecycleChannel(dartExecutor); + localizationChannel = new LocalizationChannel(dartExecutor); + platformChannel = new PlatformChannel(dartExecutor); systemChannel = new SystemChannel(dartExecutor); settingsChannel = new SettingsChannel(dartExecutor); - mFlutterLocalizationChannel = new MethodChannel(this, "flutter/localization", JSONMethodCodec.INSTANCE); - PlatformPlugin platformPlugin = new PlatformPlugin(activity); - MethodChannel flutterPlatformChannel = new MethodChannel(this, "flutter/platform", JSONMethodCodec.INSTANCE); - flutterPlatformChannel.setMethodCallHandler(platformPlugin); + // Create and setup plugins + PlatformPlugin platformPlugin = new PlatformPlugin(activity, platformChannel); addActivityLifecycleListener(platformPlugin); mImm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - mTextInputPlugin = new TextInputPlugin(this); + mTextInputPlugin = new TextInputPlugin(this, dartExecutor); androidKeyProcessor = new AndroidKeyProcessor(keyEventChannel); - setLocales(getResources().getConfiguration()); + // Send initial platform information to Dart + sendLocalesToDart(getResources().getConfiguration()); sendUserPlatformSettingsToDart(); } @@ -311,39 +319,21 @@ private void sendUserPlatformSettingsToDart() { .send(); } - 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. - } + private void sendLocalesToDart(Configuration config) { + LocaleList localeList = config.getLocales(); + int localeCount = localeList.size(); + List locales = new ArrayList<>(); + for (int index = 0; index < localeCount; ++index) { + Locale locale = localeList.get(index); + locales.add(locale); } - // Fallback single locale passing for android API < 24. Should work always. - @SuppressWarnings("deprecation") - 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())); + localizationChannel.sendLocales(locales); } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); - setLocales(newConfig); + sendLocalesToDart(newConfig); sendUserPlatformSettingsToDart(); } @@ -374,13 +364,7 @@ public void destroy() { @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { - try { - mLastInputConnection = mTextInputPlugin.createInputConnection(this, outAttrs); - return mLastInputConnection; - } catch (JSONException e) { - Log.e(TAG, "Failed to create input connection", e); - return null; - } + return mTextInputPlugin.createInputConnection(this, outAttrs); } // Must match the PointerChange enum in pointer.dart. @@ -1006,14 +990,12 @@ public AccessibilityNodeProvider getAccessibilityNodeProvider() { return null; } - private AccessibilityBridge mAccessibilityNodeProvider; - void ensureAccessibilityEnabled() { if (!isAttached()) return; mAccessibilityEnabled = true; if (mAccessibilityNodeProvider == null) { - mAccessibilityNodeProvider = new AccessibilityBridge(this); + mAccessibilityNodeProvider = new AccessibilityBridge(this, accessibilityChannel); } mNativeView.getFlutterJNI().setSemanticsEnabled(true); mAccessibilityNodeProvider.setAccessibilityEnabled(true); From e11d0e96fb16811e4c989ec39bb1965d7924655a Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 20 Feb 2019 17:06:33 -0800 Subject: [PATCH 0224/1117] Android embedding refactor pr5 add flutterengine impl (#7878) --- .../io/flutter/app/FlutterPluginRegistry.java | 8 ++ .../embedding/engine/FlutterEngine.java | 136 +++++++++++++++++- 2 files changed, 140 insertions(+), 4 deletions(-) diff --git a/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java b/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java index 02452620d9418..7710a6089830d 100644 --- a/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java +++ b/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java @@ -7,6 +7,8 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; + +import io.flutter.embedding.engine.FlutterEngine; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.common.PluginRegistry; import io.flutter.plugin.platform.PlatformViewRegistry; @@ -49,6 +51,12 @@ public FlutterPluginRegistry(FlutterNativeView nativeView, Context context) { mPlatformViewsController = new PlatformViewsController(); } + public FlutterPluginRegistry(FlutterEngine engine, Context context) { + // TODO(mattcarroll): implement use of engine instead of nativeView. + mAppContext = context; + mPlatformViewsController = new PlatformViewsController(); + } + @Override public boolean hasPlugin(String key) { return mPluginMap.containsKey(key); diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java b/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java index 4f98a8c73eb89..1986188c00990 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java @@ -4,6 +4,14 @@ package io.flutter.embedding.engine; +import android.content.Context; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; + +import io.flutter.app.FlutterPluginRegistry; +import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.embedding.engine.renderer.FlutterRenderer; + /** * A single Flutter execution environment. * @@ -19,16 +27,136 @@ * Android app. * * To start running Flutter within this {@code FlutterEngine}, get a reference to this engine's - * {@link DartExecutor} and then use {@link DartExecutor#runFromBundle(FlutterRunArguments)}. - * The {@link DartExecutor#runFromBundle(FlutterRunArguments)} method must not be invoked twice on the same - * {@code FlutterEngine}. + * {@link DartExecutor} and then use {@link DartExecutor#executeDartEntrypoint(DartExecutor.DartEntrypoint)}. + * The {@link DartExecutor#executeDartEntrypoint(DartExecutor.DartEntrypoint)} method must not be + * invoked twice on the same {@code FlutterEngine}. * * To start rendering Flutter content to the screen, use {@link #getRenderer()} to obtain a * {@link FlutterRenderer} and then attach a {@link FlutterRenderer.RenderSurface}. Consider using * a {@link io.flutter.embedding.android.FlutterView} as a {@link FlutterRenderer.RenderSurface}. */ public class FlutterEngine { - // TODO(mattcarroll): bring in FlutterEngine implementation in future PR + private static final String TAG = "FlutterEngine"; + + @NonNull + private final FlutterJNI flutterJNI; + @NonNull + private final FlutterRenderer renderer; + @NonNull + private final DartExecutor dartExecutor; + // TODO(mattcarroll): integrate system channels with FlutterEngine + @NonNull + private final FlutterPluginRegistry pluginRegistry; + + private final EngineLifecycleListener engineLifecycleListener = new EngineLifecycleListener() { + @SuppressWarnings("unused") + public void onPreEngineRestart() { + pluginRegistry.onPreEngineRestart(); + } + }; + + /** + * Constructs a new {@code FlutterEngine}. + * + * A new {@code FlutterEngine} does not execute any Dart code automatically. See + * {@link #getDartExecutor()} and {@link DartExecutor#executeDartEntrypoint(DartExecutor.DartEntrypoint)} + * to begin executing Dart code within this {@code FlutterEngine}. + * + * A new {@code FlutterEngine} will not display any UI until a + * {@link io.flutter.embedding.engine.renderer.FlutterRenderer.RenderSurface} is registered. See + * {@link #getRenderer()} and {@link FlutterRenderer#attachToRenderSurface(FlutterRenderer.RenderSurface)}. + * + * A new {@code FlutterEngine} does not come with any Flutter plugins attached. To attach plugins, + * see {@link #getPluginRegistry()}. + * + * A new {@code FlutterEngine} does come with all default system channels attached. + */ + public FlutterEngine(@NonNull Context context) { + this.flutterJNI = new FlutterJNI(); + flutterJNI.addEngineLifecycleListener(engineLifecycleListener); + attachToJni(); + + this.dartExecutor = new DartExecutor(flutterJNI); + this.dartExecutor.onAttachedToJNI(); + + // TODO(mattcarroll): FlutterRenderer is temporally coupled to attach(). Remove that coupling if possible. + this.renderer = new FlutterRenderer(flutterJNI); + + this.pluginRegistry = new FlutterPluginRegistry(this, context); + } + + private void attachToJni() { + // TODO(mattcarroll): update native call to not take in "isBackgroundView" + flutterJNI.attachToNative(false); + + if (!isAttachedToJni()) { + throw new RuntimeException("FlutterEngine failed to attach to its native Object reference."); + } + } + + @SuppressWarnings("BooleanMethodIsAlwaysInverted") + private boolean isAttachedToJni() { + return flutterJNI.isAttached(); + } + + /** + * Detaches this {@code FlutterEngine} from Flutter's native implementation, but allows + * reattachment later. + * + * // TODO(mattcarroll): document use-cases for this behavior. + */ + public void detachFromJni() { + pluginRegistry.detach(); + dartExecutor.onDetachedFromJNI(); + flutterJNI.removeEngineLifecycleListener(engineLifecycleListener); + // TODO(mattcarroll): investigate detach vs destroy. document user-cases. update code if needed. + flutterJNI.detachFromNativeButKeepNativeResources(); + } + + /** + * Cleans up all components within this {@code FlutterEngine} and then detaches from Flutter's + * native implementation. + * + * This {@code FlutterEngine} instance should be discarded after invoking this method. + */ + public void destroy() { + pluginRegistry.destroy(); + dartExecutor.onDetachedFromJNI(); + flutterJNI.removeEngineLifecycleListener(engineLifecycleListener); + flutterJNI.detachFromNativeAndReleaseResources(); + } + + /** + * The Dart execution context associated with this {@code FlutterEngine}. + * + * The {@link DartExecutor} can be used to start executing Dart code from a given entrypoint. + * See {@link DartExecutor#executeDartEntrypoint(DartExecutor.DartEntrypoint)}. + * + * Use the {@link DartExecutor} to connect any desired message channels and method channels + * to facilitate communication between Android and Dart/Flutter. + */ + @NonNull + public DartExecutor getDartExecutor() { + return dartExecutor; + } + + /** + * The rendering system associated with this {@code FlutterEngine}. + * + * To render a Flutter UI that is produced by this {@code FlutterEngine}'s Dart code, attach + * a {@link io.flutter.embedding.engine.renderer.FlutterRenderer.RenderSurface} to this + * {@link FlutterRenderer}. + */ + @NonNull + public FlutterRenderer getRenderer() { + return renderer; + } + + // TODO(mattcarroll): propose a robust story for plugin backward compability and future facing API. + @NonNull + public FlutterPluginRegistry getPluginRegistry() { + return pluginRegistry; + } /** * Lifecycle callbacks for Flutter engine lifecycle events. From 684c9394c0365d70ed97a66e342064e277122648 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 20 Feb 2019 17:23:14 -0800 Subject: [PATCH 0225/1117] Respect the custom GL proc table when creating the resource context on the IO thread. (#7893) Fixes https://github.com/flutter/flutter/issues/28229 --- ci/licenses_golden/licenses_flutter | 1 + shell/common/io_manager.cc | 5 +- shell/common/io_manager.h | 3 +- shell/gpu/BUILD.gn | 1 + shell/gpu/gpu_surface_gl.cc | 68 +----------- shell/gpu/gpu_surface_gl.h | 3 - shell/gpu/gpu_surface_gl_delegate.cc | 104 ++++++++++++++++++ shell/gpu/gpu_surface_gl_delegate.h | 9 ++ .../platform/android/platform_view_android.cc | 4 +- .../platform/darwin/ios/platform_view_ios.mm | 4 +- .../platform/embedder/embedder_surface_gl.cc | 8 +- 11 files changed, 134 insertions(+), 76 deletions(-) create mode 100644 shell/gpu/gpu_surface_gl_delegate.cc diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index d593c12f915ad..4b4db2bad596f 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -404,6 +404,7 @@ 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_gl_delegate.cc FILE: ../../../flutter/shell/gpu/gpu_surface_gl_delegate.h FILE: ../../../flutter/shell/gpu/gpu_surface_software.cc FILE: ../../../flutter/shell/gpu/gpu_surface_software.h diff --git a/shell/common/io_manager.cc b/shell/common/io_manager.cc index 996b14ed3d974..a0172e1084253 100644 --- a/shell/common/io_manager.cc +++ b/shell/common/io_manager.cc @@ -11,7 +11,8 @@ namespace shell { sk_sp IOManager::CreateCompatibleResourceLoadingContext( - GrBackend backend) { + GrBackend backend, + sk_sp gl_interface) { if (backend != GrBackend::kOpenGL_GrBackend) { return nullptr; } @@ -31,7 +32,7 @@ sk_sp IOManager::CreateCompatibleResourceLoadingContext( // ES2 shading language when the ES3 external image extension is missing. options.fPreferExternalImagesOverES3 = true; - if (auto context = GrContext::MakeGL(GrGLMakeNativeInterface(), options)) { + if (auto context = GrContext::MakeGL(gl_interface, options)) { // Do not cache textures created by the image decoder. These textures // should be deleted when they are no longer referenced by an SkImage. context->setResourceCacheLimits(0, 0); diff --git a/shell/common/io_manager.h b/shell/common/io_manager.h index 11934f999af88..a69c42abbc311 100644 --- a/shell/common/io_manager.h +++ b/shell/common/io_manager.h @@ -21,7 +21,8 @@ class IOManager : public blink::IOManager { // the IOManager. The platforms may create the context themselves if they so // desire. static sk_sp CreateCompatibleResourceLoadingContext( - GrBackend backend); + GrBackend backend, + sk_sp gl_interface); IOManager(sk_sp resource_context, fml::RefPtr unref_queue_task_runner); diff --git a/shell/gpu/BUILD.gn b/shell/gpu/BUILD.gn index 5e7bcddbfb1bf..02130c85e186c 100644 --- a/shell/gpu/BUILD.gn +++ b/shell/gpu/BUILD.gn @@ -28,6 +28,7 @@ source_set("gpu_surface_gl") { sources = [ "$gpu_dir/gpu_surface_gl.cc", "$gpu_dir/gpu_surface_gl.h", + "$gpu_dir/gpu_surface_gl_delegate.cc", "$gpu_dir/gpu_surface_gl_delegate.h", ] diff --git a/shell/gpu/gpu_surface_gl.cc b/shell/gpu/gpu_surface_gl.cc index 564a101432e58..b6248fda4c5f4 100644 --- a/shell/gpu/gpu_surface_gl.cc +++ b/shell/gpu/gpu_surface_gl.cc @@ -12,8 +12,6 @@ #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/gpu/GrBackendSurface.h" #include "third_party/skia/include/gpu/GrContextOptions.h" -#include "third_party/skia/include/gpu/gl/GrGLAssembleInterface.h" -#include "third_party/skia/include/gpu/gl/GrGLInterface.h" // These are common defines present on all OpenGL headers. However, we don't // want to perform GL header reasolution on each platform we support. So just @@ -22,7 +20,6 @@ #define GPU_GL_RGBA8 0x8058 #define GPU_GL_RGBA4 0x8056 #define GPU_GL_RGB565 0x8D62 -#define GPU_GL_VERSION 0x1F02 namespace shell { @@ -33,9 +30,6 @@ 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()) { @@ -44,8 +38,6 @@ GPUSurfaceGL::GPUSurfaceGL(GPUSurfaceGLDelegate* delegate) return; } - proc_resolver_ = delegate_->GetGLProcResolver(); - GrContextOptions options; options.fPersistentCache = PersistentCache::GetCacheForProcess(); @@ -60,26 +52,7 @@ GPUSurfaceGL::GPUSurfaceGL(GPUSurfaceGLDelegate* delegate) // 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); + auto context = GrContext::MakeGL(delegate_->GetGLInterface(), options); if (context == nullptr) { FML_LOG(ERROR) << "Failed to setup Skia Gr context."; @@ -105,8 +78,6 @@ GPUSurfaceGL::GPUSurfaceGL(sk_sp gr_context, return; } - proc_resolver_ = delegate_->GetGLProcResolver(); - delegate_->GLContextClearCurrent(); valid_ = true; @@ -133,20 +104,6 @@ GPUSurfaceGL::~GPUSurfaceGL() { 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_; @@ -372,27 +329,4 @@ 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 2be751297b7aa..d9f85acedd365 100644 --- a/shell/gpu/gpu_surface_gl.h +++ b/shell/gpu/gpu_surface_gl.h @@ -46,7 +46,6 @@ class GPUSurfaceGL : public Surface { private: GPUSurfaceGLDelegate* delegate_; - GPUSurfaceGLDelegate::GLProcResolver proc_resolver_; sk_sp context_; sk_sp onscreen_surface_; sk_sp offscreen_surface_; @@ -62,8 +61,6 @@ class GPUSurfaceGL : public Surface { bool PresentSurface(SkCanvas* canvas); - bool IsProcResolverOpenGLES(); - FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceGL); }; diff --git a/shell/gpu/gpu_surface_gl_delegate.cc b/shell/gpu/gpu_surface_gl_delegate.cc new file mode 100644 index 0000000000000..f60a8770b3938 --- /dev/null +++ b/shell/gpu/gpu_surface_gl_delegate.cc @@ -0,0 +1,104 @@ +// Copyright 2013 The Flutter 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/gpu/gpu_surface_gl_delegate.h" + +#include "third_party/skia/include/gpu/gl/GrGLAssembleInterface.h" + +namespace shell { + +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; +} + +static bool IsProcResolverOpenGLES( + GPUSurfaceGLDelegate::GLProcResolver proc_resolver) { + // Version string prefix that identifies an OpenGL ES implementation. +#define GPU_GL_VERSION 0x1F02 + constexpr char kGLESVersionPrefix[] = "OpenGL ES"; + + 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; +} + +static sk_sp CreateGLInterface( + GPUSurfaceGLDelegate::GLProcResolver proc_resolver) { + if (proc_resolver == nullptr) { + // If there is no custom proc resolver, ask Skia to guess the native + // interface. This often leads to interesting results on most platforms. + return GrGLMakeNativeInterface(); + } + + struct ProcResolverContext { + GPUSurfaceGLDelegate::GLProcResolver resolver; + }; + + ProcResolverContext context = { + .resolver = proc_resolver, + }; + + GrGLGetProc gl_get_proc = [](void* context, + const char gl_proc_name[]) -> GrGLFuncPtr { + auto proc_resolver_context = + reinterpret_cast(context); + return reinterpret_cast( + proc_resolver_context->resolver(gl_proc_name)); + }; + + // glGetString indicates an OpenGL ES interface. + if (IsProcResolverOpenGLES(proc_resolver)) { + return GrGLMakeAssembledGLESInterface(&context, gl_get_proc); + } + + // Fallback to OpenGL. + if (auto interface = GrGLMakeAssembledGLInterface(&context, gl_get_proc)) { + return interface; + } + + FML_LOG(ERROR) << "Could not create a valid GL interface."; + return nullptr; +} + +sk_sp GPUSurfaceGLDelegate::GetGLInterface() const { + return CreateGLInterface(GetGLProcResolver()); +} + +sk_sp +GPUSurfaceGLDelegate::GetDefaultPlatformGLInterface() { + return CreateGLInterface(nullptr); +} + +} // namespace shell diff --git a/shell/gpu/gpu_surface_gl_delegate.h b/shell/gpu/gpu_surface_gl_delegate.h index 36e7d2912c4a1..b290ae63e5950 100644 --- a/shell/gpu/gpu_surface_gl_delegate.h +++ b/shell/gpu/gpu_surface_gl_delegate.h @@ -8,6 +8,7 @@ #include "flutter/flow/embedded_views.h" #include "flutter/fml/macros.h" #include "third_party/skia/include/core/SkMatrix.h" +#include "third_party/skia/include/gpu/gl/GrGLInterface.h" namespace shell { @@ -45,6 +46,14 @@ class GPUSurfaceGLDelegate { // thread that the renderer is operating on. virtual flow::ExternalViewEmbedder* GetExternalViewEmbedder(); + sk_sp GetGLInterface() const; + + // TODO(chinmaygarde): The presence of this method is to work around the fact + // that not all platforms can accept a custom GL proc table. Migrate all + // platforms to move GL proc resolution to the embedder and remove this + // method. + static sk_sp GetDefaultPlatformGLInterface(); + using GLProcResolver = std::function; // Provide a custom GL proc resolver. If no such resolver is present, Skia diff --git a/shell/platform/android/platform_view_android.cc b/shell/platform/android/platform_view_android.cc index 034c059695014..a66e306c1ef82 100644 --- a/shell/platform/android/platform_view_android.cc +++ b/shell/platform/android/platform_view_android.cc @@ -9,6 +9,7 @@ #include "flutter/fml/synchronization/waitable_event.h" #include "flutter/shell/common/io_manager.h" +#include "flutter/shell/gpu/gpu_surface_gl_delegate.h" #include "flutter/shell/platform/android/android_external_texture_gl.h" #include "flutter/shell/platform/android/android_surface_gl.h" #include "flutter/shell/platform/android/platform_message_response_android.h" @@ -379,7 +380,8 @@ sk_sp PlatformViewAndroid::CreateResourceContext() const { // the OpenGL surface will be able to make a resource context current. If // this changes, this assumption breaks. Handle the same. resource_context = IOManager::CreateCompatibleResourceLoadingContext( - GrBackend::kOpenGL_GrBackend); + GrBackend::kOpenGL_GrBackend, + GPUSurfaceGLDelegate::GetDefaultPlatformGLInterface()); } else { FML_DLOG(ERROR) << "Could not make the resource context current."; } diff --git a/shell/platform/darwin/ios/platform_view_ios.mm b/shell/platform/darwin/ios/platform_view_ios.mm index f3371a9834a53..4bcb08d21afe6 100644 --- a/shell/platform/darwin/ios/platform_view_ios.mm +++ b/shell/platform/darwin/ios/platform_view_ios.mm @@ -12,6 +12,7 @@ #include "flutter/fml/synchronization/waitable_event.h" #include "flutter/fml/trace_event.h" #include "flutter/shell/common/io_manager.h" +#include "flutter/shell/gpu/gpu_surface_gl_delegate.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" @@ -82,7 +83,8 @@ return nullptr; } - return IOManager::CreateCompatibleResourceLoadingContext(GrBackend::kOpenGL_GrBackend); + return IOManager::CreateCompatibleResourceLoadingContext( + GrBackend::kOpenGL_GrBackend, GPUSurfaceGLDelegate::GetDefaultPlatformGLInterface()); } // |shell::PlatformView| diff --git a/shell/platform/embedder/embedder_surface_gl.cc b/shell/platform/embedder/embedder_surface_gl.cc index 8abb87fd3d896..487111d698423 100644 --- a/shell/platform/embedder/embedder_surface_gl.cc +++ b/shell/platform/embedder/embedder_surface_gl.cc @@ -81,11 +81,17 @@ sk_sp EmbedderSurfaceGL::CreateResourceContext() const { auto callback = gl_dispatch_table_.gl_make_resource_current_callback; if (callback && callback()) { if (auto context = IOManager::CreateCompatibleResourceLoadingContext( - GrBackend::kOpenGL_GrBackend)) { + GrBackend::kOpenGL_GrBackend, GetGLInterface())) { return context; + } else { + FML_LOG(ERROR) + << "Internal error: Resource context available but could not create " + "a compatible Skia context."; + return nullptr; } } + // The callback was not available or failed. FML_LOG(ERROR) << "Could not create a resource context for async texture uploads. " "Expect degraded performance. Set a valid make_resource_current " From ce7016e1f3d2f3fe5da8bbf904f53dcecfa4866d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 20 Feb 2019 21:28:33 -0500 Subject: [PATCH 0226/1117] Roll src/third_party/skia e471c05f92e8..20ebd0cb3882 (4 commits) (#7894) https://skia.googlesource.com/skia.git/%2Blog/e471c05f92e8..20ebd0cb3882 git log e471c05f92e86c8f8a460f55c775ca245924519e..20ebd0cb3882d1bdeed04eaa983b0e5842f0fdaf --date=short --no-merges --format=%ad %ae %s 2019-02-20 reed@google.com remove SK_SUPPORT_LEGACY_TEXTBLOBCACHEDIFFCANVAS_CONSTRUCTOR code 2019-02-20 fmalita@chromium.org [skottie] Tint effect support 2019-02-20 michaelludwig@google.com Support decal mode in GrTextureProducer 2019-02-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src bf1a36e53e69..dca111a7573e (503 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- sky/packages/sky_engine/LICENSE | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index ac8c2768e83cf..b625d365e35b9 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': 'e471c05f92e86c8f8a460f55c775ca245924519e', + 'skia_revision': '20ebd0cb3882d1bdeed04eaa983b0e5842f0fdaf', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index eedb84c3c709f..55284786527cf 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b14d48e409320424ded40cdb1731a9a2 +Signature: 80158806ee7715512b12aa7651039efe UNUSED LICENSES: diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index edab381ceabd6..fa9e5fc59f635 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -2808,6 +2808,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- boringssl +engine etc1 observatory_pub_packages skia From abe9826a9d328731ae96bc913591cd10f2e53883 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 20 Feb 2019 18:59:29 -0800 Subject: [PATCH 0227/1117] Add accessibility semantics support to embedder (#7891) Flutter's accessibility APIs consist of three main calls from the embedder to the Dart application: 1. FlutterEngineUpdateSemanticsEnabled: enables/disables semantics support. 2. FlutterEngineUpdateAccessibilityFeatures: sets embedder-specific accessibility features. 3. FlutterEngineDispatchSemanticsAction: dispatches an action (tap, long-press, scroll, etc.) to a semantics node. and two main callbacks triggered by Dart code: 1. FlutterUpdateSemanticsNodeCallback: notifies the embedder of updates to the properties of a given semantics node. 2. FlutterUpdateSemanticsCustomActionCallback: notifies the embedder of updates to custom semantics actions registered in Dart code. In the Flutter framework, when accessibility is first enabled, the embedder will receive a stream of update callbacks notifying the embedder of the full semantics tree. On further changes in the Dart application, only updates will be sent. --- BUILD.gn | 1 + ci/licenses_golden/licenses_flutter | 1 + lib/ui/semantics.dart | 6 + lib/ui/window.dart | 3 + shell/platform/embedder/BUILD.gn | 28 ++ shell/platform/embedder/embedder.cc | 113 ++++++++ shell/platform/embedder/embedder.h | 261 ++++++++++++++++++ shell/platform/embedder/embedder_engine.cc | 45 +++ shell/platform/embedder/embedder_engine.h | 9 + .../platform/embedder/fixtures/a11y_main.dart | 112 ++++++++ .../embedder/platform_view_embedder.cc | 13 + .../embedder/platform_view_embedder.h | 12 + .../embedder/tests/embedder_a11y_unittests.cc | 205 ++++++++++++++ 13 files changed, 809 insertions(+) create mode 100644 shell/platform/embedder/fixtures/a11y_main.dart create mode 100644 shell/platform/embedder/tests/embedder_a11y_unittests.cc diff --git a/BUILD.gn b/BUILD.gn index cc9b9dff1eb69..55f78f7853708 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -57,6 +57,7 @@ group("flutter") { "$flutter_root/runtime:runtime_unittests", "$flutter_root/shell/common:shell_unittests", "$flutter_root/shell/platform/embedder:embedder_unittests", + "$flutter_root/shell/platform/embedder:embedder_a11y_unittests", # TODO(cbracken) build these into a different kernel blob in the embedder tests and load that in a test in embedder_unittests "$flutter_root/synchronization:synchronization_unittests", "$flutter_root/third_party/txt:txt_unittests", ] diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 4b4db2bad596f..89ccd037e8107 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -619,6 +619,7 @@ 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/a11y_main.dart 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 diff --git a/lib/ui/semantics.dart b/lib/ui/semantics.dart index 750f7f0175b79..5d54eabf67957 100644 --- a/lib/ui/semantics.dart +++ b/lib/ui/semantics.dart @@ -6,6 +6,9 @@ part of dart.ui; /// The possible actions that can be conveyed from the operating system /// accessibility APIs to a semantics node. +// +// When changes are made to this class, the equivalent APIs in each of the +// embedders *must* be updated. class SemanticsAction { const SemanticsAction._(this.index); @@ -260,6 +263,9 @@ class SemanticsAction { } /// A Boolean value that can be associated with a semantics node. +// +// When changes are made to this class, the equivalent APIs in each of the +// embedders *must* be updated. class SemanticsFlag { static const int _kHasCheckedStateIndex = 1 << 0; static const int _kIsCheckedIndex = 1 << 1; diff --git a/lib/ui/window.dart b/lib/ui/window.dart index c33ed641e875c..56b346c3305d2 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -883,6 +883,9 @@ class Window { /// It is not possible to enable these settings from Flutter, instead they are /// used by the platform to indicate that additional accessibility features are /// enabled. +// +// When changes are made to this class, the equivalent APIs in each of the +// embedders *must* be updated. class AccessibilityFeatures { const AccessibilityFeatures._(this._index); diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index 0d4aedb0ddecd..2faf89eef0437 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -80,6 +80,34 @@ executable("embedder_unittests") { } } +test_fixtures("fixtures_a11y") { + fixtures = [ "fixtures/a11y_main.dart" ] +} + +executable("embedder_a11y_unittests") { + testonly = true + + include_dirs = [ "." ] + + sources = [ + "tests/embedder_a11y_unittests.cc", + ] + + deps = [ + ":embedder", + ":fixtures_a11y", + "$flutter_root/lib/ui:ui", + "$flutter_root/shell/common", + "$flutter_root/testing", + "//third_party/skia", + "//third_party/tonic", + ] + + if (is_linux) { + ldflags = [ "-rdynamic" ] + } +} + shared_library("flutter_engine_library") { visibility = [ ":*" ] diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index d134847ed62f2..f0f90c1256f2e 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -383,6 +383,74 @@ FlutterEngineResult FlutterEngineRun(size_t version, thread_host.io_thread->GetTaskRunner() // io ); + shell::PlatformViewEmbedder::UpdateSemanticsNodesCallback + update_semantics_nodes_callback = nullptr; + if (SAFE_ACCESS(args, update_semantics_node_callback, nullptr) != nullptr) { + update_semantics_nodes_callback = + [ptr = args->update_semantics_node_callback, + user_data](blink::SemanticsNodeUpdates update) { + for (const auto& value : update) { + const auto& node = value.second; + const auto& transform = node.transform; + auto flutter_transform = FlutterTransformation{ + transform.get(0, 0), transform.get(0, 1), transform.get(0, 2), + transform.get(1, 0), transform.get(1, 1), transform.get(1, 2), + transform.get(2, 0), transform.get(2, 1), transform.get(2, 2)}; + const FlutterSemanticsNode embedder_node = { + sizeof(FlutterSemanticsNode), + node.id, + static_cast(node.flags), + static_cast(node.actions), + node.textSelectionBase, + node.textSelectionExtent, + node.scrollChildren, + node.scrollIndex, + node.scrollPosition, + node.scrollExtentMax, + node.scrollExtentMin, + node.elevation, + node.thickness, + node.label.c_str(), + node.hint.c_str(), + node.value.c_str(), + node.increasedValue.c_str(), + node.decreasedValue.c_str(), + static_cast(node.textDirection), + FlutterRect{node.rect.fLeft, node.rect.fTop, node.rect.fRight, + node.rect.fBottom}, + flutter_transform, + node.childrenInTraversalOrder.size(), + &node.childrenInTraversalOrder[0], + &node.childrenInHitTestOrder[0], + node.customAccessibilityActions.size(), + &node.customAccessibilityActions[0], + }; + ptr(&embedder_node, user_data); + } + }; + } + + shell::PlatformViewEmbedder::UpdateSemanticsCustomActionsCallback + update_semantics_custom_actions_callback = nullptr; + if (SAFE_ACCESS(args, update_semantics_custom_action_callback, nullptr) != + nullptr) { + update_semantics_custom_actions_callback = + [ptr = args->update_semantics_custom_action_callback, + user_data](blink::CustomAccessibilityActionUpdates actions) { + for (const auto& value : actions) { + const auto& action = value.second; + const FlutterSemanticsCustomAction embedder_action = { + sizeof(FlutterSemanticsCustomAction), + action.id, + static_cast(action.overrideId), + action.label.c_str(), + action.hint.c_str(), + }; + ptr(&embedder_action, user_data); + } + }; + } + shell::PlatformViewEmbedder::PlatformMessageResponseCallback platform_message_response_callback = nullptr; if (SAFE_ACCESS(args, platform_message_callback, nullptr) != nullptr) { @@ -403,6 +471,7 @@ FlutterEngineResult FlutterEngineRun(size_t version, } shell::PlatformViewEmbedder::PlatformDispatchTable platform_dispatch_table = { + update_semantics_nodes_callback, update_semantics_custom_actions_callback, platform_message_response_callback, // platform_message_response_callback }; @@ -688,3 +757,47 @@ FlutterEngineResult FlutterEngineMarkExternalTextureFrameAvailable( } return kSuccess; } + +FlutterEngineResult FlutterEngineUpdateSemanticsEnabled(FlutterEngine engine, + bool enabled) { + if (engine == nullptr) { + return kInvalidArguments; + } + if (!reinterpret_cast(engine)->SetSemanticsEnabled( + enabled)) { + return kInternalInconsistency; + } + return kSuccess; +} + +FlutterEngineResult FlutterEngineUpdateAccessibilityFeatures( + FlutterEngine engine, + FlutterAccessibilityFeature flags) { + if (engine == nullptr) { + return kInvalidArguments; + } + if (!reinterpret_cast(engine) + ->SetAccessibilityFeatures(flags)) { + return kInternalInconsistency; + } + return kSuccess; +} + +FlutterEngineResult FlutterEngineDispatchSemanticsAction( + FlutterEngine engine, + uint64_t id, + FlutterSemanticsAction action, + const uint8_t* data, + size_t data_length) { + if (engine == nullptr) { + return kInvalidArguments; + } + auto engine_action = static_cast(action); + if (!reinterpret_cast(engine) + ->DispatchSemanticsAction( + id, engine_action, + std::vector({data, data + data_length}))) { + return kInternalInconsistency; + } + return kSuccess; +} diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 010bfbe336bc2..15c5e4922cf8f 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -31,6 +31,127 @@ typedef enum { kSoftware, } FlutterRendererType; +// Additional accessibility features that may be enabled by the platform. +// +// Must match the |AccessibilityFeatures| enum in window.dart. +typedef enum { + // Indicate there is a running accessibility service which is changing the + // interaction model of the device. + kFlutterAccessibilityFeatureAccessibleNavigation = 1 << 0, + // Indicate the platform is inverting the colors of the application. + kFlutterAccessibilityFeatureInvertColors = 1 << 1, + // Request that animations be disabled or simplified. + kFlutterAccessibilityFeatureDisableAnimations = 1 << 2, + // Request that text be rendered at a bold font weight. + kFlutterAccessibilityFeatureBoldText = 1 << 3, + // Request that certain animations be simplified and parallax effects + // removed. + kFlutterAccessibilityFeatureReduceMotion = 1 << 4, +} FlutterAccessibilityFeature; + +// The set of possible actions that can be conveyed to a semantics node. +// +// Must match the |SemanticsAction| enum in semantics.dart. +typedef enum { + // The equivalent of a user briefly tapping the screen with the finger without + // moving it. + kFlutterSemanticsActionTap = 1 << 0, + // The equivalent of a user pressing and holding the screen with the finger + // for a few seconds without moving it. + kFlutterSemanticsActionLongPress = 1 << 1, + // The equivalent of a user moving their finger across the screen from right + // to left. + kFlutterSemanticsActionScrollLeft = 1 << 2, + // The equivalent of a user moving their finger across the screen from left to + // right. + kFlutterSemanticsActionScrollRight = 1 << 3, + // The equivalent of a user moving their finger across the screen from bottom + // to top. + kFlutterSemanticsActionScrollUp = 1 << 4, + // The equivalent of a user moving their finger across the screen from top to + // bottom. + kFlutterSemanticsActionScrollDown = 1 << 5, + // Increase the value represented by the semantics node. + kFlutterSemanticsActionIncrease = 1 << 6, + // Decrease the value represented by the semantics node. + kFlutterSemanticsActionDecrease = 1 << 7, + // A request to fully show the semantics node on screen. + kFlutterSemanticsActionShowOnScreen = 1 << 8, + // Move the cursor forward by one character. + kFlutterSemanticsActionMoveCursorForwardByCharacter = 1 << 9, + // Move the cursor backward by one character. + kFlutterSemanticsActionMoveCursorBackwardByCharacter = 1 << 10, + // Set the text selection to the given range. + kFlutterSemanticsActionSetSelection = 1 << 11, + // Copy the current selection to the clipboard. + kFlutterSemanticsActionCopy = 1 << 12, + // Cut the current selection and place it in the clipboard. + kFlutterSemanticsActionCut = 1 << 13, + // Paste the current content of the clipboard. + kFlutterSemanticsActionPaste = 1 << 14, + // Indicate that the node has gained accessibility focus. + kFlutterSemanticsActionDidGainAccessibilityFocus = 1 << 15, + // Indicate that the node has lost accessibility focus. + kFlutterSemanticsActionDidLoseAccessibilityFocus = 1 << 16, + // Indicate that the user has invoked a custom accessibility action. + kFlutterSemanticsActionCustomAction = 1 << 17, + // A request that the node should be dismissed. + kFlutterSemanticsActionDismiss = 1 << 18, +} FlutterSemanticsAction; + +// The set of properties that may be associated with a semantics node. +// +// Must match the |SemanticsFlag| enum in semantics.dart. +typedef enum { + // The semantics node has the quality of either being "checked" or + // "unchecked". + kFlutterSemanticsFlagHasCheckedState = 1 << 0, + // Whether a semantics node is checked. + kFlutterSemanticsFlagIsChecked = 1 << 1, + // Whether a semantics node is selected. + kFlutterSemanticsFlagIsSelected = 1 << 2, + // Whether the semantic node represents a button. + kFlutterSemanticsFlagIsButton = 1 << 3, + // Whether the semantic node represents a text field. + kFlutterSemanticsFlagIsTextField = 1 << 4, + // Whether the semantic node currently holds the user's focus. + kFlutterSemanticsFlagIsFocused = 1 << 5, + // The semantics node has the quality of either being "enabled" or "disabled". + kFlutterSemanticsFlagHasEnabledState = 1 << 6, + // Whether a semantic node that hasEnabledState is currently enabled. + kFlutterSemanticsFlagIsEnabled = 1 << 7, + // Whether a semantic node is in a mutually exclusive group. + kFlutterSemanticsFlagIsInMutuallyExclusiveGroup = 1 << 8, + // Whether a semantic node is a header that divides content into sections. + kFlutterSemanticsFlagIsHeader = 1 << 9, + // Whether the value of the semantics node is obscured. + kFlutterSemanticsFlagIsObscured = 1 << 10, + // Whether the semantics node is the root of a subtree for which a route name + // should be announced. + kFlutterSemanticsFlagScopesRoute = 1 << 11, + // Whether the semantics node label is the name of a visually distinct route. + kFlutterSemanticsFlagNamesRoute = 1 << 12, + // Whether the semantics node is considered hidden. + kFlutterSemanticsFlagIsHidden = 1 << 13, + // Whether the semantics node represents an image. + kFlutterSemanticsFlagIsImage = 1 << 14, + // Whether the semantics node is a live region. + kFlutterSemanticsFlagIsLiveRegion = 1 << 15, + // The semantics node has the quality of either being "on" or "off". + kFlutterSemanticsFlagHasToggledState = 1 << 16, + // If true, the semantics node is "on". If false, the semantics node is "off". + kFlutterSemanticsFlagIsToggled = 1 << 17, +} FlutterSemanticsFlag; + +typedef enum { + // Text has unknown text direction. + kFlutterTextDirectionUnknown = 0, + // Text is read from right to left. + kFlutterTextDirectionRTL = 1, + // Text is read from left to right. + kFlutterTextDirectionLTR = 2, +} FlutterTextDirection; + typedef struct _FlutterEngine* FlutterEngine; typedef struct { @@ -190,6 +311,111 @@ typedef void (*FlutterPlatformMessageCallback)( const FlutterPlatformMessage* /* message*/, void* /* user data */); +typedef struct { + double left; + double top; + double right; + double bottom; +} FlutterRect; + +// A node that represents some semantic data. +// +// The semantics tree is maintained during the semantics phase of the pipeline +// (i.e., during PipelineOwner.flushSemantics), which happens after +// compositing. Updates are then pushed to embedders via the registered +// |FlutterUpdateSemanticsNodeCallback|. +typedef struct { + // The size of this struct. Must be sizeof(FlutterSemanticsNode). + size_t struct_size; + // The unique identifier for this node. + int32_t id; + // The set of semantics flags associated with this node. + FlutterSemanticsFlag flags; + // The set of semantics actions applicable to this node. + FlutterSemanticsAction actions; + // The position at which the text selection originates. + int32_t textSelectionBase; + // The position at which the text selection terminates. + int32_t textSelectionExtent; + // The total number of scrollable children that contribute to semantics. + int32_t scrollChildren; + // The index of the first visible semantic child of a scroll node. + int32_t scrollIndex; + // The current scrolling position in logical pixels if the node is scrollable. + double scrollPosition; + // The maximum in-range value for |scrollPosition| if the node is scrollable. + double scrollExtentMax; + // The minimum in-range value for |scrollPosition| if the node is scrollable. + double scrollExtentMin; + // The elevation along the z-axis at which the rect of this semantics node is + // located above its parent. + double elevation; + // Describes how much space the semantics node takes up along the z-axis. + double thickness; + // A textual description of the node. + const char* label; + // A brief description of the result of performing an action on the node. + const char* hint; + // A textual description of the current value of the node. + const char* value; + // A value that |value| will have after a kFlutterSemanticsActionIncrease| + // action has been performed. + const char* increasedValue; + // A value that |value| will have after a kFlutterSemanticsActionDecrease| + // action has been performed. + const char* decreasedValue; + // The reading direction for |label|, |value|, |hint|, |increasedValue|, and + // |decreasedValue|. + FlutterTextDirection textDirection; + // The bounding box for this node in its coordinate system. + FlutterRect rect; + // The transform from this node's coordinate system to its parent's coordinate + // system. + FlutterTransformation transform; + // The number of children this node has. + size_t child_count; + // Array of child node IDs in traversal order. Has length |child_count|. + const int32_t* children_in_traversal_order; + // Array of child node IDs in hit test order. Has length |child_count|. + const int32_t* children_in_hit_test_order; + // The number of custom accessibility action associated with this node. + size_t custom_accessibility_actions_count; + // Array of |FlutterSemanticsCustomAction| IDs associated with this node. + // Has length |custom_accessibility_actions_count|. + const int32_t* custom_accessibility_actions; +} FlutterSemanticsNode; + +// A custom semantics action, or action override. +// +// Custom actions can be registered by applications in order to provide +// semantic actions other than the standard actions available through the +// |FlutterSemanticsAction| enum. +// +// Action overrides are custom actions that the application developer requests +// to be used in place of the standard actions in the |FlutterSemanticsAction| +// enum. +typedef struct { + // The size of the struct. Must be sizeof(FlutterSemanticsCustomAction). + size_t struct_size; + // The unique custom action or action override ID. + int32_t id; + // For overriden standard actions, corresponds to the + // |FlutterSemanticsAction| to override. + FlutterSemanticsAction override_action; + // The user-readable name of this custom semantics action. + const char* label; + // The hint description of this custom semantics action. + const char* hint; +} FlutterSemanticsCustomAction; + +typedef void (*FlutterUpdateSemanticsNodeCallback)( + const FlutterSemanticsNode* /* semantics node */, + void* /* user data */); + +typedef void (*FlutterUpdateSemanticsCustomActionCallback)( + const FlutterSemanticsCustomAction* /* semantics custom action */, + void* /* user data */); + typedef struct { // The size of this struct. Must be sizeof(FlutterProjectArgs). size_t struct_size; @@ -268,6 +494,17 @@ typedef struct { // The callback invoked by the engine in root isolate scope. Called // immediately after the root isolate has been created and marked runnable. VoidCallback root_isolate_create_callback; + // The callback invoked by the engine in order to give the embedder the + // chance to respond to semantics node updates from the Dart application. The + // callback will be invoked on the thread on which the |FlutterEngineRun| + // call is made. + FlutterUpdateSemanticsNodeCallback update_semantics_node_callback; + // The callback invoked by the engine in order to give the embedder the + // chance to respond to updates to semantics custom actions from the Dart + // application. The callback will be invoked on the thread on which the + // |FlutterEngineRun| call is made. + FlutterUpdateSemanticsCustomActionCallback + update_semantics_custom_action_callback; } FlutterProjectArgs; FLUTTER_EXPORT @@ -331,6 +568,30 @@ FlutterEngineResult FlutterEngineMarkExternalTextureFrameAvailable( FlutterEngine engine, int64_t texture_identifier); +// Enable or disable accessibility semantics. +// +// When enabled, changes to the semantic contents of the window are sent via +// the |FlutterUpdateSemanticsNodeCallback| registered to +// |update_semantics_node_callback| in |FlutterProjectArgs|; +FLUTTER_EXPORT +FlutterEngineResult FlutterEngineUpdateSemanticsEnabled(FlutterEngine engine, + bool enabled); + +// Sets additional accessibility features. +FLUTTER_EXPORT +FlutterEngineResult FlutterEngineUpdateAccessibilityFeatures( + FlutterEngine engine, + FlutterAccessibilityFeature features); + +// Dispatch a semantics action to the specified semantics node. +FLUTTER_EXPORT +FlutterEngineResult FlutterEngineDispatchSemanticsAction( + FlutterEngine engine, + uint64_t id, + FlutterSemanticsAction action, + const uint8_t* data, + size_t data_length); + #if defined(__cplusplus) } // extern "C" #endif diff --git a/shell/platform/embedder/embedder_engine.cc b/shell/platform/embedder/embedder_engine.cc index 168de1b83b49c..0f21275879afd 100644 --- a/shell/platform/embedder/embedder_engine.cc +++ b/shell/platform/embedder/embedder_engine.cc @@ -146,4 +146,49 @@ bool EmbedderEngine::MarkTextureFrameAvailable(int64_t texture) { return true; } +bool EmbedderEngine::SetSemanticsEnabled(bool enabled) { + if (!IsValid()) { + return false; + } + shell_->GetTaskRunners().GetUITaskRunner()->PostTask( + [engine = shell_->GetEngine(), enabled] { + if (engine) { + engine->SetSemanticsEnabled(enabled); + } + }); + return true; +} + +bool EmbedderEngine::SetAccessibilityFeatures(int32_t flags) { + if (!IsValid()) { + return false; + } + shell_->GetTaskRunners().GetUITaskRunner()->PostTask( + [engine = shell_->GetEngine(), flags] { + if (engine) { + engine->SetAccessibilityFeatures(flags); + } + }); + return true; +} + +bool EmbedderEngine::DispatchSemanticsAction(int id, + blink::SemanticsAction action, + std::vector args) { + if (!IsValid()) { + return false; + } + shell_->GetTaskRunners().GetUITaskRunner()->PostTask( + fml::MakeCopyable([engine = shell_->GetEngine(), // engine + id, // id + action, // action + args = std::move(args) // args + ]() mutable { + if (engine) { + engine->DispatchSemanticsAction(id, action, std::move(args)); + } + })); + return true; +} + } // namespace shell diff --git a/shell/platform/embedder/embedder_engine.h b/shell/platform/embedder/embedder_engine.h index 204776554679d..f5c4399011545 100644 --- a/shell/platform/embedder/embedder_engine.h +++ b/shell/platform/embedder/embedder_engine.h @@ -11,6 +11,7 @@ #include "flutter/shell/common/shell.h" #include "flutter/shell/common/thread_host.h" #include "flutter/shell/platform/embedder/embedder.h" +#include "flutter/shell/platform/embedder/embedder_engine.h" #include "flutter/shell/platform/embedder/embedder_external_texture_gl.h" namespace shell { @@ -50,6 +51,14 @@ class EmbedderEngine { bool MarkTextureFrameAvailable(int64_t texture); + bool SetSemanticsEnabled(bool enabled); + + bool SetAccessibilityFeatures(int32_t flags); + + bool DispatchSemanticsAction(int id, + blink::SemanticsAction action, + std::vector args); + private: const ThreadHost thread_host_; std::unique_ptr shell_; diff --git a/shell/platform/embedder/fixtures/a11y_main.dart b/shell/platform/embedder/fixtures/a11y_main.dart new file mode 100644 index 0000000000000..a0315f56a4f60 --- /dev/null +++ b/shell/platform/embedder/fixtures/a11y_main.dart @@ -0,0 +1,112 @@ +import 'dart:async'; +import 'dart:typed_data'; +import 'dart:ui'; + +Float64List kIdentityTransform = () { + final Float64List values = Float64List(16); + values[0] = 1.0; + values[5] = 1.0; + values[10] = 1.0; + values[15] = 1.0; + return values; +}(); + +void signalNativeTest() native 'SignalNativeTest'; +void notifySemanticsEnabled(bool enabled) native 'NotifyTestData1'; +void notifyAccessibilityFeatures(bool reduceMotion) native 'NotifyTestData1'; +void notifySemanticsAction(int nodeId, int action, List data) native 'NotifyTestData3'; + +/// Returns a future that completes when `window.onSemanticsEnabledChanged` +/// fires. +Future get semanticsChanged { + final Completer semanticsChanged = Completer(); + window.onSemanticsEnabledChanged = semanticsChanged.complete; + return semanticsChanged.future; +} + +/// Returns a future that completes when `window.onAccessibilityFeaturesChanged` +/// fires. +Future get accessibilityFeaturesChanged { + final Completer featuresChanged = Completer(); + window.onAccessibilityFeaturesChanged = featuresChanged.complete; + return featuresChanged.future; +} + +class SemanticsActionData { + const SemanticsActionData(this.id, this.action, this.args); + final int id; + final SemanticsAction action; + final ByteData args; +} + +Future get semanticsAction { + final Completer actionReceived = Completer(); + window.onSemanticsAction = (int id, SemanticsAction action, ByteData args) { + actionReceived.complete(SemanticsActionData(id, action, args)); + }; + return actionReceived.future; +} + +main() async { + // Return initial state (semantics disabled). + notifySemanticsEnabled(window.semanticsEnabled); + + // Await semantics enabled from embedder. + await semanticsChanged; + notifySemanticsEnabled(window.semanticsEnabled); + + // Return initial state of accessibility features. + notifyAccessibilityFeatures(window.accessibilityFeatures.reduceMotion); + + // Await accessibility features changed from embedder. + await accessibilityFeaturesChanged; + notifyAccessibilityFeatures(window.accessibilityFeatures.reduceMotion); + + // Fire semantics update. + final SemanticsUpdateBuilder builder = SemanticsUpdateBuilder() + ..updateNode( + id: 42, + label: 'A: root', + rect: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0), + transform: kIdentityTransform, + childrenInTraversalOrder: Int32List.fromList([84, 96]), + childrenInHitTestOrder: Int32List.fromList([96, 84]), + ) + ..updateNode( + id: 84, + label: 'B: leaf', + rect: Rect.fromLTRB(40.0, 40.0, 80.0, 80.0), + transform: kIdentityTransform, + ) + ..updateNode( + id: 96, + label: 'C: branch', + rect: Rect.fromLTRB(40.0, 40.0, 80.0, 80.0), + transform: kIdentityTransform, + childrenInTraversalOrder: Int32List.fromList([128]), + childrenInHitTestOrder: Int32List.fromList([128]), + ) + ..updateNode( + id: 128, + label: 'D: leaf', + rect: Rect.fromLTRB(40.0, 40.0, 80.0, 80.0), + transform: kIdentityTransform, + additionalActions: Int32List.fromList([21]), + ) + ..updateCustomAction( + id: 21, + label: 'Archive', + hint: 'archive message', + ); + window.updateSemantics(builder.build()); + signalNativeTest(); + + // Await semantics action from embedder. + final SemanticsActionData data = await semanticsAction; + final List actionArgs = [data.args.getInt8(0), data.args.getInt8(1)]; + notifySemanticsAction(data.id, data.action.index, actionArgs); + + // Await semantics disabled from embedder. + await semanticsChanged; + notifySemanticsEnabled(window.semanticsEnabled); +} diff --git a/shell/platform/embedder/platform_view_embedder.cc b/shell/platform/embedder/platform_view_embedder.cc index 5a5551b751729..736a545326aa5 100644 --- a/shell/platform/embedder/platform_view_embedder.cc +++ b/shell/platform/embedder/platform_view_embedder.cc @@ -30,6 +30,19 @@ PlatformViewEmbedder::PlatformViewEmbedder( PlatformViewEmbedder::~PlatformViewEmbedder() = default; +void PlatformViewEmbedder::UpdateSemantics( + blink::SemanticsNodeUpdates update, + blink::CustomAccessibilityActionUpdates actions) { + if (platform_dispatch_table_.update_semantics_nodes_callback != nullptr) { + platform_dispatch_table_.update_semantics_nodes_callback(std::move(update)); + } + if (platform_dispatch_table_.update_semantics_custom_actions_callback != + nullptr) { + platform_dispatch_table_.update_semantics_custom_actions_callback( + std::move(actions)); + } +} + void PlatformViewEmbedder::HandlePlatformMessage( fml::RefPtr message) { if (!message) { diff --git a/shell/platform/embedder/platform_view_embedder.h b/shell/platform/embedder/platform_view_embedder.h index bea840387e7e1..b57158d95435a 100644 --- a/shell/platform/embedder/platform_view_embedder.h +++ b/shell/platform/embedder/platform_view_embedder.h @@ -18,10 +18,17 @@ namespace shell { class PlatformViewEmbedder final : public PlatformView { public: + using UpdateSemanticsNodesCallback = + std::function; + using UpdateSemanticsCustomActionsCallback = + std::function; using PlatformMessageResponseCallback = std::function)>; struct PlatformDispatchTable { + UpdateSemanticsNodesCallback update_semantics_nodes_callback; // optional + UpdateSemanticsCustomActionsCallback + update_semantics_custom_actions_callback; // optional PlatformMessageResponseCallback platform_message_response_callback; // optional }; @@ -42,6 +49,11 @@ class PlatformViewEmbedder final : public PlatformView { ~PlatformViewEmbedder() override; + // |shell::PlatformView| + void UpdateSemantics( + blink::SemanticsNodeUpdates update, + blink::CustomAccessibilityActionUpdates actions) override; + // |shell::PlatformView| void HandlePlatformMessage( fml::RefPtr message) override; diff --git a/shell/platform/embedder/tests/embedder_a11y_unittests.cc b/shell/platform/embedder/tests/embedder_a11y_unittests.cc new file mode 100644 index 0000000000000..511a1dcf2e2d1 --- /dev/null +++ b/shell/platform/embedder/tests/embedder_a11y_unittests.cc @@ -0,0 +1,205 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Allow access to fml::MessageLoop::GetCurrent() in order to flush platform +// thread tasks. +#define FML_USED_ON_EMBEDDER + +#include +#include "embedder.h" +#include "flutter/fml/macros.h" +#include "flutter/fml/message_loop.h" +#include "flutter/fml/synchronization/waitable_event.h" +#include "flutter/lib/ui/semantics/semantics_node.h" +#include "flutter/shell/platform/embedder/embedder_engine.h" +#include "flutter/testing/testing.h" +#include "third_party/dart/runtime/include/dart_api.h" +#include "third_party/tonic/converter/dart_converter.h" +#include "third_party/tonic/dart_library_natives.h" + +#define REGISTER_FUNCTION(name, count) {"" #name, name, count, true}, +#define DECLARE_FUNCTION(name, count) \ + extern void name(Dart_NativeArguments args); +#define BUILTIN_NATIVE_LIST(V) \ + V(SignalNativeTest, 0) \ + V(NotifyTestData1, 1) \ + V(NotifyTestData3, 3) + +BUILTIN_NATIVE_LIST(DECLARE_FUNCTION); + +static tonic::DartLibraryNatives* g_natives; + +Dart_NativeFunction GetNativeFunction(Dart_Handle name, + int argument_count, + bool* auto_setup_scope) { + return g_natives->GetNativeFunction(name, argument_count, auto_setup_scope); +} + +const uint8_t* GetSymbol(Dart_NativeFunction native_function) { + return g_natives->GetSymbol(native_function); +} + +using OnTestDataCallback = std::function; + +fml::AutoResetWaitableEvent g_latch; +OnTestDataCallback g_test_data_callback = [](Dart_NativeArguments) {}; + +// Called by the Dart text fixture on the UI thread to signal that the C++ +// unittest should resume. +void SignalNativeTest(Dart_NativeArguments args) { + g_latch.Signal(); +} + +// Called by test fixture on UI thread to pass data back to this test. +// 1 parameter version. +void NotifyTestData1(Dart_NativeArguments args) { + g_test_data_callback(args); +} + +// Called by test fixture on UI thread to pass data back to this test. +// 3 parameter version. +void NotifyTestData3(Dart_NativeArguments args) { + g_test_data_callback(args); +} + +TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) { + FlutterSoftwareRendererConfig renderer; + renderer.struct_size = sizeof(FlutterSoftwareRendererConfig); + renderer.surface_present_callback = [](void*, const void*, size_t, size_t) { + return false; + }; + + FlutterRendererConfig config = {}; + config.type = FlutterRendererType::kSoftware; + config.software = renderer; + + FlutterProjectArgs args = {}; + args.struct_size = sizeof(FlutterProjectArgs); + args.assets_path = testing::GetFixturesPath(); + + // Register native functions to be called from test fixture. + g_natives = new tonic::DartLibraryNatives(); + g_natives->Register({BUILTIN_NATIVE_LIST(REGISTER_FUNCTION)}); + args.root_isolate_create_callback = [](void*) { + Dart_SetNativeResolver(Dart_RootLibrary(), GetNativeFunction, GetSymbol); + }; + + typedef struct { + std::function on_semantics_update; + std::function + on_custom_action_update; + } TestData; + auto test_data = TestData{}; + args.update_semantics_node_callback = [](const FlutterSemanticsNode* node, + void* data) { + auto test_data = reinterpret_cast(data); + test_data->on_semantics_update(node); + }; + args.update_semantics_custom_action_callback = + [](const FlutterSemanticsCustomAction* action, void* data) { + auto test_data = reinterpret_cast(data); + test_data->on_custom_action_update(action); + }; + + // Start the engine, run text fixture. + FlutterEngine engine = nullptr; + FlutterEngineResult result = FlutterEngineRun(FLUTTER_ENGINE_VERSION, &config, + &args, &test_data, &engine); + ASSERT_EQ(result, FlutterEngineResult::kSuccess); + + // Wait for initial NotifySemanticsEnabled(false). + g_test_data_callback = [](Dart_NativeArguments args) { + bool enabled; + Dart_GetNativeBooleanArgument(args, 0, &enabled); + ASSERT_FALSE(enabled); + g_latch.Signal(); + }; + g_latch.Wait(); + + // Enable semantics. Wait for NotifySemanticsEnabled(true). + g_test_data_callback = [](Dart_NativeArguments args) { + bool enabled; + Dart_GetNativeBooleanArgument(args, 0, &enabled); + ASSERT_TRUE(enabled); + g_latch.Signal(); + }; + result = FlutterEngineUpdateSemanticsEnabled(engine, true); + ASSERT_EQ(result, FlutterEngineResult::kSuccess); + g_latch.Wait(); + + // Wait for initial accessibility features (reduce_motion == false) + g_test_data_callback = [](Dart_NativeArguments args) { + bool enabled; + Dart_GetNativeBooleanArgument(args, 0, &enabled); + ASSERT_FALSE(enabled); + g_latch.Signal(); + }; + g_latch.Wait(); + + // Set accessibility features: (reduce_motion == true) + g_test_data_callback = [](Dart_NativeArguments args) { + bool enabled; + Dart_GetNativeBooleanArgument(args, 0, &enabled); + ASSERT_TRUE(enabled); + g_latch.Signal(); + }; + result = FlutterEngineUpdateAccessibilityFeatures( + engine, kFlutterAccessibilityFeatureReduceMotion); + ASSERT_EQ(result, FlutterEngineResult::kSuccess); + g_latch.Wait(); + + // Wait for UpdateSemantics callback on platform (current) thread. + int node_count = 0; + test_data.on_semantics_update = + [&node_count](const FlutterSemanticsNode* node) { ++node_count; }; + int action_count = 0; + test_data.on_custom_action_update = + [&action_count](const FlutterSemanticsCustomAction* action) { + ++action_count; + }; + g_latch.Wait(); + fml::MessageLoop::GetCurrent().RunExpiredTasksNow(); + ASSERT_EQ(4, node_count); + ASSERT_EQ(1, action_count); + + // Dispatch a tap to semantics node 42. Wait for NotifySemanticsAction. + g_test_data_callback = [](Dart_NativeArguments args) { + int64_t node_id; + Dart_GetNativeIntegerArgument(args, 0, &node_id); + ASSERT_EQ(42, node_id); + + int64_t action_id; + Dart_GetNativeIntegerArgument(args, 1, &action_id); + ASSERT_EQ(static_cast(blink::SemanticsAction::kTap), action_id); + + Dart_Handle semantic_args = Dart_GetNativeArgument(args, 2); + int64_t data; + Dart_Handle dart_int = Dart_ListGetAt(semantic_args, 0); + Dart_IntegerToInt64(dart_int, &data); + ASSERT_EQ(2, data); + + dart_int = Dart_ListGetAt(semantic_args, 1); + Dart_IntegerToInt64(dart_int, &data); + ASSERT_EQ(1, data); + g_latch.Signal(); + }; + std::vector bytes({2, 1}); + result = FlutterEngineDispatchSemanticsAction( + engine, 42, kFlutterSemanticsActionTap, &bytes[0], bytes.size()); + g_latch.Wait(); + + // Disable semantics. Wait for NotifySemanticsEnabled(false). + g_test_data_callback = [](Dart_NativeArguments args) { + bool enabled; + Dart_GetNativeBooleanArgument(args, 0, &enabled); + ASSERT_FALSE(enabled); + g_latch.Signal(); + }; + result = FlutterEngineUpdateSemanticsEnabled(engine, false); + ASSERT_EQ(result, FlutterEngineResult::kSuccess); + g_latch.Wait(); + + result = FlutterEngineShutdown(engine); + ASSERT_EQ(result, FlutterEngineResult::kSuccess); +} From 39f7066b6905c612cf1d177ca024a0318e3cc456 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Wed, 20 Feb 2019 20:13:02 -0800 Subject: [PATCH 0228/1117] Test profile and release build and unit tests (#7880) * Test profile build and unit tests * update googletest, skip JIT tests on non-debug builds --- .cirrus.yml | 14 +++++++++++++- DEPS | 2 +- runtime/BUILD.gn | 1 + runtime/dart_isolate_unittests.cc | 9 +++++++++ testing/run_tests.sh | 24 +++++++++++++++--------- 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 9dde213d2698d..e65df1e409be2 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -24,7 +24,19 @@ task: 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 + test_host_script: cd $ENGINE_PATH/src && ./flutter/testing/run_tests.sh host_debug_unopt + - name: build_and_test_host_profile + compile_host_script: | + cd $ENGINE_PATH/src + ./flutter/tools/gn --runtime-mode profile --no-lto + ninja -C out/host_profile + test_host_script: cd $ENGINE_PATH/src && ./flutter/testing/run_tests.sh host_profile + - name: build_and_test_host_release + compile_host_script: | + cd $ENGINE_PATH/src + ./flutter/tools/gn --runtime-mode release --no-lto + ninja -C out/host_release + test_host_script: cd $ENGINE_PATH/src && ./flutter/testing/run_tests.sh host_release - name: build_android compile_host_script: | cd $ENGINE_PATH/src diff --git a/DEPS b/DEPS index b625d365e35b9..0fb725b8273bc 100644 --- a/DEPS +++ b/DEPS @@ -131,7 +131,7 @@ deps = { Var('fuchsia_git') + '/third_party/benchmark' + '@' + '21f1eb3fe269ea43eba862bf6b699cde46587ade', 'src/third_party/googletest': - Var('fuchsia_git') + '/third_party/googletest' + '@' + '2072b0053d3537fa5e8d222e34c759987aae1320', + Var('fuchsia_git') + '/third_party/googletest' + '@' + '50a5a788420bd44501a75562de8936fd7ac32117', 'src/third_party/rapidjson': Var('fuchsia_git') + '/third_party/rapidjson' + '@' + '32d07c55db1bb6c2ae17cba4033491a667647753', diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index 5df979ed689a9..401b107ad2adf 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -93,6 +93,7 @@ executable("runtime_unittests") { deps = [ ":runtime", ":runtime_fixtures", + "$flutter_root/common", "$flutter_root/fml", "$flutter_root/lib/snapshot", "$flutter_root/testing", diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc index ab6c29617ecf3..76de89deb061e 100644 --- a/runtime/dart_isolate_unittests.cc +++ b/runtime/dart_isolate_unittests.cc @@ -11,6 +11,12 @@ #include "flutter/testing/thread_test.h" #include "third_party/tonic/scopes/dart_isolate_scope.h" +#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_DEBUG +#define SKIP_IF_AOT() GTEST_SKIP() +#else +#define SKIP_IF_AOT() (void)0 +#endif + #define CURRENT_TEST_NAME \ std::string { \ ::testing::UnitTest::GetInstance()->current_test_info()->name() \ @@ -213,18 +219,21 @@ std::unique_ptr RunDartCodeInIsolate( } TEST_F(DartIsolateTest, IsolateCanLoadAndRunDartCode) { + SKIP_IF_AOT(); auto isolate = RunDartCodeInIsolate(GetCurrentTaskRunner(), "main"); ASSERT_TRUE(isolate); ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running); } TEST_F(DartIsolateTest, IsolateCannotLoadAndRunUnknownDartEntrypoint) { + SKIP_IF_AOT(); auto isolate = RunDartCodeInIsolate(GetCurrentTaskRunner(), "thisShouldNotExist"); ASSERT_FALSE(isolate); } TEST_F(DartIsolateTest, CanRunDartCodeCodeSynchronously) { + SKIP_IF_AOT(); auto isolate = RunDartCodeInIsolate(GetCurrentTaskRunner(), "main"); ASSERT_TRUE(isolate); diff --git a/testing/run_tests.sh b/testing/run_tests.sh index 85968fa9ff454..e3f54cd02842d 100755 --- a/testing/run_tests.sh +++ b/testing/run_tests.sh @@ -2,22 +2,28 @@ set -o pipefail -e; +HOST_DIR=${1:-host_debug_unopt} + # 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 +# out/$HOST_DIR/embedder_unittests +out/$HOST_DIR/flow_unittests +out/$HOST_DIR/fml_unittests --gtest_filter="-*TimeSensitiveTest*" +out/$HOST_DIR/runtime_unittests +out/$HOST_DIR/shell_unittests +out/$HOST_DIR/synchronization_unittests +out/$HOST_DIR/txt_unittests --font-directory=flutter/third_party/txt/third_party/fonts + +# pubspec.yaml points to these files +./flutter/tools/gn --unoptimized +ninja -C out/host_debug_unopt flutter/sky/packages pushd flutter/testing/dart pub get popd 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 --use-test-fonts out/host_debug_unopt/engine_test.dill + out/$HOST_DIR/dart out/$HOST_DIR/gen/frontend_server.dart.snapshot --sdk-root out/$HOST_DIR/flutter_patched_sdk --incremental --strong --target=flutter --packages flutter/testing/dart/.packages --output-dill out/$HOST_DIR/engine_test.dill $1 + out/$HOST_DIR/flutter_tester --disable-observatory --use-test-fonts out/$HOST_DIR/engine_test.dill } # Verify that a failing test returns a failure code. From 6d8bd99afb16f7a1ebb59a2657ec76802606a581 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 20 Feb 2019 20:45:39 -0800 Subject: [PATCH 0229/1117] Revert "Reland PerformanceOverlayLayer golden test (#7863)" (#7895) Reverting this broke the flow tests for the performance overlay: ``` ../../flutter/flow/layers/performance_overlay_layer_unittests.cc:70: Failure Value of: golden_data != nullptr Actual: false Expected: true ``` This reverts commit 8427d73c8340c9e51492689ee66261a4a72cac9e. --- ci/licenses_golden/licenses_flutter | 5 - flow/BUILD.gn | 7 +- flow/flow_run_all_unittests.cc | 32 ------ flow/flow_test_utils.cc | 40 -------- flow/flow_test_utils.h | 29 ------ flow/layers/performance_overlay_layer.cc | 31 ++---- flow/layers/performance_overlay_layer.h | 6 +- .../performance_overlay_layer_unittests.cc | 96 ------------------ .../resources/performance_overlay_gold.png | Bin 16572 -> 0 bytes 9 files changed, 12 insertions(+), 234 deletions(-) delete mode 100644 flow/flow_run_all_unittests.cc delete mode 100644 flow/flow_test_utils.cc delete mode 100644 flow/flow_test_utils.h delete mode 100644 flow/layers/performance_overlay_layer_unittests.cc delete mode 100644 testing/resources/performance_overlay_gold.png diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 89ccd037e8107..3d9c0638245c1 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -57,7 +57,6 @@ 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/performance_overlay_layer_unittests.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.h FILE: ../../../flutter/flow/layers/picture_layer.cc @@ -697,13 +696,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== ==================================================================================================== -LIBRARY: engine LIBRARY: txt ORIGIN: ../../../flutter/third_party/txt/LICENSE TYPE: LicenseType.apache -FILE: ../../../flutter/flow/flow_run_all_unittests.cc -FILE: ../../../flutter/flow/flow_test_utils.cc -FILE: ../../../flutter/flow/flow_test_utils.h FILE: ../../../flutter/third_party/txt/benchmarks/paint_record_benchmarks.cc FILE: ../../../flutter/third_party/txt/benchmarks/paragraph_benchmarks.cc FILE: ../../../flutter/third_party/txt/benchmarks/paragraph_builder_benchmarks.cc diff --git a/flow/BUILD.gn b/flow/BUILD.gn index fbbf0e49db095..6b345aa87a35a 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -93,18 +93,13 @@ executable("flow_unittests") { testonly = true sources = [ - "flow_run_all_unittests.cc", - "flow_test_utils.h", - "flow_test_utils.cc", "matrix_decomposition_unittests.cc", "raster_cache_unittests.cc", - "layers/performance_overlay_layer_unittests.cc", ] deps = [ ":flow", - "$flutter_root/fml", - "//third_party/googletest:gtest", + "$flutter_root/testing", "//third_party/dart/runtime:libdart_jit", # for tracing "//third_party/skia", ] diff --git a/flow/flow_run_all_unittests.cc b/flow/flow_run_all_unittests.cc deleted file mode 100644 index c1755e639b037..0000000000000 --- a/flow/flow_run_all_unittests.cc +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2017 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 "flutter/fml/command_line.h" -#include "flutter/fml/logging.h" -#include "gtest/gtest.h" - -#include "flow_test_utils.h" - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - fml::CommandLine cmd = fml::CommandLineFromArgcArgv(argc, argv); - flow::SetGoldenDir( - cmd.GetOptionValueWithDefault("golden-dir", "flutter/testing/resources")); - flow::SetFontFile(cmd.GetOptionValueWithDefault( - "font-file", - "flutter/third_party/txt/third_party/fonts/Roboto-Regular.ttf")); - return RUN_ALL_TESTS(); -} diff --git a/flow/flow_test_utils.cc b/flow/flow_test_utils.cc deleted file mode 100644 index 0bf6d4c31d4d9..0000000000000 --- a/flow/flow_test_utils.cc +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017 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 - -namespace flow { - -static std::string gGoldenDir; -static std::string gFontFile; - -const std::string& GetGoldenDir() { - return gGoldenDir; -} - -void SetGoldenDir(const std::string& dir) { - gGoldenDir = dir; -} - -const std::string& GetFontFile() { - return gFontFile; -} - -void SetFontFile(const std::string& file) { - gFontFile = file; -} - -} // namespace flow diff --git a/flow/flow_test_utils.h b/flow/flow_test_utils.h deleted file mode 100644 index 58da75b3f4dde..0000000000000 --- a/flow/flow_test_utils.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2017 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 - -namespace flow { - -const std::string& GetGoldenDir(); - -void SetGoldenDir(const std::string& dir); - -const std::string& GetFontFile(); - -void SetFontFile(const std::string& dir); - -} // namespace flow diff --git a/flow/layers/performance_overlay_layer.cc b/flow/layers/performance_overlay_layer.cc index e7f40058c3bfb..c80786e866e1b 100644 --- a/flow/layers/performance_overlay_layer.cc +++ b/flow/layers/performance_overlay_layer.cc @@ -15,12 +15,8 @@ namespace { void DrawStatisticsText(SkCanvas& canvas, const std::string& string, int x, - int y, - const std::string& font_path) { + int y) { SkFont font; - if (font_path != "") { - font = SkFont(SkTypeface::MakeFromFile(font_path.c_str())); - } font.setSize(15); font.setLinearMetrics(false); SkPaint paint; @@ -37,8 +33,7 @@ void VisualizeStopWatch(SkCanvas& canvas, SkScalar height, bool show_graph, bool show_labels, - const std::string& label_prefix, - const std::string& font_path) { + const std::string& label_prefix) { const int label_x = 8; // distance from x const int label_y = -10; // distance from y+height @@ -56,20 +51,14 @@ void VisualizeStopWatch(SkCanvas& canvas, stream << label_prefix << " " << "max " << max_ms_per_frame << " ms/frame, " << "avg " << average_ms_per_frame << " ms/frame"; - DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y, - font_path); + DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y); } } } // namespace -PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options, - const char* font_path) - : options_(options) { - if (font_path != nullptr) { - font_path_ = font_path; - } -} +PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options) + : options_(options) {} void PerformanceOverlayLayer::Paint(PaintContext& context) const { const int padding = 8; @@ -84,15 +73,15 @@ void PerformanceOverlayLayer::Paint(PaintContext& context) const { SkScalar height = paint_bounds().height() / 2; SkAutoCanvasRestore save(context.leaf_nodes_canvas, true); - VisualizeStopWatch( - *context.leaf_nodes_canvas, context.frame_time, x, y, width, - height - padding, options_ & kVisualizeRasterizerStatistics, - options_ & kDisplayRasterizerStatistics, "GPU", font_path_); + VisualizeStopWatch(*context.leaf_nodes_canvas, context.frame_time, x, y, + width, height - padding, + options_ & kVisualizeRasterizerStatistics, + options_ & kDisplayRasterizerStatistics, "GPU"); VisualizeStopWatch(*context.leaf_nodes_canvas, context.engine_time, x, y + height, width, height - padding, options_ & kVisualizeEngineStatistics, - options_ & kDisplayEngineStatistics, "UI", font_path_); + options_ & kDisplayEngineStatistics, "UI"); } } // namespace flow diff --git a/flow/layers/performance_overlay_layer.h b/flow/layers/performance_overlay_layer.h index a47b836c49f3a..b5f20ecbd7a6b 100644 --- a/flow/layers/performance_overlay_layer.h +++ b/flow/layers/performance_overlay_layer.h @@ -5,8 +5,6 @@ #ifndef FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ #define FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ -#include - #include "flutter/flow/layers/layer.h" #include "flutter/fml/macros.h" @@ -19,14 +17,12 @@ const int kVisualizeEngineStatistics = 1 << 3; class PerformanceOverlayLayer : public Layer { public: - explicit PerformanceOverlayLayer(uint64_t options, - const char* font_path = nullptr); + explicit PerformanceOverlayLayer(uint64_t options); void Paint(PaintContext& context) const override; private: int options_; - std::string font_path_; FML_DISALLOW_COPY_AND_ASSIGN(PerformanceOverlayLayer); }; diff --git a/flow/layers/performance_overlay_layer_unittests.cc b/flow/layers/performance_overlay_layer_unittests.cc deleted file mode 100644 index f64f53422fb37..0000000000000 --- a/flow/layers/performance_overlay_layer_unittests.cc +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2013 The Flutter 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/flow_test_utils.h" -#include "flutter/flow/layers/performance_overlay_layer.h" -#include "flutter/flow/raster_cache.h" - -#include "third_party/skia/include/core/SkSurface.h" -#include "third_party/skia/include/utils/SkBase64.h" - -#include "gtest/gtest.h" - -// To get the size of kMockedTimes in compile time. -template -constexpr int size(const T (&array)[N]) noexcept { - return N; -} - -constexpr int kMockedTimes[] = {17, 1, 4, 24, 4, 25, 30, 4, 13, 34, - 14, 0, 18, 9, 32, 36, 26, 23, 5, 8, - 32, 18, 29, 16, 29, 18, 0, 36, 33, 10}; - -// Relative to the flutter/src/engine/flutter directory -const char* kGoldenFileName = "performance_overlay_gold.png"; - -// Relative to the flutter/src/engine/flutter directory -const char* kNewGoldenFileName = "performance_overlay_gold_new.png"; - -TEST(PerformanceOverlayLayer, Gold) { - const std::string& golden_dir = flow::GetGoldenDir(); - // This unit test should only be run on Linux (not even on Mac since it's a - // golden test). Hence we don't have to worry about the "/" vs. "\". - std::string golden_file_path = golden_dir + "/" + kGoldenFileName; - std::string new_golden_file_path = golden_dir + "/" + kNewGoldenFileName; - - flow::Stopwatch mock_stopwatch; - for (int i = 0; i < size(kMockedTimes); ++i) { - mock_stopwatch.SetLapTime( - fml::TimeDelta::FromMilliseconds(kMockedTimes[i])); - } - - const SkImageInfo image_info = SkImageInfo::MakeN32Premul(1000, 1000); - sk_sp surface = SkSurface::MakeRaster(image_info); - - ASSERT_TRUE(surface != nullptr); - - flow::TextureRegistry unused_texture_registry; - - flow::Layer::PaintContext paintContext = { - nullptr, surface->getCanvas(), nullptr, mock_stopwatch, - mock_stopwatch, unused_texture_registry, nullptr, false}; - - // Specify font file to ensure the same font across different operation - // systems. - flow::PerformanceOverlayLayer layer(flow::kDisplayRasterizerStatistics | - flow::kVisualizeRasterizerStatistics | - flow::kDisplayEngineStatistics | - flow::kVisualizeEngineStatistics, - flow::GetFontFile().c_str()); - layer.set_paint_bounds(SkRect::MakeWH(1000, 400)); - surface->getCanvas()->clear(SK_ColorTRANSPARENT); - layer.Paint(paintContext); - - sk_sp snapshot = surface->makeImageSnapshot(); - sk_sp snapshot_data = snapshot->encodeToData(); - - sk_sp golden_data = - SkData::MakeFromFileName(golden_file_path.c_str()); - EXPECT_TRUE(golden_data != nullptr) - << "Golden file not found: " << golden_file_path << ".\n" - << "Please either set --golden-dir, or make sure that the unit test is " - << "run from the right directory (e.g., flutter/engine/src)."; - - const bool golden_data_matches = golden_data->equals(snapshot_data.get()); - if (!golden_data_matches) { - SkFILEWStream wstream(new_golden_file_path.c_str()); - wstream.write(snapshot_data->data(), snapshot_data->size()); - wstream.flush(); - - size_t b64_size = - SkBase64::Encode(snapshot_data->data(), snapshot_data->size(), nullptr); - char* b64_data = new char[b64_size]; - SkBase64::Encode(snapshot_data->data(), snapshot_data->size(), b64_data); - - EXPECT_TRUE(golden_data_matches) - << "Golden file mismatch. Please check " - << "the difference between " << kGoldenFileName << " and " - << kNewGoldenFileName << ", and replace the former " - << "with the latter if the difference looks good.\n\n" - << "See also the base64 encoded " << kNewGoldenFileName << ":\n" - << b64_data; - - delete[] b64_data; - } -} diff --git a/testing/resources/performance_overlay_gold.png b/testing/resources/performance_overlay_gold.png deleted file mode 100644 index 119551f705793600890950be96b6b0d60688cc54..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16572 zcmeI4c~n!`mjAIV3ra+AKuQrPN(B`KCqS7}f{4nbGLKOiWeN}=Od*ys2ndu?fJ{L_ zWD*dNAwY;S$`}~~1QHp;lmrMQB#`hssp{_4@As--zt#PIfBe>}yOt|@FWh_XIeYK3 z_xH17^lc+Ok=;jj3kV2^+`Mt^u7JSKIsPA^@4y+uoPlZZ@hx2Yrl}A(LWLZk3JClt zaP!(#)4+_S@gQ$AN~Zi4Wx?Lg)Aj297sJiYOr)UXq_{fiLEFQ;i&NEP8jEUxz@-Ki zk<$v&AhV_Oh3p*7K|AGnzuJD2L<5(O)Wh;dlf`jT#K4_TM)v&hbcg;s?Qgypb0v(E zAg)&)#f9(dJkJX)JSoA-2I1kA%d&fPek?&9{Ew+*5%aQsCpKpZ~h_Kc9_9&E1NRloHH} z8j(*tp*XF2pBy)KVZVfcfcN70$9utz_x<>4r+~oE-wFZK6cF3-jT-p4_UO@nz7*Is zDl%DS2`=nu75dND#U$OL+7sogNl&%C{Lh{}k^986v}kdm=1!$;vCYI0FYzX7?0>Qj zw*|2Dilt>`J_GlNQ5jFPg8iB>pQ_T;kxpI_SLUi4mB&s;F2u?zw|*xwCn6$(J2JGg zL*NnqY0Gyq#}KjVe=@SYYFS5^^|M0fjHLwxHp(yjv#<1TZ;O5+U9!X`qq9T=1U{}i ze)}f|*L5{Ye@~^{r`wDB_OQ6%$1D=}{qN25N1qDeuR~>SW;L*Uj zvLLpu3U1n*-;&{A8-*-(7JtAf8PdvR`T{i~b$BTjiUq7R= z@dM_{AKrt0vKM;$Ang(ush8&Ue>RvUSj9elEj?Zth76qgJ%WCWbNO>q#9fa})8V`3 zlYiQI|7VMJ+$&(m*ySSgh)u5m;2Q#=TF3q*KHS@@20cC73*txh=|8*v--njppL4{k z&eMeb+bNsV`=fdFs-%sIV@TwQ)O5Q81bjNI;R=F98)ujln6B25xwP%V{QNo0i1H4B zk16BI!gI&;RK&Z|)&rb^*wK$I&qyrN6pf|SKFoOt#cB)5I$lVv$8m~q9Gb4Y@o`RP zM@P>)Ta52w#ua#)w$KEOHw)v<%=P9ZXtJjh>Gn1BY+a?eBgzZ6SKLdvxTsRIZi303 zUd%>)P^nqM(Gk<%Qc^@HJ%el1QUC1%IK_=4$c%3By+8UvMBJf`7jO;y>{fSrmg_^$ z%r(qa`J`JdD0U~b#LLYs?Pa^;{@mPL7h1z6P2{3;mn+7{VqLv6S<@oD{dfhj3Yk+` zUw`6?Lu;LxUP6y1Vc=3x1rBF~Gm`b49+0$K{bIz3&|osOb6&oDckE6NB^6f#Ul zr)hvjqxA{Ogf0(`RJh3Co>%VO7{P}HKsBU|Q51D@(B|?)QxdVt)8@QW$8XpQ7rfU= z1%*ZIVg4Kz&!&C5wz`@;-I0Wkr!5^#9mQ@oRH4y*26p4WOpa8Lf2j1b+sp`|VO&@r z8^ExKl@YWtV=#AP7`U!_z|zZ#0P1L|d}4dbTf_8#RqKHRyE;?0ANZX~7A97srmo2) ze(ug-8_lfF;NBq_-HRT6} z>3uq-vvd5jb%V$1>V+~494aXuD>80?*I;y|B_}6yPMN&j3RswPS|GuX$+hc(@vNc@hc1?K0i%+^;yV=9;;PVxRP`ufDx*jT(= zl^1fWxjiv4L|f=Si?%sxUdof1x*o5A*6?==g(A5n`;?XAPN)ZHgig-&Ua`}WVtjsn z%;c?6CWlCb;kZ8w$(mYN;J8yV+Z#|Xu%4?6gGDSmx_j+y{_i4@E%Q}X-(zLNe>Gsv zI$c;9s}!Q}Jvb72->*Auedu$bhScKHy9F5!T%4pTX=rRrW2K~y7VN-YorzN|Y`|9p zF=h*P?by?u7Q1dHF;8&m4WEe}S9*XHSF zhYqea*VT2J)CG)_Rm3hSoK8!ua49V+%y&K2HS++&WY#uhs>^s#7mlQoYJ8?V>A-O` zS!C39k+6iK#*16Ilc;SLYMVMaIoU%GW7R3y1@hwK7X}ncw}?6t4auD?Ja({2kZkxl zuQ6I5li7>4*xwTy(<67c!1Su8r|05FcQZ4y@ra0s@#5lQvlLoZ7CD`@UW!6ZetHs1 zba&f(NJ1j38~0*S>CDnod=@Ui)XB-@J}_)5)gK9r?aR=Jm4B}gx5g(#?~*EhZjWrZ zI&EWQuA{?2S2lckF2~qd%jdx@!fZDVG1;q^g&qSwom04QN+E)f%f|sCW-9JRq3jQLXVTvlX=O#Gx&u4eF#^JW-4?Z?4LLbiT zmh%PPk(nG5GqsCB!CBi`2dj+`EM92&xqiYNzDOz_{V-4LPDy`z`;Jfjy~gm&8JlV? z(glZB^`s|*%#}77 z+YsD)^rhOvzBhcYZ-ekwj)BQ@0Dqs)%i<;aOtmU&tq+*MG`MU1s0%@>(+TP6>1`+W zM-Q+XSXk&$jllPA3zi2Vz@%lai9;rGw{Qv)tU>)fKt%0RaKY5{C{2C_x)S zO;pmmiRDh6i5Dy^a+l!}?0t5B0BK-?vswiA_mK$*N_MLR1aX zF3p>QyhsUizjV^xa(G`tn@Q04_{_Y1wLik*O^Onf6o`3VbGw#k~3r ze*BoW(U*%W!7jf%al&Q4lT-1osJ&#1 zDD1B9(r`xnPC;|@;X-6-)hu`;X)_DNtLdBsnme&(g_Yhv|9Gj~33pT~A@9MH_4eEA ze0zWQPQ(0?cgEHhsXitqx$*7W)XXwV#WPl`p`IG(XiqY4xm`1arlssPhQ?FtcJQxR zz7H_f?;PkkApdp`=GAEGMVG=C?T++>u(cc*ZxG5I+~z(3u~S`A#p9*Qa7cqI5xYf& zMKKEtmy5G_m$pd8s3Wzv^qWd~UquzwW}^?t-vV}Z(QTyMNhV6H(ZpDDeW5G$BH}p6 zBv1?(uNxA!XhRMTxko;x7jJ-8^IvF-l~5ujgW!ROY;WlV1qF@BqXQ>f^rVBPlSm}e zWQu+8e2H)ZWLXM1_d06mkhr)%78n}B69n89Da6Olnvh|rmomlp4I#hCa8$&^F zj!ra1$&-U9nRG4Q#*`9&!EnIbM43#c_40mTp4j`_IRW>sT~0b(lTEa%hLIZ{Y%-|| z-|^5O>Zqc4TW1w4O12zHiYBSPW{zx`BdeIrWavLGP#~eS= zB&_z(wu$F0~Uej9(Ov%p2zQ?*hAkgM^}Ojni0-k387LuQ)VCiXhA_EV44SkQ|EQ z8J6y-Vz^k3sYO(8TYSWdplGC+cHkU_(%5hXuC1t~v?uhd*2dQ-sr(S<=H{lRBlPs_A*AQp>_=J9yVuXUo{l8~%%*j|s) zq9PkslMHWJ6pY*oRgnj3?T_9f>aRq@%N@&E{jUNknUKRa=0nzE+Cs(?pyCV9J?yii+$|uue5fWcxh>Fl1?*T{O=u>_tKX1<7wh!E9)04i(YR&VgBG|y z47=Xe_FWJ0%lmiSL}T*|@TC5{wn}p|DTR#7K6>-HJCN@&ZcH@Ee;2mr2LmV+s*%#!GTW8P znE1#M>3?ge&Ia-BURRV%*ky+A4sPrRI}p`To7DHTUcIIS9v3IN4$N%64iTjef_Aop zv{q=~>K2=U*kcA4l0BZ-Zk(qL@-z>yCu(jkRk-(nT{iPp?rt3+*?{(iKnaqaiKXSR zjJD9s%*^=CQt^Wa*C@UiOB4!~4Rjb&#gtB)YOnD$|HUCYKN^Tuhlr@AAp7J*%!@R^1eaaHTKPgXmckNV)bY5xcWe`#_GczM38c1X^ z^j8D9s0?>x?h(lpw7Xl{Ab+cQv9Qpj8+!ODuF_ZN0pF=&_y*GI%u|#+!fsi#mAF>sPOSOuTWNqr_ct zYJR$p5*!i|Te8utW4ZB3@ID8vIWZN)Xq-4@(#SB@6ql2}EY`5zp9R9mFeuAj0+-Hq z>P$vX)Y;V5*1k}xUv7K?qJyEa7JE9@q4n7n7Ly3Wld3$4F|Wy*HT;qJC`PRHB*)s?(5uAqNoOcC@yhpsugibvXBg zhD?*Ntc->=Oa8R#r|@cNSQhWqd?N)NwOsdnsHCKW*U^!qEBj7E{eAJ9X^-sUV%|kY zVn}dDKby_Q8X6k<%Z9gtc;@b|Fu%B{P*PBUk&AT@Kj_y2!lU6J@JtAB_$6DNrgC_q zoTpOeMaue}mKJI>jTYmF%FFu$r-N=py-;{aRw~3I{h*2x!ZS1SyREI?hK+g! z1*Hz>Lc(kfHQVC5X=%#tcI%*qH_z*D_kc6jXkyxPbNRPsD6E;Jq{`VWb=A}2+CnRV zoN_{W2rJEmzuUqm-1)CoRb73F+pEXQT$pDsaYUS)oLth<)Agdn0z~SEMnJ9#RAjQAXk9Q ziCzE#o|CuXH^7=$=)yuZ^T0MK{4=0mB)Ncv?rUjrIl!N@*tV(p#>Pg4Fe8M+)QbxJ zWDRI_C|k)*R0d7nr!54Q@|OOsQ3iq*`nCKRy=k!bPEyCrB)@Vf(C~BZ#jLI#Xup|Q zW#0S%bMD;T2JZ<-+yby1>Ij@Z&*M#Yt<6iGPLRnO37U_Y$TNzgQx_FF&R8xR=YR~T zr+?n>g1Y}gYmA@Tb9XQFkd(HN;NEwxP`>W~QQ^o)pRWxo{Co8dV50lu;$ra;VvQdj zN}jH*z5e#QSyAJc=Uz{I{q&??)noXJxt$#{03_A=2coZ$vvp&Eg%iO540Ltj6JSke zwwcw4Od}90($b7?_02aL7#jzvNgKCZk5ezWQ0V1zaOaZ?w7t15_()I|1;XKQE|*2#<_sRim6Vidf=J3wJaa)&JOdN6aTy08ya0S*b8%)7d}Ex#6-i@H8c z9l|60ogGGpKqk9b+nWQC z_L=_txI#7qb(G*)?Ri>B33h60E=So@Hr)H`$Bv53%ws0PhwAUb+dqu{3NlKNQxUu8 z{q8vTW=ptRyxU;UIhM;eICUO4yE7-ZySpE#5!gDrQtF`RnJksO<@pRUBNE+Nk>$3E&Z2WHIWJ_u@MYq3C9#g zuKzf-dYgWJ*Dkx2?sQzxPvDBrR6xQFU}Fkazicu1#$>~amlCa3Q8lL5Q>(hgi!2}) z0~*7noIvPML-Kk(k!7Q!kuMq>OYosRr615adKCYRZTeVjBYCJeA?vd^}64-5vh@0WEl2>)=zTiU}fw zee>iTRRquNm5JD9yPyu$>gzXEhjIGFI-Q%6&)Rr(;_>t>5N^!kh6w`$ekJx;4i%_u z7W|ZQQBYJm;{uYiHV!6yV|n7L%z4$9{3>W1h-}6IV24l!h*Gz= zvm0j)J0y4>=?MarJvqAN0ZMH+0Ka!O#$$Ndl<_4*SKn!-tT8e&mr78}0A(L2p;={T z&zjVMq<`G%uCE+w^uv0ROV2avVXw;xF%aGqBrIqS3vT9q^JhwOC7kkv;Mx5c6sMl) zDxS!hH#cRH!OpN$VB!#hpmI3=>N0#lcHqmz=?@7o~X29uxbo~5nOXR3*s=-^YYqB5X`U&K$A3Q>?UPx`YQ_1H{ zy1+bn_lSaAy=?=5iD}=+n_8L3aL8vtqX7f;E}giZF=hRs-`kEJ&~T^( zp>BUuau4fhst5iRnfuuBf@a1Pz<*hTWO5c{m?^9G#iC?M>vG07B`rc6Z@u}_mX7fz zY`mmT-qnMn4{N~hLxl--Ql)Q1B9WPr4-y55V*~;#@xBxYxEs$bJ(kb=!vDag8iG;{ zuTG9V1WPs+{7>U*>54=9bTn(-xt!(JxWZi^;!EQHJ}&?K?aL=&aeI`bj)J>?=kRB& z^g<5YP|H=xj)v(AL(^$P#N!sSnyh)7anVC)uF8`^@hB*sfspLh6xc|g0O=_L#dJY27u|hGi^chK zwxOhYLZM!~$7#+Yu4fA>E-qdS5|)wMP$MKNHs;AOs7tCQMcoZ5l>=6ueCkt zMFvQ?3qdaRd$m78hMvg~&93EmPsE7h~KtN9qjr|u+#1uo78$b(}_A?TeIQ8V^YbNS3Vz0sDIHp z^MGH1?@TqA?GFfX=6T7)w z-PBzDtWv|{9Irsg@%_l4!9l&4f2+F&2cu%OKX+0`*FP5UaUI5X>3Ygq?(>wC=~LH#`L1GhI3*g}5T)`sQ@K~cqp8XmyZpjy1Xwl1D0c%7cuPO1k*4N#sVjWP+n{7#Pa zAfCc`_aU2OQ!9S&Dk=(5@3{+$h`9WMhi690rX~)6`_I?jS+^@m7T&C@uDLv&cURW< z9LQikKlS*TzOZnMMt23mM8H&{Z4@a~7gU=M@29LVLc3AVagp-E}|DooUF1K1aPIqg>Ne!%Yj9gkTxga$bX z-T(5)-qcU!c@{Z^K+>v(eXZmdk}#Oh+YcX(;HFaX4O+E@F$ie_t<@w^f;QS|NS6Lz%5BtaOoB zx%f*}Pfy`MM4ODN7yaq%?BPt1rMF2zB<-w%-kl5=lSZ!1x62zD%#YTySwP4VwakyB%_U(>q&1!rL4WZTAv|`R6IEWj2SPT()`Qz=k7Q5 ztOA$@OFci8+40FuQq>FbFl2L%r0_jOqH3JX9p}lbtE+bkF4D!E!^KJ(a0CnVw$$`I zZmaVgHz%QS3bJVx$Whw9&_ymkaWq5a>@<%?M{kh;V2s6YYH6;0(V-6x4F%Y4NNENv zS#obHi-umW81Y!jO|iEo0j7Tzh_0QToyOxKbgZPDVVa*?e!w>Zk8G@_VLlMQxi8b) zO&A2=?*nI%$YXtsS*-a*|AozCpsw5;0OeZcv~St+Y&tCLY`7SJ$6IVl7V0DjUYpGa zjO#b}v7(Piw5j)==u`%4HT}81r>ZJ?yuul4mc)1K3^wz#W4S85NmRy5sy;>xNOm1i z6n9;{qoczJkJj7_6p{s||MqmM0h2eU2jR^A7dUW^u2k##`9h}RXSqad3N`9KU?3=B zKUC%C=Pv?ORp$;!RV=+`DxM`1`1KdUgEC96uN<(Hz1b;l!1zEL0@oQ>qw$A>pit*m zyVQubGpDX3o>Xu@d)d$Rs-BRn$LJb0nJ@SO8E12$2o>f^tZFmbyJTatd9%ID0j{?9 zsAZ5GKYEudxD+%@Q-kk+|!fzNxPu4T31%}Uk;#s>|zr}SL zT^xoL-yIy%w9S&)b_krNK(_tJ36!qy87i>7d>|Nrq4xv6>_>=b``sRt?lORnvMQUR zM2#C5J?dm6XbFM#fT9|;(jp~OtbKzGaJhkNR}p`L!j^E{(K)a zj#Ld>p9eI~4hXNN13pzB*5VcbU%VC;7RD@VleVz|sJN=8<}%P7_2Q3?kVy^h?2jv2 zTg$J9>S&ymjUdL5d4g0OtofIn3dRV3v$tB?OR~THJF^43(YY(nZ>*sh>EzI$dp2sB zimslXQgz-Fjc2!Ka0ZK6msgs~LH~=)AduJ9{0n*6m{y>PS_;XA^2TUOPETBQnqn^g zu8m%lzvKk)`e>!QjCHNwd~!>ygv@T)aG-vTgX-8CsWo;ma&nTn#cy}AwvlH>iZuf1 zqbmL|!{_FiycuhmhL#`lKZT0#aXY?A}Q4us3X9F5ulgjsWfyQR#uR zTSp%4!b+r+tx~I-RuQD{C*o9(Tue0}QIJ^yv@y(dBMb2DuT22h?X`l#V6bc)4&pQS z<#hpqjAW(nBrYy23~`sEAX`lU^9^k?#!mtzH|b#XBVG_Ap23&`dq}VlfO5GPb%dm3 zx4hOc)rjUig=c)xn$LH(yk|)b4UJu&pYPgr(M1btWlu^oI37GD8!i^hRRnrvvNMyq zIa+W9ZZ9(k7;80Xj&Ttz0&PfX12!-u%N2B|H4hX>D)1=Vq3p715@*VR@8Dl_FvBEl zr+OH7(F_Rl4gVKk^SI~5qMSXWA{GxZWo8-4%8<%QLa@ zCbnZ}h^42_AfQst##zz?6N_qC^F$LveQ{y$ZyzcR=XxAh;UF1m2RK_whyog++K(#| zMfvGbqCBj4W4S5Hc+b`k=UxJE4jNHFD~Z*neAYWYQhI{a3PTuL43VR+q3nSHV}`hy z^*_FE`>)7a)Me=e)Tp!$^17s?q~44#rXCQqVk>~sbSYjim{Q$~BRha*=5P2-@b7>u z760rT%1o{UXnT*;EK&F`37Kp3c-GbLU$w_V= zw!tL@56uanTj^F|k*LI3>os3b8)6SyRBIzZUr2Uf;L;%gM4CZQ-e!bMFfx}KqFm(> zl#QvVxPY8+*U^mP-dcF*mNs(5rAKnG-O-rz`MIGku^Qt0Q#gam(KRp3Qt{+|uCMp= zSecYqIHVLd(NE~?uonJ3VSzQU^Yp&Ep09Hma*M00C1bG|%tTmNSgb}!*ayA`IyT5@ zvO;~jUY@6r!ZxWRU=Oo7KUNC}*Cz{r(tAL9_VD4nq16QF^Uj`3>$*z+onoN^URRWt zS2V16orbmFMAeHI715v-axIq*n3-|jUES2@ z$I^ET+AEw^OTQskcfbWdv1i!>e(_Nj__ z4NNY9envCM_bx&%aXZ4o9ruFC%?3FZ3&`}h?ZdL~eU17RBz>kpEa&tQsikkxAd(@R zDuVdEM@9Yfj#ZeTV1$q?2%ovDjLp@K4r_>1ZbDms3O0GXj*t<&SWK73E*k?gLD>+S zX~4B$`nuobQZk6*LxZ8yz2CXsRfI z?|!*rH1k>~wkIhi>xNOR1d^JLN`=P0^v6UMh9b(L4Nx1NvHiEV`x_b02 z_CP@YBMb_?c~1j>F48|0uxp9H~rDJ0N4OtciH=%?j|3#bfdXLpOce`wekkT zcg$~pNpkhD4FwzTTSMaQ-a+LH%IB(UF+py>+c_RxJWmH~8H|eb*{}B8#rMb>&SvaI zaq;d5kmV(B6UiihHQ++-Zd#{q<_TZa)SQ_I(Ls{m0n9H10T+=0Em5;CvDnxsV#@b+2Vje=`Ks zuRwm`l@t}ZCxGTj1S!a6zA-|Wbrcd-9}MzG1{~ZVvE6nsAp~?eEggo0ZOPXGE&gRz zRu=k#Q^!hVWaN3!s%yD6U}DUzt*T;1YI%tPKblT^_Nw}W!6K=A#-@AMuFPn#N(F$j zq`32Wd%B9|hz6hpMY{zpa_Z`S!nzZ<#ZFH0!pVF>GS@4UaM{=K(}-9PB!01qr~*>m z>Vsixy=hgyFV@URPtWs$UBdPS7(cH-5K=e6{tpsA-Bd71@9fGZDLJ6WZG)eO?s=BX z=O`q=ajMQcFq2CxR~YB{D7VTpWUcvQ{cLXzD`{Xz<)G+M2IxqG_)j)_+JWrauF`h~ zuLoMKTC2T~OEI&TpwYI9hk6LMzk=>5f`2uchid~lZi^~t^X6Y^jU#IQ1Qxs0an~yT zqUol+=Q!w28XFzcz%sxKSiH06b`5`jAmBGDpm}R-z3TNAH+RWfyM^nt7*^Q6;CSgw zf)5V|SK5u@m)bw2cX#rGD0OKBW?o%6xDBrh?a|(0@wJa9y}&pRzBhn#2Ted0pnH=! z-=9}RD6!jIeT}DMOi9oNm6rw!5P_Qhv)BcbI z4;K~W4LR>Mz)~1z9wFAb69}b5HeZT6_KJ}-*mt2aFW1SfzqCS2V z@ztb{{GuUYuoolpGJH+7A!m1y64{C@z; C%{D;* From 6e6020d29983a7e9bc2acbaaa813f4dce43306cd Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 20 Feb 2019 23:37:26 -0800 Subject: [PATCH 0230/1117] Eliminate .member = foo struct initialization (#7899) This breaks MSVC: ``` [3049/3506] CXX obj/flutter/shell/gpu/gpu_surface_gl.gpu_surface_gl_delegate.obj FAILED: obj/flutter/shell/gpu/gpu_surface_gl.gpu_surface_gl_delegate.obj ninja -t msvc -e environment.x64 -- E:\b\c\goma_cache\client/gomacc.exe "E:\b\depot_tools\win_toolchain\vs_files\3bc0ec615cf20ee342f3bc29bc991b5ad66d8d2c\VC\Tools\MSVC\14.14.26428\bin\HostX64\x64/cl.exe" /nologo /showIncludes /FC @obj/flutter/shell/gpu/gpu_surface_gl.gpu_surface_gl_delegate.obj.rsp /c ../../flutter/shell/gpu/gpu_surface_gl_delegate.cc /Foobj/flutter/shell/gpu/gpu_surface_gl.gpu_surface_gl_delegate.obj /Fdobj/flutter/shell/gpu/gpu_surface_gl_cc.pdb e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(70): error C2059: syntax error: '.' e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(71): error C2143: syntax error: missing ';' before '}' e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(76): error C2061: syntax error: identifier 'ProcResolverContext' e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(78): error C3536: 'proc_resolver_context': cannot be used before it is initialized e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(78): error C2227: left of '->resolver' must point to class/struct/union/generic type e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(78): note: type is 'int' e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(82): error C2059: syntax error: 'if' e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(82): error C2143: syntax error: missing ';' before '{' e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(82): error C2447: '{': missing function header (old-style formal list?) e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(87): error C2059: syntax error: 'if' e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(87): error C2143: syntax error: missing ';' before '{' e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(87): error C2447: '{': missing function header (old-style formal list?) e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(91): error C2059: syntax error: '(' e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(91): error C2059: syntax error: ')' e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(92): error C2059: syntax error: 'return' e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(95): error C2653: 'GPUSurfaceGLDelegate': is not a class or namespace name e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(95): error C2270: 'GetGLInterface': modifiers not allowed on nonmember functions e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(96): error C3861: 'GetGLProcResolver': identifier not found e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(96): error C3861: 'CreateGLInterface': identifier not found e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(100): error C2653: 'GPUSurfaceGLDelegate': is not a class or namespace name e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(101): error C3861: 'CreateGLInterface': identifier not found e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(104): error C2059: syntax error: '}' e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(104): error C2143: syntax error: missing ';' before '}' ``` --- shell/gpu/gpu_surface_gl_delegate.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/gpu/gpu_surface_gl_delegate.cc b/shell/gpu/gpu_surface_gl_delegate.cc index f60a8770b3938..1447a3de72a50 100644 --- a/shell/gpu/gpu_surface_gl_delegate.cc +++ b/shell/gpu/gpu_surface_gl_delegate.cc @@ -67,7 +67,7 @@ static sk_sp CreateGLInterface( }; ProcResolverContext context = { - .resolver = proc_resolver, + proc_resolver }; GrGLGetProc gl_get_proc = [](void* context, From 293b3de986d42fd67b4e69475f6dbefb7ad55bda Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 21 Feb 2019 04:37:57 -0500 Subject: [PATCH 0231/1117] Roll src/third_party/skia 20ebd0cb3882..348227b89430 (4 commits) (#7900) https://skia.googlesource.com/skia.git/%2Blog/20ebd0cb3882..348227b89430 git log 20ebd0cb3882d1bdeed04eaa983b0e5842f0fdaf..348227b8943013f86d689bac0f8db8b287e96d97 --date=short --no-merges --format=%ad %ae %s 2019-02-20 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-21 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-02-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 902ceed39986..eef531f1716a (2 commits) 2019-02-20 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- sky/packages/sky_engine/LICENSE | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 0fb725b8273bc..9dd00296adcbf 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': '20ebd0cb3882d1bdeed04eaa983b0e5842f0fdaf', + 'skia_revision': '348227b8943013f86d689bac0f8db8b287e96d97', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 55284786527cf..335c26c8c70e3 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 80158806ee7715512b12aa7651039efe +Signature: 7ed7cdd0833f8ee6a543292f0775c7d8 UNUSED LICENSES: diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index fa9e5fc59f635..edab381ceabd6 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -2808,7 +2808,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- boringssl -engine etc1 observatory_pub_packages skia From be32040efda249a0dd05640a3f4bca567ef43bd0 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 21 Feb 2019 08:49:12 -0500 Subject: [PATCH 0232/1117] Roll src/third_party/skia 348227b89430..05ff93c43ea5 (2 commits) (#7901) https://skia.googlesource.com/skia.git/%2Blog/348227b89430..05ff93c43ea5 git log 348227b8943013f86d689bac0f8db8b287e96d97..05ff93c43ea57fd62cd1bc36ab7cd9b6112a7ecf --date=short --no-merges --format=%ad %ae %s 2019-02-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 eef531f1716a..08573730b75a (5 commits) 2019-02-21 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 9dd00296adcbf..f106ea30709b9 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': '348227b8943013f86d689bac0f8db8b287e96d97', + 'skia_revision': '05ff93c43ea57fd62cd1bc36ab7cd9b6112a7ecf', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 335c26c8c70e3..2843df5d20e24 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 7ed7cdd0833f8ee6a543292f0775c7d8 +Signature: 4d97ab682f6fb8caddbd4000b3db475c UNUSED LICENSES: From 1cf6b8b64d42aefcbc6e7d78a2e6df706962751a Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 21 Feb 2019 07:09:52 -0800 Subject: [PATCH 0233/1117] Roll src/third_party/dart 5ddd157809..75ee523f91 (19 commits) 75ee523f91 [VM] Remove flutter/flutter patch for 3head, the issue has been fixed upstream 4013b0eece [gardening] Add adjusted fix to flutter test patch. 69d46587cf [gardening] Add fix to flutter test patch. f5d43c45ea Include 'linterVersion' into AnalysisOption signature. e58b7cd59e [gardening] Fix flutter patch. 22e70ed48f [gardening] Patch flutter/flutter to fix hhh buildbot dc2422ef84 [vm, gc] Fix accounting of external sizes in the class table. bdb52a8f33 Fix 'Organize Directives' handling end-of-line comments. 371d244273 linter version support 435a52eafa [ VM / Service ] Fixed inconsistencies in service protocol spec. 8ac6114028 Sort AvailableDeclaration fields. 48a9eb87ba [analyzer] Add hint for unnecessary ?. ccb2e2d293 [analyzer] Report dead code for x ?? y where x is non-null 004dd969b0 Remove mock_type.dart, it looks that it is not used. 266ce73e28 Remove CompletionSuggestion.elementUri, replaced with AvailableSuggestionSet. 7ebb0411f3 Rework DartFix listener interface to separate edits from suggestions. 1c576b66bc Generalize FixCodeTask to handle arbitrary numbers of phases. fd377a4d6f Sort file non_nullable_fix.dart 98af688787 Sort dartfix_listener.dart --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f106ea30709b9..d76dea9419c32 100644 --- a/DEPS +++ b/DEPS @@ -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': '5ddd1578096ee1d5bf04be82818f4801d4719a5e', + 'dart_revision': '75ee523f9102ecf3cef648979e09b88468c4a53d', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index e2c16539748fb..3687ca4f2989d 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 5f4a380cb378e7c1d8b1cc1d6742d9a0 +Signature: c3400903d3171173995a2a7eb437b6b0 UNUSED LICENSES: From bbaeba3f35c3414d67e9d1d513c1e505308fb70f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 21 Feb 2019 13:07:52 -0500 Subject: [PATCH 0234/1117] Roll src/third_party/skia 05ff93c43ea5..9a049e6ce39d (11 commits) (#7903) https://skia.googlesource.com/skia.git/%2Blog/05ff93c43ea5..9a049e6ce39d git log 05ff93c43ea57fd62cd1bc36ab7cd9b6112a7ecf..9a049e6ce39d9a7c0270b5f52ca21035e71032ef --date=short --no-merges --format=%ad %ae %s 2019-02-21 bsalomon@google.com SK_API SkExecutor 2019-02-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3f48ecb3efb5..0eee33250ebb (1 commits) 2019-02-21 reed@google.com add subpixel tweaking 2019-02-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms 9374ba7d790a..b7157d764389 (1 commits) 2019-02-21 reed@google.com remove old code behind SK_SUPPORT_LEGACY_SETLENGTH 2019-02-21 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader c1fd4087ddc9..3f48ecb3efb5 (2 commits) 2019-02-21 thakis@chromium.org Remove another semicolon. 2019-02-21 reed@google.com add test for mac aa on fonts 2019-02-21 fmalita@chromium.org [sksg] Hoist empty-bounds check to base RenderNode 2019-02-20 kjlubick@google.com [canvaskit] Upgrade emscripten to .27 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d76dea9419c32..9eb59fa67dd97 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': '05ff93c43ea57fd62cd1bc36ab7cd9b6112a7ecf', + 'skia_revision': '9a049e6ce39d9a7c0270b5f52ca21035e71032ef', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2843df5d20e24..886cc11bc28ec 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 4d97ab682f6fb8caddbd4000b3db475c +Signature: 6d414f70a2508ca7c53b28f953a9811a UNUSED LICENSES: @@ -4900,6 +4900,7 @@ LIBRARY: skia ORIGIN: ../../../third_party/skia/gm/compositor_quads.cpp + ../../../third_party/skia/LICENSE TYPE: LicenseType.bsd FILE: ../../../third_party/skia/gm/compositor_quads.cpp +FILE: ../../../third_party/skia/gm/mac_aa_explorer.cpp FILE: ../../../third_party/skia/gm/mixercolorfilter.cpp FILE: ../../../third_party/skia/gm/skbug_8664.cpp FILE: ../../../third_party/skia/include/gpu/GrContextThreadSafeProxy.h From 93eeb48baee5c24047a4a3cf5b1db234ecc48683 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 21 Feb 2019 10:57:31 -0800 Subject: [PATCH 0235/1117] Revert "Revert "Remove unnecessary entry-point closurization. (#7827)" (#7876)" (#7904) This reverts commit f45572e95f93edb89b6750a4f36ad8ed7c0a2560. --- lib/stub_ui/natives.dart | 2 +- lib/ui/hooks.dart | 24 ++++++++++++------------ lib/ui/natives.dart | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/stub_ui/natives.dart b/lib/stub_ui/natives.dart index d8388a8640e5f..b4325ff356a9c 100644 --- a/lib/stub_ui/natives.dart +++ b/lib/stub_ui/natives.dart @@ -20,7 +20,7 @@ Future _scheduleFrame( })); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') void _setupHooks() { // ignore: unused_element assert(() { // In debug mode, register the schedule frame extension. diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index b1550bf90b1ee..7386663ee5402 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -16,7 +16,7 @@ dynamic _decodeJSON(String message) { return message != null ? json.decode(message) : null; } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _updateWindowMetrics(double devicePixelRatio, double width, @@ -54,11 +54,11 @@ String _localeClosure() { return window.locale.toString(); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element _LocaleClosure _getLocaleClosure() => _localeClosure; -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _updateLocales(List locales) { const int stringsPerLocale = 4; @@ -77,7 +77,7 @@ void _updateLocales(List locales) { _invoke(window.onLocaleChanged, window._onLocaleChangedZone); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _updateUserSettingsData(String jsonData) { final Map data = json.decode(jsonData); @@ -103,14 +103,14 @@ void _updatePlatformBrightness(String brightnessName) { _invoke(window.onPlatformBrightnessChanged, window._onPlatformBrightnessChangedZone); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _updateSemanticsEnabled(bool enabled) { window._semanticsEnabled = enabled; _invoke(window.onSemanticsEnabledChanged, window._onSemanticsEnabledChangedZone); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _updateAccessibilityFeatures(int values) { final AccessibilityFeatures newFeatures = new AccessibilityFeatures._(values); @@ -120,7 +120,7 @@ void _updateAccessibilityFeatures(int values) { _invoke(window.onAccessibilityFeaturesChanged, window._onAccessibilityFlagsChangedZone); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') void _dispatchPlatformMessage(String name, ByteData data, int responseId) { if (window.onPlatformMessage != null) { _invoke3( @@ -137,14 +137,14 @@ void _dispatchPlatformMessage(String name, ByteData data, int responseId) { } } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _dispatchPointerDataPacket(ByteData packet) { if (window.onPointerDataPacket != null) _invoke1(window.onPointerDataPacket, window._onPointerDataPacketZone, _unpackPointerDataPacket(packet)); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _dispatchSemanticsAction(int id, int action, ByteData args) { _invoke3( @@ -156,13 +156,13 @@ void _dispatchSemanticsAction(int id, int action, ByteData args) { ); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _beginFrame(int microseconds) { _invoke1(window.onBeginFrame, window._onBeginFrameZone, new Duration(microseconds: microseconds)); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _drawFrame() { _invoke(window.onDrawFrame, window._onDrawFrameZone); @@ -173,7 +173,7 @@ typedef _UnaryFunction(Null args); // ignore: always_declare_return_types, prefer_generic_function_type_aliases typedef _BinaryFunction(Null args, Null message); -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') // ignore: unused_element void _runMainZoned(Function startMainIsolateFunction, Function userMainFunction) { startMainIsolateFunction((){ diff --git a/lib/ui/natives.dart b/lib/ui/natives.dart index 1e9a0798f96f6..ed83b92e4fdc9 100644 --- a/lib/ui/natives.dart +++ b/lib/ui/natives.dart @@ -29,7 +29,7 @@ Future _scheduleFrame( })); } -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') void _setupHooks() { // ignore: unused_element assert(() { // In debug mode, register the schedule frame extension. @@ -71,7 +71,7 @@ Function _getCallbackFromHandle(int handle) native 'GetCallbackFromHandle'; // Required for gen_snapshot to work correctly. int _isolateId; // ignore: unused_element -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') Function _getPrintClosure() => _print; // ignore: unused_element -@pragma('vm:entry-point') +@pragma('vm:entry-point', 'call') Function _getScheduleMicrotaskClosure() => _scheduleMicrotask; // ignore: unused_element From a5773d12116f90f714f743b223e222b30a43a658 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 21 Feb 2019 13:36:33 -0800 Subject: [PATCH 0236/1117] Do not add ghost runs for trailing whitespace if the text is ellipsized (#7906) --- third_party/txt/src/txt/paragraph.cc | 3 ++- third_party/txt/tests/paragraph_unittests.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index e8a83b96d2464..7c1ab261ebf0e 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -561,7 +561,8 @@ void Paragraph::Layout(double width, bool force) { // let it impact metrics. After layout of the whitespace run, we do not // add its width into the x-offset adjustment, effectively nullifying its // impact on the layout. - if (line_range.end_excluding_whitespace < line_range.end && + if (paragraph_style_.ellipsis.empty() && + line_range.end_excluding_whitespace < line_range.end && bidi_run.start() <= line_range.end && bidi_run.end() > line_end_index) { line_runs.emplace_back(std::max(bidi_run.start(), line_end_index), diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index 622bca0b0fa17..52781a70f7128 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -2496,7 +2496,7 @@ TEST_F(ParagraphTest, Ellipsize) { // Check that the ellipsizer limited the text to one line and did not wrap // to a second line. - ASSERT_EQ(paragraph->records_.size(), 2ull); + ASSERT_EQ(paragraph->records_.size(), 1ull); } // Test for shifting when identical runs of text are built as multiple runs. From aa2b287cbf687adaab257139f8a72ceeb160dc6a Mon Sep 17 00:00:00 2001 From: Stanislav Baranov Date: Thu, 21 Feb 2019 13:45:24 -0800 Subject: [PATCH 0237/1117] Reland #7777 with proper LICENSE (#7888) --- ci/licenses.sh | 4 +- ci/licenses_golden/licenses_flutter | 33 ++++++- shell/platform/android/BUILD.gn | 4 + .../io/flutter/view/ResourceExtractor.java | 65 ++++++++----- sky/packages/sky_engine/LICENSE | 26 ++++++ third_party/bsdiff/LICENSE | 23 +++++ third_party/bsdiff/README.md | 12 +++ .../bsdiff/io/flutter/util/BSDiff.java | 91 +++++++++++++++++++ 8 files changed, 231 insertions(+), 27 deletions(-) create mode 100644 third_party/bsdiff/LICENSE create mode 100644 third_party/bsdiff/README.md create mode 100644 third_party/bsdiff/io/flutter/util/BSDiff.java diff --git a/ci/licenses.sh b/ci/licenses.sh index a8452f36edcc5..fe56fc33148b9 100755 --- a/ci/licenses.sh +++ b/ci/licenses.sh @@ -42,7 +42,7 @@ fi 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. +expectedLicenseCount=3 # When changing this number: Update the error message below as well describing all expected license types. if [ "$actualLicenseCount" -ne "$expectedLicenseCount" ] then @@ -53,6 +53,8 @@ then 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/bsdiff' may have the following copyright instead:" + echo " Copyright 2003-2005 Colin Percival. 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." diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 3d9c0638245c1..31ba579d95761 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -4,6 +4,37 @@ UNUSED LICENSES: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USED LICENSES: +==================================================================================================== +LIBRARY: bsdiff +ORIGIN: ../../../flutter/third_party/bsdiff/LICENSE +TYPE: LicenseType.bsd +FILE: ../../../flutter/third_party/bsdiff/io/flutter/util/BSDiff.java +---------------------------------------------------------------------------------------------------- +Copyright 2003-2005 Colin Percival. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. 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. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 LIBRARY: txt @@ -981,4 +1012,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: 2 +Total license count: 3 diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index ea6ee243977d3..966cd8146592c 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -168,6 +168,10 @@ java_library("flutter_shell_java") { "io/flutter/view/VsyncWaiter.java", ] + java_files += [ + "$flutter_root/third_party/bsdiff/io/flutter/util/BSDiff.java", + ] + deps = [ ":android_support_v13", ":android_support_annotations", diff --git a/shell/platform/android/io/flutter/view/ResourceExtractor.java b/shell/platform/android/io/flutter/view/ResourceExtractor.java index a0e2f0965ad4d..b44bace5f0a4e 100644 --- a/shell/platform/android/io/flutter/view/ResourceExtractor.java +++ b/shell/platform/android/io/flutter/view/ResourceExtractor.java @@ -11,6 +11,7 @@ import android.os.AsyncTask; import android.os.Build; import android.util.Log; +import io.flutter.util.BSDiff; import io.flutter.util.PathUtils; import org.json.JSONObject; @@ -19,6 +20,7 @@ import java.util.HashSet; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; +import java.util.zip.GZIPInputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -29,8 +31,6 @@ class ResourceExtractor { private static final String TAG = "ResourceExtractor"; private static final String TIMESTAMP_PREFIX = "res_timestamp-"; - private static final int BUFFER_SIZE = 16 * 1024; - @SuppressWarnings("deprecation") static long getVersionCode(PackageInfo packageInfo) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { @@ -177,7 +177,6 @@ private void deleteFiles() { private boolean extractAPK(File dataDir) { final AssetManager manager = mContext.getResources().getAssets(); - byte[] buffer = null; for (String asset : mResources) { try { final File output = new File(dataDir, asset); @@ -190,19 +189,11 @@ private boolean extractAPK(File dataDir) { try (InputStream is = manager.open(asset); OutputStream os = new FileOutputStream(output)) { - if (buffer == null) { - buffer = new byte[BUFFER_SIZE]; - } - - int count = 0; - while ((count = is.read(buffer, 0, BUFFER_SIZE)) != -1) { - os.write(buffer, 0, count); - } - - os.flush(); - Log.i(TAG, "Extracted baseline resource " + asset); + copy(is, os); } + Log.i(TAG, "Extracted baseline resource " + asset); + } catch (FileNotFoundException fnfe) { continue; @@ -219,6 +210,8 @@ private boolean extractAPK(File dataDir) { /// Returns true if successfully unpacked update resources or if there is no update, /// otherwise deletes all resources and returns false. private boolean extractUpdate(File dataDir) { + final AssetManager manager = mContext.getResources().getAssets(); + ResourceUpdater resourceUpdater = FlutterMain.getResourceUpdater(); if (resourceUpdater == null) { return true; @@ -245,11 +238,15 @@ private boolean extractUpdate(File dataDir) { return false; } - byte[] buffer = null; for (String asset : mResources) { + boolean useDiff = false; ZipEntry entry = zipFile.getEntry(asset); if (entry == null) { - continue; + useDiff = true; + entry = zipFile.getEntry(asset + ".bzdiff40"); + if (entry == null) { + continue; + } } final File output = new File(dataDir, asset); @@ -260,18 +257,29 @@ private boolean extractUpdate(File dataDir) { output.getParentFile().mkdirs(); } - try (InputStream is = zipFile.getInputStream(entry); - OutputStream os = new FileOutputStream(output)) { - if (buffer == null) { - buffer = new byte[BUFFER_SIZE]; - } + try { + if (useDiff) { + ByteArrayOutputStream diff = new ByteArrayOutputStream(); + try (InputStream is = zipFile.getInputStream(entry)) { + copy(is, diff); + } + + ByteArrayOutputStream orig = new ByteArrayOutputStream(); + try (InputStream is = manager.open(asset)) { + copy(is, orig); + } + + try (OutputStream os = new FileOutputStream(output)) { + os.write(BSDiff.bspatch(orig.toByteArray(), diff.toByteArray())); + } - int count = 0; - while ((count = is.read(buffer, 0, BUFFER_SIZE)) != -1) { - os.write(buffer, 0, count); + } else { + try (InputStream is = zipFile.getInputStream(entry); + OutputStream os = new FileOutputStream(output)) { + copy(is, os); + } } - os.flush(); Log.i(TAG, "Extracted override resource " + asset); } catch (FileNotFoundException fnfe) { @@ -339,4 +347,11 @@ private String checkTimestamp(File dataDir) { return null; } + + private static void copy(InputStream in, OutputStream out) throws IOException { + byte[] buf = new byte[16 * 1024]; + for (int i; (i = in.read(buf)) >= 0; ) { + out.write(buf, 0, i); + } + } } diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index edab381ceabd6..265bc32f112b2 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -3492,6 +3492,32 @@ 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. -------------------------------------------------------------------------------- +bsdiff + +Copyright 2003-2005 Colin Percival. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. 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. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 txt diff --git a/third_party/bsdiff/LICENSE b/third_party/bsdiff/LICENSE new file mode 100644 index 0000000000000..d04a52996551e --- /dev/null +++ b/third_party/bsdiff/LICENSE @@ -0,0 +1,23 @@ +Copyright 2003-2005 Colin Percival. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. 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. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. diff --git a/third_party/bsdiff/README.md b/third_party/bsdiff/README.md new file mode 100644 index 0000000000000..79aac03d0fc2f --- /dev/null +++ b/third_party/bsdiff/README.md @@ -0,0 +1,12 @@ +# BSDiff + +Binary diff/patch algorithm based on +[bsdiff 4.3](http://www.daemonology.net/bsdiff/) by Colin Percival. +It's very effective at compressesing incremental changes in binaries. + +This implementation has the following differences from Colin's code, +to make it easier to read and apply patches in Java and Objective C: + +* Using gzip instead of bzip2 because gzip is included in JDK by default +* Using big- instead of little-endian serialization to simplify Java code +* Using two's complement instead of high-bit coding for negatives numbers diff --git a/third_party/bsdiff/io/flutter/util/BSDiff.java b/third_party/bsdiff/io/flutter/util/BSDiff.java new file mode 100644 index 0000000000000..135882033cbc8 --- /dev/null +++ b/third_party/bsdiff/io/flutter/util/BSDiff.java @@ -0,0 +1,91 @@ +// Copyright 2003-2005 Colin Percival. 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.util; + +import java.io.*; +import java.util.zip.GZIPInputStream; + +/** + * This is a Java port of algorithm from Flutter framework bsdiff.dart. + * Note that this port uses 32-bit ints, which limits data size to 2GB. + **/ +public abstract class BSDiff { + public static byte[] bspatch(byte[] olddata, byte[] diffdata) throws IOException { + InputStream in = new ByteArrayInputStream(diffdata, 0, diffdata.length); + DataInputStream header = new DataInputStream(in); + + byte[] magic = new byte[8]; + header.read(magic); + if (!new String(magic).equals("BZDIFF40")) { + throw new IOException("Invalid magic"); + } + + int ctrllen = (int) header.readLong(); + int datalen = (int) header.readLong(); + int newsize = (int) header.readLong(); + header.close(); + + in = new ByteArrayInputStream(diffdata, 0, diffdata.length); + in.skip(32); + DataInputStream cpf = new DataInputStream(new GZIPInputStream(in)); + + in = new ByteArrayInputStream(diffdata, 0, diffdata.length); + in.skip(32 + ctrllen); + InputStream dpf = new GZIPInputStream(in); + + in = new ByteArrayInputStream(diffdata, 0, diffdata.length); + in.skip(32 + ctrllen + datalen); + InputStream epf = new GZIPInputStream(in); + + byte[] newdata = new byte[newsize]; + + int oldpos = 0; + int newpos = 0; + + while (newpos < newsize) { + int[] ctrl = new int[3]; + for (int i = 0; i <= 2; i++) { + ctrl[i] = (int) cpf.readLong(); + } + if (newpos + ctrl[0] > newsize) { + throw new IOException("Invalid ctrl[0]"); + } + + read(dpf, newdata, newpos, ctrl[0]); + + for (int i = 0; i < ctrl[0]; i++) { + if ((oldpos + i >= 0) && (oldpos + i < olddata.length)) { + newdata[newpos + i] += olddata[oldpos + i]; + } + } + + newpos += ctrl[0]; + oldpos += ctrl[0]; + + if (newpos + ctrl[1] > newsize) { + throw new IOException("Invalid ctrl[0]"); + } + + read(epf, newdata, newpos, ctrl[1]); + + newpos += ctrl[1]; + oldpos += ctrl[2]; + } + + cpf.close(); + dpf.close(); + epf.close(); + + return newdata; + } + + private static void read(InputStream in, byte[] buf, int off, int len) throws IOException { + for (int i, n = 0; n < len; n += i) { + if ((i = in.read(buf, off + n, len - n)) < 0) { + throw new IOException("Unexpected EOF"); + } + } + } +} From 8620579cf469410b9324f8d9a140858fdfed44ec Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 21 Feb 2019 17:11:44 -0500 Subject: [PATCH 0238/1117] Roll src/third_party/skia 9a049e6ce39d..63c4d3596915 (8 commits) (#7909) https://skia.googlesource.com/skia.git/%2Blog/9a049e6ce39d..63c4d3596915 git log 9a049e6ce39d9a7c0270b5f52ca21035e71032ef..63c4d3596915ca38eb47266a98c6f5d99399b52e --date=short --no-merges --format=%ad %ae %s 2019-02-21 mtklein@google.com Revert "remove linear sRGB singleton" 2019-02-21 reed@google.com fix mac format for gm 2019-02-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 0eee33250ebb..3fc635ac4a7f (1 commits) 2019-02-21 scroggo@google.com Remove SK_SUPPORT_LEGACY_ANDROID_CODEC_COLORSPACE 2019-02-21 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-21 egdaniel@google.com Return correct GrBackendFormat when ycbcr conversion is valid. 2019-02-21 reed@google.com add gm for aa gamma 2019-02-13 mtklein@google.com remove linear sRGB singleton The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 9eb59fa67dd97..373170f0e6776 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': '9a049e6ce39d9a7c0270b5f52ca21035e71032ef', + 'skia_revision': '63c4d3596915ca38eb47266a98c6f5d99399b52e', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 886cc11bc28ec..dabd43f2fc8d2 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 6d414f70a2508ca7c53b28f953a9811a +Signature: 4adbd887c4d5bb308d83699e0800a51a UNUSED LICENSES: From 0053c1d5064931d7a690b3d8888d15d72785a079 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 21 Feb 2019 14:24:04 -0800 Subject: [PATCH 0239/1117] Roll src/third_party/dart 75ee523f91..4cff5a4fd6 (6 commits) 4cff5a4fd6 [ VM / Service ] Dynamically load source from linked-in platform kernel bc53c4dcda Update AstBuilder unified collection parsing to reduce error messages e3b8065625 Add support for --dump-info=binary 372537f1e4 Add first support for strict-inference as an analysis option. c49537e743 Support for 'double' fields in summaries. 9cdc189280 Fix bugs in list literals and add some inference tests --- DEPS | 4 ++-- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 373170f0e6776..968abdc462c83 100644 --- a/DEPS +++ b/DEPS @@ -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': '75ee523f9102ecf3cef648979e09b88468c4a53d', + 'dart_revision': '4cff5a4fd6a02c5c4277a9087e6fb69052b120f9', # 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,7 +47,7 @@ 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.15', + 'dart_dart2js_info_tag': '0.6.0', 'dart_dart_style_tag': '1.2.2', 'dart_dartdoc_tag': 'v0.28.2', 'dart_fixnum_tag': '0.10.9', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 3687ca4f2989d..4d19995524e76 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: c3400903d3171173995a2a7eb437b6b0 +Signature: 049b7971585ead7ab4f23b8bdf29853f UNUSED LICENSES: From 3f0ce769e296b977cd0bcd8f4f7390f207ef50a8 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Thu, 21 Feb 2019 15:27:37 -0800 Subject: [PATCH 0240/1117] Revert "Revert "Reland PerformanceOverlayLayer golden test (#7863)" (#7895)" (#7911) This reverts commit 6d8bd99afb16f7a1ebb59a2657ec76802606a581. --- ci/licenses_golden/licenses_flutter | 5 + flow/BUILD.gn | 7 +- flow/flow_run_all_unittests.cc | 32 ++++++ flow/flow_test_utils.cc | 40 ++++++++ flow/flow_test_utils.h | 29 ++++++ flow/layers/performance_overlay_layer.cc | 31 ++++-- flow/layers/performance_overlay_layer.h | 6 +- .../performance_overlay_layer_unittests.cc | 96 ++++++++++++++++++ .../resources/performance_overlay_gold.png | Bin 0 -> 16572 bytes 9 files changed, 234 insertions(+), 12 deletions(-) create mode 100644 flow/flow_run_all_unittests.cc create mode 100644 flow/flow_test_utils.cc create mode 100644 flow/flow_test_utils.h create mode 100644 flow/layers/performance_overlay_layer_unittests.cc create mode 100644 testing/resources/performance_overlay_gold.png diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 31ba579d95761..4509c7d13bb7d 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -88,6 +88,7 @@ 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/performance_overlay_layer_unittests.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.h FILE: ../../../flutter/flow/layers/picture_layer.cc @@ -727,9 +728,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== ==================================================================================================== +LIBRARY: engine LIBRARY: txt ORIGIN: ../../../flutter/third_party/txt/LICENSE TYPE: LicenseType.apache +FILE: ../../../flutter/flow/flow_run_all_unittests.cc +FILE: ../../../flutter/flow/flow_test_utils.cc +FILE: ../../../flutter/flow/flow_test_utils.h FILE: ../../../flutter/third_party/txt/benchmarks/paint_record_benchmarks.cc FILE: ../../../flutter/third_party/txt/benchmarks/paragraph_benchmarks.cc FILE: ../../../flutter/third_party/txt/benchmarks/paragraph_builder_benchmarks.cc diff --git a/flow/BUILD.gn b/flow/BUILD.gn index 6b345aa87a35a..fbbf0e49db095 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -93,13 +93,18 @@ executable("flow_unittests") { testonly = true sources = [ + "flow_run_all_unittests.cc", + "flow_test_utils.h", + "flow_test_utils.cc", "matrix_decomposition_unittests.cc", "raster_cache_unittests.cc", + "layers/performance_overlay_layer_unittests.cc", ] deps = [ ":flow", - "$flutter_root/testing", + "$flutter_root/fml", + "//third_party/googletest:gtest", "//third_party/dart/runtime:libdart_jit", # for tracing "//third_party/skia", ] diff --git a/flow/flow_run_all_unittests.cc b/flow/flow_run_all_unittests.cc new file mode 100644 index 0000000000000..c1755e639b037 --- /dev/null +++ b/flow/flow_run_all_unittests.cc @@ -0,0 +1,32 @@ +/* + * Copyright 2017 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 "flutter/fml/command_line.h" +#include "flutter/fml/logging.h" +#include "gtest/gtest.h" + +#include "flow_test_utils.h" + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + fml::CommandLine cmd = fml::CommandLineFromArgcArgv(argc, argv); + flow::SetGoldenDir( + cmd.GetOptionValueWithDefault("golden-dir", "flutter/testing/resources")); + flow::SetFontFile(cmd.GetOptionValueWithDefault( + "font-file", + "flutter/third_party/txt/third_party/fonts/Roboto-Regular.ttf")); + return RUN_ALL_TESTS(); +} diff --git a/flow/flow_test_utils.cc b/flow/flow_test_utils.cc new file mode 100644 index 0000000000000..0bf6d4c31d4d9 --- /dev/null +++ b/flow/flow_test_utils.cc @@ -0,0 +1,40 @@ +/* + * Copyright 2017 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 + +namespace flow { + +static std::string gGoldenDir; +static std::string gFontFile; + +const std::string& GetGoldenDir() { + return gGoldenDir; +} + +void SetGoldenDir(const std::string& dir) { + gGoldenDir = dir; +} + +const std::string& GetFontFile() { + return gFontFile; +} + +void SetFontFile(const std::string& file) { + gFontFile = file; +} + +} // namespace flow diff --git a/flow/flow_test_utils.h b/flow/flow_test_utils.h new file mode 100644 index 0000000000000..58da75b3f4dde --- /dev/null +++ b/flow/flow_test_utils.h @@ -0,0 +1,29 @@ +/* + * Copyright 2017 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 + +namespace flow { + +const std::string& GetGoldenDir(); + +void SetGoldenDir(const std::string& dir); + +const std::string& GetFontFile(); + +void SetFontFile(const std::string& dir); + +} // namespace flow diff --git a/flow/layers/performance_overlay_layer.cc b/flow/layers/performance_overlay_layer.cc index c80786e866e1b..e7f40058c3bfb 100644 --- a/flow/layers/performance_overlay_layer.cc +++ b/flow/layers/performance_overlay_layer.cc @@ -15,8 +15,12 @@ namespace { void DrawStatisticsText(SkCanvas& canvas, const std::string& string, int x, - int y) { + int y, + const std::string& font_path) { SkFont font; + if (font_path != "") { + font = SkFont(SkTypeface::MakeFromFile(font_path.c_str())); + } font.setSize(15); font.setLinearMetrics(false); SkPaint paint; @@ -33,7 +37,8 @@ void VisualizeStopWatch(SkCanvas& canvas, SkScalar height, bool show_graph, bool show_labels, - const std::string& label_prefix) { + const std::string& label_prefix, + const std::string& font_path) { const int label_x = 8; // distance from x const int label_y = -10; // distance from y+height @@ -51,14 +56,20 @@ void VisualizeStopWatch(SkCanvas& canvas, stream << label_prefix << " " << "max " << max_ms_per_frame << " ms/frame, " << "avg " << average_ms_per_frame << " ms/frame"; - DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y); + DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y, + font_path); } } } // namespace -PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options) - : options_(options) {} +PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options, + const char* font_path) + : options_(options) { + if (font_path != nullptr) { + font_path_ = font_path; + } +} void PerformanceOverlayLayer::Paint(PaintContext& context) const { const int padding = 8; @@ -73,15 +84,15 @@ void PerformanceOverlayLayer::Paint(PaintContext& context) const { SkScalar height = paint_bounds().height() / 2; SkAutoCanvasRestore save(context.leaf_nodes_canvas, true); - VisualizeStopWatch(*context.leaf_nodes_canvas, context.frame_time, x, y, - width, height - padding, - options_ & kVisualizeRasterizerStatistics, - options_ & kDisplayRasterizerStatistics, "GPU"); + VisualizeStopWatch( + *context.leaf_nodes_canvas, context.frame_time, x, y, width, + height - padding, options_ & kVisualizeRasterizerStatistics, + options_ & kDisplayRasterizerStatistics, "GPU", font_path_); VisualizeStopWatch(*context.leaf_nodes_canvas, context.engine_time, x, y + height, width, height - padding, options_ & kVisualizeEngineStatistics, - options_ & kDisplayEngineStatistics, "UI"); + options_ & kDisplayEngineStatistics, "UI", font_path_); } } // namespace flow diff --git a/flow/layers/performance_overlay_layer.h b/flow/layers/performance_overlay_layer.h index b5f20ecbd7a6b..a47b836c49f3a 100644 --- a/flow/layers/performance_overlay_layer.h +++ b/flow/layers/performance_overlay_layer.h @@ -5,6 +5,8 @@ #ifndef FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ #define FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ +#include + #include "flutter/flow/layers/layer.h" #include "flutter/fml/macros.h" @@ -17,12 +19,14 @@ const int kVisualizeEngineStatistics = 1 << 3; class PerformanceOverlayLayer : public Layer { public: - explicit PerformanceOverlayLayer(uint64_t options); + explicit PerformanceOverlayLayer(uint64_t options, + const char* font_path = nullptr); void Paint(PaintContext& context) const override; private: int options_; + std::string font_path_; FML_DISALLOW_COPY_AND_ASSIGN(PerformanceOverlayLayer); }; diff --git a/flow/layers/performance_overlay_layer_unittests.cc b/flow/layers/performance_overlay_layer_unittests.cc new file mode 100644 index 0000000000000..f64f53422fb37 --- /dev/null +++ b/flow/layers/performance_overlay_layer_unittests.cc @@ -0,0 +1,96 @@ +// Copyright 2013 The Flutter 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/flow_test_utils.h" +#include "flutter/flow/layers/performance_overlay_layer.h" +#include "flutter/flow/raster_cache.h" + +#include "third_party/skia/include/core/SkSurface.h" +#include "third_party/skia/include/utils/SkBase64.h" + +#include "gtest/gtest.h" + +// To get the size of kMockedTimes in compile time. +template +constexpr int size(const T (&array)[N]) noexcept { + return N; +} + +constexpr int kMockedTimes[] = {17, 1, 4, 24, 4, 25, 30, 4, 13, 34, + 14, 0, 18, 9, 32, 36, 26, 23, 5, 8, + 32, 18, 29, 16, 29, 18, 0, 36, 33, 10}; + +// Relative to the flutter/src/engine/flutter directory +const char* kGoldenFileName = "performance_overlay_gold.png"; + +// Relative to the flutter/src/engine/flutter directory +const char* kNewGoldenFileName = "performance_overlay_gold_new.png"; + +TEST(PerformanceOverlayLayer, Gold) { + const std::string& golden_dir = flow::GetGoldenDir(); + // This unit test should only be run on Linux (not even on Mac since it's a + // golden test). Hence we don't have to worry about the "/" vs. "\". + std::string golden_file_path = golden_dir + "/" + kGoldenFileName; + std::string new_golden_file_path = golden_dir + "/" + kNewGoldenFileName; + + flow::Stopwatch mock_stopwatch; + for (int i = 0; i < size(kMockedTimes); ++i) { + mock_stopwatch.SetLapTime( + fml::TimeDelta::FromMilliseconds(kMockedTimes[i])); + } + + const SkImageInfo image_info = SkImageInfo::MakeN32Premul(1000, 1000); + sk_sp surface = SkSurface::MakeRaster(image_info); + + ASSERT_TRUE(surface != nullptr); + + flow::TextureRegistry unused_texture_registry; + + flow::Layer::PaintContext paintContext = { + nullptr, surface->getCanvas(), nullptr, mock_stopwatch, + mock_stopwatch, unused_texture_registry, nullptr, false}; + + // Specify font file to ensure the same font across different operation + // systems. + flow::PerformanceOverlayLayer layer(flow::kDisplayRasterizerStatistics | + flow::kVisualizeRasterizerStatistics | + flow::kDisplayEngineStatistics | + flow::kVisualizeEngineStatistics, + flow::GetFontFile().c_str()); + layer.set_paint_bounds(SkRect::MakeWH(1000, 400)); + surface->getCanvas()->clear(SK_ColorTRANSPARENT); + layer.Paint(paintContext); + + sk_sp snapshot = surface->makeImageSnapshot(); + sk_sp snapshot_data = snapshot->encodeToData(); + + sk_sp golden_data = + SkData::MakeFromFileName(golden_file_path.c_str()); + EXPECT_TRUE(golden_data != nullptr) + << "Golden file not found: " << golden_file_path << ".\n" + << "Please either set --golden-dir, or make sure that the unit test is " + << "run from the right directory (e.g., flutter/engine/src)."; + + const bool golden_data_matches = golden_data->equals(snapshot_data.get()); + if (!golden_data_matches) { + SkFILEWStream wstream(new_golden_file_path.c_str()); + wstream.write(snapshot_data->data(), snapshot_data->size()); + wstream.flush(); + + size_t b64_size = + SkBase64::Encode(snapshot_data->data(), snapshot_data->size(), nullptr); + char* b64_data = new char[b64_size]; + SkBase64::Encode(snapshot_data->data(), snapshot_data->size(), b64_data); + + EXPECT_TRUE(golden_data_matches) + << "Golden file mismatch. Please check " + << "the difference between " << kGoldenFileName << " and " + << kNewGoldenFileName << ", and replace the former " + << "with the latter if the difference looks good.\n\n" + << "See also the base64 encoded " << kNewGoldenFileName << ":\n" + << b64_data; + + delete[] b64_data; + } +} diff --git a/testing/resources/performance_overlay_gold.png b/testing/resources/performance_overlay_gold.png new file mode 100644 index 0000000000000000000000000000000000000000..119551f705793600890950be96b6b0d60688cc54 GIT binary patch literal 16572 zcmeI4c~n!`mjAIV3ra+AKuQrPN(B`KCqS7}f{4nbGLKOiWeN}=Od*ys2ndu?fJ{L_ zWD*dNAwY;S$`}~~1QHp;lmrMQB#`hssp{_4@As--zt#PIfBe>}yOt|@FWh_XIeYK3 z_xH17^lc+Ok=;jj3kV2^+`Mt^u7JSKIsPA^@4y+uoPlZZ@hx2Yrl}A(LWLZk3JClt zaP!(#)4+_S@gQ$AN~Zi4Wx?Lg)Aj297sJiYOr)UXq_{fiLEFQ;i&NEP8jEUxz@-Ki zk<$v&AhV_Oh3p*7K|AGnzuJD2L<5(O)Wh;dlf`jT#K4_TM)v&hbcg;s?Qgypb0v(E zAg)&)#f9(dJkJX)JSoA-2I1kA%d&fPek?&9{Ew+*5%aQsCpKpZ~h_Kc9_9&E1NRloHH} z8j(*tp*XF2pBy)KVZVfcfcN70$9utz_x<>4r+~oE-wFZK6cF3-jT-p4_UO@nz7*Is zDl%DS2`=nu75dND#U$OL+7sogNl&%C{Lh{}k^986v}kdm=1!$;vCYI0FYzX7?0>Qj zw*|2Dilt>`J_GlNQ5jFPg8iB>pQ_T;kxpI_SLUi4mB&s;F2u?zw|*xwCn6$(J2JGg zL*NnqY0Gyq#}KjVe=@SYYFS5^^|M0fjHLwxHp(yjv#<1TZ;O5+U9!X`qq9T=1U{}i ze)}f|*L5{Ye@~^{r`wDB_OQ6%$1D=}{qN25N1qDeuR~>SW;L*Uj zvLLpu3U1n*-;&{A8-*-(7JtAf8PdvR`T{i~b$BTjiUq7R= z@dM_{AKrt0vKM;$Ang(ush8&Ue>RvUSj9elEj?Zth76qgJ%WCWbNO>q#9fa})8V`3 zlYiQI|7VMJ+$&(m*ySSgh)u5m;2Q#=TF3q*KHS@@20cC73*txh=|8*v--njppL4{k z&eMeb+bNsV`=fdFs-%sIV@TwQ)O5Q81bjNI;R=F98)ujln6B25xwP%V{QNo0i1H4B zk16BI!gI&;RK&Z|)&rb^*wK$I&qyrN6pf|SKFoOt#cB)5I$lVv$8m~q9Gb4Y@o`RP zM@P>)Ta52w#ua#)w$KEOHw)v<%=P9ZXtJjh>Gn1BY+a?eBgzZ6SKLdvxTsRIZi303 zUd%>)P^nqM(Gk<%Qc^@HJ%el1QUC1%IK_=4$c%3By+8UvMBJf`7jO;y>{fSrmg_^$ z%r(qa`J`JdD0U~b#LLYs?Pa^;{@mPL7h1z6P2{3;mn+7{VqLv6S<@oD{dfhj3Yk+` zUw`6?Lu;LxUP6y1Vc=3x1rBF~Gm`b49+0$K{bIz3&|osOb6&oDckE6NB^6f#Ul zr)hvjqxA{Ogf0(`RJh3Co>%VO7{P}HKsBU|Q51D@(B|?)QxdVt)8@QW$8XpQ7rfU= z1%*ZIVg4Kz&!&C5wz`@;-I0Wkr!5^#9mQ@oRH4y*26p4WOpa8Lf2j1b+sp`|VO&@r z8^ExKl@YWtV=#AP7`U!_z|zZ#0P1L|d}4dbTf_8#RqKHRyE;?0ANZX~7A97srmo2) ze(ug-8_lfF;NBq_-HRT6} z>3uq-vvd5jb%V$1>V+~494aXuD>80?*I;y|B_}6yPMN&j3RswPS|GuX$+hc(@vNc@hc1?K0i%+^;yV=9;;PVxRP`ufDx*jT(= zl^1fWxjiv4L|f=Si?%sxUdof1x*o5A*6?==g(A5n`;?XAPN)ZHgig-&Ua`}WVtjsn z%;c?6CWlCb;kZ8w$(mYN;J8yV+Z#|Xu%4?6gGDSmx_j+y{_i4@E%Q}X-(zLNe>Gsv zI$c;9s}!Q}Jvb72->*Auedu$bhScKHy9F5!T%4pTX=rRrW2K~y7VN-YorzN|Y`|9p zF=h*P?by?u7Q1dHF;8&m4WEe}S9*XHSF zhYqea*VT2J)CG)_Rm3hSoK8!ua49V+%y&K2HS++&WY#uhs>^s#7mlQoYJ8?V>A-O` zS!C39k+6iK#*16Ilc;SLYMVMaIoU%GW7R3y1@hwK7X}ncw}?6t4auD?Ja({2kZkxl zuQ6I5li7>4*xwTy(<67c!1Su8r|05FcQZ4y@ra0s@#5lQvlLoZ7CD`@UW!6ZetHs1 zba&f(NJ1j38~0*S>CDnod=@Ui)XB-@J}_)5)gK9r?aR=Jm4B}gx5g(#?~*EhZjWrZ zI&EWQuA{?2S2lckF2~qd%jdx@!fZDVG1;q^g&qSwom04QN+E)f%f|sCW-9JRq3jQLXVTvlX=O#Gx&u4eF#^JW-4?Z?4LLbiT zmh%PPk(nG5GqsCB!CBi`2dj+`EM92&xqiYNzDOz_{V-4LPDy`z`;Jfjy~gm&8JlV? z(glZB^`s|*%#}77 z+YsD)^rhOvzBhcYZ-ekwj)BQ@0Dqs)%i<;aOtmU&tq+*MG`MU1s0%@>(+TP6>1`+W zM-Q+XSXk&$jllPA3zi2Vz@%lai9;rGw{Qv)tU>)fKt%0RaKY5{C{2C_x)S zO;pmmiRDh6i5Dy^a+l!}?0t5B0BK-?vswiA_mK$*N_MLR1aX zF3p>QyhsUizjV^xa(G`tn@Q04_{_Y1wLik*O^Onf6o`3VbGw#k~3r ze*BoW(U*%W!7jf%al&Q4lT-1osJ&#1 zDD1B9(r`xnPC;|@;X-6-)hu`;X)_DNtLdBsnme&(g_Yhv|9Gj~33pT~A@9MH_4eEA ze0zWQPQ(0?cgEHhsXitqx$*7W)XXwV#WPl`p`IG(XiqY4xm`1arlssPhQ?FtcJQxR zz7H_f?;PkkApdp`=GAEGMVG=C?T++>u(cc*ZxG5I+~z(3u~S`A#p9*Qa7cqI5xYf& zMKKEtmy5G_m$pd8s3Wzv^qWd~UquzwW}^?t-vV}Z(QTyMNhV6H(ZpDDeW5G$BH}p6 zBv1?(uNxA!XhRMTxko;x7jJ-8^IvF-l~5ujgW!ROY;WlV1qF@BqXQ>f^rVBPlSm}e zWQu+8e2H)ZWLXM1_d06mkhr)%78n}B69n89Da6Olnvh|rmomlp4I#hCa8$&^F zj!ra1$&-U9nRG4Q#*`9&!EnIbM43#c_40mTp4j`_IRW>sT~0b(lTEa%hLIZ{Y%-|| z-|^5O>Zqc4TW1w4O12zHiYBSPW{zx`BdeIrWavLGP#~eS= zB&_z(wu$F0~Uej9(Ov%p2zQ?*hAkgM^}Ojni0-k387LuQ)VCiXhA_EV44SkQ|EQ z8J6y-Vz^k3sYO(8TYSWdplGC+cHkU_(%5hXuC1t~v?uhd*2dQ-sr(S<=H{lRBlPs_A*AQp>_=J9yVuXUo{l8~%%*j|s) zq9PkslMHWJ6pY*oRgnj3?T_9f>aRq@%N@&E{jUNknUKRa=0nzE+Cs(?pyCV9J?yii+$|uue5fWcxh>Fl1?*T{O=u>_tKX1<7wh!E9)04i(YR&VgBG|y z47=Xe_FWJ0%lmiSL}T*|@TC5{wn}p|DTR#7K6>-HJCN@&ZcH@Ee;2mr2LmV+s*%#!GTW8P znE1#M>3?ge&Ia-BURRV%*ky+A4sPrRI}p`To7DHTUcIIS9v3IN4$N%64iTjef_Aop zv{q=~>K2=U*kcA4l0BZ-Zk(qL@-z>yCu(jkRk-(nT{iPp?rt3+*?{(iKnaqaiKXSR zjJD9s%*^=CQt^Wa*C@UiOB4!~4Rjb&#gtB)YOnD$|HUCYKN^Tuhlr@AAp7J*%!@R^1eaaHTKPgXmckNV)bY5xcWe`#_GczM38c1X^ z^j8D9s0?>x?h(lpw7Xl{Ab+cQv9Qpj8+!ODuF_ZN0pF=&_y*GI%u|#+!fsi#mAF>sPOSOuTWNqr_ct zYJR$p5*!i|Te8utW4ZB3@ID8vIWZN)Xq-4@(#SB@6ql2}EY`5zp9R9mFeuAj0+-Hq z>P$vX)Y;V5*1k}xUv7K?qJyEa7JE9@q4n7n7Ly3Wld3$4F|Wy*HT;qJC`PRHB*)s?(5uAqNoOcC@yhpsugibvXBg zhD?*Ntc->=Oa8R#r|@cNSQhWqd?N)NwOsdnsHCKW*U^!qEBj7E{eAJ9X^-sUV%|kY zVn}dDKby_Q8X6k<%Z9gtc;@b|Fu%B{P*PBUk&AT@Kj_y2!lU6J@JtAB_$6DNrgC_q zoTpOeMaue}mKJI>jTYmF%FFu$r-N=py-;{aRw~3I{h*2x!ZS1SyREI?hK+g! z1*Hz>Lc(kfHQVC5X=%#tcI%*qH_z*D_kc6jXkyxPbNRPsD6E;Jq{`VWb=A}2+CnRV zoN_{W2rJEmzuUqm-1)CoRb73F+pEXQT$pDsaYUS)oLth<)Agdn0z~SEMnJ9#RAjQAXk9Q ziCzE#o|CuXH^7=$=)yuZ^T0MK{4=0mB)Ncv?rUjrIl!N@*tV(p#>Pg4Fe8M+)QbxJ zWDRI_C|k)*R0d7nr!54Q@|OOsQ3iq*`nCKRy=k!bPEyCrB)@Vf(C~BZ#jLI#Xup|Q zW#0S%bMD;T2JZ<-+yby1>Ij@Z&*M#Yt<6iGPLRnO37U_Y$TNzgQx_FF&R8xR=YR~T zr+?n>g1Y}gYmA@Tb9XQFkd(HN;NEwxP`>W~QQ^o)pRWxo{Co8dV50lu;$ra;VvQdj zN}jH*z5e#QSyAJc=Uz{I{q&??)noXJxt$#{03_A=2coZ$vvp&Eg%iO540Ltj6JSke zwwcw4Od}90($b7?_02aL7#jzvNgKCZk5ezWQ0V1zaOaZ?w7t15_()I|1;XKQE|*2#<_sRim6Vidf=J3wJaa)&JOdN6aTy08ya0S*b8%)7d}Ex#6-i@H8c z9l|60ogGGpKqk9b+nWQC z_L=_txI#7qb(G*)?Ri>B33h60E=So@Hr)H`$Bv53%ws0PhwAUb+dqu{3NlKNQxUu8 z{q8vTW=ptRyxU;UIhM;eICUO4yE7-ZySpE#5!gDrQtF`RnJksO<@pRUBNE+Nk>$3E&Z2WHIWJ_u@MYq3C9#g zuKzf-dYgWJ*Dkx2?sQzxPvDBrR6xQFU}Fkazicu1#$>~amlCa3Q8lL5Q>(hgi!2}) z0~*7noIvPML-Kk(k!7Q!kuMq>OYosRr615adKCYRZTeVjBYCJeA?vd^}64-5vh@0WEl2>)=zTiU}fw zee>iTRRquNm5JD9yPyu$>gzXEhjIGFI-Q%6&)Rr(;_>t>5N^!kh6w`$ekJx;4i%_u z7W|ZQQBYJm;{uYiHV!6yV|n7L%z4$9{3>W1h-}6IV24l!h*Gz= zvm0j)J0y4>=?MarJvqAN0ZMH+0Ka!O#$$Ndl<_4*SKn!-tT8e&mr78}0A(L2p;={T z&zjVMq<`G%uCE+w^uv0ROV2avVXw;xF%aGqBrIqS3vT9q^JhwOC7kkv;Mx5c6sMl) zDxS!hH#cRH!OpN$VB!#hpmI3=>N0#lcHqmz=?@7o~X29uxbo~5nOXR3*s=-^YYqB5X`U&K$A3Q>?UPx`YQ_1H{ zy1+bn_lSaAy=?=5iD}=+n_8L3aL8vtqX7f;E}giZF=hRs-`kEJ&~T^( zp>BUuau4fhst5iRnfuuBf@a1Pz<*hTWO5c{m?^9G#iC?M>vG07B`rc6Z@u}_mX7fz zY`mmT-qnMn4{N~hLxl--Ql)Q1B9WPr4-y55V*~;#@xBxYxEs$bJ(kb=!vDag8iG;{ zuTG9V1WPs+{7>U*>54=9bTn(-xt!(JxWZi^;!EQHJ}&?K?aL=&aeI`bj)J>?=kRB& z^g<5YP|H=xj)v(AL(^$P#N!sSnyh)7anVC)uF8`^@hB*sfspLh6xc|g0O=_L#dJY27u|hGi^chK zwxOhYLZM!~$7#+Yu4fA>E-qdS5|)wMP$MKNHs;AOs7tCQMcoZ5l>=6ueCkt zMFvQ?3qdaRd$m78hMvg~&93EmPsE7h~KtN9qjr|u+#1uo78$b(}_A?TeIQ8V^YbNS3Vz0sDIHp z^MGH1?@TqA?GFfX=6T7)w z-PBzDtWv|{9Irsg@%_l4!9l&4f2+F&2cu%OKX+0`*FP5UaUI5X>3Ygq?(>wC=~LH#`L1GhI3*g}5T)`sQ@K~cqp8XmyZpjy1Xwl1D0c%7cuPO1k*4N#sVjWP+n{7#Pa zAfCc`_aU2OQ!9S&Dk=(5@3{+$h`9WMhi690rX~)6`_I?jS+^@m7T&C@uDLv&cURW< z9LQikKlS*TzOZnMMt23mM8H&{Z4@a~7gU=M@29LVLc3AVagp-E}|DooUF1K1aPIqg>Ne!%Yj9gkTxga$bX z-T(5)-qcU!c@{Z^K+>v(eXZmdk}#Oh+YcX(;HFaX4O+E@F$ie_t<@w^f;QS|NS6Lz%5BtaOoB zx%f*}Pfy`MM4ODN7yaq%?BPt1rMF2zB<-w%-kl5=lSZ!1x62zD%#YTySwP4VwakyB%_U(>q&1!rL4WZTAv|`R6IEWj2SPT()`Qz=k7Q5 ztOA$@OFci8+40FuQq>FbFl2L%r0_jOqH3JX9p}lbtE+bkF4D!E!^KJ(a0CnVw$$`I zZmaVgHz%QS3bJVx$Whw9&_ymkaWq5a>@<%?M{kh;V2s6YYH6;0(V-6x4F%Y4NNENv zS#obHi-umW81Y!jO|iEo0j7Tzh_0QToyOxKbgZPDVVa*?e!w>Zk8G@_VLlMQxi8b) zO&A2=?*nI%$YXtsS*-a*|AozCpsw5;0OeZcv~St+Y&tCLY`7SJ$6IVl7V0DjUYpGa zjO#b}v7(Piw5j)==u`%4HT}81r>ZJ?yuul4mc)1K3^wz#W4S85NmRy5sy;>xNOm1i z6n9;{qoczJkJj7_6p{s||MqmM0h2eU2jR^A7dUW^u2k##`9h}RXSqad3N`9KU?3=B zKUC%C=Pv?ORp$;!RV=+`DxM`1`1KdUgEC96uN<(Hz1b;l!1zEL0@oQ>qw$A>pit*m zyVQubGpDX3o>Xu@d)d$Rs-BRn$LJb0nJ@SO8E12$2o>f^tZFmbyJTatd9%ID0j{?9 zsAZ5GKYEudxD+%@Q-kk+|!fzNxPu4T31%}Uk;#s>|zr}SL zT^xoL-yIy%w9S&)b_krNK(_tJ36!qy87i>7d>|Nrq4xv6>_>=b``sRt?lORnvMQUR zM2#C5J?dm6XbFM#fT9|;(jp~OtbKzGaJhkNR}p`L!j^E{(K)a zj#Ld>p9eI~4hXNN13pzB*5VcbU%VC;7RD@VleVz|sJN=8<}%P7_2Q3?kVy^h?2jv2 zTg$J9>S&ymjUdL5d4g0OtofIn3dRV3v$tB?OR~THJF^43(YY(nZ>*sh>EzI$dp2sB zimslXQgz-Fjc2!Ka0ZK6msgs~LH~=)AduJ9{0n*6m{y>PS_;XA^2TUOPETBQnqn^g zu8m%lzvKk)`e>!QjCHNwd~!>ygv@T)aG-vTgX-8CsWo;ma&nTn#cy}AwvlH>iZuf1 zqbmL|!{_FiycuhmhL#`lKZT0#aXY?A}Q4us3X9F5ulgjsWfyQR#uR zTSp%4!b+r+tx~I-RuQD{C*o9(Tue0}QIJ^yv@y(dBMb2DuT22h?X`l#V6bc)4&pQS z<#hpqjAW(nBrYy23~`sEAX`lU^9^k?#!mtzH|b#XBVG_Ap23&`dq}VlfO5GPb%dm3 zx4hOc)rjUig=c)xn$LH(yk|)b4UJu&pYPgr(M1btWlu^oI37GD8!i^hRRnrvvNMyq zIa+W9ZZ9(k7;80Xj&Ttz0&PfX12!-u%N2B|H4hX>D)1=Vq3p715@*VR@8Dl_FvBEl zr+OH7(F_Rl4gVKk^SI~5qMSXWA{GxZWo8-4%8<%QLa@ zCbnZ}h^42_AfQst##zz?6N_qC^F$LveQ{y$ZyzcR=XxAh;UF1m2RK_whyog++K(#| zMfvGbqCBj4W4S5Hc+b`k=UxJE4jNHFD~Z*neAYWYQhI{a3PTuL43VR+q3nSHV}`hy z^*_FE`>)7a)Me=e)Tp!$^17s?q~44#rXCQqVk>~sbSYjim{Q$~BRha*=5P2-@b7>u z760rT%1o{UXnT*;EK&F`37Kp3c-GbLU$w_V= zw!tL@56uanTj^F|k*LI3>os3b8)6SyRBIzZUr2Uf;L;%gM4CZQ-e!bMFfx}KqFm(> zl#QvVxPY8+*U^mP-dcF*mNs(5rAKnG-O-rz`MIGku^Qt0Q#gam(KRp3Qt{+|uCMp= zSecYqIHVLd(NE~?uonJ3VSzQU^Yp&Ep09Hma*M00C1bG|%tTmNSgb}!*ayA`IyT5@ zvO;~jUY@6r!ZxWRU=Oo7KUNC}*Cz{r(tAL9_VD4nq16QF^Uj`3>$*z+onoN^URRWt zS2V16orbmFMAeHI715v-axIq*n3-|jUES2@ z$I^ET+AEw^OTQskcfbWdv1i!>e(_Nj__ z4NNY9envCM_bx&%aXZ4o9ruFC%?3FZ3&`}h?ZdL~eU17RBz>kpEa&tQsikkxAd(@R zDuVdEM@9Yfj#ZeTV1$q?2%ovDjLp@K4r_>1ZbDms3O0GXj*t<&SWK73E*k?gLD>+S zX~4B$`nuobQZk6*LxZ8yz2CXsRfI z?|!*rH1k>~wkIhi>xNOR1d^JLN`=P0^v6UMh9b(L4Nx1NvHiEV`x_b02 z_CP@YBMb_?c~1j>F48|0uxp9H~rDJ0N4OtciH=%?j|3#bfdXLpOce`wekkT zcg$~pNpkhD4FwzTTSMaQ-a+LH%IB(UF+py>+c_RxJWmH~8H|eb*{}B8#rMb>&SvaI zaq;d5kmV(B6UiihHQ++-Zd#{q<_TZa)SQ_I(Ls{m0n9H10T+=0Em5;CvDnxsV#@b+2Vje=`Ks zuRwm`l@t}ZCxGTj1S!a6zA-|Wbrcd-9}MzG1{~ZVvE6nsAp~?eEggo0ZOPXGE&gRz zRu=k#Q^!hVWaN3!s%yD6U}DUzt*T;1YI%tPKblT^_Nw}W!6K=A#-@AMuFPn#N(F$j zq`32Wd%B9|hz6hpMY{zpa_Z`S!nzZ<#ZFH0!pVF>GS@4UaM{=K(}-9PB!01qr~*>m z>Vsixy=hgyFV@URPtWs$UBdPS7(cH-5K=e6{tpsA-Bd71@9fGZDLJ6WZG)eO?s=BX z=O`q=ajMQcFq2CxR~YB{D7VTpWUcvQ{cLXzD`{Xz<)G+M2IxqG_)j)_+JWrauF`h~ zuLoMKTC2T~OEI&TpwYI9hk6LMzk=>5f`2uchid~lZi^~t^X6Y^jU#IQ1Qxs0an~yT zqUol+=Q!w28XFzcz%sxKSiH06b`5`jAmBGDpm}R-z3TNAH+RWfyM^nt7*^Q6;CSgw zf)5V|SK5u@m)bw2cX#rGD0OKBW?o%6xDBrh?a|(0@wJa9y}&pRzBhn#2Ted0pnH=! z-=9}RD6!jIeT}DMOi9oNm6rw!5P_Qhv)BcbI z4;K~W4LR>Mz)~1z9wFAb69}b5HeZT6_KJ}-*mt2aFW1SfzqCS2V z@ztb{{GuUYuoolpGJH+7A!m1y64{C@z; C%{D;* literal 0 HcmV?d00001 From 5db4b377244bae48bc21e449e616417e68c9a6b9 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Thu, 21 Feb 2019 16:53:20 -0800 Subject: [PATCH 0241/1117] Revert dart rolls (#7913) * Roll back three Dart SDK rolls Revert "Roll src/third_party/dart 75ee523f91..4cff5a4fd6 (6 commits)" Revert "Roll src/third_party/dart 5ddd157809..75ee523f91 (19 commits)" Revert "Roll src/third_party/dart c92d5ca288..5ddd157809 (153 commits)" `pub upgrade` appears to fail 100% reproducibly on broken on Windows. This rollback rolls back both what appears to be the breaking roll (61fc178) and the following roll. This reverts commit 0053c1d5064931d7a690b3d8888d15d72785a079. This reverts commit 1cf6b8b64d42aefcbc6e7d78a2e6df706962751a. This reverts commit 61fc1786fd98f48ee355f800cf5d7aef0fff985b. * Revert "Revert "Revert "Remove unnecessary entry-point closurization. (#7827)" (#7876)" (#7904)" This reverts commit 93eeb48baee5c24047a4a3cf5b1db234ecc48683. --- DEPS | 6 +++--- ci/licenses_golden/licenses_third_party | 5 +---- lib/stub_ui/natives.dart | 2 +- lib/ui/hooks.dart | 24 ++++++++++++------------ lib/ui/natives.dart | 6 +++--- 5 files changed, 20 insertions(+), 23 deletions(-) diff --git a/DEPS b/DEPS index 968abdc462c83..cb6c2cec2933b 100644 --- a/DEPS +++ b/DEPS @@ -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': '4cff5a4fd6a02c5c4277a9087e6fb69052b120f9', + 'dart_revision': 'c92d5ca288da15b54b04c0a40ffe5d94a8883d77', # 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,9 +47,9 @@ 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.6.0', + 'dart_dart2js_info_tag': '0.5.15', 'dart_dart_style_tag': '1.2.2', - 'dart_dartdoc_tag': 'v0.28.2', + 'dart_dartdoc_tag': 'v0.28.1+2', 'dart_fixnum_tag': '0.10.9', 'dart_glob_tag': '1.1.7', 'dart_html_tag': '0.13.3+2', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 4d19995524e76..e97f942e5ae7c 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 049b7971585ead7ab4f23b8bdf29853f +Signature: a76c88a9ff389b1401e9df71fb13c1f6 UNUSED LICENSES: @@ -5707,8 +5707,6 @@ FILE: ../../../third_party/dart/runtime/lib/ffi_dynamic_library.cc FILE: ../../../third_party/dart/runtime/lib/ffi_dynamic_library_patch.dart FILE: ../../../third_party/dart/runtime/lib/ffi_native_type_patch.dart FILE: ../../../third_party/dart/runtime/lib/ffi_patch.dart -FILE: ../../../third_party/dart/runtime/tools/graphexplorer/graphexplorer.html -FILE: ../../../third_party/dart/runtime/tools/graphexplorer/graphexplorer.js FILE: ../../../third_party/dart/runtime/vm/class_id.h FILE: ../../../third_party/dart/runtime/vm/code_entry_kind.h FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier.cc @@ -5753,7 +5751,6 @@ FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm.cc FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm64.cc FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_x64.cc FILE: ../../../third_party/dart/samples/ffi/coordinate.dart -FILE: ../../../third_party/dart/samples/ffi/dylib_utils.dart FILE: ../../../third_party/dart/samples/ffi/sample_ffi_data.dart FILE: ../../../third_party/dart/samples/ffi/sample_ffi_dynamic_library.dart FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions.dart diff --git a/lib/stub_ui/natives.dart b/lib/stub_ui/natives.dart index b4325ff356a9c..d8388a8640e5f 100644 --- a/lib/stub_ui/natives.dart +++ b/lib/stub_ui/natives.dart @@ -20,7 +20,7 @@ Future _scheduleFrame( })); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') void _setupHooks() { // ignore: unused_element assert(() { // In debug mode, register the schedule frame extension. diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index 7386663ee5402..b1550bf90b1ee 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -16,7 +16,7 @@ dynamic _decodeJSON(String message) { return message != null ? json.decode(message) : null; } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _updateWindowMetrics(double devicePixelRatio, double width, @@ -54,11 +54,11 @@ String _localeClosure() { return window.locale.toString(); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element _LocaleClosure _getLocaleClosure() => _localeClosure; -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _updateLocales(List locales) { const int stringsPerLocale = 4; @@ -77,7 +77,7 @@ void _updateLocales(List locales) { _invoke(window.onLocaleChanged, window._onLocaleChangedZone); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _updateUserSettingsData(String jsonData) { final Map data = json.decode(jsonData); @@ -103,14 +103,14 @@ void _updatePlatformBrightness(String brightnessName) { _invoke(window.onPlatformBrightnessChanged, window._onPlatformBrightnessChangedZone); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _updateSemanticsEnabled(bool enabled) { window._semanticsEnabled = enabled; _invoke(window.onSemanticsEnabledChanged, window._onSemanticsEnabledChangedZone); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _updateAccessibilityFeatures(int values) { final AccessibilityFeatures newFeatures = new AccessibilityFeatures._(values); @@ -120,7 +120,7 @@ void _updateAccessibilityFeatures(int values) { _invoke(window.onAccessibilityFeaturesChanged, window._onAccessibilityFlagsChangedZone); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') void _dispatchPlatformMessage(String name, ByteData data, int responseId) { if (window.onPlatformMessage != null) { _invoke3( @@ -137,14 +137,14 @@ void _dispatchPlatformMessage(String name, ByteData data, int responseId) { } } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _dispatchPointerDataPacket(ByteData packet) { if (window.onPointerDataPacket != null) _invoke1(window.onPointerDataPacket, window._onPointerDataPacketZone, _unpackPointerDataPacket(packet)); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _dispatchSemanticsAction(int id, int action, ByteData args) { _invoke3( @@ -156,13 +156,13 @@ void _dispatchSemanticsAction(int id, int action, ByteData args) { ); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _beginFrame(int microseconds) { _invoke1(window.onBeginFrame, window._onBeginFrameZone, new Duration(microseconds: microseconds)); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _drawFrame() { _invoke(window.onDrawFrame, window._onDrawFrameZone); @@ -173,7 +173,7 @@ typedef _UnaryFunction(Null args); // ignore: always_declare_return_types, prefer_generic_function_type_aliases typedef _BinaryFunction(Null args, Null message); -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') // ignore: unused_element void _runMainZoned(Function startMainIsolateFunction, Function userMainFunction) { startMainIsolateFunction((){ diff --git a/lib/ui/natives.dart b/lib/ui/natives.dart index ed83b92e4fdc9..1e9a0798f96f6 100644 --- a/lib/ui/natives.dart +++ b/lib/ui/natives.dart @@ -29,7 +29,7 @@ Future _scheduleFrame( })); } -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') void _setupHooks() { // ignore: unused_element assert(() { // In debug mode, register the schedule frame extension. @@ -71,7 +71,7 @@ Function _getCallbackFromHandle(int handle) native 'GetCallbackFromHandle'; // Required for gen_snapshot to work correctly. int _isolateId; // ignore: unused_element -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') Function _getPrintClosure() => _print; // ignore: unused_element -@pragma('vm:entry-point', 'call') +@pragma('vm:entry-point') Function _getScheduleMicrotaskClosure() => _scheduleMicrotask; // ignore: unused_element From f1f19bba8f0089490962316867bd222727510ac5 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Thu, 21 Feb 2019 17:04:34 -0800 Subject: [PATCH 0242/1117] Revert "Revert "Revert "Reland PerformanceOverlayLayer golden test (#7863)" (#7895)" (#7911)" (#7916) This breaks the Linux build with: ``` [ RUN ] PerformanceOverlayLayer.Gold ../../flutter/flow/layers/performance_overlay_layer_unittests.cc:70: Failure Value of: golden_data != nullptr Actual: false Expected: true Golden file not found: "/b/s/w/ir/k/src/flutter/testing/resources"/performance_overlay_gold.png. Please either set --golden-dir, or make sure that the unit test is run from the right directory (e.g., flutter/engine/src). ``` This reverts commit 3f0ce769e296b977cd0bcd8f4f7390f207ef50a8. --- ci/licenses_golden/licenses_flutter | 5 - flow/BUILD.gn | 7 +- flow/flow_run_all_unittests.cc | 32 ------ flow/flow_test_utils.cc | 40 -------- flow/flow_test_utils.h | 29 ------ flow/layers/performance_overlay_layer.cc | 31 ++---- flow/layers/performance_overlay_layer.h | 6 +- .../performance_overlay_layer_unittests.cc | 96 ------------------ .../resources/performance_overlay_gold.png | Bin 16572 -> 0 bytes 9 files changed, 12 insertions(+), 234 deletions(-) delete mode 100644 flow/flow_run_all_unittests.cc delete mode 100644 flow/flow_test_utils.cc delete mode 100644 flow/flow_test_utils.h delete mode 100644 flow/layers/performance_overlay_layer_unittests.cc delete mode 100644 testing/resources/performance_overlay_gold.png diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 4509c7d13bb7d..31ba579d95761 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -88,7 +88,6 @@ 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/performance_overlay_layer_unittests.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.h FILE: ../../../flutter/flow/layers/picture_layer.cc @@ -728,13 +727,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== ==================================================================================================== -LIBRARY: engine LIBRARY: txt ORIGIN: ../../../flutter/third_party/txt/LICENSE TYPE: LicenseType.apache -FILE: ../../../flutter/flow/flow_run_all_unittests.cc -FILE: ../../../flutter/flow/flow_test_utils.cc -FILE: ../../../flutter/flow/flow_test_utils.h FILE: ../../../flutter/third_party/txt/benchmarks/paint_record_benchmarks.cc FILE: ../../../flutter/third_party/txt/benchmarks/paragraph_benchmarks.cc FILE: ../../../flutter/third_party/txt/benchmarks/paragraph_builder_benchmarks.cc diff --git a/flow/BUILD.gn b/flow/BUILD.gn index fbbf0e49db095..6b345aa87a35a 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -93,18 +93,13 @@ executable("flow_unittests") { testonly = true sources = [ - "flow_run_all_unittests.cc", - "flow_test_utils.h", - "flow_test_utils.cc", "matrix_decomposition_unittests.cc", "raster_cache_unittests.cc", - "layers/performance_overlay_layer_unittests.cc", ] deps = [ ":flow", - "$flutter_root/fml", - "//third_party/googletest:gtest", + "$flutter_root/testing", "//third_party/dart/runtime:libdart_jit", # for tracing "//third_party/skia", ] diff --git a/flow/flow_run_all_unittests.cc b/flow/flow_run_all_unittests.cc deleted file mode 100644 index c1755e639b037..0000000000000 --- a/flow/flow_run_all_unittests.cc +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2017 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 "flutter/fml/command_line.h" -#include "flutter/fml/logging.h" -#include "gtest/gtest.h" - -#include "flow_test_utils.h" - -int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); - fml::CommandLine cmd = fml::CommandLineFromArgcArgv(argc, argv); - flow::SetGoldenDir( - cmd.GetOptionValueWithDefault("golden-dir", "flutter/testing/resources")); - flow::SetFontFile(cmd.GetOptionValueWithDefault( - "font-file", - "flutter/third_party/txt/third_party/fonts/Roboto-Regular.ttf")); - return RUN_ALL_TESTS(); -} diff --git a/flow/flow_test_utils.cc b/flow/flow_test_utils.cc deleted file mode 100644 index 0bf6d4c31d4d9..0000000000000 --- a/flow/flow_test_utils.cc +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017 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 - -namespace flow { - -static std::string gGoldenDir; -static std::string gFontFile; - -const std::string& GetGoldenDir() { - return gGoldenDir; -} - -void SetGoldenDir(const std::string& dir) { - gGoldenDir = dir; -} - -const std::string& GetFontFile() { - return gFontFile; -} - -void SetFontFile(const std::string& file) { - gFontFile = file; -} - -} // namespace flow diff --git a/flow/flow_test_utils.h b/flow/flow_test_utils.h deleted file mode 100644 index 58da75b3f4dde..0000000000000 --- a/flow/flow_test_utils.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2017 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 - -namespace flow { - -const std::string& GetGoldenDir(); - -void SetGoldenDir(const std::string& dir); - -const std::string& GetFontFile(); - -void SetFontFile(const std::string& dir); - -} // namespace flow diff --git a/flow/layers/performance_overlay_layer.cc b/flow/layers/performance_overlay_layer.cc index e7f40058c3bfb..c80786e866e1b 100644 --- a/flow/layers/performance_overlay_layer.cc +++ b/flow/layers/performance_overlay_layer.cc @@ -15,12 +15,8 @@ namespace { void DrawStatisticsText(SkCanvas& canvas, const std::string& string, int x, - int y, - const std::string& font_path) { + int y) { SkFont font; - if (font_path != "") { - font = SkFont(SkTypeface::MakeFromFile(font_path.c_str())); - } font.setSize(15); font.setLinearMetrics(false); SkPaint paint; @@ -37,8 +33,7 @@ void VisualizeStopWatch(SkCanvas& canvas, SkScalar height, bool show_graph, bool show_labels, - const std::string& label_prefix, - const std::string& font_path) { + const std::string& label_prefix) { const int label_x = 8; // distance from x const int label_y = -10; // distance from y+height @@ -56,20 +51,14 @@ void VisualizeStopWatch(SkCanvas& canvas, stream << label_prefix << " " << "max " << max_ms_per_frame << " ms/frame, " << "avg " << average_ms_per_frame << " ms/frame"; - DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y, - font_path); + DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y); } } } // namespace -PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options, - const char* font_path) - : options_(options) { - if (font_path != nullptr) { - font_path_ = font_path; - } -} +PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options) + : options_(options) {} void PerformanceOverlayLayer::Paint(PaintContext& context) const { const int padding = 8; @@ -84,15 +73,15 @@ void PerformanceOverlayLayer::Paint(PaintContext& context) const { SkScalar height = paint_bounds().height() / 2; SkAutoCanvasRestore save(context.leaf_nodes_canvas, true); - VisualizeStopWatch( - *context.leaf_nodes_canvas, context.frame_time, x, y, width, - height - padding, options_ & kVisualizeRasterizerStatistics, - options_ & kDisplayRasterizerStatistics, "GPU", font_path_); + VisualizeStopWatch(*context.leaf_nodes_canvas, context.frame_time, x, y, + width, height - padding, + options_ & kVisualizeRasterizerStatistics, + options_ & kDisplayRasterizerStatistics, "GPU"); VisualizeStopWatch(*context.leaf_nodes_canvas, context.engine_time, x, y + height, width, height - padding, options_ & kVisualizeEngineStatistics, - options_ & kDisplayEngineStatistics, "UI", font_path_); + options_ & kDisplayEngineStatistics, "UI"); } } // namespace flow diff --git a/flow/layers/performance_overlay_layer.h b/flow/layers/performance_overlay_layer.h index a47b836c49f3a..b5f20ecbd7a6b 100644 --- a/flow/layers/performance_overlay_layer.h +++ b/flow/layers/performance_overlay_layer.h @@ -5,8 +5,6 @@ #ifndef FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ #define FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ -#include - #include "flutter/flow/layers/layer.h" #include "flutter/fml/macros.h" @@ -19,14 +17,12 @@ const int kVisualizeEngineStatistics = 1 << 3; class PerformanceOverlayLayer : public Layer { public: - explicit PerformanceOverlayLayer(uint64_t options, - const char* font_path = nullptr); + explicit PerformanceOverlayLayer(uint64_t options); void Paint(PaintContext& context) const override; private: int options_; - std::string font_path_; FML_DISALLOW_COPY_AND_ASSIGN(PerformanceOverlayLayer); }; diff --git a/flow/layers/performance_overlay_layer_unittests.cc b/flow/layers/performance_overlay_layer_unittests.cc deleted file mode 100644 index f64f53422fb37..0000000000000 --- a/flow/layers/performance_overlay_layer_unittests.cc +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2013 The Flutter 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/flow_test_utils.h" -#include "flutter/flow/layers/performance_overlay_layer.h" -#include "flutter/flow/raster_cache.h" - -#include "third_party/skia/include/core/SkSurface.h" -#include "third_party/skia/include/utils/SkBase64.h" - -#include "gtest/gtest.h" - -// To get the size of kMockedTimes in compile time. -template -constexpr int size(const T (&array)[N]) noexcept { - return N; -} - -constexpr int kMockedTimes[] = {17, 1, 4, 24, 4, 25, 30, 4, 13, 34, - 14, 0, 18, 9, 32, 36, 26, 23, 5, 8, - 32, 18, 29, 16, 29, 18, 0, 36, 33, 10}; - -// Relative to the flutter/src/engine/flutter directory -const char* kGoldenFileName = "performance_overlay_gold.png"; - -// Relative to the flutter/src/engine/flutter directory -const char* kNewGoldenFileName = "performance_overlay_gold_new.png"; - -TEST(PerformanceOverlayLayer, Gold) { - const std::string& golden_dir = flow::GetGoldenDir(); - // This unit test should only be run on Linux (not even on Mac since it's a - // golden test). Hence we don't have to worry about the "/" vs. "\". - std::string golden_file_path = golden_dir + "/" + kGoldenFileName; - std::string new_golden_file_path = golden_dir + "/" + kNewGoldenFileName; - - flow::Stopwatch mock_stopwatch; - for (int i = 0; i < size(kMockedTimes); ++i) { - mock_stopwatch.SetLapTime( - fml::TimeDelta::FromMilliseconds(kMockedTimes[i])); - } - - const SkImageInfo image_info = SkImageInfo::MakeN32Premul(1000, 1000); - sk_sp surface = SkSurface::MakeRaster(image_info); - - ASSERT_TRUE(surface != nullptr); - - flow::TextureRegistry unused_texture_registry; - - flow::Layer::PaintContext paintContext = { - nullptr, surface->getCanvas(), nullptr, mock_stopwatch, - mock_stopwatch, unused_texture_registry, nullptr, false}; - - // Specify font file to ensure the same font across different operation - // systems. - flow::PerformanceOverlayLayer layer(flow::kDisplayRasterizerStatistics | - flow::kVisualizeRasterizerStatistics | - flow::kDisplayEngineStatistics | - flow::kVisualizeEngineStatistics, - flow::GetFontFile().c_str()); - layer.set_paint_bounds(SkRect::MakeWH(1000, 400)); - surface->getCanvas()->clear(SK_ColorTRANSPARENT); - layer.Paint(paintContext); - - sk_sp snapshot = surface->makeImageSnapshot(); - sk_sp snapshot_data = snapshot->encodeToData(); - - sk_sp golden_data = - SkData::MakeFromFileName(golden_file_path.c_str()); - EXPECT_TRUE(golden_data != nullptr) - << "Golden file not found: " << golden_file_path << ".\n" - << "Please either set --golden-dir, or make sure that the unit test is " - << "run from the right directory (e.g., flutter/engine/src)."; - - const bool golden_data_matches = golden_data->equals(snapshot_data.get()); - if (!golden_data_matches) { - SkFILEWStream wstream(new_golden_file_path.c_str()); - wstream.write(snapshot_data->data(), snapshot_data->size()); - wstream.flush(); - - size_t b64_size = - SkBase64::Encode(snapshot_data->data(), snapshot_data->size(), nullptr); - char* b64_data = new char[b64_size]; - SkBase64::Encode(snapshot_data->data(), snapshot_data->size(), b64_data); - - EXPECT_TRUE(golden_data_matches) - << "Golden file mismatch. Please check " - << "the difference between " << kGoldenFileName << " and " - << kNewGoldenFileName << ", and replace the former " - << "with the latter if the difference looks good.\n\n" - << "See also the base64 encoded " << kNewGoldenFileName << ":\n" - << b64_data; - - delete[] b64_data; - } -} diff --git a/testing/resources/performance_overlay_gold.png b/testing/resources/performance_overlay_gold.png deleted file mode 100644 index 119551f705793600890950be96b6b0d60688cc54..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16572 zcmeI4c~n!`mjAIV3ra+AKuQrPN(B`KCqS7}f{4nbGLKOiWeN}=Od*ys2ndu?fJ{L_ zWD*dNAwY;S$`}~~1QHp;lmrMQB#`hssp{_4@As--zt#PIfBe>}yOt|@FWh_XIeYK3 z_xH17^lc+Ok=;jj3kV2^+`Mt^u7JSKIsPA^@4y+uoPlZZ@hx2Yrl}A(LWLZk3JClt zaP!(#)4+_S@gQ$AN~Zi4Wx?Lg)Aj297sJiYOr)UXq_{fiLEFQ;i&NEP8jEUxz@-Ki zk<$v&AhV_Oh3p*7K|AGnzuJD2L<5(O)Wh;dlf`jT#K4_TM)v&hbcg;s?Qgypb0v(E zAg)&)#f9(dJkJX)JSoA-2I1kA%d&fPek?&9{Ew+*5%aQsCpKpZ~h_Kc9_9&E1NRloHH} z8j(*tp*XF2pBy)KVZVfcfcN70$9utz_x<>4r+~oE-wFZK6cF3-jT-p4_UO@nz7*Is zDl%DS2`=nu75dND#U$OL+7sogNl&%C{Lh{}k^986v}kdm=1!$;vCYI0FYzX7?0>Qj zw*|2Dilt>`J_GlNQ5jFPg8iB>pQ_T;kxpI_SLUi4mB&s;F2u?zw|*xwCn6$(J2JGg zL*NnqY0Gyq#}KjVe=@SYYFS5^^|M0fjHLwxHp(yjv#<1TZ;O5+U9!X`qq9T=1U{}i ze)}f|*L5{Ye@~^{r`wDB_OQ6%$1D=}{qN25N1qDeuR~>SW;L*Uj zvLLpu3U1n*-;&{A8-*-(7JtAf8PdvR`T{i~b$BTjiUq7R= z@dM_{AKrt0vKM;$Ang(ush8&Ue>RvUSj9elEj?Zth76qgJ%WCWbNO>q#9fa})8V`3 zlYiQI|7VMJ+$&(m*ySSgh)u5m;2Q#=TF3q*KHS@@20cC73*txh=|8*v--njppL4{k z&eMeb+bNsV`=fdFs-%sIV@TwQ)O5Q81bjNI;R=F98)ujln6B25xwP%V{QNo0i1H4B zk16BI!gI&;RK&Z|)&rb^*wK$I&qyrN6pf|SKFoOt#cB)5I$lVv$8m~q9Gb4Y@o`RP zM@P>)Ta52w#ua#)w$KEOHw)v<%=P9ZXtJjh>Gn1BY+a?eBgzZ6SKLdvxTsRIZi303 zUd%>)P^nqM(Gk<%Qc^@HJ%el1QUC1%IK_=4$c%3By+8UvMBJf`7jO;y>{fSrmg_^$ z%r(qa`J`JdD0U~b#LLYs?Pa^;{@mPL7h1z6P2{3;mn+7{VqLv6S<@oD{dfhj3Yk+` zUw`6?Lu;LxUP6y1Vc=3x1rBF~Gm`b49+0$K{bIz3&|osOb6&oDckE6NB^6f#Ul zr)hvjqxA{Ogf0(`RJh3Co>%VO7{P}HKsBU|Q51D@(B|?)QxdVt)8@QW$8XpQ7rfU= z1%*ZIVg4Kz&!&C5wz`@;-I0Wkr!5^#9mQ@oRH4y*26p4WOpa8Lf2j1b+sp`|VO&@r z8^ExKl@YWtV=#AP7`U!_z|zZ#0P1L|d}4dbTf_8#RqKHRyE;?0ANZX~7A97srmo2) ze(ug-8_lfF;NBq_-HRT6} z>3uq-vvd5jb%V$1>V+~494aXuD>80?*I;y|B_}6yPMN&j3RswPS|GuX$+hc(@vNc@hc1?K0i%+^;yV=9;;PVxRP`ufDx*jT(= zl^1fWxjiv4L|f=Si?%sxUdof1x*o5A*6?==g(A5n`;?XAPN)ZHgig-&Ua`}WVtjsn z%;c?6CWlCb;kZ8w$(mYN;J8yV+Z#|Xu%4?6gGDSmx_j+y{_i4@E%Q}X-(zLNe>Gsv zI$c;9s}!Q}Jvb72->*Auedu$bhScKHy9F5!T%4pTX=rRrW2K~y7VN-YorzN|Y`|9p zF=h*P?by?u7Q1dHF;8&m4WEe}S9*XHSF zhYqea*VT2J)CG)_Rm3hSoK8!ua49V+%y&K2HS++&WY#uhs>^s#7mlQoYJ8?V>A-O` zS!C39k+6iK#*16Ilc;SLYMVMaIoU%GW7R3y1@hwK7X}ncw}?6t4auD?Ja({2kZkxl zuQ6I5li7>4*xwTy(<67c!1Su8r|05FcQZ4y@ra0s@#5lQvlLoZ7CD`@UW!6ZetHs1 zba&f(NJ1j38~0*S>CDnod=@Ui)XB-@J}_)5)gK9r?aR=Jm4B}gx5g(#?~*EhZjWrZ zI&EWQuA{?2S2lckF2~qd%jdx@!fZDVG1;q^g&qSwom04QN+E)f%f|sCW-9JRq3jQLXVTvlX=O#Gx&u4eF#^JW-4?Z?4LLbiT zmh%PPk(nG5GqsCB!CBi`2dj+`EM92&xqiYNzDOz_{V-4LPDy`z`;Jfjy~gm&8JlV? z(glZB^`s|*%#}77 z+YsD)^rhOvzBhcYZ-ekwj)BQ@0Dqs)%i<;aOtmU&tq+*MG`MU1s0%@>(+TP6>1`+W zM-Q+XSXk&$jllPA3zi2Vz@%lai9;rGw{Qv)tU>)fKt%0RaKY5{C{2C_x)S zO;pmmiRDh6i5Dy^a+l!}?0t5B0BK-?vswiA_mK$*N_MLR1aX zF3p>QyhsUizjV^xa(G`tn@Q04_{_Y1wLik*O^Onf6o`3VbGw#k~3r ze*BoW(U*%W!7jf%al&Q4lT-1osJ&#1 zDD1B9(r`xnPC;|@;X-6-)hu`;X)_DNtLdBsnme&(g_Yhv|9Gj~33pT~A@9MH_4eEA ze0zWQPQ(0?cgEHhsXitqx$*7W)XXwV#WPl`p`IG(XiqY4xm`1arlssPhQ?FtcJQxR zz7H_f?;PkkApdp`=GAEGMVG=C?T++>u(cc*ZxG5I+~z(3u~S`A#p9*Qa7cqI5xYf& zMKKEtmy5G_m$pd8s3Wzv^qWd~UquzwW}^?t-vV}Z(QTyMNhV6H(ZpDDeW5G$BH}p6 zBv1?(uNxA!XhRMTxko;x7jJ-8^IvF-l~5ujgW!ROY;WlV1qF@BqXQ>f^rVBPlSm}e zWQu+8e2H)ZWLXM1_d06mkhr)%78n}B69n89Da6Olnvh|rmomlp4I#hCa8$&^F zj!ra1$&-U9nRG4Q#*`9&!EnIbM43#c_40mTp4j`_IRW>sT~0b(lTEa%hLIZ{Y%-|| z-|^5O>Zqc4TW1w4O12zHiYBSPW{zx`BdeIrWavLGP#~eS= zB&_z(wu$F0~Uej9(Ov%p2zQ?*hAkgM^}Ojni0-k387LuQ)VCiXhA_EV44SkQ|EQ z8J6y-Vz^k3sYO(8TYSWdplGC+cHkU_(%5hXuC1t~v?uhd*2dQ-sr(S<=H{lRBlPs_A*AQp>_=J9yVuXUo{l8~%%*j|s) zq9PkslMHWJ6pY*oRgnj3?T_9f>aRq@%N@&E{jUNknUKRa=0nzE+Cs(?pyCV9J?yii+$|uue5fWcxh>Fl1?*T{O=u>_tKX1<7wh!E9)04i(YR&VgBG|y z47=Xe_FWJ0%lmiSL}T*|@TC5{wn}p|DTR#7K6>-HJCN@&ZcH@Ee;2mr2LmV+s*%#!GTW8P znE1#M>3?ge&Ia-BURRV%*ky+A4sPrRI}p`To7DHTUcIIS9v3IN4$N%64iTjef_Aop zv{q=~>K2=U*kcA4l0BZ-Zk(qL@-z>yCu(jkRk-(nT{iPp?rt3+*?{(iKnaqaiKXSR zjJD9s%*^=CQt^Wa*C@UiOB4!~4Rjb&#gtB)YOnD$|HUCYKN^Tuhlr@AAp7J*%!@R^1eaaHTKPgXmckNV)bY5xcWe`#_GczM38c1X^ z^j8D9s0?>x?h(lpw7Xl{Ab+cQv9Qpj8+!ODuF_ZN0pF=&_y*GI%u|#+!fsi#mAF>sPOSOuTWNqr_ct zYJR$p5*!i|Te8utW4ZB3@ID8vIWZN)Xq-4@(#SB@6ql2}EY`5zp9R9mFeuAj0+-Hq z>P$vX)Y;V5*1k}xUv7K?qJyEa7JE9@q4n7n7Ly3Wld3$4F|Wy*HT;qJC`PRHB*)s?(5uAqNoOcC@yhpsugibvXBg zhD?*Ntc->=Oa8R#r|@cNSQhWqd?N)NwOsdnsHCKW*U^!qEBj7E{eAJ9X^-sUV%|kY zVn}dDKby_Q8X6k<%Z9gtc;@b|Fu%B{P*PBUk&AT@Kj_y2!lU6J@JtAB_$6DNrgC_q zoTpOeMaue}mKJI>jTYmF%FFu$r-N=py-;{aRw~3I{h*2x!ZS1SyREI?hK+g! z1*Hz>Lc(kfHQVC5X=%#tcI%*qH_z*D_kc6jXkyxPbNRPsD6E;Jq{`VWb=A}2+CnRV zoN_{W2rJEmzuUqm-1)CoRb73F+pEXQT$pDsaYUS)oLth<)Agdn0z~SEMnJ9#RAjQAXk9Q ziCzE#o|CuXH^7=$=)yuZ^T0MK{4=0mB)Ncv?rUjrIl!N@*tV(p#>Pg4Fe8M+)QbxJ zWDRI_C|k)*R0d7nr!54Q@|OOsQ3iq*`nCKRy=k!bPEyCrB)@Vf(C~BZ#jLI#Xup|Q zW#0S%bMD;T2JZ<-+yby1>Ij@Z&*M#Yt<6iGPLRnO37U_Y$TNzgQx_FF&R8xR=YR~T zr+?n>g1Y}gYmA@Tb9XQFkd(HN;NEwxP`>W~QQ^o)pRWxo{Co8dV50lu;$ra;VvQdj zN}jH*z5e#QSyAJc=Uz{I{q&??)noXJxt$#{03_A=2coZ$vvp&Eg%iO540Ltj6JSke zwwcw4Od}90($b7?_02aL7#jzvNgKCZk5ezWQ0V1zaOaZ?w7t15_()I|1;XKQE|*2#<_sRim6Vidf=J3wJaa)&JOdN6aTy08ya0S*b8%)7d}Ex#6-i@H8c z9l|60ogGGpKqk9b+nWQC z_L=_txI#7qb(G*)?Ri>B33h60E=So@Hr)H`$Bv53%ws0PhwAUb+dqu{3NlKNQxUu8 z{q8vTW=ptRyxU;UIhM;eICUO4yE7-ZySpE#5!gDrQtF`RnJksO<@pRUBNE+Nk>$3E&Z2WHIWJ_u@MYq3C9#g zuKzf-dYgWJ*Dkx2?sQzxPvDBrR6xQFU}Fkazicu1#$>~amlCa3Q8lL5Q>(hgi!2}) z0~*7noIvPML-Kk(k!7Q!kuMq>OYosRr615adKCYRZTeVjBYCJeA?vd^}64-5vh@0WEl2>)=zTiU}fw zee>iTRRquNm5JD9yPyu$>gzXEhjIGFI-Q%6&)Rr(;_>t>5N^!kh6w`$ekJx;4i%_u z7W|ZQQBYJm;{uYiHV!6yV|n7L%z4$9{3>W1h-}6IV24l!h*Gz= zvm0j)J0y4>=?MarJvqAN0ZMH+0Ka!O#$$Ndl<_4*SKn!-tT8e&mr78}0A(L2p;={T z&zjVMq<`G%uCE+w^uv0ROV2avVXw;xF%aGqBrIqS3vT9q^JhwOC7kkv;Mx5c6sMl) zDxS!hH#cRH!OpN$VB!#hpmI3=>N0#lcHqmz=?@7o~X29uxbo~5nOXR3*s=-^YYqB5X`U&K$A3Q>?UPx`YQ_1H{ zy1+bn_lSaAy=?=5iD}=+n_8L3aL8vtqX7f;E}giZF=hRs-`kEJ&~T^( zp>BUuau4fhst5iRnfuuBf@a1Pz<*hTWO5c{m?^9G#iC?M>vG07B`rc6Z@u}_mX7fz zY`mmT-qnMn4{N~hLxl--Ql)Q1B9WPr4-y55V*~;#@xBxYxEs$bJ(kb=!vDag8iG;{ zuTG9V1WPs+{7>U*>54=9bTn(-xt!(JxWZi^;!EQHJ}&?K?aL=&aeI`bj)J>?=kRB& z^g<5YP|H=xj)v(AL(^$P#N!sSnyh)7anVC)uF8`^@hB*sfspLh6xc|g0O=_L#dJY27u|hGi^chK zwxOhYLZM!~$7#+Yu4fA>E-qdS5|)wMP$MKNHs;AOs7tCQMcoZ5l>=6ueCkt zMFvQ?3qdaRd$m78hMvg~&93EmPsE7h~KtN9qjr|u+#1uo78$b(}_A?TeIQ8V^YbNS3Vz0sDIHp z^MGH1?@TqA?GFfX=6T7)w z-PBzDtWv|{9Irsg@%_l4!9l&4f2+F&2cu%OKX+0`*FP5UaUI5X>3Ygq?(>wC=~LH#`L1GhI3*g}5T)`sQ@K~cqp8XmyZpjy1Xwl1D0c%7cuPO1k*4N#sVjWP+n{7#Pa zAfCc`_aU2OQ!9S&Dk=(5@3{+$h`9WMhi690rX~)6`_I?jS+^@m7T&C@uDLv&cURW< z9LQikKlS*TzOZnMMt23mM8H&{Z4@a~7gU=M@29LVLc3AVagp-E}|DooUF1K1aPIqg>Ne!%Yj9gkTxga$bX z-T(5)-qcU!c@{Z^K+>v(eXZmdk}#Oh+YcX(;HFaX4O+E@F$ie_t<@w^f;QS|NS6Lz%5BtaOoB zx%f*}Pfy`MM4ODN7yaq%?BPt1rMF2zB<-w%-kl5=lSZ!1x62zD%#YTySwP4VwakyB%_U(>q&1!rL4WZTAv|`R6IEWj2SPT()`Qz=k7Q5 ztOA$@OFci8+40FuQq>FbFl2L%r0_jOqH3JX9p}lbtE+bkF4D!E!^KJ(a0CnVw$$`I zZmaVgHz%QS3bJVx$Whw9&_ymkaWq5a>@<%?M{kh;V2s6YYH6;0(V-6x4F%Y4NNENv zS#obHi-umW81Y!jO|iEo0j7Tzh_0QToyOxKbgZPDVVa*?e!w>Zk8G@_VLlMQxi8b) zO&A2=?*nI%$YXtsS*-a*|AozCpsw5;0OeZcv~St+Y&tCLY`7SJ$6IVl7V0DjUYpGa zjO#b}v7(Piw5j)==u`%4HT}81r>ZJ?yuul4mc)1K3^wz#W4S85NmRy5sy;>xNOm1i z6n9;{qoczJkJj7_6p{s||MqmM0h2eU2jR^A7dUW^u2k##`9h}RXSqad3N`9KU?3=B zKUC%C=Pv?ORp$;!RV=+`DxM`1`1KdUgEC96uN<(Hz1b;l!1zEL0@oQ>qw$A>pit*m zyVQubGpDX3o>Xu@d)d$Rs-BRn$LJb0nJ@SO8E12$2o>f^tZFmbyJTatd9%ID0j{?9 zsAZ5GKYEudxD+%@Q-kk+|!fzNxPu4T31%}Uk;#s>|zr}SL zT^xoL-yIy%w9S&)b_krNK(_tJ36!qy87i>7d>|Nrq4xv6>_>=b``sRt?lORnvMQUR zM2#C5J?dm6XbFM#fT9|;(jp~OtbKzGaJhkNR}p`L!j^E{(K)a zj#Ld>p9eI~4hXNN13pzB*5VcbU%VC;7RD@VleVz|sJN=8<}%P7_2Q3?kVy^h?2jv2 zTg$J9>S&ymjUdL5d4g0OtofIn3dRV3v$tB?OR~THJF^43(YY(nZ>*sh>EzI$dp2sB zimslXQgz-Fjc2!Ka0ZK6msgs~LH~=)AduJ9{0n*6m{y>PS_;XA^2TUOPETBQnqn^g zu8m%lzvKk)`e>!QjCHNwd~!>ygv@T)aG-vTgX-8CsWo;ma&nTn#cy}AwvlH>iZuf1 zqbmL|!{_FiycuhmhL#`lKZT0#aXY?A}Q4us3X9F5ulgjsWfyQR#uR zTSp%4!b+r+tx~I-RuQD{C*o9(Tue0}QIJ^yv@y(dBMb2DuT22h?X`l#V6bc)4&pQS z<#hpqjAW(nBrYy23~`sEAX`lU^9^k?#!mtzH|b#XBVG_Ap23&`dq}VlfO5GPb%dm3 zx4hOc)rjUig=c)xn$LH(yk|)b4UJu&pYPgr(M1btWlu^oI37GD8!i^hRRnrvvNMyq zIa+W9ZZ9(k7;80Xj&Ttz0&PfX12!-u%N2B|H4hX>D)1=Vq3p715@*VR@8Dl_FvBEl zr+OH7(F_Rl4gVKk^SI~5qMSXWA{GxZWo8-4%8<%QLa@ zCbnZ}h^42_AfQst##zz?6N_qC^F$LveQ{y$ZyzcR=XxAh;UF1m2RK_whyog++K(#| zMfvGbqCBj4W4S5Hc+b`k=UxJE4jNHFD~Z*neAYWYQhI{a3PTuL43VR+q3nSHV}`hy z^*_FE`>)7a)Me=e)Tp!$^17s?q~44#rXCQqVk>~sbSYjim{Q$~BRha*=5P2-@b7>u z760rT%1o{UXnT*;EK&F`37Kp3c-GbLU$w_V= zw!tL@56uanTj^F|k*LI3>os3b8)6SyRBIzZUr2Uf;L;%gM4CZQ-e!bMFfx}KqFm(> zl#QvVxPY8+*U^mP-dcF*mNs(5rAKnG-O-rz`MIGku^Qt0Q#gam(KRp3Qt{+|uCMp= zSecYqIHVLd(NE~?uonJ3VSzQU^Yp&Ep09Hma*M00C1bG|%tTmNSgb}!*ayA`IyT5@ zvO;~jUY@6r!ZxWRU=Oo7KUNC}*Cz{r(tAL9_VD4nq16QF^Uj`3>$*z+onoN^URRWt zS2V16orbmFMAeHI715v-axIq*n3-|jUES2@ z$I^ET+AEw^OTQskcfbWdv1i!>e(_Nj__ z4NNY9envCM_bx&%aXZ4o9ruFC%?3FZ3&`}h?ZdL~eU17RBz>kpEa&tQsikkxAd(@R zDuVdEM@9Yfj#ZeTV1$q?2%ovDjLp@K4r_>1ZbDms3O0GXj*t<&SWK73E*k?gLD>+S zX~4B$`nuobQZk6*LxZ8yz2CXsRfI z?|!*rH1k>~wkIhi>xNOR1d^JLN`=P0^v6UMh9b(L4Nx1NvHiEV`x_b02 z_CP@YBMb_?c~1j>F48|0uxp9H~rDJ0N4OtciH=%?j|3#bfdXLpOce`wekkT zcg$~pNpkhD4FwzTTSMaQ-a+LH%IB(UF+py>+c_RxJWmH~8H|eb*{}B8#rMb>&SvaI zaq;d5kmV(B6UiihHQ++-Zd#{q<_TZa)SQ_I(Ls{m0n9H10T+=0Em5;CvDnxsV#@b+2Vje=`Ks zuRwm`l@t}ZCxGTj1S!a6zA-|Wbrcd-9}MzG1{~ZVvE6nsAp~?eEggo0ZOPXGE&gRz zRu=k#Q^!hVWaN3!s%yD6U}DUzt*T;1YI%tPKblT^_Nw}W!6K=A#-@AMuFPn#N(F$j zq`32Wd%B9|hz6hpMY{zpa_Z`S!nzZ<#ZFH0!pVF>GS@4UaM{=K(}-9PB!01qr~*>m z>Vsixy=hgyFV@URPtWs$UBdPS7(cH-5K=e6{tpsA-Bd71@9fGZDLJ6WZG)eO?s=BX z=O`q=ajMQcFq2CxR~YB{D7VTpWUcvQ{cLXzD`{Xz<)G+M2IxqG_)j)_+JWrauF`h~ zuLoMKTC2T~OEI&TpwYI9hk6LMzk=>5f`2uchid~lZi^~t^X6Y^jU#IQ1Qxs0an~yT zqUol+=Q!w28XFzcz%sxKSiH06b`5`jAmBGDpm}R-z3TNAH+RWfyM^nt7*^Q6;CSgw zf)5V|SK5u@m)bw2cX#rGD0OKBW?o%6xDBrh?a|(0@wJa9y}&pRzBhn#2Ted0pnH=! z-=9}RD6!jIeT}DMOi9oNm6rw!5P_Qhv)BcbI z4;K~W4LR>Mz)~1z9wFAb69}b5HeZT6_KJ}-*mt2aFW1SfzqCS2V z@ztb{{GuUYuoolpGJH+7A!m1y64{C@z; C%{D;* From 043d92c48abdebdad926569bc204a59c5cf20a11 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 21 Feb 2019 17:30:17 -0800 Subject: [PATCH 0243/1117] Embedder API for setting the persistent cache path (#7915) Fixes https://github.com/flutter/flutter/issues/28278 --- shell/common/persistent_cache.cc | 32 ++++++++++++++++++++--------- shell/common/persistent_cache.h | 3 +++ shell/platform/embedder/embedder.cc | 7 +++++++ shell/platform/embedder/embedder.h | 4 ++++ 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/shell/common/persistent_cache.cc b/shell/common/persistent_cache.cc index c3f6ebf025034..bab0e7ac1beee 100644 --- a/shell/common/persistent_cache.cc +++ b/shell/common/persistent_cache.cc @@ -17,6 +17,8 @@ namespace shell { +std::string PersistentCache::cache_base_path_; + static std::string SkKeyToFilePath(const SkData& data) { if (data.data() == nullptr || data.size() == 0) { return ""; @@ -40,16 +42,26 @@ PersistentCache* PersistentCache::GetCacheForProcess() { return gPersistentCache.get(); } -PersistentCache::PersistentCache() - : cache_directory_(std::make_shared( - CreateDirectory(fml::paths::GetCachesDirectory(), - { - "flutter_engine", // - blink::GetFlutterEngineVersion(), // - "skia", // - blink::GetSkiaVersion() // - }, - fml::FilePermission::kReadWrite))) { +void PersistentCache::SetCacheDirectoryPath(std::string path) { + cache_base_path_ = path; +} + +PersistentCache::PersistentCache() { + fml::UniqueFD cache_base_dir; + if (cache_base_path_.length()) { + cache_base_dir = fml::OpenDirectory(cache_base_path_.c_str(), false, + fml::FilePermission::kRead); + } else { + cache_base_dir = fml::paths::GetCachesDirectory(); + } + + if (cache_base_dir.is_valid()) { + cache_directory_ = std::make_shared( + CreateDirectory(cache_base_dir, + {"flutter_engine", blink::GetFlutterEngineVersion(), + "skia", blink::GetSkiaVersion()}, + fml::FilePermission::kReadWrite)); + } 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 32465a5c8c091..cc65d6ad621c3 100644 --- a/shell/common/persistent_cache.h +++ b/shell/common/persistent_cache.h @@ -21,6 +21,8 @@ class PersistentCache : public GrContextOptions::PersistentCache { public: static PersistentCache* GetCacheForProcess(); + static void SetCacheDirectoryPath(std::string path); + ~PersistentCache() override; void AddWorkerTaskRunner(fml::RefPtr task_runner); @@ -28,6 +30,7 @@ class PersistentCache : public GrContextOptions::PersistentCache { void RemoveWorkerTaskRunner(fml::RefPtr task_runner); private: + static std::string cache_base_path_; std::shared_ptr cache_directory_; mutable std::mutex worker_task_runners_mutex_; std::multiset> worker_task_runners_ diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index f0f90c1256f2e..6444104a1c253 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -24,6 +24,7 @@ #include "flutter/fml/make_copyable.h" #include "flutter/fml/message_loop.h" #include "flutter/fml/paths.h" +#include "flutter/shell/common/persistent_cache.h" #include "flutter/shell/common/rasterizer.h" #include "flutter/shell/common/switches.h" #include "flutter/shell/platform/embedder/embedder.h" @@ -327,6 +328,12 @@ FlutterEngineResult FlutterEngineRun(size_t version, icu_data_path = SAFE_ACCESS(args, icu_data_path, nullptr); } + if (SAFE_ACCESS(args, persistent_cache_path, nullptr) != nullptr) { + std::string persistent_cache_path = + SAFE_ACCESS(args, persistent_cache_path, nullptr); + shell::PersistentCache::SetCacheDirectoryPath(persistent_cache_path); + } + fml::CommandLine command_line; if (SAFE_ACCESS(args, command_line_argc, 0) != 0 && SAFE_ACCESS(args, command_line_argv, nullptr) != nullptr) { diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 15c5e4922cf8f..0bcd163d594d7 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -505,6 +505,10 @@ typedef struct { // |FlutterEngineRun| call is made. FlutterUpdateSemanticsCustomActionCallback update_semantics_custom_action_callback; + // Path to a directory used to store data that is cached across runs of a + // Flutter application (such as compiled shader programs used by Skia). + // This is optional. The string must be NULL terminated. + const char* persistent_cache_path; } FlutterProjectArgs; FLUTTER_EXPORT From cb0f7ece1f251c78a07550db89d0fcb3edf61e3c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 21 Feb 2019 21:19:21 -0500 Subject: [PATCH 0244/1117] Roll src/third_party/skia 63c4d3596915..e9912ca049a0 (8 commits) (#7918) https://skia.googlesource.com/skia.git/%2Blog/63c4d3596915..e9912ca049a0 git log 63c4d3596915ca38eb47266a98c6f5d99399b52e..e9912ca049a068e34b81012d2e23793dc8573cf7 --date=short --no-merges --format=%ad %ae %s 2019-02-21 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-21 robertphillips@google.com Move StrikeCache and TextBlobCache to RecordingContext 2019-02-21 robertphillips@google.com Revert "SkSL now supports null child processors" 2019-02-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src dca111a7573e..61d99852c465 (495 commits) 2019-02-21 csmartdalton@google.com vk: Hold refs to sampled textures as opposed to raw ptrs 2019-02-21 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 08573730b75a..962c222aa3be (1 commits) 2019-02-21 ethannicholas@google.com SkSL now supports null child processors The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- sky/packages/sky_engine/LICENSE | 52 ++++++++++++++++---------------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/DEPS b/DEPS index cb6c2cec2933b..458c930bbd186 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': '63c4d3596915ca38eb47266a98c6f5d99399b52e', + 'skia_revision': 'e9912ca049a068e34b81012d2e23793dc8573cf7', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index dabd43f2fc8d2..61954664d5f90 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 4adbd887c4d5bb308d83699e0800a51a +Signature: f29054c617196d2428101f0a8fb4a133 UNUSED LICENSES: diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index 265bc32f112b2..dcc3e1b66c6f0 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -3017,6 +3017,32 @@ 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. -------------------------------------------------------------------------------- +bsdiff + +Copyright 2003-2005 Colin Percival. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. 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. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. +-------------------------------------------------------------------------------- colorama Copyright (c) 2010 Jonathan Hartley @@ -3492,32 +3518,6 @@ 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. -------------------------------------------------------------------------------- -bsdiff - -Copyright 2003-2005 Colin Percival. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. 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. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 txt From e849e0b4022f2b9f3b01c10337756817ac3ebcd4 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 22 Feb 2019 01:23:36 -0500 Subject: [PATCH 0245/1117] Roll src/third_party/skia e9912ca049a0..9431161ca973 (2 commits) (#7920) https://skia.googlesource.com/skia.git/%2Blog/e9912ca049a0..9431161ca973 git log e9912ca049a068e34b81012d2e23793dc8573cf7..9431161ca9733f15f21a7ccb1e11ea6ef1cf883f --date=short --no-merges --format=%ad %ae %s 2019-02-21 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3fc635ac4a7f..b607bc8800c1 (2 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 458c930bbd186..6748591f7c588 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': 'e9912ca049a068e34b81012d2e23793dc8573cf7', + 'skia_revision': '9431161ca9733f15f21a7ccb1e11ea6ef1cf883f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 61954664d5f90..134ffe7c463b2 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f29054c617196d2428101f0a8fb4a133 +Signature: 9ea4dd59adc75be2c007bc82703f8946 UNUSED LICENSES: From 4cb9a14992ca29e15df01093462108640dd82ea7 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 21 Feb 2019 22:42:49 -0800 Subject: [PATCH 0246/1117] Allow embedders to add events to the timeline. (#7917) Fixes https://github.com/flutter/flutter/issues/28283 --- shell/platform/embedder/embedder.cc | 13 +++++++++++++ shell/platform/embedder/embedder.h | 22 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 6444104a1c253..d3e05daa1d4e5 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -24,6 +24,7 @@ #include "flutter/fml/make_copyable.h" #include "flutter/fml/message_loop.h" #include "flutter/fml/paths.h" +#include "flutter/fml/trace_event.h" #include "flutter/shell/common/persistent_cache.h" #include "flutter/shell/common/rasterizer.h" #include "flutter/shell/common/switches.h" @@ -808,3 +809,15 @@ FlutterEngineResult FlutterEngineDispatchSemanticsAction( } return kSuccess; } + +void FlutterEngineTraceEventDurationBegin(const char* name) { + fml::tracing::TraceEvent0("flutter", name); +} + +void FlutterEngineTraceEventDurationEnd(const char* name) { + fml::tracing::TraceEventEnd(name); +} + +void FlutterEngineTraceEventInstant(const char* name) { + fml::tracing::TraceEventInstant0("flutter", name); +} diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 0bcd163d594d7..0186ecb2f1bcf 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -596,6 +596,28 @@ FlutterEngineResult FlutterEngineDispatchSemanticsAction( const uint8_t* data, size_t data_length); +// A profiling utility. Logs a trace duration begin event to the timeline. If +// the timeline is unavailable or disabled, this has no effect. Must be +// balanced with an duration end event (via +// |FlutterEngineTraceEventDurationEnd|) with the same name on the same thread. +// Can be called on any thread. +FLUTTER_EXPORT +void FlutterEngineTraceEventDurationBegin(const char* name); + +// A profiling utility. Logs a trace duration end event to the timeline. If +// the timeline is unavailable or disabled, this has no effect. This call must +// be preceeded by a trace duration begin call (via +// |FlutterEngineTraceEventDurationBegin|) with the same name on the same +// thread. Can be called on any thread. +FLUTTER_EXPORT +void FlutterEngineTraceEventDurationEnd(const char* name); + +// A profiling utility. Logs a trace duration instant event to the timeline. If +// the timeline is unavailable or disabled, this has no effect. Can be called +// on any thread. +FLUTTER_EXPORT +void FlutterEngineTraceEventInstant(const char* name); + #if defined(__cplusplus) } // extern "C" #endif From 33bb91cc15916610261097eb971ec8a11b804d06 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 21 Feb 2019 23:02:32 -0800 Subject: [PATCH 0247/1117] Allow embedders to specify a vsync waiter. (#7914) Fixes https://github.com/flutter/flutter/issues/28240 --- ci/licenses_golden/licenses_flutter | 2 + shell/common/vsync_waiter.cc | 4 + shell/common/vsync_waiter.h | 27 +++++-- .../platform/android/vsync_waiter_android.cc | 74 +++++++++---------- shell/platform/android/vsync_waiter_android.h | 13 +++- shell/platform/embedder/BUILD.gn | 2 + shell/platform/embedder/embedder.cc | 35 ++++++++- shell/platform/embedder/embedder.h | 17 +++++ shell/platform/embedder/embedder_engine.cc | 12 +++ shell/platform/embedder/embedder_engine.h | 4 + .../embedder/platform_view_embedder.cc | 11 +++ .../embedder/platform_view_embedder.h | 7 +- .../embedder/vsync_waiter_embedder.cc | 43 +++++++++++ .../platform/embedder/vsync_waiter_embedder.h | 36 +++++++++ 14 files changed, 236 insertions(+), 51 deletions(-) create mode 100644 shell/platform/embedder/vsync_waiter_embedder.cc create mode 100644 shell/platform/embedder/vsync_waiter_embedder.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 31ba579d95761..9a38b32907c28 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -653,6 +653,8 @@ FILE: ../../../flutter/shell/platform/embedder/fixtures/a11y_main.dart 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/platform/embedder/vsync_waiter_embedder.cc +FILE: ../../../flutter/shell/platform/embedder/vsync_waiter_embedder.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 diff --git a/shell/common/vsync_waiter.cc b/shell/common/vsync_waiter.cc index eee6b54193d33..9443fa8a55791 100644 --- a/shell/common/vsync_waiter.cc +++ b/shell/common/vsync_waiter.cc @@ -52,4 +52,8 @@ void VsyncWaiter::FireCallback(fml::TimePoint frame_start_time, }); } +float VsyncWaiter::GetDisplayRefreshRate() const { + return kUnknownRefreshRateFPS; +} + } // namespace shell diff --git a/shell/common/vsync_waiter.h b/shell/common/vsync_waiter.h index 8af5b05abfda0..4c6251da8e277 100644 --- a/shell/common/vsync_waiter.h +++ b/shell/common/vsync_waiter.h @@ -14,8 +14,6 @@ namespace shell { -constexpr float kUnknownRefreshRateFPS = 0.0; - class VsyncWaiter : public std::enable_shared_from_this { public: using Callback = std::function { void AsyncWaitForVsync(Callback callback); - void FireCallback(fml::TimePoint frame_start_time, - fml::TimePoint frame_target_time); + static constexpr float kUnknownRefreshRateFPS = 0.0; // Get the display's maximum refresh rate in the unit of frame per second. - // Return 0.0 if the refresh rate is unkonwn. - virtual float GetDisplayRefreshRate() const { return 0.0; } + // Return kUnknownRefreshRateFPS if the refresh rate is unkonwn. + virtual float GetDisplayRefreshRate() const; protected: + // On some backends, the |FireCallback| needs to be made from a static C + // method. + friend class VsyncWaiterAndroid; + friend class VsyncWaiterEmbedder; + const blink::TaskRunners task_runners_; - std::mutex callback_mutex_; - Callback callback_; VsyncWaiter(blink::TaskRunners task_runners); + // Implementations are meant to override this method and arm their vsync + // latches when in response to this invocation. On vsync, they are meant to + // invoke the |FireCallback| method once (and only once) with the appropriate + // arguments. virtual void AwaitVSync() = 0; + void FireCallback(fml::TimePoint frame_start_time, + fml::TimePoint frame_target_time); + + private: + std::mutex callback_mutex_; + Callback callback_; + FML_DISALLOW_COPY_AND_ASSIGN(VsyncWaiter); }; diff --git a/shell/platform/android/vsync_waiter_android.cc b/shell/platform/android/vsync_waiter_android.cc index bd8cea3600cb2..854d2f21eb062 100644 --- a/shell/platform/android/vsync_waiter_android.cc +++ b/shell/platform/android/vsync_waiter_android.cc @@ -16,10 +16,6 @@ namespace shell { -static void ConsumePendingCallback(jlong java_baton, - fml::TimePoint frame_start_time, - fml::TimePoint frame_target_time); - static fml::jni::ScopedJavaGlobalRef* g_vsync_waiter_class = nullptr; static jmethodID g_async_wait_for_vsync_method_ = nullptr; @@ -30,8 +26,7 @@ VsyncWaiterAndroid::~VsyncWaiterAndroid() = default; // |shell::VsyncWaiter| void VsyncWaiterAndroid::AwaitVSync() { - std::weak_ptr* weak_this = - new std::weak_ptr(shared_from_this()); + auto* weak_this = new std::weak_ptr(shared_from_this()); jlong java_baton = reinterpret_cast(weak_this); task_runners_.GetPlatformTaskRunner()->PostTask([java_baton]() { @@ -43,11 +38,25 @@ void VsyncWaiterAndroid::AwaitVSync() { }); } -static void OnNativeVsync(JNIEnv* env, - jclass jcaller, - jlong frameTimeNanos, - jlong frameTargetTimeNanos, - jlong java_baton) { +float VsyncWaiterAndroid::GetDisplayRefreshRate() const { + JNIEnv* env = fml::jni::AttachCurrentThread(); + if (g_vsync_waiter_class == nullptr) { + return kUnknownRefreshRateFPS; + } + jclass clazz = g_vsync_waiter_class->obj(); + if (clazz == nullptr) { + return kUnknownRefreshRateFPS; + } + jfieldID fid = env->GetStaticFieldID(clazz, "refreshRateFPS", "F"); + return env->GetStaticFloatField(clazz, fid); +} + +// static +void VsyncWaiterAndroid::OnNativeVsync(JNIEnv* env, + jclass jcaller, + jlong frameTimeNanos, + jlong frameTargetTimeNanos, + jlong java_baton) { auto frame_time = fml::TimePoint::FromEpochDelta( fml::TimeDelta::FromNanoseconds(frameTimeNanos)); auto target_time = fml::TimePoint::FromEpochDelta( @@ -56,6 +65,21 @@ static void OnNativeVsync(JNIEnv* env, ConsumePendingCallback(java_baton, frame_time, target_time); } +// static +void VsyncWaiterAndroid::ConsumePendingCallback( + jlong java_baton, + fml::TimePoint frame_start_time, + fml::TimePoint frame_target_time) { + auto* weak_this = reinterpret_cast*>(java_baton); + auto shared_this = weak_this->lock(); + delete weak_this; + + if (shared_this) { + shared_this->FireCallback(frame_start_time, frame_target_time); + } +} + +// static bool VsyncWaiterAndroid::Register(JNIEnv* env) { static const JNINativeMethod methods[] = {{ .name = "nativeOnVsync", @@ -81,32 +105,4 @@ bool VsyncWaiterAndroid::Register(JNIEnv* env) { return env->RegisterNatives(clazz, methods, arraysize(methods)) == 0; } -float VsyncWaiterAndroid::GetDisplayRefreshRate() const { - JNIEnv* env = fml::jni::AttachCurrentThread(); - if (g_vsync_waiter_class == nullptr) { - return kUnknownRefreshRateFPS; - } - jclass clazz = g_vsync_waiter_class->obj(); - if (clazz == nullptr) { - return kUnknownRefreshRateFPS; - } - jfieldID fid = env->GetStaticFieldID(clazz, "refreshRateFPS", "F"); - // We can safely read this 32-bit float from Java in any thread because - // 32-bits read and write are guaranteed to be atomic: - // https://stackoverflow.com/questions/11459543/should-getters-and-setters-be-synchronized/11459616#11459616 - return env->GetStaticFloatField(clazz, fid); -} - -static void ConsumePendingCallback(jlong java_baton, - fml::TimePoint frame_start_time, - fml::TimePoint frame_target_time) { - auto* weak_this = reinterpret_cast*>(java_baton); - auto shared_this = weak_this->lock(); - delete weak_this; - - if (shared_this) { - shared_this->FireCallback(frame_start_time, frame_target_time); - } -} - } // namespace shell diff --git a/shell/platform/android/vsync_waiter_android.h b/shell/platform/android/vsync_waiter_android.h index 76cfbd73667f2..7f6f926418374 100644 --- a/shell/platform/android/vsync_waiter_android.h +++ b/shell/platform/android/vsync_waiter_android.h @@ -6,9 +6,10 @@ #define SHELL_PLATFORM_ANDROID_VSYNC_WAITER_ANDROID_H_ #include + #include + #include "flutter/fml/macros.h" -#include "flutter/fml/memory/weak_ptr.h" #include "flutter/shell/common/vsync_waiter.h" namespace shell { @@ -27,6 +28,16 @@ class VsyncWaiterAndroid final : public VsyncWaiter { // |shell::VsyncWaiter| void AwaitVSync() override; + static void OnNativeVsync(JNIEnv* env, + jclass jcaller, + jlong frameTimeNanos, + jlong frameTargetTimeNanos, + jlong java_baton); + + static void ConsumePendingCallback(jlong java_baton, + fml::TimePoint frame_start_time, + fml::TimePoint frame_target_time); + FML_DISALLOW_COPY_AND_ASSIGN(VsyncWaiterAndroid); }; diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index 2faf89eef0437..94aa7affabae8 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -30,6 +30,8 @@ source_set("embedder") { "embedder_surface_software.h", "platform_view_embedder.cc", "platform_view_embedder.h", + "vsync_waiter_embedder.cc", + "vsync_waiter_embedder.h", ] deps = [ diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index d3e05daa1d4e5..3cce19dc2ce7b 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -478,9 +478,18 @@ FlutterEngineResult FlutterEngineRun(size_t version, }; } + shell::VsyncWaiterEmbedder::VsyncCallback vsync_callback = nullptr; + if (SAFE_ACCESS(args, vsync_callback, nullptr) != nullptr) { + vsync_callback = [ptr = args->vsync_callback, user_data](intptr_t baton) { + return ptr(user_data, baton); + }; + } + shell::PlatformViewEmbedder::PlatformDispatchTable platform_dispatch_table = { - update_semantics_nodes_callback, update_semantics_custom_actions_callback, - platform_message_response_callback, // platform_message_response_callback + update_semantics_nodes_callback, // + update_semantics_custom_actions_callback, // + platform_message_response_callback, // + vsync_callback, // }; auto on_create_platform_view = InferPlatformViewCreationCallback( @@ -810,6 +819,28 @@ FlutterEngineResult FlutterEngineDispatchSemanticsAction( return kSuccess; } +FlutterEngineResult FlutterEngineOnVsync(FlutterEngine engine, + intptr_t baton, + uint64_t frame_start_time_nanos, + uint64_t frame_target_time_nanos) { + if (engine == nullptr) { + return kInvalidArguments; + } + + auto start_time = fml::TimePoint::FromEpochDelta( + fml::TimeDelta::FromNanoseconds(frame_start_time_nanos)); + + auto target_time = fml::TimePoint::FromEpochDelta( + fml::TimeDelta::FromNanoseconds(frame_target_time_nanos)); + + if (!reinterpret_cast(engine)->OnVsyncEvent( + baton, start_time, target_time)) { + return kInternalInconsistency; + } + + return kSuccess; +} + void FlutterEngineTraceEventDurationBegin(const char* name) { fml::tracing::TraceEvent0("flutter", name); } diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 0186ecb2f1bcf..28e4fb4d8582e 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -204,6 +204,7 @@ typedef bool (*TextureFrameCallback)(void* /* user data */, size_t /* width */, size_t /* height */, FlutterOpenGLTexture* /* texture out */); +typedef void (*VsyncCallback)(void* /* user data */, intptr_t /* baton */); typedef struct { // The size of this struct. Must be sizeof(FlutterOpenGLRendererConfig). @@ -509,6 +510,14 @@ typedef struct { // Flutter application (such as compiled shader programs used by Skia). // This is optional. The string must be NULL terminated. const char* persistent_cache_path; + // A callback that gets invoked by the engine when it attempts to wait for + // a platform vsync event. The engine will give the platform a baton that + // needs to be returned back to the engine via |FlutterEngineOnVsync|. All + // vsync operations must occur on the thread that made the call to + // |FlutterEngineRun|. All batons must be retured to the engine before + // initializing a |FlutterEngineShutdown|. Not doing the same will result in a + // memory leak. + VsyncCallback vsync_callback; } FlutterProjectArgs; FLUTTER_EXPORT @@ -596,6 +605,14 @@ FlutterEngineResult FlutterEngineDispatchSemanticsAction( const uint8_t* data, size_t data_length); +// Notify the engine that a vsync event occured. A baton passed to the platform +// via the vsync callback must be returned. +FLUTTER_EXPORT +FlutterEngineResult FlutterEngineOnVsync(FlutterEngine engine, + intptr_t baton, + uint64_t frame_start_time_nanos, + uint64_t frame_target_time_nanos); + // A profiling utility. Logs a trace duration begin event to the timeline. If // the timeline is unavailable or disabled, this has no effect. Must be // balanced with an duration end event (via diff --git a/shell/platform/embedder/embedder_engine.cc b/shell/platform/embedder/embedder_engine.cc index 0f21275879afd..559840bb8d5f0 100644 --- a/shell/platform/embedder/embedder_engine.cc +++ b/shell/platform/embedder/embedder_engine.cc @@ -5,6 +5,7 @@ #include "flutter/shell/platform/embedder/embedder_engine.h" #include "flutter/fml/make_copyable.h" +#include "flutter/shell/platform/embedder/vsync_waiter_embedder.h" namespace shell { @@ -191,4 +192,15 @@ bool EmbedderEngine::DispatchSemanticsAction(int id, return true; } +bool EmbedderEngine::OnVsyncEvent(intptr_t baton, + fml::TimePoint frame_start_time, + fml::TimePoint frame_target_time) { + if (!IsValid()) { + return false; + } + + return VsyncWaiterEmbedder::OnEmbedderVsync(baton, frame_start_time, + frame_target_time); +} + } // namespace shell diff --git a/shell/platform/embedder/embedder_engine.h b/shell/platform/embedder/embedder_engine.h index f5c4399011545..9975eea25d5a1 100644 --- a/shell/platform/embedder/embedder_engine.h +++ b/shell/platform/embedder/embedder_engine.h @@ -59,6 +59,10 @@ class EmbedderEngine { blink::SemanticsAction action, std::vector args); + bool OnVsyncEvent(intptr_t baton, + fml::TimePoint frame_start_time, + fml::TimePoint frame_target_time); + private: const ThreadHost thread_host_; std::unique_ptr shell_; diff --git a/shell/platform/embedder/platform_view_embedder.cc b/shell/platform/embedder/platform_view_embedder.cc index 736a545326aa5..bdb45c072dbe0 100644 --- a/shell/platform/embedder/platform_view_embedder.cc +++ b/shell/platform/embedder/platform_view_embedder.cc @@ -80,4 +80,15 @@ sk_sp PlatformViewEmbedder::CreateResourceContext() const { return embedder_surface_->CreateResourceContext(); } +// |shell::PlatformView| +std::unique_ptr PlatformViewEmbedder::CreateVSyncWaiter() { + if (!platform_dispatch_table_.vsync_callback) { + // Superclass implementation creates a timer based fallback. + return PlatformView::CreateVSyncWaiter(); + } + + return std::make_unique( + platform_dispatch_table_.vsync_callback, task_runners_); +} + } // namespace shell diff --git a/shell/platform/embedder/platform_view_embedder.h b/shell/platform/embedder/platform_view_embedder.h index b57158d95435a..377dd337ddee8 100644 --- a/shell/platform/embedder/platform_view_embedder.h +++ b/shell/platform/embedder/platform_view_embedder.h @@ -13,6 +13,7 @@ #include "flutter/shell/platform/embedder/embedder_surface.h" #include "flutter/shell/platform/embedder/embedder_surface_gl.h" #include "flutter/shell/platform/embedder/embedder_surface_software.h" +#include "flutter/shell/platform/embedder/vsync_waiter_embedder.h" namespace shell { @@ -30,7 +31,8 @@ class PlatformViewEmbedder final : public PlatformView { UpdateSemanticsCustomActionsCallback update_semantics_custom_actions_callback; // optional PlatformMessageResponseCallback - platform_message_response_callback; // optional + platform_message_response_callback; // optional + VsyncWaiterEmbedder::VsyncCallback vsync_callback; // optional }; // Creates a platform view that sets up an OpenGL rasterizer. @@ -68,6 +70,9 @@ class PlatformViewEmbedder final : public PlatformView { // |shell::PlatformView| sk_sp CreateResourceContext() const override; + // |shell::PlatformView| + std::unique_ptr CreateVSyncWaiter() override; + FML_DISALLOW_COPY_AND_ASSIGN(PlatformViewEmbedder); }; diff --git a/shell/platform/embedder/vsync_waiter_embedder.cc b/shell/platform/embedder/vsync_waiter_embedder.cc new file mode 100644 index 0000000000000..3c3509ecc7d0d --- /dev/null +++ b/shell/platform/embedder/vsync_waiter_embedder.cc @@ -0,0 +1,43 @@ +// Copyright 2013 The Flutter 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/vsync_waiter_embedder.h" + +namespace shell { + +VsyncWaiterEmbedder::VsyncWaiterEmbedder(VsyncCallback vsync_callback, + blink::TaskRunners task_runners) + : VsyncWaiter(std::move(task_runners)), vsync_callback_(vsync_callback) { + FML_DCHECK(vsync_callback_); +} + +VsyncWaiterEmbedder::~VsyncWaiterEmbedder() = default; + +// |shell::VsyncWaiter| +void VsyncWaiterEmbedder::AwaitVSync() { + auto* weak_waiter = new std::weak_ptr(shared_from_this()); + vsync_callback_(reinterpret_cast(weak_waiter)); +} + +// static +bool VsyncWaiterEmbedder::OnEmbedderVsync(intptr_t baton, + fml::TimePoint frame_start_time, + fml::TimePoint frame_target_time) { + if (baton == 0) { + return false; + } + + auto* weak_waiter = reinterpret_cast*>(baton); + auto strong_waiter = weak_waiter->lock(); + delete weak_waiter; + + if (!strong_waiter) { + return false; + } + + strong_waiter->FireCallback(frame_start_time, frame_target_time); + return true; +} + +} // namespace shell diff --git a/shell/platform/embedder/vsync_waiter_embedder.h b/shell/platform/embedder/vsync_waiter_embedder.h new file mode 100644 index 0000000000000..fc7700417e0d7 --- /dev/null +++ b/shell/platform/embedder/vsync_waiter_embedder.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 SHELL_PLATFORM_EMBEDDER_VSYNC_WAITER_EMBEDDER_H_ +#define SHELL_PLATFORM_EMBEDDER_VSYNC_WAITER_EMBEDDER_H_ + +#include "flutter/fml/macros.h" +#include "flutter/shell/common/vsync_waiter.h" + +namespace shell { + +class VsyncWaiterEmbedder final : public VsyncWaiter { + public: + using VsyncCallback = std::function; + + VsyncWaiterEmbedder(VsyncCallback callback, blink::TaskRunners task_runners); + + ~VsyncWaiterEmbedder() override; + + static bool OnEmbedderVsync(intptr_t baton, + fml::TimePoint frame_start_time, + fml::TimePoint frame_target_time); + + private: + const VsyncCallback vsync_callback_; + + // |shell::VsyncWaiter| + void AwaitVSync() override; + + FML_DISALLOW_COPY_AND_ASSIGN(VsyncWaiterEmbedder); +}; + +} // namespace shell + +#endif // SHELL_PLATFORM_EMBEDDER_VSYNC_WAITER_EMBEDDER_H_ From 6d4edf2358474d4859038eabe796f3ea2af7bc45 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 22 Feb 2019 05:34:38 -0500 Subject: [PATCH 0248/1117] Roll src/third_party/skia 9431161ca973..969659dbb313 (3 commits) (#7921) https://skia.googlesource.com/skia.git/%2Blog/9431161ca973..969659dbb313 git log 9431161ca9733f15f21a7ccb1e11ea6ef1cf883f..969659dbb3137fb3b5c55e5fc46ec071b6fb5b96 --date=short --no-merges --format=%ad %ae %s 2019-02-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 962c222aa3be..b9039bf76bf3 (2 commits) 2019-02-21 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-22 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 6748591f7c588..27e7adfe134ce 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': '9431161ca9733f15f21a7ccb1e11ea6ef1cf883f', + 'skia_revision': '969659dbb3137fb3b5c55e5fc46ec071b6fb5b96', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 134ffe7c463b2..10d172f2b48f3 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 9ea4dd59adc75be2c007bc82703f8946 +Signature: 7ec1704ea8cbad17a4734d26f42577b0 UNUSED LICENSES: From 2d33e775f6966cde45a3028dff31cfeea6deeb51 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 22 Feb 2019 09:49:17 -0500 Subject: [PATCH 0249/1117] Roll src/third_party/skia 969659dbb313..fdd15284affe (2 commits) (#7922) https://skia.googlesource.com/skia.git/%2Blog/969659dbb313..fdd15284affe git log 969659dbb3137fb3b5c55e5fc46ec071b6fb5b96..fdd15284affe8b18e4ce935ff6c20620a1745166 --date=short --no-merges --format=%ad %ae %s 2019-02-22 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-22 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 27e7adfe134ce..49db2f9fb8774 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': '969659dbb3137fb3b5c55e5fc46ec071b6fb5b96', + 'skia_revision': 'fdd15284affe8b18e4ce935ff6c20620a1745166', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 10d172f2b48f3..9c9dcb3b99a57 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 7ec1704ea8cbad17a4734d26f42577b0 +Signature: 8e00b6f890dbe581d98e96775fc89773 UNUSED LICENSES: From 93f339fb67df2934e618cfca0f9d5bd7982e4bcd Mon Sep 17 00:00:00 2001 From: ashawn Date: Sat, 23 Feb 2019 01:00:15 +0800 Subject: [PATCH 0250/1117] fix Memory leak when using PlatformView [IOS] #24714 (#7919) --- shell/platform/darwin/ios/ios_gl_render_target.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/shell/platform/darwin/ios/ios_gl_render_target.mm b/shell/platform/darwin/ios/ios_gl_render_target.mm index 308c7a5a95866..210d9a9d8c684 100644 --- a/shell/platform/darwin/ios/ios_gl_render_target.mm +++ b/shell/platform/darwin/ios/ios_gl_render_target.mm @@ -62,6 +62,7 @@ } IOSGLRenderTarget::~IOSGLRenderTarget() { + [EAGLContext setCurrentContext:context_]; FML_DCHECK(glGetError() == GL_NO_ERROR); // Deletes on GL_NONEs are ignored From f80928a9e403c6b2fc1b8de6a00bf6189b715c40 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 22 Feb 2019 14:43:17 -0500 Subject: [PATCH 0251/1117] Roll src/third_party/skia fdd15284affe..ee1c8a733e5b (15 commits) (#7924) https://skia.googlesource.com/skia.git/%2Blog/fdd15284affe..ee1c8a733e5b git log fdd15284affe8b18e4ce935ff6c20620a1745166..ee1c8a733e5b31f645bee91ca500b9f6213de77e --date=short --no-merges --format=%ad %ae %s 2019-02-22 ethannicholas@google.com Revert "Revert "SkSL now supports null child processors"" 2019-02-22 bsalomon@google.com Skip newly added TextureIdleProcFlushTest test on Mac/Metal. It crashes. 2019-02-22 brianosman@google.com Add local vs world flag for particle velocity 2019-02-22 jvanverth@google.com Blacklist fontregen on IntelIris655-Vulkan 2019-02-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader b607bc8800c1..7aafb27453d3 (1 commits) 2019-02-22 robertphillips@google.com Move DrawingManager to RecordingContext 2019-02-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 b9039bf76bf3..cf9b2853a7e7 (1 commits) 2019-02-22 egdaniel@google.com Track GrVkResources in command buffer associated with pipeline barriers. 2019-02-21 benjaminwagner@google.com Upgrade MacBookAir7.2 to macOS 10.14; rename jobs to include OS version 2019-02-22 bsalomon@google.com Make it safe to enter the cache from a GrTexture idle proc. 2019-02-22 reed@google.com update docs for backdrop 2019-02-22 kjlubick@google.com [canvaskit] JS API in place for shaped text 2019-02-22 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-21 thomasanderson@chromium.org Make SkFontConfigInterface_direct and sysroot-aware 2019-02-22 reed@google.com add hinting to gm The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/DEPS b/DEPS index 49db2f9fb8774..000c03eb59ff6 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': 'fdd15284affe8b18e4ce935ff6c20620a1745166', + 'skia_revision': 'ee1c8a733e5b31f645bee91ca500b9f6213de77e', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 9c9dcb3b99a57..77d76398c0d0e 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8e00b6f890dbe581d98e96775fc89773 +Signature: 45fe24d6bc61e00f8b5ee46ffada239c UNUSED LICENSES: @@ -1443,6 +1443,7 @@ FILE: ../../../third_party/skia/src/sksl/ast/SkSLASTIntLiteral.h FILE: ../../../third_party/skia/src/sksl/ast/SkSLASTInterfaceBlock.h FILE: ../../../third_party/skia/src/sksl/ast/SkSLASTModifiersDeclaration.h FILE: ../../../third_party/skia/src/sksl/ast/SkSLASTNode.h +FILE: ../../../third_party/skia/src/sksl/ast/SkSLASTNullLiteral.h FILE: ../../../third_party/skia/src/sksl/ast/SkSLASTParameter.h FILE: ../../../third_party/skia/src/sksl/ast/SkSLASTPositionNode.h FILE: ../../../third_party/skia/src/sksl/ast/SkSLASTPrecision.h @@ -1485,6 +1486,7 @@ FILE: ../../../third_party/skia/src/sksl/ir/SkSLLayout.h FILE: ../../../third_party/skia/src/sksl/ir/SkSLModifiers.h FILE: ../../../third_party/skia/src/sksl/ir/SkSLModifiersDeclaration.h FILE: ../../../third_party/skia/src/sksl/ir/SkSLNop.h +FILE: ../../../third_party/skia/src/sksl/ir/SkSLNullLiteral.h FILE: ../../../third_party/skia/src/sksl/ir/SkSLPostfixExpression.h FILE: ../../../third_party/skia/src/sksl/ir/SkSLPrefixExpression.h FILE: ../../../third_party/skia/src/sksl/ir/SkSLProgram.h @@ -2096,6 +2098,7 @@ 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/canvaskit/NotoSerif-Regular.ttf FILE: ../../../third_party/skia/experimental/canvaskit/canvaskit/Roboto-Regular.ttf FILE: ../../../third_party/skia/experimental/canvaskit/canvaskit/Roboto-Regular.woff FILE: ../../../third_party/skia/experimental/canvaskit/canvaskit/example.html @@ -2260,7 +2263,7 @@ FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.e FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/Test-Debian9-Clang-GCE-GPU-SwiftShader-x86_64-Debug-All-SwiftShader.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/Test-Debian9-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Debug-All-OpenCL.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/Test-Debian9-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Debug-All-Vulkan.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/Test-Mac-Clang-MacBookPro11.5-CPU-AVX2-x86_64-Debug-All-ASAN.json +FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/Test-Mac10.13-Clang-MacBookPro11.5-CPU-AVX2-x86_64-Debug-All-ASAN.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/Test-Ubuntu17-GCC-Golo-GPU-QuadroP400-x86_64-Release-All-Valgrind_AbandonGpuContext_SK_CPU_LIMIT_SSE41.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-Vulkan_ProcDump.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/cpu_scale_failed.json @@ -2319,9 +2322,9 @@ FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Debian9-Cl FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-BonusConfigs.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Debian9-Clang-NUC5PPYH-GPU-IntelHD405-x86_64-Debug-All-Vulkan.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Debian9-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Release-All.json -FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Mac-Clang-MacBook10.1-GPU-IntelHD615-x86_64-Release-All-CommandBuffer.json -FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Mac-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Release-All-MoltenVK_Vulkan.json -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-Mac10.13-Clang-MacBook10.1-GPU-IntelHD615-x86_64-Release-All-CommandBuffer.json +FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Mac10.13-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Release-All-MoltenVK_Vulkan.json +FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Mac10.13-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-NUC8i5BEK-GPU-IntelIris655-x86_64-Release-All-Vulkan.json @@ -2368,12 +2371,12 @@ FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Debian9-Cl FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-GPU-SwiftShader-x86_64-Release-All-SwiftShader.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Debian9-Clang-NUC5PPYH-GPU-IntelHD405-x86_64-Release-All-Vulkan.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Debian9-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Debug-All-Vulkan.json -FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Mac-Clang-MacBook10.1-GPU-IntelHD615-x86_64-Release-All-NativeFonts.json -FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Mac-Clang-MacBookAir7.2-GPU-IntelHD6000-x86_64-Debug-All.json -FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Mac-Clang-MacBookPro11.5-CPU-AVX2-x86_64-Release-All.json -FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Mac-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Debug-All-Metal.json -FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Mac-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Release-All-MoltenVK_Vulkan.json -FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Mac-Clang-MacMini7.1-GPU-IntelIris5100-x86_64-Debug-All-CommandBuffer.json +FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Mac10.13-Clang-MacBook10.1-GPU-IntelHD615-x86_64-Release-All-NativeFonts.json +FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Mac10.13-Clang-MacBookPro11.5-CPU-AVX2-x86_64-Release-All.json +FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Mac10.13-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Debug-All-Metal.json +FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Mac10.13-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Release-All-MoltenVK_Vulkan.json +FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Mac10.13-Clang-MacMini7.1-GPU-IntelIris5100-x86_64-Debug-All-CommandBuffer.json +FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Mac10.14-Clang-MacBookAir7.2-GPU-IntelHD6000-x86_64-Debug-All.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Ubuntu17-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-DDL1.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Ubuntu17-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-DDL3.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Ubuntu17-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-Lottie.json @@ -2431,6 +2434,7 @@ FILE: ../../../third_party/skia/infra/bots/test_skia_bundled.isolate FILE: ../../../third_party/skia/infra/bots/tools/luci-go/linux64/isolate.sha1 FILE: ../../../third_party/skia/infra/bots/tools/luci-go/mac64/isolate.sha1 FILE: ../../../third_party/skia/infra/bots/tools/luci-go/win64/isolate.exe.sha1 +FILE: ../../../third_party/skia/infra/canvaskit/docker/canvaskit-emsdk/Dockerfile FILE: ../../../third_party/skia/infra/config/recipes.cfg FILE: ../../../third_party/skia/infra/cross-compile/docker/cross-linux-arm64/Dockerfile FILE: ../../../third_party/skia/infra/cts/whitelist_devices.json From 8529dbc865df7aff250689231c13dc75b9045c70 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 22 Feb 2019 12:44:09 -0800 Subject: [PATCH 0252/1117] Remove unused FML file export.h (#7926) We should not be exporting anything from FML anyway. --- ci/licenses_golden/licenses_flutter | 1 - fml/BUILD.gn | 1 - fml/export.h | 16 ---------------- 3 files changed, 18 deletions(-) delete mode 100644 fml/export.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 9a38b32907c28..e80d512b99e2b 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -128,7 +128,6 @@ 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 diff --git a/fml/BUILD.gn b/fml/BUILD.gn index 3a7d76df80762..6c442c779f62d 100644 --- a/fml/BUILD.gn +++ b/fml/BUILD.gn @@ -13,7 +13,6 @@ source_set("fml") { "command_line.h", "compiler_specific.h", "eintr_wrapper.h", - "export.h", "file.cc", "file.h", "icu_util.cc", diff --git a/fml/export.h b/fml/export.h deleted file mode 100644 index ea9bf883f9ac3..0000000000000 --- a/fml/export.h +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013 The Flutter 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_EXPORT_H_ -#define FLUTTER_FML_EXPORT_H_ - -#include "flutter/fml/build_config.h" - -#if OS_WIN -#define FML_EXPORT __declspec(dllimport) -#else -#define FML_EXPORT __attribute__((visibility("default"))) -#endif - -#endif // FLUTTER_FML_EXPORT_H_ From e2a449a519e78814b4c2700940829994fd451a57 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Fri, 22 Feb 2019 12:48:04 -0800 Subject: [PATCH 0253/1117] Move canvas clear after preroll (#7923) This will reduce 1 render target switch when preroll paints some raster cache. --- flow/compositor_context.cc | 5 +++++ shell/common/rasterizer.cc | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/flow/compositor_context.cc b/flow/compositor_context.cc index 8dc6883597999..30f1132818b2c 100644 --- a/flow/compositor_context.cc +++ b/flow/compositor_context.cc @@ -63,6 +63,11 @@ CompositorContext::ScopedFrame::~ScopedFrame() { bool CompositorContext::ScopedFrame::Raster(flow::LayerTree& layer_tree, bool ignore_raster_cache) { layer_tree.Preroll(*this, ignore_raster_cache); + // Clearing canvas after preroll reduces one render target switch when preroll + // paints some raster cache. + if (canvas()) { + canvas()->clear(SK_ColorTRANSPARENT); + } layer_tree.Paint(*this, ignore_raster_cache); return true; } diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index 48e8ea41aff00..39766a5877c99 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -181,10 +181,6 @@ bool Rasterizer::DrawToSurface(flow::LayerTree& layer_tree) { surface_->GetContext(), canvas, external_view_embedder, surface_->GetRootTransformation(), true); - if (canvas) { - canvas->clear(SK_ColorTRANSPARENT); - } - if (compositor_frame && compositor_frame->Raster(layer_tree, false)) { frame->Submit(); if (external_view_embedder != nullptr) { From 5809adea415605b821704967cd9e0b0fc05ce34a Mon Sep 17 00:00:00 2001 From: Stanislav Baranov Date: Fri, 22 Feb 2019 12:56:35 -0800 Subject: [PATCH 0254/1117] Make the layout of dynamic patch bundle similar to APK. (#7925) This will help further changes when we pull other artifacts into the bundle. --- .../io/flutter/view/ResourceExtractor.java | 16 +++++++++------- .../android/platform_view_android_jni.cc | 5 +++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/shell/platform/android/io/flutter/view/ResourceExtractor.java b/shell/platform/android/io/flutter/view/ResourceExtractor.java index b44bace5f0a4e..5bad736061dc2 100644 --- a/shell/platform/android/io/flutter/view/ResourceExtractor.java +++ b/shell/platform/android/io/flutter/view/ResourceExtractor.java @@ -179,6 +179,7 @@ private boolean extractAPK(File dataDir) { for (String asset : mResources) { try { + final String resource = "assets/" + asset; final File output = new File(dataDir, asset); if (output.exists()) { continue; @@ -192,7 +193,7 @@ private boolean extractAPK(File dataDir) { copy(is, os); } - Log.i(TAG, "Extracted baseline resource " + asset); + Log.i(TAG, "Extracted baseline resource " + resource); } catch (FileNotFoundException fnfe) { continue; @@ -239,11 +240,10 @@ private boolean extractUpdate(File dataDir) { } for (String asset : mResources) { - boolean useDiff = false; - ZipEntry entry = zipFile.getEntry(asset); + final String resource = "assets/" + asset; + ZipEntry entry = zipFile.getEntry(resource); if (entry == null) { - useDiff = true; - entry = zipFile.getEntry(asset + ".bzdiff40"); + entry = zipFile.getEntry(resource + ".bzdiff40"); if (entry == null) { continue; } @@ -258,7 +258,7 @@ private boolean extractUpdate(File dataDir) { } try { - if (useDiff) { + if (entry.getName().endsWith(".bzdiff40")) { ByteArrayOutputStream diff = new ByteArrayOutputStream(); try (InputStream is = zipFile.getInputStream(entry)) { copy(is, diff); @@ -267,6 +267,8 @@ private boolean extractUpdate(File dataDir) { ByteArrayOutputStream orig = new ByteArrayOutputStream(); try (InputStream is = manager.open(asset)) { copy(is, orig); + } catch (FileNotFoundException e) { + throw new IOException("Could not find APK resource " + resource); } try (OutputStream os = new FileOutputStream(output)) { @@ -280,7 +282,7 @@ private boolean extractUpdate(File dataDir) { } } - Log.i(TAG, "Extracted override resource " + asset); + Log.i(TAG, "Extracted override resource " + entry.getName()); } catch (FileNotFoundException fnfe) { continue; diff --git a/shell/platform/android/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index e92d782b3f514..97bcfb6dfe0ff 100644 --- a/shell/platform/android/platform_view_android_jni.cc +++ b/shell/platform/android/platform_view_android_jni.cc @@ -252,8 +252,9 @@ static void RunBundleAndSnapshotFromLibrary(JNIEnv* env, // bundle or a zip asset bundle. const auto file_ext_index = bundlepath.rfind("."); if (bundlepath.substr(file_ext_index) == ".zip") { - asset_manager->PushBack( - std::make_unique(bundlepath, "flutter_assets")); + asset_manager->PushBack(std::make_unique( + bundlepath, "assets/flutter_assets")); + } else { asset_manager->PushBack( std::make_unique(fml::OpenDirectory( From 21c59197e7ee812138caf53fd0daf45186e7ab0e Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Fri, 22 Feb 2019 13:44:02 -0800 Subject: [PATCH 0255/1117] [re-land] Use all font managers to discover fonts for strut. (#7803) --- third_party/txt/src/txt/font_collection.cc | 20 ---- third_party/txt/src/txt/font_collection.h | 4 - third_party/txt/src/txt/paragraph.cc | 31 +++-- third_party/txt/tests/paragraph_unittests.cc | 112 ++++++++++--------- 4 files changed, 76 insertions(+), 91 deletions(-) diff --git a/third_party/txt/src/txt/font_collection.cc b/third_party/txt/src/txt/font_collection.cc index 1592d9227ccfe..ff687726ebed9 100644 --- a/third_party/txt/src/txt/font_collection.cc +++ b/third_party/txt/src/txt/font_collection.cc @@ -178,26 +178,6 @@ FontCollection::GetMinikinFontCollectionForFamilies( return font_collection; } -minikin::MinikinFont* FontCollection::GetMinikinFontForFamilies( - const std::vector& font_families, - minikin::FontStyle style) { - std::shared_ptr font_family = nullptr; - for (std::string family_name : font_families) { - font_family = FindFontFamilyInManagers(family_name); - if (font_family != nullptr) { - break; - } - } - if (font_family == nullptr) { - const auto default_font_family = GetDefaultFontFamily(); - font_family = FindFontFamilyInManagers(default_font_family); - } - if (font_family == nullptr) { - return nullptr; - } - return font_family.get()->getClosestMatch(style).font; -} - std::shared_ptr FontCollection::FindFontFamilyInManagers( const std::string& family_name) { // Search for the font family in each font manager. diff --git a/third_party/txt/src/txt/font_collection.h b/third_party/txt/src/txt/font_collection.h index fe05c9f6d97be..c98b4d29ca05d 100644 --- a/third_party/txt/src/txt/font_collection.h +++ b/third_party/txt/src/txt/font_collection.h @@ -49,10 +49,6 @@ class FontCollection : public std::enable_shared_from_this { const std::vector& font_families, const std::string& locale); - minikin::MinikinFont* GetMinikinFontForFamilies( - const std::vector& font_families, - minikin::FontStyle style); - // Provides a FontFamily that contains glyphs for ch. This caches previously // matched fonts. Also see FontCollection::DoMatchFallbackFont. const std::shared_ptr& MatchFallbackFont( diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index 7c1ab261ebf0e..b08bf3559c138 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -441,18 +441,25 @@ void Paragraph::ComputeStrut(StrutMetrics* strut, SkFont& font) { // force_strut makes all lines have exactly the strut metrics, and ignores all // actual metrics. We only force the strut if the strut is non-zero and valid. strut->force_strut = paragraph_style_.force_strut_height && valid_strut; - const FontSkia* font_skia = - static_cast(font_collection_->GetMinikinFontForFamilies( - paragraph_style_.strut_font_families, - // TODO(garyq): The variant is currently set to 0 (default) as we do - // not have a property to set it with. We should eventually support - // default, compact, and elegant variants. - minikin::FontStyle( - 0, GetWeight(paragraph_style_.strut_font_weight), - paragraph_style_.strut_font_style == FontStyle::italic))); - - if (font_skia != nullptr) { - font.setTypeface(font_skia->GetSkTypeface()); + minikin::FontStyle minikin_font_style( + 0, GetWeight(paragraph_style_.strut_font_weight), + paragraph_style_.strut_font_style == FontStyle::italic); + + std::shared_ptr collection = + font_collection_->GetMinikinFontCollectionForFamilies( + paragraph_style_.strut_font_families, ""); + if (!collection) { + return; + } + minikin::FakedFont faked_font = collection->baseFontFaked(minikin_font_style); + + if (faked_font.font != nullptr) { + SkString str; + static_cast(faked_font.font) + ->GetSkTypeface() + ->getFamilyName(&str); + FML_DLOG(ERROR) << str.c_str(); + font.setTypeface(static_cast(faked_font.font)->GetSkTypeface()); font.setSize(paragraph_style_.strut_font_size); SkFontMetrics strut_metrics; font.getMetrics(&strut_metrics); diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index 52781a70f7128..0d08bfc7fc5b5 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -2838,7 +2838,7 @@ TEST_F(ParagraphTest, FontFallbackParagraph) { // // TODO(garyq): Re-enable strut tests, allow font metric fakery, or // consolidate skia font metric behavior. -TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { +TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph1)) { // The chinese extra height should be absorbed by the strut. const char* text = "01234満毎冠p来É本可\nabcd\n満毎É行p昼本可"; auto icu_text = icu::UnicodeString::fromUTF8(text); @@ -2850,7 +2850,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { paragraph_style.strut_font_families = std::vector(1, "BlahFake"); paragraph_style.strut_font_families.push_back("ahem"); paragraph_style.strut_font_size = 50; - paragraph_style.strut_height = 1.5; + paragraph_style.strut_height = 1.8; paragraph_style.strut_leading = 0.1; paragraph_style.strut_enabled = true; @@ -2864,7 +2864,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { text_style.font_weight = FontWeight::w500; text_style.word_spacing = 0; text_style.color = SK_ColorBLACK; - text_style.height = 1; + text_style.height = .5; builder.PushStyle(text_style); builder.AddText(u16_text); @@ -2903,9 +2903,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_NEAR(boxes[0].rect.top(), 34.5, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80.313477); + EXPECT_NEAR(boxes[0].rect.bottom(), 84.5, 0.0001); boxes = paragraph->GetRectsForRange(0, 1, rect_height_max_style, rect_width_style); @@ -2914,9 +2914,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_NEAR(boxes[0].rect.top(), 34.5, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 95); boxes = paragraph->GetRectsForRange(6, 10, rect_height_style, rect_width_style); @@ -2925,9 +2925,10 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_NEAR(boxes[0].rect.top(), 34.5, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80.313477); + EXPECT_NEAR(boxes[0].rect.bottom(), 84.5, 0.0001); + ; boxes = paragraph->GetRectsForRange(6, 10, rect_height_max_style, rect_width_style); @@ -2936,9 +2937,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_NEAR(boxes[0].rect.top(), 34.5, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 95); boxes = paragraph->GetRectsForRange(14, 16, rect_height_max_style, rect_width_style); @@ -2947,9 +2948,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 208.31348); + EXPECT_NEAR(boxes[0].rect.top(), 224.5, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 100); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 267); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 285); boxes = paragraph->GetRectsForRange(20, 25, rect_height_max_style, rect_width_style); @@ -2958,9 +2959,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 297.31348); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 319.5); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 356); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 380); ASSERT_TRUE(Snapshot()); } @@ -2970,7 +2971,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph1)) { // // TODO(garyq): Re-enable strut tests, allow font metric fakery, or // consolidate skia font metric behavior. -TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { +TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph2)) { // This string is all one size and smaller than the strut metrics. const char* text = "01234ABCDEFGH\nabcd\nABCDEFGH"; auto icu_text = icu::UnicodeString::fromUTF8(text); @@ -3032,9 +3033,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 33.229004); + EXPECT_NEAR(boxes[0].rect.top(), 24, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 83.229004); + EXPECT_NEAR(boxes[0].rect.bottom(), 74, 0.0001); boxes = paragraph->GetRectsForRange(0, 1, rect_height_max_style, rect_width_style); @@ -3043,9 +3044,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 33.229004); + EXPECT_NEAR(boxes[0].rect.top(), 24, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 91); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80); boxes = paragraph->GetRectsForRange(6, 10, rect_height_style, rect_width_style); @@ -3054,9 +3055,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 33.229004); + EXPECT_NEAR(boxes[0].rect.top(), 24, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 83.229004); + EXPECT_NEAR(boxes[0].rect.bottom(), 74, 0.0001); boxes = paragraph->GetRectsForRange(6, 10, rect_height_max_style, rect_width_style); @@ -3065,9 +3066,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 33.229004); + EXPECT_NEAR(boxes[0].rect.top(), 24, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 91); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80); boxes = paragraph->GetRectsForRange(14, 16, rect_height_max_style, rect_width_style); @@ -3076,9 +3077,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 215.229); + EXPECT_NEAR(boxes[0].rect.top(), 184, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 100); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 273); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 240); boxes = paragraph->GetRectsForRange(20, 25, rect_height_max_style, rect_width_style); @@ -3087,9 +3088,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 306.229); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 264); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 364); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 320); ASSERT_TRUE(Snapshot()); } @@ -3099,7 +3100,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph2)) { // // TODO(garyq): Re-enable strut tests, allow font metric fakery, or // consolidate skia font metric behavior. -TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { +TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutParagraph3)) { // The strut is too small to absorb the extra chinese height, but the english // second line height is increased due to strut. const char* text = "01234満毎p行来昼本可\nabcd\n満毎冠行来昼本可"; @@ -3111,7 +3112,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { paragraph_style.max_lines = 10; paragraph_style.strut_font_families = std::vector(1, "ahem"); paragraph_style.strut_font_size = 50; - paragraph_style.strut_height = 1.1; + paragraph_style.strut_height = 1.2; paragraph_style.strut_enabled = true; txt::ParagraphBuilder builder(paragraph_style, GetTestFontCollection()); @@ -3162,9 +3163,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 10.526855); + EXPECT_NEAR(boxes[0].rect.top(), 8, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 60.526855); + EXPECT_NEAR(boxes[0].rect.bottom(), 58, 0.0001); boxes = paragraph->GetRectsForRange(0, 1, rect_height_max_style, rect_width_style); @@ -3173,9 +3174,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 10.526855); + EXPECT_NEAR(boxes[0].rect.top(), 8, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 63); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 60); boxes = paragraph->GetRectsForRange(6, 10, rect_height_style, rect_width_style); @@ -3184,9 +3185,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 10.526855); + EXPECT_NEAR(boxes[0].rect.top(), 8, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 60.526855); + EXPECT_NEAR(boxes[0].rect.bottom(), 58, 0.0001); boxes = paragraph->GetRectsForRange(6, 10, rect_height_max_style, rect_width_style); @@ -3195,9 +3196,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 10.526855); + EXPECT_NEAR(boxes[0].rect.top(), 8, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 63); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 60); boxes = paragraph->GetRectsForRange(14, 16, rect_height_max_style, rect_width_style); @@ -3206,9 +3207,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 136.52686); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 128); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 100); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 189); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 180); boxes = paragraph->GetRectsForRange(20, 25, rect_height_max_style, rect_width_style); @@ -3217,9 +3218,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 199.52686); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 188); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 252); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 240); ASSERT_TRUE(Snapshot()); } @@ -3229,7 +3230,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutParagraph3)) { // // TODO(garyq): Re-enable strut tests, allow font metric fakery, or // consolidate skia font metric behavior. -TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutForceParagraph)) { +TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(StrutForceParagraph)) { // The strut is too small to absorb the extra chinese height, but the english // second line height is increased due to strut. const char* text = "01234満毎冠行来昼本可\nabcd\n満毎冠行来昼本可"; @@ -3293,9 +3294,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_NEAR(boxes[0].rect.top(), 22.5, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80.313477); + EXPECT_NEAR(boxes[0].rect.bottom(), 72.5, 0.0001); boxes = paragraph->GetRectsForRange(0, 1, rect_height_max_style, rect_width_style); @@ -3304,9 +3305,10 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_NEAR(boxes[0].rect.top(), 22.5, 0.0001); + ; EXPECT_FLOAT_EQ(boxes[0].rect.right(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80); boxes = paragraph->GetRectsForRange(6, 10, rect_height_style, rect_width_style); @@ -3315,9 +3317,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_NEAR(boxes[0].rect.top(), 22.5, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80.313477); + EXPECT_NEAR(boxes[0].rect.bottom(), 72.5, 0.0001); boxes = paragraph->GetRectsForRange(6, 10, rect_height_max_style, rect_width_style); @@ -3326,9 +3328,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 30.313477); + EXPECT_NEAR(boxes[0].rect.top(), 22.5, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 500); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 89); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 80); boxes = paragraph->GetRectsForRange(14, 16, rect_height_max_style, rect_width_style); @@ -3337,9 +3339,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 0); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 208.31348); + EXPECT_NEAR(boxes[0].rect.top(), 182.5, 0.0001); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 100); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 267); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 240); boxes = paragraph->GetRectsForRange(20, 25, rect_height_max_style, rect_width_style); @@ -3348,9 +3350,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(DISABLED_StrutForceParagraph)) { } EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 50); - EXPECT_FLOAT_EQ(boxes[0].rect.top(), 297.31348); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), 262.5); EXPECT_FLOAT_EQ(boxes[0].rect.right(), 300); - EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 356); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 320); ASSERT_TRUE(Snapshot()); } From 36d495d57ab1a55f908dedef2856853a084aaf15 Mon Sep 17 00:00:00 2001 From: Stanislav Baranov Date: Fri, 22 Feb 2019 14:18:47 -0800 Subject: [PATCH 0256/1117] Dynamic patching support for native code libraries. (#7927) --- .../android/io/flutter/view/FlutterMain.java | 19 +++++- .../io/flutter/view/ResourceExtractor.java | 63 ++++++++++++++++--- 2 files changed, 73 insertions(+), 9 deletions(-) diff --git a/shell/platform/android/io/flutter/view/FlutterMain.java b/shell/platform/android/io/flutter/view/FlutterMain.java index c59e9ab1fb2cd..ae712708573cc 100644 --- a/shell/platform/android/io/flutter/view/FlutterMain.java +++ b/shell/platform/android/io/flutter/view/FlutterMain.java @@ -59,6 +59,7 @@ public class FlutterMain { private static final String DEFAULT_AOT_ISOLATE_SNAPSHOT_DATA = "isolate_snapshot_data"; private static final String DEFAULT_AOT_ISOLATE_SNAPSHOT_INSTR = "isolate_snapshot_instr"; private static final String DEFAULT_FLX = "app.flx"; + private static final String DEFAULT_LIBRARY = "libflutter.so"; private static final String DEFAULT_KERNEL_BLOB = "kernel_blob.bin"; private static final String DEFAULT_FLUTTER_ASSETS_DIR = "flutter_assets"; @@ -153,7 +154,18 @@ public static void startInitialization(Context applicationContext, Settings sett initConfig(applicationContext); initAot(applicationContext); initResources(applicationContext); - System.loadLibrary("flutter"); + + if (sResourceUpdater == null) { + System.loadLibrary("flutter"); + } else { + sResourceExtractor.waitForCompletion(); + File lib = new File(PathUtils.getDataDirectory(applicationContext), DEFAULT_LIBRARY); + if (lib.exists()) { + System.load(lib.getAbsolutePath()); + } else { + System.loadLibrary("flutter"); + } + } // We record the initialization time using SystemClock because at the start of the // initialization we have not yet loaded the native library to call into dart_tools_api.h. @@ -299,6 +311,11 @@ private static void initResources(Context applicationContext) { .addResource(sAotIsolateSnapshotInstr); } + if (sResourceUpdater != null) { + sResourceExtractor + .addResource(DEFAULT_LIBRARY); + } + sResourceExtractor.start(); } diff --git a/shell/platform/android/io/flutter/view/ResourceExtractor.java b/shell/platform/android/io/flutter/view/ResourceExtractor.java index 5bad736061dc2..40fc75982a972 100644 --- a/shell/platform/android/io/flutter/view/ResourceExtractor.java +++ b/shell/platform/android/io/flutter/view/ResourceExtractor.java @@ -240,12 +240,33 @@ private boolean extractUpdate(File dataDir) { } for (String asset : mResources) { - final String resource = "assets/" + asset; - ZipEntry entry = zipFile.getEntry(resource); + String resource = null; + ZipEntry entry = null; + if (asset.endsWith(".so")) { + // Replicate library lookup logic. + for (String abi : Build.SUPPORTED_ABIS) { + resource = "lib/" + abi + "/" + asset; + entry = zipFile.getEntry(resource); + if (entry == null) { + entry = zipFile.getEntry(resource + ".bzdiff40"); + if (entry == null) { + continue; + } + } + + // Stop after the first match. + break; + } + } + if (entry == null) { - entry = zipFile.getEntry(resource + ".bzdiff40"); + resource = "assets/" + asset; + entry = zipFile.getEntry(resource); if (entry == null) { - continue; + entry = zipFile.getEntry(resource + ".bzdiff40"); + if (entry == null) { + continue; + } } } @@ -265,10 +286,27 @@ private boolean extractUpdate(File dataDir) { } ByteArrayOutputStream orig = new ByteArrayOutputStream(); - try (InputStream is = manager.open(asset)) { - copy(is, orig); - } catch (FileNotFoundException e) { - throw new IOException("Could not find APK resource " + resource); + if (asset.endsWith(".so")) { + ZipFile apkFile = new ZipFile(getAPKPath()); + if (apkFile == null) { + throw new IOException("Could not find APK"); + } + + ZipEntry origEntry = apkFile.getEntry(resource); + if (origEntry == null) { + throw new IOException("Could not find APK resource " + resource); + } + + try (InputStream is = apkFile.getInputStream(origEntry)) { + copy(is, orig); + } + + } else { + try (InputStream is = manager.open(asset)) { + copy(is, orig); + } catch (FileNotFoundException e) { + throw new IOException("Could not find APK resource " + resource); + } } try (OutputStream os = new FileOutputStream(output)) { @@ -356,4 +394,13 @@ private static void copy(InputStream in, OutputStream out) throws IOException { out.write(buf, 0, i); } } + + private String getAPKPath() { + try { + return mContext.getPackageManager().getApplicationInfo( + mContext.getPackageName(), 0).publicSourceDir; + } catch (Exception e) { + return null; + } + } } From 204e7da36cecbfd36f2cc17b09bea6e4c36b555e Mon Sep 17 00:00:00 2001 From: Mehmet Fidanboylu Date: Fri, 22 Feb 2019 14:49:15 -0800 Subject: [PATCH 0257/1117] New setting to decide whether we want the engine to load ICU mapping. (#7928) --- common/settings.cc | 2 ++ common/settings.h | 6 ++++++ shell/common/shell.cc | 14 ++++++++------ shell/common/switches.cc | 20 +++++++++++--------- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/common/settings.cc b/common/settings.cc index d03c52157e141..d2d1c702787fd 100644 --- a/common/settings.cc +++ b/common/settings.cc @@ -43,6 +43,8 @@ std::string Settings::ToString() const { stream << "enable_software_rendering: " << enable_software_rendering << std::endl; stream << "log_tag: " << log_tag << std::endl; + stream << "icu_initialization_required: " << icu_initialization_required + << std::endl; stream << "icu_data_path: " << icu_data_path << std::endl; stream << "assets_dir: " << assets_dir << std::endl; stream << "assets_path: " << assets_path << std::endl; diff --git a/common/settings.h b/common/settings.h index c95e6eb7a5210..07c70369fd189 100644 --- a/common/settings.h +++ b/common/settings.h @@ -104,6 +104,12 @@ struct Settings { bool skia_deterministic_rendering_on_cpu = false; bool verbose_logging = false; std::string log_tag = "flutter"; + + // The icu_initialization_required setting does not have a corresponding + // switch because it is intended to be decided during build time, not runtime. + // Some companies apply source modification here because their build system + // brings its own ICU data files. + bool icu_initialization_required = true; std::string icu_data_path; MappingCallback icu_mapper; diff --git a/shell/common/shell.cc b/shell/common/shell.cc index c1dec19f6ae67..4a501d3af7d31 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -187,12 +187,14 @@ static void PerformInitializationTasks(const blink::Settings& settings) { FML_DLOG(INFO) << "Skia deterministic rendering is enabled."; } - if (settings.icu_data_path.size() != 0) { - fml::icu::InitializeICU(settings.icu_data_path); - } else if (settings.icu_mapper) { - fml::icu::InitializeICUFromMapping(settings.icu_mapper()); - } else { - FML_DLOG(WARNING) << "Skipping ICU initialization in the shell."; + if (settings.icu_initialization_required) { + if (settings.icu_data_path.size() != 0) { + fml::icu::InitializeICU(settings.icu_data_path); + } else if (settings.icu_mapper) { + fml::icu::InitializeICUFromMapping(settings.icu_mapper()); + } else { + FML_DLOG(WARNING) << "Skipping ICU initialization in the shell."; + } } }); } diff --git a/shell/common/switches.cc b/shell/common/switches.cc index dc25956fca9d6..0ef45a944a644 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -224,15 +224,17 @@ blink::Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { command_line.GetOptionValue(FlagForSwitch(Switch::CacheDirPath), &settings.temp_directory_path); - command_line.GetOptionValue(FlagForSwitch(Switch::ICUDataFilePath), - &settings.icu_data_path); - if (command_line.HasOption(FlagForSwitch(Switch::ICUSymbolPrefix))) { - std::string icu_symbol_prefix; - command_line.GetOptionValue(FlagForSwitch(Switch::ICUSymbolPrefix), - &icu_symbol_prefix); - settings.icu_mapper = [icu_symbol_prefix] { - return GetSymbolMapping(icu_symbol_prefix); - }; + if (settings.icu_initialization_required) { + command_line.GetOptionValue(FlagForSwitch(Switch::ICUDataFilePath), + &settings.icu_data_path); + if (command_line.HasOption(FlagForSwitch(Switch::ICUSymbolPrefix))) { + std::string icu_symbol_prefix; + command_line.GetOptionValue(FlagForSwitch(Switch::ICUSymbolPrefix), + &icu_symbol_prefix); + settings.icu_mapper = [icu_symbol_prefix] { + return GetSymbolMapping(icu_symbol_prefix); + }; + } } settings.use_test_fonts = From 0a50e0846a02c9086e5ae3abb64ade8266feb412 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 22 Feb 2019 19:10:21 -0500 Subject: [PATCH 0258/1117] Roll src/third_party/skia ee1c8a733e5b..a753d1a3475d (16 commits) (#7930) https://skia.googlesource.com/skia.git/%2Blog/ee1c8a733e5b..a753d1a3475d git log ee1c8a733e5b31f645bee91ca500b9f6213de77e..a753d1a3475dcae3ca80fcfffed30c0cc25a349b --date=short --no-merges --format=%ad %ae %s 2019-02-22 fmalita@chromium.org Reland "[skottie] Add tritone layer effect support" 2019-02-22 jvanverth@google.com Disable fontscaler GM on Intel Vulkan 2019-02-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader e53533d6fdf9..d2452555986f (2 commits) 2019-02-22 reed@google.com add gm to test backdrop blurs and clipping/hintrects 2019-02-22 herb@google.com Change SDFT to use a bulk api for the callback 2019-02-22 fmalita@chromium.org Revert "[skottie] Add tritone layer effect support" 2019-02-21 fmalita@chromium.org [skottie] Add tritone layer effect support 2019-02-22 halcanary@google.com SkShaper/public.bzl fix 2019-02-22 bungeman@google.com Compare to the correct hinting. 2019-02-22 halcanary@google.com tools: bin/sync just alias for git-sync-deps now 2019-02-22 jvanverth@google.com Disable tests on more Vulkan bots 2019-02-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 8a718cb58343..e53533d6fdf9 (2 commits) 2019-02-22 halcanary@google.com ICU: fix windows: dll to dat 2019-02-04 scroggo@google.com Allow setting an SkColorSpace on SkAnimatedImage 2019-02-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 7aafb27453d3..8a718cb58343 (2 commits) 2019-02-22 benjaminwagner@google.com [infra] Remove Ubuntu17 jobs The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 75 ++++++++++++++++---------------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/DEPS b/DEPS index 000c03eb59ff6..745dcad333146 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': 'ee1c8a733e5b31f645bee91ca500b9f6213de77e', + 'skia_revision': 'a753d1a3475dcae3ca80fcfffed30c0cc25a349b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 77d76398c0d0e..fb927e940493a 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 45fe24d6bc61e00f8b5ee46ffada239c +Signature: b0a131e6e4c82e5133da7075ff0f6eae UNUSED LICENSES: @@ -4866,43 +4866,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== LIBRARY: skia -ORIGIN: ../../../third_party/skia/gm/circles.cpp + ../../../third_party/skia/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../third_party/skia/gm/circles.cpp ----------------------------------------------------------------------------------------------------- -Copyright 2012 Intel Inc. - -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/gm/compositor_quads.cpp + ../../../third_party/skia/LICENSE +ORIGIN: ../../../third_party/skia/gm/backdrop.cpp + ../../../third_party/skia/LICENSE TYPE: LicenseType.bsd +FILE: ../../../third_party/skia/gm/backdrop.cpp FILE: ../../../third_party/skia/gm/compositor_quads.cpp FILE: ../../../third_party/skia/gm/mac_aa_explorer.cpp FILE: ../../../third_party/skia/gm/mixercolorfilter.cpp @@ -4966,6 +4932,41 @@ 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/gm/circles.cpp + ../../../third_party/skia/LICENSE +TYPE: LicenseType.bsd +FILE: ../../../third_party/skia/gm/circles.cpp +---------------------------------------------------------------------------------------------------- +Copyright 2012 Intel Inc. + +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/gm/crbug_918512.cpp + ../../../third_party/skia/LICENSE From 1741497a574fb5b23a32d11f7f499a3065009585 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 22 Feb 2019 23:21:56 -0500 Subject: [PATCH 0259/1117] Roll src/third_party/skia a753d1a3475d..2a5511307d34 (3 commits) (#7933) https://skia.googlesource.com/skia.git/%2Blog/a753d1a3475d..2a5511307d34 git log a753d1a3475dcae3ca80fcfffed30c0cc25a349b..2a5511307d341228135a605a73fb6043be62b987 --date=short --no-merges --format=%ad %ae %s 2019-02-23 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 cf9b2853a7e7..f78131dac076 (3 commits) 2019-02-22 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-22 fmalita@chromium.org [sksg] Use luminance coefficients from SkColorData.h The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 745dcad333146..46d89c3f14b5f 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': 'a753d1a3475dcae3ca80fcfffed30c0cc25a349b', + 'skia_revision': '2a5511307d341228135a605a73fb6043be62b987', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index fb927e940493a..b664829badbb3 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b0a131e6e4c82e5133da7075ff0f6eae +Signature: 62eb2c14fe4b4428702d88c9ec5b9389 UNUSED LICENSES: From 3efc9f5099e537b3885aacfe3506903c23c4e1ca Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 23 Feb 2019 03:33:59 -0500 Subject: [PATCH 0260/1117] Roll src/third_party/skia 2a5511307d34..72f6f044cc73 (2 commits) (#7934) https://skia.googlesource.com/skia.git/%2Blog/2a5511307d34..72f6f044cc73 git log 2a5511307d341228135a605a73fb6043be62b987..72f6f044cc739c4b7712c72d7e4af59b491629da --date=short --no-merges --format=%ad %ae %s 2019-02-23 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-02-23 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader d2452555986f..7c33e88eebb5 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 46d89c3f14b5f..04add6b5d6509 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': '2a5511307d341228135a605a73fb6043be62b987', + 'skia_revision': '72f6f044cc739c4b7712c72d7e4af59b491629da', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b664829badbb3..6e2bc125a1942 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 62eb2c14fe4b4428702d88c9ec5b9389 +Signature: 3aee6c4ec034ff873a9ae0b20d84f12a UNUSED LICENSES: From 0d777b947e4cc52a0bc17566f3e450f869ca00c9 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 23 Feb 2019 07:36:51 -0500 Subject: [PATCH 0261/1117] Roll src/third_party/skia 72f6f044cc73..12f1fecea947 (1 commits) (#7935) https://skia.googlesource.com/skia.git/%2Blog/72f6f044cc73..12f1fecea947 git log 72f6f044cc739c4b7712c72d7e4af59b491629da..12f1fecea947a675ff10bfd1b9728bc7a3ac9ab3 --date=short --no-merges --format=%ad %ae %s 2019-02-23 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 f78131dac076..c63d95525cde (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 04add6b5d6509..ef16bea319a13 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': '72f6f044cc739c4b7712c72d7e4af59b491629da', + 'skia_revision': '12f1fecea947a675ff10bfd1b9728bc7a3ac9ab3', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6e2bc125a1942..f5244137636dc 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 3aee6c4ec034ff873a9ae0b20d84f12a +Signature: 0f228c02be89de75623e1f47baba2176 UNUSED LICENSES: From 018a4f78390c116ee4dfd9149c05031141bf4762 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 23 Feb 2019 11:57:24 -0500 Subject: [PATCH 0262/1117] Roll src/third_party/skia 12f1fecea947..867da4b96e8e (1 commits) (#7936) https://skia.googlesource.com/skia.git/%2Blog/12f1fecea947..867da4b96e8e git log 12f1fecea947a675ff10bfd1b9728bc7a3ac9ab3..867da4b96e8eb591e15951f9fee719c67a0d8638 --date=short --no-merges --format=%ad %ae %s 2019-02-22 kjlubick@google.com Allow system harfbuzz. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index ef16bea319a13..e18142c1484c9 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': '12f1fecea947a675ff10bfd1b9728bc7a3ac9ab3', + 'skia_revision': '867da4b96e8eb591e15951f9fee719c67a0d8638', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index f5244137636dc..0da78ca8d09bb 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 0f228c02be89de75623e1f47baba2176 +Signature: cd59a5bfaf4496e454556730936f07b3 UNUSED LICENSES: From b1779e7d95ea812ced2f4993932bdb2325f5a8ba Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 23 Feb 2019 15:55:56 -0500 Subject: [PATCH 0263/1117] Roll src/third_party/skia 867da4b96e8e..2ed90e152d47 (1 commits) (#7939) https://skia.googlesource.com/skia.git/%2Blog/867da4b96e8e..2ed90e152d47 git log 867da4b96e8eb591e15951f9fee719c67a0d8638..2ed90e152d47abb6500d46983772b43457ecdaee --date=short --no-merges --format=%ad %ae %s 2019-02-23 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jvanverth@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index e18142c1484c9..34583927e79c6 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': '867da4b96e8eb591e15951f9fee719c67a0d8638', + 'skia_revision': '2ed90e152d47abb6500d46983772b43457ecdaee', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 0da78ca8d09bb..1022a24747249 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: cd59a5bfaf4496e454556730936f07b3 +Signature: 92877af68cc4f8c033149d2894988b11 UNUSED LICENSES: From 90fcaff9008e04b71c00cd6ce27ae335c299c8a6 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 24 Feb 2019 01:37:43 -0500 Subject: [PATCH 0264/1117] Roll src/third_party/skia 2ed90e152d47..33c1b315265c (1 commits) (#7940) https://skia.googlesource.com/skia.git/%2Blog/2ed90e152d47..33c1b315265c git log 2ed90e152d47abb6500d46983772b43457ecdaee..33c1b315265c22d24ea7df255d5ed4ba295113ad --date=short --no-merges --format=%ad %ae %s 2019-02-24 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 34583927e79c6..3eb9197655c3f 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': '2ed90e152d47abb6500d46983772b43457ecdaee', + 'skia_revision': '33c1b315265c22d24ea7df255d5ed4ba295113ad', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 1022a24747249..c38f705fdf8a5 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 92877af68cc4f8c033149d2894988b11 +Signature: f8b177abfd45eb799b68507607468ed2 UNUSED LICENSES: From 0546e1e5e9015e7a597c9e59cf89ee614a260251 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 24 Feb 2019 06:09:19 -0500 Subject: [PATCH 0265/1117] Roll src/third_party/skia 33c1b315265c..52d8a5976a23 (1 commits) (#7941) https://skia.googlesource.com/skia.git/%2Blog/33c1b315265c..52d8a5976a23 git log 33c1b315265c22d24ea7df255d5ed4ba295113ad..52d8a5976a23ad4b14ff3e824dd7ad4460d2cdfd --date=short --no-merges --format=%ad %ae %s 2019-02-24 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update SKP version The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 3eb9197655c3f..5f5726a0ed216 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': '33c1b315265c22d24ea7df255d5ed4ba295113ad', + 'skia_revision': '52d8a5976a23ad4b14ff3e824dd7ad4460d2cdfd', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index c38f705fdf8a5..263e91d04635e 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f8b177abfd45eb799b68507607468ed2 +Signature: fbfec472922e012b0da2e58253745827 UNUSED LICENSES: From 687229e70993d693a66509b636c57246847d71b2 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 24 Feb 2019 22:38:50 -0500 Subject: [PATCH 0266/1117] Roll src/third_party/skia 52d8a5976a23..e1636a4b56aa (1 commits) (#7943) https://skia.googlesource.com/skia.git/%2Blog/52d8a5976a23..e1636a4b56aa git log 52d8a5976a23ad4b14ff3e824dd7ad4460d2cdfd..e1636a4b56aacd0e9f26bf7d0dd2a2f14afe2bd3 --date=short --no-merges --format=%ad %ae %s 2019-02-25 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 7c33e88eebb5..b47c816ad7e6 (3 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 5f5726a0ed216..fd18fce9b52df 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': '52d8a5976a23ad4b14ff3e824dd7ad4460d2cdfd', + 'skia_revision': 'e1636a4b56aacd0e9f26bf7d0dd2a2f14afe2bd3', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 263e91d04635e..ee62918834428 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: fbfec472922e012b0da2e58253745827 +Signature: 4fe90056d50f558c66b6a926b47610cb UNUSED LICENSES: From 502c9c4002a6b456f829f79bfbd2ff61d075d1d7 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Sun, 24 Feb 2019 20:41:18 -0800 Subject: [PATCH 0267/1117] Android Embedding PR 6: Introduce FlutterView structure with FlutterSurfaceView and FlutterTextureView. (#7896) --- ci/licenses_golden/licenses_flutter | 3 + shell/platform/android/BUILD.gn | 3 + .../engine/android/AndroidKeyProcessor.java | 4 + .../engine/android/FlutterSurfaceView.java | 168 ++++++++++++++++ .../engine/android/FlutterTextureView.java | 180 ++++++++++++++++++ .../embedding/engine/android/FlutterView.java | 113 +++++++++++ 6 files changed, 471 insertions(+) create mode 100644 shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java create mode 100644 shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java create mode 100644 shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index e80d512b99e2b..802f6b0b67a66 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -472,6 +472,9 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterPluginRegist 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/android/AndroidKeyProcessor.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartMessenger.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/PlatformMessageHandler.java diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index 966cd8146592c..9b430a0092479 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -109,6 +109,9 @@ java_library("flutter_shell_java") { "io/flutter/embedding/engine/FlutterEngine.java", "io/flutter/embedding/engine/FlutterJNI.java", "io/flutter/embedding/engine/android/AndroidKeyProcessor.java", + "io/flutter/embedding/engine/android/FlutterSurfaceView.java", + "io/flutter/embedding/engine/android/FlutterTextureView.java", + "io/flutter/embedding/engine/android/FlutterView.java", "io/flutter/embedding/engine/dart/DartExecutor.java", "io/flutter/embedding/engine/dart/DartMessenger.java", "io/flutter/embedding/engine/dart/PlatformMessageHandler.java", diff --git a/shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.java b/shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.java index 0a876cec5e20e..cced4943b82e8 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.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.android; import android.support.annotation.NonNull; diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java new file mode 100644 index 0000000000000..5e05c2d398fb0 --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java @@ -0,0 +1,168 @@ +// Copyright 2013 The Flutter 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.android; + +import android.content.Context; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.util.AttributeSet; +import android.util.Log; +import android.view.SurfaceHolder; +import android.view.SurfaceView; + +import java.nio.ByteBuffer; + +import io.flutter.embedding.engine.renderer.FlutterRenderer; + +/** + * Paints a Flutter UI on a {@link android.view.Surface}. + * + * To begin rendering a Flutter UI, the owner of this {@code FlutterSurfaceView} must invoke + * {@link #onAttachedToRenderer(FlutterRenderer)} with the desired {@link FlutterRenderer}. + * + * To stop rendering a Flutter UI, the owner of this {@code FlutterSurfaceView} must invoke + * {@link #onDetachedFromRenderer()}. + * + * A {@code FlutterSurfaceView} is intended for situations where a developer needs to render + * a Flutter UI, but does not require any keyboard input, gesture input, accessibility + * integrations or any other interactivity beyond rendering. If standard interactivity is + * desired, consider using a {@link FlutterView} which provides all of these behaviors and + * utilizes a {@code FlutterSurfaceView} internally. + */ +public class FlutterSurfaceView extends SurfaceView { + private static final String TAG = "FlutterSurfaceView"; + + private boolean isSurfaceAvailableForRendering = false; + private boolean isAttachedToFlutterRenderer = false; + @Nullable + private FlutterRenderer flutterRenderer; + + // Connects the {@code Surface} beneath this {@code SurfaceView} with Flutter's native code. + // Callbacks are received by this Object and then those messages are forwarded to our + // FlutterRenderer, and then on to the JNI bridge over to native Flutter code. + private final SurfaceHolder.Callback surfaceCallback = new SurfaceHolder.Callback() { + @Override + public void surfaceCreated(SurfaceHolder holder) { + Log.d(TAG, "SurfaceHolder.Callback.surfaceCreated()"); + isSurfaceAvailableForRendering = true; + + if (isAttachedToFlutterRenderer) { + Log.d(TAG, "Already attached to renderer. Notifying of surface creation."); + connectSurfaceToRenderer(); + } + } + + @Override + public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { + if (isAttachedToFlutterRenderer) { + changeSurfaceSize(width, height); + } + } + + @Override + public void surfaceDestroyed(SurfaceHolder holder) { + Log.d(TAG, "SurfaceHolder.Callback.surfaceDestroyed()"); + isSurfaceAvailableForRendering = false; + + if (isAttachedToFlutterRenderer) { + disconnectSurfaceFromRenderer(); + } + } + }; + + /** + * Constructs a {@code FlutterSurfaceView} programmatically, without any XML attributes. + */ + public FlutterSurfaceView(Context context) { + this(context, null); + } + + /** + * Constructs a {@code FlutterSurfaceView} in an XML-inflation-compliant manner. + */ + public FlutterSurfaceView(Context context, AttributeSet attrs) { + super(context, attrs); + init(); + } + + private void init() { + // Grab a reference to our underlying Surface and register callbacks with that Surface so we + // can monitor changes and forward those changes on to native Flutter code. + getHolder().addCallback(surfaceCallback); + } + + /** + * Invoked by the owner of this {@code FlutterSurfaceView} when it wants to begin rendering + * a Flutter UI to this {@code FlutterSurfaceView}. + * + * If an Android {@link android.view.Surface} is available, this method will begin rendering + * {@link FlutterRenderer}'s Flutter UI to this {@code FlutterSurfaceView}. + * + * If no Android {@link android.view.Surface} is available yet, this {@code FlutterSurfaceView} + * will wait until a {@link android.view.Surface} becomes available and then begin rendering. + */ + public void onAttachedToRenderer(@NonNull FlutterRenderer flutterRenderer) { + if (this.flutterRenderer != null) { + this.flutterRenderer.detachFromRenderSurface(); + } + + this.flutterRenderer = flutterRenderer; + isAttachedToFlutterRenderer = true; + + // If we're already attached to an Android window then we're now attached to both a renderer + // and the Android window. We can begin rendering now. + if (isSurfaceAvailableForRendering) { + connectSurfaceToRenderer(); + } + } + + /** + * Invoked by the owner of this {@code FlutterSurfaceView} when it no longer wants to render + * a Flutter UI to this {@code FlutterSurfaceView}. + * + * This method will cease any on-going rendering from Flutter to this {@code FlutterSurfaceView}. + */ + public void onDetachedFromRenderer() { + if (flutterRenderer != null) { + // If we're attached to an Android window then we were rendering a Flutter UI. Now that + // this FlutterSurfaceView is detached from the FlutterRenderer, we need to stop rendering. + if (isAttachedToWindow()) { + disconnectSurfaceFromRenderer(); + } + + flutterRenderer = null; + isAttachedToFlutterRenderer = false; + } else { + Log.w(TAG, "detachFromRenderer() invoked when no FlutterRenderer was attached."); + } + } + + // FlutterRenderer and getSurfaceTexture() must both be non-null. + private void connectSurfaceToRenderer() { + if (flutterRenderer == null || getHolder() == null) { + throw new IllegalStateException("connectSurfaceToRenderer() should only be called when flutterRenderer and getHolder() are non-null."); + } + + flutterRenderer.surfaceCreated(getHolder().getSurface()); + } + + // FlutterRenderer must be non-null. + private void changeSurfaceSize(int width, int height) { + if (flutterRenderer == null) { + throw new IllegalStateException("changeSurfaceSize() should only be called when flutterRenderer is non-null."); + } + + flutterRenderer.surfaceChanged(width, height); + } + + // FlutterRenderer must be non-null. + private void disconnectSurfaceFromRenderer() { + if (flutterRenderer == null) { + throw new IllegalStateException("disconnectSurfaceFromRenderer() should only be called when flutterRenderer is non-null."); + } + + flutterRenderer.surfaceDestroyed(); + } +} diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java new file mode 100644 index 0000000000000..41a298bddd24c --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java @@ -0,0 +1,180 @@ +// Copyright 2013 The Flutter 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.android; + +import android.content.Context; +import android.graphics.SurfaceTexture; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.util.AttributeSet; +import android.util.Log; +import android.view.Surface; +import android.view.TextureView; + +import io.flutter.embedding.engine.renderer.FlutterRenderer; + +/** + * Paints a Flutter UI on a {@link SurfaceTexture}. + * + * To begin rendering a Flutter UI, the owner of this {@code FlutterTextureView} must invoke + * {@link #onAttachedToRenderer(FlutterRenderer)} with the desired {@link FlutterRenderer}. + * + * To stop rendering a Flutter UI, the owner of this {@code FlutterTextureView} must invoke + * {@link #onDetachedFromRenderer()}. + * + * A {@code FlutterTextureView} is intended for situations where a developer needs to render + * a Flutter UI, but does not require any keyboard input, gesture input, accessibility + * integrations or any other interactivity beyond rendering. If standard interactivity is + * desired, consider using a {@link FlutterView} which provides all of these behaviors and + * utilizes a {@code FlutterTextureView} internally. + */ +public class FlutterTextureView extends TextureView { + private static final String TAG = "FlutterTextureView"; + + private boolean isSurfaceAvailableForRendering = false; + private boolean isAttachedToFlutterRenderer = false; + @Nullable + private FlutterRenderer flutterRenderer; + + // Connects the {@code SurfaceTexture} beneath this {@code TextureView} with Flutter's native code. + // Callbacks are received by this Object and then those messages are forwarded to our + // FlutterRenderer, and then on to the JNI bridge over to native Flutter code. + private final SurfaceTextureListener surfaceTextureListener = new SurfaceTextureListener() { + @Override + public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) { + Log.d(TAG, "SurfaceTextureListener.onSurfaceTextureAvailable()"); + isSurfaceAvailableForRendering = true; + + // If we're already attached to a FlutterRenderer then we're now attached to both a renderer + // and the Android window, so we can begin rendering now. + if (isAttachedToFlutterRenderer) { + Log.d(TAG, "Already attached to renderer. Notifying of surface creation."); + connectSurfaceToRenderer(); + } + } + + @Override + public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { + if (isAttachedToFlutterRenderer) { + changeSurfaceSize(width, height); + } + } + + @Override + public void onSurfaceTextureUpdated(SurfaceTexture surface) { + // Invoked every time a new frame is available. We don't care. + } + + @Override + public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { + Log.d(TAG, "SurfaceTextureListener.onSurfaceTextureDestroyed()"); + isSurfaceAvailableForRendering = false; + + // If we're attached to a FlutterRenderer then we need to notify it that our SurfaceTexture + // has been destroyed. + if (isAttachedToFlutterRenderer) { + disconnectSurfaceFromRenderer(); + } + + // Return true to indicate that no further painting will take place + // within this SurfaceTexture. + return true; + } + }; + + /** + * Constructs a {@code FlutterTextureView} programmatically, without any XML attributes. + */ + public FlutterTextureView(Context context) { + this(context, null); + } + + /** + * Constructs a {@code FlutterTextureView} in an XML-inflation-compliant manner. + */ + public FlutterTextureView(Context context, AttributeSet attrs) { + super(context, attrs); + init(); + } + + private void init() { + // Listen for when our underlying SurfaceTexture becomes available, changes size, or + // gets destroyed, and take the appropriate actions. + setSurfaceTextureListener(surfaceTextureListener); + } + + /** + * Invoked by the owner of this {@code FlutterTextureView} when it wants to begin rendering + * a Flutter UI to this {@code FlutterTextureView}. + * + * If an Android {@link SurfaceTexture} is available, this method will begin rendering + * {@link FlutterRenderer}'s Flutter UI to this {@code FlutterTextureView}. + * + * If no Android {@link SurfaceTexture} is available yet, this {@code FlutterSurfaceView} + * will wait until a {@link SurfaceTexture} becomes available and then begin rendering. + */ + public void onAttachedToRenderer(@NonNull FlutterRenderer flutterRenderer) { + if (this.flutterRenderer != null) { + this.flutterRenderer.detachFromRenderSurface(); + } + + this.flutterRenderer = flutterRenderer; + isAttachedToFlutterRenderer = true; + + // If we're already attached to an Android window then we're now attached to both a renderer + // and the Android window. We can begin rendering now. + if (isSurfaceAvailableForRendering) { + connectSurfaceToRenderer(); + } + } + + /** + * Invoked by the owner of this {@code FlutterTextureView} when it no longer wants to render + * a Flutter UI to this {@code FlutterTextureView}. + * + * This method will cease any on-going rendering from Flutter to this {@code FlutterTextureView}. + */ + public void onDetachedFromRenderer() { + if (flutterRenderer != null) { + // If we're attached to an Android window then we were rendering a Flutter UI. Now that + // this FlutterTextureView is detached from the FlutterRenderer, we need to stop rendering. + if (isAttachedToWindow()) { + disconnectSurfaceFromRenderer(); + } + + flutterRenderer = null; + isAttachedToFlutterRenderer = false; + } else { + Log.w(TAG, "detachFromRenderer() invoked when no FlutterRenderer was attached."); + } + } + + // FlutterRenderer and getSurfaceTexture() must both be non-null. + private void connectSurfaceToRenderer() { + if (flutterRenderer == null || getSurfaceTexture() == null) { + throw new IllegalStateException("connectSurfaceToRenderer() should only be called when flutterRenderer and getSurfaceTexture() are non-null."); + } + + flutterRenderer.surfaceCreated(new Surface(getSurfaceTexture())); + } + + // FlutterRenderer must be non-null. + private void changeSurfaceSize(int width, int height) { + if (flutterRenderer == null) { + throw new IllegalStateException("changeSurfaceSize() should only be called when flutterRenderer is non-null."); + } + + flutterRenderer.surfaceChanged(width, height); + } + + // FlutterRenderer must be non-null. + private void disconnectSurfaceFromRenderer() { + if (flutterRenderer == null) { + throw new IllegalStateException("disconnectSurfaceFromRenderer() should only be called when flutterRenderer is non-null."); + } + + flutterRenderer.surfaceDestroyed(); + } +} diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java new file mode 100644 index 0000000000000..ce6f30d1750b2 --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java @@ -0,0 +1,113 @@ +// Copyright 2013 The Flutter 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.android; + +import android.content.Context; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.util.AttributeSet; +import android.util.Log; +import android.widget.FrameLayout; + +/** + * Displays a Flutter UI on an Android device. + *

+ * A {@code FlutterView}'s UI is painted by a corresponding {@link FlutterEngine}. + *

+ * A {@code FlutterView} can operate in 2 different {@link RenderMode}s: + *

    + *
  1. {@link RenderMode#surface}, which paints a Flutter UI to a {@link android.view.SurfaceView}. + * This mode has the best performance, but a {@code FlutterView} in this mode cannot be positioned + * between 2 other Android {@code View}s in the z-index, nor can it be animated/transformed. + * Unless the special capabilities of a {@link android.graphics.SurfaceTexture} are required, + * developers should strongly prefer this render mode.
  2. + *
  3. {@link RenderMode#texture}, which paints a Flutter UI to a {@link android.graphics.SurfaceTexture}. + * This mode is not as performant as {@link RenderMode#surface}, but a {@code FlutterView} in this + * mode can be animated and transformed, as well as positioned in the z-index between 2+ other + * Android {@code Views}. Unless the special capabilities of a {@link android.graphics.SurfaceTexture} + * are required, developers should strongly prefer the {@link RenderMode#surface} render mode.
  4. + *
+ * See https://source.android.com/devices/graphics/arch-tv#surface_or_texture for more + * information comparing {@link android.view.SurfaceView} and {@link android.view.TextureView}. + */ +public class FlutterView extends FrameLayout { + private static final String TAG = "FlutterView"; + + @NonNull + private RenderMode renderMode; + + /** + * Constructs a {@code FlutterSurfaceView} programmatically, without any XML attributes. + * + * {@link #renderMode} defaults to {@link RenderMode#surface}. + */ + public FlutterView(@NonNull Context context) { + this(context, null, null); + } + + /** + * Constructs a {@code FlutterSurfaceView} programmatically, without any XML attributes, + * and allows selection of a {@link #renderMode}. + */ + public FlutterView(@NonNull Context context, @NonNull RenderMode renderMode) { + this(context, null, renderMode); + } + + /** + * Constructs a {@code FlutterSurfaceView} in an XML-inflation-compliant manner. + * + * // TODO(mattcarroll): expose renderMode in XML when build system supports R.attr + */ + public FlutterView(@NonNull Context context, @Nullable AttributeSet attrs) { + this(context, attrs, null); + } + + private FlutterView(@NonNull Context context, @Nullable AttributeSet attrs, @Nullable RenderMode renderMode) { + super(context, attrs); + + this.renderMode = renderMode == null ? RenderMode.surface : renderMode; + + init(); + } + + private void init() { + Log.d(TAG, "Initializing FlutterView"); + + switch (renderMode) { + case surface: + Log.d(TAG, "Internally creating a FlutterSurfaceView."); + FlutterSurfaceView flutterSurfaceView = new FlutterSurfaceView(getContext()); + addView(flutterSurfaceView); + break; + case texture: + Log.d(TAG, "Internally creating a FlutterTextureView."); + FlutterTextureView flutterTextureView = new FlutterTextureView(getContext()); + addView(flutterTextureView); + break; + } + } + + /** + * Render modes for a {@link FlutterView}. + */ + public enum RenderMode { + /** + * {@code RenderMode}, which paints a Flutter UI to a {@link android.view.SurfaceView}. + * This mode has the best performance, but a {@code FlutterView} in this mode cannot be positioned + * between 2 other Android {@code View}s in the z-index, nor can it be animated/transformed. + * Unless the special capabilities of a {@link android.graphics.SurfaceTexture} are required, + * developers should strongly prefer this render mode. + */ + surface, + /** + * {@code RenderMode}, which paints a Flutter UI to a {@link android.graphics.SurfaceTexture}. + * This mode is not as performant as {@link RenderMode#surface}, but a {@code FlutterView} in this + * mode can be animated and transformed, as well as positioned in the z-index between 2+ other + * Android {@code Views}. Unless the special capabilities of a {@link android.graphics.SurfaceTexture} + * are required, developers should strongly prefer the {@link RenderMode#surface} render mode. + */ + texture + } +} From f7306394e303a210a9971acb60f9ba11d7c64ec8 Mon Sep 17 00:00:00 2001 From: Ivan Date: Mon, 25 Feb 2019 10:29:16 +0400 Subject: [PATCH 0268/1117] fix sendLocales on old android versions (#7937) [Configuration.getLocales()][1] was added in API level 24. For earlier versions, we instead return only the current locale. Fixes https://github.com/flutter/flutter/issues/28321 [1]: https://developer.android.com/reference/android/content/res/Configuration#getLocales() --- .../android/io/flutter/view/FlutterView.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index e636506d2297a..8c40ed63257c6 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -320,12 +320,16 @@ private void sendUserPlatformSettingsToDart() { } private void sendLocalesToDart(Configuration config) { - LocaleList localeList = config.getLocales(); - int localeCount = localeList.size(); List locales = new ArrayList<>(); - for (int index = 0; index < localeCount; ++index) { - Locale locale = localeList.get(index); - locales.add(locale); + if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { + LocaleList localeList = config.getLocales(); + int localeCount = localeList.size(); + for (int index = 0; index < localeCount; ++index) { + Locale locale = localeList.get(index); + locales.add(locale); + } + } else { + locales.add(config.locale); } localizationChannel.sendLocales(locales); } From f2489c1b5d2c517e395341154c406655fda80eda Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Sun, 24 Feb 2019 22:33:55 -0800 Subject: [PATCH 0269/1117] Correct FlutterSemanticsNode member name style (#7942) Correct struct members whose names were camelCase rather than snake_case. This is a breaking API change, but does not break ABI. --- shell/platform/embedder/embedder.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 28e4fb4d8582e..735d4ff97b9b1 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -335,19 +335,19 @@ typedef struct { // The set of semantics actions applicable to this node. FlutterSemanticsAction actions; // The position at which the text selection originates. - int32_t textSelectionBase; + int32_t text_selection_base; // The position at which the text selection terminates. - int32_t textSelectionExtent; + int32_t text_selection_extent; // The total number of scrollable children that contribute to semantics. - int32_t scrollChildren; + int32_t scroll_child_count; // The index of the first visible semantic child of a scroll node. - int32_t scrollIndex; + int32_t scroll_index; // The current scrolling position in logical pixels if the node is scrollable. - double scrollPosition; + double scroll_position; // The maximum in-range value for |scrollPosition| if the node is scrollable. - double scrollExtentMax; + double scroll_extent_max; // The minimum in-range value for |scrollPosition| if the node is scrollable. - double scrollExtentMin; + double scroll_extent_min; // The elevation along the z-axis at which the rect of this semantics node is // located above its parent. double elevation; @@ -361,13 +361,13 @@ typedef struct { const char* value; // A value that |value| will have after a kFlutterSemanticsActionIncrease| // action has been performed. - const char* increasedValue; + const char* increased_value; // A value that |value| will have after a kFlutterSemanticsActionDecrease| // action has been performed. - const char* decreasedValue; + const char* decreased_value; // The reading direction for |label|, |value|, |hint|, |increasedValue|, and // |decreasedValue|. - FlutterTextDirection textDirection; + FlutterTextDirection text_direction; // The bounding box for this node in its coordinate system. FlutterRect rect; // The transform from this node's coordinate system to its parent's coordinate From 9f6b297cc8629ccdee1d9462798ae72b047a12f7 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 25 Feb 2019 02:50:34 -0500 Subject: [PATCH 0270/1117] Roll src/third_party/skia e1636a4b56aa..5bbd02d6bb3d (1 commits) (#7944) https://skia.googlesource.com/skia.git/%2Blog/e1636a4b56aa..5bbd02d6bb3d git log e1636a4b56aacd0e9f26bf7d0dd2a2f14afe2bd3..5bbd02d6bb3d933fbe73d6b8fc915caa120bbcaf --date=short --no-merges --format=%ad %ae %s 2019-02-25 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index fd18fce9b52df..d45ab2426e1de 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': 'e1636a4b56aacd0e9f26bf7d0dd2a2f14afe2bd3', + 'skia_revision': '5bbd02d6bb3d933fbe73d6b8fc915caa120bbcaf', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index ee62918834428..920d6707ca312 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 4fe90056d50f558c66b6a926b47610cb +Signature: 98c48a161adee775ef2d5d8aaf331110 UNUSED LICENSES: From 6e1f0f0637e9cc5896e11d23c5f0e0596ec1e075 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 25 Feb 2019 07:03:49 -0500 Subject: [PATCH 0271/1117] Roll src/third_party/skia 5bbd02d6bb3d..478d7d46f8d7 (1 commits) (#7948) https://skia.googlesource.com/skia.git/%2Blog/5bbd02d6bb3d..478d7d46f8d7 git log 5bbd02d6bb3d933fbe73d6b8fc915caa120bbcaf..478d7d46f8d7e14fa940fd7318f38e6cbc8bc19f --date=short --no-merges --format=%ad %ae %s 2019-02-25 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d45ab2426e1de..2af26b012e921 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': '5bbd02d6bb3d933fbe73d6b8fc915caa120bbcaf', + 'skia_revision': '478d7d46f8d7e14fa940fd7318f38e6cbc8bc19f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 920d6707ca312..054b972df05a5 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 98c48a161adee775ef2d5d8aaf331110 +Signature: bb02dc4920cacedb57bb14197d80e96a UNUSED LICENSES: From 5fcc6aca89fcc8b30589041c483a924efe1b93e4 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 25 Feb 2019 11:12:31 -0500 Subject: [PATCH 0272/1117] Roll src/third_party/skia 478d7d46f8d7..507158f88d4d (1 commits) (#7949) https://skia.googlesource.com/skia.git/%2Blog/478d7d46f8d7..507158f88d4d git log 478d7d46f8d7e14fa940fd7318f38e6cbc8bc19f..507158f88d4dd90d09588ea8c870b76defdfa91a --date=short --no-merges --format=%ad %ae %s 2019-02-25 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader b47c816ad7e6..e2d8b1286ce3 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 2af26b012e921..b03a80f424f18 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': '478d7d46f8d7e14fa940fd7318f38e6cbc8bc19f', + 'skia_revision': '507158f88d4dd90d09588ea8c870b76defdfa91a', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 054b972df05a5..6528f9c901149 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: bb02dc4920cacedb57bb14197d80e96a +Signature: 1fef5f1f89a091250bec208646570e2e UNUSED LICENSES: From dff323d21adf7040469169344458bb9ace0986e0 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 25 Feb 2019 17:10:55 -0500 Subject: [PATCH 0273/1117] Roll src/third_party/skia 507158f88d4d..0b2c05470bab (19 commits) (#7952) https://skia.googlesource.com/skia.git/%2Blog/507158f88d4d..0b2c05470bab git log 507158f88d4dd90d09588ea8c870b76defdfa91a..0b2c05470bab8ac250d510384f3511574ca35444 --date=short --no-merges --format=%ad %ae %s 2019-02-25 ethannicholas@google.com fixed SPIR-V constant swizzling 2019-02-21 csmartdalton@google.com Stack-allocate pipelines for GrMeshDrawOp 2019-02-25 herb@google.com Calculate SDFT strike in common code 2019-02-25 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-25 brianosman@google.com Change particle affector to work on N particles 2019-02-25 brianosman@google.com Add "enabled" flag to affectors, fix curve interaction with stable random 2019-02-25 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 1776af77065f..8c1e8f1fb771 (1 commits) 2019-02-22 scroggo@google.com Reland "Treat kWEBP encode with quality=100 as lossless" 2019-02-25 scroggo@google.com Add a wuffs Release bot 2019-02-25 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 5efe61188243..1776af77065f (1 commits) 2019-02-25 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader e2d8b1286ce3..5efe61188243 (1 commits) 2019-02-25 bungeman@google.com Remove fuzz samples. 2019-02-25 ethannicholas@google.com fixed SkSL float literals in Arabic locale 2019-02-23 bungeman@google.com Remove defunct SkJSCanvas 2019-02-22 jvanverth@google.com Check for zero offsets for PolyUtils 2019-02-25 borenet@google.com [infra] Make the presubmit bot use recipes from CIPD 2019-02-25 fmalita@chromium.org [skottie] Layer blend mode support 2019-02-23 reed@google.com fill the layer if there is a backdrop filter 2019-02-24 nigeltao@google.com Update Wuffs version The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index b03a80f424f18..b0532f5c1b236 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': '507158f88d4dd90d09588ea8c870b76defdfa91a', + 'skia_revision': '0b2c05470bab8ac250d510384f3511574ca35444', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6528f9c901149..2e1643bcb26bb 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 1fef5f1f89a091250bec208646570e2e +Signature: 05da1111732aec79c0ada61abc030278 UNUSED LICENSES: @@ -2900,7 +2900,6 @@ FILE: ../../../third_party/skia/samplecode/SampleEmboss.cpp FILE: ../../../third_party/skia/samplecode/SampleFillType.cpp FILE: ../../../third_party/skia/samplecode/SampleFilter2.cpp FILE: ../../../third_party/skia/samplecode/SampleFontCache.cpp -FILE: ../../../third_party/skia/samplecode/SampleFuzz.cpp FILE: ../../../third_party/skia/samplecode/SampleGradients.cpp FILE: ../../../third_party/skia/samplecode/SampleHairCurves.cpp FILE: ../../../third_party/skia/samplecode/SampleHairModes.cpp @@ -3678,7 +3677,6 @@ FILE: ../../../third_party/skia/samplecode/SampleAtlas.cpp FILE: ../../../third_party/skia/samplecode/SampleClipDrawMatch.cpp FILE: ../../../third_party/skia/samplecode/SampleFilterQuality.cpp FILE: ../../../third_party/skia/samplecode/SampleLighting.cpp -FILE: ../../../third_party/skia/samplecode/SamplePathFuzz.cpp FILE: ../../../third_party/skia/samplecode/SampleShip.cpp FILE: ../../../third_party/skia/samplecode/SampleXfer.cpp FILE: ../../../third_party/skia/src/android/SkBitmapRegionCodec.cpp From fd6c3fc700e72f1cb342ed44d5d1ab985f46e008 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 25 Feb 2019 15:31:50 -0800 Subject: [PATCH 0274/1117] Do not clear FlutterJNI state when a FlutterView is detached (#7929) If an app is using retainFlutterNativeView or a plugin wants to keep the FlutterNativeView active, then the FlutterNativeView should not drop its handle to the corresponding native platform view. Fixes https://github.com/flutter/flutter/issues/26931 --- .../io/flutter/embedding/engine/FlutterEngine.java | 2 -- .../io/flutter/embedding/engine/FlutterJNI.java | 9 --------- .../android/io/flutter/view/FlutterNativeView.java | 1 - shell/platform/android/platform_view_android_jni.cc | 10 ---------- 4 files changed, 22 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java b/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java index 1986188c00990..fdffce77390f5 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java @@ -109,8 +109,6 @@ public void detachFromJni() { pluginRegistry.detach(); dartExecutor.onDetachedFromJNI(); flutterJNI.removeEngineLifecycleListener(engineLifecycleListener); - // TODO(mattcarroll): investigate detach vs destroy. document user-cases. update code if needed. - flutterJNI.detachFromNativeButKeepNativeResources(); } /** diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java index 0ee86091ab09c..f2d194275c3d4 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java @@ -392,15 +392,6 @@ public void attachToNative(boolean isBackgroundView) { private native long nativeAttach(FlutterJNI flutterJNI, boolean isBackgroundView); - @UiThread - public void detachFromNativeButKeepNativeResources() { - ensureAttachedToNative(); - nativeDetach(nativePlatformViewId); - nativePlatformViewId = null; - } - - private native void nativeDetach(long nativePlatformViewId); - @UiThread public void detachFromNativeAndReleaseResources() { ensureAttachedToNative(); diff --git a/shell/platform/android/io/flutter/view/FlutterNativeView.java b/shell/platform/android/io/flutter/view/FlutterNativeView.java index 408449ee518a1..373aa792a9413 100644 --- a/shell/platform/android/io/flutter/view/FlutterNativeView.java +++ b/shell/platform/android/io/flutter/view/FlutterNativeView.java @@ -50,7 +50,6 @@ public void detach() { mPluginRegistry.detach(); dartExecutor.onDetachedFromJNI(); mFlutterView = null; - mFlutterJNI.detachFromNativeButKeepNativeResources(); } public void destroy() { diff --git a/shell/platform/android/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index 97bcfb6dfe0ff..b26f5939902f2 100644 --- a/shell/platform/android/platform_view_android_jni.cc +++ b/shell/platform/android/platform_view_android_jni.cc @@ -160,11 +160,6 @@ static jlong AttachJNI(JNIEnv* env, } } -// TODO(mattcarroll): delete this method here and in FlutterJNI.java -static void DetachJNI(JNIEnv* env, jobject jcaller, jlong shell_holder) { - // Nothing to do. -} - static void DestroyJNI(JNIEnv* env, jobject jcaller, jlong shell_holder) { delete ANDROID_SHELL_HOLDER; } @@ -547,11 +542,6 @@ bool RegisterApi(JNIEnv* env) { .signature = "(Lio/flutter/embedding/engine/FlutterJNI;Z)J", .fnPtr = reinterpret_cast(&shell::AttachJNI), }, - { - .name = "nativeDetach", - .signature = "(J)V", - .fnPtr = reinterpret_cast(&shell::DetachJNI), - }, { .name = "nativeDestroy", .signature = "(J)V", From 1d0615af4ee5a962a023e9ad2a0c2fab24d6dd1b Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 25 Feb 2019 17:43:32 -0800 Subject: [PATCH 0275/1117] libtxt: remove a debug log message in ComputeStrut (#7953) --- third_party/txt/src/txt/paragraph.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index b08bf3559c138..3c0e6d602703b 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -458,7 +458,6 @@ void Paragraph::ComputeStrut(StrutMetrics* strut, SkFont& font) { static_cast(faked_font.font) ->GetSkTypeface() ->getFamilyName(&str); - FML_DLOG(ERROR) << str.c_str(); font.setTypeface(static_cast(faked_font.font)->GetSkTypeface()); font.setSize(paragraph_style_.strut_font_size); SkFontMetrics strut_metrics; From b36f9034c646afb4c7ea3226bb9a2f32b1edd3f6 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 25 Feb 2019 17:58:23 -0800 Subject: [PATCH 0276/1117] Roll src/third_party/dart c92d5ca288..7a63d31151 (6 commits) (#7955) 7a63d31151 Improve the message when importing a deprecated library (issue 35922) 30f9f5b1c7 Add SetOrMapLiteral to support the code-as-ui features 1c534d852c Clean up the tutorial related to implementing a visitor 7f2f840a91 Don't include constants of private enums. 7329247892 [vm/tools] Add Graph Explorer to visualize output of --write_v8_snapshot_profile_to. 5d71308b78 [vm/tools] Don't duplicate "problems" metadata into split package files. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index b0532f5c1b236..d31d69d229309 100644 --- a/DEPS +++ b/DEPS @@ -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': 'c92d5ca288da15b54b04c0a40ffe5d94a8883d77', + 'dart_revision': '7a63d31151e4c18505df910c564be171fa6f7330', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index e97f942e5ae7c..249357260bd81 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: a76c88a9ff389b1401e9df71fb13c1f6 +Signature: cc36b7aa35de39c80eb1abf7a71a88d8 UNUSED LICENSES: @@ -5707,6 +5707,8 @@ FILE: ../../../third_party/dart/runtime/lib/ffi_dynamic_library.cc FILE: ../../../third_party/dart/runtime/lib/ffi_dynamic_library_patch.dart FILE: ../../../third_party/dart/runtime/lib/ffi_native_type_patch.dart FILE: ../../../third_party/dart/runtime/lib/ffi_patch.dart +FILE: ../../../third_party/dart/runtime/tools/graphexplorer/graphexplorer.html +FILE: ../../../third_party/dart/runtime/tools/graphexplorer/graphexplorer.js FILE: ../../../third_party/dart/runtime/vm/class_id.h FILE: ../../../third_party/dart/runtime/vm/code_entry_kind.h FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier.cc From a61056aa5f4be95ad34389bb0fd17e0478b8f6ca Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 25 Feb 2019 21:24:49 -0500 Subject: [PATCH 0277/1117] Roll src/third_party/skia 0b2c05470bab..bcfbf6e94c22 (8 commits) (#7956) https://skia.googlesource.com/skia.git/%2Blog/0b2c05470bab..bcfbf6e94c22 git log 0b2c05470bab8ac250d510384f3511574ca35444..bcfbf6e94c2272b0a030a8763e2abcfe4b55395c --date=short --no-merges --format=%ad %ae %s 2019-02-25 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 c63d95525cde..0546b5380780 (4 commits) 2019-02-25 bungeman@google.com Add full definition of SkStreamAsset. 2019-02-25 csmartdalton@google.com sksl: Negate dFdy when the Y axis is flipped 2019-02-25 csmartdalton@google.com Revert "Stack-allocate pipelines for GrMeshDrawOp" 2019-02-25 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-25 bungeman@google.com SkTypeface::onOpenStream to return unique_ptr. 2019-02-25 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 8c1e8f1fb771..9b433073ba38 (1 commits) 2019-02-25 kjlubick@google.com [pathkit][canvaskit] roll versions The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d31d69d229309..439e0cde4cbb7 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': '0b2c05470bab8ac250d510384f3511574ca35444', + 'skia_revision': 'bcfbf6e94c2272b0a030a8763e2abcfe4b55395c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2e1643bcb26bb..38a9655d47ba9 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 05da1111732aec79c0ada61abc030278 +Signature: 186c1643cc6eaf037a08e71cb906d1e6 UNUSED LICENSES: From 18ad03d49d3cdbe9272ee302eed87effeec59801 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Mon, 25 Feb 2019 19:15:49 -0800 Subject: [PATCH 0278/1117] Fixed an Android keyboard entry bug that was introduced by the embedding refactor. (#28438) (#7954) --- .../engine/android/AndroidKeyProcessor.java | 12 ++++++++- .../plugin/editing/TextInputPlugin.java | 26 +++++++++++++++++-- .../android/io/flutter/view/FlutterView.java | 10 +------ 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.java b/shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.java index cced4943b82e8..09f992de7c6d1 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.java @@ -10,13 +10,16 @@ import android.view.KeyEvent; import io.flutter.embedding.engine.systemchannels.KeyEventChannel; +import io.flutter.plugin.editing.TextInputPlugin; public class AndroidKeyProcessor { private final KeyEventChannel keyEventChannel; + private final TextInputPlugin textInputPlugin; private int combiningCharacter; - public AndroidKeyProcessor(@NonNull KeyEventChannel keyEventChannel) { + public AndroidKeyProcessor(@NonNull KeyEventChannel keyEventChannel, @NonNull TextInputPlugin textInputPlugin) { this.keyEventChannel = keyEventChannel; + this.textInputPlugin = textInputPlugin; } public void onKeyUp(@NonNull KeyEvent keyEvent) { @@ -27,6 +30,13 @@ public void onKeyUp(@NonNull KeyEvent keyEvent) { } public void onKeyDown(@NonNull KeyEvent keyEvent) { + if (keyEvent.getDeviceId() != KeyCharacterMap.VIRTUAL_KEYBOARD) { + if (textInputPlugin.getLastInputConnection() != null + && textInputPlugin.getInputMethodManager().isAcceptingText()) { + textInputPlugin.getLastInputConnection().sendKeyEvent(keyEvent); + } + } + Character complexCharacter = applyCombiningCharacterToBaseCharacter(keyEvent.getUnicodeChar()); keyEventChannel.keyDown( new KeyEventChannel.FlutterKeyEvent(keyEvent, complexCharacter) diff --git a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java index bc54b3ed045ac..96fa64a0a629a 100644 --- a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java +++ b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java @@ -6,6 +6,7 @@ import android.content.Context; import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.text.Editable; import android.text.InputType; import android.text.Selection; @@ -22,13 +23,20 @@ * Android implementation of the text input plugin. */ public class TextInputPlugin { + @NonNull private final FlutterView mView; + @NonNull private final InputMethodManager mImm; + @NonNull private final TextInputChannel textInputChannel; private int mClient = 0; + @Nullable private TextInputChannel.Configuration configuration; + @Nullable private Editable mEditable; private boolean mRestartInputPending; + @Nullable + private InputConnection lastInputConnection; public TextInputPlugin(FlutterView view, @NonNull DartExecutor dartExecutor) { mView = view; @@ -64,6 +72,11 @@ public void clearClient() { }); } + @NonNull + public InputMethodManager getInputMethodManager() { + return mImm; + } + private static int inputTypeFromTextInputType( TextInputChannel.InputType type, boolean obscureText, @@ -114,7 +127,10 @@ private static int inputTypeFromTextInputType( } public InputConnection createInputConnection(FlutterView view, EditorInfo outAttrs) { - if (mClient == 0) return null; + if (mClient == 0) { + lastInputConnection = null; + return lastInputConnection; + } outAttrs.inputType = inputTypeFromTextInputType( configuration.inputType, @@ -148,7 +164,13 @@ public InputConnection createInputConnection(FlutterView view, EditorInfo outAtt outAttrs.initialSelStart = Selection.getSelectionStart(mEditable); outAttrs.initialSelEnd = Selection.getSelectionEnd(mEditable); - return connection; + lastInputConnection = connection; + return lastInputConnection; + } + + @Nullable + public InputConnection getLastInputConnection() { + return lastInputConnection; } private void showTextInput(FlutterView view) { diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 8c40ed63257c6..8c7f8baaa1a01 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -110,7 +110,6 @@ static final class ViewportMetrics { private FlutterNativeView mNativeView; private final AnimationScaleObserver mAnimationScaleObserver; private boolean mIsSoftwareRenderingEnabled = false; // using the software renderer or not - private InputConnection mLastInputConnection; public FlutterView(Context context) { this(context, null); @@ -181,7 +180,7 @@ public void surfaceDestroyed(SurfaceHolder holder) { addActivityLifecycleListener(platformPlugin); mImm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); mTextInputPlugin = new TextInputPlugin(this, dartExecutor); - androidKeyProcessor = new AndroidKeyProcessor(keyEventChannel); + androidKeyProcessor = new AndroidKeyProcessor(keyEventChannel, mTextInputPlugin); // Send initial platform information to Dart sendLocalesToDart(getResources().getConfiguration()); @@ -202,13 +201,6 @@ public boolean onKeyDown(int keyCode, KeyEvent event) { if (!isAttached()) { return super.onKeyDown(keyCode, event); } - - if (event.getDeviceId() != KeyCharacterMap.VIRTUAL_KEYBOARD) { - if (mLastInputConnection != null && mImm.isAcceptingText()) { - mLastInputConnection.sendKeyEvent(event); - } - } - androidKeyProcessor.onKeyDown(event); return super.onKeyDown(keyCode, event); } From cb9e6734a6cea74eb52ca09583288cdb0842a699 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 25 Feb 2019 21:35:11 -0800 Subject: [PATCH 0279/1117] Roll src/third_party/dart 7a63d31151..f7e435ac26 (252 commits) f7e435ac26 [ VM / Windows ] Removed call to SetThreadDescription which is only supported in new Win 10 builds bf7ecc40f9 [vm] Fix some compilation events to respect SUPPORT_TIMELINE instead of PRODUCT. fa0ba2220e [vm/compiler] Fix bug in Cid range computation afb8747fc2 [vm/tools] Add option in Graph Explorer to rewrite the graph to be more hierarchical. bf0568c548 Document restrictions on LSP refactors/code fixes 73e544ed0b Improve errors when LSP integration tests fail to spawn server 380cec1708 Wait for LSP server to be ready before sending exit command in integration test 1e60ddbc5b Make more LSP enum classes support "any value" 3dfa610694 Work around #35993 by allowing ints to be assigned to doubles in constants. 32eedccdcd [gardening] Fix patches restored in earlier commit. 38259ca3c8 [Kernel] Change block expression to have a block body b37de47842 [gardening] Restore flutter '--package' and dartjs_info_tag engine patch 76e3dfe096 Remove TypeEnvironment.legacyMode 20da48c7cf Remove unused legacyMode from constant transformer ceb998ecc0 Remove unused TargetFlags 6af24a2490 Move LSP diagnostic server test -> integration 34614ef995 Exit LSP server with exitCode=1 if there was no shutdown notification e7d263b05f [fasta] Transform set literals in annotations. 65698e2c2f Support mixin applications in type parser e395cdb1ad Support mutually recursive types 393c1df600 Improve performance of scope creation in type parser 03ee0fea51 [infra] Temporarily support both the old latest build step names. 944544137b Fix path to step log in approve_results.dart. 55c07c6d7a [vm] Fix null checks when CodeSourceMap is missing a481832df9 Add a failing test for recovery in typedef 010052cb2b Add an assist to convert conditional expressions to a null aware operator (issue 35691) 646c1f679a [tests] Minor fixes in control flow collections for tests f0155931a9 Fix null reference exception in _constantValuesEqual 5192cd1008 Narrowing improvements in dart2js global inference. ed796fcc3e Reland "Flatten constant operations to implement JS semantics by default." 8fface97f0 Reland "Eliminate singleton/static access to the constant system and expose its functionality at the top level." e40b0e04c9 Reland "Merge the JavaScript constant system into the base constant system and flatten the inheritance hierarchy." 6bdd38ae84 Reland "Move the JavaScript constant system into constants/constant_system.dart in preparation to merge it with the base constant system and flatten the constant system hierarchy." 960b08a969 Reland "Remove the Dart constant system and move all required classes into the JavaScript constant system." 6532b24d71 Implementing constant visitors. d9c05534de [dartdevc] Add helper methods to emit `For` and `ForOf` loops 620862fb13 [dartdevc] Support SetOrMapLiteral nodes 9b55682a5c Prepare to publish analyzer 0.35.2 e1992e0178 Revert "Remove the Dart constant system and move all required classes into the" 05d9c60a22 Revert "Move the JavaScript constant system into constants/constant_system.dart" 388f8e7731 Revert "Merge the JavaScript constant system into the base constant system and" 2c3dfa9e71 Revert "Eliminate singleton/static access to the constant system and expose its" 163c49fef9 Revert "Flatten constant operations to implement JS semantics by default." 8172270c95 Flatten constant operations to implement JS semantics by default. 027b76ecbf Eliminate singleton/static access to the constant system and expose its functionality at the top level. cf51eb2fba Merge the JavaScript constant system into the base constant system and flatten the inheritance hierarchy. 1702b986c8 Move the JavaScript constant system into constants/constant_system.dart in preparation to merge it with the base constant system and flatten the constant system hierarchy. 5af8de8954 Remove the Dart constant system and move all required classes into the JavaScript constant system. 272f58e543 Revise parser to generate handleLiteralSetOrMap 30b47d24e6 [sdk] Remove unused --packages flag no longer recognized by gen_snapshot. 0ad7caa5af [testing] Improve multitest error messages 58cea93953 Update BodyBuilder to use handleLiteralSetOrMap 8e2fcf7782 Advanced tracking of field initialization 60e4f194b0 Recognize and inline effectively constant fields db62dc5323 Remove hardcoded precedence integers in front end. 5aba7b7b85 Normalize expression precedence between analyzer and front_end. ff265bb5ae remove dead default lint registration API 2087d6db46 initializeFromComponent has to include platform 7f2a83ee07 BenchMaker: collect used type parameters b3c9aa624e BenchMaker: print call operators 74f0a36579 BenchMaker: Print function type arguments correctly 6b29680b12 Enable collection of type checks for benchmarking c9b8bae4e6 [Kernel] Add BlockExpression to the Kernel language e4d1b28698 Incremental compiler should respect omitPlatform setting 25bd6a1bd8 [CFE] Remove dead code for boolean method invocation. 128acb264b [VM] Decouple compile_type.h from runtime by making it only use runtime_api.h 93eca7745a Don't invalidate the entry point for no reason af65aec21f [dart2js] Fix assignment chaining bb8396592b [dart2js] Add tracing for codegen phases 3e304def65 switch dartdevc to kernel and fix path in rules. b60a55510b [dart2js] Disable assignment chaining optimization eff286becd Fix errors in mock SDK. 4a50b02364 [dartdevc] fix #36001, non-generic classes and recursive supertypes d253642f25 [standalone] Fix isolate messages for processes that a creating an AppJIT snapshot. f97f759ef3 Update the implementation of for loops 2b9e57e4b2 Move assignment chaining to own pass 627e96c9c1 [dartdevc] simplify microtask scheduling using JS Promise ee32f8c87e [VM] Rehash sets after they are read from a snapshot. 0e99581c35 [gardening] Restore flutter '--package' patch, add dartjs_info_tag engine patch a6f6c55dc8 [timeline] In newer versions of Catapult, arguments to an async end event override those in the async begin event. 4cff5a4fd6 [ VM / Service ] Dynamically load source from linked-in platform kernel bc53c4dcda Update AstBuilder unified collection parsing to reduce error messages e3b8065625 Add support for --dump-info=binary 372537f1e4 Add first support for strict-inference as an analysis option. c49537e743 Support for 'double' fields in summaries. 9cdc189280 Fix bugs in list literals and add some inference tests 75ee523f91 [VM] Remove flutter/flutter patch for 3head, the issue has been fixed upstream 4013b0eece [gardening] Add adjusted fix to flutter test patch. 69d46587cf [gardening] Add fix to flutter test patch. f5d43c45ea Include 'linterVersion' into AnalysisOption signature. e58b7cd59e [gardening] Fix flutter patch. 22e70ed48f [gardening] Patch flutter/flutter to fix hhh buildbot dc2422ef84 [vm, gc] Fix accounting of external sizes in the class table. bdb52a8f33 Fix 'Organize Directives' handling end-of-line comments. 371d244273 linter version support 435a52eafa [ VM / Service ] Fixed inconsistencies in service protocol spec. 8ac6114028 Sort AvailableDeclaration fields. 48a9eb87ba [analyzer] Add hint for unnecessary ?. ccb2e2d293 [analyzer] Report dead code for x ?? y where x is non-null 004dd969b0 Remove mock_type.dart, it looks that it is not used. 266ce73e28 Remove CompletionSuggestion.elementUri, replaced with AvailableSuggestionSet. 7ebb0411f3 Rework DartFix listener interface to separate edits from suggestions. 1c576b66bc Generalize FixCodeTask to handle arbitrary numbers of phases. fd377a4d6f Sort file non_nullable_fix.dart 98af688787 Sort dartfix_listener.dart 5ddd157809 fix uris for libraries to allow the breakpoint to lookup scripts. 7ebd02cdaa Work around for #35908. 3068192450 [vm] Remove deferred canonicalization from isolate message serialization. 0e453c637b [dart2js] Chain static assignments 8b0dd94e11 Revise AstBuilder to generate the new set-or-map AST structure 5e2529c82e Remove 'importUri' from CompletionSuggestion. 1699562dfc Remove unused AbstractSingleUnitTest. 27a805bde8 Add fast case for ASCII in Utf8Decoder, it significantly increases decoding speed 7edb7dddd8 Merge allocator analysis with collection of elided fields 6f8415245d [fasta] Transform set literals in initializers and default values. 9b10476092 [kernel/ffi] fix library paths ef9592a9c7 [kernel] Add (de)serialization for ExpressionStatements 187d6ceb20 [kernel] Add statements to Kernel (de)serialization verifier 395c0e4b98 [kernel] Add text (de)serialization for NamedTypes 14f5936468 [kernel] Simplify (de)serialization encoding for FunctionTypes 5e3e633d5d [kernel] Add text (de)serialization for TypeParameterTypes 923cea6652 [kernel] Add Bind and Binder combinators c19af8cee9 [kernel] Cleanup code for (De)SerializationEnvironment d60354b521 [kernel] Add binders and close terms as separate operations a3736868c0 [kernel] Add text (de)serialization for type parameters d76293a75a [testing] Add shared options on the test.py commandline. 596e0aa645 Include FieldInitializer in allocator analysis 8db489cb10 [vm/aot] Remove unnecessary closurization of some entry-points. c635896e1b [vm] Fix langauge_2_kernel.status after 93301 273856c6e3 Issue 3204. Support for local mixins as types. 45cb49108f Issue 3204. Include mixin(s) into top-level declaration for import Quick Fix. 6cf71022a8 Add a test for type promotion in "if" collection elements. 7df88e5755 Fix the lack of '`' in the doc. b83bcf59f2 Call dart::StubCode::Cleanup in AOT mode as well. 5722ca3126 Include defaultArgumentListString / defaultArgumentListTextRanges into AvailableSuggestion(s). 56356d426a Set 'displayUri' to IncludedSuggestionSet with file:// URIs. 43c4749f7e [dart2js] Turn on local aliases optimization 1ed9a34513 Add defaultArgumentListString / defaultArgumentListTextRanges to Declaration. c338941801 [ddc] Elide continue to next switch case 3a0ded6d54 Use _ExecutableParameters to access named parameter names. 4c1025493a Enhance available suggestions protocol. 28eb8604e3 Correctly handle invocations of top-level functions with an import prefix 0ef30fb86e Protocol for IncludedSuggestionSet.displayUri. bcd2c7fb96 Fix ListLiteral construction and add comments d3fde891bf [VM] Fix deadlock between mutator and BG compiler a85ae4e919 [vm/ffi] fix sizeOf on subtypes of Pointer 98bc608202 [testing] Blacklist tests and repeat options from reproduction commands 48beacfd78 Remove Kernel-based mixin inference e2b7f48333 Implement ClassHierarchyBuilder.getLegacyLeastUpperBound d19d50f45f Support async in LUB test 6a65f84a63 Implement longest path to Object 0720888236 Temporarily ignore context of errors in expression_test 6ccdffdb35 Test for expression compilation, type variables and initialize from dill 4bcc97a3d6 Don't run 'unbindCanonicalNames' in writeComponentToFile c9ef5be8d7 Issue 124524319. Improve getElementDeclaration to support invalid code with synthetic names. f9bb790f43 Add a fix to change invalid named argument names to an existing parameter name 1d1654592a Do not compute any imports for use on paste if import directives are being copied 03932bb852 Convert more diagnostic tests to DriverResolutionTest e1d3186ed9 Make declarations in provisional_api_test.dart private. bb76970857 Sort provisional_api_test.dart db71576ef3 [dart2js] Generator bodies can be on super mixin applications 711dd8e82e [dart2js] Avoid generating 'return' statement in setter f4b649ca4f [CFE] Propagate unevaluated constants upward. 5e70883859 [CFE] Refactor unevaluatedArguments cba4168da3 [CFE] Use _evaluateSubexpression in more places. 8e5f644d0a Use constant evaluation in allocator analysis bfa6041801 Add allocator analysis test for the J model 620743fb6b [vm/ffi] void functions 885f1cbe31 Fix constant folding of type literal equality 3638e433ce Change how DDC writes text when summarize-text is enabled 26970f370c Move source out of PotentialModification. f20ee58aa7 Remove references to the set-literals experiment 7d7d85ffa2 Change the default assumption for named parameters to "assume nullable". fa8c552fd9 Propagate non-null intent from callee to caller. ab38cf7897 Allow non-nullable usage to imply non-null intent. 24928ffcef [dartdevc] hide summarize-text option and change default to off 15e7457519 [dartdevc] change browser tests to wait longer for async completion 6b5424a7e7 Use SSA nodes to infer map key/value types. ec599a5977 [VM] Remove retry logic from close(fd) calls 1ac61b0c35 [dart2js] Basic chaining of field assignments 8cb4d00b0b Remove compareXyz() methods from ResynthesizeTestHelpers. 936b1c0404 Rename _mockOr to _either. 046928d502 [vm/kernel] Ignore package URIs when converting main script to package URI 99a5057bca Add set tracing. c291757bed Finish handling SetLiterals in the inferrer and SSA builder kernels. d11dd982dd Add typeinfo for sets and their elements and start tracing them in the inferrer. 61ab8e7816 Add kernel and backend impacts for set literals. d87482a3e1 Add SetLiteralUse and start tracking them in resolution. 97bfcd4a3a Add remaining support for sets to the abstract value domain. This lets us create set values and access their element types in the inferrer. e53cd30112 Add SetTypeMask. 15cd12beb4 Add SetConstantValue and SetConstantExpression plus their visitors. c841f050c0 Add set types to the abstract value domain. We cannot yet allocate sets. 51db39a6ae Implement basic SetLiteral visitors. Builder kernels will come later. a164e95582 Update CommonElements with set types. cd53e3b4df Patch factories for generating set literals into LinkedHashSet. 6846a7c486 Fix flutter analyzer bot by disabling lint prefer_collection_literals. cf63db2594 [VM/infra] Archive kernel-service.dart.snapshot together with coredumps 015cf88ef6 Disable set literal warning until engine rolls into flutter/flutter fd8b546800 Issue 35940. Clear evaluation results for constants in the library being analyzed. 39afa4e555 Revert "Add ExecutableElement(s) based InheritanceManager3, and switch analyzer to it." 078f8e67f8 Tests for invalid library id, and requested name. 122aa43ef6 Convert ListLiteral and remove uses of ListLiteral2 6df253db27 Update parse/tryParse documentation. 5622925369 Test of class hierachy from dill file f4379435dd Implement DillClassBuilder.typeVariables d1abd84944 [infra] Add named configuration option to test.dart. 20c3cd62fc Revert adding dart:ffi to core_types and fasta kernel_target 185c0f3e89 [gardening] status file entry for entrypoints_verification_test b15fe3a994 pkg:kernel: fix path to pkg:test in pubspec 763589472e [VM / vmservice] - Change setting of silentObservatory to a non const expression 0e62060be4 [test] Mark standalone_2/io/arguments_test as failing due to a bug in the test harness. eb73f132c1 [vm] Add macro for fallthrough annotations b66dc30334 [VM/interpreter] Skip tests enabling interpreter when not supported (fixes #35943). 65290f6e6a Add an option for reusing the previous compiler state in a worker 794e1e3a09 [gen_snapshot] Allow for multiple kernel inputs. c8abe45b00 Retry 'getSuggestionDetails' on InconsistentAnalysisException. 54dbc0068a Migrate resynthesizer tests from task model. 79b4b558ec [vm/tlab] Abandon tlab when thread gets descheduled. Allow all threads to allocate from tlab. Add tlab test. 59efe201fd Fix mistake in CHANGELOG. 48f7364d7b Remove the UX experiment 2 flag from the Dart Analysis Server. 6c96ff0145 Test case reproducing issue #35940 3b2144fa93 [vm] Respect entry-point annotation on constructors during obfuscation. d1b15cc92c Support for FieldFormalParameter in SyntacticScopeNamesCollector. ed94feb30e Update dartdoc version to 0.28.2. 223eaa6fbb Report noSuchMethod forwarders as synthetic in the mirror api 5d6bab4ed2 Add ExecutableElement(s) based InheritanceManager3, and switch analyzer to it. ae7bf9e999 [vm] Support closurization of methods through @pragma entry-points. a5d396cd25 [vm/extensions] Fix native extensions in hot-reload and running from snapshot. 4daabe69c3 [vm/gardening] Mark convert/base64_test/01 as flaky 69a952b195 remove parseSetLiterals flag from tests 3abc7d34d7 [vm/ffi] Remove platform specific logic from DynamicLibrary.open 6a5c9597c6 Revert adding enclosingLibrary to ast.dart 8333c8a4d0 Revert adding dart:ffi to devc libraries e9f239777f Split test so Kernel ClassHierarchy isn't required 25ee9b9d47 Rename test 837145a7c7 Properly restore state of _inConditionalControlFlow upon entering new function/method. dfda06061a Restore state safely in migration visitors. 765e6338a8 [docs] classify dart:ffi as vm on docs site, and exclude it for now 70e300fea0 [co19] DEPS updated 7ff5be0ceb Convert LUB test to use type parser 763035eb40 Clean up and merge dev CHANGELOG entries for stable release. 92460b8923 Migration: use non-null assertions as a hint for parameters that should not be nullable. 80798fad97 [tests] Add missing parenthesis on Equals() calls 46aa511b49 Improve the message when using a prefix to reference an undefined name (issue 35936) f4ec983fec Migrate the rest of element_test from task model. 94d8e730fb Remove parser enableSetLiterals flag 9b45c14c65 First stage cleanup of MapLiteral2 and SetLiteral2 486238df49 Remove the UX experiment 1 flag from the Dart Analysis Server. fa092aa77b [vm/compiler] actual string constant propagation 44eb626186 [VM} Fix script URLs for dart:* libraries 9ca9e66c1b [dartdevc] fix #35928, type literals are now instantiated to bounds 0f24b9e7ae [standalone] Name dart:io threads, take 2. --- DEPS | 6 +++--- ci/licenses_golden/licenses_third_party | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index 439e0cde4cbb7..1a7ec07ffdd17 100644 --- a/DEPS +++ b/DEPS @@ -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': '7a63d31151e4c18505df910c564be171fa6f7330', + 'dart_revision': 'f7e435ac26d5254b8694403a59203f6349dec208', # 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,9 +47,9 @@ 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.15', + 'dart_dart2js_info_tag': '0.6.0', 'dart_dart_style_tag': '1.2.2', - 'dart_dartdoc_tag': 'v0.28.1+2', + 'dart_dartdoc_tag': 'v0.28.2', 'dart_fixnum_tag': '0.10.9', 'dart_glob_tag': '1.1.7', 'dart_html_tag': '0.13.3+2', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 249357260bd81..96980d4b2204d 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: cc36b7aa35de39c80eb1abf7a71a88d8 +Signature: 2a3c0900bc68d785d90b2766bbcd7351 UNUSED LICENSES: @@ -5753,6 +5753,7 @@ FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm.cc FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm64.cc FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_x64.cc FILE: ../../../third_party/dart/samples/ffi/coordinate.dart +FILE: ../../../third_party/dart/samples/ffi/dylib_utils.dart FILE: ../../../third_party/dart/samples/ffi/sample_ffi_data.dart FILE: ../../../third_party/dart/samples/ffi/sample_ffi_dynamic_library.dart FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions.dart From 3962bbdc608ca183d7683b705086940910af9c16 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 26 Feb 2019 01:22:30 -0500 Subject: [PATCH 0280/1117] Roll src/third_party/skia bcfbf6e94c22..ac6d4c0c8eae (1 commits) (#7958) https://skia.googlesource.com/skia.git/%2Blog/bcfbf6e94c22..ac6d4c0c8eae git log bcfbf6e94c2272b0a030a8763e2abcfe4b55395c..ac6d4c0c8eae8a90185da16ab01c81921669cc1f --date=short --no-merges --format=%ad %ae %s 2019-02-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 9b433073ba38..53c8957c337d (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 1a7ec07ffdd17..a65e50b04ca87 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': 'bcfbf6e94c2272b0a030a8763e2abcfe4b55395c', + 'skia_revision': 'ac6d4c0c8eae8a90185da16ab01c81921669cc1f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 38a9655d47ba9..b1d8e9f73322d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 186c1643cc6eaf037a08e71cb906d1e6 +Signature: edaf760039f49bc2a4eec3c5617d3293 UNUSED LICENSES: From 31d31e6d2ae853798c105f606bf2e5cfdd6e0b04 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Tue, 26 Feb 2019 01:48:09 -0800 Subject: [PATCH 0281/1117] Android PR 7: Introduce structure of FlutterActivity and FlutterFragment (#7912) --- ci/licenses_golden/licenses_flutter | 3 + shell/platform/android/BUILD.gn | 3 + .../embedding/engine/FlutterShellArgs.java | 131 ++++++++++ .../engine/android/FlutterActivity.java | 240 ++++++++++++++++++ .../engine/android/FlutterFragment.java | 152 +++++++++++ 5 files changed, 529 insertions(+) create mode 100644 shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java create mode 100644 shell/platform/android/io/flutter/embedding/engine/android/FlutterActivity.java create mode 100644 shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 802f6b0b67a66..f03f4dff62755 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -471,7 +471,10 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterFragmentActi FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterPluginRegistry.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/android/AndroidKeyProcessor.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterActivity.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index 9b430a0092479..fa55b71b96fbe 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -108,7 +108,10 @@ java_library("flutter_shell_java") { "io/flutter/app/FlutterPluginRegistry.java", "io/flutter/embedding/engine/FlutterEngine.java", "io/flutter/embedding/engine/FlutterJNI.java", + "io/flutter/embedding/engine/FlutterShellArgs.java", "io/flutter/embedding/engine/android/AndroidKeyProcessor.java", + "io/flutter/embedding/engine/android/FlutterActivity.java", + "io/flutter/embedding/engine/android/FlutterFragment.java", "io/flutter/embedding/engine/android/FlutterSurfaceView.java", "io/flutter/embedding/engine/android/FlutterTextureView.java", "io/flutter/embedding/engine/android/FlutterView.java", diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java b/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java new file mode 100644 index 0000000000000..c3b2c9b71531e --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java @@ -0,0 +1,131 @@ +// Copyright 2013 The Flutter 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; +import android.content.Intent; +import android.support.annotation.NonNull; + +import java.util.*; + +/** + * Arguments that can be delivered to the Flutter shell when it is created. + *

+ * WARNING: THIS CLASS IS EXPERIMENTAL. DO NOT SHIP A DEPENDENCY ON THIS CODE. + * IF YOU USE IT, WE WILL BREAK YOU. + *

+ * The term "shell" refers to the native code that adapts Flutter to different platforms. Flutter's + * Android Java code initializes a native "shell" and passes these arguments to that native shell + * when it is initialized. See {@link io.flutter.view.FlutterMain#ensureInitializationComplete(Context, String[])} + * for more information. + */ +@SuppressWarnings({"WeakerAccess", "unused"}) +public class FlutterShellArgs { + public static final String ARG_KEY_TRACE_STARTUP = "trace-startup"; + public static final String ARG_TRACE_STARTUP = "--trace-startup"; + public static final String ARG_KEY_START_PAUSED = "start-paused"; + public static final String ARG_START_PAUSED = "--start-paused"; + public static final String ARG_KEY_USE_TEST_FONTS = "use-test-fonts"; + public static final String ARG_USE_TEST_FONTS = "--use-test-fonts"; + public static final String ARG_KEY_ENABLE_DART_PROFILING = "enable-dart-profiling"; + public static final String ARG_ENABLE_DART_PROFILING = "--enable-dart-profiling"; + public static final String ARG_KEY_ENABLE_SOFTWARE_RENDERING = "enable-software-rendering"; + public static final String ARG_ENABLE_SOFTWARE_RENDERING = "--enable-software-rendering"; + public static final String ARG_KEY_SKIA_DETERMINISTIC_RENDERING = "skia-deterministic-rendering"; + public static final String ARG_SKIA_DETERMINISTIC_RENDERING = "--skia-deterministic-rendering"; + public static final String ARG_KEY_TRACE_SKIA = "trace-skia"; + public static final String ARG_TRACE_SKIA = "--trace-skia"; + public static final String ARG_KEY_VERBOSE_LOGGING = "verbose-logging"; + public static final String ARG_VERBOSE_LOGGING = "--verbose-logging"; + + @NonNull + public static FlutterShellArgs fromIntent(@NonNull Intent intent) { + // Before adding more entries to this list, consider that arbitrary + // Android applications can generate intents with extra data and that + // there are many security-sensitive args in the binary. + // TODO(mattcarroll): I left this warning as-is, but we should clarify what exactly this warning is warning against. + ArrayList args = new ArrayList<>(); + + if (intent.getBooleanExtra(ARG_KEY_TRACE_STARTUP, false)) { + args.add(ARG_TRACE_STARTUP); + } + if (intent.getBooleanExtra(ARG_KEY_START_PAUSED, false)) { + args.add(ARG_START_PAUSED); + } + if (intent.getBooleanExtra(ARG_KEY_USE_TEST_FONTS, false)) { + args.add(ARG_USE_TEST_FONTS); + } + if (intent.getBooleanExtra(ARG_KEY_ENABLE_DART_PROFILING, false)) { + args.add(ARG_ENABLE_DART_PROFILING); + } + if (intent.getBooleanExtra(ARG_KEY_ENABLE_SOFTWARE_RENDERING, false)) { + args.add(ARG_ENABLE_SOFTWARE_RENDERING); + } + if (intent.getBooleanExtra(ARG_KEY_SKIA_DETERMINISTIC_RENDERING, false)) { + args.add(ARG_SKIA_DETERMINISTIC_RENDERING); + } + if (intent.getBooleanExtra(ARG_KEY_TRACE_SKIA, false)) { + args.add(ARG_TRACE_SKIA); + } + if (intent.getBooleanExtra(ARG_KEY_VERBOSE_LOGGING, false)) { + args.add(ARG_VERBOSE_LOGGING); + } + + return new FlutterShellArgs(args); + } + + private Set args; + + /** + * Creates a set of Flutter shell arguments from a given {@code String[]} array. + * The given arguments are automatically de-duplicated. + */ + public FlutterShellArgs(@NonNull String[] args) { + this.args = new HashSet<>(Arrays.asList(args)); + } + + /** + * Creates a set of Flutter shell arguments from a given {@code List}. + * The given arguments are automatically de-duplicated. + */ + public FlutterShellArgs(@NonNull List args) { + this.args = new HashSet<>(args); + } + + /** + * Creates a set of Flutter shell arguments from a given {@code Set}. + */ + public FlutterShellArgs(@NonNull Set args) { + this.args = new HashSet<>(args); + } + + /** + * Adds the given {@code arg} to this set of arguments. + * @param arg argument to add + */ + public void add(@NonNull String arg) { + args.add(arg); + } + + /** + * Removes the given {@code arg} from this set of arguments. + * @param arg argument to remove + */ + public void remove(@NonNull String arg) { + args.remove(arg); + } + + /** + * Returns a new {@code String[]} array which contains each of the arguments + * within this {@code FlutterShellArgs}. + * + * @return array of arguments + */ + @NonNull + public String[] toArray() { + String[] argsArray = new String[args.size()]; + return args.toArray(argsArray); + } +} \ No newline at end of file diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterActivity.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterActivity.java new file mode 100644 index 0000000000000..182a097f9c0f7 --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterActivity.java @@ -0,0 +1,240 @@ +// Copyright 2013 The Flutter 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.android; + +import android.content.Context; +import android.content.Intent; +import android.content.pm.ActivityInfo; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.v4.app.FragmentActivity; +import android.support.v4.app.FragmentManager; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; + +import io.flutter.embedding.engine.FlutterShellArgs; +import io.flutter.view.FlutterMain; + +/** + * {@code Activity} which displays a fullscreen Flutter UI. + *

+ * WARNING: THIS CLASS IS EXPERIMENTAL. DO NOT SHIP A DEPENDENCY ON THIS CODE. + * IF YOU USE IT, WE WILL BREAK YOU. + *

+ * {@code FlutterActivity} is the simplest and most direct way to integrate Flutter within an + * Android app. + *

+ * The Dart entrypoint executed within this {@code Activity} is "main()" by default. The entrypoint + * may be specified explicitly by passing the name of the entrypoint method as a {@code String} in + * {@link #EXTRA_DART_ENTRYPOINT}, e.g., "myEntrypoint". + *

+ * The Flutter route that is initially loaded within this {@code Activity} is "/". The initial + * route may be specified explicitly by passing the name of the route as a {@code String} in + * {@link #EXTRA_INITIAL_ROUTE}, e.g., "my/deep/link". + *

+ * The app bundle path, Dart entrypoint, and initial route can each be controlled in a subclass of + * {@code FlutterActivity} by overriding their respective methods: + *

    + *
  • {@link #getAppBundlePath()}
  • + *
  • {@link #getDartEntrypoint()}
  • + *
  • {@link #getInitialRoute()}
  • + *
+ * If Flutter is needed in a location that cannot use an {@code Activity}, consider using + * a {@link FlutterFragment}. Using a {@link FlutterFragment} requires forwarding some calls from + * an {@code Activity} to the {@link FlutterFragment}. + *

+ * If Flutter is needed in a location that can only use a {@code View}, consider using a + * {@link FlutterView}. Using a {@link FlutterView} requires forwarding some calls from an + * {@code Activity}, as well as forwarding lifecycle calls from an {@code Activity} or a + * {@code Fragment}. + */ +// TODO(mattcarroll): explain each call forwarded to Fragment (first requires resolution of PluginRegistry API). +public class FlutterActivity extends FragmentActivity { + private static final String TAG = "FlutterActivity"; + + // Meta-data arguments, processed from manifest XML. + private static final String DART_ENTRYPOINT_META_DATA_KEY = "io.flutter.Entrypoint"; + private static final String INITIAL_ROUTE_META_DATA_KEY = "io.flutter.InitialRoute"; + + // Intent extra arguments. + public static final String EXTRA_DART_ENTRYPOINT = "dart_entrypoint"; + public static final String EXTRA_INITIAL_ROUTE = "initial_route"; + + // FlutterFragment management. + private static final String TAG_FLUTTER_FRAGMENT = "flutter_fragment"; + // TODO(mattcarroll): replace ID with R.id when build system supports R.java + private static final int FRAGMENT_CONTAINER_ID = 609893468; // random number + private FlutterFragment flutterFragment; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(createFragmentContainer()); + ensureFlutterFragmentCreated(); + } + + /** + * Creates a {@link FrameLayout} with an ID of {@code #FRAGMENT_CONTAINER_ID} that will contain + * the {@link FlutterFragment} displayed by this {@code FlutterActivity}. + *

+ * @return the FrameLayout container + */ + @NonNull + private View createFragmentContainer() { + FrameLayout container = new FrameLayout(this); + container.setId(FRAGMENT_CONTAINER_ID); + container.setLayoutParams(new ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT + )); + return container; + } + + /** + * Ensure that a {@link FlutterFragment} is attached to this {@code FlutterActivity}. + *

+ * If no {@link FlutterFragment} exists in this {@code FlutterActivity}, then a {@link FlutterFragment} + * is created and added. If a {@link FlutterFragment} does exist in this {@code FlutterActivity}, then + * a reference to that {@link FlutterFragment} is retained in {@code #flutterFragment}. + */ + private void ensureFlutterFragmentCreated() { + FragmentManager fragmentManager = getSupportFragmentManager(); + flutterFragment = (FlutterFragment) fragmentManager.findFragmentByTag(TAG_FLUTTER_FRAGMENT); + if (flutterFragment == null) { + // No FlutterFragment exists yet. This must be the initial Activity creation. We will create + // and add a new FlutterFragment to this Activity. + flutterFragment = createFlutterFragment(); + fragmentManager + .beginTransaction() + .add(FRAGMENT_CONTAINER_ID, flutterFragment, TAG_FLUTTER_FRAGMENT) + .commit(); + } + } + + /** + * Creates the instance of the {@link FlutterFragment} that this {@code FlutterActivity} displays. + *

+ * Subclasses may override this method to return a specialization of {@link FlutterFragment}. + */ + @NonNull + protected FlutterFragment createFlutterFragment() { + return FlutterFragment.newInstance( + getDartEntrypoint(), + getInitialRoute(), + getAppBundlePath(), + FlutterShellArgs.fromIntent(getIntent()) + ); + } + + /** + * The path to the bundle that contains this Flutter app's resources, e.g., Dart code snapshots. + *

+ * When this {@code FlutterActivity} is run by Flutter tooling and a data String is included + * in the launching {@code Intent}, that data String is interpreted as an app bundle path. + *

+ * By default, the app bundle path is obtained from {@link FlutterMain#findAppBundlePath(Context)}. + *

+ * Subclasses may override this method to return a custom app bundle path. + */ + @NonNull + protected String getAppBundlePath() { + // If this Activity was launched from tooling, and the incoming Intent contains + // a custom app bundle path, return that path. + // TODO(mattcarroll): determine if we should have an explicit FlutterTestActivity instead of conflating. + if (isDebuggable() && Intent.ACTION_RUN.equals(getIntent().getAction())) { + String appBundlePath = getIntent().getDataString(); + if (appBundlePath != null) { + return appBundlePath; + } + } + + // Return the default app bundle path. + // TODO(mattcarroll): move app bundle resolution into an appropriately named class. + return FlutterMain.findAppBundlePath(getApplicationContext()); + } + + /** + * The Dart entrypoint that will be executed as soon as the Dart snapshot is loaded. + *

+ * This preference can be controlled with 2 methods: + *

    + *
  1. Pass a {@code String} as {@link #EXTRA_DART_ENTRYPOINT} with the launching {@code Intent}, or
  2. + *
  3. Set a {@code } called {@link #DART_ENTRYPOINT_META_DATA_KEY} for this + * {@code Activity} in the Android manifest.
  4. + *
+ * If both preferences are set, the {@code Intent} preference takes priority. + *

+ * The reason that a {@code } preference is supported is because this {@code Activity} + * might be the very first {@code Activity} launched, which means the developer won't have + * control over the incoming {@code Intent}. + *

+ * Subclasses may override this method to directly control the Dart entrypoint. + */ + @Nullable + protected String getDartEntrypoint() { + if (getIntent().hasExtra(EXTRA_DART_ENTRYPOINT)) { + return getIntent().getStringExtra(EXTRA_DART_ENTRYPOINT); + } + + try { + ActivityInfo activityInfo = getPackageManager().getActivityInfo( + getComponentName(), + PackageManager.GET_META_DATA|PackageManager.GET_ACTIVITIES + ); + Bundle metadata = activityInfo.metaData; + return metadata != null ? metadata.getString(DART_ENTRYPOINT_META_DATA_KEY) : null; + } catch (PackageManager.NameNotFoundException e) { + return null; + } + } + + /** + * The initial route that a Flutter app will render upon loading and executing its Dart code. + *

+ * This preference can be controlled with 2 methods: + *

    + *
  1. Pass a boolean as {@link #EXTRA_INITIAL_ROUTE} with the launching {@code Intent}, or
  2. + *
  3. Set a {@code } called {@link #INITIAL_ROUTE_META_DATA_KEY} for this + * {@code Activity} in the Android manifest.
  4. + *
+ * If both preferences are set, the {@code Intent} preference takes priority. + *

+ * The reason that a {@code } preference is supported is because this {@code Activity} + * might be the very first {@code Activity} launched, which means the developer won't have + * control over the incoming {@code Intent}. + *

+ * Subclasses may override this method to directly control the initial route. + */ + @Nullable + protected String getInitialRoute() { + if (getIntent().hasExtra(EXTRA_INITIAL_ROUTE)) { + return getIntent().getStringExtra(EXTRA_INITIAL_ROUTE); + } + + try { + ActivityInfo activityInfo = getPackageManager().getActivityInfo( + getComponentName(), + PackageManager.GET_META_DATA|PackageManager.GET_ACTIVITIES + ); + Bundle metadata = activityInfo.metaData; + return metadata != null ? metadata.getString(INITIAL_ROUTE_META_DATA_KEY) : null; + } catch (PackageManager.NameNotFoundException e) { + return null; + } + } + + /** + * Returns true if Flutter is running in "debug mode", and false otherwise. + *

+ * Debug mode allows Flutter to operate with hot reload and hot restart. Release mode does not. + */ + private boolean isDebuggable() { + return (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; + } +} diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java new file mode 100644 index 0000000000000..89f25e4dd5f11 --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java @@ -0,0 +1,152 @@ +// Copyright 2013 The Flutter 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.android; + +import android.content.Intent; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; + +import io.flutter.embedding.engine.FlutterShellArgs; + +/** + * {@code Fragment} which displays a Flutter UI that takes up all available {@code Fragment} space. + *

+ * WARNING: THIS CLASS IS EXPERIMENTAL. DO NOT SHIP A DEPENDENCY ON THIS CODE. + * IF YOU USE IT, WE WILL BREAK YOU. + *

+ * Using a {@code FlutterFragment} requires forwarding a number of calls from an {@code Activity} to + * ensure that the internal Flutter app behaves as expected: + *

    + *
  1. {@link Activity#onPostResume()}
  2. + *
  3. {@link Activity#onBackPressed()}
  4. + *
  5. {@link Activity#onRequestPermissionsResult(int, String[], int[])} ()}
  6. + *
  7. {@link Activity#onNewIntent(Intent)} ()}
  8. + *
  9. {@link Activity#onUserLeaveHint()}
  10. + *
  11. {@link Activity#onTrimMemory(int)}
  12. + *
+ * Additionally, when starting an {@code Activity} for a result from this {@code Fragment}, be sure + * to invoke {@link Fragment#startActivityForResult(Intent, int)} rather than + * {@link Activity#startActivityForResult(Intent, int)}. If the {@code Activity} version of the + * method is invoked then this {@code Fragment} will never receive its + * {@link Fragment#onActivityResult(int, int, Intent)} callback. + *

+ * If convenient, consider using a {@link FlutterActivity} instead of a {@code FlutterFragment} to + * avoid the work of forwarding calls. + *

+ * If Flutter is needed in a location that can only use a {@code View}, consider using a + * {@link FlutterView}. Using a {@link FlutterView} requires forwarding some calls from an + * {@code Activity}, as well as forwarding lifecycle calls from an {@code Activity} or a + * {@code Fragment}. + */ +public class FlutterFragment extends Fragment { + private static final String TAG = "FlutterFragment"; + + private static final String ARG_DART_ENTRYPOINT = "dart_entrypoint"; + private static final String ARG_INITIAL_ROUTE = "initial_route"; + private static final String ARG_APP_BUNDLE_PATH = "app_bundle_path"; + private static final String ARG_FLUTTER_INITIALIZATION_ARGS = "initialization_args"; + + /** + * Factory method that creates a new {@link FlutterFragment} with a default configuration. + *

    + *
  • default Dart entrypoint of "main"
  • + *
  • initial route of "/"
  • + *
  • default app bundle location
  • + *
  • no special engine arguments
  • + *
+ * @return new {@link FlutterFragment} + */ + public static FlutterFragment newInstance() { + return newInstance( + null, + null, + null, + null + ); + } + + /** + * Factory method that creates a new {@link FlutterFragment} with the given configuration. + *

+ * @param dartEntrypoint the name of the initial Dart method to invoke, defaults to "main" + * @param initialRoute the first route that a Flutter app will render in this {@link FlutterFragment}, + * defaults to "/" + * @param appBundlePath the path to the app bundle which contains the Dart app to execute, defaults + * to {@link FlutterMain#findAppBundlePath(Context)} + * @param flutterShellArgs any special configuration arguments for the Flutter engine + * + * @return a new {@link FlutterFragment} + */ + public static FlutterFragment newInstance(@Nullable String dartEntrypoint, + @Nullable String initialRoute, + @Nullable String appBundlePath, + @Nullable FlutterShellArgs flutterShellArgs) { + FlutterFragment frag = new FlutterFragment(); + + Bundle args = createArgsBundle( + dartEntrypoint, + initialRoute, + appBundlePath, + flutterShellArgs + ); + frag.setArguments(args); + + return frag; + } + + /** + * Creates a {@link Bundle} of arguments that can be used to configure a {@link FlutterFragment}. + * This method is exposed so that developers can create subclasses of {@link FlutterFragment}. + * Subclasses should declare static factories that use this method to create arguments that will + * be understood by the base class, and then the subclass can add any additional arguments it + * wants to this {@link Bundle}. Example: + *

{@code
+   * public static MyFlutterFragment newInstance(String myNewArg) {
+   *   // Create an instance of our subclass Fragment.
+   *   MyFlutterFragment myFrag = new MyFlutterFragment();
+   *
+   *   // Create the Bundle or args that FlutterFragment understands.
+   *   Bundle args = FlutterFragment.createArgsBundle(...);
+   *
+   *   // Add our new args to the bundle.
+   *   args.putString(ARG_MY_NEW_ARG, myNewArg);
+   *
+   *   // Give the args to our subclass Fragment.
+   *   myFrag.setArguments(args);
+   *
+   *   // Return the newly created subclass Fragment.
+   *   return myFrag;
+   * }
+   * }
+ * + * @param dartEntrypoint the name of the initial Dart method to invoke, defaults to "main" + * @param initialRoute the first route that a Flutter app will render in this {@link FlutterFragment}, defaults to "/" + * @param appBundlePath the path to the app bundle which contains the Dart app to execute + * @param flutterShellArgs any special configuration arguments for the Flutter engine + * + * @return Bundle of arguments that configure a {@link FlutterFragment} + */ + protected static Bundle createArgsBundle(@Nullable String dartEntrypoint, + @Nullable String initialRoute, + @Nullable String appBundlePath, + @Nullable FlutterShellArgs flutterShellArgs) { + Bundle args = new Bundle(); + args.putString(ARG_INITIAL_ROUTE, initialRoute); + args.putString(ARG_APP_BUNDLE_PATH, appBundlePath); + args.putString(ARG_DART_ENTRYPOINT, dartEntrypoint); + // TODO(mattcarroll): determine if we should have an explicit FlutterTestFragment instead of conflating. + if (null != flutterShellArgs) { + args.putStringArray(ARG_FLUTTER_INITIALIZATION_ARGS, flutterShellArgs.toArray()); + } + return args; + } + + public FlutterFragment() { + // Ensure that we at least have an empty Bundle of arguments so that we don't + // need to continually check for null arguments before grabbing one. + setArguments(new Bundle()); + } +} From 9f95ef23aac76c4f112446412cc6ae117e743378 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Tue, 26 Feb 2019 01:54:17 -0800 Subject: [PATCH 0282/1117] Android Embedding PR 8: Add FlutterEngine attachment/detachment to FlutterView (#7946) --- .../engine/android/FlutterSurfaceView.java | 25 +++++-- .../engine/android/FlutterTextureView.java | 27 +++++-- .../embedding/engine/android/FlutterView.java | 74 +++++++++++++++++++ .../engine/renderer/FlutterRenderer.java | 16 ++++ .../io/flutter/view/FlutterNativeView.java | 11 +++ 5 files changed, 143 insertions(+), 10 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java index 5e05c2d398fb0..edbe8645d32d1 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java @@ -20,10 +20,10 @@ * Paints a Flutter UI on a {@link android.view.Surface}. * * To begin rendering a Flutter UI, the owner of this {@code FlutterSurfaceView} must invoke - * {@link #onAttachedToRenderer(FlutterRenderer)} with the desired {@link FlutterRenderer}. + * {@link #attachToRenderer(FlutterRenderer)} with the desired {@link FlutterRenderer}. * * To stop rendering a Flutter UI, the owner of this {@code FlutterSurfaceView} must invoke - * {@link #onDetachedFromRenderer()}. + * {@link #detachFromRenderer()}. * * A {@code FlutterSurfaceView} is intended for situations where a developer needs to render * a Flutter UI, but does not require any keyboard input, gesture input, accessibility @@ -31,7 +31,7 @@ * desired, consider using a {@link FlutterView} which provides all of these behaviors and * utilizes a {@code FlutterSurfaceView} internally. */ -public class FlutterSurfaceView extends SurfaceView { +public class FlutterSurfaceView extends SurfaceView implements FlutterRenderer.RenderSurface { private static final String TAG = "FlutterSurfaceView"; private boolean isSurfaceAvailableForRendering = false; @@ -103,7 +103,7 @@ private void init() { * If no Android {@link android.view.Surface} is available yet, this {@code FlutterSurfaceView} * will wait until a {@link android.view.Surface} becomes available and then begin rendering. */ - public void onAttachedToRenderer(@NonNull FlutterRenderer flutterRenderer) { + public void attachToRenderer(@NonNull FlutterRenderer flutterRenderer) { if (this.flutterRenderer != null) { this.flutterRenderer.detachFromRenderSurface(); } @@ -124,7 +124,7 @@ public void onAttachedToRenderer(@NonNull FlutterRenderer flutterRenderer) { * * This method will cease any on-going rendering from Flutter to this {@code FlutterSurfaceView}. */ - public void onDetachedFromRenderer() { + public void detachFromRenderer() { if (flutterRenderer != null) { // If we're attached to an Android window then we were rendering a Flutter UI. Now that // this FlutterSurfaceView is detached from the FlutterRenderer, we need to stop rendering. @@ -165,4 +165,19 @@ private void disconnectSurfaceFromRenderer() { flutterRenderer.surfaceDestroyed(); } + + @Override + public void updateCustomAccessibilityActions(ByteBuffer buffer, String[] strings) { + // TODO(mattcarroll): refactor RenderSurface to move this method somewhere else. + } + + @Override + public void updateSemantics(ByteBuffer buffer, String[] strings) { + // TODO(mattcarroll): refactor RenderSurface to move this method somewhere else. + } + + @Override + public void onFirstFrameRendered() { + // TODO(mattcarroll): decide where this method should live and what it needs to do. + } } diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java index 41a298bddd24c..8ea3fee2d6327 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java @@ -13,16 +13,18 @@ import android.view.Surface; import android.view.TextureView; +import java.nio.ByteBuffer; + import io.flutter.embedding.engine.renderer.FlutterRenderer; /** * Paints a Flutter UI on a {@link SurfaceTexture}. * * To begin rendering a Flutter UI, the owner of this {@code FlutterTextureView} must invoke - * {@link #onAttachedToRenderer(FlutterRenderer)} with the desired {@link FlutterRenderer}. + * {@link #attachToRenderer(FlutterRenderer)} with the desired {@link FlutterRenderer}. * * To stop rendering a Flutter UI, the owner of this {@code FlutterTextureView} must invoke - * {@link #onDetachedFromRenderer()}. + * {@link #detachFromRenderer()}. * * A {@code FlutterTextureView} is intended for situations where a developer needs to render * a Flutter UI, but does not require any keyboard input, gesture input, accessibility @@ -30,7 +32,7 @@ * desired, consider using a {@link FlutterView} which provides all of these behaviors and * utilizes a {@code FlutterTextureView} internally. */ -public class FlutterTextureView extends TextureView { +public class FlutterTextureView extends TextureView implements FlutterRenderer.RenderSurface { private static final String TAG = "FlutterTextureView"; private boolean isSurfaceAvailableForRendering = false; @@ -115,7 +117,7 @@ private void init() { * If no Android {@link SurfaceTexture} is available yet, this {@code FlutterSurfaceView} * will wait until a {@link SurfaceTexture} becomes available and then begin rendering. */ - public void onAttachedToRenderer(@NonNull FlutterRenderer flutterRenderer) { + public void attachToRenderer(@NonNull FlutterRenderer flutterRenderer) { if (this.flutterRenderer != null) { this.flutterRenderer.detachFromRenderSurface(); } @@ -136,7 +138,7 @@ public void onAttachedToRenderer(@NonNull FlutterRenderer flutterRenderer) { * * This method will cease any on-going rendering from Flutter to this {@code FlutterTextureView}. */ - public void onDetachedFromRenderer() { + public void detachFromRenderer() { if (flutterRenderer != null) { // If we're attached to an Android window then we were rendering a Flutter UI. Now that // this FlutterTextureView is detached from the FlutterRenderer, we need to stop rendering. @@ -177,4 +179,19 @@ private void disconnectSurfaceFromRenderer() { flutterRenderer.surfaceDestroyed(); } + + @Override + public void updateCustomAccessibilityActions(ByteBuffer buffer, String[] strings) { + // TODO(mattcarroll): refactor RenderSurface to move this method somewhere else. + } + + @Override + public void updateSemantics(ByteBuffer buffer, String[] strings) { + // TODO(mattcarroll): refactor RenderSurface to move this method somewhere else. + } + + @Override + public void onFirstFrameRendered() { + // TODO(mattcarroll): decide where this method should live and what it needs to do. + } } diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java index ce6f30d1750b2..4e4886a871331 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java @@ -11,6 +11,9 @@ import android.util.Log; import android.widget.FrameLayout; +import io.flutter.embedding.engine.FlutterEngine; +import io.flutter.embedding.engine.renderer.FlutterRenderer; + /** * Displays a Flutter UI on an Android device. *

@@ -35,9 +38,18 @@ public class FlutterView extends FrameLayout { private static final String TAG = "FlutterView"; + // Behavior configuration of this FlutterView. @NonNull private RenderMode renderMode; + // Internal view hierarchy references. + @Nullable + private FlutterRenderer.RenderSurface renderSurface; + + // Connections to a Flutter execution context. + @Nullable + private FlutterEngine flutterEngine; + /** * Constructs a {@code FlutterSurfaceView} programmatically, without any XML attributes. * @@ -79,16 +91,78 @@ private void init() { case surface: Log.d(TAG, "Internally creating a FlutterSurfaceView."); FlutterSurfaceView flutterSurfaceView = new FlutterSurfaceView(getContext()); + renderSurface = flutterSurfaceView; addView(flutterSurfaceView); break; case texture: Log.d(TAG, "Internally creating a FlutterTextureView."); FlutterTextureView flutterTextureView = new FlutterTextureView(getContext()); + renderSurface = flutterTextureView; addView(flutterTextureView); break; } } + /** + * Connects this {@code FlutterView} to the given {@link FlutterEngine}. + * + * This {@code FlutterView} will begin rendering the UI painted by the given {@link FlutterEngine}. + * This {@code FlutterView} will also begin forwarding interaction events from this + * {@code FlutterView} to the given {@link FlutterEngine}, e.g., user touch events, accessibility + * events, keyboard events, and others. + * + * See {@link #detachFromFlutterEngine()} for information on how to detach from a + * {@link FlutterEngine}. + */ + public void attachToFlutterEngine(@NonNull FlutterEngine flutterEngine) { + if (isAttachedToFlutterEngine()) { + if (flutterEngine == this.flutterEngine) { + // We are already attached to this FlutterEngine + return; + } + + // Detach from a previous FlutterEngine so we can attach to this new one. + detachFromFlutterEngine(); + } + + this.flutterEngine = flutterEngine; + + // Instruct our FlutterRenderer that we are now its designated RenderSurface. + this.flutterEngine.getRenderer().attachToRenderSurface(renderSurface); + } + + /** + * Disconnects this {@code FlutterView} from a previously attached {@link FlutterEngine}. + * + * This {@code FlutterView} will clear its UI and stop forwarding all events to the previously-attached + * {@link FlutterEngine}. This includes touch events, accessibility events, keyboard events, + * and others. + * + * See {@link #attachToFlutterEngine(FlutterEngine)} for information on how to attach a + * {@link FlutterEngine}. + */ + public void detachFromFlutterEngine() { + if (!isAttachedToFlutterEngine()) { + return; + } + Log.d(TAG, "Detaching from Flutter Engine"); + + // Instruct our FlutterRenderer that we are no longer interested in being its RenderSurface. + flutterEngine.getRenderer().detachFromRenderSurface(); + flutterEngine = null; + + // TODO(mattcarroll): clear the surface when JNI doesn't blow up +// if (isSurfaceAvailableForRendering) { +// Canvas canvas = surfaceHolder.lockCanvas(); +// canvas.drawColor(Color.RED); +// surfaceHolder.unlockCanvasAndPost(canvas); +// } + } + + private boolean isAttachedToFlutterEngine() { + return flutterEngine != null; + } + /** * Render modes for a {@link FlutterView}. */ 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 130f04d6e4551..996ddb4952ed0 100644 --- a/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java +++ b/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java @@ -247,6 +247,22 @@ public void dispatchSemanticsAction(int id, * {@link #onFirstFrameRendered()}. */ public interface RenderSurface { + /** + * Invoked by the owner of this {@code RenderSurface} when it wants to begin rendering + * a Flutter UI to this {@code RenderSurface}. + * + * The details of how rendering is handled is an implementation detail. + */ + void attachToRenderer(@NonNull FlutterRenderer renderer); + + /** + * Invoked by the owner of this {@code RenderSurface} when it no longer wants to render + * a Flutter UI to this {@code RenderSurface}. + * + * This method will cease any on-going rendering from Flutter to this {@code RenderSurface}. + */ + void detachFromRenderer(); + // TODO(mattcarroll): describe what this callback is intended to do void updateCustomAccessibilityActions(ByteBuffer buffer, String[] strings); diff --git a/shell/platform/android/io/flutter/view/FlutterNativeView.java b/shell/platform/android/io/flutter/view/FlutterNativeView.java index 373aa792a9413..580612a1467bf 100644 --- a/shell/platform/android/io/flutter/view/FlutterNativeView.java +++ b/shell/platform/android/io/flutter/view/FlutterNativeView.java @@ -12,6 +12,7 @@ import io.flutter.embedding.engine.FlutterJNI; import io.flutter.embedding.engine.FlutterEngine.EngineLifecycleListener; import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.embedding.engine.renderer.FlutterRenderer; import io.flutter.embedding.engine.renderer.FlutterRenderer.RenderSurface; import io.flutter.plugin.common.*; import java.nio.ByteBuffer; @@ -166,6 +167,16 @@ private void attach(FlutterNativeView view, boolean isBackgroundView) { } private final class RenderSurfaceImpl implements RenderSurface { + @Override + public void attachToRenderer(@NonNull FlutterRenderer renderer) { + // Not relevant for v1 embedding. + } + + @Override + public void detachFromRenderer() { + // Not relevant for v1 embedding. + } + // Called by native to update the semantics/accessibility tree. public void updateSemantics(ByteBuffer buffer, String[] strings) { if (mFlutterView == null) { From fa7a25aea3e35beee9824011798b66738e2005f0 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 26 Feb 2019 05:44:36 -0500 Subject: [PATCH 0283/1117] Roll src/third_party/skia ac6d4c0c8eae..346e10e8ae1a (3 commits) (#7959) https://skia.googlesource.com/skia.git/%2Blog/ac6d4c0c8eae..346e10e8ae1a git log ac6d4c0c8eae8a90185da16ab01c81921669cc1f..346e10e8ae1afc705dd61c0ec006e652cee22ee5 --date=short --no-merges --format=%ad %ae %s 2019-02-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 377d493a0847..9a16248dedf3 (2 commits) 2019-02-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 53c8957c337d..377d493a0847 (1 commits) 2019-02-26 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index a65e50b04ca87..27c67fe47d07b 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': 'ac6d4c0c8eae8a90185da16ab01c81921669cc1f', + 'skia_revision': '346e10e8ae1afc705dd61c0ec006e652cee22ee5', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b1d8e9f73322d..022b6e196a934 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: edaf760039f49bc2a4eec3c5617d3293 +Signature: 46df429804e74ade28aec05fd44a2c05 UNUSED LICENSES: From ef1e21f53332a50faa684ca4e8e2ee89d3459046 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 26 Feb 2019 09:51:42 -0500 Subject: [PATCH 0284/1117] Roll src/third_party/skia 346e10e8ae1a..8abc84294571 (1 commits) (#7962) https://skia.googlesource.com/skia.git/%2Blog/346e10e8ae1a..8abc84294571 git log 346e10e8ae1afc705dd61c0ec006e652cee22ee5..8abc8429457128456866b52bb0bebaa800319d91 --date=short --no-merges --format=%ad %ae %s 2019-02-26 kjlubick@google.com [pathkit] fix perf The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 27c67fe47d07b..f989fc1945e8f 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': '346e10e8ae1afc705dd61c0ec006e652cee22ee5', + 'skia_revision': '8abc8429457128456866b52bb0bebaa800319d91', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 022b6e196a934..a0aa449ba09e7 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 46df429804e74ade28aec05fd44a2c05 +Signature: a3d4e233187b805dab18f568a8a4760b UNUSED LICENSES: From 1310918277907d48ad25a336bbee3269ccbb2674 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 26 Feb 2019 07:01:49 -0800 Subject: [PATCH 0285/1117] Roll src/third_party/dart f7e435ac26..0f9a5198bd (2 commits) 0f9a5198bd Finish implementing IsFutureOrSubtypeOf a52ac7d27b Correct LSP canParse functions for classes containing restricted enums --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index f989fc1945e8f..0faf037731ae2 100644 --- a/DEPS +++ b/DEPS @@ -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': 'f7e435ac26d5254b8694403a59203f6349dec208', + 'dart_revision': '0f9a5198bd644e908adcf8061e6a9722a40a2f93', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py From 113b91fe82f147b3fb77899726736171c06dad26 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 26 Feb 2019 14:13:28 -0500 Subject: [PATCH 0286/1117] Roll src/third_party/skia 8abc84294571..adfc6e40df30 (9 commits) (#7965) https://skia.googlesource.com/skia.git/%2Blog/8abc84294571..adfc6e40df30 git log 8abc8429457128456866b52bb0bebaa800319d91..adfc6e40df3081a8513ff71f2f434100b4d037b5 --date=short --no-merges --format=%ad %ae %s 2019-02-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 0546b5380780..9f20dd777b50 (1 commits) 2019-02-25 egdaniel@google.com Add support for VK_IMAGE_LAYOUT_PRESENT_SRC_KHR in skia vulkan. 2019-02-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 2ff3639d85d7..024f271ae0c7 (1 commits) 2019-02-26 stani@google.com Pass render target VkImage in GrVkDrawableInfo 2019-02-13 herb@google.com Make ARGB fallback use common strike lookup 2019-02-26 halcanary@google.com gn/core.gni: add headers 2019-02-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 9a16248dedf3..2ff3639d85d7 (1 commits) 2019-02-26 brianosman@google.com Few more particle features and some generalization work 2019-02-26 jongdeok.kim@navercorp.com [Viewer] Set the current slide first before attaching the fBackendType to fWindow. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 0faf037731ae2..67e3f57bd5698 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': '8abc8429457128456866b52bb0bebaa800319d91', + 'skia_revision': 'adfc6e40df3081a8513ff71f2f434100b4d037b5', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a0aa449ba09e7..8e1bebcab8041 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: a3d4e233187b805dab18f568a8a4760b +Signature: 757465135c8291773be02574d403a257 UNUSED LICENSES: From 4434a39c7d545ed47186b2f4d98cd09c8366e720 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Tue, 26 Feb 2019 11:33:07 -0800 Subject: [PATCH 0287/1117] Add api 21 check to LocalizationChannel.java (#7967) --- .../embedding/engine/systemchannels/LocalizationChannel.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java index 52e4fbb46171d..33acaace59592 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/LocalizationChannel.java @@ -4,6 +4,7 @@ package io.flutter.embedding.engine.systemchannels; +import android.os.Build; import android.support.annotation.NonNull; import java.util.ArrayList; @@ -35,7 +36,8 @@ public void sendLocales(List locales) { for (Locale locale : locales) { data.add(locale.getLanguage()); data.add(locale.getCountry()); - data.add(locale.getScript()); + // locale.getScript() was added in API 21. + data.add(Build.VERSION.SDK_INT >= 21 ? locale.getScript() : ""); data.add(locale.getVariant()); } channel.invokeMethod("setLocale", data); From dd3656a51cee10e367025766fe242f5324290bd0 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 26 Feb 2019 13:06:37 -0800 Subject: [PATCH 0288/1117] Roll src/third_party/dart 0f9a5198bd..385be0cf31 (14 commits) 385be0cf31 Remove unused imports 7e0c2c83f4 Update pub revision d4ff20f005 Remove unwanted @soloTest 155ac6afbd Create subtype benchmarks based on dart2js and a large application f0042a3225 [vm/ffi] Factor out FFI code shared between compiler and runtime. 2eb3ac7c02 Specify implicit creation b446d0a226 BenchMaker: a benchmark that reads the output from BenchMaker f6389a4216 TypeComputer: handle named parameters cffdd356ed BenchMaker: Don't obfuscate dart:async 1171c4735b BenchMaker: Ensure all classes are serialized 47555a25b8 Fix detection of implicit bounds eb19bba3e3 Implement TypeBuilderComputer.visitFunctionType 7f00ea7e43 Subst interface types copied from superclass 561f7905d6 A type variable can be a subtype of another --- DEPS | 4 ++-- ci/licenses_golden/licenses_third_party | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 67e3f57bd5698..c68487903d8e7 100644 --- a/DEPS +++ b/DEPS @@ -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': '0f9a5198bd644e908adcf8061e6a9722a40a2f93', + 'dart_revision': '385be0cf31938ebdadba92755bae8e049b840d9a', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -75,7 +75,7 @@ vars = { 'dart_plugin_tag': 'f5b4b0e32d1406d62daccea030ba6457d14b1c47', 'dart_pool_tag': '1.3.6', 'dart_protobuf_tag': '0.9.0', - 'dart_pub_rev': '9f00679ef47bc79cadc18e143720ade6c06c0100', + 'dart_pub_rev': '980fc947db32bca6ae7d07fbb4ad0fcdba0050ec', 'dart_pub_semver_tag': '1.4.2', 'dart_quiver_tag': '2.0.0+1', 'dart_resource_rev': '2.1.5', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 96980d4b2204d..9e9b76cf0f5a1 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 2a3c0900bc68d785d90b2766bbcd7351 +Signature: 3f8effa6275dd8795e4b6866c042b476 UNUSED LICENSES: @@ -5720,6 +5720,8 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_x64.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/flow_graph_checker.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/flow_graph_checker.h FILE: ../../../third_party/dart/runtime/vm/compiler/backend/slot_test.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/ffi.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/ffi.h FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier.cc FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier.h FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier_arm.cc From fb1c543dd4f18d19e8aecf5be0e5641f34ae47de Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 26 Feb 2019 13:28:04 -0800 Subject: [PATCH 0289/1117] Link dart:* sources into engine for debugger source support (#7908) Link dart:* sources into engine for debugger source support Currently, dart:* libraries appear to have no source in debuggers like Observatory. With this change, these sources will be available in debug mode applications. Sources for dart:* libraries are lazily loaded on a script-by-script basis. Refer to https://dart-review.googlesource.com/c/sdk/+/93375 for the Dart SDK change. --- common/settings.h | 4 ++++ lib/snapshot/BUILD.gn | 22 ++++++++++++++++++- runtime/dart_vm.cc | 8 +++++++ shell/platform/android/BUILD.gn | 3 +++ shell/platform/android/flutter_main.cc | 22 +++++++++++++++++++ .../framework/Source/FlutterDartProject.mm | 19 ++++++++++++++++ shell/platform/embedder/embedder.cc | 13 +++++++++++ 7 files changed, 90 insertions(+), 1 deletion(-) diff --git a/common/settings.h b/common/settings.h index 07c70369fd189..812e2167d31e2 100644 --- a/common/settings.h +++ b/common/settings.h @@ -48,6 +48,10 @@ struct Settings { std::string isolate_snapshot_instr_path; // deprecated MappingCallback isolate_snapshot_instr; + // Returns the Mapping to a kernel buffer which contains sources for dart:* + // libraries. + MappingCallback dart_library_sources_kernel; + std::string application_library_path; std::string application_kernel_asset; std::string application_kernel_list_asset; diff --git a/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn index 42d37626f5e4b..b12dfe4d6db6d 100644 --- a/lib/snapshot/BUILD.gn +++ b/lib/snapshot/BUILD.gn @@ -94,6 +94,14 @@ template("bin_to_assembly") { "--target_os", current_os, ] + if (defined(invoker.size_symbol)) { + args += [ + "--size_symbol_name", + invoker.size_symbol, + "--target_arch", + current_cpu, + ] + } if (invoker.executable) { args += [ "--executable" ] } @@ -201,17 +209,29 @@ bin_to_linkable("isolate_snapshot_instructions_linkable") { executable = true } +bin_to_linkable("platform_strong_dill_linkable") { + deps = [ + ":strong_platform", + ] + input = "$root_out_dir/flutter_patched_sdk/platform_strong.dill" + symbol = "kPlatformStrongDill" + size_symbol = "kPlatformStrongDillSize" + executable = false +} + source_set("snapshot") { deps = [ ":isolate_snapshot_data_linkable", ":isolate_snapshot_instructions_linkable", ":vm_snapshot_data_linkable", ":vm_snapshot_instructions_linkable", + ":platform_strong_dill_linkable", ] sources = get_target_outputs(":isolate_snapshot_data_linkable") + get_target_outputs(":isolate_snapshot_instructions_linkable") + get_target_outputs(":vm_snapshot_data_linkable") + - get_target_outputs(":vm_snapshot_instructions_linkable") + get_target_outputs(":vm_snapshot_instructions_linkable") + + get_target_outputs(":platform_strong_dill_linkable") } compile_platform("non_strong_platform") { diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 382ab05c344f2..b907db41bd0f5 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -438,6 +438,14 @@ DartVM::DartVM(const Settings& settings, &ServiceStreamCancelCallback); Dart_SetEmbedderInformationCallback(&EmbedderInformationCallback); + + if (settings.dart_library_sources_kernel != nullptr) { + std::unique_ptr dart_library_sources = + settings.dart_library_sources_kernel(); + // Set sources for dart:* libraries for debugging. + Dart_SetDartLibrarySourcesKernel(dart_library_sources->GetMapping(), + dart_library_sources->GetSize()); + } } DartVM::~DartVM() { diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index fa55b71b96fbe..cb0d8f7225dad 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -71,6 +71,9 @@ shared_library("flutter_shell_native") { } else { deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ] } + if (flutter_runtime_mode == "debug") { + deps += [ "$flutter_root/lib/snapshot" ] + } public_configs = [ "$flutter_root:config" ] diff --git a/shell/platform/android/flutter_main.cc b/shell/platform/android/flutter_main.cc index bfbc4c1ce44e6..e02eae9faba7a 100644 --- a/shell/platform/android/flutter_main.cc +++ b/shell/platform/android/flutter_main.cc @@ -25,6 +25,14 @@ namespace shell { +extern "C" { +#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG +// Used for debugging dart:* sources. +extern const uint8_t kPlatformStrongDill[]; +extern const intptr_t kPlatformStrongDillSize; +#endif +} + FlutterMain::FlutterMain(blink::Settings settings) : settings_(std::move(settings)) {} @@ -89,6 +97,20 @@ void FlutterMain::Init(JNIEnv* env, settings.task_observer_remove = [](intptr_t key) { fml::MessageLoop::GetCurrent().RemoveTaskObserver(key); }; + +#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG + // There are no ownership concerns here as all mappings are owned by the + // embedder and not the engine. + auto make_mapping_callback = [](const uint8_t* mapping, size_t size) { + return [mapping, size]() { + return std::make_unique(mapping, size); + }; + }; + + settings.dart_library_sources_kernel = + make_mapping_callback(kPlatformStrongDill, kPlatformStrongDillSize); +#endif // FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG + // Not thread safe. Will be removed when FlutterMain is refactored to no // longer be a singleton. g_flutter_main.reset(new FlutterMain(std::move(settings))); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index 689be749e85de..229e620aa6184 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -15,6 +15,14 @@ #include "flutter/shell/platform/darwin/common/command_line.h" #include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h" +extern "C" { +#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG +// Used for debugging dart:* sources. +extern const uint8_t kPlatformStrongDill[]; +extern const intptr_t kPlatformStrongDillSize; +#endif +} + static const char* kApplicationKernelSnapshotFileName = "kernel_blob.bin"; static blink::Settings DefaultSettingsForProcess(NSBundle* bundle = nil) { @@ -123,6 +131,17 @@ } } +#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG + // There are no ownership concerns here as all mappings are owned by the + // embedder and not the engine. + auto make_mapping_callback = [](const uint8_t* mapping, size_t size) { + return [mapping, size]() { return std::make_unique(mapping, size); }; + }; + + settings.dart_library_sources_kernel = + make_mapping_callback(kPlatformStrongDill, kPlatformStrongDillSize); +#endif // FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG + return settings; } diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 3cce19dc2ce7b..c9b061d6c93b3 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -13,6 +13,14 @@ #define FLUTTER_EXPORT __attribute__((visibility("default"))) #endif // OS_WIN +extern "C" { +#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG +// Used for debugging dart:* sources. +extern const uint8_t kPlatformStrongDill[]; +extern const intptr_t kPlatformStrongDillSize; +#endif // FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG +} + #include "flutter/shell/platform/embedder/embedder.h" #include @@ -286,6 +294,11 @@ void PopulateSnapshotMappingCallbacks(const FlutterProjectArgs* args, args->isolate_snapshot_instructions_size); } } + +#if !OS_FUCHSIA && (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG) + settings.dart_library_sources_kernel = + make_mapping_callback(kPlatformStrongDill, kPlatformStrongDillSize); +#endif // !OS_FUCHSIA && (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG) } FlutterEngineResult FlutterEngineRun(size_t version, From e32531f0ee16777746fc82cc84b17c6425b3a926 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 26 Feb 2019 14:49:09 -0800 Subject: [PATCH 0290/1117] Switch flutter's dart sdk to full and add dartdevc libraries (#7968) --- BUILD.gn | 38 +++++++++++- lib/snapshot/libraries.json | 117 ++++++++++++++++++++++++++++++++++++ lib/snapshot/libraries.yaml | 115 +++++++++++++++++++++++++++++++++++ tools/gn | 3 + 4 files changed, 272 insertions(+), 1 deletion(-) diff --git a/BUILD.gn b/BUILD.gn index 55f78f7853708..bbd82204f17b6 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. import("$flutter_root/common/config.gni") +import("//third_party/dart/build/dart/dart_action.gni") # Temporary snapshot copy rules until we can use the full SDK. _flutter_sdk_snapshots = [ @@ -36,7 +37,8 @@ group("flutter") { "$flutter_root/frontend_server", "//third_party/dart:create_sdk", "$flutter_root/lib/stub_ui:stub_ui", - ":dart2js_platform_files" + ":dart2js_platform_files", + ":flutter_dartdevc_kernel_sdk", ] foreach(snapshot, _flutter_sdk_snapshots) { public_deps += [ ":copy_flutter_${snapshot[0]}_snapshot" ] @@ -108,3 +110,37 @@ copy("dart2js_platform_files") { "$root_out_dir/flutter_patched_sdk/{{source_file_part}}", ] } + + +prebuilt_dart_action("flutter_dartdevc_kernel_sdk") { + deps = [ + "//third_party/dart:create_sdk", + ] + + packages = "//third_party/dart/.packages" + + script = "//third_party/dart/pkg/dev_compiler/tool/kernel_sdk.dart" + + inputs = [ + "//third_party/dart/pkg/dev_compiler/tool/kernel_sdk.dart", + ] + + outputs = [ + "$target_gen_dir/kernel/amd/dart_sdk.js", + "$target_gen_dir/kernel/amd/dart_sdk.js.map", + "$target_gen_dir/kernel/common/dart_sdk.js", + "$target_gen_dir/kernel/common/dart_sdk.js.map", + "$target_gen_dir/kernel/es6/dart_sdk.js", + "$target_gen_dir/kernel/es6/dart_sdk.js.map", + "$target_gen_dir/kernel/legacy/dart_sdk.js", + "$target_gen_dir/kernel/legacy/dart_sdk.js.map", + ] + + libraries_path = rebase_path("$flutter_root/lib/snapshot/libraries.json") + output_path = rebase_path("$target_gen_dir/kernel/flutter_ddc_sdk.dill") + + args = [ + "--output=$output_path", + "--libraries=$libraries_path", + ] +} diff --git a/lib/snapshot/libraries.json b/lib/snapshot/libraries.json index 99ef4cd778f8c..bc3d0d832c952 100644 --- a/lib/snapshot/libraries.json +++ b/lib/snapshot/libraries.json @@ -1,6 +1,123 @@ { "comment:0": "NOTE: THIS FILE IS GENERATED. DO NOT EDIT.", "comment:1": "Instead modify 'flutter/lib/snapshot/libraries.yaml' and follow the instructions therein.", + "none": { + "libraries": {} + }, + "dartdevc": { + "libraries": { + "async": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/async_patch.dart", + "uri": "../../../third_party/dart/sdk/lib/async/async.dart" + }, + "_runtime": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart" + }, + "_interceptors": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart" + }, + "mirrors": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/mirrors_patch.dart", + "supported": false, + "uri": "../../../third_party/dart/sdk/lib/mirrors/mirrors.dart" + }, + "_debugger": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/debugger.dart" + }, + "io": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/io_patch.dart", + "supported": false, + "uri": "../../../third_party/dart/sdk/lib/io/io.dart" + }, + "_internal": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart", + "uri": "../../../third_party/dart/sdk/lib/internal/internal.dart" + }, + "_metadata": { + "uri": "../../../third_party/dart/sdk/lib/html/html_common/metadata.dart" + }, + "_http": { + "uri": "../../../third_party/dart/sdk/lib/_http/http.dart" + }, + "_js_primitives": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_primitives.dart" + }, + "_js_helper": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart" + }, + "ui": { + "uri": "flutter/lib/stub_ui/ui.dart" + }, + "js": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart" + }, + "_js_mirrors": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart" + }, + "html_common": { + "uri": "../../../third_party/dart/sdk/lib/html/html_common/html_common_dart2js.dart" + }, + "_native_typed_data": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/native_typed_data.dart" + }, + "core": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart", + "uri": "../../../third_party/dart/sdk/lib/core/core.dart" + }, + "js_util": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js_util/dart2js/js_util_dart2js.dart" + }, + "collection": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart", + "uri": "../../../third_party/dart/sdk/lib/collection/collection.dart" + }, + "typed_data": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/typed_data_patch.dart", + "uri": "../../../third_party/dart/sdk/lib/typed_data/typed_data.dart" + }, + "web_audio": { + "uri": "../../../third_party/dart/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" + }, + "html": { + "uri": "../../../third_party/dart/sdk/lib/html/dart2js/html_dart2js.dart" + }, + "developer": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart", + "uri": "../../../third_party/dart/sdk/lib/developer/developer.dart" + }, + "isolate": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/isolate_patch.dart", + "supported": false, + "uri": "../../../third_party/dart/sdk/lib/isolate/isolate.dart" + }, + "web_gl": { + "uri": "../../../third_party/dart/sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" + }, + "indexed_db": { + "uri": "../../../third_party/dart/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" + }, + "convert": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/convert_patch.dart", + "uri": "../../../third_party/dart/sdk/lib/convert/convert.dart" + }, + "_isolate_helper": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart" + }, + "math": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart", + "uri": "../../../third_party/dart/sdk/lib/math/math.dart" + }, + "_foreign_helper": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/foreign_helper.dart" + }, + "web_sql": { + "uri": "../../../third_party/dart/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" + }, + "svg": { + "uri": "../../../third_party/dart/sdk/lib/svg/dart2js/svg_dart2js.dart" + } + } + }, "flutter": { "libraries": { "_builtin": { diff --git a/lib/snapshot/libraries.yaml b/lib/snapshot/libraries.yaml index c4244eaff8719..cb65d57bd7b8b 100644 --- a/lib/snapshot/libraries.yaml +++ b/lib/snapshot/libraries.yaml @@ -11,6 +11,9 @@ # changing libraries, sources, and patch files. See # https://github.com/dart-lang/sdk/issues/28836. +none: + libraries: {} + flutter: libraries: _builtin: @@ -147,3 +150,115 @@ flutter: vmservice_io: uri: "../../../third_party/dart/runtime/bin/vmservice/vmservice_io.dart" + +dartdevc: + libraries: + _runtime: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart" + + _debugger: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/debugger.dart" + + _foreign_helper: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/foreign_helper.dart" + + _http: + uri: "../../../third_party/dart/sdk/lib/_http/http.dart" + + _interceptors: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart" + + _internal: + uri: "../../../third_party/dart/sdk/lib/internal/internal.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart" + + _isolate_helper: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart" + + _js_helper: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart" + + _js_mirrors: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart" + + _js_primitives: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_primitives.dart" + + _metadata: + uri: "../../../third_party/dart/sdk/lib/html/html_common/metadata.dart" + + _native_typed_data: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/native_typed_data.dart" + + async: + uri: "../../../third_party/dart/sdk/lib/async/async.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/async_patch.dart" + + collection: + uri: "../../../third_party/dart/sdk/lib/collection/collection.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart" + + convert: + uri: "../../../third_party/dart/sdk/lib/convert/convert.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/convert_patch.dart" + + core: + uri: "../../../third_party/dart/sdk/lib/core/core.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart" + + developer: + uri: "../../../third_party/dart/sdk/lib/developer/developer.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart" + + io: + uri: "../../../third_party/dart/sdk/lib/io/io.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/io_patch.dart" + supported: false + + isolate: + uri: "../../../third_party/dart/sdk/lib/isolate/isolate.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/isolate_patch.dart" + supported: false + + mirrors: + uri: "../../../third_party/dart/sdk/lib/mirrors/mirrors.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/mirrors_patch.dart" + supported: false + + math: + uri: "../../../third_party/dart/sdk/lib/math/math.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart" + + typed_data: + uri: "../../../third_party/dart/sdk/lib/typed_data/typed_data.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/typed_data_patch.dart" + + html: + uri: "../../../third_party/dart/sdk/lib/html/dart2js/html_dart2js.dart" + + html_common: + uri: "../../../third_party/dart/sdk/lib/html/html_common/html_common_dart2js.dart" + + indexed_db: + uri: "../../../third_party/dart/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" + + js: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart" + + js_util: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js_util/dart2js/js_util_dart2js.dart" + + svg: + uri: "../../../third_party/dart/sdk/lib/svg/dart2js/svg_dart2js.dart" + + web_audio: + uri: "../../../third_party/dart/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" + + web_gl: + uri: "../../../third_party/dart/sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" + + web_sql: + uri: "../../../third_party/dart/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" + + ui: + uri: "flutter/lib/stub_ui/ui.dart" diff --git a/tools/gn b/tools/gn index e7e6e82b262cb..3a753ef39edef 100755 --- a/tools/gn +++ b/tools/gn @@ -227,6 +227,9 @@ def to_gn_args(args): if args.arm_float_abi: gn_args['arm_float_abi'] = args.arm_float_abi + # Switch flutter to full Dart SDK. + gn_args['dart_platform_sdk'] = False + return gn_args def parse_args(args): From e3f1bdc4dd4146cf7093492526cbe4e5525044e4 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 26 Feb 2019 18:23:31 -0500 Subject: [PATCH 0291/1117] Roll src/third_party/skia adfc6e40df30..4dbb96dfaa04 (6 commits) (#7970) https://skia.googlesource.com/skia.git/%2Blog/adfc6e40df30..4dbb96dfaa04 git log adfc6e40df3081a8513ff71f2f434100b4d037b5..4dbb96dfaa04868b4ed00ca90513097b2d987625 --date=short --no-merges --format=%ad %ae %s 2019-02-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader fe3d4978886b..8adf1fcd08d0 (2 commits) 2019-02-26 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 024f271ae0c7..fe3d4978886b (1 commits) 2019-02-26 brianosman@google.com Particles: remove non-stable random, add better enum reflection 2019-02-26 fmalita@chromium.org [skottie] Shape blending mode support 2019-02-26 bsalomon@google.com Remove legacy types/methods from SkDeferredDisplayList recorder. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c68487903d8e7..71851973ef3fb 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': 'adfc6e40df3081a8513ff71f2f434100b4d037b5', + 'skia_revision': '4dbb96dfaa04868b4ed00ca90513097b2d987625', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 8e1bebcab8041..2f2a134a727d7 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 757465135c8291773be02574d403a257 +Signature: 724f50e9f5ec65dcf10c8d1cfcd729df UNUSED LICENSES: From 9b21ea857a005af22f2dbdbf2302145654bb528e Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 26 Feb 2019 16:13:28 -0800 Subject: [PATCH 0292/1117] Roll src/third_party/dart 385be0cf31..05bba46133 (6 commits) 05bba46133 Use DFS numbering for block dominates test fba89f9f64 [vm] Don't change the content of the VM isolate's snapshot based on what was loading into a core or app snapshot. 3d3f6f9d4b Remove immediateUnderSetLiteral. 7b86d78f07 Enable set literal lowering in dart2js. e29835749a [dart_internal] Bump SDK constraint upper-bound to <2.3.0 53ca69ba7e [release] Bump version and update CHANGELOG for 2.2.0 --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 71851973ef3fb..46b9ee5ffd6fe 100644 --- a/DEPS +++ b/DEPS @@ -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': '385be0cf31938ebdadba92755bae8e049b840d9a', + 'dart_revision': '05bba46133f9dd349dac2e83ca3bf81b25c2d749', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 9e9b76cf0f5a1..b1db51ea15438 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 3f8effa6275dd8795e4b6866c042b476 +Signature: 54c7a95ddf78efb1fdfafc5db3ba46fa UNUSED LICENSES: From 9f92324fd6aa9f592db19bf380186c4ed6da2e7c Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Tue, 26 Feb 2019 17:03:10 -0800 Subject: [PATCH 0293/1117] Suppress deprecation warning for usage of Configuration.locale (#7973) --- shell/platform/android/io/flutter/view/FlutterView.java | 1 + 1 file changed, 1 insertion(+) diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 8c7f8baaa1a01..753f12967f93c 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -311,6 +311,7 @@ private void sendUserPlatformSettingsToDart() { .send(); } + @SuppressWarnings("deprecation") private void sendLocalesToDart(Configuration config) { List locales = new ArrayList<>(); if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { From 4db7c30501c0426b808f768937bfd9470252cfe8 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Tue, 26 Feb 2019 19:05:18 -0800 Subject: [PATCH 0294/1117] Android Embedding PR 10: Add system channels to FlutterEngine. (#7960) --- .../embedding/engine/FlutterEngine.java | 116 +++++++++++++++++- 1 file changed, 114 insertions(+), 2 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java b/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java index fdffce77390f5..74bab64129119 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java @@ -6,11 +6,19 @@ import android.content.Context; import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import io.flutter.app.FlutterPluginRegistry; import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.embedding.engine.renderer.FlutterRenderer; +import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; +import io.flutter.embedding.engine.systemchannels.KeyEventChannel; +import io.flutter.embedding.engine.systemchannels.LifecycleChannel; +import io.flutter.embedding.engine.systemchannels.LocalizationChannel; +import io.flutter.embedding.engine.systemchannels.NavigationChannel; +import io.flutter.embedding.engine.systemchannels.PlatformChannel; +import io.flutter.embedding.engine.systemchannels.SettingsChannel; +import io.flutter.embedding.engine.systemchannels.SystemChannel; +import io.flutter.embedding.engine.systemchannels.TextInputChannel; /** * A single Flutter execution environment. @@ -35,6 +43,7 @@ * {@link FlutterRenderer} and then attach a {@link FlutterRenderer.RenderSurface}. Consider using * a {@link io.flutter.embedding.android.FlutterView} as a {@link FlutterRenderer.RenderSurface}. */ +// TODO(mattcarroll): re-evaluate system channel APIs - some are not well named or differentiated public class FlutterEngine { private static final String TAG = "FlutterEngine"; @@ -44,10 +53,29 @@ public class FlutterEngine { private final FlutterRenderer renderer; @NonNull private final DartExecutor dartExecutor; - // TODO(mattcarroll): integrate system channels with FlutterEngine @NonNull private final FlutterPluginRegistry pluginRegistry; + // System channels. + @NonNull + private final AccessibilityChannel accessibilityChannel; + @NonNull + private final KeyEventChannel keyEventChannel; + @NonNull + private final LifecycleChannel lifecycleChannel; + @NonNull + private final LocalizationChannel localizationChannel; + @NonNull + private final NavigationChannel navigationChannel; + @NonNull + private final PlatformChannel platformChannel; + @NonNull + private final SettingsChannel settingsChannel; + @NonNull + private final SystemChannel systemChannel; + @NonNull + private final TextInputChannel textInputChannel; + private final EngineLifecycleListener engineLifecycleListener = new EngineLifecycleListener() { @SuppressWarnings("unused") public void onPreEngineRestart() { @@ -82,6 +110,16 @@ public FlutterEngine(@NonNull Context context) { // TODO(mattcarroll): FlutterRenderer is temporally coupled to attach(). Remove that coupling if possible. this.renderer = new FlutterRenderer(flutterJNI); + accessibilityChannel = new AccessibilityChannel(dartExecutor); + keyEventChannel = new KeyEventChannel(dartExecutor); + lifecycleChannel = new LifecycleChannel(dartExecutor); + localizationChannel = new LocalizationChannel(dartExecutor); + navigationChannel = new NavigationChannel(dartExecutor); + platformChannel = new PlatformChannel(dartExecutor); + settingsChannel = new SettingsChannel(dartExecutor); + systemChannel = new SystemChannel(dartExecutor); + textInputChannel = new TextInputChannel(dartExecutor); + this.pluginRegistry = new FlutterPluginRegistry(this, context); } @@ -150,6 +188,80 @@ public FlutterRenderer getRenderer() { return renderer; } + /** + * System channel that sends accessibility requests and events from Flutter to Android. + */ + @NonNull + public AccessibilityChannel getAccessibilityChannel() { + return accessibilityChannel; + } + + /** + * System channel that sends key events from Android to Flutter. + */ + @NonNull + public KeyEventChannel getKeyEventChannel() { + return keyEventChannel; + } + + /** + * System channel that sends Android lifecycle events to Flutter. + */ + @NonNull + public LifecycleChannel getLifecycleChannel() { + return lifecycleChannel; + } + + /** + * System channel that sends locale data from Android to Flutter. + */ + @NonNull + public LocalizationChannel getLocalizationChannel() { + return localizationChannel; + } + + /** + * System channel that sends Flutter navigation commands from Android to Flutter. + */ + @NonNull + public NavigationChannel getNavigationChannel() { + return navigationChannel; + } + + /** + * System channel that sends platform-oriented requests and information to Flutter, + * e.g., requests to play sounds, requests for haptics, system chrome settings, etc. + */ + @NonNull + public PlatformChannel getPlatformChannel() { + return platformChannel; + } + + /** + * System channel that sends platform/user settings from Android to Flutter, e.g., + * time format, scale factor, etc. + */ + @NonNull + public SettingsChannel getSettingsChannel() { + return settingsChannel; + } + + /** + * System channel that sends memory pressure warnings from Android to Flutter. + */ + @NonNull + public SystemChannel getSystemChannel() { + return systemChannel; + } + + /** + * System channel that sends and receives text input requests and state. + */ + @NonNull + public TextInputChannel getTextInputChannel() { + return textInputChannel; + } + // TODO(mattcarroll): propose a robust story for plugin backward compability and future facing API. @NonNull public FlutterPluginRegistry getPluginRegistry() { From 5deb15cdf3273b2fcaff451d2efe4ba1ff7d2967 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 26 Feb 2019 19:02:16 -0800 Subject: [PATCH 0295/1117] Roll src/third_party/dart 05bba46133..e94e797d7b (5 commits) e94e797d7b Fix flow analysis test for ForStatement2 0374ba1698 Coalesce ForStatementBase with ForStatement2Impl. 4cd309316b Prepare visitors for UI-as-code rework. cfac26e184 Deprecate `Expression.precedence`. 4abf59202d Fix ForLoop2 support in reference collector --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 46b9ee5ffd6fe..7ea0bbe62221f 100644 --- a/DEPS +++ b/DEPS @@ -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': '05bba46133f9dd349dac2e83ca3bf81b25c2d749', + 'dart_revision': 'e94e797d7b65bae5e036161c6ad62a7894a07a82', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py From d162ad8427392a74e9b3d063c099a7ad8f3c53f6 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 26 Feb 2019 22:55:27 -0500 Subject: [PATCH 0296/1117] Roll src/third_party/skia 4dbb96dfaa04..f6faf2fcea7b (7 commits) (#7977) https://skia.googlesource.com/skia.git/%2Blog/4dbb96dfaa04..f6faf2fcea7b git log 4dbb96dfaa04868b4ed00ca90513097b2d987625..f6faf2fcea7b8bcfae0e5be29f9c292da8703c97 --date=short --no-merges --format=%ad %ae %s 2019-02-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 9f20dd777b50..009696c56169 (2 commits) 2019-02-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 1bc7ee95f75b..6c9fb0e6353c (1 commits) 2019-02-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 7f6f891204d0..1bc7ee95f75b (1 commits) 2019-02-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 54c4772e855c..7f6f891204d0 (1 commits) 2019-02-26 csmartdalton@google.com Reland "Stack-allocate pipelines for GrMeshDrawOp" 2019-02-19 mtklein@google.com remove mention of SkPaintDefaults_Flags 2019-02-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 8adf1fcd08d0..54c4772e855c (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 7ea0bbe62221f..80b43263ba977 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': '4dbb96dfaa04868b4ed00ca90513097b2d987625', + 'skia_revision': 'f6faf2fcea7b8bcfae0e5be29f9c292da8703c97', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2f2a134a727d7..3f9134e69d4c3 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 724f50e9f5ec65dcf10c8d1cfcd729df +Signature: ff3c3602efacd16b443f1da56d22115f UNUSED LICENSES: From 3f3e4ec9046e2f6ce229a990169a427f2de824ce Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 27 Feb 2019 03:12:25 -0500 Subject: [PATCH 0297/1117] Roll src/third_party/skia f6faf2fcea7b..ab3f8674c9d2 (2 commits) (#7980) https://skia.googlesource.com/skia.git/%2Blog/f6faf2fcea7b..ab3f8674c9d2 git log f6faf2fcea7b8bcfae0e5be29f9c292da8703c97..ab3f8674c9d2b28356eda74cbd35b3a8a7835752 --date=short --no-merges --format=%ad %ae %s 2019-02-27 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-02-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 6c9fb0e6353c..ead1a345a36c (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 80b43263ba977..7d8d8cecd549c 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': 'f6faf2fcea7b8bcfae0e5be29f9c292da8703c97', + 'skia_revision': 'ab3f8674c9d2b28356eda74cbd35b3a8a7835752', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3f9134e69d4c3..92616fb108c39 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ff3c3602efacd16b443f1da56d22115f +Signature: b3bf5a7ca4cf5663793c3fccb721c742 UNUSED LICENSES: From b324969c1f2da552bf07f7bc6f31f57d08a8d4e3 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 27 Feb 2019 01:10:48 -0800 Subject: [PATCH 0298/1117] Roll src/third_party/dart e94e797d7b..9450c6d829 (8 commits) 9450c6d829 Move SUBTYPE_OF_SEALED_CLASS to own file, and DriverResolutionTest 603678e46c [vm, gc] Streamline the promotion allocation fast path. 8fd09304b6 [vm, gc] Force inline MarkObject into its sole caller. fb88c983e7 [vm/compiler] Switch kernel helper for background compiler to use new space. 6d575152c9 [vm/compiler] Changes in Cid range computation 2d58ea3b42 [dartdevc] fix #35554, throw NullThrownError when null is thrown 25aa35ef98 Convert ast.dart to triple-slash comment style b11cb39d66 [DDC] Support implict casts in [ForLoopStatement2] --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 7d8d8cecd549c..2dfca0efac322 100644 --- a/DEPS +++ b/DEPS @@ -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': 'e94e797d7b65bae5e036161c6ad62a7894a07a82', + 'dart_revision': '9450c6d829a91b055982eec3eb4d7f83d8686a11', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index b1db51ea15438..f08c287546dcf 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 54c7a95ddf78efb1fdfafc5db3ba46fa +Signature: efafbbb1222897f979c2a4a6115ad024 UNUSED LICENSES: From 15793288ea5b5a1d3a226e959f3f912179754def Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 27 Feb 2019 07:07:19 -0800 Subject: [PATCH 0299/1117] Roll src/third_party/dart 9450c6d829..40bab34fbd (8 commits) 40bab34fbd Fix Stopwatch timers to not overflow on intermediate computations. edcaa05375 Support @pragma('dart2js:noElision') on non-internal methods dc8a56bc0e Rename set literal tests to end in _test f484e1b05e Call canParse() for all LSP requests before passing to handlers 0e54ce3b2d Fix a canParse method that would overflow the stack 8fb52650e5 Ensure LSP canParse type-checks optional values 26d91cf4b6 If LSP initialize fails in tests, throw d1876531f2 Fix LSP canParse to allow nulls where the spec allows --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 2dfca0efac322..20f36acd0f2a3 100644 --- a/DEPS +++ b/DEPS @@ -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': '9450c6d829a91b055982eec3eb4d7f83d8686a11', + 'dart_revision': '40bab34fbd08673b469b86c01f211cd0b6e805c5', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index f08c287546dcf..081222b6fd271 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: efafbbb1222897f979c2a4a6115ad024 +Signature: ab41a143da5b7fb2e46b9b9df48ae3cb UNUSED LICENSES: From c3eb7aea861327bc77ef2d6a702c44fb69032d99 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 27 Feb 2019 10:25:52 -0500 Subject: [PATCH 0300/1117] Roll src/third_party/skia ab3f8674c9d2..ff84d8a900d4 (1 commits) (#7983) https://skia.googlesource.com/skia.git/%2Blog/ab3f8674c9d2..ff84d8a900d4 git log ab3f8674c9d2b28356eda74cbd35b3a8a7835752..ff84d8a900d4b9dd4d4aa7a9569425f0ac234830 --date=short --no-merges --format=%ad %ae %s 2019-02-26 bungeman@google.com SkTypeface::openStream to return smart pointer. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 20f36acd0f2a3..146c088efeb72 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': 'ab3f8674c9d2b28356eda74cbd35b3a8a7835752', + 'skia_revision': 'ff84d8a900d4b9dd4d4aa7a9569425f0ac234830', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 92616fb108c39..66aeb0758dcfd 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b3bf5a7ca4cf5663793c3fccb721c742 +Signature: 1bea5458095c0f6e6943f64d781b6e6f UNUSED LICENSES: From a82c7ee73d45eaf1c1d27adc645925306257b674 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 27 Feb 2019 12:31:37 -0500 Subject: [PATCH 0301/1117] Add async events to pipeline flows. (#7985) --- synchronization/pipeline.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/synchronization/pipeline.h b/synchronization/pipeline.h index 30740c36befe2..3aafc1767a702 100644 --- a/synchronization/pipeline.h +++ b/synchronization/pipeline.h @@ -55,6 +55,7 @@ class Pipeline : public fml::RefCountedThreadSafe> { TRACE_EVENT_ASYNC_END0("flutter", "PipelineProduce", trace_id_); // The continuation is being dropped on the floor. End the flow. TRACE_FLOW_END("flutter", "PipelineItem", trace_id_); + TRACE_EVENT_ASYNC_END0("flutter", "PipelineItem", trace_id_); } } @@ -79,6 +80,7 @@ class Pipeline : public fml::RefCountedThreadSafe> { ProducerContinuation(Continuation continuation, size_t trace_id) : continuation_(continuation), trace_id_(trace_id) { TRACE_FLOW_BEGIN("flutter", "PipelineItem", trace_id_); + TRACE_EVENT_ASYNC_BEGIN0("flutter", "PipelineItem", trace_id_); TRACE_EVENT_ASYNC_BEGIN0("flutter", "PipelineProduce", trace_id_); } @@ -133,6 +135,7 @@ class Pipeline : public fml::RefCountedThreadSafe> { empty_.Signal(); TRACE_FLOW_END("flutter", "PipelineItem", trace_id); + TRACE_EVENT_ASYNC_END0("flutter", "PipelineItem", trace_id); return items_count > 0 ? PipelineConsumeResult::MoreAvailable : PipelineConsumeResult::Done; From b7d5129492e33632a991428f829bc87ed93ead62 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 27 Feb 2019 10:06:57 -0800 Subject: [PATCH 0302/1117] [macos] Add hover support to FLEViewController (#7975) Adds an option to enable mouse tracking, which will send add/hover/remove events to the Flutter engine. --- .../framework/Headers/FLEViewController.h | 17 +++++ .../framework/Source/FLEViewController.mm | 70 ++++++++++++++++++- 2 files changed, 86 insertions(+), 1 deletion(-) diff --git a/shell/platform/darwin/macos/framework/Headers/FLEViewController.h b/shell/platform/darwin/macos/framework/Headers/FLEViewController.h index 246ae2040a2aa..e831934cd1911 100644 --- a/shell/platform/darwin/macos/framework/Headers/FLEViewController.h +++ b/shell/platform/darwin/macos/framework/Headers/FLEViewController.h @@ -16,6 +16,17 @@ #import "FlutterMacros.h" #endif +typedef NS_ENUM(NSInteger, FlutterMouseTrackingMode) { + // Hover events will never be sent to Flutter. + FlutterMouseTrackingModeNone = 0, + // Hover events will be sent to Flutter when the view is in the key window. + FlutterMouseTrackingModeInKeyWindow, + // Hover events will be sent to Flutter when the view is in the active app. + FlutterMouseTrackingModeInActiveApp, + // Hover events will be sent to Flutter regardless of window and app focus. + FlutterMouseTrackingModeAlways, +}; + /** * Controls embedder plugins and communication with the underlying Flutter engine, managing a view * intended to handle key inputs and drawing protocols (see |view|). @@ -33,6 +44,12 @@ FLUTTER_EXPORT */ @property(nullable) NSView* view; +/** + * The style of mouse tracking to use for the view. Defaults to + * FlutterMouseTrackingModeNone. + */ +@property(nonatomic) FlutterMouseTrackingMode mouseTrackingMode; + /** * Launches the Flutter engine with the provided configuration. * diff --git a/shell/platform/darwin/macos/framework/Source/FLEViewController.mm b/shell/platform/darwin/macos/framework/Source/FLEViewController.mm index faf982dff1a9f..ac901423ee1b6 100644 --- a/shell/platform/darwin/macos/framework/Source/FLEViewController.mm +++ b/shell/platform/darwin/macos/framework/Source/FLEViewController.mm @@ -32,7 +32,18 @@ @interface FLEViewController () /** * A list of additional responders to keyboard events. Keybord events are forwarded to all of them. */ -@property NSMutableOrderedSet* additionalKeyResponders; +@property(nonatomic) NSMutableOrderedSet* additionalKeyResponders; + +/** + * The tracking area used to generate hover events, if enabled. + */ +@property(nonatomic) NSTrackingArea* trackingArea; + +/** + * Updates |trackingArea| for the current tracking settings, creating it with + * the correct mode if tracking is enabled, or removing it if not. + */ +- (void)configureTrackingArea; /** * Creates and registers plugins used by this view controller. @@ -202,12 +213,28 @@ - (void)dealloc { } } +- (void)setView:(NSView*)view { + if (_trackingArea) { + [self.view removeTrackingArea:_trackingArea]; + } + [super setView:view]; + [self configureTrackingArea]; +} + - (void)loadView { self.view = [[FLEView alloc] init]; } #pragma mark - Public methods +- (void)setMouseTrackingMode:(FlutterMouseTrackingMode)mode { + if (_mouseTrackingMode == mode) { + return; + } + _mouseTrackingMode = mode; + [self configureTrackingArea]; +} + - (BOOL)launchEngineWithAssetsPath:(NSURL*)assets commandLineArguments:(NSArray*)arguments { return [self launchEngineInternalWithAssetsPath:assets @@ -241,6 +268,35 @@ - (void)removeKeyResponder:(NSResponder*)responder { #pragma mark - Private methods +- (void)configureTrackingArea { + if (_mouseTrackingMode != FlutterMouseTrackingModeNone && self.view) { + NSTrackingAreaOptions options = + NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingInVisibleRect; + switch (_mouseTrackingMode) { + case FlutterMouseTrackingModeInKeyWindow: + options |= NSTrackingActiveInKeyWindow; + break; + case FlutterMouseTrackingModeInActiveApp: + options |= NSTrackingActiveInActiveApp; + break; + case FlutterMouseTrackingModeAlways: + options |= NSTrackingActiveAlways; + break; + default: + NSLog(@"Error: Unrecognized mouse tracking mode: %ld", _mouseTrackingMode); + return; + } + _trackingArea = [[NSTrackingArea alloc] initWithRect:NSZeroRect + options:options + owner:self + userInfo:nil]; + [self.view addTrackingArea:_trackingArea]; + } else if (_trackingArea) { + [self.view removeTrackingArea:_trackingArea]; + _trackingArea = nil; + } +} + - (void)addInternalPlugins { _textInputPlugin = [[FLETextInputPlugin alloc] initWithViewController:self]; _keyEventChannel = @@ -471,4 +527,16 @@ - (void)mouseDragged:(NSEvent*)event { [self dispatchMouseEvent:event phase:kMove]; } +- (void)mouseEntered:(NSEvent*)event { + [self dispatchMouseEvent:event phase:kAdd]; +} + +- (void)mouseExited:(NSEvent*)event { + [self dispatchMouseEvent:event phase:kRemove]; +} + +- (void)mouseMoved:(NSEvent*)event { + [self dispatchMouseEvent:event phase:kHover]; +} + @end From 1089b5c9f84dd2ef1225c4a89d9d65601e11e704 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 27 Feb 2019 11:27:19 -0800 Subject: [PATCH 0303/1117] Check for a null pressure range for motion events (#7986) Fixes https://github.com/flutter/flutter/issues/28490 --- .../android/io/flutter/view/FlutterView.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 753f12967f93c..58a44a37a743e 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -456,14 +456,16 @@ private void addPointerForIndex(MotionEvent event, int pointerIndex, int pointer packet.putLong(0); // obscured packet.putDouble(event.getPressure(pointerIndex)); // pressure + double pressureMin = 0.0, pressureMax = 1.0; if (event.getDevice() != null) { InputDevice.MotionRange pressureRange = event.getDevice().getMotionRange(MotionEvent.AXIS_PRESSURE); - packet.putDouble(pressureRange.getMin()); // pressure_min - packet.putDouble(pressureRange.getMax()); // pressure_max - } else { - packet.putDouble(0.0); // pressure_min - packet.putDouble(1.0); // pressure_max + if (pressureRange != null) { + pressureMin = pressureRange.getMin(); + pressureMax = pressureRange.getMax(); + } } + packet.putDouble(pressureMin); // pressure_min + packet.putDouble(pressureMax); // pressure_max if (pointerKind == kPointerDeviceKindStylus) { packet.putDouble(event.getAxisValue(MotionEvent.AXIS_DISTANCE, pointerIndex)); // distance From 0852795bfc670ba0716ac3a1955d8fb2722d5e18 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 27 Feb 2019 14:43:24 -0500 Subject: [PATCH 0304/1117] Roll src/third_party/skia ff84d8a900d4..67d87128fd00 (7 commits) (#7987) https://skia.googlesource.com/skia.git/%2Blog/ff84d8a900d4..67d87128fd00 git log ff84d8a900d4b9dd4d4aa7a9569425f0ac234830..67d87128fd001b7fc049e65af7c7a3b5240c4a11 --date=short --no-merges --format=%ad %ae %s 2019-02-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 5edafb5ac109..928dfeed1796 (2 commits) 2019-02-26 borenet@google.com [recipes] Plumb task ID through to DM results 2019-02-27 brianosman@google.com Particles: Improvements to SkCurve 2019-02-27 reed@google.com Avoid forcing rasterpipeline due to device colorspace 2019-02-27 kjlubick@google.com update canvaskit docs to new API 2019-02-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader ead1a345a36c..5edafb5ac109 (1 commits) 2019-02-27 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 146c088efeb72..df5fc7e20422a 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': 'ff84d8a900d4b9dd4d4aa7a9569425f0ac234830', + 'skia_revision': '67d87128fd001b7fc049e65af7c7a3b5240c4a11', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 66aeb0758dcfd..649d18b5b8a7e 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 1bea5458095c0f6e6943f64d781b6e6f +Signature: 31a4ba58e2ed9670d2518bf9bbb627cb UNUSED LICENSES: From 3e4e6f5c54db7a705e6d50f7f3bddfa2ac0d6612 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 27 Feb 2019 12:12:45 -0800 Subject: [PATCH 0305/1117] Provide batching for semantics updates (#7988) Some embedders prefer to minimise the number of semantics node/custom action updates sent back to the host platform -- for example due to expensive serialisation mechanisms, etc. This patch provides a 'batch end' signal that provides embedders with an indication of when a self-consistent set of semantics node or custom action updates have been sent. We overload the node/action ID with information that conveys a batch end by using an ID (-1) that is never allotted to semantics nodes by the framework. --- shell/platform/embedder/embedder.cc | 10 ++++++++ shell/platform/embedder/embedder.h | 25 ++++++++++++++++--- .../embedder/tests/embedder_a11y_unittests.cc | 21 +++++++++++++--- 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index c9b061d6c93b3..a7ae7575ca425 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -448,6 +448,11 @@ FlutterEngineResult FlutterEngineRun(size_t version, }; ptr(&embedder_node, user_data); } + const FlutterSemanticsNode batch_end_sentinel = { + sizeof(FlutterSemanticsNode), + kFlutterSemanticsNodeIdBatchEnd, + }; + ptr(&batch_end_sentinel, user_data); }; } @@ -469,6 +474,11 @@ FlutterEngineResult FlutterEngineRun(size_t version, }; ptr(&embedder_action, user_data); } + const FlutterSemanticsCustomAction batch_end_sentinel = { + sizeof(FlutterSemanticsCustomAction), + kFlutterSemanticsCustomActionIdBatchEnd, + }; + ptr(&batch_end_sentinel, user_data); }; } diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 735d4ff97b9b1..bff32b3c5d3a0 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -319,6 +319,10 @@ typedef struct { double bottom; } FlutterRect; +// |FlutterSemanticsNode| ID used as a sentinel to signal the end of a batch of +// semantics node updates. +const int32_t kFlutterSemanticsNodeIdBatchEnd = -1; + // A node that represents some semantic data. // // The semantics tree is maintained during the semantics phase of the pipeline @@ -386,6 +390,10 @@ typedef struct { const int32_t* custom_accessibility_actions; } FlutterSemanticsNode; +// |FlutterSemanticsCustomAction| ID used as a sentinel to signal the end of a +// batch of semantics custom action updates. +const int32_t kFlutterSemanticsCustomActionIdBatchEnd = -1; + // A custom semantics action, or action override. // // Custom actions can be registered by applications in order to provide @@ -496,14 +504,23 @@ typedef struct { // immediately after the root isolate has been created and marked runnable. VoidCallback root_isolate_create_callback; // The callback invoked by the engine in order to give the embedder the - // chance to respond to semantics node updates from the Dart application. The - // callback will be invoked on the thread on which the |FlutterEngineRun| + // chance to respond to semantics node updates from the Dart application. + // Semantics node updates are sent in batches terminated by a 'batch end' + // callback that is passed a sentinel |FlutterSemanticsNode| whose |id| field + // has the value |kFlutterSemanticsNodeIdBatchEnd|. + // + // The callback will be invoked on the thread on which the |FlutterEngineRun| // call is made. FlutterUpdateSemanticsNodeCallback update_semantics_node_callback; // The callback invoked by the engine in order to give the embedder the // chance to respond to updates to semantics custom actions from the Dart - // application. The callback will be invoked on the thread on which the - // |FlutterEngineRun| call is made. + // application. Custom action updates are sent in batches terminated by a + // 'batch end' callback that is passed a sentinel + // |FlutterSemanticsCustomAction| whose |id| field has the value + // |kFlutterSemanticsCustomActionIdBatchEnd|. + // + // The callback will be invoked on the thread on which the |FlutterEngineRun| + // call is made. FlutterUpdateSemanticsCustomActionCallback update_semantics_custom_action_callback; // Path to a directory used to store data that is cached across runs of a diff --git a/shell/platform/embedder/tests/embedder_a11y_unittests.cc b/shell/platform/embedder/tests/embedder_a11y_unittests.cc index 511a1dcf2e2d1..1959901c19700 100644 --- a/shell/platform/embedder/tests/embedder_a11y_unittests.cc +++ b/shell/platform/embedder/tests/embedder_a11y_unittests.cc @@ -151,17 +151,32 @@ TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) { // Wait for UpdateSemantics callback on platform (current) thread. int node_count = 0; + int node_batch_end_count = 0; test_data.on_semantics_update = - [&node_count](const FlutterSemanticsNode* node) { ++node_count; }; + [&node_count, &node_batch_end_count](const FlutterSemanticsNode* node) { + if (node->id == kFlutterSemanticsNodeIdBatchEnd) { + ++node_batch_end_count; + } else { + ++node_count; + } + }; int action_count = 0; + int action_batch_end_count = 0; test_data.on_custom_action_update = - [&action_count](const FlutterSemanticsCustomAction* action) { - ++action_count; + [&action_count, + &action_batch_end_count](const FlutterSemanticsCustomAction* action) { + if (action->id == kFlutterSemanticsCustomActionIdBatchEnd) { + ++action_batch_end_count; + } else { + ++action_count; + } }; g_latch.Wait(); fml::MessageLoop::GetCurrent().RunExpiredTasksNow(); ASSERT_EQ(4, node_count); + ASSERT_EQ(1, node_batch_end_count); ASSERT_EQ(1, action_count); + ASSERT_EQ(1, action_batch_end_count); // Dispatch a tap to semantics node 42. Wait for NotifySemanticsAction. g_test_data_callback = [](Dart_NativeArguments args) { From 9b924765f4de29cb9751eb598a629f0cc8d4975b Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 27 Feb 2019 14:41:58 -0800 Subject: [PATCH 0306/1117] Improve performance of Locale.toString (#7990) Use a map instead of a switch to replace deprecated language and country codes. Also cache the result for the most recently used locale. --- lib/ui/window.dart | 205 +++++++++++++++++++++--------------------- tools/gen_locale.dart | 4 +- 2 files changed, 107 insertions(+), 102 deletions(-) diff --git a/lib/ui/window.dart b/lib/ui/window.dart index 56b346c3305d2..d89b668b7037d 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -223,94 +223,91 @@ class Locale { /// /// * [new Locale.fromSubtags], which describes the conventions for creating /// [Locale] objects. - String get languageCode => _replaceDeprecatedLanguageSubtag(_languageCode); + String get languageCode => _deprecatedLanguageSubtagMap[_languageCode] ?? _languageCode; final 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) { - case 'in': return 'id'; // Indonesian; deprecated 1989-01-01 - case 'iw': return 'he'; // Hebrew; deprecated 1989-01-01 - case 'ji': return 'yi'; // Yiddish; deprecated 1989-01-01 - case 'jw': return 'jv'; // Javanese; deprecated 2001-08-13 - case 'mo': return 'ro'; // Moldavian, Moldovan; deprecated 2008-11-22 - case 'aam': return 'aas'; // Aramanik; deprecated 2015-02-12 - case 'adp': return 'dz'; // Adap; deprecated 2015-02-12 - case 'aue': return 'ktz'; // =/Kx'au//'ein; deprecated 2015-02-12 - case 'ayx': return 'nun'; // Ayi (China); deprecated 2011-08-16 - case 'bgm': return 'bcg'; // Baga Mboteni; deprecated 2016-05-30 - case 'bjd': return 'drl'; // Bandjigali; deprecated 2012-08-12 - case 'ccq': return 'rki'; // Chaungtha; deprecated 2012-08-12 - case 'cjr': return 'mom'; // Chorotega; deprecated 2010-03-11 - case 'cka': return 'cmr'; // Khumi Awa Chin; deprecated 2012-08-12 - case 'cmk': return 'xch'; // Chimakum; deprecated 2010-03-11 - case 'coy': return 'pij'; // Coyaima; deprecated 2016-05-30 - case 'cqu': return 'quh'; // Chilean Quechua; deprecated 2016-05-30 - case 'drh': return 'khk'; // Darkhat; deprecated 2010-03-11 - case 'drw': return 'prs'; // Darwazi; deprecated 2010-03-11 - case 'gav': return 'dev'; // Gabutamon; deprecated 2010-03-11 - case 'gfx': return 'vaj'; // Mangetti Dune !Xung; deprecated 2015-02-12 - case 'ggn': return 'gvr'; // Eastern Gurung; deprecated 2016-05-30 - case 'gti': return 'nyc'; // Gbati-ri; deprecated 2015-02-12 - case 'guv': return 'duz'; // Gey; deprecated 2016-05-30 - case 'hrr': return 'jal'; // Horuru; deprecated 2012-08-12 - case 'ibi': return 'opa'; // Ibilo; deprecated 2012-08-12 - case 'ilw': return 'gal'; // Talur; deprecated 2013-09-10 - case 'jeg': return 'oyb'; // Jeng; deprecated 2017-02-23 - case 'kgc': return 'tdf'; // Kasseng; deprecated 2016-05-30 - case 'kgh': return 'kml'; // Upper Tanudan Kalinga; deprecated 2012-08-12 - case 'koj': return 'kwv'; // Sara Dunjo; deprecated 2015-02-12 - case 'krm': return 'bmf'; // Krim; deprecated 2017-02-23 - case 'ktr': return 'dtp'; // Kota Marudu Tinagas; deprecated 2016-05-30 - case 'kvs': return 'gdj'; // Kunggara; deprecated 2016-05-30 - case 'kwq': return 'yam'; // Kwak; deprecated 2015-02-12 - case 'kxe': return 'tvd'; // Kakihum; deprecated 2015-02-12 - case 'kzj': return 'dtp'; // Coastal Kadazan; deprecated 2016-05-30 - case 'kzt': return 'dtp'; // Tambunan Dusun; deprecated 2016-05-30 - case 'lii': return 'raq'; // Lingkhim; deprecated 2015-02-12 - case 'lmm': return 'rmx'; // Lamam; deprecated 2014-02-28 - case 'meg': return 'cir'; // Mea; deprecated 2013-09-10 - case 'mst': return 'mry'; // Cataelano Mandaya; deprecated 2010-03-11 - case 'mwj': return 'vaj'; // Maligo; deprecated 2015-02-12 - case 'myt': return 'mry'; // Sangab Mandaya; deprecated 2010-03-11 - case 'nad': return 'xny'; // Nijadali; deprecated 2016-05-30 - case 'ncp': return 'kdz'; // Ndaktup; deprecated 2018-03-08 - case 'nnx': return 'ngv'; // Ngong; deprecated 2015-02-12 - case 'nts': return 'pij'; // Natagaimas; deprecated 2016-05-30 - case 'oun': return 'vaj'; // !O!ung; deprecated 2015-02-12 - case 'pcr': return 'adx'; // Panang; deprecated 2013-09-10 - case 'pmc': return 'huw'; // Palumata; deprecated 2016-05-30 - case 'pmu': return 'phr'; // Mirpur Panjabi; deprecated 2015-02-12 - case 'ppa': return 'bfy'; // Pao; deprecated 2016-05-30 - case 'ppr': return 'lcq'; // Piru; deprecated 2013-09-10 - case 'pry': return 'prt'; // Pray 3; deprecated 2016-05-30 - case 'puz': return 'pub'; // Purum Naga; deprecated 2014-02-28 - case 'sca': return 'hle'; // Sansu; deprecated 2012-08-12 - case 'skk': return 'oyb'; // Sok; deprecated 2017-02-23 - case 'tdu': return 'dtp'; // Tempasuk Dusun; deprecated 2016-05-30 - case 'thc': return 'tpo'; // Tai Hang Tong; deprecated 2016-05-30 - case 'thx': return 'oyb'; // The; deprecated 2015-02-12 - case 'tie': return 'ras'; // Tingal; deprecated 2011-08-16 - case 'tkk': return 'twm'; // Takpa; deprecated 2011-08-16 - case 'tlw': return 'weo'; // South Wemale; deprecated 2012-08-12 - case 'tmp': return 'tyj'; // Tai Mène; deprecated 2016-05-30 - case 'tne': return 'kak'; // Tinoc Kallahan; deprecated 2016-05-30 - case 'tnf': return 'prs'; // Tangshewi; deprecated 2010-03-11 - case 'tsf': return 'taj'; // Southwestern Tamang; deprecated 2015-02-12 - case 'uok': return 'ema'; // Uokha; deprecated 2015-02-12 - case 'xba': return 'cax'; // Kamba (Brazil); deprecated 2016-05-30 - case 'xia': return 'acn'; // Xiandao; deprecated 2013-09-10 - case 'xkh': return 'waw'; // Karahawyana; deprecated 2016-05-30 - case 'xsj': return 'suj'; // Subi; deprecated 2015-02-12 - case 'ybd': return 'rki'; // Yangbye; deprecated 2012-08-12 - case 'yma': return 'lrr'; // Yamphe; deprecated 2012-08-12 - case 'ymt': return 'mtm'; // Mator-Taygi-Karagas; deprecated 2015-02-12 - case 'yos': return 'zom'; // Yos; deprecated 2013-09-10 - case 'yuu': return 'yug'; // Yugh; deprecated 2014-02-28 - default: return languageCode; - } - } + // This map is generated by //flutter/tools/gen_locale.dart + // Mappings generated for language subtag registry as of 2019-02-27. + static const Map _deprecatedLanguageSubtagMap = const { + 'in': 'id', // Indonesian; deprecated 1989-01-01 + 'iw': 'he', // Hebrew; deprecated 1989-01-01 + 'ji': 'yi', // Yiddish; deprecated 1989-01-01 + 'jw': 'jv', // Javanese; deprecated 2001-08-13 + 'mo': 'ro', // Moldavian, Moldovan; deprecated 2008-11-22 + 'aam': 'aas', // Aramanik; deprecated 2015-02-12 + 'adp': 'dz', // Adap; deprecated 2015-02-12 + 'aue': 'ktz', // ǂKxʼauǁʼein; deprecated 2015-02-12 + 'ayx': 'nun', // Ayi (China); deprecated 2011-08-16 + 'bgm': 'bcg', // Baga Mboteni; deprecated 2016-05-30 + 'bjd': 'drl', // Bandjigali; deprecated 2012-08-12 + 'ccq': 'rki', // Chaungtha; deprecated 2012-08-12 + 'cjr': 'mom', // Chorotega; deprecated 2010-03-11 + 'cka': 'cmr', // Khumi Awa Chin; deprecated 2012-08-12 + 'cmk': 'xch', // Chimakum; deprecated 2010-03-11 + 'coy': 'pij', // Coyaima; deprecated 2016-05-30 + 'cqu': 'quh', // Chilean Quechua; deprecated 2016-05-30 + 'drh': 'khk', // Darkhat; deprecated 2010-03-11 + 'drw': 'prs', // Darwazi; deprecated 2010-03-11 + 'gav': 'dev', // Gabutamon; deprecated 2010-03-11 + 'gfx': 'vaj', // Mangetti Dune ǃXung; deprecated 2015-02-12 + 'ggn': 'gvr', // Eastern Gurung; deprecated 2016-05-30 + 'gti': 'nyc', // Gbati-ri; deprecated 2015-02-12 + 'guv': 'duz', // Gey; deprecated 2016-05-30 + 'hrr': 'jal', // Horuru; deprecated 2012-08-12 + 'ibi': 'opa', // Ibilo; deprecated 2012-08-12 + 'ilw': 'gal', // Talur; deprecated 2013-09-10 + 'jeg': 'oyb', // Jeng; deprecated 2017-02-23 + 'kgc': 'tdf', // Kasseng; deprecated 2016-05-30 + 'kgh': 'kml', // Upper Tanudan Kalinga; deprecated 2012-08-12 + 'koj': 'kwv', // Sara Dunjo; deprecated 2015-02-12 + 'krm': 'bmf', // Krim; deprecated 2017-02-23 + 'ktr': 'dtp', // Kota Marudu Tinagas; deprecated 2016-05-30 + 'kvs': 'gdj', // Kunggara; deprecated 2016-05-30 + 'kwq': 'yam', // Kwak; deprecated 2015-02-12 + 'kxe': 'tvd', // Kakihum; deprecated 2015-02-12 + 'kzj': 'dtp', // Coastal Kadazan; deprecated 2016-05-30 + 'kzt': 'dtp', // Tambunan Dusun; deprecated 2016-05-30 + 'lii': 'raq', // Lingkhim; deprecated 2015-02-12 + 'lmm': 'rmx', // Lamam; deprecated 2014-02-28 + 'meg': 'cir', // Mea; deprecated 2013-09-10 + 'mst': 'mry', // Cataelano Mandaya; deprecated 2010-03-11 + 'mwj': 'vaj', // Maligo; deprecated 2015-02-12 + 'myt': 'mry', // Sangab Mandaya; deprecated 2010-03-11 + 'nad': 'xny', // Nijadali; deprecated 2016-05-30 + 'ncp': 'kdz', // Ndaktup; deprecated 2018-03-08 + 'nnx': 'ngv', // Ngong; deprecated 2015-02-12 + 'nts': 'pij', // Natagaimas; deprecated 2016-05-30 + 'oun': 'vaj', // ǃOǃung; deprecated 2015-02-12 + 'pcr': 'adx', // Panang; deprecated 2013-09-10 + 'pmc': 'huw', // Palumata; deprecated 2016-05-30 + 'pmu': 'phr', // Mirpur Panjabi; deprecated 2015-02-12 + 'ppa': 'bfy', // Pao; deprecated 2016-05-30 + 'ppr': 'lcq', // Piru; deprecated 2013-09-10 + 'pry': 'prt', // Pray 3; deprecated 2016-05-30 + 'puz': 'pub', // Purum Naga; deprecated 2014-02-28 + 'sca': 'hle', // Sansu; deprecated 2012-08-12 + 'skk': 'oyb', // Sok; deprecated 2017-02-23 + 'tdu': 'dtp', // Tempasuk Dusun; deprecated 2016-05-30 + 'thc': 'tpo', // Tai Hang Tong; deprecated 2016-05-30 + 'thx': 'oyb', // The; deprecated 2015-02-12 + 'tie': 'ras', // Tingal; deprecated 2011-08-16 + 'tkk': 'twm', // Takpa; deprecated 2011-08-16 + 'tlw': 'weo', // South Wemale; deprecated 2012-08-12 + 'tmp': 'tyj', // Tai Mène; deprecated 2016-05-30 + 'tne': 'kak', // Tinoc Kallahan; deprecated 2016-05-30 + 'tnf': 'prs', // Tangshewi; deprecated 2010-03-11 + 'tsf': 'taj', // Southwestern Tamang; deprecated 2015-02-12 + 'uok': 'ema', // Uokha; deprecated 2015-02-12 + 'xba': 'cax', // Kamba (Brazil); deprecated 2016-05-30 + 'xia': 'acn', // Xiandao; deprecated 2013-09-10 + 'xkh': 'waw', // Karahawyana; deprecated 2016-05-30 + 'xsj': 'suj', // Subi; deprecated 2015-02-12 + 'ybd': 'rki', // Yangbye; deprecated 2012-08-12 + 'yma': 'lrr', // Yamphe; deprecated 2012-08-12 + 'ymt': 'mtm', // Mator-Taygi-Karagas; deprecated 2015-02-12 + 'yos': 'zom', // Yos; deprecated 2013-09-10 + 'yuu': 'yug', // Yugh; deprecated 2014-02-28 + }; /// The script subtag for the locale. /// @@ -345,22 +342,19 @@ class Locale { /// /// * [new Locale.fromSubtags], which describes the conventions for creating /// [Locale] objects. - String get countryCode => _replaceDeprecatedRegionSubtag(_countryCode); + String get countryCode => _deprecatedRegionSubtagMap[_countryCode] ?? _countryCode; final String _countryCode; - 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) { - case 'BU': return 'MM'; // Burma; deprecated 1989-12-05 - case 'DD': return 'DE'; // German Democratic Republic; deprecated 1990-10-30 - case 'FX': return 'FR'; // Metropolitan France; deprecated 1997-07-14 - case 'TP': return 'TL'; // East Timor; deprecated 2002-05-20 - case 'YD': return 'YE'; // Democratic Yemen; deprecated 1990-08-14 - case 'ZR': return 'CD'; // Zaire; deprecated 1997-07-14 - default: return regionCode; - } - } + // This map is generated by //flutter/tools/gen_locale.dart + // Mappings generated for language subtag registry as of 2019-02-27. + static const Map _deprecatedRegionSubtagMap = const { + 'BU': 'MM', // Burma; deprecated 1989-12-05 + 'DD': 'DE', // German Democratic Republic; deprecated 1990-10-30 + 'FX': 'FR', // Metropolitan France; deprecated 1997-07-14 + 'TP': 'TL', // East Timor; deprecated 2002-05-20 + 'YD': 'YE', // Democratic Yemen; deprecated 1990-08-14 + 'ZR': 'CD', // Zaire; deprecated 1997-07-14 + }; @override bool operator ==(dynamic other) { @@ -377,8 +371,19 @@ class Locale { @override int get hashCode => hashValues(languageCode, scriptCode, countryCode); + static Locale cachedLocale; + static String cachedLocaleString; + @override String toString() { + if (!identical(cachedLocale, this)) { + cachedLocale = this; + cachedLocaleString = _rawToString(); + } + return cachedLocaleString; + } + + String _rawToString() { final StringBuffer out = StringBuffer(languageCode); if (scriptCode != null) out.write('_$scriptCode'); diff --git a/tools/gen_locale.dart b/tools/gen_locale.dart index 2ee63adb20155..bb3751fa3d8a4 100644 --- a/tools/gen_locale.dart +++ b/tools/gen_locale.dart @@ -7,7 +7,7 @@ // When running this script, use the output of this script to update the // comments that say when the script was last run (that comment appears twice in -// window.dart), and then replace all the "case" statements with the output from +// window.dart), and then replace all the map entries with the output from // this script (the first set for _canonicalizeLanguageCode and the second set // for _canonicalizeRegionCode). @@ -60,7 +60,7 @@ Future main() async { assert(section.containsKey('Deprecated')); final String comment = section.containsKey('Comment') ? section['Comment'].single : 'deprecated ${section['Deprecated'].single}'; final String preferredValue = section['Preferred-Value'].single; - outputs[type].add('case \'$subtag\': return \'$preferredValue\'; // ${descriptions.join(", ")}; $comment'); + outputs[type].add('\'$subtag\': \'$preferredValue\', // ${descriptions.join(", ")}; $comment'); } } print('// Mappings generated for language subtag registry as of $fileDate.'); From 4a148cdc8969df4c9277bc6bce08bc518a5ad2dd Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 27 Feb 2019 18:55:31 -0500 Subject: [PATCH 0307/1117] Roll src/third_party/skia 67d87128fd00..0cedddc1420b (10 commits) (#7992) https://skia.googlesource.com/skia.git/%2Blog/67d87128fd00..0cedddc1420b git log 67d87128fd001b7fc049e65af7c7a3b5240c4a11..0cedddc1420b248bafdbf094125ea1dde2b85d97 --date=short --no-merges --format=%ad %ae %s 2019-02-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 17078c70fc9c..83fc5445e748 (6 commits) 2019-02-27 mtklein@google.com round when writing lowp 565 or 4444 2019-02-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 009696c56169..aaa17b8528d8 (1 commits) 2019-02-27 reed@google.com utility to check if floats are [0...1] 2019-02-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 105fd0f651d1..17078c70fc9c (1 commits) 2019-02-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 928dfeed1796..105fd0f651d1 (4 commits) 2019-02-27 mtklein@google.com mark more methods inline 2019-02-27 mtklein@google.com specialize if_then_else(int4,float4,float4) 2019-02-27 michaelludwig@google.com Revert "Add general quad API to SkGpuDevice" 2019-02-27 michaelludwig@google.com Add general quad API to SkGpuDevice The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index df5fc7e20422a..f0582a01da472 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': '67d87128fd001b7fc049e65af7c7a3b5240c4a11', + 'skia_revision': '0cedddc1420b248bafdbf094125ea1dde2b85d97', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 649d18b5b8a7e..0d4a804bce18e 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 31a4ba58e2ed9670d2518bf9bbb627cb +Signature: c716f5ad6a16bd13877bc957a6e5e88a UNUSED LICENSES: From df03ec74fa8c4ecfa36a42669c6d4e5725392d9f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 27 Feb 2019 23:12:43 -0500 Subject: [PATCH 0308/1117] Roll src/third_party/skia 0cedddc1420b..90043480b587 (1 commits) (#7994) https://skia.googlesource.com/skia.git/%2Blog/0cedddc1420b..90043480b587 git log 0cedddc1420b248bafdbf094125ea1dde2b85d97..90043480b587b627b255e8010b23b0f2dff3a8c9 --date=short --no-merges --format=%ad %ae %s 2019-02-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 83fc5445e748..dfc0f3b7a757 (5 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f0582a01da472..533f4078fee37 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': '0cedddc1420b248bafdbf094125ea1dde2b85d97', + 'skia_revision': '90043480b587b627b255e8010b23b0f2dff3a8c9', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 0d4a804bce18e..8cdab6c618c5c 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c716f5ad6a16bd13877bc957a6e5e88a +Signature: f86ecf445ce41fd5cdd109670d3a3e06 UNUSED LICENSES: From 2360b459de81e6aef881ed384272da71548395c8 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 27 Feb 2019 21:09:28 -0800 Subject: [PATCH 0309/1117] Android Embedding PR 11: Add FlutterEngine to FlutterFragment. (#7972) --- .../engine/android/FlutterFragment.java | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java index 89f25e4dd5f11..d4a535bc053d1 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java @@ -4,12 +4,17 @@ package io.flutter.embedding.engine.android; +import android.content.Context; import android.content.Intent; import android.os.Bundle; +import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; +import android.util.Log; +import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.FlutterShellArgs; +import io.flutter.view.FlutterMain; /** * {@code Fragment} which displays a Flutter UI that takes up all available {@code Fragment} space. @@ -144,9 +149,62 @@ protected static Bundle createArgsBundle(@Nullable String dartEntrypoint, return args; } + @Nullable + private FlutterEngine flutterEngine; + public FlutterFragment() { // Ensure that we at least have an empty Bundle of arguments so that we don't // need to continually check for null arguments before grabbing one. setArguments(new Bundle()); } + + @Override + public void onAttach(Context context) { + super.onAttach(context); + + // When "retain instance" is true, the FlutterEngine will survive configuration + // changes. Therefore, we create a new one only if one does not already exist. + if (flutterEngine == null) { + createFlutterEngine(); + } + } + + /** + * Creates a new FlutterEngine instance. + * + * Subclasses can instantiate their own {@link FlutterEngine} by overriding + * {@link #onCreateFlutterEngine(Context)}. + * + * Subclasses can alter the {@link FlutterEngine} after creation by overriding + * {@link #onFlutterEngineCreated(FlutterEngine)}. + */ + private void createFlutterEngine() { + // Create a FlutterEngine to back our FlutterView. + flutterEngine = onCreateFlutterEngine(getActivity()); + + // Allow subclasses to customize FlutterEngine as desired. + onFlutterEngineCreated(flutterEngine); + } + + /** + * Hook for subclasses to customize the creation of the {@code FlutterEngine}. + * + * By default, this method returns a standard {@link FlutterEngine} without any modification. + */ + @NonNull + protected FlutterEngine onCreateFlutterEngine(@NonNull Context context) { + Log.d(TAG, "onCreateFlutterEngine()"); + return new FlutterEngine(context); + } + + /** + * Hook for subclasses to customize the {@link FlutterEngine} owned by this {@link FlutterFragment} + * after the {@link FlutterEngine} has been instantiated. + * + * Consider using this method to connect desired Flutter plugins to this {@code Fragment}'s + * {@link FlutterEngine}. + */ + protected void onFlutterEngineCreated(@NonNull FlutterEngine flutterEngine) { + // no-op + } } From 72cbe69cc84be6dd6d0c31b180e99771b5a0c6bc Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 27 Feb 2019 21:10:08 -0800 Subject: [PATCH 0310/1117] Fix two typos in embedder.h (#7993) occured -> occurred preceeded -> preceded --- shell/platform/embedder/embedder.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index bff32b3c5d3a0..baf789594d012 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -622,8 +622,8 @@ FlutterEngineResult FlutterEngineDispatchSemanticsAction( const uint8_t* data, size_t data_length); -// Notify the engine that a vsync event occured. A baton passed to the platform -// via the vsync callback must be returned. +// Notify the engine that a vsync event occurred. A baton passed to the +// platform via the vsync callback must be returned. FLUTTER_EXPORT FlutterEngineResult FlutterEngineOnVsync(FlutterEngine engine, intptr_t baton, @@ -638,9 +638,9 @@ FlutterEngineResult FlutterEngineOnVsync(FlutterEngine engine, FLUTTER_EXPORT void FlutterEngineTraceEventDurationBegin(const char* name); -// A profiling utility. Logs a trace duration end event to the timeline. If -// the timeline is unavailable or disabled, this has no effect. This call must -// be preceeded by a trace duration begin call (via +// A profiling utility. Logs a trace duration end event to the timeline. If the +// timeline is unavailable or disabled, this has no effect. This call must be +// preceded by a trace duration begin call (via // |FlutterEngineTraceEventDurationBegin|) with the same name on the same // thread. Can be called on any thread. FLUTTER_EXPORT From 58ce0fff7ac360eee9dda2f65604dadc42c519d1 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 28 Feb 2019 03:42:59 -0500 Subject: [PATCH 0311/1117] Roll src/third_party/skia 90043480b587..1179d5dfaf8d (3 commits) (#7995) https://skia.googlesource.com/skia.git/%2Blog/90043480b587..1179d5dfaf8d git log 90043480b587b627b255e8010b23b0f2dff3a8c9..1179d5dfaf8d0a2a7c6c8f7e997dd267b118d5db --date=short --no-merges --format=%ad %ae %s 2019-02-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 aaa17b8528d8..4b314eefc839 (2 commits) 2019-02-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3014e76bab03..201f136c9907 (1 commits) 2019-02-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader dfc0f3b7a757..3014e76bab03 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 533f4078fee37..0652b70f47230 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': '90043480b587b627b255e8010b23b0f2dff3a8c9', + 'skia_revision': '1179d5dfaf8d0a2a7c6c8f7e997dd267b118d5db', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 8cdab6c618c5c..65ecdb13a0c23 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f86ecf445ce41fd5cdd109670d3a3e06 +Signature: f25dc20a23aafd38437994dfd80cdd57 UNUSED LICENSES: From 5194919e130917d29ac15f0ac7f52ea94d1a4d67 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 28 Feb 2019 11:31:43 -0500 Subject: [PATCH 0312/1117] Roll src/third_party/skia 1179d5dfaf8d..b7b2da871e95 (1 commits) (#7996) https://skia.googlesource.com/skia.git/%2Blog/1179d5dfaf8d..b7b2da871e95 git log 1179d5dfaf8d0a2a7c6c8f7e997dd267b118d5db..b7b2da871e959ce9d412498b0378f5ace0dd5808 --date=short --no-merges --format=%ad %ae %s 2019-02-28 mtklein@google.com set -fcolor-diagnostics when is_clang The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 0652b70f47230..eef910003fc53 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': '1179d5dfaf8d0a2a7c6c8f7e997dd267b118d5db', + 'skia_revision': 'b7b2da871e959ce9d412498b0378f5ace0dd5808', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the From 6bc9c3d1703ae258937194c0b8be8f78b57ac6b2 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 28 Feb 2019 13:15:08 -0800 Subject: [PATCH 0313/1117] Roll src/third_party/dart 40bab34fbd..7c70ab1817 (35 commits) 7c70ab1817 Revert change that empirically doesn't improve code for dart2js stopwatch. 895bc90509 Sync pub client to newest version 39f365f3b9 Sort declarations in parser.dart. 8af83b19d6 Sort declarations in ast_builder.dart. 0adddfbeab Eliminate uses of old AST node types from analysis server 120328aff7 [fasta] Commandline option to enable asserts 82c5c5bbb2 [fasta] Only read compiler context at construction in kernel_target. 9a4c49f301 Update field analysis tests to prepare for eager initializer improvements 75370569fc Fall back to DillLoader when computing types in SourceLoader 78ba3dab7a Rename ImplicitType to ImplcitFieldType 1720704594 Recognize effectively constant static fields ba31e448ca Finish implementing IsIntersectionSubtypeOf 5f095b7039 [Fasta] Add support for spread in map literals 3b8591d13e [ddc] Initial impl for invoking service extension ae70ce855f Include the completion suggestion labels as explicit relevance tags 50ab52d567 Use raw is-check when type arguments match the bounds d650c619e2 more postfix "!" non-null assert operator tests a3ab6b6514 [vm, gc] Reduce cost of maintaining allocation stats during scavenges. 36c14db2d3 Only refine non-null in SSA a1349ac529 Remove childEntities and visitChildren from ForEachStatementImpl and ForStatementImpl. 31993bf1b5 improve expression function body recovery 1c477ad3aa Refactor downward inference to improve recovery 8f12d634fe add postfix "!" non-null assert operator ab10fb12dc [vm/interpreter] Reduce stack usage of interpreter ffc1383918 Move tests of five more analyzer codes to diagnostics a6b76df8d8 Add flag to re-run global inference when reading a data file. b04cb2f5e7 Don't create instances of ForStatement2Impl yet. 82a15835f0 Short-circuit logical operators in constants 7829012e61 add new ExperimentNotEnabled error code 1e2211bbb6 going to go ahead and just revert this. I don't think it is at all critical. Thanks for noticing the build failure Paul! 01cc5a6305 Ensure unknown fields in LSP payloads are ignored d7a7de31bf Update dartkb test expectations 0e9d97498c Add some notes on using Dart LSP with Vim a9ef31ba43 [Fasta] Add Kernel syntax for spread elements b79e2a8882 Fix equivalence/show_helper --- DEPS | 4 ++-- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index eef910003fc53..cb824997cff40 100644 --- a/DEPS +++ b/DEPS @@ -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': '40bab34fbd08673b469b86c01f211cd0b6e805c5', + 'dart_revision': '7c70ab1817ad6553f21fadadf0a88fe568ee8745', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -75,7 +75,7 @@ vars = { 'dart_plugin_tag': 'f5b4b0e32d1406d62daccea030ba6457d14b1c47', 'dart_pool_tag': '1.3.6', 'dart_protobuf_tag': '0.9.0', - 'dart_pub_rev': '980fc947db32bca6ae7d07fbb4ad0fcdba0050ec', + 'dart_pub_rev': '3c060aae47985e9a248b850f1d0450304a5c97e3', 'dart_pub_semver_tag': '1.4.2', 'dart_quiver_tag': '2.0.0+1', 'dart_resource_rev': '2.1.5', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 081222b6fd271..28067d13e0b2d 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: ab41a143da5b7fb2e46b9b9df48ae3cb +Signature: 80f68675dab65099e7156f61547b4d56 UNUSED LICENSES: From a1d84996ddcd1ece63232ee252d5484ddd960bee Mon Sep 17 00:00:00 2001 From: Greg Spencer Date: Thu, 28 Feb 2019 14:42:55 -0800 Subject: [PATCH 0314/1117] Fix spelling errors in dartdocs (#7997) Fix the spelling errors in the dartdocs for the engine. There are no functionality changes here, just documentation fixes. --- .../track_widget_constructor_locations.dart | 4 +- lib/stub_ui/compositing.dart | 2 +- lib/stub_ui/natives.dart | 2 +- lib/stub_ui/painting.dart | 69 +++++++++--------- lib/stub_ui/semantics.dart | 10 +-- lib/stub_ui/text.dart | 6 +- lib/ui/compositing.dart | 2 +- lib/ui/natives.dart | 11 +-- lib/ui/painting.dart | 71 ++++++++++--------- lib/ui/semantics.dart | 6 +- lib/ui/text.dart | 6 +- 11 files changed, 97 insertions(+), 92 deletions(-) diff --git a/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart b/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart index 47fa4f341f826..78c361e98f516 100644 --- a/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart +++ b/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart @@ -144,7 +144,7 @@ class _WidgetCallSiteTransformer extends Transformer { /// locations of the parameters passed in from the source location of the /// constructor call but it is convenient to bundle the location and names /// of the parameters passed in so that tools can show parameter locations - /// without reparsing the source code. + /// without re-parsing the source code. ConstructorInvocation _constructLocation( Location location, { String name, @@ -399,7 +399,7 @@ class WidgetCreatorTracker implements ProgramTransformer { new VariableGet(variable), )); // TODO(jacobr): add an assert verifying the locationField is not - // null. Curently we cannot safely add this assert because we do not + // null. Currently, we cannot safely add this assert because we do not // handle Widget classes with optional positional arguments. There are // no Widget classes in the flutter repo with optional positional // arguments but it is possible users could add classes with optional diff --git a/lib/stub_ui/compositing.dart b/lib/stub_ui/compositing.dart index 3de66280773c9..071b1d45cdacd 100644 --- a/lib/stub_ui/compositing.dart +++ b/lib/stub_ui/compositing.dart @@ -215,7 +215,7 @@ class SceneBuilder { /// Android view: When resizing an Android view there is a short period during /// which the framework cannot tell if the newest texture frame has the /// previous or new size, to workaround this the framework "freezes" the - /// texture just before resizing the Android view and unfreezes it when it is + /// texture just before resizing the Android view and un-freezes it when it is /// certain that a frame with the new size is ready. void addTexture(int textureId, { Offset offset: Offset.zero, double width: 0.0, double height: 0.0 , bool freeze: false}) { throw UnimplementedError(); diff --git a/lib/stub_ui/natives.dart b/lib/stub_ui/natives.dart index d8388a8640e5f..9e46816e5f5b5 100644 --- a/lib/stub_ui/natives.dart +++ b/lib/stub_ui/natives.dart @@ -33,7 +33,7 @@ void _setupHooks() { // ignore: unused_element /// /// The buffer contains a list of symbols compiled by the Dart JIT at runtime up to the point /// when this function was called. This list can be saved to a text file and passed to tools -/// such as `flutter build` or Dart `gen_snapshot` in order to precompile this code offline. +/// such as `flutter build` or Dart `gen_snapshot` in order to pre-compile this code offline. /// /// The list has one symbol per line of the following format: `,,\n`. /// Here are some examples: diff --git a/lib/stub_ui/painting.dart b/lib/stub_ui/painting.dart index 958f4020d0dad..ce60d7bb130df 100644 --- a/lib/stub_ui/painting.dart +++ b/lib/stub_ui/painting.dart @@ -59,7 +59,7 @@ Color _scaleAlpha(Color a, double factor) { /// /// Consider the light teal of the Flutter logo. It is fully opaque, with a red /// channel value of 0x42 (66), a green channel value of 0xA5 (165), and a blue -/// channel value of 0xF5 (245). In the common "hash syntax" for colour values, +/// channel value of 0xF5 (245). In the common "hash syntax" for color values, /// it would be described as `#42A5F5`. /// /// Here are some ways it could be constructed: @@ -803,7 +803,7 @@ enum FilterQuality { /// Fastest possible filtering, albeit also the lowest quality. /// - /// Typically this implies nearest-neighbour filtering. + /// Typically this implies nearest-neighbor filtering. none, /// Better quality than [none], faster than [medium]. @@ -814,7 +814,7 @@ enum FilterQuality { /// Better quality than [low], faster than [high]. /// /// Typically this implies a combination of bilinear interpolation and - /// pyramidal parametric prefiltering (mipmaps). + /// pyramidal parametric pre-filtering (mipmaps). medium, /// Best possible quality filtering, albeit also the slowest. @@ -1651,7 +1651,7 @@ void decodeImageFromList(Uint8List list, ImageDecoderCallback callback) { /// [pixels] is the pixel data in the encoding described by [format]. /// /// [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 +/// data buffer. If unspecified, it defaults to [width] multiplied by the /// number of bytes per pixel in the provided [format]. /// /// The [decodedCacheRatioCap] is the default maximum multiple of the compressed @@ -1762,17 +1762,17 @@ class EngineLayer { /// A complex, one-dimensional subset of a plane. /// -/// A path consists of a number of subpaths, and a _current point_. +/// A path consists of a number of sub-paths, and a _current point_. /// -/// Subpaths consist of segments of various types, such as lines, -/// arcs, or beziers. Subpaths can be open or closed, and can +/// Sub-paths consist of segments of various types, such as lines, +/// arcs, or beziers. Sub-paths can be open or closed, and can /// self-intersect. /// -/// Closed subpaths enclose a (possibly discontiguous) region of the +/// Closed sub-paths enclose a (possibly discontiguous) region of the /// plane based on the current [fillType]. /// /// The _current point_ is initially at the origin. After each -/// operation adding a segment to a subpath, the current point is +/// operation adding a segment to a sub-path, the current point is /// updated to the end of that segment. /// /// Paths can be drawn on canvases using [Canvas.drawPath], and can @@ -1798,12 +1798,12 @@ class Path { } - /// Starts a new subpath at the given coordinate. + /// Starts a new sub-path at the given coordinate. void moveTo(double x, double y) { throw UnimplementedError(); } - /// Starts a new subpath at the given offset from the current point. + /// Starts a new sub-path at the given offset from the current point. void relativeMoveTo(double dx, double dy) { throw UnimplementedError(); } @@ -1872,7 +1872,7 @@ class Path { /// If the `forceMoveTo` argument is false, adds a straight line /// segment and an arc segment. /// - /// If the `forceMoveTo` argument is true, starts a new subpath + /// If the `forceMoveTo` argument is true, starts a new sub-path /// consisting of an arc segment. /// /// In either case, the arc segment consists of the arc that follows @@ -1936,14 +1936,14 @@ class Path { throw UnimplementedError(); } - /// Adds a new subpath that consists of four lines that outline the + /// Adds a new sub-path that consists of four lines that outline the /// given rectangle. void addRect(Rect rect) { assert(_rectIsValid(rect)); throw UnimplementedError(); } - /// Adds a new subpath that consists of a curve that forms the + /// Adds a new sub-path that consists of a curve that forms the /// ellipse that fills the given rectangle. /// /// To add a circle, pass an appropriate rectangle as `oval`. [Rect.fromCircle] @@ -1953,7 +1953,7 @@ class Path { throw UnimplementedError(); } - /// Adds a new subpath with one arc segment that consists of the arc + /// Adds a new sub-path with one arc segment that consists of the arc /// that follows the edge of the oval bounded by the given /// rectangle, from startAngle radians around the oval up to /// startAngle + sweepAngle radians around the oval, with zero @@ -1967,7 +1967,7 @@ class Path { } - /// Adds a new subpath with a sequence of line segments that connect the given + /// Adds a new sub-path with a sequence of line segments that connect the given /// points. /// /// If `close` is true, a final line segment will be added that connects the @@ -1979,7 +1979,7 @@ class Path { throw UnimplementedError(); } - /// Adds a new subpath that consists of the straight lines and + /// Adds a new sub-path that consists of the straight lines and /// curves needed to form the rounded rectangle described by the /// argument. void addRRect(RRect rrect) { @@ -1987,7 +1987,7 @@ class Path { throw UnimplementedError(); } - /// Adds a new subpath that consists of the given `path` offset by the given + /// Adds a new sub-path that consists of the given `path` offset by the given /// `offset`. /// /// If `matrix4` is specified, the path will be transformed by this matrix @@ -2011,13 +2011,13 @@ class Path { throw UnimplementedError(); } - /// Closes the last subpath, as if a straight line had been drawn - /// from the current point to the first point of the subpath. + /// Closes the last sub-path, as if a straight line had been drawn + /// from the current point to the first point of the sub-path. void close() { throw UnimplementedError(); } - /// Clears the [Path] object of all subpaths, returning it to the + /// Clears the [Path] object of all sub-paths, returning it to the /// same state it had when it was created. The _current point_ is /// reset to the origin. void reset() { @@ -2037,14 +2037,14 @@ class Path { } /// Returns a copy of the path with all the segments of every - /// subpath translated by the given offset. + /// sub-path translated by the given offset. Path shift(Offset offset) { assert(_offsetIsValid(offset)); throw UnimplementedError(); } /// Returns a copy of the path with all the segments of every - /// subpath transformed by the given matrix. + /// sub-path transformed by the given matrix. Path transform(Float64List matrix4) { assert(_matrix4IsValid(matrix4)); throw UnimplementedError(); @@ -2174,7 +2174,7 @@ class PathMetricIterator implements Iterator { } } -/// Utilities for measuring a [Path] and extracting subpaths. +/// Utilities for measuring a [Path] and extracting sub-paths. /// /// Iterate over the object returned by [Path.computeMetrics] to obtain /// [PathMetric] objects. @@ -2220,7 +2220,7 @@ class PathMetric { final _PathMeasure _measure; - /// Computes the position of hte current contour at the given offset, and the + /// Computes the position of the current contour at the given offset, and the /// angle of the path at that point. /// /// For example, calling this method with a distance of 1.41 for a line from @@ -2386,7 +2386,7 @@ class ColorFilter { _matrix = matrix, _type = _TypeMatrix; - /// Construct a color filter that applies the srgb gamma curve to the RGB + /// Construct a color filter that applies the sRGB gamma curve to the RGB /// channels. const ColorFilter.linearToSrgbGamma() : _color = null, @@ -2394,7 +2394,7 @@ class ColorFilter { _matrix = null, _type = _TypeLinearToSrgbGamma; - /// Creates a color filter that applies the inverse of the srgb gamma curve + /// Creates a color filter that applies the inverse of the sRGB gamma curve /// to the RGB channels. const ColorFilter.srgbToLinearGamma() : _color = null, @@ -2811,8 +2811,8 @@ class Canvas { /// ## Using saveLayer with clips /// /// When a rectangular clip operation (from [clipRect]) is not axis-aligned - /// with the raster buffer, or when the clip operation is not rectalinear (e.g. - /// because it is a rounded rectangle clip created by [clipRRect] or an + /// with the raster buffer, or when the clip operation is not rectilinear + /// (e.g. because it is a rounded rectangle clip created by [clipRRect] or an /// arbitrarily complicated path clip created by [clipPath]), the edge of the /// clip needs to be anti-aliased. /// @@ -3103,7 +3103,7 @@ class Canvas { /// Draws the given [Path] with the given [Paint]. Whether this shape is /// filled or stroked (or both) is controlled by [Paint.style]. If the path is - /// filled, then subpaths within it are implicitly closed (see [Path.close]). + /// filled, then sub-paths within it are implicitly closed (see [Path.close]). void drawPath(Path path, Paint paint) { assert(path != null); // path is checked on the engine side assert(paint != null); @@ -3368,7 +3368,7 @@ class 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. + /// and not be visible. /// /// Transparency should be adjusted through the [color] alpha. /// @@ -3421,9 +3421,10 @@ class Shadow { /// 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. + /// 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 overridden in subclasses to + /// provide this functionality. Paint toPaint() { throw UnimplementedError(); } diff --git a/lib/stub_ui/semantics.dart b/lib/stub_ui/semantics.dart index 6f052f3851a21..bc15a4cc285ac 100644 --- a/lib/stub_ui/semantics.dart +++ b/lib/stub_ui/semantics.dart @@ -161,7 +161,7 @@ class SemanticsAction { /// A [Snackbar], for example, may have a dismiss action to indicate to the /// user that it can be removed after it is no longer relevant. On Android, /// (with TalkBack) special hint text is spoken when focusing the node and - /// a custom action is availible in the local context menu. On iOS, + /// a custom action is available in the local context menu. On iOS, /// (with VoiceOver) users can perform a standard gesture to dismiss it. static const SemanticsAction dismiss = const SemanticsAction._(_kDismissIndex); @@ -642,7 +642,7 @@ class SemanticsUpdateBuilder { /// Update the custom semantics action associated with the given `id`. /// - /// The name of the action exposed to the user is the `label`. For overriden + /// The name of the action exposed to the user is the `label`. For overridden /// standard actions this value is ignored. /// /// The `hint` should describe what happens when an action occurs, not the @@ -652,9 +652,9 @@ class SemanticsUpdateBuilder { /// The text direction of the `hint` and `label` is the same as the global /// window. /// - /// For overriden standard actions, `overrideId` corresponds with a - /// [SemanticsAction.index] value. For custom actions this argument should not be - /// provided. + /// For overridden standard actions, `overrideId` corresponds with a + /// [SemanticsAction.index] value. For custom actions this argument should not + /// be provided. void updateCustomAction({int id, String label, String hint, int overrideId = -1}) { assert(id != null); assert(overrideId != null); diff --git a/lib/stub_ui/text.dart b/lib/stub_ui/text.dart index 6b0fd57a16ad6..bc152addb837a 100644 --- a/lib/stub_ui/text.dart +++ b/lib/stub_ui/text.dart @@ -358,7 +358,7 @@ class TextStyle { /// * `fontWeight`: The typeface thickness to use when painting the text (e.g., bold). /// * `fontStyle`: The typeface variant to use when drawing the letters (e.g., italics). /// * `fontFamily`: The name of the font to use when painting the text (e.g., Roboto). If a `fontFamilyFallback` is - /// provided and `fontFamily` is not, then the first font family in `fontFamilyFallback` will take the postion of + /// provided and `fontFamily` is not, then the first font family in `fontFamilyFallback` will take the position of /// the preferred font family. When a higher priority font cannot be found or does not contain a glyph, a lower /// priority font will be used. /// * `fontFamilyFallback`: An ordered list of the names of the fonts to fallback on when a glyph cannot @@ -1163,7 +1163,7 @@ class TextPosition { /// The only constraint that can be specified is the [width]. See the discussion /// at [width] for more details. class ParagraphConstraints { - /// Creates constraints for laying out a pargraph. + /// Creates constraints for laying out a paragraph. /// /// The [width] argument must not be null. const ParagraphConstraints({ @@ -1372,7 +1372,7 @@ class Paragraph { /// Builds a [Paragraph] containing text with the given styling information. /// -/// To set the paragraph's alignment, truncation, and ellipsising behavior, pass +/// To set the paragraph's alignment, truncation, and ellipsizing behavior, pass /// an appropriately-configured [ParagraphStyle] object to the [new /// ParagraphBuilder] constructor. /// diff --git a/lib/ui/compositing.dart b/lib/ui/compositing.dart index 2647729163430..e7675c0a26e74 100644 --- a/lib/ui/compositing.dart +++ b/lib/ui/compositing.dart @@ -264,7 +264,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 { /// Android view: When resizing an Android view there is a short period during /// which the framework cannot tell if the newest texture frame has the /// previous or new size, to workaround this the framework "freezes" the - /// texture just before resizing the Android view and unfreezes it when it is + /// texture just before resizing the Android view and un-freezes it when it is /// certain that a frame with the new size is ready. void addTexture(int textureId, { Offset offset: Offset.zero, double width: 0.0, double height: 0.0 , bool freeze: false}) { assert(offset != null, 'Offset argument was null'); diff --git a/lib/ui/natives.dart b/lib/ui/natives.dart index 1e9a0798f96f6..27913bdd9a519 100644 --- a/lib/ui/natives.dart +++ b/lib/ui/natives.dart @@ -40,11 +40,14 @@ void _setupHooks() { // ignore: unused_element /// Returns runtime Dart compilation trace as a UTF-8 encoded memory buffer. /// -/// The buffer contains a list of symbols compiled by the Dart JIT at runtime up to the point -/// when this function was called. This list can be saved to a text file and passed to tools -/// such as `flutter build` or Dart `gen_snapshot` in order to precompile this code offline. +/// The buffer contains a list of symbols compiled by the Dart JIT at runtime up +/// to the point when this function was called. This list can be saved to a text +/// file and passed to tools such as `flutter build` or Dart `gen_snapshot` in +/// order to pre-compile this code offline. +/// +/// The list has one symbol per line of the following format: +/// `,,\n`. /// -/// The list has one symbol per line of the following format: `,,\n`. /// Here are some examples: /// /// ``` diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index 53fb922288a86..a83cf9265d012 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -59,7 +59,7 @@ Color _scaleAlpha(Color a, double factor) { /// /// Consider the light teal of the Flutter logo. It is fully opaque, with a red /// channel value of 0x42 (66), a green channel value of 0xA5 (165), and a blue -/// channel value of 0xF5 (245). In the common "hash syntax" for colour values, +/// channel value of 0xF5 (245). In the common "hash syntax" for color values, /// it would be described as `#42A5F5`. /// /// Here are some ways it could be constructed: @@ -803,7 +803,7 @@ enum FilterQuality { /// Fastest possible filtering, albeit also the lowest quality. /// - /// Typically this implies nearest-neighbour filtering. + /// Typically this implies nearest-neighbor filtering. none, /// Better quality than [none], faster than [medium]. @@ -814,7 +814,7 @@ enum FilterQuality { /// Better quality than [low], faster than [high]. /// /// Typically this implies a combination of bilinear interpolation and - /// pyramidal parametric prefiltering (mipmaps). + /// pyramidal parametric pre-filtering (mipmaps). medium, /// Best possible quality filtering, albeit also the slowest. @@ -1681,7 +1681,7 @@ Future _decodeImageFromListAsync(Uint8List list, /// [pixels] is the pixel data in the encoding described by [format]. /// /// [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 +/// data buffer. If unspecified, it defaults to [width] multiplied by the /// number of bytes per pixel in the provided [format]. /// /// The [decodedCacheRatioCap] is the default maximum multiple of the compressed @@ -1799,17 +1799,17 @@ class EngineLayer extends NativeFieldWrapperClass2 { /// A complex, one-dimensional subset of a plane. /// -/// A path consists of a number of subpaths, and a _current point_. +/// A path consists of a number of sub-paths, and a _current point_. /// -/// Subpaths consist of segments of various types, such as lines, -/// arcs, or beziers. Subpaths can be open or closed, and can +/// Sub-paths consist of segments of various types, such as lines, +/// arcs, or beziers. Sub-paths can be open or closed, and can /// self-intersect. /// -/// Closed subpaths enclose a (possibly discontiguous) region of the +/// Closed sub-paths enclose a (possibly discontiguous) region of the /// plane based on the current [fillType]. /// /// The _current point_ is initially at the origin. After each -/// operation adding a segment to a subpath, the current point is +/// operation adding a segment to a sub-path, the current point is /// updated to the end of that segment. /// /// Paths can be drawn on canvases using [Canvas.drawPath], and can @@ -1839,10 +1839,10 @@ class Path extends NativeFieldWrapperClass2 { int _getFillType() native 'Path_getFillType'; void _setFillType(int fillType) native 'Path_setFillType'; - /// Starts a new subpath at the given coordinate. + /// Starts a new sub-path at the given coordinate. void moveTo(double x, double y) native 'Path_moveTo'; - /// Starts a new subpath at the given offset from the current point. + /// Starts a new sub-path at the given offset from the current point. void relativeMoveTo(double dx, double dy) native 'Path_relativeMoveTo'; /// Adds a straight line segment from the current point to the given @@ -1893,7 +1893,7 @@ class Path extends NativeFieldWrapperClass2 { /// If the `forceMoveTo` argument is false, adds a straight line /// segment and an arc segment. /// - /// If the `forceMoveTo` argument is true, starts a new subpath + /// If the `forceMoveTo` argument is true, starts a new sub-path /// consisting of an arc segment. /// /// In either case, the arc segment consists of the arc that follows @@ -1971,7 +1971,7 @@ class Path extends NativeFieldWrapperClass2 { bool largeArc, bool clockwise) native 'Path_relativeArcToPoint'; - /// Adds a new subpath that consists of four lines that outline the + /// Adds a new sub-path that consists of four lines that outline the /// given rectangle. void addRect(Rect rect) { assert(_rectIsValid(rect)); @@ -1979,7 +1979,7 @@ class Path extends NativeFieldWrapperClass2 { } void _addRect(double left, double top, double right, double bottom) native 'Path_addRect'; - /// Adds a new subpath that consists of a curve that forms the + /// Adds a new sub-path that consists of a curve that forms the /// ellipse that fills the given rectangle. /// /// To add a circle, pass an appropriate rectangle as `oval`. [Rect.fromCircle] @@ -1990,7 +1990,7 @@ class Path extends NativeFieldWrapperClass2 { } void _addOval(double left, double top, double right, double bottom) native 'Path_addOval'; - /// Adds a new subpath with one arc segment that consists of the arc + /// Adds a new sub-path with one arc segment that consists of the arc /// that follows the edge of the oval bounded by the given /// rectangle, from startAngle radians around the oval up to /// startAngle + sweepAngle radians around the oval, with zero @@ -2005,7 +2005,7 @@ class Path extends NativeFieldWrapperClass2 { void _addArc(double left, double top, double right, double bottom, double startAngle, double sweepAngle) native 'Path_addArc'; - /// Adds a new subpath with a sequence of line segments that connect the given + /// Adds a new sub-path with a sequence of line segments that connect the given /// points. /// /// If `close` is true, a final line segment will be added that connects the @@ -2018,7 +2018,7 @@ class Path extends NativeFieldWrapperClass2 { } void _addPolygon(Float32List points, bool close) native 'Path_addPolygon'; - /// Adds a new subpath that consists of the straight lines and + /// Adds a new sub-path that consists of the straight lines and /// curves needed to form the rounded rectangle described by the /// argument. void addRRect(RRect rrect) { @@ -2027,7 +2027,7 @@ class Path extends NativeFieldWrapperClass2 { } void _addRRect(Float32List rrect) native 'Path_addRRect'; - /// Adds a new subpath that consists of the given `path` offset by the given + /// Adds a new sub-path that consists of the given `path` offset by the given /// `offset`. /// /// If `matrix4` is specified, the path will be transformed by this matrix @@ -2065,11 +2065,11 @@ class Path extends NativeFieldWrapperClass2 { void _extendWithPath(Path path, double dx, double dy) native 'Path_extendWithPath'; void _extendWithPathAndMatrix(Path path, double dx, double dy, Float64List matrix) native 'Path_extendWithPathAndMatrix'; - /// Closes the last subpath, as if a straight line had been drawn - /// from the current point to the first point of the subpath. + /// Closes the last sub-path, as if a straight line had been drawn + /// from the current point to the first point of the sub-path. void close() native 'Path_close'; - /// Clears the [Path] object of all subpaths, returning it to the + /// Clears the [Path] object of all sub-paths, returning it to the /// same state it had when it was created. The _current point_ is /// reset to the origin. void reset() native 'Path_reset'; @@ -2088,7 +2088,7 @@ class Path extends NativeFieldWrapperClass2 { bool _contains(double x, double y) native 'Path_contains'; /// Returns a copy of the path with all the segments of every - /// subpath translated by the given offset. + /// sub-path translated by the given offset. Path shift(Offset offset) { assert(_offsetIsValid(offset)); return _shift(offset.dx, offset.dy); @@ -2096,7 +2096,7 @@ class Path extends NativeFieldWrapperClass2 { Path _shift(double dx, double dy) native 'Path_shift'; /// Returns a copy of the path with all the segments of every - /// subpath transformed by the given matrix. + /// sub-path transformed by the given matrix. Path transform(Float64List matrix4) { assert(_matrix4IsValid(matrix4)); return _transform(matrix4); @@ -2243,14 +2243,14 @@ class PathMetricIterator implements Iterator { } } -/// Utilities for measuring a [Path] and extracting subpaths. +/// Utilities for measuring a [Path] and extracting sub-paths. /// /// Iterate over the object returned by [Path.computeMetrics] to obtain /// [PathMetric] objects. /// /// Once created, the methods on this class will only be valid while the /// iterator is at the contour for which they were created. It will also only be -/// valid for the path as it was specifed when [Path.computeMetrics] was called. +/// valid for the path as it was specified when [Path.computeMetrics] was called. /// If additional contours are added or any contours are updated, the metrics /// need to be recomputed. class PathMetric { @@ -2288,7 +2288,7 @@ class PathMetric { final _PathMeasure _measure; - /// Computes the position of hte current contour at the given offset, and the + /// Computes the position of the current contour at the given offset, and the /// angle of the path at that point. /// /// For example, calling this method with a distance of 1.41 for a line from @@ -2483,7 +2483,7 @@ class ColorFilter { _matrix = matrix, _type = _TypeMatrix; - /// Construct a color filter that applies the srgb gamma curve to the RGB + /// Construct a color filter that applies the sRGB gamma curve to the RGB /// channels. const ColorFilter.linearToSrgbGamma() : _color = null, @@ -2491,7 +2491,7 @@ class ColorFilter { _matrix = null, _type = _TypeLinearToSrgbGamma; - /// Creates a color filter that applies the inverse of the srgb gamma curve + /// Creates a color filter that applies the inverse of the sRGB gamma curve /// to the RGB channels. const ColorFilter.srgbToLinearGamma() : _color = null, @@ -3055,8 +3055,8 @@ class Canvas extends NativeFieldWrapperClass2 { /// ## Using saveLayer with clips /// /// When a rectangular clip operation (from [clipRect]) is not axis-aligned - /// with the raster buffer, or when the clip operation is not rectalinear (e.g. - /// because it is a rounded rectangle clip created by [clipRRect] or an + /// with the raster buffer, or when the clip operation is not rectilinear + /// (e.g. because it is a rounded rectangle clip created by [clipRRect] or an /// arbitrarily complicated path clip created by [clipPath]), the edge of the /// clip needs to be anti-aliased. /// @@ -3408,7 +3408,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// Draws the given [Path] with the given [Paint]. Whether this shape is /// filled or stroked (or both) is controlled by [Paint.style]. If the path is - /// filled, then subpaths within it are implicitly closed (see [Path.close]). + /// filled, then sub-paths within it are implicitly closed (see [Path.close]). void drawPath(Path path, Paint paint) { assert(path != null); // path is checked on the engine side assert(paint != null); @@ -3803,7 +3803,7 @@ class 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. + /// and not be visible. /// /// Transparency should be adjusted through the [color] alpha. /// @@ -3862,9 +3862,10 @@ class Shadow { /// 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. + /// 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 overridden in subclasses to + /// provide this functionality. Paint toPaint() { return Paint() ..color = color diff --git a/lib/ui/semantics.dart b/lib/ui/semantics.dart index 5d54eabf67957..1e3650910d543 100644 --- a/lib/ui/semantics.dart +++ b/lib/ui/semantics.dart @@ -164,7 +164,7 @@ class SemanticsAction { /// A [Snackbar], for example, may have a dismiss action to indicate to the /// user that it can be removed after it is no longer relevant. On Android, /// (with TalkBack) special hint text is spoken when focusing the node and - /// a custom action is availible in the local context menu. On iOS, + /// a custom action is available in the local context menu. On iOS, /// (with VoiceOver) users can perform a standard gesture to dismiss it. static const SemanticsAction dismiss = const SemanticsAction._(_kDismissIndex); @@ -708,7 +708,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { /// Update the custom semantics action associated with the given `id`. /// - /// The name of the action exposed to the user is the `label`. For overriden + /// The name of the action exposed to the user is the `label`. For overridden /// standard actions this value is ignored. /// /// The `hint` should describe what happens when an action occurs, not the @@ -718,7 +718,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { /// The text direction of the `hint` and `label` is the same as the global /// window. /// - /// For overriden standard actions, `overrideId` corresponds with a + /// For overridden standard actions, `overrideId` corresponds with a /// [SemanticsAction.index] value. For custom actions this argument should not be /// provided. void updateCustomAction({int id, String label, String hint, int overrideId = -1}) { diff --git a/lib/ui/text.dart b/lib/ui/text.dart index 61d4d6afe9c12..1eff826ad2c6c 100644 --- a/lib/ui/text.dart +++ b/lib/ui/text.dart @@ -358,7 +358,7 @@ class TextStyle { /// * `fontWeight`: The typeface thickness to use when painting the text (e.g., bold). /// * `fontStyle`: The typeface variant to use when drawing the letters (e.g., italics). /// * `fontFamily`: The name of the font to use when painting the text (e.g., Roboto). If a `fontFamilyFallback` is - /// provided and `fontFamily` is not, then the first font family in `fontFamilyFallback` will take the postion of + /// provided and `fontFamily` is not, then the first font family in `fontFamilyFallback` will take the position of /// the preferred font family. When a higher priority font cannot be found or does not contain a glyph, a lower /// priority font will be used. /// * `fontFamilyFallback`: An ordered list of the names of the fonts to fallback on when a glyph cannot @@ -1165,7 +1165,7 @@ class TextPosition { /// The only constraint that can be specified is the [width]. See the discussion /// at [width] for more details. class ParagraphConstraints { - /// Creates constraints for laying out a pargraph. + /// Creates constraints for laying out a paragraph. /// /// The [width] argument must not be null. const ParagraphConstraints({ @@ -1370,7 +1370,7 @@ class Paragraph extends NativeFieldWrapperClass2 { /// Builds a [Paragraph] containing text with the given styling information. /// -/// To set the paragraph's alignment, truncation, and ellipsising behavior, pass +/// To set the paragraph's alignment, truncation, and ellipsizing behavior, pass /// an appropriately-configured [ParagraphStyle] object to the [new /// ParagraphBuilder] constructor. /// From 56c16154eadada5f77c57ddca39a86c5e30c5768 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 28 Feb 2019 14:44:28 -0800 Subject: [PATCH 0315/1117] Android Embedding PR 9: Introduce an AndroidTouchProcessor to convert MotionEvents to Flutter touch data. (#7947) --- ci/licenses_golden/licenses_flutter | 1 + shell/platform/android/BUILD.gn | 1 + .../engine/android/AndroidTouchProcessor.java | 186 ++++++++++++++++++ 3 files changed, 188 insertions(+) create mode 100644 shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index f03f4dff62755..f04bcef39103b 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -473,6 +473,7 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/Flutte 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/android/AndroidKeyProcessor.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterActivity.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index cb0d8f7225dad..9ff065b3ab830 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -113,6 +113,7 @@ java_library("flutter_shell_java") { "io/flutter/embedding/engine/FlutterJNI.java", "io/flutter/embedding/engine/FlutterShellArgs.java", "io/flutter/embedding/engine/android/AndroidKeyProcessor.java", + "io/flutter/embedding/engine/android/AndroidTouchProcessor.java", "io/flutter/embedding/engine/android/FlutterActivity.java", "io/flutter/embedding/engine/android/FlutterFragment.java", "io/flutter/embedding/engine/android/FlutterSurfaceView.java", diff --git a/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java b/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java new file mode 100644 index 0000000000000..9bf0848d68661 --- /dev/null +++ b/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java @@ -0,0 +1,186 @@ +package io.flutter.embedding.engine.android; + +import android.support.annotation.NonNull; +import android.view.MotionEvent; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; + +import io.flutter.embedding.engine.renderer.FlutterRenderer; + +/** + * Sends touch information from Android to Flutter in a format that Flutter + * understands. + */ +public class AndroidTouchProcessor { + + // Must match the PointerChange enum in pointer.dart. + // TODO(mattcarroll): convert these to an IntDef + private static final int POINTER_CHANGE_CANCEL = 0; + private static final int POINTER_CHANGE_ADD = 1; + private static final int POINTER_CHANGE_REMOVE = 2; + private static final int POINTER_CHANGE_HOVER = 3; + private static final int POINTER_CHANGE_DOWN = 4; + private static final int POINTER_CHANGE_MOVE = 5; + private static final int POINTER_CHANGE_UP = 6; + + // Must match the PointerDeviceKind enum in pointer.dart. + // TODO(mattcarroll): convert these to an IntDef + private static final int POINTER_DEVICE_KIND_TOUCH = 0; + private static final int POINTER_DEVICE_KIND_MOUSE = 1; + private static final int POINTER_DEVICE_KIND_STYLUS = 2; + private static final int POINTER_DEVICE_KIND_INVERTED_STYLUS = 3; + private static final int POINTER_DEVICE_KIND_UNKNOWN = 4; + + // Must match the unpacking code in hooks.dart. + private static final int POINTER_DATA_FIELD_COUNT = 19; + private static final int BYTE_PER_FIELD = 8; + + @NonNull + private final FlutterRenderer renderer; + + /** + * Constructs an {@code AndroidTouchProcessor} that will send touch event data + * to the Flutter execution context represented by the given {@link FlutterRenderer}. + */ + // TODO(mattcarroll): consider moving packet behavior to a FlutterInteractionSurface instead of FlutterRenderer + public AndroidTouchProcessor(@NonNull FlutterRenderer renderer) { + this.renderer = renderer; + } + + /** + * Sends the given {@link MotionEvent} data to Flutter in a format that + * Flutter understands. + */ + public boolean onTouchEvent(MotionEvent event) { + int pointerCount = event.getPointerCount(); + + // Prepare a data packet of the appropriate size and order. + ByteBuffer packet = ByteBuffer.allocateDirect( + pointerCount * POINTER_DATA_FIELD_COUNT * BYTE_PER_FIELD + ); + 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); + } 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); + } + } + + // Verify that the packet is the expected size. + assert packet.position() % (POINTER_DATA_FIELD_COUNT * BYTE_PER_FIELD) == 0; + + // Send the packet to Flutter. + renderer.dispatchPointerDataPacket(packet, packet.position()); + + return true; + } + + // TODO(mattcarroll): consider creating a PointerPacket class instead of using a procedure that mutates inputs. + private void addPointerForIndex(MotionEvent event, int pointerIndex, ByteBuffer packet) { + int pointerChange = getPointerChangeForAction(event.getActionMasked()); + if (pointerChange == -1) { + return; + } + + int pointerKind = getPointerDeviceTypeForToolType(event.getToolType(pointerIndex)); + + long timeStamp = event.getEventTime() * 1000; // Convert from milliseconds to microseconds. + + packet.putLong(timeStamp); // time_stamp + packet.putLong(pointerChange); // change + packet.putLong(pointerKind); // kind + packet.putLong(event.getPointerId(pointerIndex)); // device + packet.putDouble(event.getX(pointerIndex)); // physical_x + packet.putDouble(event.getY(pointerIndex)); // physical_y + + if (pointerKind == POINTER_DEVICE_KIND_MOUSE) { + packet.putLong(event.getButtonState() & 0x1F); // buttons + } else if (pointerKind == POINTER_DEVICE_KIND_STYLUS) { + packet.putLong((event.getButtonState() >> 4) & 0xF); // buttons + } else { + packet.putLong(0); // buttons + } + + packet.putLong(0); // obscured + + // TODO(eseidel): Could get the calibrated range if necessary: + // event.getDevice().getMotionRange(MotionEvent.AXIS_PRESSURE) + packet.putDouble(event.getPressure(pointerIndex)); // pressure + packet.putDouble(0.0); // pressure_min + packet.putDouble(1.0); // pressure_max + + if (pointerKind == POINTER_DEVICE_KIND_STYLUS) { + packet.putDouble(event.getAxisValue(MotionEvent.AXIS_DISTANCE, pointerIndex)); // distance + packet.putDouble(0.0); // distance_max + } else { + packet.putDouble(0.0); // distance + packet.putDouble(0.0); // distance_max + } + + packet.putDouble(event.getToolMajor(pointerIndex)); // radius_major + packet.putDouble(event.getToolMinor(pointerIndex)); // radius_minor + + packet.putDouble(0.0); // radius_min + packet.putDouble(0.0); // radius_max + + packet.putDouble(event.getAxisValue(MotionEvent.AXIS_ORIENTATION, pointerIndex)); // orientation + + if (pointerKind == POINTER_DEVICE_KIND_STYLUS) { + packet.putDouble(event.getAxisValue(MotionEvent.AXIS_TILT, pointerIndex)); // tilt + } else { + packet.putDouble(0.0); // tilt + } + } + + private int getPointerChangeForAction(int maskedAction) { + // Primary pointer: + if (maskedAction == MotionEvent.ACTION_DOWN) { + return POINTER_CHANGE_DOWN; + } + if (maskedAction == MotionEvent.ACTION_UP) { + return POINTER_CHANGE_UP; + } + // Secondary pointer: + if (maskedAction == MotionEvent.ACTION_POINTER_DOWN) { + return POINTER_CHANGE_DOWN; + } + if (maskedAction == MotionEvent.ACTION_POINTER_UP) { + return POINTER_CHANGE_UP; + } + // All pointers: + if (maskedAction == MotionEvent.ACTION_MOVE) { + return POINTER_CHANGE_MOVE; + } + if (maskedAction == MotionEvent.ACTION_CANCEL) { + return POINTER_CHANGE_CANCEL; + } + return -1; + } + + // TODO(mattcarroll): introduce IntDef for toolType. + private int getPointerDeviceTypeForToolType(int toolType) { + switch (toolType) { + case MotionEvent.TOOL_TYPE_FINGER: + return POINTER_DEVICE_KIND_TOUCH; + case MotionEvent.TOOL_TYPE_STYLUS: + return POINTER_DEVICE_KIND_STYLUS; + case MotionEvent.TOOL_TYPE_MOUSE: + return POINTER_DEVICE_KIND_MOUSE; + case MotionEvent.TOOL_TYPE_ERASER: + return POINTER_DEVICE_KIND_INVERTED_STYLUS; + default: + // MotionEvent.TOOL_TYPE_UNKNOWN will reach here. + return POINTER_DEVICE_KIND_UNKNOWN; + } + } +} From 6145e9046a7b2c4e9e683a124001a20995daf651 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 28 Feb 2019 15:02:56 -0800 Subject: [PATCH 0316/1117] Android Embedding PR 13: Integrated text input, keyevent input, and some other channel comms in FlutterView. (#7979) --- .../embedding/engine/android/FlutterView.java | 259 ++++++++++++++++++ .../editing/InputConnectionAdaptor.java | 6 +- .../plugin/editing/TextInputPlugin.java | 13 +- 3 files changed, 269 insertions(+), 9 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java index 4e4886a871331..fad69bac0ed97 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java @@ -5,14 +5,31 @@ package io.flutter.embedding.engine.android; import android.content.Context; +import android.content.res.Configuration; +import android.graphics.Rect; +import android.os.Build; +import android.os.LocaleList; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.text.format.DateFormat; import android.util.AttributeSet; import android.util.Log; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.WindowInsets; +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputConnection; +import android.view.inputmethod.InputMethod; +import android.view.inputmethod.InputMethodManager; import android.widget.FrameLayout; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.renderer.FlutterRenderer; +import io.flutter.plugin.editing.TextInputPlugin; /** * Displays a Flutter UI on an Android device. @@ -50,6 +67,16 @@ public class FlutterView extends FrameLayout { @Nullable private FlutterEngine flutterEngine; + // Components that process various types of Android View input and events, + // possibly storing intermediate state, and communicating those events to Flutter. + // + // These components essentially add some additional behavioral logic on top of + // existing, stateless system channels, e.g., KeyEventChannel, TextInputChannel, etc. + @Nullable + private TextInputPlugin textInputPlugin; + @Nullable + private AndroidKeyProcessor androidKeyProcessor; + /** * Constructs a {@code FlutterSurfaceView} programmatically, without any XML attributes. * @@ -103,6 +130,176 @@ private void init() { } } + //------- Start: Process View configuration that Flutter cares about. ------ + /** + * Sends relevant configuration data from Android to Flutter when the Android + * {@link Configuration} changes. + * + * The Android {@link Configuration} might change as a result of device orientation + * change, device language change, device text scale factor change, etc. + */ + @Override + protected void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + sendLocalesToFlutter(newConfig); + sendUserSettingsToFlutter(); + } + + /** + * Invoked when this {@code FlutterView} changes size, including upon initial + * measure. + * + * The initial measure reports an {@code oldWidth} and {@code oldHeight} of zero. + * + * Flutter cares about the width and height of the view that displays it on the host + * platform. Therefore, when this method is invoked, the new width and height are + * communicated to Flutter as the "physical size" of the view that displays Flutter's + * UI. + */ + @Override + protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) { + // TODO(mattcarroll): hookup to viewport metrics. + super.onSizeChanged(width, height, oldWidth, oldHeight); + } + + /** + * Invoked when Android's desired window insets change, i.e., padding. + * + * Flutter does not use a standard {@code View} hierarchy and therefore Flutter is + * unaware of these insets. Therefore, this method calculates the viewport metrics + * that Flutter should use and then sends those metrics to Flutter. + * + * This callback is not present in API < 20, which means lower API devices will see + * the wider than expected padding when the status and navigation bars are hidden. + */ + @Override + public final WindowInsets onApplyWindowInsets(WindowInsets insets) { + // TODO(mattcarroll): hookup to Flutter metrics. + return insets; + } + + /** + * Invoked when Android's desired window insets change, i.e., padding. + * + * {@code fitSystemWindows} is an earlier version of + * {@link #onApplyWindowInsets(WindowInsets)}. See that method for more details + * about how window insets relate to Flutter. + */ + @Override + @SuppressWarnings("deprecation") + protected boolean fitSystemWindows(Rect insets) { + // TODO(mattcarroll): hookup to Flutter metrics. + return super.fitSystemWindows(insets); + } + //------- End: Process View configuration that Flutter cares about. -------- + + //-------- Start: Process UI I/O that Flutter cares about. ------- + /** + * Creates an {@link InputConnection} to work with a {@link android.view.inputmethod.InputMethodManager}. + * + * Any {@code View} that can take focus or process text input must implement this + * method by returning a non-null {@code InputConnection}. Flutter may render one or + * many focusable and text-input widgets, therefore {@code FlutterView} must support + * an {@code InputConnection}. + * + * The {@code InputConnection} returned from this method comes from a + * {@link TextInputPlugin}, which is owned by this {@code FlutterView}. A + * {@link TextInputPlugin} exists to encapsulate the nuances of input communication, + * rather than spread that logic throughout this {@code FlutterView}. + */ + @Override + public InputConnection onCreateInputConnection(EditorInfo outAttrs) { + if (!isAttachedToFlutterEngine()) { + return super.onCreateInputConnection(outAttrs); + } + + return textInputPlugin.createInputConnection(this, outAttrs); + } + + /** + * Invoked when key is released. + * + * This method is typically invoked in response to the release of a physical + * keyboard key or a D-pad button. It is generally not invoked when a virtual + * software keyboard is used, though a software keyboard may choose to invoke + * this method in some situations. + * + * {@link KeyEvent}s are sent from Android to Flutter. {@link AndroidKeyProcessor} + * may do some additional work with the given {@link KeyEvent}, e.g., combine this + * {@code keyCode} with the previous {@code keyCode} to generate a unicode combined + * character. + */ + @Override + public boolean onKeyUp(int keyCode, KeyEvent event) { + if (!isAttachedToFlutterEngine()) { + return super.onKeyUp(keyCode, event); + } + + androidKeyProcessor.onKeyUp(event); + return super.onKeyUp(keyCode, event); + } + + /** + * Invoked when key is pressed. + * + * This method is typically invoked in response to the press of a physical + * keyboard key or a D-pad button. It is generally not invoked when a virtual + * software keyboard is used, though a software keyboard may choose to invoke + * this method in some situations. + * + * {@link KeyEvent}s are sent from Android to Flutter. {@link AndroidKeyProcessor} + * may do some additional work with the given {@link KeyEvent}, e.g., combine this + * {@code keyCode} with the previous {@code keyCode} to generate a unicode combined + * character. + */ + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + if (!isAttachedToFlutterEngine()) { + return super.onKeyDown(keyCode, event); + } + + androidKeyProcessor.onKeyDown(event); + return super.onKeyDown(keyCode, event); + } + + /** + * Invoked by Android when a user touch event occurs. + * + * Flutter handles all of its own gesture detection and processing, therefore this + * method forwards all {@link MotionEvent} data from Android to Flutter. + */ + @Override + public boolean onTouchEvent(MotionEvent event) { + if (!isAttachedToFlutterEngine()) { + return false; + } + + // TODO(mattcarroll): forward event to touch processore when it's merged in. + return false; + } + + /** + * Invoked by Android when a hover-compliant input system causes a hover event. + * + * An example of hover events is a stylus sitting near an Android screen. As the + * stylus moves from outside a {@code View} to hover over a {@code View}, or move + * around within a {@code View}, or moves from over a {@code View} to outside a + * {@code View}, a corresponding {@link MotionEvent} is reported via this method. + * + * Hover events can be used for accessibility touch exploration and therefore are + * processed here for accessibility purposes. + */ + @Override + public boolean onHoverEvent(MotionEvent event) { + if (!isAttachedToFlutterEngine()) { + return false; + } + + // TODO(mattcarroll): hook up to accessibility. + return false; + } + //-------- End: Process UI I/O that Flutter cares about. --------- + /** * Connects this {@code FlutterView} to the given {@link FlutterEngine}. * @@ -129,6 +326,26 @@ public void attachToFlutterEngine(@NonNull FlutterEngine flutterEngine) { // Instruct our FlutterRenderer that we are now its designated RenderSurface. this.flutterEngine.getRenderer().attachToRenderSurface(renderSurface); + + // Initialize various components that know how to process Android View I/O + // in a way that Flutter understands. + textInputPlugin = new TextInputPlugin( + this, + this.flutterEngine.getDartExecutor() + ); + androidKeyProcessor = new AndroidKeyProcessor( + this.flutterEngine.getKeyEventChannel(), + textInputPlugin + ); + + // Inform the Android framework that it should retrieve a new InputConnection + // now that an engine is attached. + // TODO(mattcarroll): once this is proven to work, move this line ot TextInputPlugin + textInputPlugin.getInputMethodManager().restartInput(this); + + // Push View and Context related information from Android to Flutter. + sendUserSettingsToFlutter(); + sendLocalesToFlutter(getResources().getConfiguration()); } /** @@ -147,6 +364,12 @@ public void detachFromFlutterEngine() { } Log.d(TAG, "Detaching from Flutter Engine"); + // Inform the Android framework that it should retrieve a new InputConnection + // now that the engine is detached. The new InputConnection will be null, which + // signifies that this View does not process input (until a new engine is attached). + // TODO(mattcarroll): once this is proven to work, move this line ot TextInputPlugin + textInputPlugin.getInputMethodManager().restartInput(this); + // Instruct our FlutterRenderer that we are no longer interested in being its RenderSurface. flutterEngine.getRenderer().detachFromRenderSurface(); flutterEngine = null; @@ -163,6 +386,42 @@ private boolean isAttachedToFlutterEngine() { return flutterEngine != null; } + /** + * Send the current {@link Locale} configuration to Flutter. + * + * FlutterEngine must be non-null when this method is invoked. + */ + @SuppressWarnings("deprecation") + private void sendLocalesToFlutter(Configuration config) { + List locales = new ArrayList<>(); + if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { + LocaleList localeList = config.getLocales(); + int localeCount = localeList.size(); + for (int index = 0; index < localeCount; ++index) { + Locale locale = localeList.get(index); + locales.add(locale); + } + } else { + locales.add(config.locale); + } + flutterEngine.getLocalizationChannel().sendLocales(locales); + } + + /** + * Send various user preferences of this Android device to Flutter. + * + * For example, sends the user's "text scale factor" preferences, as well as the user's clock + * format preference. + * + * FlutterEngine must be non-null when this method is invoked. + */ + private void sendUserSettingsToFlutter() { + flutterEngine.getSettingsChannel().startMessage() + .setTextScaleFactor(getResources().getConfiguration().fontScale) + .setUse24HourFormat(DateFormat.is24HourFormat(getContext())) + .send(); + } + /** * Render modes for a {@link FlutterView}. */ diff --git a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java index b3a287820bfe9..c613e82ff3a01 100644 --- a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java +++ b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java @@ -8,6 +8,7 @@ import android.text.Editable; import android.text.Selection; import android.view.KeyEvent; +import android.view.View; import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; @@ -15,10 +16,9 @@ import io.flutter.embedding.engine.systemchannels.TextInputChannel; import io.flutter.plugin.common.ErrorLogResult; import io.flutter.plugin.common.MethodChannel; -import io.flutter.view.FlutterView; class InputConnectionAdaptor extends BaseInputConnection { - private final FlutterView mFlutterView; + private final View mFlutterView; private final int mClient; private final TextInputChannel textInputChannel; private final Editable mEditable; @@ -29,7 +29,7 @@ class InputConnectionAdaptor extends BaseInputConnection { new ErrorLogResult("FlutterTextInput"); public InputConnectionAdaptor( - FlutterView view, + View view, int client, TextInputChannel textInputChannel, Editable editable diff --git a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java index 96fa64a0a629a..051befd6fab4e 100644 --- a/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java +++ b/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java @@ -10,6 +10,7 @@ import android.text.Editable; import android.text.InputType; import android.text.Selection; +import android.view.View; import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; @@ -24,7 +25,7 @@ */ public class TextInputPlugin { @NonNull - private final FlutterView mView; + private final View mView; @NonNull private final InputMethodManager mImm; @NonNull @@ -38,7 +39,7 @@ public class TextInputPlugin { @Nullable private InputConnection lastInputConnection; - public TextInputPlugin(FlutterView view, @NonNull DartExecutor dartExecutor) { + public TextInputPlugin(View view, @NonNull DartExecutor dartExecutor) { mView = view; mImm = (InputMethodManager) view.getContext().getSystemService( Context.INPUT_METHOD_SERVICE); @@ -126,7 +127,7 @@ private static int inputTypeFromTextInputType( return textType; } - public InputConnection createInputConnection(FlutterView view, EditorInfo outAttrs) { + public InputConnection createInputConnection(View view, EditorInfo outAttrs) { if (mClient == 0) { lastInputConnection = null; return lastInputConnection; @@ -173,12 +174,12 @@ public InputConnection getLastInputConnection() { return lastInputConnection; } - private void showTextInput(FlutterView view) { + private void showTextInput(View view) { view.requestFocus(); mImm.showSoftInput(view, 0); } - private void hideTextInput(FlutterView view) { + private void hideTextInput(View view) { mImm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0); } @@ -203,7 +204,7 @@ private void applyStateToSelection(TextInputChannel.TextEditState state) { } } - private void setTextInputEditingState(FlutterView view, TextInputChannel.TextEditState state) { + private void setTextInputEditingState(View view, TextInputChannel.TextEditState state) { if (!mRestartInputPending && state.text.equals(mEditable.toString())) { applyStateToSelection(state); mImm.updateSelection(mView, Math.max(Selection.getSelectionStart(mEditable), 0), From fe15149d1a4a08e51692c3aec8e8c8b33ec6d116 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 28 Feb 2019 16:51:17 -0800 Subject: [PATCH 0317/1117] Android Embedding PR 12: Add lifecycle methods to FlutterActivity. (#7974) --- .../engine/android/FlutterActivity.java | 40 +++ .../engine/android/FlutterFragment.java | 232 +++++++++++++++++- 2 files changed, 264 insertions(+), 8 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterActivity.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterActivity.java index 182a097f9c0f7..cdaab64827699 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterActivity.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterActivity.java @@ -18,6 +18,7 @@ import android.view.ViewGroup; import android.widget.FrameLayout; +import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.FlutterShellArgs; import io.flutter.view.FlutterMain; @@ -132,6 +133,45 @@ protected FlutterFragment createFlutterFragment() { ); } + @Override + public void onPostResume() { + super.onPostResume(); + flutterFragment.onPostResume(); + } + + @Override + protected void onNewIntent(Intent intent) { + // Forward Intents to our FlutterFragment in case it cares. + flutterFragment.onNewIntent(intent); + } + + @Override + public void onBackPressed() { + flutterFragment.onBackPressed(); + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + flutterFragment.onRequestPermissionsResult(requestCode, permissions, grantResults); + } + + @Override + public void onUserLeaveHint() { + flutterFragment.onUserLeaveHint(); + } + + @Override + public void onTrimMemory(int level) { + super.onTrimMemory(level); + flutterFragment.onTrimMemory(level); + } + + @SuppressWarnings("unused") + @Nullable + protected FlutterEngine getFlutterEngine() { + return flutterFragment.getFlutterEngine(); + } + /** * The path to the bundle that contains this Flutter app's resources, e.g., Dart code snapshots. *

diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java index d4a535bc053d1..e4042bbaaa139 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java @@ -6,16 +6,23 @@ import android.content.Context; import android.content.Intent; +import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.FlutterShellArgs; +import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.view.FlutterMain; +import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW; + /** * {@code Fragment} which displays a Flutter UI that takes up all available {@code Fragment} space. *

@@ -25,17 +32,17 @@ * Using a {@code FlutterFragment} requires forwarding a number of calls from an {@code Activity} to * ensure that the internal Flutter app behaves as expected: *

    - *
  1. {@link Activity#onPostResume()}
  2. - *
  3. {@link Activity#onBackPressed()}
  4. - *
  5. {@link Activity#onRequestPermissionsResult(int, String[], int[])} ()}
  6. - *
  7. {@link Activity#onNewIntent(Intent)} ()}
  8. - *
  9. {@link Activity#onUserLeaveHint()}
  10. - *
  11. {@link Activity#onTrimMemory(int)}
  12. + *
  13. {@link android.app.Activity#onPostResume()}
  14. + *
  15. {@link android.app.Activity#onBackPressed()}
  16. + *
  17. {@link android.app.Activity#onRequestPermissionsResult(int, String[], int[])} ()}
  18. + *
  19. {@link android.app.Activity#onNewIntent(Intent)} ()}
  20. + *
  21. {@link android.app.Activity#onUserLeaveHint()}
  22. + *
  23. {@link android.app.Activity#onTrimMemory(int)}
  24. *
* Additionally, when starting an {@code Activity} for a result from this {@code Fragment}, be sure * to invoke {@link Fragment#startActivityForResult(Intent, int)} rather than - * {@link Activity#startActivityForResult(Intent, int)}. If the {@code Activity} version of the - * method is invoked then this {@code Fragment} will never receive its + * {@link android.app.Activity#startActivityForResult(Intent, int)}. If the {@code Activity} version + * of the method is invoked then this {@code Fragment} will never receive its * {@link Fragment#onActivityResult(int, int, Intent)} callback. *

* If convenient, consider using a {@link FlutterActivity} instead of a {@code FlutterFragment} to @@ -151,6 +158,8 @@ protected static Bundle createArgsBundle(@Nullable String dartEntrypoint, @Nullable private FlutterEngine flutterEngine; + @Nullable + private FlutterView flutterView; public FlutterFragment() { // Ensure that we at least have an empty Bundle of arguments so that we don't @@ -158,6 +167,16 @@ public FlutterFragment() { setArguments(new Bundle()); } + /** + * The {@link FlutterEngine} that backs the Flutter content presented by this {@code Fragment}. + * + * @return the {@link FlutterEngine} held by this {@code Fragment} + */ + @Nullable + public FlutterEngine getFlutterEngine() { + return flutterEngine; + } + @Override public void onAttach(Context context) { super.onAttach(context); @@ -207,4 +226,201 @@ protected FlutterEngine onCreateFlutterEngine(@NonNull Context context) { protected void onFlutterEngineCreated(@NonNull FlutterEngine flutterEngine) { // no-op } + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + flutterView = new FlutterView(getContext()); + flutterView.attachToFlutterEngine(flutterEngine); + + // TODO(mattcarroll): the following call should exist here, but the plugin system needs to be revamped. + // The existing attach() method does not know how to handle this kind of FlutterView. + //flutterEngine.getPluginRegistry().attach(this, getActivity()); + + doInitialFlutterViewRun(); + + return flutterView; + } + + /** + * Starts running Dart within the FlutterView for the first time. + * + * Reloading/restarting Dart within a given FlutterView is not supported. If this method is + * invoked while Dart is already executing then it does nothing. + * + * {@code flutterEngine} must be non-null when invoking this method. + */ + private void doInitialFlutterViewRun() { + if (flutterEngine.getDartExecutor().isExecutingDart()) { + // No warning is logged because this situation will happen on every config + // change if the developer does not choose to retain the Fragment instance. + // So this is expected behavior in many cases. + return; + } + + // The engine needs to receive the Flutter app's initial route before executing any + // Dart code to ensure that the initial route arrives in time to be applied. + if (getInitialRoute() != null) { + flutterEngine.getNavigationChannel().setInitialRoute(getInitialRoute()); + } + + // Configure the Dart entrypoint and execute it. + DartExecutor.DartEntrypoint entrypoint = new DartExecutor.DartEntrypoint( + getResources().getAssets(), + getAppBundlePath(), + getDartEntrypointFunctionName() + ); + flutterEngine.getDartExecutor().executeDartEntrypoint(entrypoint); + } + + /** + * Returns the initial route that should be rendered within Flutter, once the Flutter app starts. + * + * Defaults to {@code null}, which signifies a route of "/" in Flutter. + */ + @Nullable + protected String getInitialRoute() { + return getArguments().getString(ARG_INITIAL_ROUTE); + } + + /** + * Returns the file path to the desired Flutter app's bundle of code. + * + * Defaults to {@link FlutterMain#findAppBundlePath(Context)}. + */ + @NonNull + protected String getAppBundlePath() { + return getArguments().getString(ARG_APP_BUNDLE_PATH, FlutterMain.findAppBundlePath(getContextCompat())); + } + + /** + * Returns the name of the Dart method that this {@code FlutterFragment} should execute to + * start a Flutter app. + * + * Defaults to "main". + */ + @NonNull + protected String getDartEntrypointFunctionName() { + return getArguments().getString(ARG_DART_ENTRYPOINT, "main"); + } + + // TODO(mattcarroll): determine why this can't be in onResume(). Comment reason, or move if possible. + public void onPostResume() { + Log.d(TAG, "onPostResume()"); + flutterEngine.getLifecycleChannel().appIsResumed(); + } + + /** + * The hardware back button was pressed. + * + * See {@link android.app.Activity#onBackPressed()} + */ + public void onBackPressed() { + Log.d(TAG, "onBackPressed()"); + if (flutterEngine != null) { + flutterEngine.getNavigationChannel().popRoute(); + } else { + Log.w(TAG, "Invoked onBackPressed() before FlutterFragment was attached to an Activity."); + } + } + + /** + * The result of a permission request has been received. + * + * See {@link android.app.Activity#onRequestPermissionsResult(int, String[], int[])} + * + * @param requestCode identifier passed with the initial permission request + * @param permissions permissions that were requested + * @param grantResults permission grants or denials + */ + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + if (flutterEngine != null) { + flutterEngine.getPluginRegistry().onRequestPermissionsResult(requestCode, permissions, grantResults); + } else { + Log.w(TAG, "onRequestPermissionResult() invoked before FlutterFragment was attached to an Activity."); + } + } + + /** + * A new Intent was received by the {@link android.app.Activity} that currently owns this + * {@link Fragment}. + * + * See {@link android.app.Activity#onNewIntent(Intent)} + * + * @param intent new Intent + */ + public void onNewIntent(@NonNull Intent intent) { + if (flutterEngine != null) { + flutterEngine.getPluginRegistry().onNewIntent(intent); + } else { + Log.w(TAG, "onNewIntent() invoked before FlutterFragment was attached to an Activity."); + } + } + + /** + * A result has been returned after an invocation of {@link Fragment#startActivityForResult(Intent, int)}. + * + * @param requestCode request code sent with {@link Fragment#startActivityForResult(Intent, int)} + * @param resultCode code representing the result of the {@code Activity} that was launched + * @param data any corresponding return data, held within an {@code Intent} + */ + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (flutterEngine != null) { + flutterEngine.getPluginRegistry().onActivityResult(requestCode, resultCode, data); + } else { + Log.w(TAG, "onActivityResult() invoked before FlutterFragment was attached to an Activity."); + } + } + + /** + * The {@link android.app.Activity} that owns this {@link Fragment} is about to go to the background + * as the result of a user's choice/action, i.e., not as the result of an OS decision. + * + * See {@link android.app.Activity#onUserLeaveHint()} + */ + public void onUserLeaveHint() { + if (flutterEngine != null) { + flutterEngine.getPluginRegistry().onUserLeaveHint(); + } else { + Log.w(TAG, "onUserLeaveHint() invoked before FlutterFragment was attached to an Activity."); + } + } + + /** + * Callback invoked when memory is low. + * + * This implementation forwards a memory pressure warning to the running Flutter app. + * + * @param level level + */ + public void onTrimMemory(int level) { + if (flutterEngine != null) { + // Use a trim level delivered while the application is running so the + // framework has a chance to react to the notification. + if (level == TRIM_MEMORY_RUNNING_LOW) { + flutterEngine.getSystemChannel().sendMemoryPressureWarning(); + } + } else { + Log.w(TAG, "onTrimMemory() invoked before FlutterFragment was attached to an Activity."); + } + } + + /** + * Callback invoked when memory is low. + * + * This implementation forwards a memory pressure warning to the running Flutter app. + */ + @Override + public void onLowMemory() { + super.onLowMemory(); + flutterEngine.getSystemChannel().sendMemoryPressureWarning(); + } + + @NonNull + private Context getContextCompat() { + return Build.VERSION.SDK_INT >= 23 + ? getContext() + : getActivity(); + } } From 302e2e9d2deaff03107d48518debf1a93967554e Mon Sep 17 00:00:00 2001 From: Core Date: Fri, 1 Mar 2019 08:44:49 +0700 Subject: [PATCH 0318/1117] Fix cursor jumping when typing some special characters. (#7964) --- third_party/txt/src/txt/paragraph.cc | 10 +++ third_party/txt/tests/paragraph_unittests.cc | 86 ++++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index 3c0e6d602703b..68c06fc143a21 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -1248,6 +1248,7 @@ std::vector Paragraph::GetRectsForRange( // Lines that are actually in the requested range. size_t max_line = 0; size_t min_line = INT_MAX; + size_t glyph_length = 0; // Generate initial boxes and calculate metrics. for (const CodeUnitRun& run : code_unit_runs_) { @@ -1276,6 +1277,15 @@ std::vector Paragraph::GetRectsForRange( if (gp.code_units.start >= start && gp.code_units.end <= end) { left = std::min(left, static_cast(gp.x_pos.start)); right = std::max(right, static_cast(gp.x_pos.end)); + } else if (gp.code_units.end == end) { + // Calculate left and right when we are at + // the last position of a combining character. + glyph_length = (gp.code_units.end - gp.code_units.start) - 1; + if (gp.code_units.start == + std::max(0, (start - glyph_length))) { + left = std::min(left, static_cast(gp.x_pos.start)); + right = std::max(right, static_cast(gp.x_pos.end)); + } } } if (left == SK_ScalarMax || right == SK_ScalarMin) diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index 0d08bfc7fc5b5..ef5966236c787 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -1673,6 +1673,92 @@ TEST_F(ParagraphTest, ASSERT_TRUE(Snapshot()); } +TEST_F(ParagraphTest, GetRectsForRangeIncludeCombiningCharacter) { + 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_families = std::vector(1, "Roboto"); + text_style.font_size = 50; + text_style.letter_spacing = 1; + text_style.word_spacing = 5; + 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(GetTestCanvasWidth() - 100); + + paragraph->Paint(GetCanvas(), 0, 0); + + Paragraph::RectHeightStyle rect_height_style = + Paragraph::RectHeightStyle::kTight; + Paragraph::RectWidthStyle rect_width_style = + Paragraph::RectWidthStyle::kTight; + + std::vector boxes = + paragraph->GetRectsForRange(0, 0, rect_height_style, rect_width_style); + EXPECT_EQ(boxes.size(), 0ull); + + // Case when the sentence starts with a combining character + // We should get 0 box for ด because it's already been combined to ดี + boxes = + paragraph->GetRectsForRange(0, 1, rect_height_style, rect_width_style); + EXPECT_EQ(boxes.size(), 0ull); + + boxes = + paragraph->GetRectsForRange(1, 2, rect_height_style, rect_width_style); + EXPECT_EQ(boxes.size(), 1ull); + + boxes = + paragraph->GetRectsForRange(0, 2, rect_height_style, rect_width_style); + EXPECT_EQ(boxes.size(), 1ull); + + // Case when the sentence contains a combining character + // We should get 0 box for ว because it's already been combined to วั + boxes = + paragraph->GetRectsForRange(3, 4, rect_height_style, rect_width_style); + EXPECT_EQ(boxes.size(), 0ull); + + boxes = + paragraph->GetRectsForRange(4, 5, rect_height_style, rect_width_style); + EXPECT_EQ(boxes.size(), 1ull); + + boxes = + paragraph->GetRectsForRange(3, 5, rect_height_style, rect_width_style); + EXPECT_EQ(boxes.size(), 1ull); + + // Case when the sentence contains a combining character that contain 3 + // characters We should get 0 box for ท and ที because it's already been + // combined to ที่ + boxes = + paragraph->GetRectsForRange(14, 15, rect_height_style, rect_width_style); + EXPECT_EQ(boxes.size(), 0ull); + + boxes = + paragraph->GetRectsForRange(15, 16, rect_height_style, rect_width_style); + EXPECT_EQ(boxes.size(), 0ull); + + boxes = + paragraph->GetRectsForRange(16, 17, rect_height_style, rect_width_style); + EXPECT_EQ(boxes.size(), 1ull); + + boxes = + paragraph->GetRectsForRange(14, 17, rect_height_style, rect_width_style); + EXPECT_EQ(boxes.size(), 1ull); +} + TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeCenterParagraph)) { const char* text = "01234   "; // includes ideographic space // and english space. From c88b09710daf7aec6344d10e1abb427cb6e50d80 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 28 Feb 2019 22:11:18 -0500 Subject: [PATCH 0319/1117] Roll src/third_party/skia b7b2da871e95..255569187f27 (23 commits) (#8002) https://skia.googlesource.com/skia.git/%2Blog/b7b2da871e95..255569187f27 git log b7b2da871e959ce9d412498b0378f5ace0dd5808..255569187f27d854a78ce67a62713fadc2d5e292 --date=short --no-merges --format=%ad %ae %s 2019-03-01 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 5de69e91bd93..5546fb4fdd85 (4 commits) 2019-02-27 csmartdalton@google.com Make GrMesh compatible with instanced draws that have no attribs 2019-02-28 reed@google.com Move responsibility to onMakeContext for device colorspace decision 2019-02-28 kjlubick@google.com [canvaskit] Add support for external fonts 2019-02-26 csmartdalton@google.com Revert "Drop unused shader support for sample variables" 2019-02-28 brianosman@google.com Particles: Removed emitters, added more full-featured position affectors 2019-02-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader c6eb41bebc27..a1924739029e (2 commits) 2019-02-28 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-02-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader bc63cf9c511b..c6eb41bebc27 (3 commits) 2019-02-28 jvanverth@google.com Fix a couple of Mac windowing issues. 2019-02-28 bsalomon@google.com Remove support for SkDeferredDisplayListRecorder::DelayReleaseCallback::kNo. 2019-02-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 201f136c9907..bc63cf9c511b (1 commits) 2019-02-28 thakis@chromium.org skia: Fix -Wextra-semi warnings in non-dcheck builds. 2019-02-27 michaelludwig@google.com Reland "Add general quad API to SkGpuDevice" 2019-02-28 brianosman@google.com Fix scaling error in SkLights::makeColorSpace 2019-02-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 61d99852c465..1dc32aecaa61 (2053 commits) 2019-02-28 benjaminwagner@google.com Remove OS condition from isolate files 2019-02-28 kjlubick@google.com [canvaskit][pathkit] Remove flaky/low-utility Debug tests 2019-02-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 4b314eefc839..5de69e91bd93 (1 commits) 2019-02-28 fmalita@chromium.org solink with --start-group/--end-group 2019-02-27 scroggo@google.com Enable Skia for Windows 2019-02-28 halcanary@google.com SkQP Documentation 2019-02-28 kjlubick@google.com [canvaskit] Support image assets for Skottie The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DEPS b/DEPS index cb824997cff40..0c612b0842336 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': 'b7b2da871e959ce9d412498b0378f5ace0dd5808', + 'skia_revision': '255569187f27d854a78ce67a62713fadc2d5e292', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 65ecdb13a0c23..61182d5dc0927 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f25dc20a23aafd38437994dfd80cdd57 +Signature: 84d0579ee895fb12763c036a74644ea9 UNUSED LICENSES: @@ -2133,8 +2133,11 @@ 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/canvaskit/postamble.js +FILE: ../../../third_party/skia/experimental/canvaskit/preamble.js FILE: ../../../third_party/skia/experimental/canvaskit/ready.js FILE: ../../../third_party/skia/experimental/canvaskit/release.js +FILE: ../../../third_party/skia/experimental/canvaskit/skottie.js FILE: ../../../third_party/skia/experimental/docs/animationCommon.js FILE: ../../../third_party/skia/experimental/docs/backend.js FILE: ../../../third_party/skia/experimental/docs/canvasBackend.js @@ -2144,7 +2147,6 @@ FILE: ../../../third_party/skia/experimental/docs/jsonbaseddoc.htm FILE: ../../../third_party/skia/experimental/docs/svgBackend.js FILE: ../../../third_party/skia/experimental/docs/svgbaseddoc.htm FILE: ../../../third_party/skia/experimental/docs/utilities.js -FILE: ../../../third_party/skia/infra/bots/android_bin.isolate FILE: ../../../third_party/skia/infra/bots/assets.isolate FILE: ../../../third_party/skia/infra/bots/assets/android_ndk_darwin/VERSION FILE: ../../../third_party/skia/infra/bots/assets/android_ndk_linux/VERSION @@ -4693,14 +4695,12 @@ FILE: ../../../third_party/skia/modules/particles/include/SkParticleAffector.h FILE: ../../../third_party/skia/modules/particles/include/SkParticleData.h FILE: ../../../third_party/skia/modules/particles/include/SkParticleDrawable.h FILE: ../../../third_party/skia/modules/particles/include/SkParticleEffect.h -FILE: ../../../third_party/skia/modules/particles/include/SkParticleEmitter.h FILE: ../../../third_party/skia/modules/particles/include/SkParticleSerialization.h FILE: ../../../third_party/skia/modules/particles/include/SkReflected.h FILE: ../../../third_party/skia/modules/particles/src/SkCurve.cpp FILE: ../../../third_party/skia/modules/particles/src/SkParticleAffector.cpp FILE: ../../../third_party/skia/modules/particles/src/SkParticleDrawable.cpp FILE: ../../../third_party/skia/modules/particles/src/SkParticleEffect.cpp -FILE: ../../../third_party/skia/modules/particles/src/SkParticleEmitter.cpp FILE: ../../../third_party/skia/modules/particles/src/SkReflected.cpp ---------------------------------------------------------------------------------------------------- Copyright 2019 Google LLC From 99f3f7a9c246f1ebedc6eefd867cde250b370380 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Thu, 28 Feb 2019 19:19:06 -0800 Subject: [PATCH 0320/1117] Fix incorrect transformation matrix (#8001) Previously the transformation matrix returned on semantics nodes was fetched by matrix col,row (incorrectly). This uses the SkMatrix constants instead and adds a test. --- shell/platform/embedder/embedder.cc | 18 ++++++++++----- .../platform/embedder/fixtures/a11y_main.dart | 23 +++++++++++-------- .../embedder/tests/embedder_a11y_unittests.cc | 9 ++++++++ 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index a7ae7575ca425..7dffc91718e77 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -412,12 +412,18 @@ FlutterEngineResult FlutterEngineRun(size_t version, user_data](blink::SemanticsNodeUpdates update) { for (const auto& value : update) { const auto& node = value.second; - const auto& transform = node.transform; - auto flutter_transform = FlutterTransformation{ - transform.get(0, 0), transform.get(0, 1), transform.get(0, 2), - transform.get(1, 0), transform.get(1, 1), transform.get(1, 2), - transform.get(2, 0), transform.get(2, 1), transform.get(2, 2)}; - const FlutterSemanticsNode embedder_node = { + SkMatrix transform = static_cast(node.transform); + FlutterTransformation flutter_transform{ + transform.get(SkMatrix::kMScaleX), + transform.get(SkMatrix::kMSkewX), + transform.get(SkMatrix::kMTransX), + transform.get(SkMatrix::kMSkewY), + transform.get(SkMatrix::kMScaleY), + transform.get(SkMatrix::kMTransY), + transform.get(SkMatrix::kMPersp0), + transform.get(SkMatrix::kMPersp1), + transform.get(SkMatrix::kMPersp2)}; + const FlutterSemanticsNode embedder_node{ sizeof(FlutterSemanticsNode), node.id, static_cast(node.flags), diff --git a/shell/platform/embedder/fixtures/a11y_main.dart b/shell/platform/embedder/fixtures/a11y_main.dart index a0315f56a4f60..578bd471c0d0a 100644 --- a/shell/platform/embedder/fixtures/a11y_main.dart +++ b/shell/platform/embedder/fixtures/a11y_main.dart @@ -2,12 +2,17 @@ import 'dart:async'; import 'dart:typed_data'; import 'dart:ui'; -Float64List kIdentityTransform = () { +Float64List kTestTransform = () { final Float64List values = Float64List(16); - values[0] = 1.0; - values[5] = 1.0; - values[10] = 1.0; - values[15] = 1.0; + values[0] = 1.0; // scaleX + values[4] = 2.0; // skewX + values[12] = 3.0; // transX + values[1] = 4.0; // skewY + values[5] = 5.0; // scaleY + values[13] = 6.0; // transY + values[3] = 7.0; // pers0 + values[7] = 8.0; // pers1 + values[15] = 9.0; // pers2 return values; }(); @@ -68,7 +73,7 @@ main() async { id: 42, label: 'A: root', rect: Rect.fromLTRB(0.0, 0.0, 10.0, 10.0), - transform: kIdentityTransform, + transform: kTestTransform, childrenInTraversalOrder: Int32List.fromList([84, 96]), childrenInHitTestOrder: Int32List.fromList([96, 84]), ) @@ -76,13 +81,13 @@ main() async { id: 84, label: 'B: leaf', rect: Rect.fromLTRB(40.0, 40.0, 80.0, 80.0), - transform: kIdentityTransform, + transform: kTestTransform, ) ..updateNode( id: 96, label: 'C: branch', rect: Rect.fromLTRB(40.0, 40.0, 80.0, 80.0), - transform: kIdentityTransform, + transform: kTestTransform, childrenInTraversalOrder: Int32List.fromList([128]), childrenInHitTestOrder: Int32List.fromList([128]), ) @@ -90,7 +95,7 @@ main() async { id: 128, label: 'D: leaf', rect: Rect.fromLTRB(40.0, 40.0, 80.0, 80.0), - transform: kIdentityTransform, + transform: kTestTransform, additionalActions: Int32List.fromList([21]), ) ..updateCustomAction( diff --git a/shell/platform/embedder/tests/embedder_a11y_unittests.cc b/shell/platform/embedder/tests/embedder_a11y_unittests.cc index 1959901c19700..cfb15db76dc68 100644 --- a/shell/platform/embedder/tests/embedder_a11y_unittests.cc +++ b/shell/platform/embedder/tests/embedder_a11y_unittests.cc @@ -158,6 +158,15 @@ TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) { ++node_batch_end_count; } else { ++node_count; + ASSERT_EQ(1.0, node->transform.scaleX); + ASSERT_EQ(2.0, node->transform.skewX); + ASSERT_EQ(3.0, node->transform.transX); + ASSERT_EQ(4.0, node->transform.skewY); + ASSERT_EQ(5.0, node->transform.scaleY); + ASSERT_EQ(6.0, node->transform.transY); + ASSERT_EQ(7.0, node->transform.pers0); + ASSERT_EQ(8.0, node->transform.pers1); + ASSERT_EQ(9.0, node->transform.pers2); } }; int action_count = 0; From 66042161eba17da968800c57ddd2c314cd787abb Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 1 Mar 2019 09:25:23 -0500 Subject: [PATCH 0321/1117] Roll src/third_party/skia 255569187f27..71a23d4195d9 (1 commits) (#8003) https://skia.googlesource.com/skia.git/%2Blog/255569187f27..71a23d4195d9 git log 255569187f27d854a78ce67a62713fadc2d5e292..71a23d4195d96dbf200fbf10fb887dbcc83bd1da --date=short --no-merges --format=%ad %ae %s 2019-02-28 fmalita@chromium.org [canvaskit] Consolidate Skottie assets The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 0c612b0842336..491cc994ac5e2 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': '255569187f27d854a78ce67a62713fadc2d5e292', + 'skia_revision': '71a23d4195d96dbf200fbf10fb887dbcc83bd1da', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 61182d5dc0927..a85e35e36c85b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 84d0579ee895fb12763c036a74644ea9 +Signature: c82fdb93a1014dcf85c470bff90ccc4b UNUSED LICENSES: From 0b174017143c34629546134601bb6c65becf71a3 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Fri, 1 Mar 2019 10:43:09 -0800 Subject: [PATCH 0322/1117] Buffer lifecycle in WindowData (#7999) --- lib/ui/hooks.dart | 7 +++++++ lib/ui/window.dart | 9 +++++++++ lib/ui/window/window.cc | 12 ++++++++++++ lib/ui/window/window.h | 1 + runtime/runtime_controller.cc | 14 +++++++++++++- runtime/runtime_controller.h | 3 +++ shell/common/engine.cc | 2 ++ 7 files changed, 47 insertions(+), 1 deletion(-) diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index b1550bf90b1ee..a7e831245c699 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -89,6 +89,13 @@ void _updateUserSettingsData(String jsonData) { _updatePlatformBrightness(data['platformBrightness']); } +@pragma('vm:entry-point') +// ignore: unused_element +void _updateLifecycleState(String state) { + window._initialLifecycleState ??= state; +} + + void _updateTextScaleFactor(double textScaleFactor) { window._textScaleFactor = textScaleFactor; _invoke(window.onTextScaleFactorChanged, window._onTextScaleFactorChangedZone); diff --git a/lib/ui/window.dart b/lib/ui/window.dart index d89b668b7037d..6abceceb0261c 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -556,6 +556,15 @@ class Window { _onLocaleChangedZone = Zone.current; } + /// The lifecycle state immediately after dart isolate initialization. + /// + /// This property will not be updated as the lifecycle changes. + /// + /// It is used to initialize [SchedulerBinding.lifecycleState] at startup + /// with any buffered lifecycle state events. + String get initialLifecycleState => _initialLifecycleState; + String _initialLifecycleState; + /// The system-reported text scale. /// /// This establishes the text scaling factor to use when rendering text, diff --git a/lib/ui/window/window.cc b/lib/ui/window/window.cc index 0a90d6fcbf2d9..bfeb86cef66f4 100644 --- a/lib/ui/window/window.cc +++ b/lib/ui/window/window.cc @@ -217,6 +217,18 @@ void Window::UpdateUserSettingsData(const std::string& data) { })); } +void Window::UpdateLifecycleState(const std::string& data) { + std::shared_ptr dart_state = library_.dart_state().lock(); + if (!dart_state) + return; + tonic::DartState::Scope scope(dart_state); + tonic::LogIfError(tonic::DartInvokeField(library_.value(), + "_updateLifecycleState", + { + tonic::StdStringToDart(data), + })); +} + void Window::UpdateSemanticsEnabled(bool enabled) { std::shared_ptr dart_state = library_.dart_state().lock(); if (!dart_state) diff --git a/lib/ui/window/window.h b/lib/ui/window/window.h index 94a506fb5fa4d..f5624e4bad6af 100644 --- a/lib/ui/window/window.h +++ b/lib/ui/window/window.h @@ -65,6 +65,7 @@ class Window final { void UpdateWindowMetrics(const ViewportMetrics& metrics); void UpdateLocales(const std::vector& locales); void UpdateUserSettingsData(const std::string& data); + void UpdateLifecycleState(const std::string& data); void UpdateSemanticsEnabled(bool enabled); void UpdateAccessibilityFeatures(int32_t flags); void DispatchPlatformMessage(fml::RefPtr message); diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc index b57f2232acc47..83a848e87955c 100644 --- a/runtime/runtime_controller.cc +++ b/runtime/runtime_controller.cc @@ -128,7 +128,8 @@ bool RuntimeController::FlushRuntimeStateToIsolate() { SetLocales(window_data_.locale_data) && SetSemanticsEnabled(window_data_.semantics_enabled) && SetAccessibilityFeatures(window_data_.accessibility_feature_flags_) && - SetUserSettingsData(window_data_.user_settings_data); + SetUserSettingsData(window_data_.user_settings_data) && + SetLifecycleState(window_data_.lifecycle_state); } bool RuntimeController::SetViewportMetrics(const ViewportMetrics& metrics) { @@ -164,6 +165,17 @@ bool RuntimeController::SetUserSettingsData(const std::string& data) { return false; } +bool RuntimeController::SetLifecycleState(const std::string& data) { + window_data_.lifecycle_state = data; + + if (auto* window = GetWindowIfAvailable()) { + window->UpdateLifecycleState(window_data_.lifecycle_state); + return true; + } + + return false; +} + bool RuntimeController::SetSemanticsEnabled(bool enabled) { window_data_.semantics_enabled = enabled; diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h index c913795b8eba2..03f1389d8c613 100644 --- a/runtime/runtime_controller.h +++ b/runtime/runtime_controller.h @@ -49,6 +49,8 @@ class RuntimeController final : public WindowClient { bool SetUserSettingsData(const std::string& data); + bool SetLifecycleState(const std::string& data); + bool SetSemanticsEnabled(bool enabled); bool SetAccessibilityFeatures(int32_t flags); @@ -111,6 +113,7 @@ class RuntimeController final : public WindowClient { std::string variant_code; std::vector locale_data; std::string user_settings_data = "{}"; + std::string lifecycle_state; bool semantics_enabled = false; bool assistive_technology_enabled = false; int32_t accessibility_feature_flags_ = 0; diff --git a/shell/common/engine.cc b/shell/common/engine.cc index 084216072e988..e5b818b0c6015 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -291,6 +291,8 @@ bool Engine::HandleLifecyclePlatformMessage(blink::PlatformMessage* message) { if (state == "AppLifecycleState.resumed" && have_surface_) { ScheduleFrame(); } + runtime_controller_->SetLifecycleState(state); + // We always want pass the message forwards directly into the framework. return false; } From d7e0bc10c2a334480bece03f9e353fe9f007d311 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 1 Mar 2019 14:11:42 -0500 Subject: [PATCH 0323/1117] Roll src/third_party/skia 71a23d4195d9..e1f5b644656f (8 commits) (#8004) https://skia.googlesource.com/skia.git/%2Blog/71a23d4195d9..e1f5b644656f git log 71a23d4195d96dbf200fbf10fb887dbcc83bd1da..e1f5b644656fc38d4784d12e174a5f8bdbab7538 --date=short --no-merges --format=%ad %ae %s 2019-03-01 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader a1924739029e..dd1e37e31d68 (1 commits) 2019-02-28 ianloic@google.com Clean up SkFontMgr_fuchsia.cpp after FIDL API change 2019-03-01 reed@google.com fix docs for fitsInBytes 2019-03-01 kjlubick@google.com [canvaskit] Roll 0.4.1 2019-03-01 mtklein@google.com fix labels in P3 gm 2019-02-28 jvanverth@google.com Add GrMtlPipelineStateCache. 2019-03-01 fmalita@chromium.org [canvaskit] Ignore image paths in Skottie asset keys 2019-03-01 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 5546fb4fdd85..1581ff030b9c (2 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 491cc994ac5e2..9f7294097ad18 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': '71a23d4195d96dbf200fbf10fb887dbcc83bd1da', + 'skia_revision': 'e1f5b644656fc38d4784d12e174a5f8bdbab7538', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a85e35e36c85b..ebf2119fd7667 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c82fdb93a1014dcf85c470bff90ccc4b +Signature: 9fe2814b76fdfc922c7db5e725e33d37 UNUSED LICENSES: From 293cfcaa548fb448df62d3a2708d7f88fb5c2a95 Mon Sep 17 00:00:00 2001 From: Greg Spencer Date: Fri, 1 Mar 2019 14:53:22 -0800 Subject: [PATCH 0324/1117] Guard against using Android API not defined in API level 16 & 17 (#8006) This adds a guard around the call to MotionEvent.isFromSource, which is not implemented in API 16 and 17. Fixes flutter/flutter#28640 --- shell/platform/android/io/flutter/view/FlutterView.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 58a44a37a743e..c766305fd7dcc 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -570,7 +570,11 @@ public boolean onHoverEvent(MotionEvent event) { @Override public boolean onGenericMotionEvent(MotionEvent event) { - if (!event.isFromSource(InputDevice.SOURCE_CLASS_POINTER) || + // Method isFromSource is only available in API 18+ (Jelly Bean MR2) + // Mouse hover support is not implemented for API < 18. + boolean isPointerEvent = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 + && event.isFromSource(InputDevice.SOURCE_CLASS_POINTER); + if (!isPointerEvent || event.getActionMasked() != MotionEvent.ACTION_HOVER_MOVE || !isAttached()) { return super.onGenericMotionEvent(event); From 39c46dea4b7347a252218aaff5caac5dc2fec8cd Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Fri, 1 Mar 2019 15:14:20 -0800 Subject: [PATCH 0325/1117] Revert "Buffer lifecycle in WindowData (#7999)" (#8010) This reverts commit 0b174017143c34629546134601bb6c65becf71a3. --- lib/ui/hooks.dart | 7 ------- lib/ui/window.dart | 9 --------- lib/ui/window/window.cc | 12 ------------ lib/ui/window/window.h | 1 - runtime/runtime_controller.cc | 14 +------------- runtime/runtime_controller.h | 3 --- shell/common/engine.cc | 2 -- 7 files changed, 1 insertion(+), 47 deletions(-) diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index a7e831245c699..b1550bf90b1ee 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -89,13 +89,6 @@ void _updateUserSettingsData(String jsonData) { _updatePlatformBrightness(data['platformBrightness']); } -@pragma('vm:entry-point') -// ignore: unused_element -void _updateLifecycleState(String state) { - window._initialLifecycleState ??= state; -} - - void _updateTextScaleFactor(double textScaleFactor) { window._textScaleFactor = textScaleFactor; _invoke(window.onTextScaleFactorChanged, window._onTextScaleFactorChangedZone); diff --git a/lib/ui/window.dart b/lib/ui/window.dart index 6abceceb0261c..d89b668b7037d 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -556,15 +556,6 @@ class Window { _onLocaleChangedZone = Zone.current; } - /// The lifecycle state immediately after dart isolate initialization. - /// - /// This property will not be updated as the lifecycle changes. - /// - /// It is used to initialize [SchedulerBinding.lifecycleState] at startup - /// with any buffered lifecycle state events. - String get initialLifecycleState => _initialLifecycleState; - String _initialLifecycleState; - /// The system-reported text scale. /// /// This establishes the text scaling factor to use when rendering text, diff --git a/lib/ui/window/window.cc b/lib/ui/window/window.cc index bfeb86cef66f4..0a90d6fcbf2d9 100644 --- a/lib/ui/window/window.cc +++ b/lib/ui/window/window.cc @@ -217,18 +217,6 @@ void Window::UpdateUserSettingsData(const std::string& data) { })); } -void Window::UpdateLifecycleState(const std::string& data) { - std::shared_ptr dart_state = library_.dart_state().lock(); - if (!dart_state) - return; - tonic::DartState::Scope scope(dart_state); - tonic::LogIfError(tonic::DartInvokeField(library_.value(), - "_updateLifecycleState", - { - tonic::StdStringToDart(data), - })); -} - void Window::UpdateSemanticsEnabled(bool enabled) { std::shared_ptr dart_state = library_.dart_state().lock(); if (!dart_state) diff --git a/lib/ui/window/window.h b/lib/ui/window/window.h index f5624e4bad6af..94a506fb5fa4d 100644 --- a/lib/ui/window/window.h +++ b/lib/ui/window/window.h @@ -65,7 +65,6 @@ class Window final { void UpdateWindowMetrics(const ViewportMetrics& metrics); void UpdateLocales(const std::vector& locales); void UpdateUserSettingsData(const std::string& data); - void UpdateLifecycleState(const std::string& data); void UpdateSemanticsEnabled(bool enabled); void UpdateAccessibilityFeatures(int32_t flags); void DispatchPlatformMessage(fml::RefPtr message); diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc index 83a848e87955c..b57f2232acc47 100644 --- a/runtime/runtime_controller.cc +++ b/runtime/runtime_controller.cc @@ -128,8 +128,7 @@ bool RuntimeController::FlushRuntimeStateToIsolate() { SetLocales(window_data_.locale_data) && SetSemanticsEnabled(window_data_.semantics_enabled) && SetAccessibilityFeatures(window_data_.accessibility_feature_flags_) && - SetUserSettingsData(window_data_.user_settings_data) && - SetLifecycleState(window_data_.lifecycle_state); + SetUserSettingsData(window_data_.user_settings_data); } bool RuntimeController::SetViewportMetrics(const ViewportMetrics& metrics) { @@ -165,17 +164,6 @@ bool RuntimeController::SetUserSettingsData(const std::string& data) { return false; } -bool RuntimeController::SetLifecycleState(const std::string& data) { - window_data_.lifecycle_state = data; - - if (auto* window = GetWindowIfAvailable()) { - window->UpdateLifecycleState(window_data_.lifecycle_state); - return true; - } - - return false; -} - bool RuntimeController::SetSemanticsEnabled(bool enabled) { window_data_.semantics_enabled = enabled; diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h index 03f1389d8c613..c913795b8eba2 100644 --- a/runtime/runtime_controller.h +++ b/runtime/runtime_controller.h @@ -49,8 +49,6 @@ class RuntimeController final : public WindowClient { bool SetUserSettingsData(const std::string& data); - bool SetLifecycleState(const std::string& data); - bool SetSemanticsEnabled(bool enabled); bool SetAccessibilityFeatures(int32_t flags); @@ -113,7 +111,6 @@ class RuntimeController final : public WindowClient { std::string variant_code; std::vector locale_data; std::string user_settings_data = "{}"; - std::string lifecycle_state; bool semantics_enabled = false; bool assistive_technology_enabled = false; int32_t accessibility_feature_flags_ = 0; diff --git a/shell/common/engine.cc b/shell/common/engine.cc index e5b818b0c6015..084216072e988 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -291,8 +291,6 @@ bool Engine::HandleLifecyclePlatformMessage(blink::PlatformMessage* message) { if (state == "AppLifecycleState.resumed" && have_surface_) { ScheduleFrame(); } - runtime_controller_->SetLifecycleState(state); - // We always want pass the message forwards directly into the framework. return false; } From 9bef73a1a1b157340947c4794b8193b5c583179c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 1 Mar 2019 18:40:24 -0500 Subject: [PATCH 0326/1117] Roll src/third_party/skia e1f5b644656f..436d47d5bde9 (3 commits) (#8009) https://skia.googlesource.com/skia.git/%2Blog/e1f5b644656f..436d47d5bde9 git log e1f5b644656fc38d4784d12e174a5f8bdbab7538..436d47d5bde9849dbec03579d8d99a6df33c380f --date=short --no-merges --format=%ad %ae %s 2019-03-01 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 1dc32aecaa61..cddf8925a8d8 (456 commits) 2019-03-01 halcanary@google.com SkQP: Fix report 2019-03-01 mtklein@google.com update high-contrast color filter for tagged SW destinations The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 9f7294097ad18..5515941104329 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': 'e1f5b644656fc38d4784d12e174a5f8bdbab7538', + 'skia_revision': '436d47d5bde9849dbec03579d8d99a6df33c380f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index ebf2119fd7667..6649452dcb72e 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 9fe2814b76fdfc922c7db5e725e33d37 +Signature: 21d92947550af3e9514c1ae863ff3e59 UNUSED LICENSES: From 36cdd2ee6b8f44e36265dc5394664691b9b5bb6b Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 1 Mar 2019 23:51:33 -0500 Subject: [PATCH 0327/1117] Roll src/third_party/skia 436d47d5bde9..09198525261a (6 commits) (#8012) https://skia.googlesource.com/skia.git/%2Blog/436d47d5bde9..09198525261a git log 436d47d5bde9849dbec03579d8d99a6df33c380f..09198525261aa5152c2183158315d81176776d99 --date=short --no-merges --format=%ad %ae %s 2019-03-01 reed@google.com use colorspace steps to determine legacy blits 2019-03-01 jvanverth@google.com Fix memory leak in Metal. 2019-03-01 jvanverth@google.com Restore old Viewer setup order. 2019-03-01 egdaniel@google.com Add flush call to take access type, flags, and semaphore. 2019-03-01 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 1581ff030b9c..6f1a852fce0b (3 commits) 2019-03-01 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 5515941104329..c20a5cb996b0f 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': '436d47d5bde9849dbec03579d8d99a6df33c380f', + 'skia_revision': '09198525261aa5152c2183158315d81176776d99', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6649452dcb72e..bc95e6fd3abdf 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 21d92947550af3e9514c1ae863ff3e59 +Signature: 614fb46c9f0811dad283390a278f8b0d UNUSED LICENSES: From 8a0b054a43b649ec9c43b2190ecd25470aea92c8 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 2 Mar 2019 04:19:27 -0500 Subject: [PATCH 0328/1117] Roll src/third_party/skia 09198525261a..705e67347962 (7 commits) (#8013) https://skia.googlesource.com/skia.git/%2Blog/09198525261a..705e67347962 git log 09198525261aa5152c2183158315d81176776d99..705e67347962f9b76d9a4aafcc21b8781b45d632 --date=short --no-merges --format=%ad %ae %s 2019-03-01 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-02 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader a2f5fd826031..823ca85404fb (1 commits) 2019-03-02 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-03-02 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 37c024a6a7fd..a2f5fd826031 (2 commits) 2019-03-01 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader dd1e37e31d68..37c024a6a7fd (1 commits) 2019-02-28 bungeman@google.com Adjust luminance gamma for Mac. 2019-03-01 mtklein@google.com bring back lowp bilerp_clamp_8888 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c20a5cb996b0f..d01b9ea45089a 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': '09198525261aa5152c2183158315d81176776d99', + 'skia_revision': '705e67347962f9b76d9a4aafcc21b8781b45d632', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index bc95e6fd3abdf..3ebbe62532581 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 614fb46c9f0811dad283390a278f8b0d +Signature: f7e13ab4be87bd6c4206f27f9a484860 UNUSED LICENSES: From 7234cc4634024c488ec68fac80a0ee59fe22a73a Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 2 Mar 2019 08:51:51 -0500 Subject: [PATCH 0329/1117] Roll src/third_party/skia 705e67347962..9159c8ef83b2 (1 commits) (#8014) https://skia.googlesource.com/skia.git/%2Blog/705e67347962..9159c8ef83b2 git log 705e67347962f9b76d9a4aafcc21b8781b45d632..9159c8ef83b2b333551f68664f9fb50fc266c822 --date=short --no-merges --format=%ad %ae %s 2019-03-02 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 6f1a852fce0b..4d153383bd3a (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d01b9ea45089a..2e6b340fa68fb 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': '705e67347962f9b76d9a4aafcc21b8781b45d632', + 'skia_revision': '9159c8ef83b2b333551f68664f9fb50fc266c822', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3ebbe62532581..b2a1f539fac23 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f7e13ab4be87bd6c4206f27f9a484860 +Signature: 8d6cea6aa16d0318dcbc001d404da797 UNUSED LICENSES: From 130cf77c572f2780b6eab3e14f70a7a42fe3f2f3 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Sat, 2 Mar 2019 10:01:15 -0800 Subject: [PATCH 0330/1117] Build engine for iOS on presubmit (#8011) * build the ios engine on Cirrus --- .cirrus.yml | 33 +++++++++++++++++++++++++++++++++ tools/gen_objcdoc.sh | 12 +----------- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index e65df1e409be2..e4cafa6434f1a 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -45,6 +45,39 @@ task: mkdir javadoc_tmp ./flutter/tools/gen_javadoc.py --out-dir javadoc_tmp +task: + name: build_ios + use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' + osx_instance: + image: high-sierra-xcode-9.4.1 + env: + CIRRUS_WORKING_DIR: "/tmp/github_repo" + ENGINE_PATH: "/tmp/engine" + DEPOT_TOOLS: "/tmp/depot_tools" + PATH: "$DEPOT_TOOLS:$PATH" + depot_tools_script: + git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS + # jazzy_script: + # sudo gem install jazzy@0.9.4 + gclient_sync_script: | + mkdir -p $ENGINE_PATH/src + echo 'solutions = [{"managed": False,"name": "src/flutter","url": "git@github.com:flutter/engine.git","custom_deps": {},"deps_file": "DEPS","safesync_url": "",},]' > $ENGINE_PATH/.gclient + cd $ENGINE_PATH/src + rm -rf flutter + rm -rf out + mv $CIRRUS_WORKING_DIR flutter + gclient sync + compile_host_script: | + cd $ENGINE_PATH/src + ./flutter/tools/gn --ios --unoptimized + ninja -C out/ios_debug_unopt + # TODO(dnfield): when we can install jazzy properly, we should do this. + # AFAICT we can't because of Xcode version. + # mkdir objcdoc_tmp + # pushd flutter + # ./tools/gen_objcdoc.sh ../objcdoc_tmp + # popd + format_and_dart_test_task: container: image: gcr.io/flutter-cirrus/build-engine-image:latest diff --git a/tools/gen_objcdoc.sh b/tools/gen_objcdoc.sh index 54dae94e5b719..2ec7a21913394 100755 --- a/tools/gen_objcdoc.sh +++ b/tools/gen_objcdoc.sh @@ -24,15 +24,6 @@ if [[ -n "${GEM_HOME}" ]] PATH="${GEM_HOME}/bin:$PATH" fi -# Jazzy 0.8.x, used on chrome infra, expects --no-download-badge -# Jazzy 0.9.x, used on LUCI, doesn't support that flag. -noDownloadBadge="" -if [[ -z "$LUCI_CONTEXT" ]] - then - noDownloadBadge="--no-download-badge" -fi - - # Use iPhoneSimulator SDK # See: https://github.com/realm/jazzy/issues/791 jazzy \ @@ -47,5 +38,4 @@ jazzy \ --xcodebuild-arguments --objc,shell/platform/darwin/ios/framework/Headers/Flutter.h,--,-x,objective-c,-isysroot,"$(xcrun --show-sdk-path --sdk iphonesimulator)",-I,"$(pwd)"\ --module Flutter\ --root-url https://docs.flutter.io/objc/\ - --output "$1"\ - $noDownloadBadge + --output "$1" From 13064aec87e0c34bad9e4fc8cbf283d1e04f2e89 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Sat, 2 Mar 2019 10:01:51 -0800 Subject: [PATCH 0331/1117] Add overloads for lookup that lets you specify a bundle (#8007) * Add overloads for lookup that lets you specify a bundle * check bundle with defaultBundleIdentifier before main bundle --- .../framework/Headers/FlutterDartProject.h | 29 +++++++++++++++++-- .../framework/Source/FlutterDartProject.mm | 21 ++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h b/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h index c2b4339d55b33..032d1c281f3a2 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h @@ -26,14 +26,26 @@ FLUTTER_EXPORT - (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. + * Returns the file name for the given asset. If the bundle with the identifier + * "io.flutter.flutter.app" exists, it will try use that bundle; otherwise, it + * will use the main bundle. To specify a different bundle, use + * `-lookupKeyForAsset:asset:fromBundle`. * * @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. + * The returned file name can be used to access the asset in the supplied bundle. + * + * @param asset The name of the asset. The name can be hierarchical. + * @param bundle The `NSBundle` to use for looking up the asset. + * @return the file name to be used for lookup in the main bundle. + */ ++ (NSString*)lookupKeyForAsset:(NSString*)asset fromBundle:(NSBundle*)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. @@ -44,6 +56,19 @@ FLUTTER_EXPORT */ + (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package; +/** + * 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 specified 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. + * @param bundle The bundle to use when doing the lookup. + * @return the file name to be used for lookup in the main bundle. + */ ++ (NSString*)lookupKeyForAsset:(NSString*)asset + fromPackage:(NSString*)package + fromBundle:(NSBundle*)bundle; + /** * Returns the default identifier for the bundle where we expect to find the Flutter Dart * application. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index 229e620aa6184..4e0c97b3f113a 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -199,6 +199,12 @@ - (instancetype)initWithPrecompiledDartBundle:(NSBundle*)bundle { #pragma mark - Assets-related utilities + (NSString*)flutterAssetsName:(NSBundle*)bundle { + if (bundle == nil) { + bundle = [NSBundle bundleWithIdentifier:[FlutterDartProject defaultBundleIdentifier]]; + } + if (bundle == nil) { + bundle = [NSBundle mainBundle]; + } NSString* flutterAssetsName = [bundle objectForInfoDictionaryKey:@"FLTAssetsPath"]; if (flutterAssetsName == nil) { flutterAssetsName = @"Frameworks/App.framework/flutter_assets"; @@ -207,12 +213,23 @@ + (NSString*)flutterAssetsName:(NSBundle*)bundle { } + (NSString*)lookupKeyForAsset:(NSString*)asset { - NSString* flutterAssetsName = [FlutterDartProject flutterAssetsName:[NSBundle mainBundle]]; + return [self lookupKeyForAsset:asset fromBundle:nil]; +} + ++ (NSString*)lookupKeyForAsset:(NSString*)asset fromBundle:(NSBundle*)bundle { + NSString* flutterAssetsName = [FlutterDartProject flutterAssetsName:bundle]; return [NSString stringWithFormat:@"%@/%@", flutterAssetsName, asset]; } + (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package { - return [self lookupKeyForAsset:[NSString stringWithFormat:@"packages/%@/%@", package, asset]]; + return [self lookupKeyForAsset:asset fromPackage:package fromBundle:nil]; +} + ++ (NSString*)lookupKeyForAsset:(NSString*)asset + fromPackage:(NSString*)package + fromBundle:(NSBundle*)bundle { + return [self lookupKeyForAsset:[NSString stringWithFormat:@"packages/%@/%@", package, asset] + fromBundle:bundle]; } + (NSString*)defaultBundleIdentifier { From 75cd4df37e4021891d2d92e53fe5e7318509dbd8 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 2 Mar 2019 13:56:53 -0500 Subject: [PATCH 0332/1117] Roll src/third_party/skia 9159c8ef83b2..c945f0e31a53 (1 commits) (#8015) https://skia.googlesource.com/skia.git/%2Blog/9159c8ef83b2..c945f0e31a53 git log 9159c8ef83b2b333551f68664f9fb50fc266c822..c945f0e31a5396a4ff6347d45a908b529233ed0c --date=short --no-merges --format=%ad %ae %s 2019-03-02 reed@google.com Revert "use colorspace steps to determine legacy blits" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 2e6b340fa68fb..55e0116bb51dd 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': '9159c8ef83b2b333551f68664f9fb50fc266c822', + 'skia_revision': 'c945f0e31a5396a4ff6347d45a908b529233ed0c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b2a1f539fac23..36d348f4ff23a 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8d6cea6aa16d0318dcbc001d404da797 +Signature: d96848bf5de6abdc53e79865c89ffedd UNUSED LICENSES: From 01d8a1f27fa5aa628ac6afcfe3e22b9721922a08 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 2 Mar 2019 18:20:12 -0500 Subject: [PATCH 0333/1117] Roll src/third_party/skia c945f0e31a53..0d7012a80c17 (1 commits) (#8016) https://skia.googlesource.com/skia.git/%2Blog/c945f0e31a53..0d7012a80c17 git log c945f0e31a5396a4ff6347d45a908b529233ed0c..0d7012a80c178448a9b090816268c7933661cb89 --date=short --no-merges --format=%ad %ae %s 2019-03-02 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src cddf8925a8d8..7761d0dc32ad (267 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (scroggo@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 55e0116bb51dd..0e370320c4c2f 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': 'c945f0e31a5396a4ff6347d45a908b529233ed0c', + 'skia_revision': '0d7012a80c178448a9b090816268c7933661cb89', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 36d348f4ff23a..2a1098c15adec 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: d96848bf5de6abdc53e79865c89ffedd +Signature: 557e3ada683173376df67bcea7dac16e UNUSED LICENSES: From cdc1410721602a531ed78b1567a3f636ea0ba11f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 2 Mar 2019 22:25:27 -0500 Subject: [PATCH 0334/1117] Roll src/third_party/skia 0d7012a80c17..58a75383a70b (1 commits) (#8017) https://skia.googlesource.com/skia.git/%2Blog/0d7012a80c17..58a75383a70b git log 0d7012a80c178448a9b090816268c7933661cb89..58a75383a70b3311bc4079e8cc834435e1dc24d5 --date=short --no-merges --format=%ad %ae %s 2019-03-02 reed@google.com change particleslide to use Resources The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 0e370320c4c2f..e047110ced262 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': '0d7012a80c178448a9b090816268c7933661cb89', + 'skia_revision': '58a75383a70b3311bc4079e8cc834435e1dc24d5', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the From a28329cb91ac18ad4d7950b3b170a74a8de979ee Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 3 Mar 2019 02:51:55 -0500 Subject: [PATCH 0335/1117] Roll src/third_party/skia 58a75383a70b..c97b0672a73f (1 commits) (#8018) https://skia.googlesource.com/skia.git/%2Blog/58a75383a70b..c97b0672a73f git log 58a75383a70b3311bc4079e8cc834435e1dc24d5..c97b0672a73fec6f91392572ec9907e2563f977e --date=short --no-merges --format=%ad %ae %s 2019-03-03 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index e047110ced262..41cd76a0fb2bc 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': '58a75383a70b3311bc4079e8cc834435e1dc24d5', + 'skia_revision': 'c97b0672a73fec6f91392572ec9907e2563f977e', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2a1098c15adec..64856a7e1f99c 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 557e3ada683173376df67bcea7dac16e +Signature: 2cd1a23cd0df9c367fddf0b0b155e207 UNUSED LICENSES: From e9eae9a1af77400d02c498f0ad943f2858845398 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 3 Mar 2019 07:21:31 -0500 Subject: [PATCH 0336/1117] Roll src/third_party/skia c97b0672a73f..1b9f889628e0 (1 commits) (#8019) https://skia.googlesource.com/skia.git/%2Blog/c97b0672a73f..1b9f889628e0 git log c97b0672a73fec6f91392572ec9907e2563f977e..1b9f889628e06943b513ff0c3fa92b697f74fe3e --date=short --no-merges --format=%ad %ae %s 2019-03-03 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update SKP version The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 41cd76a0fb2bc..8dead7105ad7a 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': 'c97b0672a73fec6f91392572ec9907e2563f977e', + 'skia_revision': '1b9f889628e06943b513ff0c3fa92b697f74fe3e', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 64856a7e1f99c..cc1d8b2641ef9 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2cd1a23cd0df9c367fddf0b0b155e207 +Signature: 73c98299e045f328ed19b7afd55d4a9c UNUSED LICENSES: From b44a9305c71d67495d1f7546ea1dabfeecd3543f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 3 Mar 2019 11:50:08 -0500 Subject: [PATCH 0337/1117] Roll src/third_party/skia 1b9f889628e0..c6671be0ea75 (1 commits) (#8020) https://skia.googlesource.com/skia.git/%2Blog/1b9f889628e0..c6671be0ea75 git log 1b9f889628e06943b513ff0c3fa92b697f74fe3e..c6671be0ea75880626807c4c40792b2cb1301a39 --date=short --no-merges --format=%ad %ae %s 2019-03-03 reed@google.com Revert "bring back lowp bilerp_clamp_8888" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 8dead7105ad7a..f073bb513f6ca 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': '1b9f889628e06943b513ff0c3fa92b697f74fe3e', + 'skia_revision': 'c6671be0ea75880626807c4c40792b2cb1301a39', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index cc1d8b2641ef9..351132fe1ca9e 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 73c98299e045f328ed19b7afd55d4a9c +Signature: 2b57e01df9555987af14385e5f1867f6 UNUSED LICENSES: From 75e2b4702c777af4547526acfb9ba11a745ba7e8 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 3 Mar 2019 16:15:00 -0500 Subject: [PATCH 0338/1117] Roll src/third_party/skia c6671be0ea75..c1a9feb6f06e (2 commits) (#8021) https://skia.googlesource.com/skia.git/%2Blog/c6671be0ea75..c1a9feb6f06e git log c6671be0ea75880626807c4c40792b2cb1301a39..c1a9feb6f06edc41cce044b7da4f5e4a2e5055a5 --date=short --no-merges --format=%ad %ae %s 2019-03-03 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 7761d0dc32ad..aae499d4d09d (42 commits) 2019-03-03 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f073bb513f6ca..b8f10d1fda713 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': 'c6671be0ea75880626807c4c40792b2cb1301a39', + 'skia_revision': 'c1a9feb6f06edc41cce044b7da4f5e4a2e5055a5', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 351132fe1ca9e..af5ce50c771e2 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2b57e01df9555987af14385e5f1867f6 +Signature: 6c7bb3eabee8dc2bd7a4d99b27f9adb4 UNUSED LICENSES: From 4f54a1dd944497bd1ec0f2acca22ff9fbd8b377a Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 3 Mar 2019 20:50:07 -0500 Subject: [PATCH 0339/1117] Roll src/third_party/skia c1a9feb6f06e..5800f2e8a920 (2 commits) (#8022) https://skia.googlesource.com/skia.git/%2Blog/c1a9feb6f06e..5800f2e8a920 git log c1a9feb6f06edc41cce044b7da4f5e4a2e5055a5..5800f2e8a920ed57c66cde8f6f29c1af376e7661 --date=short --no-merges --format=%ad %ae %s 2019-03-03 reed@google.com Reland "use colorspace steps to determine legacy blits" 2019-03-03 reed@google.com Reland "bring back lowp bilerp_clamp_8888" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index b8f10d1fda713..8530e49a065eb 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': 'c1a9feb6f06edc41cce044b7da4f5e4a2e5055a5', + 'skia_revision': '5800f2e8a920ed57c66cde8f6f29c1af376e7661', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index af5ce50c771e2..4fcc7e5a33796 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 6c7bb3eabee8dc2bd7a4d99b27f9adb4 +Signature: c3fc29250d07962ef7acf39c704bd8e8 UNUSED LICENSES: From 48bf4803eec7f84eb58c55bbdee57c2c0f1fb4d3 Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Mon, 4 Mar 2019 15:10:24 -0500 Subject: [PATCH 0340/1117] [fuchsia] Fix snapshot BUILD.gn file for Fuchsia roll (#8024) --- lib/snapshot/BUILD.gn | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn index b12dfe4d6db6d..ca00ad71efa80 100644 --- a/lib/snapshot/BUILD.gn +++ b/lib/snapshot/BUILD.gn @@ -211,9 +211,13 @@ bin_to_linkable("isolate_snapshot_instructions_linkable") { bin_to_linkable("platform_strong_dill_linkable") { deps = [ - ":strong_platform", + ":kernel_platform_files", ] - input = "$root_out_dir/flutter_patched_sdk/platform_strong.dill" + if (is_fuchsia || is_fuchsia_host) { + input = "$root_out_dir/flutter_runner_patched_sdk/platform_strong.dill" + } else { + input = "$root_out_dir/flutter_patched_sdk/platform_strong.dill" + } symbol = "kPlatformStrongDill" size_symbol = "kPlatformStrongDillSize" executable = false From a2246c1990843b174a6fd8dcdfb99e829d6746e8 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Mon, 4 Mar 2019 13:55:53 -0800 Subject: [PATCH 0341/1117] Start of linting Android embedding (#8023) * Add a tool for running Android SDK lint on Android embedding --- shell/platform/android/AndroidManifest.xml | 2 +- tools/android_lint/.gitignore | 1 + tools/android_lint/bin/main.dart | 148 +++++++++++++++++++++ tools/android_lint/project.xml | 81 +++++++++++ tools/android_lint/pubspec.yaml | 5 + 5 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 tools/android_lint/.gitignore create mode 100644 tools/android_lint/bin/main.dart create mode 100644 tools/android_lint/project.xml create mode 100644 tools/android_lint/pubspec.yaml diff --git a/shell/platform/android/AndroidManifest.xml b/shell/platform/android/AndroidManifest.xml index 2c5c91095d2f2..7e10898269888 100644 --- a/shell/platform/android/AndroidManifest.xml +++ b/shell/platform/android/AndroidManifest.xml @@ -5,7 +5,7 @@ --> - + diff --git a/tools/android_lint/.gitignore b/tools/android_lint/.gitignore new file mode 100644 index 0000000000000..e44752dc2001b --- /dev/null +++ b/tools/android_lint/.gitignore @@ -0,0 +1 @@ +lint_report/ diff --git a/tools/android_lint/bin/main.dart b/tools/android_lint/bin/main.dart new file mode 100644 index 0000000000000..4254fd2d20124 --- /dev/null +++ b/tools/android_lint/bin/main.dart @@ -0,0 +1,148 @@ +// Copyright 2013 The Flutter 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 'dart:io'; + +import 'package:args/args.dart'; +import 'package:path/path.dart' as path; +import 'package:process/process.dart'; + +const LocalProcessManager processManager = LocalProcessManager(); + +/// Runs the Android SDK Lint tool on flutter/shell/platform/android. +/// +/// This script scans the flutter/shell/platform/android directory for Java +/// files to build a `project.xml` file. This file is then passed to the lint +/// tool and HTML output is reqeusted in the directory for the `--out` +/// parameter, which defaults to `lint_report`. +/// +/// The `--in` parameter may be specified to force this script to scan a +/// specific location for the engine repository, and expects to be given the +/// `src` directory that contains both `third_party` and `flutter`. +/// +/// At the time of this writing, the Android Lint tool doesn't work well with +/// Java > 1.8. This script will print a warning if you are not running +/// Java 1.8. +Future main(List args) async { + final ArgParser argParser = setupOptions(); + await checkJava1_8(); + final int exitCode = await runLint(argParser, argParser.parse(args)); + exit(exitCode); +} + +Future runLint(ArgParser argParser, ArgResults argResults) async { + final Directory androidDir = Directory(path.join( + argResults['in'], + 'flutter', + 'shell', + 'platform', + 'android', + )); + if (!androidDir.existsSync()) { + print('This command must be run from the engine/src directory, ' + 'or be passed that directory as the --in parameter.\n'); + print(argParser.usage); + return -1; + } + + final Directory androidSdkDir = Directory( + path.join(argResults['in'], 'third_party', 'android_tools', 'sdk'), + ); + + if (!androidSdkDir.existsSync()) { + print('The Android SDK for this engine is missing from the ' + 'third_party/android_tools directory. Have you run gclient sync?\n'); + print(argParser.usage); + return -1; + } + + final IOSink projectXml = File('./project.xml').openWrite(); + projectXml.write( + ''' + + + + + +'''); + for (final FileSystemEntity entity in androidDir.listSync(recursive: true)) { + if (!entity.path.endsWith('.java')) { + continue; + } + projectXml.writeln(' '); + } + + projectXml.write(''' + +'''); + await projectXml.close(); + + print('Wrote project.xml, starting lint...'); + final ProcessResult result = await processManager.run( + [ + path.join(androidSdkDir.path, 'tools', 'bin', 'lint'), + '--project', + './project.xml', + '--html', + argResults['out'], + '--showall', + '--exitcode', // Set non-zero exit code on errors + '-Wall', + '-Werror', + ], + ); + if (result.stderr != null) { + print('Lint tool had internal errors:'); + print(result.stderr); + } + print(result.stdout); + return result.exitCode; +} + +ArgParser setupOptions() { + final ArgParser argParser = ArgParser(); + argParser.addOption( + 'in', + help: 'The path to `engine/src`.', + defaultsTo: path.relative( + path.join( + path.dirname( + path.dirname(path.dirname(path.fromUri(Platform.script))), + ), + '..', + '..', + ), + ), + ); + argParser.addOption( + 'out', + help: 'The path to write the generated the HTML report to.', + defaultsTo: 'lint_report', + ); + argParser.addFlag( + 'help', + help: 'Print usage of the command.', + negatable: false, + defaultsTo: false, + ); + + return argParser; +} + +Future checkJava1_8() async { + print('Checking Java version...'); + final ProcessResult javaResult = await processManager.run( + ['java', '-version'], + ); + if (javaResult.exitCode != 0) { + print('Could not run "java -version". ' + 'Ensure Java is installed and available on your path.'); + print(javaResult.stderr); + } + final String javaVersionStdout = javaResult.stdout; + if (javaVersionStdout.contains('"1.8')) { + print('The Android SDK tools may not work properly with your Java version. ' + 'If this process fails, please retry using Java 1.8.'); + } +} diff --git a/tools/android_lint/project.xml b/tools/android_lint/project.xml new file mode 100644 index 0000000000000..6d8fffe439f3e --- /dev/null +++ b/tools/android_lint/project.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/android_lint/pubspec.yaml b/tools/android_lint/pubspec.yaml new file mode 100644 index 0000000000000..b27131c37c920 --- /dev/null +++ b/tools/android_lint/pubspec.yaml @@ -0,0 +1,5 @@ +name: android_lint +dependencies: + args: 1.5.0 + path: ^1.6.2 + process: ^3.0.9 From f3d4a7f71d403222ea27d679ff8d8ead487b471d Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 4 Mar 2019 13:39:35 -0800 Subject: [PATCH 0342/1117] Roll src/third_party/dart 7c70ab1817..7d8ffe0daf (77 commits) 7d8ffe0daf Eliminate uses of old AST node types from pkg/analyzer/lib/src/test_utilities 2e463506b7 Read more nodes from serialized AST. e91c3b3ab4 Update pkg:html version to 0.13.4+1 819f44532c Eliminate uses of old AST node types from pkg/analyzer/lib/src/task/strong 095e651ff2 Eliminate uses of old AST node types from pkg/analyzer/lib/src/services 2c087433db [co19] DEPS and status files updated b095a6be8e [infra] Update checked in SDKs to 2.2.1-dev.0.0 f46186ac49 [infra] Fix update_flakiness using wrong key when computing matches. 03e46ee969 [infra] Add expectation and matches information to flaky.json. 15f1fc212c Add a flag to allow only analyzing project folders that contain open files bc2b78886d [CFE] handle set literals in constant evaluator. 2b2e71770c [kernel] Add SetConstant node to Kernel. 084e98e3a3 [VM] Ensure that a newly allocated object is either new or added to remembered set if we want to eliminate write barriers to it 95cfa6c583 Support native class and js-interop annotations through ir constants 62d22083ac Flatten native member resolver 053dfbb2ac [cfe] Compile list spread elements into block expressions 1e0d514469 Address comments from a previous CL 156790474e Allocate fieldOffsets once, in computeFieldOffsets(). 4a144e631f Fix production of outline for incomplete generic function types (issue 36059) 4bd3e4b561 Write more AST nodes to summary. fa2d32e80a [ddc] Add api to query loaded libs 5a335957f2 [analyzer] fix #33119, add strict-raw-types flag 76d31a251e [dartdevc] fix hot restart static field reset 2f158b9997 Add ABI_VERSION to the version file and a script to upload dills to CPID 0491d5cde7 Revert "[VM runtime] Dual mapping of executable pages." 5f9bd87689 Eliminate uses of old AST node types from parts of the analyzer 38d675287c Eliminate uses of old AST node types from parts of the analyzer df59b09756 Fail early if a thread has no stack headroom 44186dfdcd [VM runtime] Dual mapping of executable pages. 298866ed94 Write / read resolved AST to / from flat buffers. 863f7df7aa Include debug info when dart:core is not resolved. f00fe7a289 Rework of downward inference for the ui-as-code features 1a9f40b1c5 [VM] Remove unnecessary assert to fix cc/PrintJSON test c2a48ee065 [VM] Fix bigint left shift that could cause heap corruption when intrinsified. 9201b906ee Convert ir.Constant to ConstantValue dc555eb9a7 [vm] On Fuchsia, enable timeline streams based on the state of system trace categories. 644026da51 Eliminate uses of old AST node types from AstFactory c35304ef18 [vm/simdbc,interpreter] Preserve arguments descriptor around call to inline cache miss handler a681a6297a [vm/incremental compiler] Add reject/compile_expresson test for incremental compiler. ce1fb830d0 [infra] Suggest running gsutil.py config in approve_results if needed. 2c8f70cde3 [cfe] Add type inference for spreads in set literals b36c56ff84 [cfe] Add type inference for spreads in list literals e4aa4325b7 [fasta] Enable spread collections in unit tests 1471b8e444 Revert "[CFE] Move constant evaluation number semantics handling to front end." 6e06047004 AST to Text more resilient in writeAdditionalExports c2b466b09f [CFE] Move constant evaluation number semantics handling to front end. b60b664b16 [infra] Make gclient sync quiet when nothing is updated. 9a0a3fd8c1 Eliminate uses of old AST node types from analyzer_plugin ba4cfb8613 Initial computation of initializer complexity through the scope visitor. 15515d86e3 Reland "[analyzer] Constant verifier support for SetOrMapLiteral" 9bec44d1e2 Revert "[analyzer] Constant verifier support for SetOrMapLiteral" d73bc49420 DEPS: update html, http_parser, logging, package_resolver, source_span 9c6315c199 [analyzer] Constant verifier support for SetOrMapLiteral 67366ed771 Support for @Variant and @VariantId in generator. 16fc751e49 [fuchsia] Clean-up after the FIDL string/vector types transition 1d3a0d5129 Revert "[vm/ffi] Stress tests for FFI functions." 24df9cc588 [vm] Implement interpreter stubs for ARM, SIMARM and SIMARM64. e8d6e2f704 [ VM ] Updated SourceReport tests with correct token positions 19dbd70363 Catch errors in formatting function types 2259695037 [vm, gc] Document object representation. 223f407af5 [gardening] Skip ffi/negative_function_test on asan bot c2e48195f0 Rename UiAsCodeVisitorMixin to UIAsCodeVisitorMixin 48ee388791 Fix a typo in a shared test 545ebe1741 Prepare to publish analyzer 0.35.3 17195d2667 Eliminate uses of old AST node types from dev_compiler a417659fcd debug dartfix test a10b0d8763 [vm/compiler] LICM and CSE improvements ff6f61c872 [VM / Observatory ] Remove needless stacktrace print when adding to closed socket a51c9f15cc Make optype compatible with previous versions of analyzer. a2eac98753 Merge HintCodeTest_Driver into HintCodeTest. 9d609426b2 [vm] Update status file for standalone_2/ffi/function_stress_test bab9d2ad05 [vm] Remember GenericCovariantImpl in TypeParameter 3dcc0c69a1 [vm] Fix windows build after "[vm/ffi] Stress tests for FFI functions." 1596f437bd debug dartfix test fa8ba53b52 [infra] Add a script that appends fields with previous results to result data b186a270e4 [vm/ffi] Stress tests for FFI functions. 7dec865054 Add set literal support to the flutter outline computer --- DEPS | 10 +++++----- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/DEPS b/DEPS index 8530e49a065eb..f0c255780dfbe 100644 --- a/DEPS +++ b/DEPS @@ -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': '7c70ab1817ad6553f21fadadf0a88fe568ee8745', + 'dart_revision': '7d8ffe0daf8148dd281884ec3911f1274e21f0af', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -52,9 +52,9 @@ vars = { 'dart_dartdoc_tag': 'v0.28.2', 'dart_fixnum_tag': '0.10.9', 'dart_glob_tag': '1.1.7', - 'dart_html_tag': '0.13.3+2', + 'dart_html_tag': '0.13.4+1', 'dart_http_multi_server_tag': '2.0.5', - 'dart_http_parser_tag': '3.1.1', + 'dart_http_parser_tag': '3.1.3', 'dart_http_retry_tag': '0.1.1', 'dart_http_tag': '0.12.0', 'dart_http_throttle_tag': '1.0.2', @@ -70,7 +70,7 @@ vars = { 'dart_oauth2_tag': '1.2.1', 'dart_observatory_pub_packages_rev': '0894122173b0f98eb08863a7712e78407d4477bc', 'dart_package_config_tag': '1.0.5', - 'dart_package_resolver_tag': '1.0.4', + 'dart_package_resolver_tag': '1.0.10', 'dart_path_tag': '1.6.2', 'dart_plugin_tag': 'f5b4b0e32d1406d62daccea030ba6457d14b1c47', 'dart_pool_tag': '1.3.6', @@ -86,7 +86,7 @@ vars = { 'dart_shelf_web_socket_tag': '0.2.2+3', 'dart_source_map_stack_trace_tag': '1.1.5', 'dart_source_maps_tag': '8af7cc1a1c3a193c1fba5993ce22a546a319c40e', - 'dart_source_span_tag': '1.4.1', + 'dart_source_span_tag': '1.5.5', 'dart_stack_trace_tag': '1.9.3', 'dart_stream_channel_tag': '1.6.8', 'dart_string_scanner_tag': '1.0.3', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 28067d13e0b2d..5ade61510b999 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 80f68675dab65099e7156f61547b4d56 +Signature: 1405abeaed1a76feefc683d14369d056 UNUSED LICENSES: From 3d53e2026a70f098e3bb789d6bfb338ad879e57e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 4 Mar 2019 18:05:13 -0500 Subject: [PATCH 0343/1117] Roll src/third_party/skia 5800f2e8a920..e3e80b7edfd1 (2 commits) (#8028) https://skia.googlesource.com/skia.git/%2Blog/5800f2e8a920..e3e80b7edfd1 git log 5800f2e8a920ed57c66cde8f6f29c1af376e7661..e3e80b7edfd1d31724ef789b7d879d0fee5e52f2 --date=short --no-merges --format=%ad %ae %s 2019-03-04 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-03-04 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f0c255780dfbe..6775e0e664399 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': '5800f2e8a920ed57c66cde8f6f29c1af376e7661', + 'skia_revision': 'e3e80b7edfd1d31724ef789b7d879d0fee5e52f2', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 4fcc7e5a33796..78e6827b929ff 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c3fc29250d07962ef7acf39c704bd8e8 +Signature: 6a5e4c2b1031c3a8cc1b8d5e0524d4dc UNUSED LICENSES: From 36ca5740c7e39e25d7ac22c755e66525b92fbb56 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Mon, 4 Mar 2019 15:55:32 -0800 Subject: [PATCH 0344/1117] [platform_views] Fix duplicated touch event pass down to flutter view from platform view. (#8026) Fix for flutter/flutter#27700 and flutter/flutter#24207 There are 2 fixes included in this PR. The intercepting views sometime pass up the touches events to flutter view, even after the forward gesture recognizer pass the event to the flutter view. We only want the event to be passed to the flutter view once. So we let the intercepting view 'consumes' the event in this PR to fix the problem. When a touch sequence has multiple touch points participated(e.g. Pinch gesture), the touchesBegan and touchesEnded can be triggered multiple times if the touches do not happen simultaneously. One example would be: when performing a pinch gesture with 2 fingers, I put down one finger, keep the finger on the screen, then put down another finger, perform pinch, lift up both finger at the same time. In this sequence, touchesBegan is called twice with each touch in one of the calls and touchesEnded is called once and has 2 touches in the callback. To handle this issue, we added a count to count the touches in one touch sequence. We only set the state to fail when the count reaches 0(That is all the touches has began in the current sequence is ended). --- .../framework/Source/FlutterPlatformViews.mm | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm index 3452807bcdeb5..2bd198af6bf12 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm @@ -353,6 +353,21 @@ - (void)blockGesture { _delayingRecognizer.get().state = UIGestureRecognizerStateEnded; } +// We want the intercepting view to consume the touches and not pass the touches up to the parent +// view. Make the touch event method not call super will not pass the touches up to the parent view. +// Hence we overide the touch event methods and do nothing. +- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { +} + +- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { +} + +- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event { +} + +- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event { +} + @end @implementation DelayingGestureRecognizer { @@ -395,6 +410,8 @@ @implementation ForwardingGestureRecognizer { // So this is safe as when FlutterView is deallocated the reference to ForwardingGestureRecognizer // will go away. UIView* _flutterView; + // Counting the pointers that has started in one touch sequence. + NSInteger _currentTouchPointersCount; } - (instancetype)initWithTarget:(id)target flutterView:(UIView*)flutterView { @@ -402,12 +419,15 @@ - (instancetype)initWithTarget:(id)target flutterView:(UIView*)flutterView { if (self) { self.delegate = self; _flutterView = flutterView; + _currentTouchPointersCount = 0; } return self; } - (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { [_flutterView touchesBegan:touches withEvent:event]; + _currentTouchPointersCount += touches.count; + [_flutterView touchesBegan:touches withEvent:event]; } - (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { @@ -416,11 +436,19 @@ - (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { - (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event { [_flutterView touchesEnded:touches withEvent:event]; - self.state = UIGestureRecognizerStateFailed; + _currentTouchPointersCount -= touches.count; + // Touches in one touch sequence are sent to the touchesEnded method separately if different + // fingers stop touching the screen at different time. So one touchesEnded method triggering does + // not necessarially mean the touch sequence has ended. We Only set the state to + // UIGestureRecognizerStateFailed when all the touches in the current touch sequence is ended. + if (_currentTouchPointersCount == 0) { + self.state = UIGestureRecognizerStateFailed; + } } - (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event { [_flutterView touchesCancelled:touches withEvent:event]; + _currentTouchPointersCount = 0; self.state = UIGestureRecognizerStateFailed; } From fb3e35d6aca6ab6901d315698551855e25dc98a2 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Mon, 4 Mar 2019 17:12:52 -0800 Subject: [PATCH 0345/1117] Android Embedding PR15: Add Viewport Metrics to FlutterView (#8029) --- .../engine/android/FlutterSurfaceView.java | 13 +++- .../engine/android/FlutterTextureView.java | 12 ++-- .../embedding/engine/android/FlutterView.java | 66 +++++++++++++++++-- .../engine/renderer/FlutterRenderer.java | 60 ++++++++++------- 4 files changed, 113 insertions(+), 38 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java index edbe8645d32d1..dc52f9e6d46f9 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java @@ -56,6 +56,7 @@ public void surfaceCreated(SurfaceHolder holder) { @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { + Log.d(TAG, "SurfaceHolder.Callback.surfaceChanged()"); if (isAttachedToFlutterRenderer) { changeSurfaceSize(width, height); } @@ -97,13 +98,17 @@ private void init() { * Invoked by the owner of this {@code FlutterSurfaceView} when it wants to begin rendering * a Flutter UI to this {@code FlutterSurfaceView}. * - * If an Android {@link android.view.Surface} is available, this method will begin rendering - * {@link FlutterRenderer}'s Flutter UI to this {@code FlutterSurfaceView}. + * If an Android {@link android.view.Surface} is available, this method will give that + * {@link android.view.Surface} to the given {@link FlutterRenderer} to begin rendering + * Flutter's UI to this {@code FlutterSurfaceView}. * * If no Android {@link android.view.Surface} is available yet, this {@code FlutterSurfaceView} - * will wait until a {@link android.view.Surface} becomes available and then begin rendering. + * will wait until a {@link android.view.Surface} becomes available and then give that + * {@link android.view.Surface} to the given {@link FlutterRenderer} to begin rendering + * Flutter's UI to this {@code FlutterSurfaceView}. */ public void attachToRenderer(@NonNull FlutterRenderer flutterRenderer) { + Log.d(TAG, "attachToRenderer"); if (this.flutterRenderer != null) { this.flutterRenderer.detachFromRenderSurface(); } @@ -114,6 +119,7 @@ public void attachToRenderer(@NonNull FlutterRenderer flutterRenderer) { // If we're already attached to an Android window then we're now attached to both a renderer // and the Android window. We can begin rendering now. if (isSurfaceAvailableForRendering) { + Log.d(TAG, "Surface is available for rendering. Connecting."); connectSurfaceToRenderer(); } } @@ -179,5 +185,6 @@ public void updateSemantics(ByteBuffer buffer, String[] strings) { @Override public void onFirstFrameRendered() { // TODO(mattcarroll): decide where this method should live and what it needs to do. + Log.d(TAG, "onFirstFrameRendered()"); } } diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java index 8ea3fee2d6327..c12c2fa4274fc 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java @@ -111,11 +111,14 @@ private void init() { * Invoked by the owner of this {@code FlutterTextureView} when it wants to begin rendering * a Flutter UI to this {@code FlutterTextureView}. * - * If an Android {@link SurfaceTexture} is available, this method will begin rendering - * {@link FlutterRenderer}'s Flutter UI to this {@code FlutterTextureView}. + * If an Android {@link SurfaceTexture} is available, this method will give that + * {@link SurfaceTexture} to the given {@link FlutterRenderer} to begin rendering + * Flutter's UI to this {@code FlutterTextureView}. * - * If no Android {@link SurfaceTexture} is available yet, this {@code FlutterSurfaceView} - * will wait until a {@link SurfaceTexture} becomes available and then begin rendering. + * If no Android {@link SurfaceTexture} is available yet, this {@code FlutterTextureView} + * will wait until a {@link SurfaceTexture} becomes available and then give that + * {@link SurfaceTexture} to the given {@link FlutterRenderer} to begin rendering + * Flutter's UI to this {@code FlutterTextureView}. */ public void attachToRenderer(@NonNull FlutterRenderer flutterRenderer) { if (this.flutterRenderer != null) { @@ -193,5 +196,6 @@ public void updateSemantics(ByteBuffer buffer, String[] strings) { @Override public void onFirstFrameRendered() { // TODO(mattcarroll): decide where this method should live and what it needs to do. + Log.d(TAG, "onFirstFrameRendered()"); } } diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java index fad69bac0ed97..aee6a5a95547c 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java @@ -17,10 +17,9 @@ import android.view.KeyEvent; import android.view.MotionEvent; import android.view.WindowInsets; +import android.view.WindowManager; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; -import android.view.inputmethod.InputMethod; -import android.view.inputmethod.InputMethodManager; import android.widget.FrameLayout; import java.util.ArrayList; @@ -30,6 +29,7 @@ import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.renderer.FlutterRenderer; import io.flutter.plugin.editing.TextInputPlugin; +import io.flutter.view.VsyncWaiter; /** * Displays a Flutter UI on an Android device. @@ -77,6 +77,9 @@ public class FlutterView extends FrameLayout { @Nullable private AndroidKeyProcessor androidKeyProcessor; + // Directly implemented View behavior that communicates with Flutter. + private final FlutterRenderer.ViewportMetrics viewportMetrics = new FlutterRenderer.ViewportMetrics(); + /** * Constructs a {@code FlutterSurfaceView} programmatically, without any XML attributes. * @@ -158,8 +161,10 @@ protected void onConfigurationChanged(Configuration newConfig) { */ @Override protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) { - // TODO(mattcarroll): hookup to viewport metrics. super.onSizeChanged(width, height, oldWidth, oldHeight); + viewportMetrics.width = width; + viewportMetrics.height = height; + sendViewportMetricsToFlutter(); } /** @@ -174,8 +179,22 @@ protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) */ @Override public final WindowInsets onApplyWindowInsets(WindowInsets insets) { - // TODO(mattcarroll): hookup to Flutter metrics. - return insets; + WindowInsets newInsets = super.onApplyWindowInsets(insets); + + // Status bar (top) and left/right system insets should partially obscure the content (padding). + viewportMetrics.paddingTop = insets.getSystemWindowInsetTop(); + viewportMetrics.paddingRight = insets.getSystemWindowInsetRight(); + viewportMetrics.paddingBottom = 0; + viewportMetrics.paddingLeft = insets.getSystemWindowInsetLeft(); + + // Bottom system inset (keyboard) should adjust scrollable bottom edge (inset). + viewportMetrics.viewInsetTop = 0; + viewportMetrics.viewInsetRight = 0; + viewportMetrics.viewInsetBottom = insets.getSystemWindowInsetBottom(); + viewportMetrics.viewInsetLeft = 0; + sendViewportMetricsToFlutter(); + + return newInsets; } /** @@ -188,8 +207,23 @@ public final WindowInsets onApplyWindowInsets(WindowInsets insets) { @Override @SuppressWarnings("deprecation") protected boolean fitSystemWindows(Rect insets) { - // TODO(mattcarroll): hookup to Flutter metrics. - return super.fitSystemWindows(insets); + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { + // Status bar, left/right system insets partially obscure content (padding). + viewportMetrics.paddingTop = insets.top; + viewportMetrics.paddingRight = insets.right; + viewportMetrics.paddingBottom = 0; + viewportMetrics.paddingLeft = insets.left; + + // Bottom system inset (keyboard) should adjust scrollable bottom edge (inset). + viewportMetrics.viewInsetTop = 0; + viewportMetrics.viewInsetRight = 0; + viewportMetrics.viewInsetBottom = insets.bottom; + viewportMetrics.viewInsetLeft = 0; + sendViewportMetricsToFlutter(); + return true; + } else { + return super.fitSystemWindows(insets); + } } //------- End: Process View configuration that Flutter cares about. -------- @@ -312,13 +346,16 @@ public boolean onHoverEvent(MotionEvent event) { * {@link FlutterEngine}. */ public void attachToFlutterEngine(@NonNull FlutterEngine flutterEngine) { + Log.d(TAG, "attachToFlutterEngine()"); if (isAttachedToFlutterEngine()) { if (flutterEngine == this.flutterEngine) { // We are already attached to this FlutterEngine + Log.d(TAG, "Already attached to this engine. Doing nothing."); return; } // Detach from a previous FlutterEngine so we can attach to this new one. + Log.d(TAG, "Currently attached to a different engine. Detaching."); detachFromFlutterEngine(); } @@ -346,6 +383,7 @@ public void attachToFlutterEngine(@NonNull FlutterEngine flutterEngine) { // Push View and Context related information from Android to Flutter. sendUserSettingsToFlutter(); sendLocalesToFlutter(getResources().getConfiguration()); + sendViewportMetricsToFlutter(); } /** @@ -359,7 +397,9 @@ public void attachToFlutterEngine(@NonNull FlutterEngine flutterEngine) { * {@link FlutterEngine}. */ public void detachFromFlutterEngine() { + Log.d(TAG, "detachFromFlutterEngine()"); if (!isAttachedToFlutterEngine()) { + Log.d(TAG, "Not attached to an engine. Doing nothing."); return; } Log.d(TAG, "Detaching from Flutter Engine"); @@ -422,6 +462,18 @@ private void sendUserSettingsToFlutter() { .send(); } + // TODO(mattcarroll): consider introducing a system channel for this communication instead of JNI + private void sendViewportMetricsToFlutter() { + Log.d(TAG, "sendViewportMetricsToFlutter()"); + if (!isAttachedToFlutterEngine()) { + Log.w(TAG, "Tried to send viewport metrics from Android to Flutter but this FlutterView was not attached to a FlutterEngine."); + return; + } + + viewportMetrics.devicePixelRatio = getResources().getDisplayMetrics().density; + flutterEngine.getRenderer().setViewportMetrics(viewportMetrics); + } + /** * Render modes for a {@link FlutterView}. */ 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 996ddb4952ed0..35dacea6d467d 100644 --- a/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java +++ b/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java @@ -29,7 +29,7 @@ * code via JNI. The corresponding {@link RenderSurface} is used as a delegate to carry out * certain actions on behalf of this {@code FlutterRenderer} within an Android view hierarchy. * - * {@link FlutterView} is an implementation of a {@link RenderSurface}. + * {@link io.flutter.embedding.engine.android.FlutterView} is an implementation of a {@link RenderSurface}. */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public class FlutterRenderer implements TextureRegistry { @@ -49,14 +49,16 @@ public void attachToRenderSurface(@NonNull RenderSurface renderSurface) { } this.renderSurface = renderSurface; + this.renderSurface.attachToRenderer(this); this.flutterJNI.setRenderSurface(renderSurface); } public void detachFromRenderSurface() { // TODO(mattcarroll): determine desired behavior if we're asked to detach without first being attached if (this.renderSurface != null) { - surfaceDestroyed(); + this.renderSurface.detachFromRenderer(); this.renderSurface = null; + surfaceDestroyed(); this.flutterJNI.setRenderSurface(null); } } @@ -157,29 +159,19 @@ public void surfaceDestroyed() { } // TODO(mattcarroll): describe the native behavior that this invokes - public void setViewportMetrics(float devicePixelRatio, - int physicalWidth, - int physicalHeight, - int physicalPaddingTop, - int physicalPaddingRight, - int physicalPaddingBottom, - int physicalPaddingLeft, - int physicalViewInsetTop, - int physicalViewInsetRight, - int physicalViewInsetBottom, - int physicalViewInsetLeft) { + public void setViewportMetrics(@NonNull ViewportMetrics viewportMetrics) { flutterJNI.setViewportMetrics( - devicePixelRatio, - physicalWidth, - physicalHeight, - physicalPaddingTop, - physicalPaddingRight, - physicalPaddingBottom, - physicalPaddingLeft, - physicalViewInsetTop, - physicalViewInsetRight, - physicalViewInsetBottom, - physicalViewInsetLeft + viewportMetrics.devicePixelRatio, + viewportMetrics.width, + viewportMetrics.height, + viewportMetrics.paddingTop, + viewportMetrics.paddingRight, + viewportMetrics.paddingBottom, + viewportMetrics.paddingLeft, + viewportMetrics.viewInsetTop, + viewportMetrics.viewInsetRight, + viewportMetrics.viewInsetBottom, + viewportMetrics.viewInsetLeft ); } @@ -281,4 +273,24 @@ public interface RenderSurface { */ void onFirstFrameRendered(); } + + /** + * Mutable data structure that holds all viewport metrics properties that Flutter cares about. + * + * All distance measurements, e.g., width, height, padding, viewInsets, are measured in device + * pixels, not logical pixels. + */ + public static final class ViewportMetrics { + public float devicePixelRatio = 1.0f; + public int width = 0; + public int height = 0; + public int paddingTop = 0; + public int paddingRight = 0; + public int paddingBottom = 0; + public int paddingLeft = 0; + public int viewInsetTop = 0; + public int viewInsetRight = 0; + public int viewInsetBottom = 0; + public int viewInsetLeft = 0; + } } From 8f1fdcd195239241285f6b59237a00596fa57f95 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Mon, 4 Mar 2019 18:02:24 -0800 Subject: [PATCH 0346/1117] Android Embedding PR 14: Almost done with FlutterFragment. (#8000) --- .../engine/android/FlutterFragment.java | 89 ++++++++++++++++++- .../embedding/engine/android/FlutterView.java | 10 +++ 2 files changed, 98 insertions(+), 1 deletion(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java index e4042bbaaa139..47defdf13367a 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java @@ -19,6 +19,7 @@ import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.FlutterShellArgs; import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.plugin.platform.PlatformPlugin; import io.flutter.view.FlutterMain; import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW; @@ -160,6 +161,8 @@ protected static Bundle createArgsBundle(@Nullable String dartEntrypoint, private FlutterEngine flutterEngine; @Nullable private FlutterView flutterView; + @Nullable + private PlatformPlugin platformPlugin; public FlutterFragment() { // Ensure that we at least have an empty Bundle of arguments so that we don't @@ -181,11 +184,30 @@ public FlutterEngine getFlutterEngine() { public void onAttach(Context context) { super.onAttach(context); + initializeFlutter(getContextCompat()); + // When "retain instance" is true, the FlutterEngine will survive configuration // changes. Therefore, we create a new one only if one does not already exist. if (flutterEngine == null) { createFlutterEngine(); } + + // Regardless of whether or not a FlutterEngine already existed, the PlatformPlugin + // is bound to a specific Activity. Therefore, it needs to be created and configured + // every time this Fragment attaches to a new Activity. + // TODO(mattcarroll): the PlatformPlugin needs to be reimagined because it implicitly takes + // control of the entire window. This is unacceptable for non-fullscreen + // use-cases. + platformPlugin = new PlatformPlugin(getActivity(), flutterEngine.getPlatformChannel()); + } + + private void initializeFlutter(@NonNull Context context) { + String[] flutterShellArgsArray = getArguments().getStringArray(ARG_FLUTTER_INITIALIZATION_ARGS); + FlutterShellArgs flutterShellArgs = new FlutterShellArgs( + flutterShellArgsArray != null ? flutterShellArgsArray : new String[] {} + ); + + FlutterMain.ensureInitializationComplete(context.getApplicationContext(), flutterShellArgs.toArray()); } /** @@ -307,7 +329,72 @@ protected String getDartEntrypointFunctionName() { // TODO(mattcarroll): determine why this can't be in onResume(). Comment reason, or move if possible. public void onPostResume() { Log.d(TAG, "onPostResume()"); - flutterEngine.getLifecycleChannel().appIsResumed(); + if (flutterEngine != null) { + flutterEngine.getLifecycleChannel().appIsResumed(); + + // TODO(mattcarroll): find a better way to handle the update of UI overlays than calling through + // to platformPlugin. We're implicitly entangling the Window, Activity, Fragment, + // and engine all with this one call. + platformPlugin.onPostResume(); + + // TODO(mattcarroll): consider a more abstract way to invoke this behavior. It is very strange for + // a Fragment to have a seemingly random View responsibility, but this is what + // existed in the original embedding and I don't have a good alternative yet. + flutterView.updateAccessibilityFeatures(); + } else { + Log.w(TAG, "onPostResume() invoked before FlutterFragment was attached to an Activity."); + } + } + + @Override + public void onPause() { + super.onPause(); + Log.d(TAG, "onPause()"); + flutterEngine.getLifecycleChannel().appIsInactive(); + } + + @Override + public void onStop() { + super.onStop(); + Log.d(TAG, "onStop()"); + flutterEngine.getLifecycleChannel().appIsPaused(); + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + Log.d(TAG, "onDestroyView()"); + flutterView.detachFromFlutterEngine(); + } + + @Override + public void onDetach() { + super.onDetach(); + Log.d(TAG, "onDetach()"); + + // Null out the platformPlugin to avoid a possible retain cycle between the plugin, this Fragment, + // and this Fragment's Activity. + platformPlugin = null; + + // Destroy our FlutterEngine if we're not set to retain it. + if (!retainFlutterIsolateAfterFragmentDestruction()) { + flutterEngine.destroy(); + flutterEngine = null; + } + } + + /** + * Returns true if the {@link FlutterEngine} within this {@code FlutterFragment} should outlive + * the {@code FlutterFragment}, itself. + * + * Defaults to false. This method can be overridden in subclasses to retain the + * {@link FlutterEngine}. + */ + // TODO(mattcarroll): consider a dynamic determination of this preference based on whether the + // engine was created automatically, or if the engine was provided manually. + // Manually provided engines should probably not be destroyed. + protected boolean retainFlutterIsolateAfterFragmentDestruction() { + return false; } /** diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java index aee6a5a95547c..c7d86cbf2e6ab 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java @@ -9,6 +9,7 @@ import android.graphics.Rect; import android.os.Build; import android.os.LocaleList; +import android.provider.Settings; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.text.format.DateFormat; @@ -334,6 +335,15 @@ public boolean onHoverEvent(MotionEvent event) { } //-------- End: Process UI I/O that Flutter cares about. --------- + //-------- Start: Accessibility ------- + /** + * No-op. Placeholder so that the containing Fragment can call through, but not yet implemented. + */ + public void updateAccessibilityFeatures() { + // TODO(mattcarroll): bring in accessibility code from old FlutterView. + } + //-------- End: Accessibility --------- + /** * Connects this {@code FlutterView} to the given {@link FlutterEngine}. * From 629c0d8366571d3881ba05d9ac1899e246d6fb59 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 4 Mar 2019 17:54:40 -0800 Subject: [PATCH 0347/1117] Roll src/third_party/dart 7d8ffe0daf..571ea80e11 (3 commits) 571ea80e11 [vm/compiler] added assert to kernel flowgraph builder b88e6dd910 Fix the type argument on the deep flattening spread test. 62df51cb34 Eliminate uses of old AST node types from parts of the analyzer --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 6775e0e664399..9eca9db96ef2d 100644 --- a/DEPS +++ b/DEPS @@ -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': '7d8ffe0daf8148dd281884ec3911f1274e21f0af', + 'dart_revision': '571ea80e1101e706980ea8aefa7fc18a0c8ba2ec', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 5ade61510b999..1e1b8c898d1c0 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 1405abeaed1a76feefc683d14369d056 +Signature: 4a8dfa2afe659f0a6057032c092f7496 UNUSED LICENSES: From 2cd9b41ba50e78171515b2e4883bc9945b448ff8 Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Mon, 4 Mar 2019 18:43:47 -0800 Subject: [PATCH 0348/1117] Select MPL instead of LGPL (#7991) --- ci/licenses_golden/licenses_skia | 971 ++++++++++++++---------------- ci/licenses_golden/tool_signature | 2 +- sky/packages/sky_engine/LICENSE | 969 ++++++++++++++--------------- tools/licenses/README.md | 42 +- tools/licenses/data/mozilla-1.1 | 469 +++++++++++++++ tools/licenses/lib/licenses.dart | 4 + tools/licenses/lib/main.dart | 51 +- tools/licenses/lib/patterns.dart | 8 +- 8 files changed, 1486 insertions(+), 1030 deletions(-) create mode 100644 tools/licenses/data/mozilla-1.1 diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 78e6827b929ff..69608c8b69161 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -435,512 +435,477 @@ limitations under the License. ==================================================================================================== LIBRARY: gif ORIGIN: ../../../third_party/skia/third_party/gif/SkGifImageReader.cpp -TYPE: LicenseType.lgpl +TYPE: LicenseType.mpl FILE: ../../../third_party/skia/third_party/gif/SkGifImageReader.cpp FILE: ../../../third_party/skia/third_party/gif/SkGifImageReader.h ---------------------------------------------------------------------------------------------------- -GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - -Copyright (C) 1991, 1999 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! +MOZILLA PUBLIC LICENSE + Version 1.1 + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the MPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + https://www.mozilla.org/MPL + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] ==================================================================================================== ==================================================================================================== diff --git a/ci/licenses_golden/tool_signature b/ci/licenses_golden/tool_signature index 30c9333357bfe..2189010017a26 100644 --- a/ci/licenses_golden/tool_signature +++ b/ci/licenses_golden/tool_signature @@ -1,2 +1,2 @@ -Signature: 293c762c71d027f77cf88deb80f9e78e +Signature: 91b3b5b8c1ef9e911fd65b636d009be8 diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index dcc3e1b66c6f0..0a34be8037ede 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -4210,508 +4210,473 @@ Legal Terms -------------------------------------------------------------------------------- gif -GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - -Copyright (C) 1991, 1999 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! +MOZILLA PUBLIC LICENSE + Version 1.1 + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the MPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + https://www.mozilla.org/MPL + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] -------------------------------------------------------------------------------- gif diff --git a/tools/licenses/README.md b/tools/licenses/README.md index 786e3b8fc728c..ccd44c0a82f75 100644 --- a/tools/licenses/README.md +++ b/tools/licenses/README.md @@ -10,8 +10,17 @@ cd flutter/ci/licenses_golden patch -p2 < my/patch/file ``` -## Regenerate License Files (Only works on Linux) -To update the golden license files, make sure you've rebased your branch to the latest upstream master and then run the following in this directory: +## Check for license changes (Only works on Linux) + +This script has two sets of output files: "goldens", which describe +the current license state of the repository, and the actual real +LICENSE file, which is what matters. + +We look at changes to the goldens to determine if there are any actual +changes to the licenses. + +To update the goldens, make sure you've rebased your branch to the +latest upstream master and then run the following in this directory: ``` pub get @@ -20,9 +29,29 @@ rm -rf ../../../out/licenses dart lib/main.dart --src ../../.. --out ../../../out/licenses --golden ../../ci/licenses_golden ``` -Then copy any affected files from `../../../out/licenses` to `../../ci/licenses_golden` and add them to your change. +In order for the license script to work correctly, you need to remove +any untracked files inside `engine/src` (the buildroot), not just +`engine/src/flutter`. + +Once the script has finished, copy any affected files from +`../../../out/licenses` to `../../ci/licenses_golden` and add them to +your change, and examine the diffs to see what changed. + +``` +cp ../../../out/licenses/* ../../ci/licenses_golden +git diff +``` + +If the only changes are to what files are included, then you're good +to go. However, if any of the _licenses_ changed, whether new licenses +are added, old ones removed, or any have their content changed in +_any_ way (including, e.g., whitespace changes), or if the affected +libraries change, **you must update the actual license file**. -The `sky/packages/sky_engine/LICENSE` file is included in product releases and should be updated any time the golden file changes in a way that involves changes to anything other than the FILE lines. To update this file, run: +The `sky/packages/sky_engine/LICENSE` file is the one actually +included in product releases and the one that should be updated any +time the golden file changes in a way that involves changes to +anything other than the `FILE` lines. To update this file, run: ``` pub get @@ -30,4 +59,7 @@ gclient sync dart lib/main.dart --release --src ../../.. --out ../../../out/licenses > ../../sky/packages/sky_engine/LICENSE ``` -**In order for the license script to work, please remove all untracked files inside `engine/src` (not just `engine/src/flutter`)** +The bots do not verify that you did this step, it's important that you +do it! When reviewing patches, if you see a change to the golden +files, check to see if there's a corresponding change to the LICENSE +file! diff --git a/tools/licenses/data/mozilla-1.1 b/tools/licenses/data/mozilla-1.1 new file mode 100644 index 0000000000000..566908108012c --- /dev/null +++ b/tools/licenses/data/mozilla-1.1 @@ -0,0 +1,469 @@ + MOZILLA PUBLIC LICENSE + Version 1.1 + + --------------- + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the MPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + https://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] diff --git a/tools/licenses/lib/licenses.dart b/tools/licenses/lib/licenses.dart index 629c6fcc63ea2..718f3123c04ca 100644 --- a/tools/licenses/lib/licenses.dart +++ b/tools/licenses/lib/licenses.dart @@ -269,6 +269,10 @@ abstract class License implements Comparable { body = system.File('data/academic-3.0').readAsStringSync(); type = LicenseType.afl; break; + case 'Mozilla Public License:1.1': + body = system.File('data/mozilla-1.1').readAsStringSync(); + type = LicenseType.mpl; + break; case 'http://mozilla.org/MPL/2.0/:2.0': body = system.File('data/mozilla-2.0').readAsStringSync(); type = LicenseType.mpl; diff --git a/tools/licenses/lib/main.dart b/tools/licenses/lib/main.dart index c9d8171eb1c46..9f0cadc87081a 100644 --- a/tools/licenses/lib/main.dart +++ b/tools/licenses/lib/main.dart @@ -1184,7 +1184,7 @@ class _RepositoryDirectory extends _RepositoryEntry implements LicenseSource { result.addAll(licenses); progress.advance(success: true); } catch (e, stack) { - system.stderr.writeln('error searching for copyright in: ${file.io}\n$e'); + system.stderr.writeln('\nerror searching for copyright in: ${file.io}\n$e'); if (e is! String) system.stderr.writeln(stack); system.stderr.writeln('\n'); @@ -2256,6 +2256,9 @@ Future _collectLicensesForComponent(_RepositoryDirectory componentRoot, { final List licenses = Set.from(componentRoot.getLicenses(progress).toList()).toList(); + if (progress.hadErrors) + throw 'Had failures while collecting licenses.'; + sink.writeln('UNUSED LICENSES:\n'); final List unusedLicenses = licenses .where((License license) => !license.isUsed) @@ -2268,6 +2271,38 @@ Future _collectLicensesForComponent(_RepositoryDirectory componentRoot, { sink.writeln('USED LICENSES:\n'); final List usedLicenses = licenses.where((License license) => license.isUsed).toList(); final List output = usedLicenses.map((License license) => license.toString()).toList(); + for (int index = 0; index < output.length; index += 1) { + // The strings we look for here are strings which we do not expect to see in + // any of the licenses we use. They either represent examples of misparsing + // licenses (issues we've previously run into and fixed), or licenses we + // know we are trying to avoid (e.g. the GPL, or licenses that only apply to + // test content which shouldn't get built at all). + // If you find that one of these tests is getting hit, and it's not obvious + // to you why the relevant license is a problem, please ask around (e.g. try + // asking Hixie). Do not merely remove one of these checks, sometimes the + // issues involved are relatively subtle. + if (output[index].contains('Version: MPL 1.1/GPL 2.0/LGPL 2.1')) + throw 'Unexpected trilicense block found in: ${usedLicenses[index].origin}'; + if (output[index].contains('The contents of this file are subject to the Mozilla Public License Version')) + throw 'Unexpected MPL block found in: ${usedLicenses[index].origin}'; + if (output[index].contains('You should have received a copy of the GNU')) + throw 'Unexpected GPL block found in: ${usedLicenses[index].origin}'; + if (output[index].contains('BoringSSL is a fork of OpenSSL')) + throw 'Unexpected legacy BoringSSL block found in: ${usedLicenses[index].origin}'; + if (output[index].contains('Contents of this folder are ported from')) + throw 'Unexpected block found in: ${usedLicenses[index].origin}'; + if (output[index].contains('https://github.com/w3c/web-platform-tests/tree/master/selectors-api')) + throw 'Unexpected W3C content found in: ${usedLicenses[index].origin}'; + if (output[index].contains('http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html')) + throw 'Unexpected W3C copyright found in: ${usedLicenses[index].origin}'; + if (output[index].contains('It is based on commit')) + throw 'Unexpected content found in: ${usedLicenses[index].origin}'; + if (output[index].contains('The original code is covered by the dual-licensing approach described in:')) + throw 'Unexpected old license reference found in: ${usedLicenses[index].origin}'; + if (output[index].contains('must choose')) + throw 'Unexpected indecisiveness found in: ${usedLicenses[index].origin}'; + } + output.sort(); sink.writeln(output.join('\n\n')); sink.writeln('Total license count: ${licenses.length}'); @@ -2396,17 +2431,3 @@ Future main(List arguments) async { system.exit(1); } } - -// Sanity checks: -// -// The following substrings shouldn't be in the output: -// Version: MPL 1.1/GPL 2.0/LGPL 2.1 -// The contents of this file are subject to the Mozilla Public License Version -// You should have received a copy of the GNU -// BoringSSL is a fork of OpenSSL -// Contents of this folder are ported from -// https://github.com/w3c/web-platform-tests/tree/master/selectors-api -// It is based on commit -// The original code is covered by the dual-licensing approach described in: -// http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html -// must choose diff --git a/tools/licenses/lib/patterns.dart b/tools/licenses/lib/patterns.dart index d92fc1402ca9c..232edaa719fa3 100644 --- a/tools/licenses/lib/patterns.dart +++ b/tools/licenses/lib/patterns.dart @@ -980,14 +980,14 @@ final List csReferencesByUrl = [3], - versionIndicies: const { 3:4 }, + licenseIndices: const [3], // 5 is lgpl, which we're actively not selecting + versionIndicies: const { 3:4 }, // 5:6 for lgpl pattern: RegExp( kIndent + r'(?:Version: [GMPL/012. ]+ *\n' r'^(?:(?:\1\2? *)? *\n)*' - r'^\1\2)?The contents of this file are subject to the Mozilla Public License Version *\n' - r'^\1\2(?:1\.1) \(the "License"\); you may not use this file except in compliance with *\n' + r'^\1\2)?The contents of this file are subject to the (Mozilla Public License) Version *\n' + r'^\1\2(1\.1) \(the "License"\); you may not use this file except in compliance with *\n' r'^\1\2the License\. +You may obtain a copy of the License at *\n' r'^\1\2http://www\.mozilla\.org/MPL/ *\n' r'^(?:(?:\1\2? *)? *\n)*' From 052774e1cb0187bf2ba81c3d9f3e3fa291f5ebac Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 4 Mar 2019 22:50:32 -0500 Subject: [PATCH 0349/1117] Roll src/third_party/skia e3e80b7edfd1..0a57971f0544 (16 commits) (#8035) https://skia.googlesource.com/skia.git/%2Blog/e3e80b7edfd1..0a57971f0544 git log e3e80b7edfd1d31724ef789b7d879d0fee5e52f2..0a57971f054410af9f0b29e776b8f186540c7a1c --date=short --no-merges --format=%ad %ae %s 2019-03-04 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-01 halcanary@google.com SkQP: fix five tests 2019-03-04 robertphillips@google.com Reduce usage of SkCanvas::flush 2019-03-04 fmalita@chromium.org Fix handling of SkSL nullable FPs 2019-03-01 mtklein@google.com mark lowp TODOs 2019-03-04 brianosman@google.com Add SkParticleValue to allow further customization of curve behavior 2019-03-04 herb@google.com Introduce SkStrikeCacheInterface 2019-03-04 egdaniel@google.com Add API for creating SkImage from AHB while uploading data to it. 2019-03-04 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 4d153383bd3a..0e1ce2e55387 (1 commits) 2019-03-04 robertphillips@google.com Clean up GrSurfaceContext's relationship with GrRecordingContext 2019-02-28 mtklein@google.com add kRGBA_F16Norm_SkColorType 2019-03-01 robertphillips@google.com Remove (unnecessary?) flush in RenderYUVAToRGBA 2019-03-04 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src aae499d4d09d..8e3cddfd5a43 (217 commits) 2019-03-04 halcanary@google.com SkQP: fix androidx (follows 2ccdd2bc1d0) 2019-03-04 robertphillips@google.com Remove peekProxy's side-effect behavior 2019-03-04 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 823ca85404fb..bb305299f4de (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 9eca9db96ef2d..fde0db003757b 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': 'e3e80b7edfd1d31724ef789b7d879d0fee5e52f2', + 'skia_revision': '0a57971f054410af9f0b29e776b8f186540c7a1c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 69608c8b69161..26b698cfbade1 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 6a5e4c2b1031c3a8cc1b8d5e0524d4dc +Signature: 7a19060fde0d980ac4a36861c31ada7e UNUSED LICENSES: @@ -4847,6 +4847,7 @@ FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h FILE: ../../../third_party/skia/samplecode/SampleSG.cpp FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp +FILE: ../../../third_party/skia/src/core/SkStrikeInterface.h FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.cpp FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.h FILE: ../../../third_party/skia/src/gpu/GrBaseContextPriv.h From ed628da00aa9ef50ef06c61888f32c46fdea6be6 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Mon, 4 Mar 2019 22:00:54 -0800 Subject: [PATCH 0350/1117] Add missing kHasImplicitScrolling enum value (#8030) This brings the Dart and C++ semantics flag enums back in sync. In #5941, implicit scrolling support was added to SemanticsFlag in dart:ui, and to the Android embedder, but not to the SemanticsFlags enum on the C++ side. This also clarifies/corrects the documentation for this value in dart:ui and in the embedder API. --- lib/ui/semantics.dart | 11 ++++++----- lib/ui/semantics/semantics_node.h | 1 + shell/platform/embedder/embedder.h | 8 ++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/ui/semantics.dart b/lib/ui/semantics.dart index 1e3650910d543..79aaf1ef943d9 100644 --- a/lib/ui/semantics.dart +++ b/lib/ui/semantics.dart @@ -264,8 +264,9 @@ class SemanticsAction { /// A Boolean value that can be associated with a semantics node. // -// When changes are made to this class, the equivalent APIs in each of the -// embedders *must* be updated. +// When changes are made to this class, the equivalent APIs in +// `lib/ui/semantics/semantics_node.h` and in each of the embedders *must* be +// updated. class SemanticsFlag { static const int _kHasCheckedStateIndex = 1 << 0; static const int _kIsCheckedIndex = 1 << 1; @@ -476,9 +477,9 @@ class SemanticsFlag { /// to move focus to an offscreen child. /// /// For example, a [ListView] widget has implicit scrolling so that users can - /// easily move to the next visible set of children. A [TabBar] widget does - /// not have implicit scrolling, so that users can navigate into the tab - /// body when reaching the end of the tab bar. + /// easily move the accessibility focus to the next set of children. A + /// [PageView] widget does not have implicit scrolling, so that users don't + /// navigate to the next page when reaching the end of the current one. static const SemanticsFlag hasImplicitScrolling = const SemanticsFlag._(_kHasImplicitScrollingIndex); /// The possible semantics flags. diff --git a/lib/ui/semantics/semantics_node.h b/lib/ui/semantics/semantics_node.h index 7596dc20957e8..6bed3b305f1d3 100644 --- a/lib/ui/semantics/semantics_node.h +++ b/lib/ui/semantics/semantics_node.h @@ -65,6 +65,7 @@ enum class SemanticsFlags : int32_t { kIsLiveRegion = 1 << 15, kHasToggledState = 1 << 16, kIsToggled = 1 << 17, + kHasImplicitScrolling = 1 << 18, }; struct SemanticsNode { diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index baf789594d012..11f70f1092f5d 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -141,6 +141,14 @@ typedef enum { kFlutterSemanticsFlagHasToggledState = 1 << 16, // If true, the semantics node is "on". If false, the semantics node is "off". kFlutterSemanticsFlagIsToggled = 1 << 17, + // Whether the platform can scroll the semantics node when the user attempts + // to move the accessibility focus to an offscreen child. + // + // For example, a |ListView| widget has implicit scrolling so that users can + // easily move the accessibility focus to the next set of children. A + // |PageView| widget does not have implicit scrolling, so that users don't + // navigate to the next page when reaching the end of the current one. + kFlutterSemanticsFlagHasImplicitScrolling = 1 << 18, } FlutterSemanticsFlag; typedef enum { From c462269807fec45f403a615bf90a1e2a573a36f3 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 5 Mar 2019 03:20:00 -0500 Subject: [PATCH 0351/1117] Roll src/third_party/skia 0a57971f0544..fbc887df72ec (1 commits) (#8037) https://skia.googlesource.com/skia.git/%2Blog/0a57971f0544..fbc887df72ec git log 0a57971f054410af9f0b29e776b8f186540c7a1c..fbc887df72ec102843c009977b24ed5b4bb2fab1 --date=short --no-merges --format=%ad %ae %s 2019-03-05 reed@google.com Revert "Remove (unnecessary?) flush in RenderYUVAToRGBA" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index fde0db003757b..3464e40b5d6b6 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': '0a57971f054410af9f0b29e776b8f186540c7a1c', + 'skia_revision': 'fbc887df72ec102843c009977b24ed5b4bb2fab1', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 26b698cfbade1..31ab8006db70b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 7a19060fde0d980ac4a36861c31ada7e +Signature: 8ba8b757d4d23dc9e9b1a157dc7ca2e2 UNUSED LICENSES: From 75d4db31d0cc59404d726b4d92ca52e31545a25c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 5 Mar 2019 07:41:42 -0500 Subject: [PATCH 0352/1117] Roll src/third_party/skia fbc887df72ec..25bc174cf682 (7 commits) (#8039) https://skia.googlesource.com/skia.git/%2Blog/fbc887df72ec..25bc174cf682 git log fbc887df72ec102843c009977b24ed5b4bb2fab1..25bc174cf682e666d5437e5f3b910a7a11b4bb9e --date=short --no-merges --format=%ad %ae %s 2019-03-04 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader bb305299f4de..d318dd329423 (7 commits) 2019-03-04 fmalita@chromium.org SkMixerColorFilter GPU impl 2019-03-04 csmartdalton@google.com Drop support for GL_EXT_raster_multisample 2019-03-05 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-03-01 bungeman@google.com Roll HarfBuzz. 2019-03-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 0e1ce2e55387..b8cff9e9347c (6 commits) 2019-03-05 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 3464e40b5d6b6..99d4eebdb50a3 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': 'fbc887df72ec102843c009977b24ed5b4bb2fab1', + 'skia_revision': '25bc174cf682e666d5437e5f3b910a7a11b4bb9e', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 31ab8006db70b..e6eb0de71a859 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8ba8b757d4d23dc9e9b1a157dc7ca2e2 +Signature: c8fbe627d3b7f9e585d53f4e8584f18b UNUSED LICENSES: @@ -4862,6 +4862,9 @@ FILE: ../../../third_party/skia/src/gpu/GrImageContext.cpp FILE: ../../../third_party/skia/src/gpu/GrImageContextPriv.h FILE: ../../../third_party/skia/src/gpu/GrRecordingContext.cpp FILE: ../../../third_party/skia/src/gpu/GrRecordingContextPriv.h +FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.fp +FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.h FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.h FILE: ../../../third_party/skia/src/sksl/SkSLDefines.h From e6a5201f0be3e471438df703ea7355c186d25f51 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Tue, 5 Mar 2019 07:58:26 -0800 Subject: [PATCH 0353/1117] Add missing values to semantics action enums (#8033) This brings the Dart and C++ semantics flag enums back in sync. In #5902, the ability to move the cursor forward and backward one word were added to dart:ui, and to the Android embedder, but not to the SemanticsAction enum on the C++ side. --- lib/ui/semantics.dart | 5 +++-- lib/ui/semantics/semantics_node.h | 5 ++++- shell/platform/embedder/embedder.h | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/ui/semantics.dart b/lib/ui/semantics.dart index 79aaf1ef943d9..b98d36fe2b895 100644 --- a/lib/ui/semantics.dart +++ b/lib/ui/semantics.dart @@ -7,8 +7,9 @@ part of dart.ui; /// The possible actions that can be conveyed from the operating system /// accessibility APIs to a semantics node. // -// When changes are made to this class, the equivalent APIs in each of the -// embedders *must* be updated. +// When changes are made to this class, the equivalent APIs in +// `lib/ui/semantics/semantics_node.h` and in each of the embedders *must* be +// updated. class SemanticsAction { const SemanticsAction._(this.index); diff --git a/lib/ui/semantics/semantics_node.h b/lib/ui/semantics/semantics_node.h index 6bed3b305f1d3..f6918e54475ba 100644 --- a/lib/ui/semantics/semantics_node.h +++ b/lib/ui/semantics/semantics_node.h @@ -16,7 +16,8 @@ namespace blink { -// Must match the SemanticsAction enum in semantics.dart. +// Must match the SemanticsAction enum in semantics.dart and in each of the +// embedders. enum class SemanticsAction : int32_t { kTap = 1 << 0, kLongPress = 1 << 1, @@ -37,6 +38,8 @@ enum class SemanticsAction : int32_t { kDidLoseAccessibilityFocus = 1 << 16, kCustomAction = 1 << 17, kDismiss = 1 << 18, + kMoveCursorForwardByWordIndex = 1 << 19, + kMoveCursorBackwardByWordIndex = 1 << 20, }; const int kScrollableSemanticsActions = diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 11f70f1092f5d..402f58ebcd3ef 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -97,6 +97,10 @@ typedef enum { kFlutterSemanticsActionCustomAction = 1 << 17, // A request that the node should be dismissed. kFlutterSemanticsActionDismiss = 1 << 18, + // Move the cursor forward by one word. + kFlutterSemanticsActionMoveCursorForwardByWordIndex = 1 << 19, + // Move the cursor backward by one word. + kFlutterSemanticsActionMoveCursorBackwardByWordIndex = 1 << 20, } FlutterSemanticsAction; // The set of properties that may be associated with a semantics node. From 5fed421972b7c573e5c9c77140f8cb17592eb443 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 5 Mar 2019 12:20:58 -0500 Subject: [PATCH 0354/1117] Roll src/third_party/skia 25bc174cf682..72542816cadb (14 commits) (#8040) https://skia.googlesource.com/skia.git/%2Blog/25bc174cf682..72542816cadb git log 25bc174cf682e666d5437e5f3b910a7a11b4bb9e..72542816cadbc3d18a19725f6f6aecf45ffc188c --date=short --no-merges --format=%ad %ae %s 2019-03-04 reed@google.com add sample for retained vertices 2019-03-05 fmalita@chromium.org Reland "SkMixerColorFilter GPU impl" 2019-03-05 reed@google.com Revert "SkMixerColorFilter GPU impl" 2019-03-05 reed@google.com Reland "check if we can use legacy blits" 2019-03-05 reed@google.com Revert "check if we can use legacy blits" 2019-02-27 brianosman@google.com Remove dithering during SkConvertPixels 2019-03-05 bsalomon@google.com Remove legacy promise image APIs 2019-03-04 jvanverth@google.com Fix issue with offsetting polygon by 0 distance. 2019-03-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader d69cdaba1445..e95eeb19a770 (1 commits) 2019-03-04 bsalomon@google.com Default implementation of onSetRelease() on GrSurface 2019-03-04 bsalomon@google.com Simplify promise image lazy instantiation callbacks. 2019-03-04 robertphillips@google.com Lay some groundwork for depowering SkGpuDevice's and SkImage_GpuBase's context pointer 2019-03-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader d318dd329423..d69cdaba1445 (4 commits) 2019-03-01 reed@google.com check if we can use legacy blits The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index 99d4eebdb50a3..004c3f14c31f7 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': '25bc174cf682e666d5437e5f3b910a7a11b4bb9e', + 'skia_revision': '72542816cadbc3d18a19725f6f6aecf45ffc188c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index e6eb0de71a859..e9e85586b9d13 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c8fbe627d3b7f9e585d53f4e8584f18b +Signature: cf0991f5443f916cde12c3bc27ba049f UNUSED LICENSES: @@ -1717,8 +1717,6 @@ FILE: ../../../third_party/skia/src/effects/SkTrimPE.h FILE: ../../../third_party/skia/src/effects/SkTrimPathEffect.cpp FILE: ../../../third_party/skia/src/gpu/GrContextThreadSafeProxyPriv.h FILE: ../../../third_party/skia/src/gpu/GrDDLContext.cpp -FILE: ../../../third_party/skia/src/gpu/GrDeinstantiateProxyTracker.cpp -FILE: ../../../third_party/skia/src/gpu/GrDeinstantiateProxyTracker.h FILE: ../../../third_party/skia/src/gpu/GrDriverBugWorkarounds.cpp FILE: ../../../third_party/skia/src/gpu/GrFPArgs.h FILE: ../../../third_party/skia/src/gpu/GrLegacyDirectContext.cpp From 14e082fa0546666dbde653860ade6280fcf0a8a5 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 5 Mar 2019 09:36:16 -0800 Subject: [PATCH 0355/1117] add lint script for Android with baseline (#8036) * add lint script for Android with baseline --- .cirrus.yml | 4 + tools/android_lint/baseline.xml | 939 +++++++++++++++++++++++++++++++ tools/android_lint/bin/main.dart | 95 +++- 3 files changed, 1007 insertions(+), 31 deletions(-) create mode 100644 tools/android_lint/baseline.xml diff --git a/.cirrus.yml b/.cirrus.yml index e4cafa6434f1a..bfe6d0816b9fb 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -38,6 +38,10 @@ task: ninja -C out/host_release test_host_script: cd $ENGINE_PATH/src && ./flutter/testing/run_tests.sh host_release - name: build_android + lint_host_script: | + cd $ENGINE_PATH/src/flutter/tools/android_lint + $ENGINE_PATH/src/third_party/dart/tools/sdks/dart-sdk/bin/pub get + $ENGINE_PATH/src/third_party/dart/tools/sdks/dart-sdk/bin/dart bin/main.dart compile_host_script: | cd $ENGINE_PATH/src ./flutter/tools/gn --android --unoptimized diff --git a/tools/android_lint/baseline.xml b/tools/android_lint/baseline.xml new file mode 100644 index 0000000000000..2a81ee20380c5 --- /dev/null +++ b/tools/android_lint/baseline.xml @@ -0,0 +1,939 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/android_lint/bin/main.dart b/tools/android_lint/bin/main.dart index 4254fd2d20124..c96de9afc2226 100644 --- a/tools/android_lint/bin/main.dart +++ b/tools/android_lint/bin/main.dart @@ -57,7 +57,15 @@ Future runLint(ArgParser argParser, ArgResults argResults) async { return -1; } - final IOSink projectXml = File('./project.xml').openWrite(); + if (argResults['rebaseline']) { + print('Removing previous baseline.xml...'); + final File baselineXml = File(baselineXmlPath); + if (baselineXml.existsSync()) { + await baselineXml.delete(); + } + } + print('Preparing projext.xml...'); + final IOSink projectXml = File(projectXmlPath).openWrite(); projectXml.write( ''' @@ -79,57 +87,67 @@ Future runLint(ArgParser argParser, ArgResults argResults) async { await projectXml.close(); print('Wrote project.xml, starting lint...'); - final ProcessResult result = await processManager.run( + final Process lintProcess = await processManager.start( [ path.join(androidSdkDir.path, 'tools', 'bin', 'lint'), '--project', - './project.xml', + projectXmlPath, '--html', argResults['out'], '--showall', '--exitcode', // Set non-zero exit code on errors '-Wall', '-Werror', + '--baseline', + baselineXmlPath, ], ); - if (result.stderr != null) { - print('Lint tool had internal errors:'); - print(result.stderr); - } - print(result.stdout); - return result.exitCode; + lintProcess.stdout.pipe(stdout); + lintProcess.stderr.pipe(stderr); + return await lintProcess.exitCode; } +/// Prepares an [ArgParser] for this script. ArgParser setupOptions() { final ArgParser argParser = ArgParser(); - argParser.addOption( - 'in', - help: 'The path to `engine/src`.', - defaultsTo: path.relative( - path.join( - path.dirname( - path.dirname(path.dirname(path.fromUri(Platform.script))), + argParser + ..addOption( + 'in', + help: 'The path to `engine/src`.', + defaultsTo: path.relative( + path.join( + projectDir, + '..', + '..', + '..', ), - '..', - '..', ), - ), - ); - argParser.addOption( - 'out', - help: 'The path to write the generated the HTML report to.', - defaultsTo: 'lint_report', - ); - argParser.addFlag( - 'help', - help: 'Print usage of the command.', - negatable: false, - defaultsTo: false, - ); + ) + ..addOption( + 'out', + help: 'The path to write the generated the HTML report to.', + defaultsTo: path.join(projectDir, 'lint_report'), + ) + ..addFlag( + 'help', + help: 'Print usage of the command.', + negatable: false, + defaultsTo: false, + ) + ..addFlag( + 'rebaseline', + help: 'Recalculates the baseline for errors and warnings ' + 'in this project.', + negatable: false, + defaultsTo: false, + ); return argParser; } +/// Checks that `java` points to Java 1.8. +/// +/// The SDK lint tool may not work with Java > 1.8. Future checkJava1_8() async { print('Checking Java version...'); final ProcessResult javaResult = await processManager.run( @@ -146,3 +164,18 @@ Future checkJava1_8() async { 'If this process fails, please retry using Java 1.8.'); } } + +/// The root directory of this project. +String get projectDir => path.dirname( + path.dirname( + path.fromUri(Platform.script), + ), + ); + +/// The path to use for project.xml, which tells the linter where to find source +/// files. +String get projectXmlPath => path.join(projectDir, 'project.xml'); + +/// The path to use for baseline.xml, which tells the linter what errors or +/// warnings to ignore. +String get baselineXmlPath => path.join(projectDir, 'baseline.xml'); From effee2f80e3478a54ee3327df020cc356f833935 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Tue, 5 Mar 2019 11:12:00 -0800 Subject: [PATCH 0356/1117] remove extra statement (#8041) Remove an extra statement introduced in https://github.com/flutter/engine/commit/36ca5740c7e39e25d7ac22c755e66525b92fbb56 --- .../platform/darwin/ios/framework/Source/FlutterPlatformViews.mm | 1 - 1 file changed, 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm index 2bd198af6bf12..304ae123bc364 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm @@ -427,7 +427,6 @@ - (instancetype)initWithTarget:(id)target flutterView:(UIView*)flutterView { - (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { [_flutterView touchesBegan:touches withEvent:event]; _currentTouchPointersCount += touches.count; - [_flutterView touchesBegan:touches withEvent:event]; } - (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { From f4951df193a7966f9ed4da43d555eee0913d84d1 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Tue, 5 Mar 2019 12:07:07 -0800 Subject: [PATCH 0357/1117] Minor cleanups to CONTRIBUTING.md (#8043) This is really just in order to trigger a build. ci.chromium.org infra had a short outage during our last build. --- CONTRIBUTING.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aa1efa2bc0437..7102ad364ac08 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,18 +1,22 @@ Contributing to the Flutter engine ================================== -[![Build Status](https://cirrus-ci.com/flutter/engine.svg)](https://cirrus-ci.com/flutter/engine) +[![Build Status](https://cirrus-ci.com/flutter/engine.svg)][build_status] -_See also: [Flutter's code of conduct](https://github.com/flutter/flutter/blob/master/CODE_OF_CONDUCT.md)_ +_See also: [Flutter's code of conduct][code_of_conduct]_ Welcome ------- -For an introduction to contributing to Flutter, see [our -contributor -guide](https://github.com/flutter/flutter/blob/master/CONTRIBUTING.md). +For an introduction to contributing to Flutter, see [our contributor +guide][contrib_guide]. -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. +For specific instructions regarding building Flutter's engine, see [Setting up +the Engine development environment][engine_dev_setup] on our wiki. Those +instructions are part of the broader onboarding instructions described in the +contributing guide. + +[build_status]: https://cirrus-ci.com/flutter/engine +[code_of_conduct]: https://github.com/flutter/flutter/blob/master/CODE_OF_CONDUCT.md +[contrib_guide]: https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment +[engine_dev_setup]: https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment From dd80fc9ff69a355ffde8ca340ceddd0fba4f1f89 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Tue, 5 Mar 2019 14:12:07 -0800 Subject: [PATCH 0358/1117] Add engine support for scrollwheel events (#7494) Adds support for pointer signals, in a way that will support both discrete events (e.g., scroll wheels, flutter/flutter#22762) and continuous gestures (e.g., trackpad scroll, flutter/flutter#21953). Also exposes these new event options to the embedder. Does not include code to send the new events from the platform shells. --- lib/stub_ui/hooks.dart | 5 ++- lib/stub_ui/pointer.dart | 33 ++++++++++++++++++- lib/ui/hooks.dart | 5 ++- lib/ui/pointer.dart | 33 ++++++++++++++++++- lib/ui/window/pointer_data.cc | 2 +- lib/ui/window/pointer_data.h | 10 ++++++ .../android/io/flutter/view/FlutterView.java | 16 +++++++-- shell/platform/embedder/embedder.cc | 17 ++++++++++ shell/platform/embedder/embedder.h | 10 ++++++ 9 files changed, 124 insertions(+), 7 deletions(-) diff --git a/lib/stub_ui/hooks.dart b/lib/stub_ui/hooks.dart index 8fd0c2a338a01..6e0820832939b 100644 --- a/lib/stub_ui/hooks.dart +++ b/lib/stub_ui/hooks.dart @@ -213,7 +213,7 @@ void _invoke3(void callback(A1 a1, A2 a2, A3 a3), Zone zone, A1 arg1 // // * pointer_data.cc // * FlutterView.java -const int _kPointerDataFieldCount = 21; +const int _kPointerDataFieldCount = 24; PointerDataPacket _unpackPointerDataPacket(ByteData packet) { const int kStride = Int64List.bytesPerElement; @@ -227,6 +227,7 @@ PointerDataPacket _unpackPointerDataPacket(ByteData packet) { timeStamp: new Duration(microseconds: packet.getInt64(kStride * offset++, _kFakeHostEndian)), change: PointerChange.values[packet.getInt64(kStride * offset++, _kFakeHostEndian)], kind: PointerDeviceKind.values[packet.getInt64(kStride * offset++, _kFakeHostEndian)], + signalKind: PointerSignalKind.values[packet.getInt64(kStride * offset++, _kFakeHostEndian)], device: packet.getInt64(kStride * offset++, _kFakeHostEndian), physicalX: packet.getFloat64(kStride * offset++, _kFakeHostEndian), physicalY: packet.getFloat64(kStride * offset++, _kFakeHostEndian), @@ -245,6 +246,8 @@ PointerDataPacket _unpackPointerDataPacket(ByteData packet) { orientation: packet.getFloat64(kStride * offset++, _kFakeHostEndian), tilt: packet.getFloat64(kStride * offset++, _kFakeHostEndian), platformData: packet.getInt64(kStride * offset++, _kFakeHostEndian), + scrollDeltaX: packet.getFloat64(kStride * offset++, _kFakeHostEndian), + scrollDeltaY: packet.getFloat64(kStride * offset++, _kFakeHostEndian) ); assert(offset == (i + 1) * _kPointerDataFieldCount); } diff --git a/lib/stub_ui/pointer.dart b/lib/stub_ui/pointer.dart index c0d3757d84bd5..fd5f3a13e25aa 100644 --- a/lib/stub_ui/pointer.dart +++ b/lib/stub_ui/pointer.dart @@ -54,6 +54,18 @@ enum PointerDeviceKind { unknown } +/// The kind of [PointerDeviceKind.signal]. +enum PointerSignalKind { + /// The event is not associated with a pointer signal. + none, + + /// A pointer-generated scroll (e.g., mouse wheel or trackpad scroll). + scroll, + + /// An unknown pointer signal kind. + unknown +} + /// Information about the state of a pointer. class PointerData { /// Creates an object that represents the state of a pointer. @@ -61,6 +73,7 @@ class PointerData { this.timeStamp: Duration.zero, this.change: PointerChange.cancel, this.kind: PointerDeviceKind.touch, + this.signalKind, this.device: 0, this.physicalX: 0.0, this.physicalY: 0.0, @@ -79,6 +92,8 @@ class PointerData { this.orientation: 0.0, this.tilt: 0.0, this.platformData: 0, + this.scrollDeltaX: 0.0, + this.scrollDeltaY: 0.0, }); /// Time of event dispatch, relative to an arbitrary timeline. @@ -90,6 +105,9 @@ class PointerData { /// The kind of input device for which the event was generated. final PointerDeviceKind kind; + /// The kind of signal for a pointer signal event. + final PointerSignalKind signalKind; + /// Unique identifier for the pointing device, reused across interactions. final int device; @@ -203,6 +221,16 @@ class PointerData { /// Opaque platform-specific data associated with the event. final int platformData; + /// For events with signalKind of PointerSignalKind.scroll: + /// + /// The amount to scroll in the x direction, in physical pixels. + final double scrollDeltaX; + + /// For events with signalKind of PointerSignalKind.scroll: + /// + /// The amount to scroll in the y direction, in physical pixels. + final double scrollDeltaY; + @override String toString() => '$runtimeType(x: $physicalX, y: $physicalY)'; @@ -212,6 +240,7 @@ class PointerData { 'timeStamp: $timeStamp, ' 'change: $change, ' 'kind: $kind, ' + 'signalKind: $signalKind, ' 'device: $device, ' 'physicalX: $physicalX, ' 'physicalY: $physicalY, ' @@ -228,7 +257,9 @@ class PointerData { 'radiusMax: $radiusMax, ' 'orientation: $orientation, ' 'tilt: $tilt, ' - 'platformData: $platformData' + 'platformData: $platformData, ' + 'scrollDeltaX: $scrollDeltaX, ' + 'scrollDeltaY: $scrollDeltaY' ')'; } } diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index b1550bf90b1ee..e88580a95ce06 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -259,7 +259,7 @@ void _invoke3(void callback(A1 a1, A2 a2, A3 a3), Zone zone, A1 arg1 // // * pointer_data.cc // * FlutterView.java -const int _kPointerDataFieldCount = 21; +const int _kPointerDataFieldCount = 24; PointerDataPacket _unpackPointerDataPacket(ByteData packet) { const int kStride = Int64List.bytesPerElement; @@ -273,6 +273,7 @@ PointerDataPacket _unpackPointerDataPacket(ByteData packet) { timeStamp: new Duration(microseconds: packet.getInt64(kStride * offset++, _kFakeHostEndian)), change: PointerChange.values[packet.getInt64(kStride * offset++, _kFakeHostEndian)], kind: PointerDeviceKind.values[packet.getInt64(kStride * offset++, _kFakeHostEndian)], + signalKind: PointerSignalKind.values[packet.getInt64(kStride * offset++, _kFakeHostEndian)], device: packet.getInt64(kStride * offset++, _kFakeHostEndian), physicalX: packet.getFloat64(kStride * offset++, _kFakeHostEndian), physicalY: packet.getFloat64(kStride * offset++, _kFakeHostEndian), @@ -291,6 +292,8 @@ PointerDataPacket _unpackPointerDataPacket(ByteData packet) { orientation: packet.getFloat64(kStride * offset++, _kFakeHostEndian), tilt: packet.getFloat64(kStride * offset++, _kFakeHostEndian), platformData: packet.getInt64(kStride * offset++, _kFakeHostEndian), + scrollDeltaX: packet.getFloat64(kStride * offset++, _kFakeHostEndian), + scrollDeltaY: packet.getFloat64(kStride * offset++, _kFakeHostEndian) ); assert(offset == (i + 1) * _kPointerDataFieldCount); } diff --git a/lib/ui/pointer.dart b/lib/ui/pointer.dart index c0d3757d84bd5..fd5f3a13e25aa 100644 --- a/lib/ui/pointer.dart +++ b/lib/ui/pointer.dart @@ -54,6 +54,18 @@ enum PointerDeviceKind { unknown } +/// The kind of [PointerDeviceKind.signal]. +enum PointerSignalKind { + /// The event is not associated with a pointer signal. + none, + + /// A pointer-generated scroll (e.g., mouse wheel or trackpad scroll). + scroll, + + /// An unknown pointer signal kind. + unknown +} + /// Information about the state of a pointer. class PointerData { /// Creates an object that represents the state of a pointer. @@ -61,6 +73,7 @@ class PointerData { this.timeStamp: Duration.zero, this.change: PointerChange.cancel, this.kind: PointerDeviceKind.touch, + this.signalKind, this.device: 0, this.physicalX: 0.0, this.physicalY: 0.0, @@ -79,6 +92,8 @@ class PointerData { this.orientation: 0.0, this.tilt: 0.0, this.platformData: 0, + this.scrollDeltaX: 0.0, + this.scrollDeltaY: 0.0, }); /// Time of event dispatch, relative to an arbitrary timeline. @@ -90,6 +105,9 @@ class PointerData { /// The kind of input device for which the event was generated. final PointerDeviceKind kind; + /// The kind of signal for a pointer signal event. + final PointerSignalKind signalKind; + /// Unique identifier for the pointing device, reused across interactions. final int device; @@ -203,6 +221,16 @@ class PointerData { /// Opaque platform-specific data associated with the event. final int platformData; + /// For events with signalKind of PointerSignalKind.scroll: + /// + /// The amount to scroll in the x direction, in physical pixels. + final double scrollDeltaX; + + /// For events with signalKind of PointerSignalKind.scroll: + /// + /// The amount to scroll in the y direction, in physical pixels. + final double scrollDeltaY; + @override String toString() => '$runtimeType(x: $physicalX, y: $physicalY)'; @@ -212,6 +240,7 @@ class PointerData { 'timeStamp: $timeStamp, ' 'change: $change, ' 'kind: $kind, ' + 'signalKind: $signalKind, ' 'device: $device, ' 'physicalX: $physicalX, ' 'physicalY: $physicalY, ' @@ -228,7 +257,9 @@ class PointerData { 'radiusMax: $radiusMax, ' 'orientation: $orientation, ' 'tilt: $tilt, ' - 'platformData: $platformData' + 'platformData: $platformData, ' + 'scrollDeltaX: $scrollDeltaX, ' + 'scrollDeltaY: $scrollDeltaY' ')'; } } diff --git a/lib/ui/window/pointer_data.cc b/lib/ui/window/pointer_data.cc index e74e0b5ce94f0..d52bda18c3f58 100644 --- a/lib/ui/window/pointer_data.cc +++ b/lib/ui/window/pointer_data.cc @@ -9,7 +9,7 @@ namespace blink { // If this value changes, update the pointer data unpacking code in hooks.dart. -static constexpr int kPointerDataFieldCount = 21; +static constexpr int kPointerDataFieldCount = 24; 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 d9d01b560a1d2..56fd6067a1b35 100644 --- a/lib/ui/window/pointer_data.h +++ b/lib/ui/window/pointer_data.h @@ -28,11 +28,19 @@ struct alignas(8) PointerData { kMouse, kStylus, kInvertedStylus, + kSignal, + }; + + // Must match the PointerSignalKind enum in pointer.dart. + enum class SignalKind : int64_t { + kNone, + kScroll, }; int64_t time_stamp; Change change; DeviceKind kind; + SignalKind signal_kind; int64_t device; double physical_x; double physical_y; @@ -51,6 +59,8 @@ struct alignas(8) PointerData { double orientation; double tilt; int64_t platformData; + double scroll_delta_x; + double scroll_delta_y; void Clear(); }; diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index c766305fd7dcc..6c42dc152d739 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -378,10 +378,16 @@ public InputConnection onCreateInputConnection(EditorInfo outAttrs) { private static final int kPointerDeviceKindMouse = 1; private static final int kPointerDeviceKindStylus = 2; private static final int kPointerDeviceKindInvertedStylus = 3; - private static final int kPointerDeviceKindUnknown = 4; + private static final int kPointerDeviceKindSignal = 4; + private static final int kPointerDeviceKindUnknown = 5; + + // Must match the PointerSignalKind enum in pointer.dart. + private static final int kPointerSignalKindNone = 0; + private static final int kPointerSignalKindScroll = 1; + private static final int kPointerSignalKindUnknown = 2; // These values must match the unpacking code in hooks.dart. - private static final int kPointerDataFieldCount = 21; + private static final int kPointerDataFieldCount = 24; private static final int kPointerBytesPerField = 8; private int getPointerChangeForAction(int maskedAction) { @@ -436,11 +442,14 @@ private void addPointerForIndex(MotionEvent event, int pointerIndex, int pointer int pointerKind = getPointerDeviceTypeForToolType(event.getToolType(pointerIndex)); + int signalKind = kPointerSignalKindNone; + long timeStamp = event.getEventTime() * 1000; // Convert from milliseconds to microseconds. packet.putLong(timeStamp); // time_stamp packet.putLong(pointerChange); // change packet.putLong(pointerKind); // kind + packet.putLong(signalKind); // signal_kind packet.putLong(event.getPointerId(pointerIndex)); // device packet.putDouble(event.getX(pointerIndex)); // physical_x packet.putDouble(event.getY(pointerIndex)); // physical_y @@ -492,6 +501,9 @@ private void addPointerForIndex(MotionEvent event, int pointerIndex, int pointer } packet.putLong(pointerData); // platformData + + packet.putDouble(0.0); // scroll_delta_x + packet.putDouble(0.0); // scroll_delta_y } @Override diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 7dffc91718e77..c4d0546474411 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -677,6 +677,19 @@ inline blink::PointerData::Change ToPointerDataChange( return blink::PointerData::Change::kCancel; } +// Returns the blink::PointerData::SignalKind for the given +// FlutterPointerSignaKind. +inline blink::PointerData::SignalKind ToPointerDataSignalKind( + FlutterPointerSignalKind kind) { + switch (kind) { + case kFlutterPointerSignalKindNone: + return blink::PointerData::SignalKind::kNone; + case kFlutterPointerSignalKindScroll: + return blink::PointerData::SignalKind::kScroll; + } + return blink::PointerData::SignalKind::kNone; +} + FlutterEngineResult FlutterEngineSendPointerEvent( FlutterEngine engine, const FlutterPointerEvent* pointers, @@ -699,6 +712,10 @@ FlutterEngineResult FlutterEngineSendPointerEvent( pointer_data.physical_x = SAFE_ACCESS(current, x, 0.0); pointer_data.physical_y = SAFE_ACCESS(current, y, 0.0); pointer_data.device = SAFE_ACCESS(current, device, 0); + pointer_data.signal_kind = ToPointerDataSignalKind( + SAFE_ACCESS(current, signal_kind, kFlutterPointerSignalKindNone)); + pointer_data.scroll_delta_x = SAFE_ACCESS(current, scroll_delta_x, 0.0); + pointer_data.scroll_delta_y = SAFE_ACCESS(current, scroll_delta_y, 0.0); packet->SetPointerData(i, pointer_data); current = reinterpret_cast( reinterpret_cast(current) + current->struct_size); diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 402f58ebcd3ef..103da739a2147 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -277,6 +277,7 @@ typedef struct { double pixel_ratio; } FlutterWindowMetricsEvent; +// The phase of the pointer event. typedef enum { kCancel, kUp, @@ -287,6 +288,12 @@ typedef enum { kHover, } FlutterPointerPhase; +// The type of a pointer signal. +typedef enum { + kFlutterPointerSignalKindNone, + kFlutterPointerSignalKindScroll, +} FlutterPointerSignalKind; + typedef struct { // The size of this struct. Must be sizeof(FlutterPointerEvent). size_t struct_size; @@ -297,6 +304,9 @@ typedef struct { // An optional device identifier. If this is not specified, it is assumed that // the embedder has no multitouch capability. int32_t device; + FlutterPointerSignalKind signal_kind; + double scroll_delta_x; + double scroll_delta_y; } FlutterPointerEvent; struct _FlutterPlatformMessageResponseHandle; From e37bd27b485d03d006e3ebbe174c64c40eea8434 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 5 Mar 2019 15:21:06 -0800 Subject: [PATCH 0359/1117] Fix weak pointer use violations in shell and platform view. (#8046) --- shell/common/platform_view.cc | 17 ++++++++++++++--- shell/common/platform_view.h | 2 ++ shell/common/shell.cc | 25 +++++++++++++------------ shell/common/surface.h | 2 +- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/shell/common/platform_view.cc b/shell/common/platform_view.cc index 7c7c1dc258aad..cd909814c66b8 100644 --- a/shell/common/platform_view.cc +++ b/shell/common/platform_view.cc @@ -60,7 +60,20 @@ void PlatformView::SetViewportMetrics(const blink::ViewportMetrics& metrics) { } void PlatformView::NotifyCreated() { - delegate_.OnPlatformViewCreated(CreateRenderingSurface()); + std::unique_ptr surface; + + // Threading: We want to use the platform view on the non-platform thread. + // Using the weak pointer is illegal. But, we are going to introduce a latch + // so that the platform view is not collected till the surface is obtained. + auto* platform_view = this; + fml::ManualResetWaitableEvent latch; + fml::TaskRunner::RunNowOrPostTask( + task_runners_.GetGPUTaskRunner(), [platform_view, &surface, &latch]() { + surface = platform_view->CreateRenderingSurface(); + latch.Signal(); + }); + latch.Wait(); + delegate_.OnPlatformViewCreated(std::move(surface)); } void PlatformView::NotifyDestroyed() { @@ -68,10 +81,8 @@ void PlatformView::NotifyDestroyed() { } sk_sp PlatformView::CreateResourceContext() const { -#ifndef OS_FUCHSIA FML_DLOG(WARNING) << "This platform does not setup the resource " "context on the IO thread for async texture uploads."; -#endif // OS_FUCHSIA return nullptr; } diff --git a/shell/common/platform_view.h b/shell/common/platform_view.h index ed3b6e999a3ea..2ed5091b46895 100644 --- a/shell/common/platform_view.h +++ b/shell/common/platform_view.h @@ -123,6 +123,8 @@ class PlatformView { SkISize size_; fml::WeakPtrFactory weak_factory_; + // Unlike all other methods on the platform view, this is called on the GPU + // task runner. virtual std::unique_ptr CreateRenderingSurface(); private: diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 4a501d3af7d31..ef177eacabcc3 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -446,26 +446,27 @@ void Shell::OnPlatformViewCreated(std::unique_ptr surface) { fml::TaskRunner::RunNowOrPostTask(gpu_task_runner, gpu_task); }; - auto io_task = [io_manager = io_manager_->GetWeakPtr(), - platform_view = platform_view_->GetWeakPtr(), + // Threading: Capture platform view by raw pointer and not the weak pointer. + // We are going to use the pointer on the IO thread which is not safe with a + // weak pointer. However, we are preventing the platform view from being + // collected by using a latch. + auto* platform_view = platform_view_.get(); + + FML_DCHECK(platform_view); + + auto io_task = [io_manager = io_manager_->GetWeakPtr(), platform_view, ui_task_runner = task_runners_.GetUITaskRunner(), ui_task] { - if (io_manager) { + if (io_manager && !io_manager->GetResourceContext()) { io_manager->NotifyResourceContextAvailable( - platform_view ? platform_view->CreateResourceContext() : nullptr); + platform_view->CreateResourceContext()); } // Step 1: Next, post a task on the UI thread to tell the engine that it has // an output surface. fml::TaskRunner::RunNowOrPostTask(ui_task_runner, ui_task); }; - // Step 0: If the IOManager doesn't already have a ResourceContext, tell the - // IO thread that the PlatformView can make one for it now. - // Otherwise, jump right to step 1 on the UI thread. - if (!io_manager_->GetResourceContext()) { - fml::TaskRunner::RunNowOrPostTask(task_runners_.GetIOTaskRunner(), io_task); - } else { - fml::TaskRunner::RunNowOrPostTask(task_runners_.GetUITaskRunner(), ui_task); - } + fml::TaskRunner::RunNowOrPostTask(task_runners_.GetIOTaskRunner(), io_task); + latch.Wait(); } diff --git a/shell/common/surface.h b/shell/common/surface.h index d82453a00dd29..dc37c803d9ce9 100644 --- a/shell/common/surface.h +++ b/shell/common/surface.h @@ -15,7 +15,7 @@ namespace shell { /// Represents a Frame that has been fully configured for the underlying client -/// rendering API. A frame may only be sumitted once. +/// rendering API. A frame may only be submitted once. class SurfaceFrame { public: using SubmitCallback = From b30f9897b9b8506d20dc5bdf943b42540ee4ea1b Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 5 Mar 2019 16:32:22 -0800 Subject: [PATCH 0360/1117] Improve elevation bounds for physical shape layers (#8044) * improve elevation bounds calculation and add diagram --- flow/layers/physical_shape_layer.cc | 38 ++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/flow/layers/physical_shape_layer.cc b/flow/layers/physical_shape_layer.cc index 841ae4cf6a076..d022ccb223305 100644 --- a/flow/layers/physical_shape_layer.cc +++ b/flow/layers/physical_shape_layer.cc @@ -9,6 +9,9 @@ namespace flow { +const SkScalar kLightHeight = 600; +const SkScalar kLightRadius = 800; + PhysicalShapeLayer::PhysicalShapeLayer(Clip clip_behavior) : isRect_(false), clip_behavior_(clip_behavior) {} @@ -51,11 +54,36 @@ void PhysicalShapeLayer::Preroll(PrerollContext* context, set_needs_system_composite(true); #else // Add some margin to the paint bounds to leave space for the shadow. - // The margin is hardcoded to an arbitrary maximum for now because Skia - // doesn't provide a way to calculate it. We fill this whole region - // and clip children to it so we don't need to join the child paint bounds. + // We fill this whole region and clip children to it so we don't need to + // join the child paint bounds. + // The offset is calculated as follows: + + // .-- (kLightRadius = 800) + // ----- (light) + // | (kLightHeight = 600) + // ------------- (layer) + // | + // | (elevation) + // | + // ------------------------------------------------ (canvas) + // ----------- (extent of shadow) + // + // E = lx } x = (r + w/2)/h + // } => + // r + w/2 = hx } E = (l/h)(r + w/2) + // + // Where: E = extent of shadow + // l = elevation of layer + // r = radius of the light source + // w = width of the layer + // h = light height + // x = multiplier for elevation to extent SkRect bounds(path_.getBounds()); - bounds.outset(20.0, 20.0); + double ex = (kLightRadius * device_pixel_ratio_ + bounds.width() * 0.5) / + kLightHeight; + double ey = (kLightRadius * device_pixel_ratio_ + bounds.height() * 0.5) / + kLightHeight; + bounds.outset(elevation_ * ex, elevation_ * ey); set_paint_bounds(bounds); #endif // defined(OS_FUCHSIA) } @@ -145,8 +173,6 @@ void PhysicalShapeLayer::DrawShadow(SkCanvas* canvas, SkScalar dpr) { const SkScalar kAmbientAlpha = 0.039f; const SkScalar kSpotAlpha = 0.25f; - const SkScalar kLightHeight = 600; - const SkScalar kLightRadius = 800; SkShadowFlags flags = transparentOccluder ? SkShadowFlags::kTransparentOccluder_ShadowFlag From 70a18b51533580505156b85ba9176c2036db6e65 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Tue, 5 Mar 2019 17:35:43 -0800 Subject: [PATCH 0361/1117] Add clang static analysis support to gn wrapper (#8047) Adds --clang-static-analysis option to GN to enable/disable compiling with clang static analysis enabled. --- DEPS | 2 +- tools/gn | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 004c3f14c31f7..fe3e5cd636d8d 100644 --- a/DEPS +++ b/DEPS @@ -116,7 +116,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '7f64ff4928e7106cd8d81c6397fba4b7c1cdbb96', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '4a12b0dfad16723b2190b697a669e3ae17b50b35', # Fuchsia compatibility # diff --git a/tools/gn b/tools/gn index 3a753ef39edef..8cf8af92d3166 100755 --- a/tools/gn +++ b/tools/gn @@ -91,6 +91,11 @@ def to_gn_args(args): gn_args['android_full_debug'] = args.target_os == 'android' and args.unoptimized gn_args['is_clang'] = not sys.platform.startswith(('cygwin', 'win')) + if not sys.platform.startswith(('cygwin', 'win')): + gn_args['use_clang_static_analyzer'] = args.clang_static_analyzer + else: + gn_args['use_clang_static_analyzer'] = False + gn_args['embedder_for_target'] = args.embedder_for_target gn_args['enable_coverage'] = args.coverage @@ -261,6 +266,9 @@ def parse_args(args): parser.add_argument('--clang', default=True, action='store_true') parser.add_argument('--no-clang', dest='clang', action='store_false') + parser.add_argument('--clang-static-analyzer', default=False, action='store_true') + parser.add_argument('--no-clang-static-analyzer', dest='clang_static_analyzer', action='store_false') + parser.add_argument('--target-sysroot', type=str) parser.add_argument('--target-toolchain', type=str) parser.add_argument('--target-triple', type=str) From 4773375c6815968631b6df87e3813e6e6cce1d83 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 5 Mar 2019 17:36:10 -0800 Subject: [PATCH 0362/1117] Used named conditionals for platform specific dependencies and suppress Android and Windows hooks on Mac. (#8051) --- .cirrus.yml | 2 +- DEPS | 80 ++++++++++++++++------------------------------------- 2 files changed, 25 insertions(+), 57 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index bfe6d0816b9fb..d55ef85f89ad5 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -65,7 +65,7 @@ task: # sudo gem install jazzy@0.9.4 gclient_sync_script: | mkdir -p $ENGINE_PATH/src - echo 'solutions = [{"managed": False,"name": "src/flutter","url": "git@github.com:flutter/engine.git","custom_deps": {},"deps_file": "DEPS","safesync_url": "",},]' > $ENGINE_PATH/.gclient + echo 'solutions = [{"managed": False,"name": "src/flutter","url": "git@github.com:flutter/engine.git","deps_file": "DEPS", "custom_vars": {"download_android_deps" : False, "download_windows_deps" : False,},},]' > $ENGINE_PATH/.gclient cd $ENGINE_PATH/src rm -rf flutter rm -rf out diff --git a/DEPS b/DEPS index fe3e5cd636d8d..00ee27c83be41 100644 --- a/DEPS +++ b/DEPS @@ -104,6 +104,12 @@ vars = { 'ios_tools_revision': '69b7c1b160e7107a6a98d948363772dc9caea46f', 'buildtools_revision': 'bac220c15490dcf7b7d8136f75100bbc77e8d217', + + # Checkout Android dependencies only on platforms where we build for Android targets. + 'download_android_deps': 'host_os == "mac" or host_os == "linux"', + + # Checkout Windows dependencies only if we are building on Windows. + 'download_windows_deps' : 'host_os == "win"', } # Only these hosts are allowed for dependencies in this DEPS file. @@ -383,10 +389,6 @@ deps = { Var('dart_git') + '/when.git' + '@' + '0.2.0', } -recursedeps = [ - 'src/buildtools', -] - hooks = [ { # This clobbers when necessary (based on get_landmines.py). It must be the @@ -402,12 +404,12 @@ hooks = [ { # Update the Windows toolchain if necessary. 'name': 'win_toolchain', + 'condition': 'download_windows_deps', 'pattern': '.', 'action': ['python', 'src/build/vs_toolchain.py', 'update'], }, { - # Pull dart sdk if needed - # this will be used by android_tools + # Pull prebuilt dart sdk. 'name': 'dart', 'pattern': '.', 'action': ['python', 'src/tools/dart/update.py'], @@ -415,31 +417,17 @@ hooks = [ { 'name': 'prepare_android_downloader', 'pattern': '.', + 'condition': 'download_android_deps', 'cwd': 'src/tools/android/android_sdk_downloader', - 'condition': 'host_os == "linux" or host_os == "mac"', 'action': [ '../../../third_party/dart/tools/sdks/dart-sdk/bin/pub', # this hook _must_ be run _after_ the dart hook. 'get' ], }, - # TODO(dnfield): This can be enabled when we actually support building - # the android engine on windows. For now there's no sense in having - # windows clients download bits they don't need. - # see: https://github.com/flutter/flutter/issues/13841 - # { - # 'name': 'prepare_android_downloader_win', - # 'pattern': '.', - # 'cwd': 'src\\tools\\android\\android_sdk_downloader', - # 'condition': 'host_os == "win"', - # 'action': [ - # '..\\..\\..\\third_party\\dart\\tools\\sdks\\dart-sdk\\bin\\pub.bat', # this hook _must_ be run _after_ the dart hook. - # 'get' - # ], - # }, { 'name': 'download_android_tools', 'pattern': '.', - 'condition': 'host_os == "mac" or host_os == "linux"', + 'condition': 'download_android_deps', 'action': [ 'src/third_party/dart/tools/sdks/dart-sdk/bin/dart', # this hook _must_ be run _after_ the dart hook. '--enable-asserts', @@ -454,31 +442,10 @@ hooks = [ '--ndk-version=19.1.5304403' ], }, - # TODO(dnfield): This can be enabled when we actually support building - # the android engine on windows. For now there's no sense in having - # windows clients download bits they don't need. - # see: https://github.com/flutter/flutter/issues/13841 - # { - # 'name': 'download_android_tools_win', - # 'pattern': '.', - # 'condition': 'host_os == "win"', - # 'action': [ - # 'src\\third_party\\dart\\tools\\sdks\\dart-sdk\\bin\\dart.exe', # this hook _must_ be run _after_ the dart hook. - # '--enable-asserts', - # 'src\\tools\\android\\android_sdk_downloader\\lib\\main.dart', - # '-y', # Accept licenses - # '--out=src\\third_party\\android_tools', - # '--platform=28', - # '--platform-revision=6', - # '--build-tools-version=28.0.3', - # '--platform-tools-version=28.0.1', - # '--tools-version=26.1.1', - # '--ndk-version=19.0.5232133' - # ], - # }, { 'name': 'download_android_support', 'pattern': '.', + 'condition': 'download_android_deps', 'action': [ 'python', 'src/flutter/tools/android_support/download_android_support.py', @@ -510,18 +477,19 @@ hooks = [ ], }, { - "name": "7zip", - "pattern": ".", - "action": [ - "download_from_google_storage", - "--no_auth", - "--no_resume", - "--bucket", - "dart-dependencies", - "--platform=win32", - "--extract", - "-s", - "src/third_party/dart/third_party/7zip.tar.gz.sha1", + 'name': '7zip', + 'pattern': '.', + 'condition': 'download_windows_deps', + 'action': [ + 'download_from_google_storage', + '--no_auth', + '--no_resume', + '--bucket', + 'dart-dependencies', + '--platform=win32', + '--extract', + '-s', + 'src/third_party/dart/third_party/7zip.tar.gz.sha1', ], }, ] From 57c120a2928888e5a38ad464b84721e296dabd23 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 5 Mar 2019 17:47:06 -0800 Subject: [PATCH 0363/1117] remove extra source files (#8052) --- BUILD.gn | 80 -------------------------------------------------------- 1 file changed, 80 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index bbd82204f17b6..a320299636089 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -5,18 +5,6 @@ import("$flutter_root/common/config.gni") import("//third_party/dart/build/dart/dart_action.gni") -# Temporary snapshot copy rules until we can use the full SDK. -_flutter_sdk_snapshots = [ - [ - "dart2js", - "//third_party/dart/utils/compiler:dart2js", - ], - [ - "kernel_worker", - "//third_party/dart/utils/bazel:kernel_worker", - ], -] - group("flutter") { testonly = true @@ -37,12 +25,7 @@ group("flutter") { "$flutter_root/frontend_server", "//third_party/dart:create_sdk", "$flutter_root/lib/stub_ui:stub_ui", - ":dart2js_platform_files", - ":flutter_dartdevc_kernel_sdk", ] - foreach(snapshot, _flutter_sdk_snapshots) { - public_deps += [ ":copy_flutter_${snapshot[0]}_snapshot" ] - } } } @@ -81,66 +64,3 @@ group("dist") { "$flutter_root/sky/dist", ] } - -foreach(snapshot, _flutter_sdk_snapshots) { - copy("copy_flutter_${snapshot[0]}_snapshot") { - deps = [ - snapshot[1], - ] - sources = [ - "$root_gen_dir/${snapshot[0]}.dart.snapshot", - ] - outputs = [ - "$root_out_dir/dart-sdk/bin/snapshots/flutter_{{source_file_part}}", - ] - } -} - -copy("dart2js_platform_files") { - deps = [ - "//third_party/dart/utils/compiler:compile_dart2js_platform" - ] - - sources = [ - "$root_out_dir/dart2js_outline.dill", - "$root_out_dir/dart2js_platform.dill", - ] - - outputs = [ - "$root_out_dir/flutter_patched_sdk/{{source_file_part}}", - ] -} - - -prebuilt_dart_action("flutter_dartdevc_kernel_sdk") { - deps = [ - "//third_party/dart:create_sdk", - ] - - packages = "//third_party/dart/.packages" - - script = "//third_party/dart/pkg/dev_compiler/tool/kernel_sdk.dart" - - inputs = [ - "//third_party/dart/pkg/dev_compiler/tool/kernel_sdk.dart", - ] - - outputs = [ - "$target_gen_dir/kernel/amd/dart_sdk.js", - "$target_gen_dir/kernel/amd/dart_sdk.js.map", - "$target_gen_dir/kernel/common/dart_sdk.js", - "$target_gen_dir/kernel/common/dart_sdk.js.map", - "$target_gen_dir/kernel/es6/dart_sdk.js", - "$target_gen_dir/kernel/es6/dart_sdk.js.map", - "$target_gen_dir/kernel/legacy/dart_sdk.js", - "$target_gen_dir/kernel/legacy/dart_sdk.js.map", - ] - - libraries_path = rebase_path("$flutter_root/lib/snapshot/libraries.json") - output_path = rebase_path("$target_gen_dir/kernel/flutter_ddc_sdk.dill") - - args = [ - "--output=$output_path", - "--libraries=$libraries_path", - ] -} From 840c5233ae9a68ced0616140e09c6994b80ee054 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Tue, 5 Mar 2019 18:30:39 -0800 Subject: [PATCH 0364/1117] Correct URL for Cirrus CI build status badge (#8054) --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7102ad364ac08..c5d94d44120ef 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,7 @@ Contributing to the Flutter engine ================================== -[![Build Status](https://cirrus-ci.com/flutter/engine.svg)][build_status] +[![Build Status](https://api.cirrus-ci.com/github/flutter/engine.svg)][build_status] _See also: [Flutter's code of conduct][code_of_conduct]_ @@ -16,7 +16,7 @@ the Engine development environment][engine_dev_setup] on our wiki. Those instructions are part of the broader onboarding instructions described in the contributing guide. -[build_status]: https://cirrus-ci.com/flutter/engine +[build_status]: https://cirrus-ci.com/github/flutter/engine [code_of_conduct]: https://github.com/flutter/flutter/blob/master/CODE_OF_CONDUCT.md [contrib_guide]: https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment [engine_dev_setup]: https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment From 7f16789b2ee0073fb20999610c9ecefa606b7edd Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 5 Mar 2019 20:07:10 -0800 Subject: [PATCH 0365/1117] Remove redundant thread checker in FML. (#8053) There is already fml/memory/thread_checker.h --- ci/licenses_golden/licenses_flutter | 2 - fml/BUILD.gn | 2 - fml/synchronization/thread_checker.h | 71 ------------------- .../thread_checker_unittest.cc | 37 ---------- 4 files changed, 112 deletions(-) delete mode 100644 fml/synchronization/thread_checker.h delete mode 100644 fml/synchronization/thread_checker_unittest.cc diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index f04bcef39103b..038903489a3f8 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -219,8 +219,6 @@ 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 diff --git a/fml/BUILD.gn b/fml/BUILD.gn index 6c442c779f62d..ca0b9ad9fec77 100644 --- a/fml/BUILD.gn +++ b/fml/BUILD.gn @@ -50,7 +50,6 @@ source_set("fml") { "synchronization/count_down_latch.h", "synchronization/shared_mutex.h", "synchronization/thread_annotations.h", - "synchronization/thread_checker.h", "synchronization/waitable_event.cc", "synchronization/waitable_event.h", "task_runner.cc", @@ -188,7 +187,6 @@ executable("fml_unittests") { "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", "thread_local_unittests.cc", "thread_unittests.cc", diff --git a/fml/synchronization/thread_checker.h b/fml/synchronization/thread_checker.h deleted file mode 100644 index 3501ac5d4a9e5..0000000000000 --- a/fml/synchronization/thread_checker.h +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// A class for checking that the current thread is/isn't the same as an initial -// thread. - -#ifndef FLUTTER_FML_SYNCHRONIZATION_THREAD_CHECKER_H_ -#define FLUTTER_FML_SYNCHRONIZATION_THREAD_CHECKER_H_ - -#include "flutter/fml/build_config.h" - -#if defined(OS_WIN) -#include -#else -#include -#endif - -#include "flutter/fml/logging.h" -#include "flutter/fml/macros.h" - -namespace fml { - -// A simple class that records the identity of the thread that it was created -// on, and at later points can tell if the current thread is the same as its -// creation thread. This class is thread-safe. -// -// Note: Unlike Chromium's |base::ThreadChecker|, this is *not* Debug-only (so -// #ifdef it out if you want something Debug-only). (Rationale: Having a -// |CalledOnValidThread()| that lies in Release builds seems bad. Moreover, -// there's a small space cost to having even an empty class. ) -class ThreadChecker final { - public: -#if defined(OS_WIN) - ThreadChecker() : self_(GetCurrentThreadId()) {} - ~ThreadChecker() {} - - bool IsCreationThreadCurrent() const { return GetCurrentThreadId() == self_; } - - private: - const DWORD self_; - -#else - ThreadChecker() : self_(pthread_self()) {} - ~ThreadChecker() {} - - // Returns true if the current thread is the thread this object was created - // on and false otherwise. - bool IsCreationThreadCurrent() const { - return !!pthread_equal(pthread_self(), self_); - } - - private: - const pthread_t self_; -#endif - - FML_DISALLOW_COPY_AND_ASSIGN(ThreadChecker); -}; - -#ifndef NDEBUG -#define FML_DECLARE_THREAD_CHECKER(c) fml::ThreadChecker c -#define FML_DCHECK_CREATION_THREAD_IS_CURRENT(c) \ - FML_DCHECK((c).IsCreationThreadCurrent()) -#else -#define FML_DECLARE_THREAD_CHECKER(c) -#define FML_DCHECK_CREATION_THREAD_IS_CURRENT(c) ((void)0) -#endif - -} // namespace fml - -#endif // FLUTTER_FML_SYNCHRONIZATION_THREAD_CHECKER_H_ diff --git a/fml/synchronization/thread_checker_unittest.cc b/fml/synchronization/thread_checker_unittest.cc deleted file mode 100644 index 92eb34f166157..0000000000000 --- a/fml/synchronization/thread_checker_unittest.cc +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2013 The Flutter 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/thread_checker.h" - -#include - -#include "gtest/gtest.h" - -namespace fml { -namespace { - -TEST(ThreadCheckerTest, SameThread) { - ThreadChecker checker; - EXPECT_TRUE(checker.IsCreationThreadCurrent()); -} - -// Note: This test depends on |std::thread| being compatible with -// |pthread_self()|. -TEST(ThreadCheckerTest, DifferentThreads) { - ThreadChecker checker1; - EXPECT_TRUE(checker1.IsCreationThreadCurrent()); - - std::thread thread([&checker1]() { - ThreadChecker checker2; - EXPECT_TRUE(checker2.IsCreationThreadCurrent()); - EXPECT_FALSE(checker1.IsCreationThreadCurrent()); - }); - thread.join(); - - // Note: Without synchronization, we can't look at |checker2| from the main - // thread. -} - -} // namespace -} // namespace fml From 3335764ae903efe253e33725efce6b64cdcca1bd Mon Sep 17 00:00:00 2001 From: liyuqian Date: Wed, 6 Mar 2019 08:39:00 -0800 Subject: [PATCH 0366/1117] Skip skp files in license check (#8050) * Skip skp files in license check This fixes https://bugs.chromium.org/p/skia/issues/detail?id=8828 * Update signature --- ci/licenses_golden/tool_signature | 2 +- tools/licenses/lib/filesystem.dart | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/licenses_golden/tool_signature b/ci/licenses_golden/tool_signature index 2189010017a26..e6f18498d5dbb 100644 --- a/ci/licenses_golden/tool_signature +++ b/ci/licenses_golden/tool_signature @@ -1,2 +1,2 @@ -Signature: 91b3b5b8c1ef9e911fd65b636d009be8 +Signature: e7b89482e4ea9fef22a33ad9fcc34961 diff --git a/tools/licenses/lib/filesystem.dart b/tools/licenses/lib/filesystem.dart index cf1cddbb31f27..dc5cd9d1be122 100644 --- a/tools/licenses/lib/filesystem.dart +++ b/tools/licenses/lib/filesystem.dart @@ -200,6 +200,7 @@ FileType identifyFile(String name, Reader reader) { case '.webp': return FileType.binary; // WEBP case '.pdf': return FileType.binary; // PDF case '.emf': return FileType.binary; // Windows enhanced metafile format + case '.skp': return FileType.binary; // Skia picture format // Videos case '.ogg': return FileType.binary; // Ogg media case '.mp4': return FileType.binary; // MPEG media From 2fe9c9b5fd24b998c81d9156d5716131c1597f18 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 6 Mar 2019 13:47:15 -0500 Subject: [PATCH 0367/1117] Roll src/third_party/skia 72542816cadb..801a9c16d81e (46 commits) (#8060) https://skia.googlesource.com/skia.git/%2Blog/72542816cadb..801a9c16d81e git log 72542816cadbc3d18a19725f6f6aecf45ffc188c..801a9c16d81ef848eb8c9ae2e94fa458eb7a681c --date=short --no-merges --format=%ad %ae %s 2019-03-06 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-05 herb@google.com Move process* closures into the GrTextBlob 2019-02-20 halcanary@google.com SkPDF: Add experimental Harfbuzz font subsetter 2019-03-06 mtklein@google.com also tag DM results with color and alpha type 2019-03-06 kjlubick@google.com [canvaskit] Remove additional copies of CanvasKit when testing 2019-03-06 borenet@google.com [infra] Remove bookmaker bots 2019-03-06 reed@google.com change gm to use srgb (not linear) so srgb and legacy draw the same 2019-03-05 jvanverth@google.com Fix stencil setup in Metal 2019-03-06 kjlubick@google.com [canvaskit] Add particles integration 2019-03-05 egdaniel@google.com Add ddl support to drawing to wrapped vulkan secondary command buffers. 2019-03-05 nifong@google.com Basic wasm skp debugger unit test 2019-03-06 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 a8300e56b550..e397949ec2db (1 commits) 2019-02-27 nigeltao@google.com SkWuffsCodec: replace memset+check_wuffs_version 2019-03-06 kjlubick@google.com [canvaskit] Add some APIs for speed and clients 2019-03-05 robertphillips@google.com Update YUVA mipmap generation path to take a GrRecordingContext 2019-03-06 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-03-06 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 55959b0bb19f..a8300e56b550 (3 commits) 2019-03-05 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-05 khushalsagar@chromium.org remote fonts: Ensure consistent gamma usage with remote and gpu fonts. 2019-03-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 8e3cddfd5a43..2f034a6e32fc (426 commits) 2019-03-05 michaelludwig@google.com Support per-entry transforms in image-set API 2019-03-05 csmartdalton@google.com Make mixed samples detection automatic 2019-03-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader e57f10e4041d..4c84dbdce271 (1 commits) 2019-03-04 herb@google.com Pointer to GrStrikeCache on GrTextBlob 2019-03-04 halcanary@google.com SkQP: from skqp_gn_args import SkqpGnArgs 2019-03-05 kjlubick@google.com [particles] Clean up build - remove test deps 2019-03-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 b8cff9e9347c..55959b0bb19f (3 commits) 2019-03-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms 7efede6c3d35..10736f2da359 (2 commits) 2019-03-05 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-05 reed@google.com array of unique verts 2019-03-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms b7157d764389..7efede6c3d35 (1 commits) 2019-03-05 robertphillips@google.com Make SkImage_Base::asTextureProxyRef take a GrRecordingContext parameter 2019-03-05 bsalomon@google.com Distinguish between "flushed" and "finished" idle state callbacks on GrTexture. 2019-03-05 robertphillips@google.com Clean up logic in fontregen GM 2019-03-05 bsalomon@google.com Use GrSurface::setRelease helper that creates ref-counted wrapper 2019-03-05 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-04 egdaniel@google.com Add unit test to check if we can create a VkDevice using global priority extension. 2019-03-04 scroggo@google.com Fix Android host-side Windows build 2019-03-05 csmartdalton@google.com Make sure to apply the stencil settings for GrDashOp 2019-03-04 benjaminwagner@google.com [infra] Upgrade Debian GCE bots to 9.8. 2019-03-04 herb@google.com Have SkGlyphRunListPainter close over SkStrikeCacheInterface 2019-03-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader e95eeb19a770..e57f10e4041d (1 commits) 2019-03-04 bungeman@google.com Clarify ownership of typefaces in implementation. 2019-03-05 nifong@google.com Initial wasm debugger 2019-03-04 benjaminwagner@google.com Add fetch-gn to canvaskit and cmake compile scripts 2019-03-04 ethannicholas@google.com Add support for runtime color filters written in SkSL. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/DEPS b/DEPS index 00ee27c83be41..c9920d648718d 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': '72542816cadbc3d18a19725f6f6aecf45ffc188c', + 'skia_revision': '801a9c16d81ef848eb8c9ae2e94fa458eb7a681c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index e9e85586b9d13..656f655385a1f 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: cf0991f5443f916cde12c3bc27ba049f +Signature: 171d209ab2e2243f9d0472e568158ad1 UNUSED LICENSES: @@ -2110,6 +2110,14 @@ FILE: ../../../third_party/skia/experimental/docs/jsonbaseddoc.htm FILE: ../../../third_party/skia/experimental/docs/svgBackend.js FILE: ../../../third_party/skia/experimental/docs/svgbaseddoc.htm FILE: ../../../third_party/skia/experimental/docs/utilities.js +FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/cpu.js +FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/debugger/index.html +FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/externs.js +FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/fonts/NotoMono-Regular.ttf +FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/karma.conf.js +FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/package.json +FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/ready.js +FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/sample.skp FILE: ../../../third_party/skia/infra/bots/assets.isolate FILE: ../../../third_party/skia/infra/bots/assets/android_ndk_darwin/VERSION FILE: ../../../third_party/skia/infra/bots/assets/android_ndk_linux/VERSION @@ -2255,13 +2263,6 @@ FILE: ../../../third_party/skia/infra/bots/recipes/android_compile.expected/andr 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/android_compile.expected/android_compile_unrecognized_target.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 -FILE: ../../../third_party/skia/infra/bots/recipes/bookmaker.expected/nightly_failed_fiddles.json -FILE: ../../../third_party/skia/infra/bots/recipes/bookmaker.expected/nightly_failed_upload.json -FILE: ../../../third_party/skia/infra/bots/recipes/bookmaker.expected/percommit_bookmaker.json -FILE: ../../../third_party/skia/infra/bots/recipes/bookmaker.expected/percommit_failed_validation.json FILE: ../../../third_party/skia/infra/bots/recipes/calmbench.expected/Calmbench-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All.json FILE: ../../../third_party/skia/infra/bots/recipes/calmbench.expected/Calmbench-Ubuntu17-Clang-Golo-GPU-QuadroP400-x86_64-Release-All.json FILE: ../../../third_party/skia/infra/bots/recipes/check_generated_files.expected/Housekeeper-PerCommit-CheckGeneratedFiles.json @@ -4652,7 +4653,10 @@ LIBRARY: skia ORIGIN: ../../../third_party/skia/experimental/canvaskit/WasmAliases.h + ../../../third_party/skia/LICENSE TYPE: LicenseType.bsd FILE: ../../../third_party/skia/experimental/canvaskit/WasmAliases.h +FILE: ../../../third_party/skia/experimental/canvaskit/particles_bindings.cpp FILE: ../../../third_party/skia/experimental/canvaskit/skottie_bindings.cpp +FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/debugger_bindings.cpp +FILE: ../../../third_party/skia/gm/runtimecolorfilter.cpp FILE: ../../../third_party/skia/modules/particles/include/SkCurve.h FILE: ../../../third_party/skia/modules/particles/include/SkParticleAffector.h FILE: ../../../third_party/skia/modules/particles/include/SkParticleData.h @@ -4665,6 +4669,7 @@ FILE: ../../../third_party/skia/modules/particles/src/SkParticleAffector.cpp FILE: ../../../third_party/skia/modules/particles/src/SkParticleDrawable.cpp FILE: ../../../third_party/skia/modules/particles/src/SkParticleEffect.cpp FILE: ../../../third_party/skia/modules/particles/src/SkReflected.cpp +FILE: ../../../third_party/skia/src/core/SkColorFilterPriv.h ---------------------------------------------------------------------------------------------------- Copyright 2019 Google LLC From 471a2c89a689ff1d5c70a5deb4565f646380bce6 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 6 Mar 2019 13:15:01 -0800 Subject: [PATCH 0368/1117] Send scroll events from the macOS shell (#8056) Adds scroll event handling to the macOS shell, sending them using the new embedding API. Currently, trackpad scrolling is just handled like scrollwheel scrolling, since the trackpad-gesture-based scroll handling in Flutter is still in progress. Adds code to synthesize Add events if mouse tracking isn't enabled, so that it doesn't rely on Flutter being lenient about handling events from pointers that have never been added. --- .../framework/Source/FLEViewController.mm | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/shell/platform/darwin/macos/framework/Source/FLEViewController.mm b/shell/platform/darwin/macos/framework/Source/FLEViewController.mm index ac901423ee1b6..76a1e08557004 100644 --- a/shell/platform/darwin/macos/framework/Source/FLEViewController.mm +++ b/shell/platform/darwin/macos/framework/Source/FLEViewController.mm @@ -39,6 +39,14 @@ @interface FLEViewController () */ @property(nonatomic) NSTrackingArea* trackingArea; +/** + * Whether or not a kAdd event has been sent for the mouse (or sent again since + * the last kRemove was sent if tracking is enabled). Used to determine whether + * to send an Add event before sending an incoming mouse event, since Flutter + * expects a pointers to be added before events are sent for them. + */ +@property(nonatomic) BOOL mouseCurrentlyAdded; + /** * Updates |trackingArea| for the current tracking settings, creating it with * the correct mode if tracking is enabled, or removing it if not. @@ -416,16 +424,54 @@ - (void)handlePlatformMessage:(const FlutterPlatformMessage*)message { } - (void)dispatchMouseEvent:(NSEvent*)event phase:(FlutterPointerPhase)phase { + // If a pointer added event hasn't been sent, synthesize one using this event for the basic + // information. + if (!_mouseCurrentlyAdded && phase != kAdd) { + // Only the values extracted for use in flutterEvent below matter, the rest are dummy values. + NSEvent* addEvent = [NSEvent enterExitEventWithType:NSEventTypeMouseEntered + location:event.locationInWindow + modifierFlags:0 + timestamp:event.timestamp + windowNumber:event.windowNumber + context:nil + eventNumber:0 + trackingNumber:0 + userData:NULL]; + [self dispatchMouseEvent:addEvent phase:kAdd]; + } + NSPoint locationInView = [self.view convertPoint:event.locationInWindow fromView:nil]; NSPoint locationInBackingCoordinates = [self.view convertPointToBacking:locationInView]; - const FlutterPointerEvent flutterEvent = { + FlutterPointerEvent flutterEvent = { .struct_size = sizeof(flutterEvent), .phase = phase, .x = locationInBackingCoordinates.x, .y = -locationInBackingCoordinates.y, // convertPointToBacking makes this negative. .timestamp = static_cast(event.timestamp * NSEC_PER_MSEC), }; + + if (event.type == NSEventTypeScrollWheel) { + flutterEvent.signal_kind = kFlutterPointerSignalKindScroll; + + double pixelsPerLine = 1.0; + if (!event.hasPreciseScrollingDeltas) { + CGEventSourceRef source = CGEventCreateSourceFromEvent(event.CGEvent); + pixelsPerLine = CGEventSourceGetPixelsPerLine(source); + if (source) { + CFRelease(source); + } + } + double scaleFactor = self.view.layer.contentsScale; + flutterEvent.scroll_delta_x = event.scrollingDeltaX * pixelsPerLine * scaleFactor; + flutterEvent.scroll_delta_y = -event.scrollingDeltaY * pixelsPerLine * scaleFactor; + } FlutterEngineSendPointerEvent(_engine, &flutterEvent, 1); + + if (phase == kAdd) { + _mouseCurrentlyAdded = YES; + } else if (phase == kRemove) { + _mouseCurrentlyAdded = NO; + } } - (void)dispatchKeyEvent:(NSEvent*)event ofType:(NSString*)type { @@ -539,4 +585,10 @@ - (void)mouseMoved:(NSEvent*)event { [self dispatchMouseEvent:event phase:kHover]; } +- (void)scrollWheel:(NSEvent*)event { + // TODO: Add gesture-based (trackpad) scroll support once it's supported by the engine rather + // than always using kHover. + [self dispatchMouseEvent:event phase:kHover]; +} + @end From 3661d5e43b83106498e3a4ce2226f976cebed021 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Wed, 6 Mar 2019 15:38:34 -0800 Subject: [PATCH 0369/1117] Re-land "Buffer lifecycle in WindowData" (#8032) --- lib/stub_ui/hooks.dart | 4 ++++ lib/stub_ui/window.dart | 9 +++++++++ lib/ui/hooks.dart | 7 +++++++ lib/ui/window.dart | 9 +++++++++ lib/ui/window/window.cc | 12 ++++++++++++ lib/ui/window/window.h | 1 + runtime/runtime_controller.cc | 14 +++++++++++++- runtime/runtime_controller.h | 3 +++ shell/common/engine.cc | 2 ++ 9 files changed, 60 insertions(+), 1 deletion(-) diff --git a/lib/stub_ui/hooks.dart b/lib/stub_ui/hooks.dart index 6e0820832939b..4ea381bfb8d34 100644 --- a/lib/stub_ui/hooks.dart +++ b/lib/stub_ui/hooks.dart @@ -84,6 +84,10 @@ void _updateUserSettingsData(String jsonData) { _updateAlwaysUse24HourFormat(data['alwaysUse24HourFormat']); } +void _updateLifecycleState(String state) { + window._initialLifecycleState ??= state; +} + void _updateTextScaleFactor(double textScaleFactor) { window._textScaleFactor = textScaleFactor; _invoke(window.onTextScaleFactorChanged, window._onTextScaleFactorChangedZone); diff --git a/lib/stub_ui/window.dart b/lib/stub_ui/window.dart index bc08ca95c3313..f3dedc642887e 100644 --- a/lib/stub_ui/window.dart +++ b/lib/stub_ui/window.dart @@ -551,6 +551,15 @@ class Window { _onLocaleChangedZone = Zone.current; } + /// The lifecycle state immediately after dart isolate initialization. + /// + /// This property will not be updated as the lifecycle changes. + /// + /// It is used to initialize [SchedulerBinding.lifecycleState] at startup + /// with any buffered lifecycle state events. + String get initialLifecycleState => _initialLifecycleState; + String _initialLifecycleState; + /// The setting indicating the current brightness mode of the host platform. /// If the platform has no preference, [platformBrightness] defaults to [Brightness.light]. Brightness get platformBrightness => _platformBrightness; diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index e88580a95ce06..4d299c91a24ed 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -89,6 +89,13 @@ void _updateUserSettingsData(String jsonData) { _updatePlatformBrightness(data['platformBrightness']); } +@pragma('vm:entry-point') +// ignore: unused_element +void _updateLifecycleState(String state) { + window._initialLifecycleState ??= state; +} + + void _updateTextScaleFactor(double textScaleFactor) { window._textScaleFactor = textScaleFactor; _invoke(window.onTextScaleFactorChanged, window._onTextScaleFactorChangedZone); diff --git a/lib/ui/window.dart b/lib/ui/window.dart index d89b668b7037d..6abceceb0261c 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -556,6 +556,15 @@ class Window { _onLocaleChangedZone = Zone.current; } + /// The lifecycle state immediately after dart isolate initialization. + /// + /// This property will not be updated as the lifecycle changes. + /// + /// It is used to initialize [SchedulerBinding.lifecycleState] at startup + /// with any buffered lifecycle state events. + String get initialLifecycleState => _initialLifecycleState; + String _initialLifecycleState; + /// The system-reported text scale. /// /// This establishes the text scaling factor to use when rendering text, diff --git a/lib/ui/window/window.cc b/lib/ui/window/window.cc index 0a90d6fcbf2d9..bfeb86cef66f4 100644 --- a/lib/ui/window/window.cc +++ b/lib/ui/window/window.cc @@ -217,6 +217,18 @@ void Window::UpdateUserSettingsData(const std::string& data) { })); } +void Window::UpdateLifecycleState(const std::string& data) { + std::shared_ptr dart_state = library_.dart_state().lock(); + if (!dart_state) + return; + tonic::DartState::Scope scope(dart_state); + tonic::LogIfError(tonic::DartInvokeField(library_.value(), + "_updateLifecycleState", + { + tonic::StdStringToDart(data), + })); +} + void Window::UpdateSemanticsEnabled(bool enabled) { std::shared_ptr dart_state = library_.dart_state().lock(); if (!dart_state) diff --git a/lib/ui/window/window.h b/lib/ui/window/window.h index 94a506fb5fa4d..f5624e4bad6af 100644 --- a/lib/ui/window/window.h +++ b/lib/ui/window/window.h @@ -65,6 +65,7 @@ class Window final { void UpdateWindowMetrics(const ViewportMetrics& metrics); void UpdateLocales(const std::vector& locales); void UpdateUserSettingsData(const std::string& data); + void UpdateLifecycleState(const std::string& data); void UpdateSemanticsEnabled(bool enabled); void UpdateAccessibilityFeatures(int32_t flags); void DispatchPlatformMessage(fml::RefPtr message); diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc index b57f2232acc47..83a848e87955c 100644 --- a/runtime/runtime_controller.cc +++ b/runtime/runtime_controller.cc @@ -128,7 +128,8 @@ bool RuntimeController::FlushRuntimeStateToIsolate() { SetLocales(window_data_.locale_data) && SetSemanticsEnabled(window_data_.semantics_enabled) && SetAccessibilityFeatures(window_data_.accessibility_feature_flags_) && - SetUserSettingsData(window_data_.user_settings_data); + SetUserSettingsData(window_data_.user_settings_data) && + SetLifecycleState(window_data_.lifecycle_state); } bool RuntimeController::SetViewportMetrics(const ViewportMetrics& metrics) { @@ -164,6 +165,17 @@ bool RuntimeController::SetUserSettingsData(const std::string& data) { return false; } +bool RuntimeController::SetLifecycleState(const std::string& data) { + window_data_.lifecycle_state = data; + + if (auto* window = GetWindowIfAvailable()) { + window->UpdateLifecycleState(window_data_.lifecycle_state); + return true; + } + + return false; +} + bool RuntimeController::SetSemanticsEnabled(bool enabled) { window_data_.semantics_enabled = enabled; diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h index c913795b8eba2..03f1389d8c613 100644 --- a/runtime/runtime_controller.h +++ b/runtime/runtime_controller.h @@ -49,6 +49,8 @@ class RuntimeController final : public WindowClient { bool SetUserSettingsData(const std::string& data); + bool SetLifecycleState(const std::string& data); + bool SetSemanticsEnabled(bool enabled); bool SetAccessibilityFeatures(int32_t flags); @@ -111,6 +113,7 @@ class RuntimeController final : public WindowClient { std::string variant_code; std::vector locale_data; std::string user_settings_data = "{}"; + std::string lifecycle_state; bool semantics_enabled = false; bool assistive_technology_enabled = false; int32_t accessibility_feature_flags_ = 0; diff --git a/shell/common/engine.cc b/shell/common/engine.cc index 084216072e988..5b2d5a5c3dd37 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -291,6 +291,8 @@ bool Engine::HandleLifecyclePlatformMessage(blink::PlatformMessage* message) { if (state == "AppLifecycleState.resumed" && have_surface_) { ScheduleFrame(); } + runtime_controller_->SetLifecycleState(state); + // Always forward these messages to the framework by returning false. return false; } From a93d99db98d42403ec83f5f7b3b8b4897578c328 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Wed, 6 Mar 2019 16:53:14 -0800 Subject: [PATCH 0370/1117] A11y callback (#8005) * implement callback for a11y readiness * use FlutterSemanticsUpdateNotification from header, move to VC header --- .../ios/framework/Headers/FlutterEngine.h | 20 +++++++++++++++++++ .../framework/Headers/FlutterViewController.h | 8 ++++++++ .../ios/framework/Source/FlutterEngine.mm | 4 ++++ shell/platform/darwin/ios/platform_view_ios.h | 6 +++--- .../platform/darwin/ios/platform_view_ios.mm | 7 +++++-- 5 files changed, 40 insertions(+), 5 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h b/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h index 262a97a1dc2d3..c7a4836a9f50c 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h @@ -133,6 +133,26 @@ FLUTTER_EXPORT */ - (void)destroyContext; +/** + * Ensures that Flutter will generate a semantics tree. + * + * This is enabled by default if certain accessibility services are turned on by + * the user, or when using a Simulator. This method allows a user to turn + * semantics on when they would not ordinarily be generated and the performance + * overhead is not a concern, e.g. for UI testing. Note that semantics should + * never be programatically turned off, as it would potentially disable + * accessibility services an end user has requested. + * + * This method must only be called after launching the engine via + * `-runWithEntrypoint:` or `-runWithEntryPoint:libraryURI`. + * + * You can subscribe to semantics updates via `NSNotificationCenter` by adding + * an observer for the name `FlutterSemanticsUpdateNotification`. The `object` + * parameter will be the `FlutterViewController` associated with the semantics + * update. + */ +- (void)ensureSemanticsEnabled; + /** * Sets the `FlutterViewController` for this instance. The FlutterEngine must be * running (e.g. a successful call to `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI`) diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h b/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h index 371a888c88394..1ac7d61c5e614 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h @@ -17,6 +17,14 @@ @class FlutterEngine; +/** + * The name used for semantic update nofications via `NSNotificationCenter`. + * + * The object passed as the sender is the `FlutterViewController` associated + * with the update. + */ +const NSNotificationName FlutterSemanticsUpdateNotification = @"FlutterSemanticsUpdate"; + /** * A `UIViewController` implementation for Flutter views. * diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm index 8b8bd33fdba2a..a90e49c7085fa 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -146,6 +146,10 @@ - (void)dispatchPointerDataPacket:(std::unique_ptr)pac return _shell->GetTaskRunners().GetPlatformTaskRunner(); } +- (void)ensureSemanticsEnabled { + self.iosPlatformView->SetSemanticsEnabled(true); +} + - (void)setViewController:(FlutterViewController*)viewController { FML_DCHECK(self.iosPlatformView); _viewController = [viewController getWeakPtr]; diff --git a/shell/platform/darwin/ios/platform_view_ios.h b/shell/platform/darwin/ios/platform_view_ios.h index a0d85a7ffd0f9..b7495b90fec51 100644 --- a/shell/platform/darwin/ios/platform_view_ios.h +++ b/shell/platform/darwin/ios/platform_view_ios.h @@ -40,6 +40,9 @@ class PlatformViewIOS final : public PlatformView { void SetTextInputPlugin(fml::scoped_nsprotocol plugin); + // |shell::PlatformView| + void SetSemanticsEnabled(bool enabled) override; + private: fml::WeakPtr owner_controller_; std::unique_ptr ios_surface_; @@ -57,9 +60,6 @@ class PlatformViewIOS final : public PlatformView { // |shell::PlatformView| sk_sp CreateResourceContext() const override; - // |shell::PlatformView| - void SetSemanticsEnabled(bool enabled) override; - // |shell::PlatformView| void SetAccessibilityFeatures(int32_t flags) override; diff --git a/shell/platform/darwin/ios/platform_view_ios.mm b/shell/platform/darwin/ios/platform_view_ios.mm index 4bcb08d21afe6..6f138edcfdd11 100644 --- a/shell/platform/darwin/ios/platform_view_ios.mm +++ b/shell/platform/darwin/ios/platform_view_ios.mm @@ -90,8 +90,8 @@ // |shell::PlatformView| void PlatformViewIOS::SetSemanticsEnabled(bool enabled) { if (!owner_controller_) { - FML_DLOG(WARNING) << "Could not set semantics to enabled, this " - "PlatformViewIOS has no ViewController."; + FML_LOG(WARNING) << "Could not set semantics to enabled, this " + "PlatformViewIOS has no ViewController."; return; } if (enabled && !accessibility_bridge_) { @@ -111,8 +111,11 @@ // |shell::PlatformView| void PlatformViewIOS::UpdateSemantics(blink::SemanticsNodeUpdates update, blink::CustomAccessibilityActionUpdates actions) { + FML_DCHECK(owner_controller_); if (accessibility_bridge_) { accessibility_bridge_->UpdateSemantics(std::move(update), std::move(actions)); + [[NSNotificationCenter defaultCenter] postNotificationName:FlutterSemanticsUpdateNotification + object:owner_controller_.get()]; } } From 5a06afa2a0b812b07c6e33743aff5bcbafbe4b1e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 6 Mar 2019 20:48:24 -0500 Subject: [PATCH 0371/1117] Roll src/third_party/skia 801a9c16d81e..3c957d575c58 (19 commits) (#8063) https://skia.googlesource.com/skia.git/%2Blog/801a9c16d81e..3c957d575c58 git log 801a9c16d81ef848eb8c9ae2e94fa458eb7a681c..3c957d575c584bdebbdff79129f48b4c5877e158 --date=short --no-merges --format=%ad %ae %s 2019-03-06 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 2f034a6e32fc..ca7eff86b174 (489 commits) 2019-03-06 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 2c25b14c34c1..76e9bc066b28 (1 commits) 2019-03-06 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-06 fmalita@chromium.org Make SkCubicMap immutable 2019-03-06 brianosman@google.com Particle cleanup: IWYU 2019-03-06 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 9584fe43a9c2..2c25b14c34c1 (1 commits) 2019-03-06 brianosman@google.com SkReflected - avoid double registration, auto register base types, etc. 2019-02-28 fmalita@chromium.org Make SkCubicMap public 2019-03-06 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 4c84dbdce271..9584fe43a9c2 (1 commits) 2019-03-06 jvanverth@google.com Another stab at MTLRenderCommandEncoder memory leak. 2019-03-06 mtklein@google.com encode F16Norm as rec2020 2019-03-06 reed@google.com change gradients4f to use srgb 2019-03-06 herb@google.com Fix: set SDFT if there is only fallback 2019-03-06 brianosman@google.com Add glf16norm config to DM 2019-03-06 nifong@google.com Interface for passing skp file from JS to WASM 2019-03-06 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms 10736f2da359..5e67e5c19fd3 (1 commits) 2019-03-06 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-06 brianosman@google.com Particles: Cleanup and better UI 2019-03-06 mtklein@google.com rework colorImage testing The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index c9920d648718d..040b28815489c 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': '801a9c16d81ef848eb8c9ae2e94fa458eb7a681c', + 'skia_revision': '3c957d575c584bdebbdff79129f48b4c5877e158', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 656f655385a1f..958a8f2feacd3 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 171d209ab2e2243f9d0472e568158ad1 +Signature: 657b81661adc356ab79d52cbc9b249f4 UNUSED LICENSES: @@ -1575,6 +1575,7 @@ FILE: ../../../third_party/skia/include/c/sk_imageinfo.h FILE: ../../../third_party/skia/include/core/SkCanvasVirtualEnforcer.h FILE: ../../../third_party/skia/include/core/SkContourMeasure.h FILE: ../../../third_party/skia/include/core/SkCoverageMode.h +FILE: ../../../third_party/skia/include/core/SkCubicMap.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 @@ -1686,7 +1687,6 @@ FILE: ../../../third_party/skia/src/core/SkColorSpaceXformSteps.h FILE: ../../../third_party/skia/src/core/SkContourMeasure.cpp FILE: ../../../third_party/skia/src/core/SkCoverageModePriv.h 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 @@ -2112,12 +2112,12 @@ FILE: ../../../third_party/skia/experimental/docs/svgbaseddoc.htm FILE: ../../../third_party/skia/experimental/docs/utilities.js FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/cpu.js FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/debugger/index.html +FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/debugger/sample.skp FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/externs.js FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/fonts/NotoMono-Regular.ttf FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/karma.conf.js FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/package.json FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/ready.js -FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/sample.skp FILE: ../../../third_party/skia/infra/bots/assets.isolate FILE: ../../../third_party/skia/infra/bots/assets/android_ndk_darwin/VERSION FILE: ../../../third_party/skia/infra/bots/assets/android_ndk_linux/VERSION From 3fb627f2c06a8c41d1e236518237fe4ee0a0d8d0 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Wed, 6 Mar 2019 18:45:01 -0800 Subject: [PATCH 0372/1117] add signal to pointer kinds (#8065) --- lib/ui/pointer.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ui/pointer.dart b/lib/ui/pointer.dart index fd5f3a13e25aa..b9a32cb56c1b5 100644 --- a/lib/ui/pointer.dart +++ b/lib/ui/pointer.dart @@ -50,6 +50,9 @@ enum PointerDeviceKind { /// A pointer device with a stylus that has been inverted. invertedStylus, + /// A pointer device that uses a pointer signal. + signal, + /// An unknown pointer device. unknown } From ca0bac4fb02778aba6d935d98e3acbae5180fdf5 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Wed, 6 Mar 2019 20:55:34 -0800 Subject: [PATCH 0373/1117] Revert "add signal to pointer kinds" (#8066) --- lib/ui/pointer.dart | 3 --- lib/ui/window/pointer_data.h | 1 - shell/platform/android/io/flutter/view/FlutterView.java | 3 +-- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/ui/pointer.dart b/lib/ui/pointer.dart index b9a32cb56c1b5..fd5f3a13e25aa 100644 --- a/lib/ui/pointer.dart +++ b/lib/ui/pointer.dart @@ -50,9 +50,6 @@ enum PointerDeviceKind { /// A pointer device with a stylus that has been inverted. invertedStylus, - /// A pointer device that uses a pointer signal. - signal, - /// An unknown pointer device. unknown } diff --git a/lib/ui/window/pointer_data.h b/lib/ui/window/pointer_data.h index 56fd6067a1b35..f58c377044d3d 100644 --- a/lib/ui/window/pointer_data.h +++ b/lib/ui/window/pointer_data.h @@ -28,7 +28,6 @@ struct alignas(8) PointerData { kMouse, kStylus, kInvertedStylus, - kSignal, }; // Must match the PointerSignalKind enum in pointer.dart. diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 6c42dc152d739..8df25207422ba 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -378,8 +378,7 @@ public InputConnection onCreateInputConnection(EditorInfo outAttrs) { private static final int kPointerDeviceKindMouse = 1; private static final int kPointerDeviceKindStylus = 2; private static final int kPointerDeviceKindInvertedStylus = 3; - private static final int kPointerDeviceKindSignal = 4; - private static final int kPointerDeviceKindUnknown = 5; + private static final int kPointerDeviceKindUnknown = 4; // Must match the PointerSignalKind enum in pointer.dart. private static final int kPointerSignalKindNone = 0; From 68ed654ea99b59ca711c149f018f54e39f607b2e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 7 Mar 2019 01:35:34 -0500 Subject: [PATCH 0374/1117] Roll src/third_party/skia 3c957d575c58..692122e3ef23 (6 commits) (#8067) https://skia.googlesource.com/skia.git/%2Blog/3c957d575c58..692122e3ef23 git log 3c957d575c584bdebbdff79129f48b4c5877e158..692122e3ef2335ae7569d73960375743bb9af989 --date=short --no-merges --format=%ad %ae %s 2019-03-06 herb@google.com Don't apply the view matrix twice for complicated fallback 2019-03-07 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader bf943f67daa4..2995dc2a67c7 (2 commits) 2019-03-06 bungeman@google.com Correct argument order for blobs in viewer. 2019-03-06 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 76e9bc066b28..bf943f67daa4 (2 commits) 2019-03-06 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 e397949ec2db..14126505b237 (4 commits) 2019-03-06 recipe-roller@chromium.org Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 040b28815489c..07203f0821690 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': '3c957d575c584bdebbdff79129f48b4c5877e158', + 'skia_revision': '692122e3ef2335ae7569d73960375743bb9af989', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 958a8f2feacd3..852aedbaf67e4 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 657b81661adc356ab79d52cbc9b249f4 +Signature: bab11cccef86d46bab1376a56023393b UNUSED LICENSES: From 80c6dd2864bc32487d09f3508b3038a06b224ff0 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 7 Mar 2019 07:32:30 -0500 Subject: [PATCH 0375/1117] Roll src/third_party/skia 692122e3ef23..4c1ea43a79b5 (3 commits) (#8069) https://skia.googlesource.com/skia.git/%2Blog/692122e3ef23..4c1ea43a79b5 git log 692122e3ef2335ae7569d73960375743bb9af989..4c1ea43a79b5be7522adeac2e1e0d9ae21f26193 --date=short --no-merges --format=%ad %ae %s 2019-03-07 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 952d27384a7e..45faa0849352 (1 commits) 2019-03-07 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 2995dc2a67c7..952d27384a7e (1 commits) 2019-03-07 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 07203f0821690..2b2ba40f54d66 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': '692122e3ef2335ae7569d73960375743bb9af989', + 'skia_revision': '4c1ea43a79b5be7522adeac2e1e0d9ae21f26193', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 852aedbaf67e4..50b5bd7ab4252 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: bab11cccef86d46bab1376a56023393b +Signature: ea74b6b2903e553ca56be5bff0a607a6 UNUSED LICENSES: From ff46dd38f276e52d75074978ed5f7b48dc38b14d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 7 Mar 2019 12:05:23 -0500 Subject: [PATCH 0376/1117] Roll src/third_party/skia 4c1ea43a79b5..88b8d1124b72 (8 commits) (#8070) https://skia.googlesource.com/skia.git/%2Blog/4c1ea43a79b5..88b8d1124b72 git log 4c1ea43a79b5be7522adeac2e1e0d9ae21f26193..88b8d1124b7280d379f7545eda4b9097a4d8a292 --date=short --no-merges --format=%ad %ae %s 2019-03-07 bsalomon@google.com Revert "Distinguish between "flushed" and "finished" idle state callbacks on GrTexture." 2019-03-07 fmalita@chromium.org [skottie] Use std::chrono for load time stats 2019-03-07 bsalomon@google.com Revert "Change promise image contract to for when Release and Done are called." 2019-03-06 herb@google.com Removed unused fallback code 2019-03-07 kjlubick@google.com [canvaskit] Increase timeout and add logging to further diagnose test flakiness 2019-03-06 mtklein@google.com fix f16norm mips 2019-03-06 bsalomon@google.com Change promise image contract to for when Release and Done are called. 2019-03-06 reed@google.com remove dead SK_SUPPORT_LEGACY_CHOOSERASTERPIPELINE code The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 2b2ba40f54d66..d682b445b74a8 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': '4c1ea43a79b5be7522adeac2e1e0d9ae21f26193', + 'skia_revision': '88b8d1124b7280d379f7545eda4b9097a4d8a292', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 50b5bd7ab4252..96a293f5e1329 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ea74b6b2903e553ca56be5bff0a607a6 +Signature: 5499bdd90e967369cfc64f95ffd6b6d7 UNUSED LICENSES: From de90dbff7d0e27a81e78d11322e232c90022b108 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Thu, 7 Mar 2019 11:03:39 -0800 Subject: [PATCH 0377/1117] Refactor web configuration/ Add dartdevc (#7978) --- BUILD.gn | 3 +- ci/licenses_golden/licenses_flutter | 2 +- lib/snapshot/libraries.json | 117 -------------- lib/snapshot/libraries.yaml | 115 ------------- lib/stub_ui/BUILD.gn | 41 ----- lib/stub_ui/libraries.json | 122 -------------- lib/stub_ui/libraries.yaml | 128 --------------- web_sdk/BUILD.gn | 66 ++++++++ web_sdk/libraries.json | 236 +++++++++++++++++++++++++++ web_sdk/libraries.yaml | 240 ++++++++++++++++++++++++++++ web_sdk/make_combined_sdk.sh | 16 ++ 11 files changed, 560 insertions(+), 526 deletions(-) delete mode 100644 lib/stub_ui/BUILD.gn delete mode 100644 lib/stub_ui/libraries.json delete mode 100644 lib/stub_ui/libraries.yaml create mode 100644 web_sdk/BUILD.gn create mode 100644 web_sdk/libraries.json create mode 100644 web_sdk/libraries.yaml create mode 100755 web_sdk/make_combined_sdk.sh diff --git a/BUILD.gn b/BUILD.gn index a320299636089..248524f872551 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -3,7 +3,6 @@ # found in the LICENSE file. import("$flutter_root/common/config.gni") -import("//third_party/dart/build/dart/dart_action.gni") group("flutter") { testonly = true @@ -24,7 +23,7 @@ group("flutter") { public_deps += [ "$flutter_root/frontend_server", "//third_party/dart:create_sdk", - "$flutter_root/lib/stub_ui:stub_ui", + "$flutter_root/web_sdk", ] } } diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 038903489a3f8..a73eae28ef67d 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -251,7 +251,6 @@ FILE: ../../../flutter/lib/stub_ui/hash_codes.dart FILE: ../../../flutter/lib/stub_ui/hooks.dart FILE: ../../../flutter/lib/stub_ui/isolate_name_server.dart FILE: ../../../flutter/lib/stub_ui/lerp.dart -FILE: ../../../flutter/lib/stub_ui/libraries.json FILE: ../../../flutter/lib/stub_ui/natives.dart FILE: ../../../flutter/lib/stub_ui/painting.dart FILE: ../../../flutter/lib/stub_ui/plugins.dart @@ -704,6 +703,7 @@ FILE: ../../../flutter/vulkan/vulkan_utilities.cc FILE: ../../../flutter/vulkan/vulkan_utilities.h FILE: ../../../flutter/vulkan/vulkan_window.cc FILE: ../../../flutter/vulkan/vulkan_window.h +FILE: ../../../flutter/web_sdk/libraries.json ---------------------------------------------------------------------------------------------------- Copyright 2013 The Flutter Authors. All rights reserved. diff --git a/lib/snapshot/libraries.json b/lib/snapshot/libraries.json index bc3d0d832c952..99ef4cd778f8c 100644 --- a/lib/snapshot/libraries.json +++ b/lib/snapshot/libraries.json @@ -1,123 +1,6 @@ { "comment:0": "NOTE: THIS FILE IS GENERATED. DO NOT EDIT.", "comment:1": "Instead modify 'flutter/lib/snapshot/libraries.yaml' and follow the instructions therein.", - "none": { - "libraries": {} - }, - "dartdevc": { - "libraries": { - "async": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/async_patch.dart", - "uri": "../../../third_party/dart/sdk/lib/async/async.dart" - }, - "_runtime": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart" - }, - "_interceptors": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart" - }, - "mirrors": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/mirrors_patch.dart", - "supported": false, - "uri": "../../../third_party/dart/sdk/lib/mirrors/mirrors.dart" - }, - "_debugger": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/debugger.dart" - }, - "io": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/io_patch.dart", - "supported": false, - "uri": "../../../third_party/dart/sdk/lib/io/io.dart" - }, - "_internal": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart", - "uri": "../../../third_party/dart/sdk/lib/internal/internal.dart" - }, - "_metadata": { - "uri": "../../../third_party/dart/sdk/lib/html/html_common/metadata.dart" - }, - "_http": { - "uri": "../../../third_party/dart/sdk/lib/_http/http.dart" - }, - "_js_primitives": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_primitives.dart" - }, - "_js_helper": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart" - }, - "ui": { - "uri": "flutter/lib/stub_ui/ui.dart" - }, - "js": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart" - }, - "_js_mirrors": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart" - }, - "html_common": { - "uri": "../../../third_party/dart/sdk/lib/html/html_common/html_common_dart2js.dart" - }, - "_native_typed_data": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/native_typed_data.dart" - }, - "core": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart", - "uri": "../../../third_party/dart/sdk/lib/core/core.dart" - }, - "js_util": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js_util/dart2js/js_util_dart2js.dart" - }, - "collection": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart", - "uri": "../../../third_party/dart/sdk/lib/collection/collection.dart" - }, - "typed_data": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/typed_data_patch.dart", - "uri": "../../../third_party/dart/sdk/lib/typed_data/typed_data.dart" - }, - "web_audio": { - "uri": "../../../third_party/dart/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" - }, - "html": { - "uri": "../../../third_party/dart/sdk/lib/html/dart2js/html_dart2js.dart" - }, - "developer": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart", - "uri": "../../../third_party/dart/sdk/lib/developer/developer.dart" - }, - "isolate": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/isolate_patch.dart", - "supported": false, - "uri": "../../../third_party/dart/sdk/lib/isolate/isolate.dart" - }, - "web_gl": { - "uri": "../../../third_party/dart/sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" - }, - "indexed_db": { - "uri": "../../../third_party/dart/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" - }, - "convert": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/convert_patch.dart", - "uri": "../../../third_party/dart/sdk/lib/convert/convert.dart" - }, - "_isolate_helper": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart" - }, - "math": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart", - "uri": "../../../third_party/dart/sdk/lib/math/math.dart" - }, - "_foreign_helper": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/foreign_helper.dart" - }, - "web_sql": { - "uri": "../../../third_party/dart/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" - }, - "svg": { - "uri": "../../../third_party/dart/sdk/lib/svg/dart2js/svg_dart2js.dart" - } - } - }, "flutter": { "libraries": { "_builtin": { diff --git a/lib/snapshot/libraries.yaml b/lib/snapshot/libraries.yaml index cb65d57bd7b8b..c4244eaff8719 100644 --- a/lib/snapshot/libraries.yaml +++ b/lib/snapshot/libraries.yaml @@ -11,9 +11,6 @@ # changing libraries, sources, and patch files. See # https://github.com/dart-lang/sdk/issues/28836. -none: - libraries: {} - flutter: libraries: _builtin: @@ -150,115 +147,3 @@ flutter: vmservice_io: uri: "../../../third_party/dart/runtime/bin/vmservice/vmservice_io.dart" - -dartdevc: - libraries: - _runtime: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart" - - _debugger: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/debugger.dart" - - _foreign_helper: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/foreign_helper.dart" - - _http: - uri: "../../../third_party/dart/sdk/lib/_http/http.dart" - - _interceptors: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart" - - _internal: - uri: "../../../third_party/dart/sdk/lib/internal/internal.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart" - - _isolate_helper: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart" - - _js_helper: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart" - - _js_mirrors: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart" - - _js_primitives: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_primitives.dart" - - _metadata: - uri: "../../../third_party/dart/sdk/lib/html/html_common/metadata.dart" - - _native_typed_data: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/native_typed_data.dart" - - async: - uri: "../../../third_party/dart/sdk/lib/async/async.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/async_patch.dart" - - collection: - uri: "../../../third_party/dart/sdk/lib/collection/collection.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart" - - convert: - uri: "../../../third_party/dart/sdk/lib/convert/convert.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/convert_patch.dart" - - core: - uri: "../../../third_party/dart/sdk/lib/core/core.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart" - - developer: - uri: "../../../third_party/dart/sdk/lib/developer/developer.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart" - - io: - uri: "../../../third_party/dart/sdk/lib/io/io.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/io_patch.dart" - supported: false - - isolate: - uri: "../../../third_party/dart/sdk/lib/isolate/isolate.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/isolate_patch.dart" - supported: false - - mirrors: - uri: "../../../third_party/dart/sdk/lib/mirrors/mirrors.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/mirrors_patch.dart" - supported: false - - math: - uri: "../../../third_party/dart/sdk/lib/math/math.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart" - - typed_data: - uri: "../../../third_party/dart/sdk/lib/typed_data/typed_data.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/typed_data_patch.dart" - - html: - uri: "../../../third_party/dart/sdk/lib/html/dart2js/html_dart2js.dart" - - html_common: - uri: "../../../third_party/dart/sdk/lib/html/html_common/html_common_dart2js.dart" - - indexed_db: - uri: "../../../third_party/dart/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" - - js: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart" - - js_util: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js_util/dart2js/js_util_dart2js.dart" - - svg: - uri: "../../../third_party/dart/sdk/lib/svg/dart2js/svg_dart2js.dart" - - web_audio: - uri: "../../../third_party/dart/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" - - web_gl: - uri: "../../../third_party/dart/sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" - - web_sql: - uri: "../../../third_party/dart/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" - - ui: - uri: "flutter/lib/stub_ui/ui.dart" diff --git a/lib/stub_ui/BUILD.gn b/lib/stub_ui/BUILD.gn deleted file mode 100644 index 218f0344083df..0000000000000 --- a/lib/stub_ui/BUILD.gn +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright 2019 The Flutter Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -copy("stub_ui") { - sources = [ - "compositing.dart", - "geometry.dart", - "hash_codes.dart", - "hooks.dart", - "isolate_name_server.dart", - "lerp.dart", - "natives.dart", - "painting.dart", - "plugins.dart", - "pointer.dart", - "semantics.dart", - "text.dart", - "ui.dart", - "versions.dart", - "window.dart", - ] - - deps = [ - ":stub_libraries", - ] - - outputs = [ - "$root_out_dir/flutter_patched_sdk/stub_ui/{{source_file_part}}" - ] -} - -copy("stub_libraries") { - sources = [ - "$flutter_root/lib/stub_ui/libraries.json" - ] - - outputs = [ - "$root_out_dir/flutter_patched_sdk/libraries.json" - ] -} diff --git a/lib/stub_ui/libraries.json b/lib/stub_ui/libraries.json deleted file mode 100644 index 60313c4ce6cbc..0000000000000 --- a/lib/stub_ui/libraries.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "comment:0": "NOTE: THIS FILE IS GENERATED. DO NOT EDIT.", - "comment:1": "Instead modify 'flutter/lib/stub_ui/libraries.yaml' and follow the instructions therein.", - "dart2js": { - "libraries": { - "async": { - "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart", - "uri": "../../../../dart-sdk/lib/async/async.dart" - }, - "_interceptors": { - "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/interceptors.dart" - }, - "mirrors": { - "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart", - "supported": false, - "uri": "../../../../dart-sdk/lib/mirrors/mirrors.dart" - }, - "_js_embedded_names": { - "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart" - }, - "io": { - "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/io_patch.dart", - "supported": false, - "uri": "../../../../dart-sdk/lib/io/io.dart" - }, - "_internal": { - "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/internal_patch.dart", - "uri": "../../../../dart-sdk/lib/internal/internal.dart" - }, - "_metadata": { - "uri": "../../../../dart-sdk/lib/html/html_common/metadata.dart" - }, - "_async_await_error_codes": { - "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart" - }, - "_http": { - "uri": "../../../../dart-sdk/lib/_http/http.dart" - }, - "_js_primitives": { - "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/js_primitives.dart" - }, - "_js_helper": { - "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/js_helper.dart" - }, - "_chrome": { - "uri": "../../../../dart-sdk/lib/_chrome/dart2js/chrome_dart2js.dart" - }, - "html_common": { - "uri": "../../../../dart-sdk/lib/html/html_common/html_common_dart2js.dart" - }, - "ui": { - "uri": "stub_ui/ui.dart" - }, - "js": { - "uri": "../../../../dart-sdk/lib/js/dart2js/js_dart2js.dart" - }, - "_native_typed_data": { - "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/native_typed_data.dart" - }, - "_js_names": { - "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/js_names.dart" - }, - "core": { - "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/core_patch.dart", - "uri": "../../../../dart-sdk/lib/core/core.dart" - }, - "collection": { - "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/collection_patch.dart", - "uri": "../../../../dart-sdk/lib/collection/collection.dart" - }, - "js_util": { - "uri": "../../../../dart-sdk/lib/js_util/dart2js/js_util_dart2js.dart" - }, - "typed_data": { - "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/typed_data_patch.dart", - "uri": "../../../../dart-sdk/lib/typed_data/typed_data.dart" - }, - "web_audio": { - "uri": "../../../../dart-sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" - }, - "html": { - "uri": "../../../../dart-sdk/lib/html/dart2js/html_dart2js.dart" - }, - "isolate": { - "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/isolate_patch.dart", - "supported": false, - "uri": "../../../../dart-sdk/lib/isolate/isolate.dart" - }, - "developer": { - "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/developer_patch.dart", - "uri": "../../../../dart-sdk/lib/developer/developer.dart" - }, - "web_gl": { - "uri": "../../../../dart-sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" - }, - "indexed_db": { - "uri": "../../../../dart-sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" - }, - "_js": { - "patches": "../../../../dart-sdk/lib/js/_js_client.dart", - "uri": "../../../../dart-sdk/lib/js/_js.dart" - }, - "convert": { - "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/convert_patch.dart", - "uri": "../../../../dart-sdk/lib/convert/convert.dart" - }, - "math": { - "patches": "../../../../dart-sdk/lib/_internal/js_runtime/lib/math_patch.dart", - "uri": "../../../../dart-sdk/lib/math/math.dart" - }, - "_foreign_helper": { - "uri": "../../../../dart-sdk/lib/_internal/js_runtime/lib/foreign_helper.dart" - }, - "web_sql": { - "uri": "../../../../dart-sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" - }, - "svg": { - "uri": "../../../../dart-sdk/lib/svg/dart2js/svg_dart2js.dart" - } - } - } -} \ No newline at end of file diff --git a/lib/stub_ui/libraries.yaml b/lib/stub_ui/libraries.yaml deleted file mode 100644 index aded84171f6e5..0000000000000 --- a/lib/stub_ui/libraries.yaml +++ /dev/null @@ -1,128 +0,0 @@ -# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file -# for details. All rights reserved. Use of this source code is governed by a -# BSD-style license that can be found in the LICENSE file. - -# Note: if you edit this file, you must also edit libraries.json in this -# directory: -# -#. python third_party/dart/tools/yaml2json.py flutter/lib/snapshot/libraries.yaml flutter/lib/snapshot/libraries.json -# -# We currently have several different files that needs to be updated when -# changing libraries, sources, and patch files. See -# https://github.com/dart-lang/sdk/issues/28836. - -dart2js: - libraries: - ui: - uri: "stub_ui/ui.dart" - - async: - uri: "../../../../dart-sdk/lib/async/async.dart" - patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart" - - _chrome: - uri: "../../../../dart-sdk/lib/_chrome/dart2js/chrome_dart2js.dart" - - collection: - uri: "../../../../dart-sdk/lib/collection/collection.dart" - patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/collection_patch.dart" - - convert: - uri: "../../../../dart-sdk/lib/convert/convert.dart" - patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/convert_patch.dart" - - core: - uri: "../../../../dart-sdk/lib/core/core.dart" - patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/core_patch.dart" - - developer: - uri: "../../../../dart-sdk/lib/developer/developer.dart" - patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/developer_patch.dart" - - html: - uri: "../../../../dart-sdk/lib/html/dart2js/html_dart2js.dart" - - html_common: - uri: "../../../../dart-sdk/lib/html/html_common/html_common_dart2js.dart" - - indexed_db: - uri: "../../../../dart-sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" - - _http: - uri: "../../../../dart-sdk/lib/_http/http.dart" - - io: - uri: "../../../../dart-sdk/lib/io/io.dart" - patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/io_patch.dart" - supported: false - - isolate: - uri: "../../../../dart-sdk/lib/isolate/isolate.dart" - patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/isolate_patch.dart" - supported: false - - js: - uri: "../../../../dart-sdk/lib/js/dart2js/js_dart2js.dart" - - _js: - uri: "../../../../dart-sdk/lib/js/_js.dart" - patches: "../../../../dart-sdk/lib/js/_js_client.dart" - - js_util: - uri: "../../../../dart-sdk/lib/js_util/dart2js/js_util_dart2js.dart" - - math: - uri: "../../../../dart-sdk/lib/math/math.dart" - patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/math_patch.dart" - - mirrors: - uri: "../../../../dart-sdk/lib/mirrors/mirrors.dart" - patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart" - supported: false - - typed_data: - uri: "../../../../dart-sdk/lib/typed_data/typed_data.dart" - patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/typed_data_patch.dart" - - _native_typed_data: - uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/native_typed_data.dart" - - svg: - uri: "../../../../dart-sdk/lib/svg/dart2js/svg_dart2js.dart" - - web_audio: - uri: "../../../../dart-sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" - - web_gl: - uri: "../../../../dart-sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" - - web_sql: - uri: "../../../../dart-sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" - - _internal: - uri: "../../../../dart-sdk/lib/internal/internal.dart" - patches: "../../../../dart-sdk/lib/_internal/js_runtime/lib/internal_patch.dart" - - _js_helper: - uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/js_helper.dart" - - _interceptors: - uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/interceptors.dart" - - _foreign_helper: - uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/foreign_helper.dart" - - _js_names: - uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/js_names.dart" - - _js_primitives: - uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/js_primitives.dart" - - _js_embedded_names: - uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart" - - _async_await_error_codes: - uri: "../../../../dart-sdk/lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart" - - _metadata: - uri: "../../../../dart-sdk/lib/html/html_common/metadata.dart" \ No newline at end of file diff --git a/web_sdk/BUILD.gn b/web_sdk/BUILD.gn new file mode 100644 index 0000000000000..507afb3d6816f --- /dev/null +++ b/web_sdk/BUILD.gn @@ -0,0 +1,66 @@ +# Copyright 2019 The Flutter 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("web_sdk") { + sdk_copy_deps = [] + + deps = [ + ":web_ui_sources", + ":web_libraries_json", + ":dart_sdk_internal", + ] + sdk_copy_deps +} + +copy("web_ui_sources") { + sources = [ + "$flutter_root/lib/stub_ui/compositing.dart", + "$flutter_root/lib/stub_ui/geometry.dart", + "$flutter_root/lib/stub_ui/hash_codes.dart", + "$flutter_root/lib/stub_ui/hooks.dart", + "$flutter_root/lib/stub_ui/isolate_name_server.dart", + "$flutter_root/lib/stub_ui/lerp.dart", + "$flutter_root/lib/stub_ui/natives.dart", + "$flutter_root/lib/stub_ui/painting.dart", + "$flutter_root/lib/stub_ui/plugins.dart", + "$flutter_root/lib/stub_ui/pointer.dart", + "$flutter_root/lib/stub_ui/semantics.dart", + "$flutter_root/lib/stub_ui/text.dart", + "$flutter_root/lib/stub_ui/ui.dart", + "$flutter_root/lib/stub_ui/versions.dart", + "$flutter_root/lib/stub_ui/window.dart", + ] + + outputs = [ + "$root_out_dir/flutter_web_sdk/lib/ui/{{source_file_part}}" + ] +} + +copy("web_libraries_json") { + sources = [ + "libraries.json" + ] + + outputs = [ + "$root_out_dir/flutter_web_sdk/lib/libraries.json" + ] +} + +copy("dart_sdk_internal") { + deps = [ + "//third_party/dart:create_sdk" + ] + + sources = [ + "$root_out_dir/dart-sdk/lib/_internal/ddc_sdk.dill", + "$root_out_dir/dart-sdk/lib/_internal/dart2js_platform.dill", + "$root_out_dir/dart-sdk/lib/_internal/dart2js_server_platform.dill", + "$root_out_dir/dart-sdk/lib/_internal/ddc_sdk.sum", + "$root_out_dir/dart-sdk/lib/_internal/strong.sum", + "$root_out_dir/dart-sdk/lib/_internal/vm_platform_strong.dill", + ] + + outputs = [ + "$root_out_dir/flutter_web_sdk/lib/_internal/{{source_file_part}}" + ] +} diff --git a/web_sdk/libraries.json b/web_sdk/libraries.json new file mode 100644 index 0000000000000..a9203707e82f4 --- /dev/null +++ b/web_sdk/libraries.json @@ -0,0 +1,236 @@ +{ + "comment:0": "NOTE: THIS FILE IS GENERATED. DO NOT EDIT.", + "comment:1": "Instead modify 'flutter/flutter_web/libraries.yaml' and follow the instructions therein.", + "dart2js": { + "libraries": { + "async": { + "patches": "lib/_internal/js_runtime/lib/async_patch.dart", + "uri": "lib/async/async.dart" + }, + "_interceptors": { + "uri": "lib/_internal/js_runtime/lib/interceptors.dart" + }, + "mirrors": { + "patches": "lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart", + "supported": false, + "uri": "lib/mirrors/mirrors.dart" + }, + "_js_embedded_names": { + "uri": "lib/_internal/js_runtime/lib/shared/embedded_names.dart" + }, + "io": { + "patches": "lib/_internal/js_runtime/lib/io_patch.dart", + "supported": false, + "uri": "lib/io/io.dart" + }, + "_internal": { + "patches": "lib/_internal/js_runtime/lib/internal_patch.dart", + "uri": "lib/internal/internal.dart" + }, + "_metadata": { + "uri": "lib/html/html_common/metadata.dart" + }, + "_async_await_error_codes": { + "uri": "lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart" + }, + "_http": { + "uri": "lib/_http/http.dart" + }, + "_js_primitives": { + "uri": "lib/_internal/js_runtime/lib/js_primitives.dart" + }, + "_js_helper": { + "uri": "lib/_internal/js_runtime/lib/js_helper.dart" + }, + "_chrome": { + "uri": "lib/_chrome/dart2js/chrome_dart2js.dart" + }, + "html_common": { + "uri": "lib/html/html_common/html_common_dart2js.dart" + }, + "ui": { + "uri": "../lib/ui/ui.dart" + }, + "js": { + "uri": "lib/js/dart2js/js_dart2js.dart" + }, + "_native_typed_data": { + "uri": "lib/_internal/js_runtime/lib/native_typed_data.dart" + }, + "_js_names": { + "uri": "lib/_internal/js_runtime/lib/js_names.dart" + }, + "core": { + "patches": "lib/_internal/js_runtime/lib/core_patch.dart", + "uri": "lib/core/core.dart" + }, + "collection": { + "patches": "lib/_internal/js_runtime/lib/collection_patch.dart", + "uri": "lib/collection/collection.dart" + }, + "js_util": { + "uri": "lib/js_util/dart2js/js_util_dart2js.dart" + }, + "typed_data": { + "patches": "lib/_internal/js_runtime/lib/typed_data_patch.dart", + "uri": "lib/typed_data/typed_data.dart" + }, + "web_audio": { + "uri": "lib/web_audio/dart2js/web_audio_dart2js.dart" + }, + "html": { + "uri": "lib/html/dart2js/html_dart2js.dart" + }, + "isolate": { + "patches": "lib/_internal/js_runtime/lib/isolate_patch.dart", + "supported": false, + "uri": "lib/isolate/isolate.dart" + }, + "developer": { + "patches": "lib/_internal/js_runtime/lib/developer_patch.dart", + "uri": "lib/developer/developer.dart" + }, + "web_gl": { + "uri": "lib/web_gl/dart2js/web_gl_dart2js.dart" + }, + "indexed_db": { + "uri": "lib/indexed_db/dart2js/indexed_db_dart2js.dart" + }, + "_js": { + "patches": "lib/js/_js_client.dart", + "uri": "lib/js/_js.dart" + }, + "convert": { + "patches": "lib/_internal/js_runtime/lib/convert_patch.dart", + "uri": "lib/convert/convert.dart" + }, + "math": { + "patches": "lib/_internal/js_runtime/lib/math_patch.dart", + "uri": "lib/math/math.dart" + }, + "_foreign_helper": { + "uri": "lib/_internal/js_runtime/lib/foreign_helper.dart" + }, + "web_sql": { + "uri": "lib/web_sql/dart2js/web_sql_dart2js.dart" + }, + "svg": { + "uri": "lib/svg/dart2js/svg_dart2js.dart" + } + } + }, + "dartdevc": { + "libraries": { + "async": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/async_patch.dart", + "uri": "lib/async/async.dart" + }, + "_runtime": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart" + }, + "_interceptors": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart" + }, + "mirrors": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/mirrors_patch.dart", + "supported": false, + "uri": "lib/mirrors/mirrors.dart" + }, + "_debugger": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/debugger.dart" + }, + "io": { + "patches": "io_patch.dart", + "supported": false, + "uri": "lib/io/io.dart" + }, + "_internal": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart", + "uri": "lib/internal/internal.dart" + }, + "_metadata": { + "uri": "lib/html/html_common/metadata.dart" + }, + "_http": { + "uri": "lib/_http/http.dart" + }, + "_js_primitives": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_primitives.dart" + }, + "_js_helper": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart" + }, + "ui": { + "uri": "../lib/ui/ui.dart" + }, + "js": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart" + }, + "_js_mirrors": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart" + }, + "html_common": { + "uri": "lib/html/html_common/html_common_dart2js.dart" + }, + "_native_typed_data": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/native_typed_data.dart" + }, + "core": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart", + "uri": "lib/core/core.dart" + }, + "js_util": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js_util/dart2js/js_util_dart2js.dart" + }, + "collection": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart", + "uri": "lib/collection/collection.dart" + }, + "typed_data": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/typed_data_patch.dart", + "uri": "lib/typed_data/typed_data.dart" + }, + "web_audio": { + "uri": "lib/web_audio/dart2js/web_audio_dart2js.dart" + }, + "html": { + "uri": "lib/html/dart2js/html_dart2js.dart" + }, + "developer": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart", + "uri": "lib/developer/developer.dart" + }, + "isolate": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/isolate_patch.dart", + "supported": false, + "uri": "lib/isolate/isolate.dart" + }, + "web_gl": { + "uri": "lib/web_gl/dart2js/web_gl_dart2js.dart" + }, + "indexed_db": { + "uri": "lib/indexed_db/dart2js/indexed_db_dart2js.dart" + }, + "convert": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/convert_patch.dart", + "uri": "lib/convert/convert.dart" + }, + "_isolate_helper": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart" + }, + "math": { + "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart", + "uri": "lib/math/math.dart" + }, + "_foreign_helper": { + "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/foreign_helper.dart" + }, + "web_sql": { + "uri": "lib/web_sql/dart2js/web_sql_dart2js.dart" + }, + "svg": { + "uri": "lib/svg/dart2js/svg_dart2js.dart" + } + } + } +} \ No newline at end of file diff --git a/web_sdk/libraries.yaml b/web_sdk/libraries.yaml new file mode 100644 index 0000000000000..2516e18d4fdbf --- /dev/null +++ b/web_sdk/libraries.yaml @@ -0,0 +1,240 @@ +# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. + +# Note: if you edit this file, you must also edit libraries.json in this +# directory: +# +#. python third_party/dart/tools/yaml2json.py flutter/lib/snapshot/libraries.yaml flutter/lib/snapshot/libraries.json +# +# We currently have several different files that needs to be updated when +# changing libraries, sources, and patch files. See +# https://github.com/dart-lang/sdk/issues/28836. + +dartdevc: + libraries: + _runtime: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart" + + _debugger: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/debugger.dart" + + _foreign_helper: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/foreign_helper.dart" + + _http: + uri: "lib/_http/http.dart" + + _interceptors: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart" + + _internal: + uri: "lib/internal/internal.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart" + + _isolate_helper: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart" + + _js_helper: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart" + + _js_mirrors: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart" + + _js_primitives: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_primitives.dart" + + _metadata: + uri: "lib/html/html_common/metadata.dart" + + _native_typed_data: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/native_typed_data.dart" + + async: + uri: "lib/async/async.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/async_patch.dart" + + collection: + uri: "lib/collection/collection.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart" + + convert: + uri: "lib/convert/convert.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/convert_patch.dart" + + core: + uri: "lib/core/core.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart" + + developer: + uri: "lib/developer/developer.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart" + + io: + uri: "lib/io/io.dart" + patches: "io_patch.dart" + supported: false + + isolate: + uri: "lib/isolate/isolate.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/isolate_patch.dart" + supported: false + + mirrors: + uri: "lib/mirrors/mirrors.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/mirrors_patch.dart" + supported: false + + math: + uri: "lib/math/math.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart" + + typed_data: + uri: "lib/typed_data/typed_data.dart" + patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/typed_data_patch.dart" + + html: + uri: "lib/html/dart2js/html_dart2js.dart" + + html_common: + uri: "lib/html/html_common/html_common_dart2js.dart" + + indexed_db: + uri: "lib/indexed_db/dart2js/indexed_db_dart2js.dart" + + js: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart" + + js_util: + uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js_util/dart2js/js_util_dart2js.dart" + + svg: + uri: "lib/svg/dart2js/svg_dart2js.dart" + + web_audio: + uri: "lib/web_audio/dart2js/web_audio_dart2js.dart" + + web_gl: + uri: "lib/web_gl/dart2js/web_gl_dart2js.dart" + + web_sql: + uri: "lib/web_sql/dart2js/web_sql_dart2js.dart" + + ui: + uri: "../lib/ui/ui.dart" + +dart2js: + libraries: + ui: + uri: "../lib/ui/ui.dart" + + async: + uri: "lib/async/async.dart" + patches: "lib/_internal/js_runtime/lib/async_patch.dart" + + _chrome: + uri: "lib/_chrome/dart2js/chrome_dart2js.dart" + + collection: + uri: "lib/collection/collection.dart" + patches: "lib/_internal/js_runtime/lib/collection_patch.dart" + + convert: + uri: "lib/convert/convert.dart" + patches: "lib/_internal/js_runtime/lib/convert_patch.dart" + + core: + uri: "lib/core/core.dart" + patches: "lib/_internal/js_runtime/lib/core_patch.dart" + + developer: + uri: "lib/developer/developer.dart" + patches: "lib/_internal/js_runtime/lib/developer_patch.dart" + + html: + uri: "lib/html/dart2js/html_dart2js.dart" + + html_common: + uri: "lib/html/html_common/html_common_dart2js.dart" + + indexed_db: + uri: "lib/indexed_db/dart2js/indexed_db_dart2js.dart" + + _http: + uri: "lib/_http/http.dart" + + io: + uri: "lib/io/io.dart" + patches: "io_patch.dart" + supported: false + + isolate: + uri: "lib/isolate/isolate.dart" + patches: "lib/_internal/js_runtime/lib/isolate_patch.dart" + supported: false + + js: + uri: "lib/js/dart2js/js_dart2js.dart" + + _js: + uri: "lib/js/_js.dart" + patches: "lib/js/_js_client.dart" + + js_util: + uri: "lib/js_util/dart2js/js_util_dart2js.dart" + + math: + uri: "lib/math/math.dart" + patches: "lib/_internal/js_runtime/lib/math_patch.dart" + + mirrors: + uri: "lib/mirrors/mirrors.dart" + patches: "lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart" + supported: false + + typed_data: + uri: "lib/typed_data/typed_data.dart" + patches: "lib/_internal/js_runtime/lib/typed_data_patch.dart" + + _native_typed_data: + uri: "lib/_internal/js_runtime/lib/native_typed_data.dart" + + svg: + uri: "lib/svg/dart2js/svg_dart2js.dart" + + web_audio: + uri: "lib/web_audio/dart2js/web_audio_dart2js.dart" + + web_gl: + uri: "lib/web_gl/dart2js/web_gl_dart2js.dart" + + web_sql: + uri: "lib/web_sql/dart2js/web_sql_dart2js.dart" + + _internal: + uri: "lib/internal/internal.dart" + patches: "lib/_internal/js_runtime/lib/internal_patch.dart" + + _js_helper: + uri: "lib/_internal/js_runtime/lib/js_helper.dart" + + _interceptors: + uri: "lib/_internal/js_runtime/lib/interceptors.dart" + + _foreign_helper: + uri: "lib/_internal/js_runtime/lib/foreign_helper.dart" + + _js_names: + uri: "lib/_internal/js_runtime/lib/js_names.dart" + + _js_primitives: + uri: "lib/_internal/js_runtime/lib/js_primitives.dart" + + _js_embedded_names: + uri: "lib/_internal/js_runtime/lib/shared/embedded_names.dart" + + _async_await_error_codes: + uri: "lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart" + + _metadata: + uri: "lib/html/html_common/metadata.dart" \ No newline at end of file diff --git a/web_sdk/make_combined_sdk.sh b/web_sdk/make_combined_sdk.sh new file mode 100755 index 0000000000000..06b673baba8a2 --- /dev/null +++ b/web_sdk/make_combined_sdk.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Reference script for creating patched sdk locally. +# Copy normal dart sources into flutter_patched sdk +mkdir -p out/host_debug_unopt/flutter_patched_sdk/lib +cp -RL out/host_debug_unopt/dart-sdk/lib/ out/host_debug_unopt/flutter_patched_sdk/lib + +# Copy stub ui dart sources into flutter_patched sdk +mkdir -p out/host_debug_unopt/flutter_patched_sdk/lib/ui +cp -RL flutter/lib/stub_ui/ out/host_debug_unopt/flutter_patched_sdk/lib/ui + +# Copy libraries.json into flutter patched sdk. +cp -RL flutter/flutter_web/libraries.json out/host_debug_unopt/flutter_patched_sdk/lib/libraries.json + +# Copy libraries.dart into flutter patched sdk +cp -RL flutter/flutter_web/libraries.dart out/host_debug_unopt/flutter_patched_sdk/lib/_internal/libraries.dart From d71bfe58dd20fced2f6776d636a9dc32c502e67e Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 7 Mar 2019 11:44:00 -0800 Subject: [PATCH 0378/1117] Only build a full Dart SDK when building for the host system (#8071) --- tools/gn | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/gn b/tools/gn index 8cf8af92d3166..ee784e5300d33 100755 --- a/tools/gn +++ b/tools/gn @@ -232,8 +232,9 @@ def to_gn_args(args): if args.arm_float_abi: gn_args['arm_float_abi'] = args.arm_float_abi - # Switch flutter to full Dart SDK. - gn_args['dart_platform_sdk'] = False + # Switch flutter to full Dart SDK when building for the host system. + if args.target_os is None: + gn_args['dart_platform_sdk'] = False return gn_args From d3f6d7a21d1a866e39cc114c788db99d119d2c12 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Thu, 7 Mar 2019 15:07:50 -0800 Subject: [PATCH 0379/1117] only partial rule revert (#8078) --- web_sdk/BUILD.gn | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/web_sdk/BUILD.gn b/web_sdk/BUILD.gn index 507afb3d6816f..47d8121cbec45 100644 --- a/web_sdk/BUILD.gn +++ b/web_sdk/BUILD.gn @@ -3,13 +3,11 @@ # found in the LICENSE file. group("web_sdk") { - sdk_copy_deps = [] - deps = [ ":web_ui_sources", ":web_libraries_json", - ":dart_sdk_internal", - ] + sdk_copy_deps + #":dart_sdk_internal", + ] } copy("web_ui_sources") { @@ -46,21 +44,21 @@ copy("web_libraries_json") { ] } -copy("dart_sdk_internal") { - deps = [ - "//third_party/dart:create_sdk" - ] +# copy("dart_sdk_internal") { +# deps = [ +# "//third_party/dart:create_sdk" +# ] - sources = [ - "$root_out_dir/dart-sdk/lib/_internal/ddc_sdk.dill", - "$root_out_dir/dart-sdk/lib/_internal/dart2js_platform.dill", - "$root_out_dir/dart-sdk/lib/_internal/dart2js_server_platform.dill", - "$root_out_dir/dart-sdk/lib/_internal/ddc_sdk.sum", - "$root_out_dir/dart-sdk/lib/_internal/strong.sum", - "$root_out_dir/dart-sdk/lib/_internal/vm_platform_strong.dill", - ] +# sources = [ +# "$root_out_dir/dart-sdk/lib/_internal/ddc_sdk.dill", +# "$root_out_dir/dart-sdk/lib/_internal/dart2js_platform.dill", +# "$root_out_dir/dart-sdk/lib/_internal/dart2js_server_platform.dill", +# "$root_out_dir/dart-sdk/lib/_internal/ddc_sdk.sum", +# "$root_out_dir/dart-sdk/lib/_internal/strong.sum", +# "$root_out_dir/dart-sdk/lib/_internal/vm_platform_strong.dill", +# ] - outputs = [ - "$root_out_dir/flutter_web_sdk/lib/_internal/{{source_file_part}}" - ] -} +# outputs = [ +# "$root_out_dir/flutter_web_sdk/lib/_internal/{{source_file_part}}" +# ] +# } From 7426305f5d7fd6d8a2d1ebddb67e1330b3728082 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 7 Mar 2019 16:10:03 -0800 Subject: [PATCH 0380/1117] Mark const extern (#8077) * Mark const extern * fix build --- .cirrus.yml | 4 ++-- .../darwin/ios/framework/Headers/FlutterViewController.h | 2 +- .../darwin/ios/framework/Source/FlutterViewController.mm | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index d55ef85f89ad5..4ea101ac93b66 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -11,7 +11,7 @@ gke_container: task: env: CIRRUS_WORKING_DIR: "/tmp/github_repo" - + DEPOT_TOOLS_UPDATE: 0 replace_engine_script: | cd $ENGINE_PATH/src rm -r flutter @@ -88,7 +88,7 @@ format_and_dart_test_task: env: CIRRUS_WORKING_DIR: "/tmp/github_repo" - + DEPOT_TOOLS_UPDATE: 0 replace_engine_script: | cd $ENGINE_PATH/src rm -r flutter diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h b/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h index 1ac7d61c5e614..5881b3c1aeff6 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h @@ -23,7 +23,7 @@ * The object passed as the sender is the `FlutterViewController` associated * with the update. */ -const NSNotificationName FlutterSemanticsUpdateNotification = @"FlutterSemanticsUpdate"; +extern NSNotificationName const FlutterSemanticsUpdateNotification; /** * A `UIViewController` implementation for Flutter views. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 2e4a265d17f0e..076e3bec3402b 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -22,6 +22,8 @@ #include "flutter/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h" #include "flutter/shell/platform/darwin/ios/platform_view_ios.h" +NSNotificationName const FlutterSemanticsUpdateNotification = @"FlutterSemanticsUpdate"; + @implementation FlutterViewController { std::unique_ptr> _weakFactory; fml::scoped_nsobject _engine; From b5f59ed89dbcea6db7492b9e22f841cc785262b9 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 7 Mar 2019 16:28:22 -0800 Subject: [PATCH 0381/1117] Delay the vsync callback till the frame start time specified by embedder. (#8072) The current assumption is that the embedder will wait till the vsync event and then fire the callback. However, some embedders have that information upfront. Since the time point has already been specified by the embedder, there is no reason to burden the embedder with having to setup a wait either. --- shell/common/vsync_waiter.cc | 5 +++-- shell/platform/embedder/embedder.h | 26 ++++++++++++++++++-------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/shell/common/vsync_waiter.cc b/shell/common/vsync_waiter.cc index 9443fa8a55791..a117c7fff5142 100644 --- a/shell/common/vsync_waiter.cc +++ b/shell/common/vsync_waiter.cc @@ -35,7 +35,7 @@ void VsyncWaiter::FireCallback(fml::TimePoint frame_start_time, return; } - task_runners_.GetUITaskRunner()->PostTask( + task_runners_.GetUITaskRunner()->PostTaskForTime( [callback, frame_start_time, frame_target_time]() { #if defined(OS_FUCHSIA) // In general, traces on Fuchsia are recorded across the whole system. @@ -49,7 +49,8 @@ void VsyncWaiter::FireCallback(fml::TimePoint frame_start_time, TRACE_EVENT0("flutter", "VSYNC"); #endif callback(frame_start_time, frame_target_time); - }); + }, + frame_start_time); } float VsyncWaiter::GetDisplayRefreshRate() const { diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 103da739a2147..bbb1a9161bc43 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -549,13 +549,15 @@ typedef struct { // Flutter application (such as compiled shader programs used by Skia). // This is optional. The string must be NULL terminated. const char* persistent_cache_path; - // A callback that gets invoked by the engine when it attempts to wait for - // a platform vsync event. The engine will give the platform a baton that - // needs to be returned back to the engine via |FlutterEngineOnVsync|. All - // vsync operations must occur on the thread that made the call to - // |FlutterEngineRun|. All batons must be retured to the engine before - // initializing a |FlutterEngineShutdown|. Not doing the same will result in a - // memory leak. + // A callback that gets invoked by the engine when it attempts to wait for a + // platform vsync event. The engine will give the platform a baton that needs + // to be returned back to the engine via |FlutterEngineOnVsync|. All batons + // must be retured to the engine before initializing a + // |FlutterEngineShutdown|. Not doing the same will result in a memory leak. + // While the call to |FlutterEngineOnVsync| must occur on the thread that made + // the call to |FlutterEngineRun|, the engine will make this callback on an + // internal engine-managed thread. If the components accessed on the embedder + // are not thread safe, the appropriate re-threading must be done. VsyncCallback vsync_callback; } FlutterProjectArgs; @@ -645,7 +647,15 @@ FlutterEngineResult FlutterEngineDispatchSemanticsAction( size_t data_length); // Notify the engine that a vsync event occurred. A baton passed to the -// platform via the vsync callback must be returned. +// platform via the vsync callback must be returned. This call must be made on +// the thread on which the call to |FlutterEngineRun| was made. +// +// |frame_start_time_nanos| is the point at which the vsync event occurred. +// |frame_target_time_nanos| is the point at which the embedder anticipates the +// next vsync to occur. This is a hint the engine uses to schedule Dart VM +// garbage collection in periods in which the various threads are most likely to +// be idle. For example, for a 60Hz display, embedders should add 16.6 * 1e6 to +// the frame time field. FLUTTER_EXPORT FlutterEngineResult FlutterEngineOnVsync(FlutterEngine engine, intptr_t baton, From a48cd16e077778a7aa5908e4faa4da07714260f2 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Thu, 7 Mar 2019 16:46:44 -0800 Subject: [PATCH 0382/1117] Update a11y word forward/back enum names (#8073) This updates the FlutterSemanticsAction enumerator identifiers for the 'move cursor forward/back one word' actions (added in flutter/engine#8033) for consistency with the 'move cusor forward/back on character' identifiers. ABI compatibility is unaffected, but this with require the following change in any embedder making use of these fields: Rename: kFlutterSemanticsActionMoveCursorForwardByWordIndex to: kFlutterSemanticsActionMoveCursorForwardByWord Rename: kFlutterSemanticsActionMoveCursorBackwardByWordIndex to: kFlutterSemanticsActionMoveCursorBackwardByWord --- shell/platform/embedder/embedder.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index bbb1a9161bc43..bfc3002a1da3d 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -98,9 +98,9 @@ typedef enum { // A request that the node should be dismissed. kFlutterSemanticsActionDismiss = 1 << 18, // Move the cursor forward by one word. - kFlutterSemanticsActionMoveCursorForwardByWordIndex = 1 << 19, + kFlutterSemanticsActionMoveCursorForwardByWord = 1 << 19, // Move the cursor backward by one word. - kFlutterSemanticsActionMoveCursorBackwardByWordIndex = 1 << 20, + kFlutterSemanticsActionMoveCursorBackwardByWord = 1 << 20, } FlutterSemanticsAction; // The set of properties that may be associated with a semantics node. From 95ef58cf484c0883c90dfce51532e20fd9cbb6fd Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 7 Mar 2019 16:56:46 -0800 Subject: [PATCH 0383/1117] Add script to help generate PR messages (#8074) * Add script to help generate PR messages * newline --- tools/engine_roll_pr_desc.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 tools/engine_roll_pr_desc.sh diff --git a/tools/engine_roll_pr_desc.sh b/tools/engine_roll_pr_desc.sh new file mode 100755 index 0000000000000..6965301a327c9 --- /dev/null +++ b/tools/engine_roll_pr_desc.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +if [[ $1 == '' ]]; then + echo 'Usage: engine_roll_pr_desc.sh ..' + exit 1 +fi +git log --oneline --no-merges --no-color $1 | sed 's/^/flutter\/engine@/g' | sed -e 's/(\(#[0-9]*)\)/\(flutter\/engine\1/g' From 60314077846c123f45c5aaef911c5ea48343d569 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 8 Mar 2019 09:23:21 -0500 Subject: [PATCH 0384/1117] Roll src/third_party/skia 88b8d1124b72..3d1b941f3a7d (27 commits) (#8082) https://skia.googlesource.com/skia.git/%2Blog/88b8d1124b72..3d1b941f3a7d git log 88b8d1124b7280d379f7545eda4b9097a4d8a292..3d1b941f3a7d84d9bc83cf2ad1050bc608193c56 --date=short --no-merges --format=%ad %ae %s 2019-03-08 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-03-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader b12437300c1a..3ed33cee5e61 (1 commits) 2019-03-07 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-07 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src ca7eff86b174..7ddffe6a4a5e (485 commits) 2019-03-07 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader efec1b9fa6c7..b12437300c1a (2 commits) 2019-03-07 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 7273a4b3863e..efec1b9fa6c7 (4 commits) 2019-03-07 brianosman@google.com Fix two SkPathRef bugs 2019-03-07 csmartdalton@google.com Restore support for multisample locations 2019-03-07 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 71008d880f75..7273a4b3863e (1 commits) 2019-03-07 mtklein@google.com add color_depth field in DM/Gold 2019-03-07 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-07 jvanverth@google.com Add Autorelease pools to clear out no longer needed Metal objects. 2019-03-07 ethannicholas@google.com added constant swizzle support for Metal 2019-03-07 ethannicholas@google.com Got RelaxedPrecision decorations working again in SPIR-V, and removed no-longer-needed old-style precision handling code. 2019-03-07 brianosman@google.com Add F16Norm support to a few more pixmap helpers 2019-03-07 brianosman@google.com Fix bit-depth selection for picture shader playback with F16Norm 2019-03-07 bungeman@google.com Add filter quality to paint overrides in viewer. 2019-03-07 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-07 mtklein@google.com treat F16Norm like F16 as far as SW tranfer functions go 2019-03-07 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader ec255730a818..71008d880f75 (1 commits) 2019-03-07 fmalita@chromium.org [canvaskit] Clean up Skottie sources list 2019-03-07 mtklein@google.com add pause to SkSpinlock::contendedAcquire on Intel 2019-03-07 kjlubick@google.com [canvaskit] more testing logs 2019-03-07 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 45faa0849352..ec255730a818 (1 commits) 2019-03-07 hcm@google.com Update Skia milestone to 75 2019-03-07 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-07 reed@google.com undo old colorspace hacks related to savelayers The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d682b445b74a8..b193361e99bfe 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': '88b8d1124b7280d379f7545eda4b9097a4d8a292', + 'skia_revision': '3d1b941f3a7d84d9bc83cf2ad1050bc608193c56', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 96a293f5e1329..f76858f6f911f 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 5499bdd90e967369cfc64f95ffd6b6d7 +Signature: 8bdb80f9946ca01423af71f6555e5c39 UNUSED LICENSES: @@ -4838,6 +4838,7 @@ FILE: ../../../third_party/skia/gm/backdrop.cpp FILE: ../../../third_party/skia/gm/compositor_quads.cpp FILE: ../../../third_party/skia/gm/mac_aa_explorer.cpp FILE: ../../../third_party/skia/gm/mixercolorfilter.cpp +FILE: ../../../third_party/skia/gm/samplelocations.cpp FILE: ../../../third_party/skia/gm/skbug_8664.cpp FILE: ../../../third_party/skia/include/gpu/GrContextThreadSafeProxy.h FILE: ../../../third_party/skia/include/private/GrContext_Base.h @@ -4865,6 +4866,8 @@ FILE: ../../../third_party/skia/src/gpu/GrImageContext.cpp FILE: ../../../third_party/skia/src/gpu/GrImageContextPriv.h FILE: ../../../third_party/skia/src/gpu/GrRecordingContext.cpp FILE: ../../../third_party/skia/src/gpu/GrRecordingContextPriv.h +FILE: ../../../third_party/skia/src/gpu/GrSamplePatternDictionary.cpp +FILE: ../../../third_party/skia/src/gpu/GrSamplePatternDictionary.h FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.fp FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.h From 260669c65e9e74a74540fce168285de2b1f46839 Mon Sep 17 00:00:00 2001 From: Core Date: Sat, 9 Mar 2019 01:47:06 +0700 Subject: [PATCH 0385/1117] Fix deleting text when the last character is some special characters on IOS (#7982) --- .../Source/FlutterTextInputPlugin.mm | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm index d6b8873adc6bc..dd8971f402e58 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm @@ -621,6 +621,27 @@ - (void)insertText:(NSString*)text { - (void)deleteBackward { _selectionAffinity = _kTextAffinityDownstream; + + // When deleting Thai vowel, _selectedTextRange has location + // but does not have length, so we have to manually set it. + // In addition, we needed to delete only a part of grapheme cluster + // because it is the expected behavior of Thai input. + // https://github.com/flutter/flutter/issues/24203 + // https://github.com/flutter/flutter/issues/21745 + // + // This is needed for correct handling of the deletion of Thai vowel input. + // TODO(cbracken): Get a good understanding of expected behaviour of Thai + // input and ensure that this is the correct solution. + // https://github.com/flutter/flutter/issues/28962 + if (_selectedTextRange.isEmpty && [self hasText]) { + NSRange oldRange = ((FlutterTextRange*)_selectedTextRange).range; + if (oldRange.location > 0) { + NSRange newRange = NSMakeRange(oldRange.location - 1, 1); + [self setSelectedTextRange:[FlutterTextRange rangeWithNSRange:newRange] + updateEditingState:false]; + } + } + if (!_selectedTextRange.isEmpty) [self replaceRange:_selectedTextRange withText:@""]; } From 7cbd9d8b474f79ca4b6ad61286d49d662d81fa6e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 8 Mar 2019 14:38:38 -0500 Subject: [PATCH 0386/1117] Roll src/third_party/skia 3d1b941f3a7d..bea1f94f341e (7 commits) (#8083) https://skia.googlesource.com/skia.git/%2Blog/3d1b941f3a7d..bea1f94f341e git log 3d1b941f3a7d84d9bc83cf2ad1050bc608193c56..bea1f94f341e8b0466ea2bfbda3f3ba44a2fda5c --date=short --no-merges --format=%ad %ae %s 2019-03-08 mtklein@google.com remove platform_font_manager() 2019-03-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 620334064f47..d2b1d2f936ee (1 commits) 2019-03-08 reed@google.com change load/store_rgba to have src and dst variants 2019-03-07 jcgregorio@google.com Get doxygen working again. 2019-03-07 ethannicholas@google.com Fixed a couple of Vulkan bugs 2019-03-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3ed33cee5e61..620334064f47 (1 commits) 2019-03-07 benjaminwagner@google.com Add CMake asset for macOS. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index b193361e99bfe..2b0d5106bcb03 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': '3d1b941f3a7d84d9bc83cf2ad1050bc608193c56', + 'skia_revision': 'bea1f94f341e8b0466ea2bfbda3f3ba44a2fda5c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index f76858f6f911f..3892e2013e360 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8bdb80f9946ca01423af71f6555e5c39 +Signature: 9107ca6e7b9595ef1a2eff8ea828c5c4 UNUSED LICENSES: @@ -2005,7 +2005,6 @@ TYPE: LicenseType.bsd FILE: ../../../third_party/skia/.clang-tidy FILE: ../../../third_party/skia/CQ_COMMITTERS FILE: ../../../third_party/skia/DEPS -FILE: ../../../third_party/skia/Doxyfile FILE: ../../../third_party/skia/animations/checkbox.xml FILE: ../../../third_party/skia/animations/chest#1.jpg FILE: ../../../third_party/skia/animations/fire#1.jpg @@ -2131,6 +2130,7 @@ FILE: ../../../third_party/skia/infra/bots/assets/chromebook_x86_64_gles/VERSION FILE: ../../../third_party/skia/infra/bots/assets/clang_linux/VERSION FILE: ../../../third_party/skia/infra/bots/assets/clang_win/VERSION FILE: ../../../third_party/skia/infra/bots/assets/cmake_linux/VERSION +FILE: ../../../third_party/skia/infra/bots/assets/cmake_mac/VERSION FILE: ../../../third_party/skia/infra/bots/assets/gcloud_linux/VERSION FILE: ../../../third_party/skia/infra/bots/assets/go/VERSION FILE: ../../../third_party/skia/infra/bots/assets/go_deps/VERSION From 4c94049502064a630954b5fb7a071aee92e942a8 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 8 Mar 2019 12:10:53 -0800 Subject: [PATCH 0387/1117] Move android_sdk_downloader so I can more easily deprecate it (#8084) --- DEPS | 4 +- tools/android_sdk_downloader/.gitignore | 7 + tools/android_sdk_downloader/LICENSE | 27 ++ tools/android_sdk_downloader/README.md | 31 ++ .../analysis_options.yaml | 155 +++++++ tools/android_sdk_downloader/lib/main.dart | 220 +++++++++ .../lib/src/android_repository.dart | 416 ++++++++++++++++++ .../lib/src/checksums.dart | 31 ++ .../android_sdk_downloader/lib/src/http.dart | 130 ++++++ .../lib/src/options.dart | 129 ++++++ tools/android_sdk_downloader/lib/src/zip.dart | 41 ++ tools/android_sdk_downloader/pubspec.yaml | 12 + 12 files changed, 1201 insertions(+), 2 deletions(-) create mode 100644 tools/android_sdk_downloader/.gitignore create mode 100644 tools/android_sdk_downloader/LICENSE create mode 100644 tools/android_sdk_downloader/README.md create mode 100644 tools/android_sdk_downloader/analysis_options.yaml create mode 100644 tools/android_sdk_downloader/lib/main.dart create mode 100644 tools/android_sdk_downloader/lib/src/android_repository.dart create mode 100644 tools/android_sdk_downloader/lib/src/checksums.dart create mode 100644 tools/android_sdk_downloader/lib/src/http.dart create mode 100644 tools/android_sdk_downloader/lib/src/options.dart create mode 100644 tools/android_sdk_downloader/lib/src/zip.dart create mode 100644 tools/android_sdk_downloader/pubspec.yaml diff --git a/DEPS b/DEPS index 2b0d5106bcb03..47ef330849766 100644 --- a/DEPS +++ b/DEPS @@ -418,7 +418,7 @@ hooks = [ 'name': 'prepare_android_downloader', 'pattern': '.', 'condition': 'download_android_deps', - 'cwd': 'src/tools/android/android_sdk_downloader', + 'cwd': 'src/flutter/tools/android_sdk_downloader', 'action': [ '../../../third_party/dart/tools/sdks/dart-sdk/bin/pub', # this hook _must_ be run _after_ the dart hook. 'get' @@ -431,7 +431,7 @@ hooks = [ 'action': [ 'src/third_party/dart/tools/sdks/dart-sdk/bin/dart', # this hook _must_ be run _after_ the dart hook. '--enable-asserts', - 'src/tools/android/android_sdk_downloader/lib/main.dart', + 'src/flutter/tools/android_sdk_downloader/lib/main.dart', '-y', # Accept licenses '--out=src/third_party/android_tools', '--platform=28', diff --git a/tools/android_sdk_downloader/.gitignore b/tools/android_sdk_downloader/.gitignore new file mode 100644 index 0000000000000..d6a35f97f7659 --- /dev/null +++ b/tools/android_sdk_downloader/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +.atom/ +.idea +.packages +.pub/ +.dart_tool/ +pubspec.lock \ No newline at end of file diff --git a/tools/android_sdk_downloader/LICENSE b/tools/android_sdk_downloader/LICENSE new file mode 100644 index 0000000000000..58ab87f9b99b9 --- /dev/null +++ b/tools/android_sdk_downloader/LICENSE @@ -0,0 +1,27 @@ +// 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 +// 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. \ No newline at end of file diff --git a/tools/android_sdk_downloader/README.md b/tools/android_sdk_downloader/README.md new file mode 100644 index 0000000000000..c705ee214278f --- /dev/null +++ b/tools/android_sdk_downloader/README.md @@ -0,0 +1,31 @@ +# Android SDK Downloader + +This program assists with downloading the Android SDK and NDK artifacts for +Flutter engine development. + +## Usage + +``` +-r, --repository-xml Specifies the location of the Android Repository XML file. + (defaults to "https://dl.google.com/android/repository/repository2-1.xml") + +-p, --platform Specifies the Android platform version, e.g. 28 + + --platform-revision Specifies the Android platform revision, e.g. 6 for 28_r06 + +-o, --out The directory to write downloaded files to. + + --os The OS type to download for. Defaults to current platform. + (defaults to current platform), accepts: [windows, macos, linux] + + --build-tools-version The build-tools version to download. Must be in format of .., e.g. 28.0.3; or ..., e.g. 28.0.0.2 + + --platform-tools-version The platform-tools version to download. Must be in format of .., e.g. 28.0.1; or ..., e.g. 28.0.0.2 + + --tools-version The tools version to download. Must be in format of .., e.g. 26.1.1; or ..., e.g. 28.1.1.2 + + --ndk-version The ndk version to download. Must be in format of .., e.g. 28.0.3; or ..., e.g. 28.0.0.2 + +-y, --[no-]accept-licenses Automatically accept Android SDK licenses. + --[no-]overwrite Skip download if the target directory exists. +``` \ No newline at end of file diff --git a/tools/android_sdk_downloader/analysis_options.yaml b/tools/android_sdk_downloader/analysis_options.yaml new file mode 100644 index 0000000000000..2023b29bda9fe --- /dev/null +++ b/tools/android_sdk_downloader/analysis_options.yaml @@ -0,0 +1,155 @@ +# Specify analysis options. +# +# Copied from https://github.com/flutter/flutter/blob/master/analysis_options.yaml + +analyzer: + strong-mode: + implicit-dynamic: false + errors: + # treat missing required parameters as a warning (not a hint) + missing_required_param: warning + # treat missing returns as a warning (not a hint) + missing_return: warning + # allow having TODOs in the code + todo: ignore + exclude: + - 'bin/cache/**' + # the following two are relative to the stocks example and the flutter package respectively + # see https://github.com/dart-lang/sdk/issues/28463 + - 'lib/i18n/stock_messages_*.dart' + - 'lib/src/http/**' + +linter: + rules: + # these rules are documented on and in the same order as + # the Dart Lint rules page to make maintenance easier + # https://github.com/dart-lang/linter/blob/master/example/all.yaml + - always_declare_return_types + - always_put_control_body_on_new_line + # - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219 + - always_require_non_null_named_parameters + - always_specify_types + - annotate_overrides + # - avoid_annotating_with_dynamic # conflicts with always_specify_types + - avoid_as + # - avoid_bool_literals_in_conditional_expressions # not yet tested + # - avoid_catches_without_on_clauses # we do this commonly + # - avoid_catching_errors # we do this commonly + - avoid_classes_with_only_static_members + # - avoid_double_and_int_checks # only useful when targeting JS runtime + - avoid_empty_else + - avoid_field_initializers_in_const_classes + - avoid_function_literals_in_foreach_calls + # - avoid_implementing_value_types # not yet tested + - avoid_init_to_null + # - avoid_js_rounded_ints # only useful when targeting JS runtime + - avoid_null_checks_in_equality_operators + # - avoid_positional_boolean_parameters # not yet tested + # - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356) + - avoid_relative_lib_imports + - avoid_renaming_method_parameters + - avoid_return_types_on_setters + # - avoid_returning_null # there are plenty of valid reasons to return null + - avoid_returning_null_for_void + # - avoid_returning_this # there are plenty of valid reasons to return this + # - avoid_setters_without_getters # not yet tested + # - avoid_single_cascade_in_expression_statements # not yet tested + - avoid_slow_async_io + - avoid_types_as_parameter_names + # - avoid_types_on_closure_parameters # conflicts with always_specify_types + - avoid_unused_constructor_parameters + - avoid_void_async + - await_only_futures + - camel_case_types + - cancel_subscriptions + # - cascade_invocations # not yet tested + # - close_sinks # not reliable enough + # - comment_references # blocked on https://github.com/flutter/flutter/issues/20765 + # - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204 + - control_flow_in_finally + # - curly_braces_in_flow_control_structures # not yet tested + - directives_ordering + - empty_catches + - empty_constructor_bodies + - empty_statements + # - file_names # not yet tested + - flutter_style_todos + - hash_and_equals + - implementation_imports + # - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811 + - iterable_contains_unrelated_type + # - join_return_with_assignment # not yet tested + - library_names + - library_prefixes + # - lines_longer_than_80_chars # not yet tested + - list_remove_unrelated_type + # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181 + - no_adjacent_strings_in_list + - no_duplicate_case_values + - non_constant_identifier_names + # - null_closures # not yet tested + # - omit_local_variable_types # opposite of always_specify_types + # - one_member_abstracts # too many false positives + # - only_throw_errors # https://github.com/flutter/flutter/issues/5792 + - overridden_fields + - package_api_docs + - package_names + - package_prefixed_library_names + # - parameter_assignments # we do this commonly + - prefer_adjacent_string_concatenation + - prefer_asserts_in_initializer_lists + - prefer_collection_literals + - prefer_conditional_assignment + - prefer_const_constructors + - prefer_const_constructors_in_immutables + - prefer_const_declarations + - prefer_const_literals_to_create_immutables + # - prefer_constructors_over_static_methods # not yet tested + - prefer_contains + - prefer_equal_for_default_values + # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods + - prefer_final_fields + - prefer_final_locals + - prefer_foreach + # - prefer_function_declarations_over_variables # not yet tested + - prefer_generic_function_type_aliases + - prefer_initializing_formals + # - prefer_int_literals # not yet tested + # - prefer_interpolation_to_compose_strings # not yet tested + - prefer_is_empty + - prefer_is_not_empty + - prefer_iterable_whereType + # - prefer_mixin # https://github.com/dart-lang/language/issues/32 + - prefer_single_quotes + - prefer_typing_uninitialized_variables + - prefer_void_to_null + # - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml + - recursive_getters + - slash_for_doc_comments + - sort_constructors_first + - sort_pub_dependencies + - sort_unnamed_constructors_first + - super_goes_last + - test_types_in_equals + - throw_in_finally + # - type_annotate_public_apis # subset of always_specify_types + - type_init_formals + # - unawaited_futures # too many false positives + - unnecessary_brace_in_string_interps + - unnecessary_const + - unnecessary_getters_setters + # - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498 + - unnecessary_new + - unnecessary_null_aware_assignments + - unnecessary_null_in_if_null_operators + - unnecessary_overrides + - unnecessary_parenthesis + - unnecessary_statements + - unnecessary_this + - unrelated_type_equality_checks + - use_rethrow_when_possible + # - use_setters_to_change_properties # not yet tested + # - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182 + # - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review + - valid_regexps + # - void_checks # not yet tested diff --git a/tools/android_sdk_downloader/lib/main.dart b/tools/android_sdk_downloader/lib/main.dart new file mode 100644 index 0000000000000..f563889c82b29 --- /dev/null +++ b/tools/android_sdk_downloader/lib/main.dart @@ -0,0 +1,220 @@ +// Copyright 2013 The Flutter 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 'dart:convert'; +import 'dart:io'; + +import 'package:args/args.dart'; +import 'package:path/path.dart' as path; + +import 'src/android_repository.dart'; +import 'src/checksums.dart'; +import 'src/http.dart'; +import 'src/options.dart'; +import 'src/zip.dart'; + +const String _kAndroidRepositoryXml = 'https://dl.google.com/android/repository/repository2-1.xml'; + + +Future main(List args) async { + final ArgParser argParser = ArgParser() + ..addOption( + 'repository-xml', + abbr: 'r', + help: 'Specifies the location of the Android Repository XML file.', + defaultsTo: _kAndroidRepositoryXml, + ) + ..addOption( + 'platform', + abbr: 'p', + help: 'Specifies the Android platform version, e.g. 28', + ) + ..addOption( + 'platform-revision', + help: 'Specifies the Android platform revision, e.g. 6 for 28_r06', + ) + ..addOption( + 'out', + abbr: 'o', + help: 'The directory to write downloaded files to.', + defaultsTo: '.', + ) + ..addOption( + 'os', + help: 'The OS type to download for. Defaults to current platform.', + defaultsTo: Platform.operatingSystem, + allowed: osTypeMap.keys, + ) + ..addOption( + 'build-tools-version', + help: 'The build-tools version to download. Must be in format of ' + '.., e.g. 28.0.3; ' + 'or ..., e.g. 28.0.0.2', + ) + ..addOption( + 'platform-tools-version', + help: 'The platform-tools version to download. Must be in format of ' + '.., e.g. 28.0.1; ' + 'or ..., e.g. 28.0.0.2', + ) + ..addOption( + 'tools-version', + help: 'The tools version to download. Must be in format of ' + '.., e.g. 26.1.1; ' + 'or ..., e.g. 28.1.1.2', + ) + ..addOption( + 'ndk-version', + help: 'The ndk version to download. Must be in format of ' + '.., e.g. 28.0.3; ' + 'or ..., e.g. 28.0.0.2', + ) + ..addFlag('accept-licenses', + abbr: 'y', + defaultsTo: false, + help: 'Automatically accept Android SDK licenses.') + ..addFlag( + 'overwrite', + defaultsTo: false, + help: 'Skip download if the target directory exists.', + ); + + final bool help = args.contains('-h') + || args.contains('--help') + || (args.isNotEmpty && args.first == 'help'); + if (help) { + print(argParser.usage); + return; + } + + final Options options = Options.parseAndValidate(args, argParser); + + final AndroidRepository androidRepository = await _getAndroidRepository(options.repositoryXmlUri); + assert(androidRepository.platforms.isNotEmpty); + assert(androidRepository.buildTools.isNotEmpty); + + if (!options.acceptLicenses) { + for (final AndroidRepositoryLicense license in androidRepository.licenses) { + print('================================================================================\n\n'); + print(license.text); + stdout.write('Do you accept? (Y/n): '); + final String result = stdin.readLineSync().trim().toLowerCase(); + if (result != '' && result.startsWith('y') == false) { + print('Ending.'); + exit(-1); + } + } + } + + await options.outDirectory.create(recursive: true); + + final Directory tempDir = await Directory(options.outDirectory.path).createTemp(); + await tempDir.create(recursive: true); + + final Directory ndkDir = Directory(path.join(options.outDirectory.path, 'ndk')); + final Directory sdkDir = Directory(path.join(options.outDirectory.path, 'sdk')); + final Directory platformDir = Directory(path.join(sdkDir.path, 'platforms', 'android-${options.platformApiLevel}')); + final Directory buildToolsDir = Directory(path.join(sdkDir.path, 'build-tools', options.buildToolsRevision.raw)); + final Directory platformToolsDir = Directory(path.join(sdkDir.path, 'platform-tools')); + final Directory toolsDir = Directory(path.join(sdkDir.path, 'tools')); + + final Map checksums = + await loadChecksums(options.outDirectory); + + print('Downloading Android SDK and NDK artifacts...'); + final List> futures = >[]; + + futures.add(downloadArchive( + androidRepository.platforms, + OptionsRevision(null, options.platformRevision), + options.repositoryBase, + tempDir, + checksumToSkip: options.overwrite ? null : checksums[platformDir.path], + ).then((ArchiveDownloadResult result) { + if (result != ArchiveDownloadResult.empty) { + return unzipFile(result.zipFileName, platformDir).then((_) { + checksums[platformDir.path] = result.checksum; + return writeChecksums(checksums, options.outDirectory); + }); + } + return null; + })); + futures.add(downloadArchive( + androidRepository.buildTools, + options.buildToolsRevision, + options.repositoryBase, + tempDir, + osType: options.osType, + checksumToSkip: options.overwrite ? null : checksums[buildToolsDir.path], + ).then((ArchiveDownloadResult result) { + if (result != ArchiveDownloadResult.empty) { + return unzipFile(result.zipFileName, buildToolsDir).then((_) { + checksums[buildToolsDir.path] = result.checksum; + return writeChecksums(checksums, options.outDirectory); + }); + } + return null; + })); + futures.add(downloadArchive( + androidRepository.platformTools, + options.platformToolsRevision, + options.repositoryBase, + tempDir, + osType: options.osType, + checksumToSkip: options.overwrite ? null : checksums[platformToolsDir.path], + ).then((ArchiveDownloadResult result) { + if (result != ArchiveDownloadResult.empty) { + return unzipFile(result.zipFileName, platformToolsDir).then((_) { + checksums[platformToolsDir.path] = result.checksum; + return writeChecksums(checksums, options.outDirectory); + }); + } + return null; + })); + futures.add(downloadArchive( + androidRepository.tools, + options.toolsRevision, + options.repositoryBase, + tempDir, + osType: options.osType, + checksumToSkip: options.overwrite ? null : checksums[toolsDir.path], + ).then((ArchiveDownloadResult result) { + if (result != ArchiveDownloadResult.empty) { + return unzipFile(result.zipFileName, toolsDir).then((_) { + checksums[toolsDir.path] = result.checksum; + return writeChecksums(checksums, options.outDirectory); + }); + } + return null; + })); + futures.add(downloadArchive( + androidRepository.ndkBundles, + options.ndkRevision, + options.repositoryBase, + tempDir, + osType: options.osType, + checksumToSkip: options.overwrite ? null : checksums[ndkDir.path], + ).then((ArchiveDownloadResult result) { + if (result != ArchiveDownloadResult.empty) { + return unzipFile(result.zipFileName, ndkDir).then((_) { + checksums[ndkDir.path] = result.checksum; + return writeChecksums(checksums, options.outDirectory); + }); + } + return null; + })); + await Future.wait(futures); + await tempDir.delete(recursive: true); +} + +Future _getAndroidRepository(Uri repositoryXmlUri) async { + final StringBuffer repoXmlBuffer = StringBuffer(); + Future _repositoryXmlHandler(HttpClientResponse response) async { + await response.transform(utf8.decoder).forEach(repoXmlBuffer.write); + } + + await httpGet(repositoryXmlUri, _repositoryXmlHandler); + + return parseAndroidRepositoryXml(repoXmlBuffer.toString()); +} diff --git a/tools/android_sdk_downloader/lib/src/android_repository.dart b/tools/android_sdk_downloader/lib/src/android_repository.dart new file mode 100644 index 0000000000000..3490d02e95c3c --- /dev/null +++ b/tools/android_sdk_downloader/lib/src/android_repository.dart @@ -0,0 +1,416 @@ +// Copyright 2013 The Flutter 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 'package:xml/xml.dart' as xml show parse; +import 'package:xml/xml.dart'; + +// see https://android.googlesource.com/platform/tools/base/+/master/sdklib/src/main/java/com/android/sdklib/repository/sdk-repository-10.xsd + +const String _kXsi = 'http://www.w3.org/2001/XMLSchema-instance'; +const String _kSdk = 'http://schemas.android.com/sdk/android/repo/repository2/01'; + +void _debugCheckElement( + XmlElement element, + String name, { + String namespace, +}) { + assert(element != null); + assert(element.name.local == name, '${element.name.local} != $name'); + assert(element.name.namespaceUri == namespace, + '${element.name.namespaceUri} != $namespace'); +} + +XmlElement _firstOrDefault(Iterable list) { + if (list?.isEmpty == true) { + return null; + } + return list.first; +} + +String _getChildText( + XmlElement parent, + String childName, { + String def = '', + String namespace, +}) { + final String value = _firstOrDefault( + parent.findElements( + childName, + namespace: namespace, + ), + )?.text; + return value ?? def; +} + +OSType _parseHostType(String value) { + switch (value) { + case 'linux': + return OSType.linux; + case 'windows': + return OSType.windows; + case 'macosx': + return OSType.mac; + default: + return OSType.any; + } +} + +/// Parses a the Android SDK's https://dl.google.com/android/repository/repository2-1.xml +/// into an [AndroidRepository] object. +AndroidRepository parseAndroidRepositoryXml(String rawXml) { + final XmlDocument doc = xml.parse(rawXml); + return AndroidRepository.fromXml(doc.rootElement); +} + +XmlElement _getTypeDetails(XmlElement parent) { + final XmlElement typeDetails = + _firstOrDefault(parent.findAllElements('type-details')); + if (typeDetails == null) { + throw StateError('Missing .'); + } + return typeDetails; +} + +String _getTypeDetailsType(XmlElement typeDetails) { + return typeDetails.getAttribute('type', namespace: _kXsi); +} + +Iterable _getArchives(XmlElement parent) { + assert(parent != null); + final XmlElement archives = + _firstOrDefault(parent.findAllElements('archives')); + if (archives == null) { + return null; + } + return archives.findElements('archive'); +} + +/// Object class for https://dl.google.com/android/repository/repository2-1.xml. +class AndroidRepository { + const AndroidRepository( + this.licenses, + this.platforms, + this.buildTools, + this.platformTools, + this.tools, + this.ndkBundles, + ) : assert(licenses != null), + assert(platforms != null), + assert(buildTools != null), + assert(platformTools != null), + assert(tools != null), + assert(ndkBundles != null); + + /// Parses the `` element. + factory AndroidRepository.fromXml(XmlElement element) { + _debugCheckElement(element, 'sdk-repository', namespace: _kSdk); + final List licenses = + []; + final List platforms = + []; + final List buildTools = + []; + final List platformTools = + []; + final List tools = + []; + + final List ndkBundles = + []; + for (final XmlElement child in element.children.whereType()) { + switch (child.name.local) { + case 'license': + licenses.add(AndroidRepositoryLicense.fromXml(child)); + break; + case 'remotePackage': + final XmlElement typeDetails = _getTypeDetails(child); + switch (_getTypeDetailsType(typeDetails)) { + case 'sdk:platformDetailsType': + platforms.add( + AndroidRepositoryPlatform.fromXml(child, typeDetails), + ); + break; + case 'generic:genericDetailsType': + final String path = child.getAttribute('path'); + if (path.startsWith('build-tools;')) { + buildTools.add(AndroidRepositoryRemotePackage.fromXml(child)); + } else if (path.startsWith('platform-tools')) { + platformTools + .add(AndroidRepositoryRemotePackage.fromXml(child)); + } else if (path.startsWith('tools')) { + tools.add(AndroidRepositoryRemotePackage.fromXml(child)); + } else if (path.startsWith('ndk-bundle')) { + ndkBundles.add(AndroidRepositoryRemotePackage.fromXml(child)); + } + break; + default: + break; + } + break; + default: + break; + } + } + return AndroidRepository( + licenses, + platforms, + buildTools, + platformTools, + tools, + ndkBundles, + ); + } + + /// Licenses from the repository XML. + final List licenses; + + /// Platform information from the repository XML. + final List platforms; + + /// Build tools information from the repostiory XML. + final List buildTools; + + /// Platform tools information from the repostiory XML. + final List platformTools; + + /// Tools information from the repostiory XML. + final List tools; + + /// Tools information from the repostiory XML. + final List ndkBundles; +} + +/// Object class for the `` element in the Android repo XML. +/// +/// This node contains license information for the packages in the SDK. +class AndroidRepositoryLicense { + /// Creates a new RepositoryLicense holder. + const AndroidRepositoryLicense(this.id, this.text) + : assert(id != null), + assert(text != null); + + /// Parses a `` element. + factory AndroidRepositoryLicense.fromXml(XmlElement element) { + _debugCheckElement(element, 'license'); + return AndroidRepositoryLicense(element.getAttribute('id'), element.text); + } + + /// The identifier for this license. + final String id; + + /// The text of the license. + final String text; +} + +/// Object class for the `` nodes in the repo XML. +/// +/// These nodes contain information about where to download the zipped +/// binaries for various components of the SDK. +class AndroidRepositoryRemotePackage { + const AndroidRepositoryRemotePackage( + this.revision, + this.displayName, + this.archives, { + this.isObsolete = false, + }) : assert(revision != null), + assert(displayName != null), + assert(archives != null), + assert(isObsolete != null); + + factory AndroidRepositoryRemotePackage.fromXml(XmlElement element) { + _debugCheckElement(element, 'remotePackage'); + + return AndroidRepositoryRemotePackage( + AndroidRepositoryRevision.fromXml( + _firstOrDefault(element.findElements('revision'))), + _getChildText(element, 'display-name'), + _getArchives(element) + .map( + (XmlElement archive) => AndroidRepositoryArchive.fromXml(archive), + ) + .toList(), + isObsolete: element.getAttribute('obsolete') == 'true', + ); + } + + /// The `` element, if any. + final AndroidRepositoryRevision revision; + + /// The `` element. + final String displayName; + + /// The list of archives available for this package. + final List archives; + + /// Whether this package is marked as obsolete. + final bool isObsolete; + + @override + String toString() => '$runtimeType{revision: $revision, displayName: $displayName, archives: $archives}'; +} + +/// Object class for instances of `` elements that are for the +/// platform package. +class AndroidRepositoryPlatform extends AndroidRepositoryRemotePackage { + const AndroidRepositoryPlatform( + AndroidRepositoryRevision revision, + String displayName, + List archives, + this.apiLevel, { + bool isObsolete = false, + }) : assert(apiLevel != null), + super(revision, displayName, archives, isObsolete: isObsolete); + + /// Parses an platform from a `` element. + factory AndroidRepositoryPlatform.fromXml( + XmlElement element, + XmlElement typeDetails, + ) { + _debugCheckElement(element, 'remotePackage'); + assert(typeDetails != null); + + return AndroidRepositoryPlatform( + AndroidRepositoryRevision.fromXml( + _firstOrDefault(element.findElements('revision'))), + _getChildText(element, 'display-name'), + _getArchives(element) + .map( + (XmlElement archive) => AndroidRepositoryArchive.fromXml(archive), + ) + .toList(), + int.parse(_getChildText(typeDetails, 'api-level', def: '0')), + isObsolete: element.getAttribute('obsolete') == 'true', + ); + } + + /// The API level for this Platform. + final int apiLevel; + + @override + String toString() => '$runtimeType{revision: $revision, displayName: $displayName, archives: $archives, apiLevel: $apiLevel}'; +} + +/// The OS types supported by Android. +enum OSType { + /// Any OS is supported. + any, + + /// Suppoorts Linux only. + linux, + + /// Supports macOS only. + mac, + + /// Supports windows only. + windows, +} + +/// Object class for the `` element in the Android repo XML. +/// +/// Contains information about the size, checksum, and location of a binary +/// zip archive. Optionally contains information about what host OS is +/// supported. +class AndroidRepositoryArchive { + /// Creates a new AndroidRepositoryArchive. + const AndroidRepositoryArchive( + this.size, + this.checksum, + this.url, { + this.hostOS = OSType.any, + }) : assert(size != null), + assert(checksum != null), + assert(url != null), + assert(hostOS != null); + + /// Parses an `` element. + factory AndroidRepositoryArchive.fromXml(XmlElement element) { + _debugCheckElement(element, 'archive'); + final XmlElement complete = + _firstOrDefault(element.findElements('complete')); + if (complete == null) { + throw StateError('Found element without a node!'); + } + + return AndroidRepositoryArchive( + int.parse(_getChildText(complete, 'size', def: '0')), + _getChildText(complete, 'checksum'), + _getChildText(complete, 'url'), + hostOS: _parseHostType(_getChildText(element, 'host-os')), + ); + } + + /// The download size in bytes of the archive. + final int size; + + /// The SHA-1 checksum of the archive. + final String checksum; + + /// The absolute or relative URL of the file. + final String url; + + /// The OS type, if applicable, for this archive. + final OSType hostOS; + + @override + String toString() => '$runtimeType{size: $size, checksum: $checksum, url: $url, hostOS: $hostOS}'; +} + +/// Object class for a `` node in the Android repo XML. +/// +/// Contains information about the revision of the archive. +/// +/// In the case of the platform package, this is the revision of the platform. +/// +/// In all other cases, this basically works like semver. +class AndroidRepositoryRevision { + /// Creates a new Android repository revision object. All values are required. + const AndroidRepositoryRevision( + this.major, [ + this.minor = 0, + this.micro = 0, + this.preview = 0, + ]) : assert(major != null), + assert(minor != null), + assert(micro != null), + assert(preview != null); + + /// Parses a `` element from the Android repository XML. + factory AndroidRepositoryRevision.fromXml(XmlElement element) { + if (element == null) { + return const AndroidRepositoryRevision(0); + } + _debugCheckElement(element, 'revision'); + return AndroidRepositoryRevision( + int.tryParse(_getChildText(element, 'major', def: '0')), + int.tryParse(_getChildText(element, 'minor', def: '0')), + int.tryParse(_getChildText(element, 'micro', def: '0')), + ); + } + + /// The major revision value. + final int major; + + /// The minor revision value. + final int minor; + + /// The micro revision. + final int micro; + + /// Preview/Release candidate version. A value of 0 indicates that + /// this is not a preview. + final int preview; + + /// Whether this revision represents a preview or release. + bool get isPreview => preview > 0; + + bool matches(int major, int minor, int micro, [int preview = 0]) { + return this.major == major && + this.minor == minor && + this.micro == micro && + this.preview == preview; + } + + @override + String toString() => '$runtimeType:{$major.$minor.$micro.$preview}'; +} diff --git a/tools/android_sdk_downloader/lib/src/checksums.dart b/tools/android_sdk_downloader/lib/src/checksums.dart new file mode 100644 index 0000000000000..37e376217e9b6 --- /dev/null +++ b/tools/android_sdk_downloader/lib/src/checksums.dart @@ -0,0 +1,31 @@ +// Copyright 2013 The Flutter 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 'dart:convert'; +import 'dart:io'; + +import 'package:path/path.dart' as path; + +Future> loadChecksums(Directory directory) async { + final File checksumFile = File(path.join(directory.path, 'checksums.json')); + if (!checksumFile.existsSync()) { + return {}; + } + final Map result = {}; + final Map jsonResult = + json.decode(await checksumFile.readAsString()); + for (final String key in jsonResult.keys) { + result[key] = jsonResult[key]; + } + return result; +} + +Future writeChecksums( + Map checksums, + Directory directory, +) async { + final File checksumFile = File(path.join(directory.path, 'checksums.json')); + const JsonEncoder encoder = JsonEncoder.withIndent(' '); + await checksumFile.writeAsString(encoder.convert(checksums)); +} diff --git a/tools/android_sdk_downloader/lib/src/http.dart b/tools/android_sdk_downloader/lib/src/http.dart new file mode 100644 index 0000000000000..4b2fa6cc29cd5 --- /dev/null +++ b/tools/android_sdk_downloader/lib/src/http.dart @@ -0,0 +1,130 @@ +// Copyright 2013 The Flutter 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 'dart:io'; + +import 'package:path/path.dart' as path; + +import 'android_repository.dart'; +import 'options.dart'; + +typedef HttpResponseHandler = Future Function(HttpClientResponse); + +Future httpGet( + Uri url, + HttpResponseHandler handler, +) async { + assert(url != null); + assert(handler != null); + + final HttpClient httpClient = HttpClient(); + + try { + final HttpClientRequest request = await httpClient.getUrl(url); + final HttpClientResponse response = await request.close(); + await handler(response); + } finally { + httpClient.close(); + } +} + +class DownloadTracker { + DownloadTracker(this.name, this.total) : received = 0; + + final String name; + final int total; + int received; + + String get percent => '${((received / total) * 100).round()}'.padLeft(3) + '%'; + + @override + String toString() => '$name: $received/$total ($percent).'; +} + +final Map _downloadTrackers = + {}; +void _printDownloadTrackers() { + for (final DownloadTracker tracker in _downloadTrackers.values) { + stdout.write( + '${tracker.name.replaceAll('Android ', '')}: ${tracker.percent} '); + } + + if (_downloadTrackers.values + .every((DownloadTracker tracker) => tracker.received == tracker.total)) { + stdout.writeln(); + print('Downloads complete.'); + } else { + stdout.write('\r'); + } +} + +class ArchiveDownloadResult { + const ArchiveDownloadResult(this.zipFileName, this.checksum); + + static const ArchiveDownloadResult empty = ArchiveDownloadResult(null, null); + + final String zipFileName; + final String checksum; +} + +Future downloadArchive( + List packages, + OptionsRevision revision, + String repositoryBase, + Directory outDirectory, { + OSType osType, + int apiLevel, + String checksumToSkip, +}) async { + AndroidRepositoryRemotePackage package; + for (final AndroidRepositoryRemotePackage p in packages) { + if (apiLevel != null && p is AndroidRepositoryPlatform) { + if (p.apiLevel != apiLevel) { + continue; + } + } + if (p.revision.matches( + revision.major, revision.minor, revision.micro, revision.preview)) { + package = p; + break; + } + } + if (package == null) { + throw StateError('Could not find package matching arguments: ' + '$revision, $osType, $apiLevel'); + } + + final String displayName = package.displayName; + final AndroidRepositoryArchive archive = osType == null + ? package.archives.first + : package.archives.firstWhere( + (AndroidRepositoryArchive archive) => archive.hostOS == osType, + ); + + if (archive.checksum == checksumToSkip) { + print('Skipping $displayName, checksum matches current asset.'); + return ArchiveDownloadResult.empty; + } + + Uri uri = Uri.parse(archive.url); + if (!uri.isAbsolute) { + uri = Uri.parse(repositoryBase + archive.url); + } + + _downloadTrackers[displayName] = DownloadTracker(displayName, archive.size); + final String outFileName = path.join(outDirectory.path, archive.url); + final IOSink tempFileSink = File(outFileName).openWrite(); + + Future _handlePlatformZip(HttpClientResponse response) async { + await for (List data in response) { + _downloadTrackers[displayName].received += data.length; + tempFileSink.add(data); + _printDownloadTrackers(); + } + await tempFileSink.close(); + } + + await httpGet(uri, _handlePlatformZip); + return ArchiveDownloadResult(outFileName, archive.checksum); +} diff --git a/tools/android_sdk_downloader/lib/src/options.dart b/tools/android_sdk_downloader/lib/src/options.dart new file mode 100644 index 0000000000000..73e3a2f210b35 --- /dev/null +++ b/tools/android_sdk_downloader/lib/src/options.dart @@ -0,0 +1,129 @@ +// Copyright 2013 The Flutter 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 'dart:io'; + +import 'package:args/args.dart'; +import 'package:meta/meta.dart'; + +import 'android_repository.dart'; + +const Map osTypeMap = { + 'windows': OSType.windows, + 'macos': OSType.mac, + 'linux': OSType.linux, +}; + +class OptionsRevision { + const OptionsRevision( + this.raw, [ + this.major = 0, + this.minor = 0, + this.micro = 0, + this.preview = 0, + ]); + + /// Accepted formats: 1.2.3 or 1.2.3.4 + factory OptionsRevision.fromRaw(String raw) { + final List rawParts = raw.split('.'); + if (rawParts == null || (rawParts.length != 3 && rawParts.length != 4)) { + throw ArgumentError('Invalid revision string $raw.'); + } + return OptionsRevision( + raw, + int.parse(rawParts[0]), + int.parse(rawParts[1]), + int.parse(rawParts[2]), + rawParts.length == 4 ? int.parse(rawParts[3]) : 0, + ); + } + + final String raw; + final int major; + final int minor; + final int micro; + final int preview; +} + +class Options { + const Options({ + @required this.platformApiLevel, + @required this.platformRevision, + @required this.repositoryXml, + @required this.repositoryXmlUri, + @required this.buildToolsRevision, + @required this.platformToolsRevision, + @required this.toolsRevision, + @required this.ndkRevision, + @required this.outDirectory, + @required this.repositoryBase, + @required this.osType, + this.acceptLicenses = false, + this.overwrite = false, + }); + + static Options parseAndValidate(List args, ArgParser argParser) { + final ArgResults argResults = argParser.parse(args); + final int platformApiLevel = int.parse(argResults['platform']); + final int platformRevision = int.parse(argResults['platform-revision']); + final Directory outDirectory = Directory(argResults['out']); + + final String rawRepositoryXmlUri = argResults['repository-xml']; + final Uri repositoryXmlUri = Uri.tryParse(rawRepositoryXmlUri); + final int lastSlash = rawRepositoryXmlUri.lastIndexOf('/'); + final String repositoryBase = + rawRepositoryXmlUri.substring(0, lastSlash + 1); + + if (repositoryXmlUri == null) { + throw ArgumentError( + 'Error: could not parse $rawRepositoryXmlUri as a valid URL.'); + } + + String getRawVersion(String argName) { + final String raw = argResults[argName]; + if (raw?.isEmpty == true) { + print('Could not parse required argument $argName.'); + print(argParser.usage); + exit(-1); + } + return raw; + } + + final String rawBuildToolsVersion = getRawVersion('build-tools-version'); + final String rawPlatformToolsVersion = + getRawVersion('platform-tools-version'); + final String rawToolsVersion = getRawVersion('tools-version'); + final String rawNdkVersion = getRawVersion('ndk-version'); + + return Options( + platformApiLevel: platformApiLevel, + platformRevision: platformRevision, + outDirectory: outDirectory, + repositoryXml: rawRepositoryXmlUri, + repositoryXmlUri: repositoryXmlUri, + repositoryBase: repositoryBase, + buildToolsRevision: OptionsRevision.fromRaw(rawBuildToolsVersion), + platformToolsRevision: OptionsRevision.fromRaw(rawPlatformToolsVersion), + toolsRevision: OptionsRevision.fromRaw(rawToolsVersion), + ndkRevision: OptionsRevision.fromRaw(rawNdkVersion), + osType: osTypeMap[argResults['os']], + acceptLicenses: argResults['accept-licenses'], + overwrite: argResults['overwrite'], + ); + } + + final int platformApiLevel; + final String repositoryXml; + final Uri repositoryXmlUri; + final int platformRevision; + final OptionsRevision buildToolsRevision; + final OptionsRevision platformToolsRevision; + final OptionsRevision toolsRevision; + final OptionsRevision ndkRevision; + final String repositoryBase; + final Directory outDirectory; + final OSType osType; + final bool acceptLicenses; + final bool overwrite; +} diff --git a/tools/android_sdk_downloader/lib/src/zip.dart b/tools/android_sdk_downloader/lib/src/zip.dart new file mode 100644 index 0000000000000..488cb9b29b512 --- /dev/null +++ b/tools/android_sdk_downloader/lib/src/zip.dart @@ -0,0 +1,41 @@ +// Copyright 2013 The Flutter 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 'dart:async'; +import 'dart:io'; + +// TODO(dnfield): if/when a streaming unzip routine is available for Dart, use that instead. + +Future unzipFile(String file, Directory outDir) async { + await outDir.parent.create(recursive: true); + final Directory tempDir = await outDir.parent.createTemp(); + + String command; + List args; + if (Platform.isWindows) { + command = 'powershell.exe -nologo -noprofile -command ' + '"& { ' + 'Add-Type -A \'System.IO.Compression.FileSystem\'; ' + '[IO.Compression.ZipFile]::ExtractToDirectory(\'$file\', \'${tempDir.path}\'); ' + '}"'; + args = []; + } else { + command = 'unzip'; + args = [ + file, + '-d', + tempDir.path, + ]; + } + final ProcessResult result = await Process.run(command, args); + if (result.exitCode != 0) { + throw Exception('Failed to unzip archive!'); + } + final Directory dir = await tempDir.list().first; + if (await outDir.exists()) { + await outDir.delete(recursive: true); + } + await dir.rename(outDir.path); + await tempDir.delete(); +} diff --git a/tools/android_sdk_downloader/pubspec.yaml b/tools/android_sdk_downloader/pubspec.yaml new file mode 100644 index 0000000000000..ef1b304818da9 --- /dev/null +++ b/tools/android_sdk_downloader/pubspec.yaml @@ -0,0 +1,12 @@ +name: 'android_sdk_downloader' +publish_to: none + +environment: + # The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite. + sdk: ">=2.0.0-dev.68.0 <3.0.0" + +dependencies: + args: ^1.5.1 + meta: ^1.1.6 + path: ^1.6.2 + xml: ^3.2.3 From 87edd94e9cc751a0de72c0828d41793b9f740062 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Fri, 8 Mar 2019 12:15:45 -0800 Subject: [PATCH 0388/1117] Add read-only persistent cache (#8049) Some clients (e.g., embedded devices) prefer generating persistent cache files for the specific device beforehand, and ship them as readonly files in OTA packages. --- shell/common/persistent_cache.cc | 14 +++++++++++--- shell/common/persistent_cache.h | 11 ++++++++++- shell/platform/embedder/embedder.cc | 4 ++++ shell/platform/embedder/embedder.h | 4 ++++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/shell/common/persistent_cache.cc b/shell/common/persistent_cache.cc index bab0e7ac1beee..6e52a810e59ec 100644 --- a/shell/common/persistent_cache.cc +++ b/shell/common/persistent_cache.cc @@ -35,10 +35,13 @@ static std::string SkKeyToFilePath(const SkData& data) { return encode_result.second; } +bool PersistentCache::gIsReadOnly = false; + PersistentCache* PersistentCache::GetCacheForProcess() { static std::unique_ptr gPersistentCache; static std::once_flag once = {}; - std::call_once(once, []() { gPersistentCache.reset(new PersistentCache()); }); + std::call_once( + once, []() { gPersistentCache.reset(new PersistentCache(gIsReadOnly)); }); return gPersistentCache.get(); } @@ -46,7 +49,7 @@ void PersistentCache::SetCacheDirectoryPath(std::string path) { cache_base_path_ = path; } -PersistentCache::PersistentCache() { +PersistentCache::PersistentCache(bool read_only) : is_read_only_(read_only) { fml::UniqueFD cache_base_dir; if (cache_base_path_.length()) { cache_base_dir = fml::OpenDirectory(cache_base_path_.c_str(), false, @@ -60,7 +63,8 @@ PersistentCache::PersistentCache() { CreateDirectory(cache_base_dir, {"flutter_engine", blink::GetFlutterEngineVersion(), "skia", blink::GetSkiaVersion()}, - fml::FilePermission::kReadWrite)); + read_only ? fml::FilePermission::kRead + : fml::FilePermission::kReadWrite)); } if (!IsValid()) { FML_LOG(WARNING) << "Could not acquire the persistent cache directory. " @@ -130,6 +134,10 @@ static void PersistentCacheStore(fml::RefPtr worker, // |GrContextOptions::PersistentCache| void PersistentCache::store(const SkData& key, const SkData& data) { + if (is_read_only_) { + return; + } + if (!IsValid()) { return; } diff --git a/shell/common/persistent_cache.h b/shell/common/persistent_cache.h index cc65d6ad621c3..51662994dde70 100644 --- a/shell/common/persistent_cache.h +++ b/shell/common/persistent_cache.h @@ -19,6 +19,13 @@ namespace shell { class PersistentCache : public GrContextOptions::PersistentCache { public: + // Mutable static switch that can be set before GetCacheForProcess. If true, + // we'll only read existing caches but not generate new ones. Some clients + // (e.g., embedded devices) prefer generating persistent cache files for the + // specific device beforehand, and ship them as readonly files in OTA + // packages. + static bool gIsReadOnly; + static PersistentCache* GetCacheForProcess(); static void SetCacheDirectoryPath(std::string path); @@ -31,6 +38,8 @@ class PersistentCache : public GrContextOptions::PersistentCache { private: static std::string cache_base_path_; + + const bool is_read_only_; std::shared_ptr cache_directory_; mutable std::mutex worker_task_runners_mutex_; std::multiset> worker_task_runners_ @@ -38,7 +47,7 @@ class PersistentCache : public GrContextOptions::PersistentCache { bool IsValid() const; - PersistentCache(); + PersistentCache(bool read_only = false); // |GrContextOptions::PersistentCache| sk_sp load(const SkData& key) override; diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index c4d0546474411..aa397938bb957 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -348,6 +348,10 @@ FlutterEngineResult FlutterEngineRun(size_t version, shell::PersistentCache::SetCacheDirectoryPath(persistent_cache_path); } + if (SAFE_ACCESS(args, is_persistent_cache_read_only, false)) { + shell::PersistentCache::gIsReadOnly = true; + } + fml::CommandLine command_line; if (SAFE_ACCESS(args, command_line_argc, 0) != 0 && SAFE_ACCESS(args, command_line_argv, nullptr) != nullptr) { diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index bfc3002a1da3d..0be1fae740ad2 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -549,6 +549,10 @@ typedef struct { // Flutter application (such as compiled shader programs used by Skia). // This is optional. The string must be NULL terminated. const char* persistent_cache_path; + + // If true, we'll only read the existing cache, but not write new ones. + bool is_persistent_cache_read_only; + // A callback that gets invoked by the engine when it attempts to wait for a // platform vsync event. The engine will give the platform a baton that needs // to be returned back to the engine via |FlutterEngineOnVsync|. All batons From 1d10e0eb67fa76e4d5f5764b12468ef1c6f604c2 Mon Sep 17 00:00:00 2001 From: Michael Klimushyn Date: Fri, 8 Mar 2019 13:33:58 -0800 Subject: [PATCH 0389/1117] Guard against NewAPI failures (#8048) Adds minimum SDK checks around minimum APIs. flutter/flutter#28848 --- .../engine/android/FlutterSurfaceView.java | 2 +- .../engine/android/FlutterTextureView.java | 2 +- .../embedding/engine/android/FlutterView.java | 4 + .../plugin/platform/PlatformPlugin.java | 15 +- .../io/flutter/view/AccessibilityBridge.java | 59 ++- .../android/io/flutter/view/FlutterView.java | 14 +- .../io/flutter/view/ResourceExtractor.java | 19 +- tools/android_lint/baseline.xml | 482 +----------------- tools/android_lint/lint.xml | 11 + 9 files changed, 122 insertions(+), 486 deletions(-) create mode 100644 tools/android_lint/lint.xml diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java index dc52f9e6d46f9..cbff0b4ac828c 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java @@ -134,7 +134,7 @@ public void detachFromRenderer() { if (flutterRenderer != null) { // If we're attached to an Android window then we were rendering a Flutter UI. Now that // this FlutterSurfaceView is detached from the FlutterRenderer, we need to stop rendering. - if (isAttachedToWindow()) { + if (getWindowToken() != null) { disconnectSurfaceFromRenderer(); } diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java index c12c2fa4274fc..f39c6d4e77a82 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java @@ -145,7 +145,7 @@ public void detachFromRenderer() { if (flutterRenderer != null) { // If we're attached to an Android window then we were rendering a Flutter UI. Now that // this FlutterTextureView is detached from the FlutterRenderer, we need to stop rendering. - if (isAttachedToWindow()) { + if (getWindowToken() != null) { disconnectSurfaceFromRenderer(); } diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java index c7d86cbf2e6ab..7e586670e477f 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java @@ -4,6 +4,7 @@ package io.flutter.embedding.engine.android; +import android.annotation.TargetApi; import android.content.Context; import android.content.res.Configuration; import android.graphics.Rect; @@ -12,6 +13,7 @@ import android.provider.Settings; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.annotation.RequiresApi; import android.text.format.DateFormat; import android.util.AttributeSet; import android.util.Log; @@ -179,6 +181,8 @@ protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) * the wider than expected padding when the status and navigation bars are hidden. */ @Override + @TargetApi(20) + @RequiresApi(20) public final WindowInsets onApplyWindowInsets(WindowInsets insets) { WindowInsets newInsets = super.onApplyWindowInsets(insets); diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java index e9d44001ef0f5..e1e5f9f9cdbaa 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java @@ -132,12 +132,15 @@ private void setSystemChromeApplicationSwitcherDescription(PlatformChannel.AppSw return; } - @SuppressWarnings("deprecation") - TaskDescription taskDescription = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) - ? new TaskDescription(description.label, 0, description.color) - : new TaskDescription(description.label, null, description.color); - - activity.setTaskDescription(taskDescription); + // Linter refuses to believe we're only executing this code in API 28 unless we use distinct if blocks and + // hardcode the API 28 constant. + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P && Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { + activity.setTaskDescription(new TaskDescription(description.label)); + } + if (Build.VERSION.SDK_INT >= 28) { + TaskDescription taskDescription = new TaskDescription(description.label, 0, description.color); + activity.setTaskDescription(taskDescription); + } } private void setSystemChromeEnabledSystemUIOverlays(List overlaysToShow) { diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index ac5e2f8f3d995..add434080c054 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -4,12 +4,15 @@ package io.flutter.view; +import android.annotation.TargetApi; import android.app.Activity; import android.graphics.Rect; import android.opengl.Matrix; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; +import android.support.annotation.NonNull; +import android.support.annotation.RequiresApi; import android.util.Log; import android.view.View; import android.view.accessibility.AccessibilityEvent; @@ -84,10 +87,12 @@ enum Action { SHOW_ON_SCREEN(1 << 8), MOVE_CURSOR_FORWARD_BY_CHARACTER(1 << 9), MOVE_CURSOR_BACKWARD_BY_CHARACTER(1 << 10), + /** These actions are only supported on Android 4.3 and above. */ SET_SELECTION(1 << 11), COPY(1 << 12), CUT(1 << 13), PASTE(1 << 14), + /** End 4.3 only supported actions. */ DID_GAIN_ACCESSIBILITY_FOCUS(1 << 15), DID_LOSE_ACCESSIBILITY_FOCUS(1 << 16), CUSTOM_ACTION(1 << 17), @@ -233,17 +238,22 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { } result.setMovementGranularities(granularities); } - if (object.hasAction(Action.SET_SELECTION)) { - result.addAction(AccessibilityNodeInfo.ACTION_SET_SELECTION); - } - if (object.hasAction(Action.COPY)) { - result.addAction(AccessibilityNodeInfo.ACTION_COPY); - } - if (object.hasAction(Action.CUT)) { - result.addAction(AccessibilityNodeInfo.ACTION_CUT); - } - if (object.hasAction(Action.PASTE)) { - result.addAction(AccessibilityNodeInfo.ACTION_PASTE); + + // These are non-ops on older devices. Attempting to interact with the text will cause Talkback to read the + // contents of the text box instead. + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) { + if (object.hasAction(Action.SET_SELECTION)) { + result.addAction(AccessibilityNodeInfo.ACTION_SET_SELECTION); + } + if (object.hasAction(Action.COPY)) { + result.addAction(AccessibilityNodeInfo.ACTION_COPY); + } + if (object.hasAction(Action.CUT)) { + result.addAction(AccessibilityNodeInfo.ACTION_CUT); + } + if (object.hasAction(Action.PASTE)) { + result.addAction(AccessibilityNodeInfo.ACTION_PASTE); + } } if (object.hasFlag(Flag.IS_BUTTON)) { @@ -312,11 +322,14 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { // We should prefer setCollectionInfo to the class names, as this way we get "In List" // and "Out of list" announcements. But we don't always know the counts, so we // can fallback to the generic scroll view class names. + // + // On older APIs, we always fall back to the generic scroll view class names here. + // // TODO(dnfield): We should add semantics properties for rows and columns in 2 dimensional lists, e.g. // GridView. Right now, we're only supporting ListViews and only if they have scroll children. if (object.hasFlag(Flag.HAS_IMPLICIT_SCROLLING)) { if (object.hasAction(Action.SCROLL_LEFT) || object.hasAction(Action.SCROLL_RIGHT)) { - if (shouldSetCollectionInfo(object)) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT && shouldSetCollectionInfo(object)) { result.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain( 0, // rows object.scrollChildren, // columns @@ -325,7 +338,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { result.setClassName("android.widget.HorizontalScrollView"); } } else { - if (shouldSetCollectionInfo(object)) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 && shouldSetCollectionInfo(object)) { result.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain( object.scrollChildren, // rows 0, // columns @@ -465,9 +478,21 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { return true; } case AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY: { + // Text selection APIs aren't available until API 18. We can't handle the case here so return false + // instead. It's extremely unlikely that this case would ever be triggered in the first place in API < + // 18. + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { + return false; + } return performCursorMoveAction(object, virtualViewId, arguments, false); } case AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY: { + // Text selection APIs aren't available until API 18. We can't handle the case here so return false + // instead. It's extremely unlikely that this case would ever be triggered in the first place in API < + // 18. + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { + return false; + } return performCursorMoveAction(object, virtualViewId, arguments, true); } case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: { @@ -502,6 +527,12 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { return true; } case AccessibilityNodeInfo.ACTION_SET_SELECTION: { + // Text selection APIs aren't available until API 18. We can't handle the case here so return false + // instead. It's extremely unlikely that this case would ever be triggered in the first place in API < + // 18. + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { + return false; + } final Map selection = new HashMap<>(); final boolean hasSelection = arguments != null && arguments.containsKey( @@ -553,6 +584,8 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { return false; } + @RequiresApi(18) + @TargetApi(18) boolean performCursorMoveAction( SemanticsObject object, int virtualViewId, Bundle arguments, boolean forward) { final int granularity = diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 8df25207422ba..6161a23c5f4af 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -4,6 +4,7 @@ package io.flutter.view; +import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.content.res.Configuration; @@ -17,6 +18,7 @@ import android.os.Handler; import android.os.LocaleList; import android.provider.Settings; +import android.support.annotation.RequiresApi; import android.text.format.DateFormat; import android.util.AttributeSet; import android.util.Log; @@ -654,6 +656,8 @@ else if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) { // be padded. When the on-screen keyboard is detected, we want to include the full inset // but when the inset is just the hidden nav bar, we want to provide a zero inset so the space // can be used. + @TargetApi(20) + @RequiresApi(20) int calculateBottomKeyboardInset(WindowInsets insets) { int screenHeight = getRootView().getHeight(); // Magic number due to this being a heuristic. This should be replaced, but we have not @@ -672,6 +676,8 @@ int calculateBottomKeyboardInset(WindowInsets insets) { // This callback is not present in API < 20, which means lower API devices will see // the wider than expected padding when the status and navigation bars are hidden. @Override + @TargetApi(20) + @RequiresApi(20) public final WindowInsets onApplyWindowInsets(WindowInsets insets) { boolean statusBarHidden = (SYSTEM_UI_FLAG_FULLSCREEN & getWindowSystemUiVisibility()) != 0; @@ -963,8 +969,9 @@ public void onChange(boolean selfChange) { @Override public void onChange(boolean selfChange, Uri uri) { - String value = Settings.Global.getString(getContext().getContentResolver(), - Settings.Global.TRANSITION_ANIMATION_SCALE); + String value = Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 ? null + : Settings.Global.getString(getContext().getContentResolver(), + Settings.Global.TRANSITION_ANIMATION_SCALE); if (value != null && value.equals("0")) { mAccessibilityFeatureFlags |= AccessibilityFeature.DISABLE_ANIMATIONS.value; } else { @@ -974,6 +981,9 @@ public void onChange(boolean selfChange, Uri uri) { } } + // This is guarded at instantiation time. + @TargetApi(19) + @RequiresApi(19) class TouchExplorationListener implements AccessibilityManager.TouchExplorationStateChangeListener { @Override public void onTouchExplorationStateChanged(boolean enabled) { diff --git a/shell/platform/android/io/flutter/view/ResourceExtractor.java b/shell/platform/android/io/flutter/view/ResourceExtractor.java index 40fc75982a972..ecbd026c9db09 100644 --- a/shell/platform/android/io/flutter/view/ResourceExtractor.java +++ b/shell/platform/android/io/flutter/view/ResourceExtractor.java @@ -4,6 +4,8 @@ package io.flutter.view; +import static java.util.Arrays.asList; + import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; @@ -16,6 +18,7 @@ import org.json.JSONObject; import java.io.*; +import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.concurrent.CancellationException; @@ -30,10 +33,12 @@ class ResourceExtractor { private static final String TAG = "ResourceExtractor"; private static final String TIMESTAMP_PREFIX = "res_timestamp-"; + private static final String[] SUPPORTED_ABIS = getSupportedAbis(); @SuppressWarnings("deprecation") static long getVersionCode(PackageInfo packageInfo) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + // Linter needs P (28) hardcoded or else it will fail these lines. + if (Build.VERSION.SDK_INT >= 28) { return packageInfo.getLongVersionCode(); } else { return packageInfo.versionCode; @@ -244,7 +249,7 @@ private boolean extractUpdate(File dataDir) { ZipEntry entry = null; if (asset.endsWith(".so")) { // Replicate library lookup logic. - for (String abi : Build.SUPPORTED_ABIS) { + for (String abi : SUPPORTED_ABIS) { resource = "lib/" + abi + "/" + asset; entry = zipFile.getEntry(resource); if (entry == null) { @@ -403,4 +408,14 @@ private String getAPKPath() { return null; } } + + private static String[] getSupportedAbis() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.SUPPORTED_ABIS.length > 0) { + return Build.SUPPORTED_ABIS; + } else { + ArrayList cpuAbis = new ArrayList(asList(Build.CPU_ABI, Build.CPU_ABI2)); + cpuAbis.removeAll(asList(null, "")); + return cpuAbis.toArray(new String[0]); + } + } } diff --git a/tools/android_lint/baseline.xml b/tools/android_lint/baseline.xml index 2a81ee20380c5..93bc535f5737d 100644 --- a/tools/android_lint/baseline.xml +++ b/tools/android_lint/baseline.xml @@ -8,7 +8,7 @@ errorLine2=" ~~~~~~"> @@ -19,7 +19,7 @@ errorLine2=" ~~~~~~"> @@ -30,7 +30,7 @@ errorLine2=" ~~~~~~"> @@ -41,7 +41,7 @@ errorLine2=" ~~~~~~"> @@ -52,7 +52,7 @@ errorLine2=" ~~~~~~"> @@ -63,7 +63,7 @@ errorLine2=" ~~~~~~"> @@ -74,7 +74,7 @@ errorLine2=" ~~~~~~"> @@ -85,7 +85,7 @@ errorLine2=" ~~~~~~"> @@ -96,7 +96,7 @@ errorLine2=" ~~~~~~"> @@ -107,7 +107,7 @@ errorLine2=" ~~~~~~"> @@ -118,7 +118,7 @@ errorLine2=" ~~~~~~"> @@ -129,7 +129,7 @@ errorLine2=" ~~~~~~"> @@ -155,116 +155,6 @@ column="9"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -342,336 +232,6 @@ column="71"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -767,7 +327,7 @@ errorLine2=" ^"> @@ -800,7 +360,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -811,7 +371,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -877,7 +437,7 @@ errorLine2=" ~~~~~~~~~~~~~~~"> @@ -888,7 +448,7 @@ errorLine2=" ~~~~~~~~~~~~~~~"> @@ -921,7 +481,7 @@ errorLine2=" ~~~~~~~~~~~~"> @@ -932,7 +492,7 @@ errorLine2=" ~~~~~~~~~~~~"> diff --git a/tools/android_lint/lint.xml b/tools/android_lint/lint.xml new file mode 100644 index 0000000000000..241207161d5d6 --- /dev/null +++ b/tools/android_lint/lint.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file From 3c8ef04e910675eab5530c5ac4a3bcb1be84f6db Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 8 Mar 2019 16:30:48 -0800 Subject: [PATCH 0390/1117] Allow embedders to post tasks onto the render thread. (#8089) Some embedders may have to wait on fences asynchronously before committing contents. This allows them to post a task onto the engine managed thread used for rendering. --- shell/platform/embedder/embedder.cc | 15 +++++++++++++++ shell/platform/embedder/embedder.h | 8 ++++++++ shell/platform/embedder/embedder_engine.cc | 9 +++++++++ shell/platform/embedder/embedder_engine.h | 2 ++ 4 files changed, 34 insertions(+) diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index aa397938bb957..8e56920a32868 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -902,3 +902,18 @@ void FlutterEngineTraceEventDurationEnd(const char* name) { void FlutterEngineTraceEventInstant(const char* name) { fml::tracing::TraceEventInstant0("flutter", name); } + +FlutterEngineResult FlutterEnginePostRenderThreadTask(FlutterEngine engine, + VoidCallback callback, + void* baton) { + if (engine == nullptr || callback == nullptr) { + return kInvalidArguments; + } + + auto task = [callback, baton]() { callback(baton); }; + + return reinterpret_cast(engine)->PostRenderThreadTask( + task) + ? kSuccess + : kInternalInconsistency; +} diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 0be1fae740ad2..bf2343ec6e728 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -688,6 +688,14 @@ void FlutterEngineTraceEventDurationEnd(const char* name); FLUTTER_EXPORT void FlutterEngineTraceEventInstant(const char* name); +// Posts a task onto the Flutter render thread. Typically, this may be called +// from any thread as long as a |FlutterEngineShutdown| on the specific engine +// has not already been initiated. +FLUTTER_EXPORT +FlutterEngineResult FlutterEnginePostRenderThreadTask(FlutterEngine engine, + VoidCallback callback, + void* callback_data); + #if defined(__cplusplus) } // extern "C" #endif diff --git a/shell/platform/embedder/embedder_engine.cc b/shell/platform/embedder/embedder_engine.cc index 559840bb8d5f0..63083bcef1b4d 100644 --- a/shell/platform/embedder/embedder_engine.cc +++ b/shell/platform/embedder/embedder_engine.cc @@ -203,4 +203,13 @@ bool EmbedderEngine::OnVsyncEvent(intptr_t baton, frame_target_time); } +bool EmbedderEngine::PostRenderThreadTask(fml::closure task) { + if (!IsValid()) { + return false; + } + + shell_->GetTaskRunners().GetGPUTaskRunner()->PostTask(task); + return true; +} + } // namespace shell diff --git a/shell/platform/embedder/embedder_engine.h b/shell/platform/embedder/embedder_engine.h index 9975eea25d5a1..52b528e3a2ec3 100644 --- a/shell/platform/embedder/embedder_engine.h +++ b/shell/platform/embedder/embedder_engine.h @@ -63,6 +63,8 @@ class EmbedderEngine { fml::TimePoint frame_start_time, fml::TimePoint frame_target_time); + bool PostRenderThreadTask(fml::closure task); + private: const ThreadHost thread_host_; std::unique_ptr shell_; From c48774cfe09b7f286defb9e457a74c7e7028e11c Mon Sep 17 00:00:00 2001 From: Siva Date: Fri, 8 Mar 2019 16:31:23 -0800 Subject: [PATCH 0391/1117] Roll src/third_party/dart 571ea80e11..2fb6cd9f5f (122 commits) (#8086) 2fb6cd9f5f [vm] Fix Service::RequestAssets 585eb7f507 [ VM / Service ] Added `disableBreakpoints` parameter to `evaluate`, `evaluateInFrame` and `invoke` RPCs 9b0ac9ee03 Extract diagnostic tests in preparation for supporting ui-as-code features 93d42679f0 [vm, arm64, fuchsia] Check for stack overflow / interrupts based on DSP instead of CSP. 05be278603 Split MISSING_RETURN tests 1dd4559271 [vm] Add Native->VM transitions when dereferencing API handles. 34953ffd7d Cleanup some NNBD flags a47ffd2b50 Fix some errors in the control flow collections tests e1dfad1f2c Attempt 4 at the upload abi dills script 4b609422e9 Make AVAILABLE_SUGGESTION_SETS and related APIs non-experimental. 8332fb0631 [vm] Adds an API call to dump the CPU profile to the timeline ccf756dae5 Integration testing to ensure server lint name representations are correct. 34e1c93906 add prefer_null_aware_operators error code association 5c7b07f783 [dart/vm] Fix bug in kernel binary flow graph builder 07b2f82203 [fuchsia] Remove unused header a6a5a2b635 [dart/fuzzer] Added more Dart constructs 48ac0bdd72 Revert "Attempt 3 at the upload abi dill script" bc02b6ce7d Split DEAD_CODE tests into their own file 6c1a05a388 update non-nullable flag in ErrorVerifier for angular plugin da831bda20 fix lint name for unnecessary_overrides f2a8e71ff9 [vm] Decouple flow graph building of implicit closure functions from kernel reading f44fecbe39 Fix the way type arguments for iterable and map are accessed 94a382bfb8 Attempt 3 at the upload abi dill script 924a934fe1 Shrink the stack headroom if the stack is very small e5a833b06b Comment out test that unexpectedly passes on Windows. 72548cde13 Revert "[vm, gc] The mutator's TLAB and the interpreter's lookup cache must be visited even if the mutator is unscheduled." bdb07f4a1f [vm/ffi] Fix garbage collection of ffi.Pointer subtypes. cab4a7b48d fix lint name for unnecessary_brace_in_string_interps 00aeae4ca8 add fix for no_duplicate_case_values 593405afda add fix for use_rethrow 1551d9c660 Include correct stack during error with Stream.join 309140693c Revise non-nullable flag from AstBuilder to ErrorVerifier 2d3b1055d3 [vm/ffi] remove RuntimeError/Fail expectation from status files b4e9e46f81 [Gardening] Add tools/diff_results.dart which can query the test results database and report a diff in test results from two commits f1cc9c7cf1 [cfe] Classes for if, for and for-in elements. e3f0ca80e5 [cfe] Compile null-aware spreads in non-const lists and sets e8fa9a019b [ddc] Fix a front end test failure b71f6afd2c [vm/ffi] enable function stress test on macos 4ec72c1eb1 [VM-Runtime]Fix source report coverage to not include field without function initializer 253499fe68 [vm, gc] The mutator's TLAB and the interpreter's lookup cache must be visited even if the mutator is unscheduled. 980e5c7b57 [vm] Mark VM isolate objects at heap finalization instead of allocation. e48ad45fbd [vm, interpreter] Enable field guards. a7d790bbbe Fix cast exception in resolution 2f53b7913c [dartdevc] Including the current library for members from within an InstanceConstant 0124541d5f Deprecate AST data structures that will be obseleted by the "UI as code" feature 1751135fc3 [infra] Increase number of shards on app-* builders 6988347b53 [fuchsia] Migrate to lib/sys/cpp 995b1c9adc FE Server shouldn't try to invalidate other file schemes 975cc65c17 [vm, interpreter] Implement interpreter stubs for IA32. 85dec3423c add fix for unnecessary_new lint 17bf9d13b1 Delay disambiguating maps and sets until we know whether there are any conflicts 079309fcd6 Create curly braces when resynthesizing map and set literals 68c9909ef8 Re-apply workaround for bug fixed by closures containing type promotions in variables with inferred types. 68946df573 [vm] Also print version information in assertion failures, not just faults. 0c231060f4 Revert "Another attempt to fix the upload script." d1e60e0f3d Remove @failingTest from a test that stopped failing. 825d03c585 [vm] Remove malloc_hooks support for jemalloc 8bb8d11859 Prepare to publish analyzer_plugin version 0.0.1-alpha.7 0e578056e9 Another attempt to fix the upload script. 90b61e2fde Start implementing linker and resynthesizing. a1226b1490 Write and read almost all nodes. ba5644b76c Fix handling of closures containing type promotions in variables with inferred types. 7a98559781 [vm/ffi] make Pointer.toString() uniform on all operating systems 12fcb9136c [cfe] Make resolveInputUri available for pkg/vm 5441ff672b add fix for unnecessary_const lints 9645b19060 [infra] Link to the documentation in the new workflow tools. 150c58c13f [infra] Shard app-kernel tests that were causing timeouts 105912339c [cfe] Inherit SpreadElement from Expression, not ExpressionJudgment a85e481d3d [vm/gardening] Fix status file for entrypoints_verification_test. fa0d99156f Remove task model initialization 3712235e0e Remove the task graph and the tool that produces it 99d028be77 [infra] Make promote.py work with newer versions of gsutil 9d9f599ca9 [cfe] Compile spread in sets b5a1f6c36b Reland "[CFE] Move constant evaluation number semantics handling to front end." ea6e83004b Use @pragma instead of package:meta/dart2js in tests 2448445826 Make IfStatementImpl use IfMixin. 7ba8995917 Download ABI dills during gclient sync dc1f2bd087 [vm] Avoid assertion for non-finalized type parameter of expression evaluation function ef969c8c7e Revert "Update the build bot name restriction in upload_abi_dills.sh" 57f16820cd Add tests for "await" inside spread, if, and for. cbc404b6de [VM] Cleanup status files some more dc02d859f4 Ensure all SetConstantValues are JavaScriptSetConstants. f112b672e7 Use ListLiteral.elements2 instead of ListLiteral.elements. 4a7f9d7c11 Remove FindNode.setLiteral method. 2922878ce9 [vm, compiler] Fix GuardFieldTypeInstr to update the original field. 4eedef85a3 Update the build bot name restriction in upload_abi_dills.sh 60de5b4983 [vm] Avoid quadratic growth in (Malloc)TextBuffer and ZoneTextBuffer. c921716a30 Add upload_abi_dills.sh to dart-sdk-linux in test_matrix.json 47b417c88e Remove FindNode methods related to AST data structures that will be removed. c793038137 Identify flutter_web in Flutter. 1da7c0d472 [cfe] Fix type checks in spreads within lists and sets 09a1cf67e6 [cfe] Don't replace spreads with invalid expressions after inference 51a334caa7 [vm] Remove kernel reading from BuildArgumentTypeChecks 927e758e96 Stop using package:html in analyzer. 53438199a4 Tweak version numbers in LSP readme 58a0487125 more tests for 34610 and 36009 2071d1284d [vm/ffi] Fix crash on toString for dart:ffi trampoline functions aacd8c7711 de-dup machine format errors cc455ecc1d Add use_abi_version flag, and plumb ABI version to version.h 96e982f054 Improve await-outside-async error recovery e033b676dd fix parser crash in unterminated string literal inside unterminated interpolation ed8357cf83 Re-land "[vm/ffi] Stress tests for FFI functions."" 6227ab0b97 Replace @ForceInline with @pragma in dart:html 204651f3ab Replace package:expect annotations with @pragma 45e6f83cd6 gitignore visual studio project files ca24e7aa10 [vm] Allow no main method when doing type flow analysis c769743f67 [CFE] Transform constants in annotations on all parameters. 718b36ed73 [cfe] Use for-in instead of List.addAll for list spread 99093c0610 [fasta] Required but not inferred constant context. 822ebdd1e0 [fasta] Wrap non-const variable accesses inside const expressions. 013cf68624 Replace js_helper annotations with @pragma 1a88421d39 Allow to change .package uri in incremental compiler 2695cdfbb1 Change incremental compiler to take entry points (plural) 3124125008 Move Flutter utility methods into a class, which can be instantiated either with regular package:flutter, or with package_flutter_web. 5a8bdc7f34 [dartdevc] fix #36052, missing key in map should result in null 643895befc Fix two failing tests on the bots (TBR) 24d28e8f48 Write SetOrMapLiteral instead of MapLiteral or SetLiteral. c86a9ece5f First cut at upward inference for the ui-as-code features 2329fccdb9 Use visitForStatement2() and read as ForStatement2 and its parts. a7a4c95df7 Summarize SetOrMapLiteral 1abcbe1318 Eliminate uses of old AST node types from parts of the analyzer 1c27b817fc New protocol to inspect analysis server state at code completion time --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 47ef330849766..cfe925bba5579 100644 --- a/DEPS +++ b/DEPS @@ -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': '571ea80e1101e706980ea8aefa7fc18a0c8ba2ec', + 'dart_revision': '2fb6cd9f5ff78fb347795f383a748a1e37d23275', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 1e1b8c898d1c0..80fa218d1863e 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 4a8dfa2afe659f0a6057032c092f7496 +Signature: aeb3ef2d086ef58fb819d6902a51acb5 UNUSED LICENSES: @@ -5230,7 +5230,6 @@ FILE: ../../../third_party/dart/runtime/vm/malloc_hooks.h FILE: ../../../third_party/dart/runtime/vm/malloc_hooks_arm.cc FILE: ../../../third_party/dart/runtime/vm/malloc_hooks_arm64.cc FILE: ../../../third_party/dart/runtime/vm/malloc_hooks_ia32.cc -FILE: ../../../third_party/dart/runtime/vm/malloc_hooks_jemalloc.cc FILE: ../../../third_party/dart/runtime/vm/malloc_hooks_tcmalloc.cc FILE: ../../../third_party/dart/runtime/vm/malloc_hooks_test.cc FILE: ../../../third_party/dart/runtime/vm/malloc_hooks_unsupported.cc From edfc0cfaaf6d812ab3d28f6ad912601b6abe53ec Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Fri, 8 Mar 2019 18:08:26 -0800 Subject: [PATCH 0392/1117] Android Embedding PR 16: Add touch support to FlutterView. (#8034) --- .../engine/android/AndroidTouchProcessor.java | 146 ++++++++++++------ .../embedding/engine/android/FlutterView.java | 6 +- 2 files changed, 104 insertions(+), 48 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java b/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java index 9bf0848d68661..94c4f7525c51b 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java @@ -1,6 +1,8 @@ package io.flutter.embedding.engine.android; +import android.support.annotation.IntDef; import android.support.annotation.NonNull; +import android.view.InputDevice; import android.view.MotionEvent; import java.nio.ByteBuffer; @@ -15,26 +17,47 @@ public class AndroidTouchProcessor { // Must match the PointerChange enum in pointer.dart. - // TODO(mattcarroll): convert these to an IntDef - private static final int POINTER_CHANGE_CANCEL = 0; - private static final int POINTER_CHANGE_ADD = 1; - private static final int POINTER_CHANGE_REMOVE = 2; - private static final int POINTER_CHANGE_HOVER = 3; - private static final int POINTER_CHANGE_DOWN = 4; - private static final int POINTER_CHANGE_MOVE = 5; - private static final int POINTER_CHANGE_UP = 6; + @IntDef({ + PointerChange.CANCEL, + PointerChange.ADD, + PointerChange.REMOVE, + PointerChange.HOVER, + PointerChange.DOWN, + PointerChange.MOVE, + PointerChange.UP + }) + private @interface PointerChange { + int CANCEL = 0; + int ADD = 1; + int REMOVE = 2; + int HOVER = 3; + int DOWN = 4; + int MOVE = 5; + int UP = 6; + } + // Must match the PointerDeviceKind enum in pointer.dart. - // TODO(mattcarroll): convert these to an IntDef - private static final int POINTER_DEVICE_KIND_TOUCH = 0; - private static final int POINTER_DEVICE_KIND_MOUSE = 1; - private static final int POINTER_DEVICE_KIND_STYLUS = 2; - private static final int POINTER_DEVICE_KIND_INVERTED_STYLUS = 3; - private static final int POINTER_DEVICE_KIND_UNKNOWN = 4; + @IntDef({ + PointerDeviceKind.TOUCH, + PointerDeviceKind.MOUSE, + PointerDeviceKind.STYLUS, + PointerDeviceKind.INVERTED_STYLUS, + PointerDeviceKind.UNKNOWN + }) + private @interface PointerDeviceKind { + int TOUCH = 0; + int MOUSE = 1; + int STYLUS = 2; + int INVERTED_STYLUS = 3; + int UNKNOWN = 4; + } // Must match the unpacking code in hooks.dart. - private static final int POINTER_DATA_FIELD_COUNT = 19; - private static final int BYTE_PER_FIELD = 8; + // TODO(mattcarroll): Update with additional fields for scroll wheel support + private static final int POINTER_DATA_FIELD_COUNT = 21; + private static final int BYTES_PER_FIELD = 8; + private static final int POINTER_DATA_FLAG_BATCHED = 1; @NonNull private final FlutterRenderer renderer; @@ -57,27 +80,41 @@ public boolean onTouchEvent(MotionEvent event) { // Prepare a data packet of the appropriate size and order. ByteBuffer packet = ByteBuffer.allocateDirect( - pointerCount * POINTER_DATA_FIELD_COUNT * BYTE_PER_FIELD + pointerCount * POINTER_DATA_FIELD_COUNT * BYTES_PER_FIELD ); 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()); + boolean updateForSinglePointer = maskedAction == MotionEvent.ACTION_DOWN || maskedAction == MotionEvent.ACTION_POINTER_DOWN; + boolean updateForMultiplePointers = !updateForSinglePointer && (maskedAction == MotionEvent.ACTION_UP || maskedAction == MotionEvent.ACTION_POINTER_UP); + if (updateForSinglePointer) { + // ACTION_DOWN and ACTION_POINTER_DOWN always apply to a single pointer only. + addPointerForIndex(event, event.getActionIndex(), pointerChange, 0, packet); + } else if (updateForMultiplePointers) { + // 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() && event.getToolType(p) == MotionEvent.TOOL_TYPE_FINGER) { + addPointerForIndex(event, p, PointerChange.MOVE, POINTER_DATA_FLAG_BATCHED, 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); } } // Verify that the packet is the expected size. - assert packet.position() % (POINTER_DATA_FIELD_COUNT * BYTE_PER_FIELD) == 0; + assert packet.position() % (POINTER_DATA_FIELD_COUNT * BYTES_PER_FIELD) == 0; // Send the packet to Flutter. renderer.dispatchPointerDataPacket(packet, packet.position()); @@ -86,8 +123,13 @@ public boolean onTouchEvent(MotionEvent event) { } // TODO(mattcarroll): consider creating a PointerPacket class instead of using a procedure that mutates inputs. - 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; } @@ -103,9 +145,9 @@ private void addPointerForIndex(MotionEvent event, int pointerIndex, ByteBuffer packet.putDouble(event.getX(pointerIndex)); // physical_x packet.putDouble(event.getY(pointerIndex)); // physical_y - if (pointerKind == POINTER_DEVICE_KIND_MOUSE) { + if (pointerKind == PointerDeviceKind.MOUSE) { packet.putLong(event.getButtonState() & 0x1F); // buttons - } else if (pointerKind == POINTER_DEVICE_KIND_STYLUS) { + } else if (pointerKind == PointerDeviceKind.STYLUS) { packet.putLong((event.getButtonState() >> 4) & 0xF); // buttons } else { packet.putLong(0); // buttons @@ -113,13 +155,20 @@ private void addPointerForIndex(MotionEvent event, int pointerIndex, ByteBuffer packet.putLong(0); // obscured - // TODO(eseidel): Could get the calibrated range if necessary: - // event.getDevice().getMotionRange(MotionEvent.AXIS_PRESSURE) packet.putDouble(event.getPressure(pointerIndex)); // pressure - packet.putDouble(0.0); // pressure_min - packet.putDouble(1.0); // pressure_max + double pressureMin = 0.0; + double pressureMax = 1.0; + if (event.getDevice() != null) { + InputDevice.MotionRange pressureRange = event.getDevice().getMotionRange(MotionEvent.AXIS_PRESSURE); + if (pressureRange != null) { + pressureMin = pressureRange.getMin(); + pressureMax = pressureRange.getMax(); + } + } + packet.putDouble(pressureMin); // pressure_min + packet.putDouble(pressureMax); // pressure_max - if (pointerKind == POINTER_DEVICE_KIND_STYLUS) { + if (pointerKind == PointerDeviceKind.STYLUS) { packet.putDouble(event.getAxisValue(MotionEvent.AXIS_DISTANCE, pointerIndex)); // distance packet.putDouble(0.0); // distance_max } else { @@ -127,6 +176,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 @@ -135,52 +186,55 @@ private void addPointerForIndex(MotionEvent event, int pointerIndex, ByteBuffer packet.putDouble(event.getAxisValue(MotionEvent.AXIS_ORIENTATION, pointerIndex)); // orientation - if (pointerKind == POINTER_DEVICE_KIND_STYLUS) { + if (pointerKind == PointerDeviceKind.STYLUS) { packet.putDouble(event.getAxisValue(MotionEvent.AXIS_TILT, pointerIndex)); // tilt } else { packet.putDouble(0.0); // tilt } + + packet.putLong(pointerData); } + @PointerChange private int getPointerChangeForAction(int maskedAction) { // Primary pointer: if (maskedAction == MotionEvent.ACTION_DOWN) { - return POINTER_CHANGE_DOWN; + return PointerChange.DOWN; } if (maskedAction == MotionEvent.ACTION_UP) { - return POINTER_CHANGE_UP; + return PointerChange.UP; } // Secondary pointer: if (maskedAction == MotionEvent.ACTION_POINTER_DOWN) { - return POINTER_CHANGE_DOWN; + return PointerChange.DOWN; } if (maskedAction == MotionEvent.ACTION_POINTER_UP) { - return POINTER_CHANGE_UP; + return PointerChange.UP; } // All pointers: if (maskedAction == MotionEvent.ACTION_MOVE) { - return POINTER_CHANGE_MOVE; + return PointerChange.MOVE; } if (maskedAction == MotionEvent.ACTION_CANCEL) { - return POINTER_CHANGE_CANCEL; + return PointerChange.CANCEL; } return -1; } - // TODO(mattcarroll): introduce IntDef for toolType. + @PointerDeviceKind private int getPointerDeviceTypeForToolType(int toolType) { switch (toolType) { case MotionEvent.TOOL_TYPE_FINGER: - return POINTER_DEVICE_KIND_TOUCH; + return PointerDeviceKind.TOUCH; case MotionEvent.TOOL_TYPE_STYLUS: - return POINTER_DEVICE_KIND_STYLUS; + return PointerDeviceKind.STYLUS; case MotionEvent.TOOL_TYPE_MOUSE: - return POINTER_DEVICE_KIND_MOUSE; + return PointerDeviceKind.MOUSE; case MotionEvent.TOOL_TYPE_ERASER: - return POINTER_DEVICE_KIND_INVERTED_STYLUS; + return PointerDeviceKind.INVERTED_STYLUS; default: // MotionEvent.TOOL_TYPE_UNKNOWN will reach here. - return POINTER_DEVICE_KIND_UNKNOWN; + return PointerDeviceKind.UNKNOWN; } } } diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java index 7e586670e477f..1f507cecb3c13 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java @@ -79,6 +79,8 @@ public class FlutterView extends FrameLayout { private TextInputPlugin textInputPlugin; @Nullable private AndroidKeyProcessor androidKeyProcessor; + @Nullable + private AndroidTouchProcessor androidTouchProcessor; // Directly implemented View behavior that communicates with Flutter. private final FlutterRenderer.ViewportMetrics viewportMetrics = new FlutterRenderer.ViewportMetrics(); @@ -313,8 +315,7 @@ public boolean onTouchEvent(MotionEvent event) { return false; } - // TODO(mattcarroll): forward event to touch processore when it's merged in. - return false; + return androidTouchProcessor.onTouchEvent(event); } /** @@ -388,6 +389,7 @@ public void attachToFlutterEngine(@NonNull FlutterEngine flutterEngine) { this.flutterEngine.getKeyEventChannel(), textInputPlugin ); + androidTouchProcessor = new AndroidTouchProcessor(this.flutterEngine.getRenderer()); // Inform the Android framework that it should retrieve a new InputConnection // now that an engine is attached. From 718329ce6e8b66970ae198804f43abf647c6f24e Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Fri, 8 Mar 2019 18:09:04 -0800 Subject: [PATCH 0393/1117] Android Embedding PR 17: Clarify AccessibilityBridge and move logic out of FlutterView. (#8061) --- .../flutter/embedding/engine/FlutterJNI.java | 18 + .../systemchannels/AccessibilityChannel.java | 6 +- .../io/flutter/view/AccessibilityBridge.java | 1423 ++++++++++++----- .../android/io/flutter/view/FlutterView.java | 228 +-- tools/android_lint/baseline.xml | 62 +- 5 files changed, 1103 insertions(+), 634 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java index f2d194275c3d4..41e128ecd63f7 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java @@ -20,6 +20,8 @@ import io.flutter.embedding.engine.FlutterEngine.EngineLifecycleListener; import io.flutter.embedding.engine.renderer.FlutterRenderer; import io.flutter.embedding.engine.renderer.OnFirstFrameRenderedListener; +import io.flutter.plugin.common.StandardMessageCodec; +import io.flutter.view.AccessibilityBridge; /** * Interface between Flutter embedding's Java code and Flutter engine's C/C++ code. @@ -323,6 +325,22 @@ private native void nativeDispatchPointerDataPacket(long nativePlatformViewId, ByteBuffer buffer, int position); + public void dispatchSemanticsAction(int id, @NonNull AccessibilityBridge.Action action) { + dispatchSemanticsAction(id, action, null); + } + + public void dispatchSemanticsAction(int id, @NonNull AccessibilityBridge.Action action, @Nullable Object args) { + ensureAttachedToNative(); + + ByteBuffer encodedArgs = null; + int position = 0; + if (args != null) { + encodedArgs = StandardMessageCodec.INSTANCE.encodeMessage(args); + position = encodedArgs.position(); + } + dispatchSemanticsAction(id, action.value, encodedArgs, position); + } + @UiThread public void dispatchSemanticsAction(int id, int action, ByteBuffer args, int argsPosition) { ensureAttachedToNative(); diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java index 4bfcd37973b58..7eed2619bebda 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java @@ -103,17 +103,17 @@ public interface AccessibilityMessageHandler { void announce(@NonNull String message); /** - * The user has tapped on the artifact with the given {@code nodeId}. + * The user has tapped on the widget with the given {@code nodeId}. */ void onTap(int nodeId); /** - * The user has long pressed on the artifact with the given {@code nodeId}. + * The user has long pressed on the widget with the given {@code nodeId}. */ void onLongPress(int nodeId); /** - * The user has opened a popup window, menu, dialog, etc. + * The user has opened a tooltip. */ void onTooltip(@NonNull String message); } diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index add434080c054..812170155ec75 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -6,28 +6,69 @@ import android.annotation.TargetApi; import android.app.Activity; +import android.content.ContentResolver; +import android.database.ContentObserver; import android.graphics.Rect; +import android.net.Uri; import android.opengl.Matrix; import android.os.Build; import android.os.Bundle; +import android.os.Handler; +import android.provider.Settings; import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.support.annotation.NonNull; import android.support.annotation.RequiresApi; import android.util.Log; +import android.view.MotionEvent; import android.view.View; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeProvider; +import io.flutter.embedding.engine.FlutterJNI; import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; import io.flutter.util.Predicate; import java.nio.ByteBuffer; import java.util.*; -class AccessibilityBridge - extends AccessibilityNodeProvider { - private static final String TAG = "FlutterView"; +/** + * Bridge between Android's OS accessibility system and Flutter's accessibility system. + * + * An {@code AccessibilityBridge} requires: + *

    + *
  • A real Android {@link View}, called the {@link #rootAccessibilityView}, which contains a + * Flutter UI. The {@link #rootAccessibilityView} is required at the time of + * {@code AccessibilityBridge}'s instantiation and is held for the duration of + * {@code AccessibilityBridge}'s lifespan. {@code AccessibilityBridge} invokes various + * accessibility methods on the {@link #rootAccessibilityView}, e.g., + * {@link View#onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo)}. The + * {@link #rootAccessibilityView} is expected to notify the {@code AccessibilityBridge} of + * relevant interactions: {@link #onAccessibilityHoverEvent(MotionEvent)}, {@link #reset()}, + * {@link #updateSemantics(ByteBuffer, String[])}, and {@link #updateCustomAccessibilityActions(ByteBuffer, String[])}
  • + *
  • A {@link FlutterJNI} instance, corresponding to the running Flutter app.
  • + *
  • An {@link AccessibilityChannel} that is connected to the running Flutter app.
  • + *
  • Android's {@link AccessibilityManager} to query and listen for accessibility settings.
  • + *
  • Android's {@link ContentResolver} to listen for changes to system animation settings.
  • + *
+ * + * The {@code AccessibilityBridge} causes Android to treat Flutter {@code SemanticsNode}s as if + * they were accessible Android {@link View}s. Accessibility requests may be sent from + * a Flutter widget to the Android OS, as if it were an Android {@link View}, and + * accessibility events may be consumed by a Flutter widget, as if it were an Android + * {@link View}. {@code AccessibilityBridge} refers to Flutter's accessible widgets as + * "virtual views" and identifies them with "virtual view IDs". + * + * Most communication between the Android OS accessibility system and Flutter's accessibility + * system is achieved via the {@link AccessibilityChannel} system channel. However, some + * information is exchanged directly between the Android embedding and Flutter framework + * via {@link FlutterJNI}. + * TODO(mattcarroll): consider moving FlutterJNI calls over to AccessibilityChannel + */ +public class AccessibilityBridge extends AccessibilityNodeProvider { + private static final String TAG = "AccessibilityBridge"; // Constants from higher API levels. // TODO(goderbauer): Get these from Android Support Library when @@ -38,35 +79,160 @@ class AccessibilityBridge private static final float SCROLL_POSITION_CAP_FOR_INFINITY = 70000.0f; private static final int ROOT_NODE_ID = 0; - private final FlutterView owner; + /// Value is derived from ACTION_TYPE_MASK in AccessibilityNodeInfo.java + private static int FIRST_RESOURCE_ID = 267386881; + + // Real Android View, which internally holds a Flutter UI. + @NonNull + private final View rootAccessibilityView; + + // Direct interface between Flutter's Android embedding and the Flutter framework. + @NonNull + private final FlutterJNI flutterJNI; + + // The accessibility communication API between Flutter's Android embedding and + // the Flutter framework. + @NonNull private final AccessibilityChannel accessibilityChannel; + + // Android's {@link AccessibilityManager}, which we can query to see if accessibility is + // turned on, as well as listen for changes to accessibility's activation. + @NonNull + private final AccessibilityManager accessibilityManager; + + // Android's {@link ContentResolver}, which is used to observe the global TRANSITION_ANIMATION_SCALE, + // which determines whether Flutter's animations should be enabled or disabled for accessibility + // purposes. + @NonNull + private final ContentResolver contentResolver; + + // The top-level Android View within the containing Window. + // TODO(mattcarroll): Move communication with the decorView out to FlutterView, or even FlutterActivity. + // The reason this is here is because when the device is in reverse-landscape + // orientation, Android has a bug where it assumes the OS nav bar is on the + // right side of the screen, not the left. As a result, accessibility borders + // are drawn too far to the left. The AccessibilityBridge directly adjusts + // for this Android bug. We still need to adjust, but this is the wrong place + // to access a decorView. What if the FlutterView is only part of the UI + // hierarchy, like a list item? We shouldn't touch the decor view. + // https://github.com/flutter/flutter/issues/19967 + @NonNull private final View decorView; - private Map objects; - private Map customAccessibilityActions; - private boolean accessibilityEnabled = false; - private SemanticsObject a11yFocusedObject; - private SemanticsObject inputFocusedObject; - private SemanticsObject hoveredObject; + + // The entire Flutter semantics tree of the running Flutter app, stored as a Map + // from each SemanticsNode's ID to a Java representation of a Flutter SemanticsNode. + // + // Flutter's semantics tree is cached here because Android might ask for information about + // a given SemanticsNode at any moment in time. Caching the tree allows for immediate + // response to Android's request. + // + // The structure of flutterSemanticsTree may be 1 or 2 frames behind the Flutter app + // due to the time required to communicate tree changes from Flutter to Android. + // + // See the Flutter docs on SemanticsNode: + // https://docs.flutter.io/flutter/semantics/SemanticsNode-class.html + @NonNull + private final Map flutterSemanticsTree = new HashMap<>(); + + // The set of all custom Flutter accessibility actions that are present in the running + // Flutter app, stored as a Map from each action's ID to the definition of the custom accessibility + // action. + // + // Flutter and Android support a number of built-in accessibility actions. However, these + // predefined actions are not always sufficient for a desired interaction. Android facilitates + // custom accessibility actions, https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.AccessibilityAction. + // Flutter supports custom accessibility actions via {@code customSemanticsActions} within + // a {@code Semantics} widget, https://docs.flutter.io/flutter/widgets/Semantics-class.html. + // {@code customAccessibilityActions} are an Android-side cache of all custom accessibility + // types declared within the running Flutter app. + // + // Custom accessibility actions are comprised of only a few fields, and therefore it is likely + // that a given app may define the same custom accessibility action many times. Identical + // custom accessibility actions are de-duped such that {@code customAccessibilityActions} only + // caches unique custom accessibility actions. + // + // See the Android documentation for custom accessibility actions: + // https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.AccessibilityAction + // + // See the Flutter documentation for the Semantics widget: + // https://docs.flutter.io/flutter/widgets/Semantics-class.html + @NonNull + private final Map customAccessibilityActions = new HashMap<>(); + + // The {@code SemanticsNode} within Flutter that currently has the focus of Android's + // accessibility system. + @Nullable + private SemanticsNode accessibilityFocusedSemanticsNode; + + // The accessibility features that should currently be active within Flutter, represented as + // a bitmask whose values comes from {@link AccessibilityFeature}. + private int accessibilityFeatureFlags = 0; + + // The {@code SemanticsNode} within Flutter that currently has the focus of Android's input + // system. + // + // Input focus is independent of accessibility focus. It is possible that accessibility focus + // and input focus target the same {@code SemanticsNode}, but it is also possible that one + // {@code SemanticsNode} has input focus while a different {@code SemanticsNode} has + // accessibility focus. For example, a user may use a D-Pad to navigate to a text field, giving + // it accessibility focus, and then enable input on that text field, giving it input focus. Then + // the user moves the accessibility focus to a nearby label to get info about the label, while + // maintaining input focus on the original text field. + @Nullable + private SemanticsNode inputFocusedSemanticsNode; + + // The widget within Flutter that currently sits beneath a cursor, e.g, + // beneath a stylus or mouse cursor. + @Nullable + private SemanticsNode hoveredObject; + + // A Java/Android cached representation of the Flutter app's navigation stack. The Flutter + // navigation stack is tracked so that accessibility announcements can be made during Flutter's + // navigation changes. + // TODO(mattcarroll): take this cache into account for new routing solution so accessibility does + // not get left behind. + @NonNull + private final List flutterNavigationStack = new ArrayList<>(); + + // TODO(mattcarroll): why do we need previouseRouteId if we have flutterNavigationStack private int previousRouteId = ROOT_NODE_ID; - private List previousRoutes; + + // TODO(mattcarroll): is this for the decor view adjustment? + @NonNull private Integer lastLeftFrameInset = 0; + @Nullable + private OnAccessibilityChangeListener onAccessibilityChangeListener; + + // Handler for all messages received from Flutter via the {@code accessibilityChannel} private final AccessibilityChannel.AccessibilityMessageHandler accessibilityMessageHandler = new AccessibilityChannel.AccessibilityMessageHandler() { + /** + * The Dart application would like the given {@code message} to be announced. + */ @Override public void announce(@NonNull String message) { - owner.announceForAccessibility(message); + rootAccessibilityView.announceForAccessibility(message); } + /** + * The user has tapped on the widget with the given {@code nodeId}. + */ @Override public void onTap(int nodeId) { sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_CLICKED); } + /** + * The user has long pressed on the widget with the given {@code nodeId}. + */ @Override public void onLongPress(int nodeId) { sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); } + /** + * The user has opened a tooltip. + */ @Override public void onTooltip(@NonNull String message) { AccessibilityEvent e = obtainAccessibilityEvent(ROOT_NODE_ID, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); @@ -75,164 +241,262 @@ public void onTooltip(@NonNull String message) { } }; - enum Action { - TAP(1 << 0), - LONG_PRESS(1 << 1), - SCROLL_LEFT(1 << 2), - SCROLL_RIGHT(1 << 3), - SCROLL_UP(1 << 4), - SCROLL_DOWN(1 << 5), - INCREASE(1 << 6), - DECREASE(1 << 7), - SHOW_ON_SCREEN(1 << 8), - MOVE_CURSOR_FORWARD_BY_CHARACTER(1 << 9), - MOVE_CURSOR_BACKWARD_BY_CHARACTER(1 << 10), - /** These actions are only supported on Android 4.3 and above. */ - SET_SELECTION(1 << 11), - COPY(1 << 12), - CUT(1 << 13), - PASTE(1 << 14), - /** End 4.3 only supported actions. */ - DID_GAIN_ACCESSIBILITY_FOCUS(1 << 15), - DID_LOSE_ACCESSIBILITY_FOCUS(1 << 16), - CUSTOM_ACTION(1 << 17), - DISMISS(1 << 18), - MOVE_CURSOR_FORWARD_BY_WORD(1 << 19), - MOVE_CURSOR_BACKWARD_BY_WORD(1 << 20); + // Listener that is notified when accessibility is turned on/off. + private final AccessibilityManager.AccessibilityStateChangeListener accessibilityStateChangeListener = new AccessibilityManager.AccessibilityStateChangeListener() { + @Override + public void onAccessibilityStateChanged(boolean accessibilityEnabled) { + if (accessibilityEnabled) { + accessibilityChannel.setAccessibilityMessageHandler(accessibilityMessageHandler); + flutterJNI.setSemanticsEnabled(true); + } else { + accessibilityChannel.setAccessibilityMessageHandler(null); + flutterJNI.setSemanticsEnabled(false); + } - Action(int value) { - this.value = value; + if (onAccessibilityChangeListener != null) { + onAccessibilityChangeListener.onAccessibilityChanged( + accessibilityEnabled, + accessibilityManager.isTouchExplorationEnabled() + ); + } } + }; - final int value; - } + // Listener that is notified when accessibility touch exploration is turned on/off. + // This is guarded at instantiation time. + @TargetApi(19) + @RequiresApi(19) + private final AccessibilityManager.TouchExplorationStateChangeListener touchExplorationStateChangeListener = new AccessibilityManager.TouchExplorationStateChangeListener() { + @Override + public void onTouchExplorationStateChanged(boolean isTouchExplorationEnabled) { + if (isTouchExplorationEnabled) { + accessibilityFeatureFlags |= AccessibilityFeature.ACCESSIBLE_NAVIGATION.value; + } else { + onTouchExplorationExit(); + accessibilityFeatureFlags &= ~AccessibilityFeature.ACCESSIBLE_NAVIGATION.value; + } + sendLatestAccessibilityFlagsToFlutter(); - enum Flag { - HAS_CHECKED_STATE(1 << 0), - IS_CHECKED(1 << 1), - IS_SELECTED(1 << 2), - IS_BUTTON(1 << 3), - IS_TEXT_FIELD(1 << 4), - IS_FOCUSED(1 << 5), - HAS_ENABLED_STATE(1 << 6), - IS_ENABLED(1 << 7), - IS_IN_MUTUALLY_EXCLUSIVE_GROUP(1 << 8), - IS_HEADER(1 << 9), - IS_OBSCURED(1 << 10), - SCOPES_ROUTE(1 << 11), - NAMES_ROUTE(1 << 12), - IS_HIDDEN(1 << 13), - IS_IMAGE(1 << 14), - IS_LIVE_REGION(1 << 15), - HAS_TOGGLED_STATE(1 << 16), - IS_TOGGLED(1 << 17), - HAS_IMPLICIT_SCROLLING(1 << 18); + if (onAccessibilityChangeListener != null) { + onAccessibilityChangeListener.onAccessibilityChanged( + accessibilityManager.isEnabled(), + isTouchExplorationEnabled + ); + } + } + }; - Flag(int value) { - this.value = value; + // Listener that is notified when the global TRANSITION_ANIMATION_SCALE. When this scale goes + // to zero, we instruct Flutter to disable animations. + private final ContentObserver animationScaleObserver = new ContentObserver(new Handler()) { + @Override + public void onChange(boolean selfChange) { + this.onChange(selfChange, null); } - final int value; - } + @Override + public void onChange(boolean selfChange, Uri uri) { + // Retrieve the current value of TRANSITION_ANIMATION_SCALE from the OS. + String value = Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 ? null + : Settings.Global.getString( + contentResolver, + Settings.Global.TRANSITION_ANIMATION_SCALE + ); + + boolean shouldAnimationsBeDisabled = value != null && value.equals("0"); + if (shouldAnimationsBeDisabled) { + accessibilityFeatureFlags |= AccessibilityFeature.DISABLE_ANIMATIONS.value; + } else { + accessibilityFeatureFlags &= ~AccessibilityFeature.DISABLE_ANIMATIONS.value; + } + sendLatestAccessibilityFlagsToFlutter(); + } + }; - AccessibilityBridge(@NonNull FlutterView owner, @NonNull AccessibilityChannel accessibilityChannel) { - this.owner = owner; + AccessibilityBridge( + @NonNull View rootAccessibilityView, + @NonNull FlutterJNI flutterJNI, + @NonNull AccessibilityChannel accessibilityChannel, + @NonNull AccessibilityManager accessibilityManager, + @NonNull ContentResolver contentResolver + ) { + this.rootAccessibilityView = rootAccessibilityView; + this.flutterJNI = flutterJNI; this.accessibilityChannel = accessibilityChannel; - decorView = ((Activity) owner.getContext()).getWindow().getDecorView(); - objects = new HashMap<>(); - customAccessibilityActions = new HashMap<>(); - previousRoutes = new ArrayList<>(); - } + this.accessibilityManager = accessibilityManager; + this.contentResolver = contentResolver; - void setAccessibilityEnabled(boolean accessibilityEnabled) { - this.accessibilityEnabled = accessibilityEnabled; - if (accessibilityEnabled) { - this.accessibilityChannel.setAccessibilityMessageHandler(accessibilityMessageHandler); - } else { - this.accessibilityChannel.setAccessibilityMessageHandler(null); + decorView = ((Activity) rootAccessibilityView.getContext()).getWindow().getDecorView(); + + // Tell Flutter whether accessibility is initially active or not. Then register a listener + // to be notified of changes in the future. + accessibilityStateChangeListener.onAccessibilityStateChanged(accessibilityManager.isEnabled()); + this.accessibilityManager.addAccessibilityStateChangeListener(accessibilityStateChangeListener); + + // Tell Flutter whether touch exploration is initially active or not. Then register a listener + // to be notified of changes in the future. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + touchExplorationStateChangeListener.onTouchExplorationStateChanged(accessibilityManager.isTouchExplorationEnabled()); + this.accessibilityManager.addTouchExplorationStateChangeListener(touchExplorationStateChangeListener); + } + + // Tell Flutter whether animations should initially be enabled or disabled. Then register a + // listener to be notified of changes in the future. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { + animationScaleObserver.onChange(false); + Uri transitionUri = Settings.Global.getUriFor(Settings.Global.TRANSITION_ANIMATION_SCALE); + this.contentResolver.registerContentObserver(transitionUri, false, animationScaleObserver); } } - private boolean shouldSetCollectionInfo(final SemanticsObject object) { + /** + * Disconnects any listeners and/or delegates that were initialized in {@code AccessibilityBridge}'s + * constructor, or added after. + * + * Do not use this instance after invoking {@code release}. The behavior of any method invoked + * on this {@code AccessibilityBridge} after invoking {@code release()} is undefined. + */ + public void release() { + setOnAccessibilityChangeListener(null); + accessibilityManager.removeAccessibilityStateChangeListener(accessibilityStateChangeListener); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + accessibilityManager.removeTouchExplorationStateChangeListener(touchExplorationStateChangeListener); + } + contentResolver.unregisterContentObserver(animationScaleObserver); + } + + /** + * Returns true if the Android OS currently has accessibility enabled, false otherwise. + */ + public boolean isAccessibilityEnabled() { + return accessibilityManager.isEnabled(); + } + + /** + * Returns true if the Android OS currently has touch exploration enabled, false otherwise. + */ + public boolean isTouchExplorationEnabled() { + return accessibilityManager.isTouchExplorationEnabled(); + } + + /** + * Sets a listener on this {@code AccessibilityBridge}, which is notified whenever accessibility + * activation, or touch exploration activation changes. + */ + public void setOnAccessibilityChangeListener(@Nullable OnAccessibilityChangeListener listener) { + this.onAccessibilityChangeListener = listener; + } + + /** + * Sends the current value of {@link #accessibilityFeatureFlags} to Flutter via {@link FlutterJNI}. + */ + private void sendLatestAccessibilityFlagsToFlutter() { + flutterJNI.setAccessibilityFeatures(accessibilityFeatureFlags); + } + + private boolean shouldSetCollectionInfo(final SemanticsNode semanticsNode) { // TalkBack expects a number of rows and/or columns greater than 0 to announce // in list and out of list. For an infinite or growing list, you have to // specify something > 0 to get "in list" announcements. // TalkBack will also only track one list at a time, so we only want to set this - // for a list that contains the current a11y focused object - otherwise, if there + // for a list that contains the current a11y focused semanticsNode - otherwise, if there // are two lists or nested lists, we may end up with announcements for only the last // one that is currently available in the semantics tree. However, we also want // to set it if we're exiting a list to a non-list, so that we can get the "out of list" // announcement when A11y focus moves out of a list and not into another list. - return object.scrollChildren > 0 - && (hasSemanticsObjectAncestor(a11yFocusedObject, o -> o == object) - || !hasSemanticsObjectAncestor(a11yFocusedObject, o -> o.hasFlag(Flag.HAS_IMPLICIT_SCROLLING))); + return semanticsNode.scrollChildren > 0 + && (SemanticsNode.nullableHasAncestor(accessibilityFocusedSemanticsNode, o -> o == semanticsNode) + || !SemanticsNode.nullableHasAncestor(accessibilityFocusedSemanticsNode, o -> o.hasFlag(Flag.HAS_IMPLICIT_SCROLLING))); } + /** + * Returns {@link AccessibilityNodeInfo} for the view corresponding to the given {@code virtualViewId}. + * + * This method is invoked by Android's accessibility system when Android needs accessibility info + * for a given view. + * + * When a {@code virtualViewId} of {@link View#NO_ID} is requested, accessibility node info is + * returned for our {@link #rootAccessibilityView}. Otherwise, Flutter's semantics tree, + * represented by {@link #flutterSemanticsTree}, is searched for a {@link SemanticsNode} with + * the given {@code virtualViewId}. If no such {@link SemanticsNode} is found, then this method + * returns null. If the desired {@link SemanticsNode} is found, then an {@link AccessibilityNodeInfo} + * is obtained from the {@link #rootAccessibilityView}, filled with appropriate info, and then + * returned. + * + * Depending on the type of Flutter {@code SemanticsNode} that is requested, the returned + * {@link AccessibilityNodeInfo} pretends that the {@code SemanticsNode} in question comes from + * a specialize Android view, e.g., {@link Flag#IS_TEXT_FIELD} maps to {@code android.widget.EditText}, + * {@link Flag#IS_BUTTON} maps to {@code android.widget.Button}, and {@link Flag#IS_IMAGE} maps + * to {@code android.widget.ImageView}. In the case that no specialized view applies, the + * returned {@link AccessibilityNodeInfo} pretends that it represents a {@code android.view.View}. + */ @Override @SuppressWarnings("deprecation") public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { if (virtualViewId == View.NO_ID) { - AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(owner); - owner.onInitializeAccessibilityNodeInfo(result); - if (objects.containsKey(ROOT_NODE_ID)) { - result.addChild(owner, ROOT_NODE_ID); + AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(rootAccessibilityView); + rootAccessibilityView.onInitializeAccessibilityNodeInfo(result); + // TODO(mattcarroll): what does it mean for the semantics tree to contain or not contain + // the root node ID? + if (flutterSemanticsTree.containsKey(ROOT_NODE_ID)) { + result.addChild(rootAccessibilityView, ROOT_NODE_ID); } return result; } - SemanticsObject object = objects.get(virtualViewId); - if (object == null) { + SemanticsNode semanticsNode = flutterSemanticsTree.get(virtualViewId); + if (semanticsNode == null) { return null; } - AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(owner, virtualViewId); + AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(rootAccessibilityView, virtualViewId); // Work around for https://github.com/flutter/flutter/issues/2101 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { result.setViewIdResourceName(""); } - result.setPackageName(owner.getContext().getPackageName()); + result.setPackageName(rootAccessibilityView.getContext().getPackageName()); result.setClassName("android.view.View"); - result.setSource(owner, virtualViewId); - result.setFocusable(object.isFocusable()); - if (inputFocusedObject != null) { - result.setFocused(inputFocusedObject.id == virtualViewId); + result.setSource(rootAccessibilityView, virtualViewId); + result.setFocusable(semanticsNode.isFocusable()); + if (inputFocusedSemanticsNode != null) { + result.setFocused(inputFocusedSemanticsNode.id == virtualViewId); } - if (a11yFocusedObject != null) { - result.setAccessibilityFocused(a11yFocusedObject.id == virtualViewId); + if (accessibilityFocusedSemanticsNode != null) { + result.setAccessibilityFocused(accessibilityFocusedSemanticsNode.id == virtualViewId); } - if (object.hasFlag(Flag.IS_TEXT_FIELD)) { - result.setPassword(object.hasFlag(Flag.IS_OBSCURED)); + if (semanticsNode.hasFlag(Flag.IS_TEXT_FIELD)) { + result.setPassword(semanticsNode.hasFlag(Flag.IS_OBSCURED)); result.setClassName("android.widget.EditText"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { result.setEditable(true); - if (object.textSelectionBase != -1 && object.textSelectionExtent != -1) { - result.setTextSelection(object.textSelectionBase, object.textSelectionExtent); + if (semanticsNode.textSelectionBase != -1 && semanticsNode.textSelectionExtent != -1) { + result.setTextSelection(semanticsNode.textSelectionBase, semanticsNode.textSelectionExtent); } // 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 && a11yFocusedObject != null && a11yFocusedObject.id == virtualViewId) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 && accessibilityFocusedSemanticsNode != null && accessibilityFocusedSemanticsNode.id == virtualViewId) { result.setLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); } } // Cursor movements int granularities = 0; - if (object.hasAction(Action.MOVE_CURSOR_FORWARD_BY_CHARACTER)) { + if (semanticsNode.hasAction(Action.MOVE_CURSOR_FORWARD_BY_CHARACTER)) { result.addAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY); granularities |= AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER; } - if (object.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER)) { + if (semanticsNode.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER)) { result.addAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY); granularities |= AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER; } - if (object.hasAction(Action.MOVE_CURSOR_FORWARD_BY_WORD)) { + if (semanticsNode.hasAction(Action.MOVE_CURSOR_FORWARD_BY_WORD)) { result.addAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY); granularities |= AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD; } - if (object.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_WORD)) { + if (semanticsNode.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_WORD)) { result.addAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY); granularities |= AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD; } @@ -242,44 +506,44 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { // These are non-ops on older devices. Attempting to interact with the text will cause Talkback to read the // contents of the text box instead. if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) { - if (object.hasAction(Action.SET_SELECTION)) { + if (semanticsNode.hasAction(Action.SET_SELECTION)) { result.addAction(AccessibilityNodeInfo.ACTION_SET_SELECTION); } - if (object.hasAction(Action.COPY)) { + if (semanticsNode.hasAction(Action.COPY)) { result.addAction(AccessibilityNodeInfo.ACTION_COPY); } - if (object.hasAction(Action.CUT)) { + if (semanticsNode.hasAction(Action.CUT)) { result.addAction(AccessibilityNodeInfo.ACTION_CUT); } - if (object.hasAction(Action.PASTE)) { + if (semanticsNode.hasAction(Action.PASTE)) { result.addAction(AccessibilityNodeInfo.ACTION_PASTE); } } - if (object.hasFlag(Flag.IS_BUTTON)) { + if (semanticsNode.hasFlag(Flag.IS_BUTTON)) { result.setClassName("android.widget.Button"); } - if (object.hasFlag(Flag.IS_IMAGE)) { + if (semanticsNode.hasFlag(Flag.IS_IMAGE)) { result.setClassName("android.widget.ImageView"); // TODO(jonahwilliams): Figure out a way conform to the expected id from TalkBack's // CustomLabelManager. talkback/src/main/java/labeling/CustomLabelManager.java#L525 } - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 && object.hasAction(Action.DISMISS)) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 && semanticsNode.hasAction(Action.DISMISS)) { result.setDismissable(true); result.addAction(AccessibilityNodeInfo.ACTION_DISMISS); } - if (object.parent != null) { - assert object.id > ROOT_NODE_ID; - result.setParent(owner, object.parent.id); + if (semanticsNode.parent != null) { + assert semanticsNode.id > ROOT_NODE_ID; + result.setParent(rootAccessibilityView, semanticsNode.parent.id); } else { - assert object.id == ROOT_NODE_ID; - result.setParent(owner); + assert semanticsNode.id == ROOT_NODE_ID; + result.setParent(rootAccessibilityView); } - Rect bounds = object.getGlobalRect(); - if (object.parent != null) { - Rect parentBounds = object.parent.getGlobalRect(); + Rect bounds = semanticsNode.getGlobalRect(); + if (semanticsNode.parent != null) { + Rect parentBounds = semanticsNode.parent.getGlobalRect(); Rect boundsInParent = new Rect(bounds); boundsInParent.offset(-parentBounds.left, -parentBounds.top); result.setBoundsInParent(boundsInParent); @@ -289,30 +553,35 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { result.setBoundsInScreen(bounds); result.setVisibleToUser(true); result.setEnabled( - !object.hasFlag(Flag.HAS_ENABLED_STATE) || object.hasFlag(Flag.IS_ENABLED)); + !semanticsNode.hasFlag(Flag.HAS_ENABLED_STATE) || semanticsNode.hasFlag(Flag.IS_ENABLED) + ); - if (object.hasAction(Action.TAP)) { - if (Build.VERSION.SDK_INT >= 21 && object.onTapOverride != null) { + if (semanticsNode.hasAction(Action.TAP)) { + if (Build.VERSION.SDK_INT >= 21 && semanticsNode.onTapOverride != null) { result.addAction(new AccessibilityNodeInfo.AccessibilityAction( - AccessibilityNodeInfo.ACTION_CLICK, object.onTapOverride.hint)); + AccessibilityNodeInfo.ACTION_CLICK, + semanticsNode.onTapOverride.hint + )); result.setClickable(true); } else { result.addAction(AccessibilityNodeInfo.ACTION_CLICK); result.setClickable(true); } } - if (object.hasAction(Action.LONG_PRESS)) { - if (Build.VERSION.SDK_INT >= 21 && object.onLongPressOverride != null) { - result.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_LONG_CLICK, - object.onLongPressOverride.hint)); + if (semanticsNode.hasAction(Action.LONG_PRESS)) { + if (Build.VERSION.SDK_INT >= 21 && semanticsNode.onLongPressOverride != null) { + result.addAction(new AccessibilityNodeInfo.AccessibilityAction( + AccessibilityNodeInfo.ACTION_LONG_CLICK, + semanticsNode.onLongPressOverride.hint + )); result.setLongClickable(true); } else { result.addAction(AccessibilityNodeInfo.ACTION_LONG_CLICK); result.setLongClickable(true); } } - if (object.hasAction(Action.SCROLL_LEFT) || object.hasAction(Action.SCROLL_UP) - || object.hasAction(Action.SCROLL_RIGHT) || object.hasAction(Action.SCROLL_DOWN)) { + if (semanticsNode.hasAction(Action.SCROLL_LEFT) || semanticsNode.hasAction(Action.SCROLL_UP) + || semanticsNode.hasAction(Action.SCROLL_RIGHT) || semanticsNode.hasAction(Action.SCROLL_DOWN)) { result.setScrollable(true); // This tells Android's a11y to send scroll events when reaching the end of @@ -327,22 +596,24 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { // // TODO(dnfield): We should add semantics properties for rows and columns in 2 dimensional lists, e.g. // GridView. Right now, we're only supporting ListViews and only if they have scroll children. - if (object.hasFlag(Flag.HAS_IMPLICIT_SCROLLING)) { - if (object.hasAction(Action.SCROLL_LEFT) || object.hasAction(Action.SCROLL_RIGHT)) { - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT && shouldSetCollectionInfo(object)) { + if (semanticsNode.hasFlag(Flag.HAS_IMPLICIT_SCROLLING)) { + if (semanticsNode.hasAction(Action.SCROLL_LEFT) || semanticsNode.hasAction(Action.SCROLL_RIGHT)) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT && shouldSetCollectionInfo(semanticsNode)) { result.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain( 0, // rows - object.scrollChildren, // columns - false)); // hierarchical + semanticsNode.scrollChildren, // columns + false // hierarchical + )); } else { result.setClassName("android.widget.HorizontalScrollView"); } } else { - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 && shouldSetCollectionInfo(object)) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 && shouldSetCollectionInfo(semanticsNode)) { result.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain( - object.scrollChildren, // rows + semanticsNode.scrollChildren, // rows 0, // columns - false)); // hierarchical + false // hierarchical + )); } else { result.setClassName("android.widget.ScrollView"); } @@ -351,53 +622,54 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { // TODO(ianh): Once we're on SDK v23+, call addAction to // expose AccessibilityAction.ACTION_SCROLL_LEFT, _RIGHT, // _UP, and _DOWN when appropriate. - if (object.hasAction(Action.SCROLL_LEFT) || object.hasAction(Action.SCROLL_UP)) { + if (semanticsNode.hasAction(Action.SCROLL_LEFT) || semanticsNode.hasAction(Action.SCROLL_UP)) { result.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); } - if (object.hasAction(Action.SCROLL_RIGHT) || object.hasAction(Action.SCROLL_DOWN)) { + if (semanticsNode.hasAction(Action.SCROLL_RIGHT) || semanticsNode.hasAction(Action.SCROLL_DOWN)) { result.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } } - if (object.hasAction(Action.INCREASE) || object.hasAction(Action.DECREASE)) { + if (semanticsNode.hasAction(Action.INCREASE) || semanticsNode.hasAction(Action.DECREASE)) { // TODO(jonahwilliams): support AccessibilityAction.ACTION_SET_PROGRESS once SDK is // updated. result.setClassName("android.widget.SeekBar"); - if (object.hasAction(Action.INCREASE)) { + if (semanticsNode.hasAction(Action.INCREASE)) { result.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); } - if (object.hasAction(Action.DECREASE)) { + if (semanticsNode.hasAction(Action.DECREASE)) { result.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } } - if (object.hasFlag(Flag.IS_LIVE_REGION) && Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) { + if (semanticsNode.hasFlag(Flag.IS_LIVE_REGION) && Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) { result.setLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); } - boolean hasCheckedState = object.hasFlag(Flag.HAS_CHECKED_STATE); - boolean hasToggledState = object.hasFlag(Flag.HAS_TOGGLED_STATE); + boolean hasCheckedState = semanticsNode.hasFlag(Flag.HAS_CHECKED_STATE); + boolean hasToggledState = semanticsNode.hasFlag(Flag.HAS_TOGGLED_STATE); assert !(hasCheckedState && hasToggledState); result.setCheckable(hasCheckedState || hasToggledState); if (hasCheckedState) { - result.setChecked(object.hasFlag(Flag.IS_CHECKED)); - result.setContentDescription(object.getValueLabelHint()); - if (object.hasFlag(Flag.IS_IN_MUTUALLY_EXCLUSIVE_GROUP)) + result.setChecked(semanticsNode.hasFlag(Flag.IS_CHECKED)); + result.setContentDescription(semanticsNode.getValueLabelHint()); + if (semanticsNode.hasFlag(Flag.IS_IN_MUTUALLY_EXCLUSIVE_GROUP)) { result.setClassName("android.widget.RadioButton"); - else + } else { result.setClassName("android.widget.CheckBox"); + } } else if (hasToggledState) { - result.setChecked(object.hasFlag(Flag.IS_TOGGLED)); + result.setChecked(semanticsNode.hasFlag(Flag.IS_TOGGLED)); result.setClassName("android.widget.Switch"); - result.setContentDescription(object.getValueLabelHint()); + result.setContentDescription(semanticsNode.getValueLabelHint()); } else { // Setting the text directly instead of the content description // will replace the "checked" or "not-checked" label. - result.setText(object.getValueLabelHint()); + result.setText(semanticsNode.getValueLabelHint()); } - result.setSelected(object.hasFlag(Flag.IS_SELECTED)); + result.setSelected(semanticsNode.hasFlag(Flag.IS_SELECTED)); // Accessibility Focus - if (a11yFocusedObject != null && a11yFocusedObject.id == virtualViewId) { + if (accessibilityFocusedSemanticsNode != null && accessibilityFocusedSemanticsNode.id == virtualViewId) { result.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } else { result.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); @@ -405,18 +677,20 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { // Actions on the local context menu if (Build.VERSION.SDK_INT >= 21) { - if (object.customAccessibilityActions != null) { - for (CustomAccessibilityAction action : object.customAccessibilityActions) { + if (semanticsNode.customAccessibilityActions != null) { + for (CustomAccessibilityAction action : semanticsNode.customAccessibilityActions) { result.addAction(new AccessibilityNodeInfo.AccessibilityAction( - action.resourceId, action.label)); + action.resourceId, + action.label + )); } } } - if (object.childrenInTraversalOrder != null) { - for (SemanticsObject child : object.childrenInTraversalOrder) { + if (semanticsNode.childrenInTraversalOrder != null) { + for (SemanticsNode child : semanticsNode.childrenInTraversalOrder) { if (!child.hasFlag(Flag.IS_HIDDEN)) { - result.addChild(owner, child.id); + result.addChild(rootAccessibilityView, child.id); } } } @@ -424,54 +698,68 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { return result; } + /** + * Instructs the view represented by {@code virtualViewId} to carry out the desired {@code accessibilityAction}, + * perhaps configured by additional {@code arguments}. + * + * This method is invoked by Android's accessibility system. This method returns true if the + * desired {@code SemanticsNode} was found and was capable of performing the desired action, + * false otherwise. + * + * In a traditional Android app, the given view ID refers to a {@link View} within an Android + * {@link View} hierarchy. Flutter does not have an Android {@link View} hierarchy, therefore + * the given view ID is a {@code virtualViewId} that refers to a {@code SemanticsNode} within + * a Flutter app. The given arguments of this method are forwarded from Android to Flutter + * via {@link FlutterJNI}. + */ @Override - public boolean performAction(int virtualViewId, int action, Bundle arguments) { - SemanticsObject object = objects.get(virtualViewId); - if (object == null) { + public boolean performAction(int virtualViewId, int accessibilityAction, @Nullable Bundle arguments) { + SemanticsNode semanticsNode = flutterSemanticsTree.get(virtualViewId); + if (semanticsNode == null) { return false; } - switch (action) { + switch (accessibilityAction) { case AccessibilityNodeInfo.ACTION_CLICK: { // Note: TalkBack prior to Oreo doesn't use this handler and instead simulates a // click event at the center of the SemanticsNode. Other a11y services might go // through this handler though. - owner.dispatchSemanticsAction(virtualViewId, Action.TAP); + flutterJNI.dispatchSemanticsAction(virtualViewId, Action.TAP); return true; } case AccessibilityNodeInfo.ACTION_LONG_CLICK: { // Note: TalkBack doesn't use this handler and instead simulates a long click event // at the center of the SemanticsNode. Other a11y services might go through this // handler though. - owner.dispatchSemanticsAction(virtualViewId, Action.LONG_PRESS); + flutterJNI.dispatchSemanticsAction(virtualViewId, Action.LONG_PRESS); return true; } case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: { - if (object.hasAction(Action.SCROLL_UP)) { - owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_UP); - } else if (object.hasAction(Action.SCROLL_LEFT)) { + if (semanticsNode.hasAction(Action.SCROLL_UP)) { + flutterJNI.dispatchSemanticsAction(virtualViewId, Action.SCROLL_UP); + } else if (semanticsNode.hasAction(Action.SCROLL_LEFT)) { // TODO(ianh): bidi support using textDirection - owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_LEFT); - } else if (object.hasAction(Action.INCREASE)) { - object.value = object.increasedValue; + flutterJNI.dispatchSemanticsAction(virtualViewId, Action.SCROLL_LEFT); + } else if (semanticsNode.hasAction(Action.INCREASE)) { + semanticsNode.value = semanticsNode.increasedValue; // Event causes Android to read out the updated value. sendAccessibilityEvent(virtualViewId, AccessibilityEvent.TYPE_VIEW_SELECTED); - owner.dispatchSemanticsAction(virtualViewId, Action.INCREASE); + flutterJNI.dispatchSemanticsAction(virtualViewId, Action.INCREASE); } else { return false; } return true; } case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: { - if (object.hasAction(Action.SCROLL_DOWN)) { - owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_DOWN); - } else if (object.hasAction(Action.SCROLL_RIGHT)) { + if (semanticsNode.hasAction(Action.SCROLL_DOWN)) { + flutterJNI.dispatchSemanticsAction(virtualViewId, Action.SCROLL_DOWN); + } else if (semanticsNode.hasAction(Action.SCROLL_RIGHT)) { // TODO(ianh): bidi support using textDirection - owner.dispatchSemanticsAction(virtualViewId, Action.SCROLL_RIGHT); - } else if (object.hasAction(Action.DECREASE)) { - object.value = object.decreasedValue; + flutterJNI.dispatchSemanticsAction(virtualViewId, Action.SCROLL_RIGHT); + } else if (semanticsNode.hasAction(Action.DECREASE)) { + semanticsNode.value = semanticsNode.decreasedValue; // Event causes Android to read out the updated value. sendAccessibilityEvent(virtualViewId, AccessibilityEvent.TYPE_VIEW_SELECTED); - owner.dispatchSemanticsAction(virtualViewId, Action.DECREASE); + flutterJNI.dispatchSemanticsAction(virtualViewId, Action.DECREASE); } else { return false; } @@ -484,7 +772,7 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { return false; } - return performCursorMoveAction(object, virtualViewId, arguments, false); + return performCursorMoveAction(semanticsNode, virtualViewId, arguments, false); } case AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY: { // Text selection APIs aren't available until API 18. We can't handle the case here so return false @@ -493,29 +781,39 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { return false; } - return performCursorMoveAction(object, virtualViewId, arguments, true); + return performCursorMoveAction(semanticsNode, virtualViewId, arguments, true); } case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: { - owner.dispatchSemanticsAction(virtualViewId, Action.DID_LOSE_ACCESSIBILITY_FOCUS); + flutterJNI.dispatchSemanticsAction( + virtualViewId, + Action.DID_LOSE_ACCESSIBILITY_FOCUS + ); sendAccessibilityEvent( - virtualViewId, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - a11yFocusedObject = null; + virtualViewId, + AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED + ); + accessibilityFocusedSemanticsNode = null; return true; } case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: { - owner.dispatchSemanticsAction(virtualViewId, Action.DID_GAIN_ACCESSIBILITY_FOCUS); + flutterJNI.dispatchSemanticsAction( + virtualViewId, + Action.DID_GAIN_ACCESSIBILITY_FOCUS + ); sendAccessibilityEvent( - virtualViewId, AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED); + virtualViewId, + AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED + ); - if (a11yFocusedObject == null) { + if (accessibilityFocusedSemanticsNode == null) { // When Android focuses a node, it doesn't invalidate the view. // (It does when it sends ACTION_CLEAR_ACCESSIBILITY_FOCUS, so // we only have to worry about this when the focused node is null.) - owner.invalidate(); + rootAccessibilityView.invalidate(); } - a11yFocusedObject = object; + accessibilityFocusedSemanticsNode = semanticsNode; - if (object.hasAction(Action.INCREASE) || object.hasAction(Action.DECREASE)) { + if (semanticsNode.hasAction(Action.INCREASE) || semanticsNode.hasAction(Action.DECREASE)) { // SeekBars only announce themselves after this event. sendAccessibilityEvent(virtualViewId, AccessibilityEvent.TYPE_VIEW_SELECTED); } @@ -523,7 +821,7 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { return true; } case ACTION_SHOW_ON_SCREEN: { - owner.dispatchSemanticsAction(virtualViewId, Action.SHOW_ON_SCREEN); + flutterJNI.dispatchSemanticsAction(virtualViewId, Action.SHOW_ON_SCREEN); return true; } case AccessibilityNodeInfo.ACTION_SET_SELECTION: { @@ -535,86 +833,110 @@ public boolean performAction(int virtualViewId, int action, Bundle arguments) { } final Map selection = new HashMap<>(); final boolean hasSelection = arguments != null - && arguments.containsKey( - AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT) - && arguments.containsKey( - AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT); + && arguments.containsKey(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT) + && arguments.containsKey(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT); if (hasSelection) { - selection.put("base", - arguments.getInt( - AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT)); - selection.put("extent", - arguments.getInt( - AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT)); + selection.put( + "base", + arguments.getInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT) + ); + selection.put( + "extent", + arguments.getInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT) + ); } else { // Clear the selection - selection.put("base", object.textSelectionExtent); - selection.put("extent", object.textSelectionExtent); + selection.put("base", semanticsNode.textSelectionExtent); + selection.put("extent", semanticsNode.textSelectionExtent); } - owner.dispatchSemanticsAction(virtualViewId, Action.SET_SELECTION, selection); + flutterJNI.dispatchSemanticsAction(virtualViewId, Action.SET_SELECTION, selection); return true; } case AccessibilityNodeInfo.ACTION_COPY: { - owner.dispatchSemanticsAction(virtualViewId, Action.COPY); + flutterJNI.dispatchSemanticsAction(virtualViewId, Action.COPY); return true; } case AccessibilityNodeInfo.ACTION_CUT: { - owner.dispatchSemanticsAction(virtualViewId, Action.CUT); + flutterJNI.dispatchSemanticsAction(virtualViewId, Action.CUT); return true; } case AccessibilityNodeInfo.ACTION_PASTE: { - owner.dispatchSemanticsAction(virtualViewId, Action.PASTE); + flutterJNI.dispatchSemanticsAction(virtualViewId, Action.PASTE); return true; } case AccessibilityNodeInfo.ACTION_DISMISS: { - owner.dispatchSemanticsAction(virtualViewId, Action.DISMISS); + flutterJNI.dispatchSemanticsAction(virtualViewId, Action.DISMISS); return true; } default: - // might be a custom accessibility action. - final int flutterId = action - firstResourceId; - CustomAccessibilityAction contextAction = - customAccessibilityActions.get(flutterId); + // might be a custom accessibility accessibilityAction. + final int flutterId = accessibilityAction - FIRST_RESOURCE_ID; + CustomAccessibilityAction contextAction = customAccessibilityActions.get(flutterId); if (contextAction != null) { - owner.dispatchSemanticsAction( - virtualViewId, Action.CUSTOM_ACTION, contextAction.id); + flutterJNI.dispatchSemanticsAction( + virtualViewId, + Action.CUSTOM_ACTION, + contextAction.id + ); return true; } } return false; } - @RequiresApi(18) + /** + * Handles the responsibilities of {@link #performAction(int, int, Bundle)} for the specific + * scenario of cursor movement. + */ @TargetApi(18) - boolean performCursorMoveAction( - SemanticsObject object, int virtualViewId, Bundle arguments, boolean forward) { - final int granularity = - arguments.getInt(AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT); + @RequiresApi(18) + private boolean performCursorMoveAction( + @NonNull SemanticsNode semanticsNode, + int virtualViewId, + @NonNull Bundle arguments, + boolean forward + ) { + final int granularity = arguments.getInt( + AccessibilityNodeInfo.ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT + ); final boolean extendSelection = arguments.getBoolean( - AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN); + AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN + ); switch (granularity) { case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER: { - if (forward && object.hasAction(Action.MOVE_CURSOR_FORWARD_BY_CHARACTER)) { - owner.dispatchSemanticsAction(virtualViewId, - Action.MOVE_CURSOR_FORWARD_BY_CHARACTER, extendSelection); + if (forward && semanticsNode.hasAction(Action.MOVE_CURSOR_FORWARD_BY_CHARACTER)) { + flutterJNI.dispatchSemanticsAction( + virtualViewId, + Action.MOVE_CURSOR_FORWARD_BY_CHARACTER, + extendSelection + ); return true; } - if (!forward && object.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER)) { - owner.dispatchSemanticsAction(virtualViewId, - Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER, extendSelection); + if (!forward && semanticsNode.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER)) { + flutterJNI.dispatchSemanticsAction( + virtualViewId, + Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER, + extendSelection + ); return true; } break; } case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD: - if (forward && object.hasAction(Action.MOVE_CURSOR_FORWARD_BY_WORD)) { - owner.dispatchSemanticsAction(virtualViewId, - Action.MOVE_CURSOR_FORWARD_BY_WORD, extendSelection); + if (forward && semanticsNode.hasAction(Action.MOVE_CURSOR_FORWARD_BY_WORD)) { + flutterJNI.dispatchSemanticsAction( + virtualViewId, + Action.MOVE_CURSOR_FORWARD_BY_WORD, + extendSelection + ); return true; } - if (!forward && object.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_WORD)) { - owner.dispatchSemanticsAction(virtualViewId, - Action.MOVE_CURSOR_BACKWARD_BY_WORD, extendSelection); + if (!forward && semanticsNode.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_WORD)) { + flutterJNI.dispatchSemanticsAction( + virtualViewId, + Action.MOVE_CURSOR_BACKWARD_BY_WORD, + extendSelection + ); return true; } break; @@ -624,76 +946,164 @@ boolean performCursorMoveAction( // TODO(ianh): implement findAccessibilityNodeInfosByText() + /** + * Finds the view in a hierarchy that currently has the given type of {@code focus}. + * + * This method is invoked by Android's accessibility system. + * + * Flutter does not have an Android {@link View} hierarchy. Therefore, Flutter conceptually + * handles this request by searching its semantics tree for the given {@code focus}, represented + * by {@link #flutterSemanticsTree}. In practice, this {@code AccessibilityBridge} always + * caches any active {@link #accessibilityFocusedSemanticsNode} and {@link #inputFocusedSemanticsNode}. + * Therefore, no searching is necessary. This method directly inspects the given {@code focus} + * type to return one of the cached nodes, null if the cached node is null, or null if a different + * {@code focus} type is requested. + */ @Override public AccessibilityNodeInfo findFocus(int focus) { switch (focus) { case AccessibilityNodeInfo.FOCUS_INPUT: { - if (inputFocusedObject != null) - return createAccessibilityNodeInfo(inputFocusedObject.id); + if (inputFocusedSemanticsNode != null) { + return createAccessibilityNodeInfo(inputFocusedSemanticsNode.id); + } } // Fall through to check FOCUS_ACCESSIBILITY case AccessibilityNodeInfo.FOCUS_ACCESSIBILITY: { - if (a11yFocusedObject != null) - return createAccessibilityNodeInfo(a11yFocusedObject.id); + if (accessibilityFocusedSemanticsNode != null) { + return createAccessibilityNodeInfo(accessibilityFocusedSemanticsNode.id); + } } } return null; } - private SemanticsObject getRootObject() { - assert objects.containsKey(0); - return objects.get(0); + /** + * Returns the {@link SemanticsNode} at the root of Flutter's semantics tree. + */ + private SemanticsNode getRootSemanticsNode() { + assert flutterSemanticsTree.containsKey(0); + return flutterSemanticsTree.get(0); } - private SemanticsObject getOrCreateObject(int id) { - SemanticsObject object = objects.get(id); - if (object == null) { - object = new SemanticsObject(); - object.id = id; - objects.put(id, object); - } - return object; + /** + * Returns an existing {@link SemanticsNode} with the given {@code id}, if it exists within + * {@link #flutterSemanticsTree}, or creates and returns a new {@link SemanticsNode} with the + * given {@code id}, adding the new {@link SemanticsNode} to the {@link #flutterSemanticsTree}. + * + * This method should only be invoked as a result of receiving new information from Flutter. + * The {@link #flutterSemanticsTree} is an Android cache of the last known state of a Flutter + * app's semantics tree, therefore, invoking this method in any other situation will result in + * a corrupt cache of Flutter's semantics tree. + */ + private SemanticsNode getOrCreateSemanticsNode(int id) { + SemanticsNode semanticsNode = flutterSemanticsTree.get(id); + if (semanticsNode == null) { + semanticsNode = new SemanticsNode(this); + semanticsNode.id = id; + flutterSemanticsTree.put(id, semanticsNode); + } + return semanticsNode; } - private CustomAccessibilityAction getOrCreateAction(int id) { + /** + * Returns an existing {@link CustomAccessibilityAction} with the given {@code id}, if it exists + * within {@link #customAccessibilityActions}, or creates and returns a new {@link CustomAccessibilityAction} + * with the given {@code id}, adding the new {@link CustomAccessibilityAction} to the + * {@link #customAccessibilityActions}. + * + * This method should only be invoked as a result of receiving new information from Flutter. + * The {@link #customAccessibilityActions} is an Android cache of the last known state of a Flutter + * app's registered custom accessibility actions, therefore, invoking this method in any other + * situation will result in a corrupt cache of Flutter's accessibility actions. + */ + private CustomAccessibilityAction getOrCreateAccessibilityAction(int id) { CustomAccessibilityAction action = customAccessibilityActions.get(id); if (action == null) { action = new CustomAccessibilityAction(); action.id = id; - action.resourceId = id + firstResourceId; + action.resourceId = id + FIRST_RESOURCE_ID; customAccessibilityActions.put(id, action); } return action; } - void handleTouchExplorationExit() { + /** + * A hover {@link MotionEvent} has occurred in the {@code View} that corresponds to this + * {@code AccessibilityBridge}. + * + * This method returns true if Flutter's accessibility system handled the hover event, false + * otherwise. + * + * This method should be invoked from the corresponding {@code View}'s + * {@link View#onHoverEvent(MotionEvent)}. + */ + public boolean onAccessibilityHoverEvent(MotionEvent event) { + if (!accessibilityManager.isTouchExplorationEnabled()) { + return false; + } + + if (event.getAction() == MotionEvent.ACTION_HOVER_ENTER || event.getAction() == MotionEvent.ACTION_HOVER_MOVE) { + handleTouchExploration(event.getX(), event.getY()); + } else if (event.getAction() == MotionEvent.ACTION_HOVER_EXIT) { + onTouchExplorationExit(); + } else { + Log.d("flutter", "unexpected accessibility hover event: " + event); + return false; + } + return true; + } + + /** + * This method should be invoked when a hover interaction has the cursor move off of a + * {@code SemanticsNode}. + * + * This method informs the Android accessibility system that a {@link AccessibilityEvent#TYPE_VIEW_HOVER_EXIT} + * has occurred. + */ + private void onTouchExplorationExit() { if (hoveredObject != null) { sendAccessibilityEvent(hoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); hoveredObject = null; } } - void handleTouchExploration(float x, float y) { - if (objects.isEmpty()) { + /** + * This method should be invoked when a new hover interaction begins with a {@code SemanticsNode}, + * or when an existing hover interaction sees a movement of the cursor. + * + * This method checks to see if the cursor has moved from one {@code SemanticsNode} to another. + * If it has, this method informs the Android accessibility system of the change by first sending + * a {@link AccessibilityEvent#TYPE_VIEW_HOVER_ENTER} event for the new hover node, followed by + * a {@link AccessibilityEvent#TYPE_VIEW_HOVER_EXIT} event for the old hover node. + */ + private void handleTouchExploration(float x, float y) { + if (flutterSemanticsTree.isEmpty()) { return; } - SemanticsObject newObject = getRootObject().hitTest(new float[] {x, y, 0, 1}); - if (newObject != hoveredObject) { + SemanticsNode semanticsNodeUnderCursor = getRootSemanticsNode().hitTest(new float[] {x, y, 0, 1}); + if (semanticsNodeUnderCursor != hoveredObject) { // sending ENTER before EXIT is how Android wants it - if (newObject != null) { - sendAccessibilityEvent(newObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_ENTER); + if (semanticsNodeUnderCursor != null) { + sendAccessibilityEvent(semanticsNodeUnderCursor.id, AccessibilityEvent.TYPE_VIEW_HOVER_ENTER); } if (hoveredObject != null) { sendAccessibilityEvent(hoveredObject.id, AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); } - hoveredObject = newObject; + hoveredObject = semanticsNodeUnderCursor; } } - void updateCustomAccessibilityActions(ByteBuffer buffer, String[] strings) { + /** + * Updates the Android cache of Flutter's currently registered custom accessibility actions. + */ + // TODO(mattcarroll): Consider introducing ability to delete custom actions because they can + // probably come and go in Flutter, so we may want to reflect that here in + // the Android cache as well. + // TODO(mattcarroll): where is the encoding code for reference? + void updateCustomAccessibilityActions(@NonNull ByteBuffer buffer, @NonNull String[] strings) { while (buffer.hasRemaining()) { int id = buffer.getInt(); - CustomAccessibilityAction action = getOrCreateAction(id); + CustomAccessibilityAction action = getOrCreateAccessibilityAction(id); action.overrideId = buffer.getInt(); int stringIndex = buffer.getInt(); action.label = stringIndex == -1 ? null : strings[stringIndex]; @@ -702,26 +1112,32 @@ void updateCustomAccessibilityActions(ByteBuffer buffer, String[] strings) { } } - void updateSemantics(ByteBuffer buffer, String[] strings) { - ArrayList updated = new ArrayList<>(); + /** + * Updates {@link #flutterSemanticsTree} to reflect the latest state of Flutter's semantics tree. + * + * The latest state of Flutter's semantics tree is encoded in the given {@code buffer}. + */ + // TODO(mattcarroll): where is the encoding code for reference? + void updateSemantics(@NonNull ByteBuffer buffer, @NonNull String[] strings) { + ArrayList updated = new ArrayList<>(); while (buffer.hasRemaining()) { int id = buffer.getInt(); - SemanticsObject object = getOrCreateObject(id); - object.updateWith(buffer, strings); - if (object.hasFlag(Flag.IS_HIDDEN)) { + SemanticsNode semanticsNode = getOrCreateSemanticsNode(id); + semanticsNode.updateWith(buffer, strings); + if (semanticsNode.hasFlag(Flag.IS_HIDDEN)) { continue; } - if (object.hasFlag(Flag.IS_FOCUSED)) { - inputFocusedObject = object; + if (semanticsNode.hasFlag(Flag.IS_FOCUSED)) { + inputFocusedSemanticsNode = semanticsNode; } - if (object.hadPreviousConfig) { - updated.add(object); + if (semanticsNode.hadPreviousConfig) { + updated.add(semanticsNode); } } - Set visitedObjects = new HashSet<>(); - SemanticsObject rootObject = getRootObject(); - List newRoutes = new ArrayList<>(); + Set visitedObjects = new HashSet<>(); + SemanticsNode rootObject = getRootSemanticsNode(); + List newRoutes = new ArrayList<>(); if (rootObject != null) { final float[] identity = new float[16]; Matrix.setIdentityM(identity, 0); @@ -744,10 +1160,10 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { // Dispatch a TYPE_WINDOW_STATE_CHANGED event if the most recent route id changed from the // previously cached route id. - SemanticsObject lastAdded = null; - for (SemanticsObject semanticsObject : newRoutes) { - if (!previousRoutes.contains(semanticsObject.id)) { - lastAdded = semanticsObject; + SemanticsNode lastAdded = null; + for (SemanticsNode semanticsNode : newRoutes) { + if (!flutterNavigationStack.contains(semanticsNode.id)) { + lastAdded = semanticsNode; } } if (lastAdded == null && newRoutes.size() > 0) { @@ -755,19 +1171,19 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { } if (lastAdded != null && lastAdded.id != previousRouteId) { previousRouteId = lastAdded.id; - createWindowChangeEvent(lastAdded); + createAndSendWindowChangeEvent(lastAdded); } - previousRoutes.clear(); - for (SemanticsObject semanticsObject : newRoutes) { - previousRoutes.add(semanticsObject.id); + flutterNavigationStack.clear(); + for (SemanticsNode semanticsNode : newRoutes) { + flutterNavigationStack.add(semanticsNode.id); } - Iterator> it = objects.entrySet().iterator(); + Iterator> it = flutterSemanticsTree.entrySet().iterator(); while (it.hasNext()) { - Map.Entry entry = it.next(); - SemanticsObject object = entry.getValue(); + Map.Entry entry = it.next(); + SemanticsNode object = entry.getValue(); if (!visitedObjects.contains(object)) { - willRemoveSemanticsObject(object); + willRemoveSemanticsNode(object); it.remove(); } } @@ -776,7 +1192,7 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { // see https://github.com/flutter/flutter/issues/14534 sendAccessibilityEvent(0, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); - for (SemanticsObject object : updated) { + for (SemanticsNode object : updated) { if (object.didScroll()) { AccessibilityEvent event = obtainAccessibilityEvent(object.id, AccessibilityEvent.TYPE_VIEW_SCROLLED); @@ -816,7 +1232,7 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { event.setFromIndex(object.scrollIndex); int visibleChildren = 0; // handle hidden children at the beginning and end of the list. - for (SemanticsObject child : object.childrenInHitTestOrder) { + for (SemanticsNode child : object.childrenInHitTestOrder) { if (!child.hasFlag(Flag.IS_HIDDEN)) { visibleChildren += 1; } @@ -842,25 +1258,25 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } } else if (object.hasFlag(Flag.IS_TEXT_FIELD) && object.didChangeLabel() - && inputFocusedObject != null && inputFocusedObject.id == object.id) { + && inputFocusedSemanticsNode != null && inputFocusedSemanticsNode.id == object.id) { // Text fields should announce when their label changes while focused. We use a live // region tag to do so, and this event triggers that update. sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } - if (a11yFocusedObject != null && a11yFocusedObject.id == object.id + if (accessibilityFocusedSemanticsNode != null && accessibilityFocusedSemanticsNode.id == object.id && !object.hadFlag(Flag.IS_SELECTED) && object.hasFlag(Flag.IS_SELECTED)) { AccessibilityEvent event = obtainAccessibilityEvent(object.id, AccessibilityEvent.TYPE_VIEW_SELECTED); event.getText().add(object.label); sendAccessibilityEvent(event); } - if (inputFocusedObject != null && inputFocusedObject.id == object.id + if (inputFocusedSemanticsNode != null && inputFocusedSemanticsNode.id == object.id && 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 - && (a11yFocusedObject == null || (a11yFocusedObject.id == inputFocusedObject.id))) { + && (accessibilityFocusedSemanticsNode == null || (accessibilityFocusedSemanticsNode.id == inputFocusedSemanticsNode.id))) { String oldValue = object.previousValue != null ? object.previousValue : ""; String newValue = object.value != null ? object.value : ""; AccessibilityEvent event = createTextChangedEvent(object.id, oldValue, newValue); @@ -915,67 +1331,205 @@ private AccessibilityEvent createTextChangedEvent(int id, String oldValue, Strin return e; } - private AccessibilityEvent obtainAccessibilityEvent(int virtualViewId, int eventType) { - assert virtualViewId != ROOT_NODE_ID; - AccessibilityEvent event = AccessibilityEvent.obtain(eventType); - event.setPackageName(owner.getContext().getPackageName()); - event.setSource(owner, virtualViewId); - return event; - } - - private void sendAccessibilityEvent(int virtualViewId, int eventType) { - if (!accessibilityEnabled) { + /** + * Sends an accessibility event of the given {@code eventType} to Android's accessibility + * system with the given {@code viewId} represented as the source of the event. + * + * The given {@code viewId} may either belong to {@link #rootAccessibilityView}, or any + * Flutter {@link SemanticsNode}. + */ + private void sendAccessibilityEvent(int viewId, int eventType) { + if (!accessibilityManager.isEnabled()) { return; } - if (virtualViewId == ROOT_NODE_ID) { - owner.sendAccessibilityEvent(eventType); + if (viewId == ROOT_NODE_ID) { + rootAccessibilityView.sendAccessibilityEvent(eventType); } else { - sendAccessibilityEvent(obtainAccessibilityEvent(virtualViewId, eventType)); + sendAccessibilityEvent(obtainAccessibilityEvent(viewId, eventType)); } } - private void sendAccessibilityEvent(AccessibilityEvent event) { - if (!accessibilityEnabled) { + /** + * Sends the given {@link AccessibilityEvent} to Android's accessibility system for a given + * Flutter {@link SemanticsNode}. + * + * This method should only be called for a Flutter {@link SemanticsNode}, not a traditional + * Android {@code View}, i.e., {@link #rootAccessibilityView}. + */ + private void sendAccessibilityEvent(@NonNull AccessibilityEvent event) { + if (!accessibilityManager.isEnabled()) { return; } - owner.getParent().requestSendAccessibilityEvent(owner, event); + // TODO(mattcarroll): why are we explicitly talking to the root view's parent? + rootAccessibilityView.getParent().requestSendAccessibilityEvent(rootAccessibilityView, event); } - private void createWindowChangeEvent(SemanticsObject route) { - AccessibilityEvent e = - obtainAccessibilityEvent(route.id, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); + /** + * Factory method that creates a {@link AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED} and sends + * the event to Android's accessibility system. + * + * The given {@code route} should be a {@link SemanticsNode} that represents a navigation route + * in the Flutter app. + */ + private void createAndSendWindowChangeEvent(@NonNull SemanticsNode route) { + AccessibilityEvent event = obtainAccessibilityEvent( + route.id, + AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED + ); String routeName = route.getRouteName(); - e.getText().add(routeName); - sendAccessibilityEvent(e); + event.getText().add(routeName); + sendAccessibilityEvent(event); } - private void willRemoveSemanticsObject(SemanticsObject object) { - assert objects.containsKey(object.id); - assert objects.get(object.id) == object; - object.parent = null; - if (a11yFocusedObject == object) { - sendAccessibilityEvent(a11yFocusedObject.id, - AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - a11yFocusedObject = null; - } - if (inputFocusedObject == object) { - inputFocusedObject = null; - } - if (hoveredObject == object) { + /** + * Factory method that creates a new {@link AccessibilityEvent} that is configured to represent + * the Flutter {@link SemanticsNode} represented by the given {@code virtualViewId}, categorized + * as the given {@code eventType}. + * + * This method should *only* be called for Flutter {@link SemanticsNode}s. It should *not* be + * invoked to create an {@link AccessibilityEvent} for the {@link #rootAccessibilityView}. + */ + private AccessibilityEvent obtainAccessibilityEvent(int virtualViewId, int eventType) { + assert virtualViewId != ROOT_NODE_ID; + AccessibilityEvent event = AccessibilityEvent.obtain(eventType); + event.setPackageName(rootAccessibilityView.getContext().getPackageName()); + event.setSource(rootAccessibilityView, virtualViewId); + return event; + } + + /** + * Hook called just before a {@link SemanticsNode} is removed from the Android cache of Flutter's + * semantics tree. + */ + private void willRemoveSemanticsNode(SemanticsNode semanticsNodeToBeRemoved) { + assert flutterSemanticsTree.containsKey(semanticsNodeToBeRemoved.id); + assert flutterSemanticsTree.get(semanticsNodeToBeRemoved.id) == semanticsNodeToBeRemoved; + // TODO(mattcarroll): should parent be set to "null" here? Changing the parent seems like the + // behavior of a method called "removeSemanticsNode()". The same is true + // for null'ing accessibilityFocusedSemanticsNode, inputFocusedSemanticsNode, + // and hoveredObject. Is this a hook method or a command? + semanticsNodeToBeRemoved.parent = null; + if (accessibilityFocusedSemanticsNode == semanticsNodeToBeRemoved) { + sendAccessibilityEvent( + accessibilityFocusedSemanticsNode.id, + AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED + ); + accessibilityFocusedSemanticsNode = null; + } + if (inputFocusedSemanticsNode == semanticsNodeToBeRemoved) { + inputFocusedSemanticsNode = null; + } + if (hoveredObject == semanticsNodeToBeRemoved) { hoveredObject = null; } } - void reset() { - objects.clear(); - if (a11yFocusedObject != null) - sendAccessibilityEvent(a11yFocusedObject.id, - AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED); - a11yFocusedObject = null; + /** + * Resets the {@code AccessibilityBridge}: + *
    + *
  • Clears {@link #flutterSemanticsTree}, the Android cache of Flutter's semantics tree
  • + *
  • Releases focus on any active {@link #accessibilityFocusedSemanticsNode}
  • + *
  • Clears any hovered {@code SemanticsNode}
  • + *
  • Sends a {@link AccessibilityEvent#TYPE_WINDOW_CONTENT_CHANGED} event
  • + *
+ */ + // TODO(mattcarroll): under what conditions is this method expected to be invoked? + public void reset() { + flutterSemanticsTree.clear(); + if (accessibilityFocusedSemanticsNode != null) { + sendAccessibilityEvent( + accessibilityFocusedSemanticsNode.id, + AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED + ); + } + accessibilityFocusedSemanticsNode = null; hoveredObject = null; sendAccessibilityEvent(0, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } + /** + * Listener that can be set on a {@link AccessibilityBridge}, which is invoked any time + * accessibility is turned on/off, or touch exploration is turned on/off. + */ + public interface OnAccessibilityChangeListener { + void onAccessibilityChanged(boolean isAccessibilityEnabled, boolean isTouchExplorationEnabled); + } + + // Must match SemanticsActions in semantics.dart + // https://github.com/flutter/engine/blob/master/lib/ui/semantics.dart + public enum Action { + TAP(1 << 0), + LONG_PRESS(1 << 1), + SCROLL_LEFT(1 << 2), + SCROLL_RIGHT(1 << 3), + SCROLL_UP(1 << 4), + SCROLL_DOWN(1 << 5), + INCREASE(1 << 6), + DECREASE(1 << 7), + SHOW_ON_SCREEN(1 << 8), + MOVE_CURSOR_FORWARD_BY_CHARACTER(1 << 9), + MOVE_CURSOR_BACKWARD_BY_CHARACTER(1 << 10), + SET_SELECTION(1 << 11), + COPY(1 << 12), + CUT(1 << 13), + PASTE(1 << 14), + DID_GAIN_ACCESSIBILITY_FOCUS(1 << 15), + DID_LOSE_ACCESSIBILITY_FOCUS(1 << 16), + CUSTOM_ACTION(1 << 17), + DISMISS(1 << 18), + MOVE_CURSOR_FORWARD_BY_WORD(1 << 19), + MOVE_CURSOR_BACKWARD_BY_WORD(1 << 20); + + public final int value; + + Action(int value) { + this.value = value; + } + } + + // Must match SemanticsFlag in semantics.dart + // https://github.com/flutter/engine/blob/master/lib/ui/semantics.dart + private enum Flag { + HAS_CHECKED_STATE(1 << 0), + IS_CHECKED(1 << 1), + IS_SELECTED(1 << 2), + IS_BUTTON(1 << 3), + IS_TEXT_FIELD(1 << 4), + IS_FOCUSED(1 << 5), + HAS_ENABLED_STATE(1 << 6), + IS_ENABLED(1 << 7), + IS_IN_MUTUALLY_EXCLUSIVE_GROUP(1 << 8), + IS_HEADER(1 << 9), + IS_OBSCURED(1 << 10), + SCOPES_ROUTE(1 << 11), + NAMES_ROUTE(1 << 12), + IS_HIDDEN(1 << 13), + IS_IMAGE(1 << 14), + IS_LIVE_REGION(1 << 15), + HAS_TOGGLED_STATE(1 << 16), + IS_TOGGLED(1 << 17), + HAS_IMPLICIT_SCROLLING(1 << 18); + + final int value; + + Flag(int value) { + this.value = value; + } + } + + // Must match the enum defined in window.dart. + private enum AccessibilityFeature { + ACCESSIBLE_NAVIGATION(1 << 0), + INVERT_COLORS(1 << 1), // NOT SUPPORTED + DISABLE_ANIMATIONS(1 << 2); + + final int value; + + AccessibilityFeature(int value) { + this.value = value; + } + } + private enum TextDirection { UNKNOWN, LTR, @@ -992,64 +1546,95 @@ public static TextDirection fromInt(int value) { } } - private class CustomAccessibilityAction { + /** + * Accessibility action that is defined within a given Flutter application, as opposed to the + * standard accessibility actions that are available in the Flutter framework. + * + * Flutter and Android support a number of built-in accessibility actions. However, these + * predefined actions are not always sufficient for a desired interaction. Android facilitates + * custom accessibility actions, https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.AccessibilityAction. + * Flutter supports custom accessibility actions via {@code customSemanticsActions} within + * a {@code Semantics} widget, https://docs.flutter.io/flutter/widgets/Semantics-class.html. + * + * See the Android documentation for custom accessibility actions: + * https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.AccessibilityAction + * + * See the Flutter documentation for the Semantics widget: + * https://docs.flutter.io/flutter/widgets/Semantics-class.html + */ + private static class CustomAccessibilityAction { CustomAccessibilityAction() {} - /// Resource id is the id of the custom action plus a minimum value so that the identifier - /// does not collide with existing Android accessibility actions. - int resourceId = -1; - int id = -1; - int overrideId = -1; + // The ID of the custom action plus a minimum value so that the identifier + // does not collide with existing Android accessibility actions. This ID + // represents and Android resource ID, not a Flutter ID. + private int resourceId = -1; - /// The label is the user presented value which is displayed in the local context menu. - String label; + // The Flutter ID of this custom accessibility action. See Flutter's Semantics widget for + // custom accessibility action definitions: https://docs.flutter.io/flutter/widgets/Semantics-class.html + private int id = -1; - /// The hint is the text used in overriden standard actions. - String hint; - - boolean isStandardAction() { - return overrideId != -1; - } - } - /// Value is derived from ACTION_TYPE_MASK in AccessibilityNodeInfo.java - static int firstResourceId = 267386881; + // The ID of the standard Flutter accessibility action that this {@code CustomAccessibilityAction} + // overrides with a custom {@code label} and/or {@code hint}. + private int overrideId = -1; + // The user presented value which is displayed in the local context menu. + private String label; - static boolean hasSemanticsObjectAncestor(SemanticsObject target, Predicate tester) { - return target != null && target.getAncestor(tester) != null; + // The text used in overridden standard actions. + private String hint; } - private class SemanticsObject { - SemanticsObject() {} - - int id = -1; - - int flags; - int actions; - int textSelectionBase; - int textSelectionExtent; - int scrollChildren; - int scrollIndex; - float scrollPosition; - float scrollExtentMax; - float scrollExtentMin; - String label; - String value; - String increasedValue; - String decreasedValue; - String hint; - TextDirection textDirection; - - boolean hadPreviousConfig = false; - int previousFlags; - int previousActions; - int previousTextSelectionBase; - int previousTextSelectionExtent; - float previousScrollPosition; - float previousScrollExtentMax; - float previousScrollExtentMin; - String previousValue; - String previousLabel; + /** + * Flutter {@code SemanticsNode} represented in Java/Android. + * + * Flutter maintains a semantics tree that is controlled by, but is independent of Flutter's + * element tree, i.e., widgets/elements/render objects. Flutter's semantics tree must be cached + * on the Android side so that Android can query any {@code SemanticsNode} at any time. This + * class represents a single node in the semantics tree, and it is a Java representation of the + * analogous concept within Flutter. + * + * To see how this {@code SemanticsNode}'s fields correspond to Flutter's semantics system, see + * semantics.dart: https://github.com/flutter/engine/blob/master/lib/ui/semantics.dart + */ + private static class SemanticsNode { + private static boolean nullableHasAncestor(SemanticsNode target, Predicate tester) { + return target != null && target.getAncestor(tester) != null; + } + + final AccessibilityBridge accessibilityBridge; + + // Flutter ID of this {@code SemanticsNode}. + private int id = -1; + + private int flags; + private int actions; + private int textSelectionBase; + private int textSelectionExtent; + private int scrollChildren; + private int scrollIndex; + private float scrollPosition; + private float scrollExtentMax; + private float scrollExtentMin; + private String label; + private String value; + private String increasedValue; + private String decreasedValue; + private String hint; + + // See Flutter's {@code SemanticsNode#textDirection}. + private TextDirection textDirection; + + private boolean hadPreviousConfig = false; + private int previousFlags; + private int previousActions; + private int previousTextSelectionBase; + private int previousTextSelectionExtent; + private float previousScrollPosition; + private float previousScrollExtentMax; + private float previousScrollExtentMin; + private String previousValue; + private String previousLabel; private float left; private float top; @@ -1057,12 +1642,12 @@ private class SemanticsObject { private float bottom; private float[] transform; - SemanticsObject parent; - List childrenInTraversalOrder; - List childrenInHitTestOrder; - List customAccessibilityActions; - CustomAccessibilityAction onTapOverride; - CustomAccessibilityAction onLongPressOverride; + private SemanticsNode parent; + private List childrenInTraversalOrder; + private List childrenInHitTestOrder; + private List customAccessibilityActions; + private CustomAccessibilityAction onTapOverride; + private CustomAccessibilityAction onLongPressOverride; private boolean inverseTransformDirty = true; private float[] inverseTransform; @@ -1071,8 +1656,16 @@ private class SemanticsObject { private float[] globalTransform; private Rect globalRect; - SemanticsObject getAncestor(Predicate tester) { - SemanticsObject nextAncestor = parent; + SemanticsNode(@NonNull AccessibilityBridge accessibilityBridge) { + this.accessibilityBridge = accessibilityBridge; + } + + /** + * Returns the ancestor of this {@code SemanticsNode} for which {@link Predicate#test(Object)} + * returns true, or null if no such ancestor exists. + */ + private SemanticsNode getAncestor(Predicate tester) { + SemanticsNode nextAncestor = parent; while (nextAncestor != null) { if (tester.test(nextAncestor)) { return nextAncestor; @@ -1082,51 +1675,61 @@ SemanticsObject getAncestor(Predicate tester) { return null; } - boolean hasAction(Action action) { + /** + * Returns true if the given {@code action} is supported by this {@code SemanticsNode}. + * + * This method only applies to this {@code SemanticsNode} and does not implicitly search + * its children. + */ + private boolean hasAction(@NonNull Action action) { return (actions & action.value) != 0; } - boolean hadAction(Action action) { + /** + * Returns true if the given {@code action} was supported by the immediately previous + * version of this {@code SemanticsNode}. + */ + private boolean hadAction(@NonNull Action action) { return (previousActions & action.value) != 0; } - boolean hasFlag(Flag flag) { + private boolean hasFlag(@NonNull Flag flag) { return (flags & flag.value) != 0; } - boolean hadFlag(Flag flag) { + private boolean hadFlag(@NonNull Flag flag) { assert hadPreviousConfig; return (previousFlags & flag.value) != 0; } - boolean didScroll() { + private boolean didScroll() { return !Float.isNaN(scrollPosition) && !Float.isNaN(previousScrollPosition) && previousScrollPosition != scrollPosition; } - boolean didChangeLabel() { + private boolean didChangeLabel() { if (label == null && previousLabel == null) { return false; } return label == null || previousLabel == null || !label.equals(previousLabel); } - void log(String indent, boolean recursive) { + private void log(@NonNull String indent, boolean recursive) { Log.i(TAG, - indent + "SemanticsObject id=" + id + " label=" + label + " actions=" + actions + indent + "SemanticsNode id=" + id + " label=" + label + " actions=" + actions + " flags=" + flags + "\n" + indent + " +-- textDirection=" + textDirection + "\n" + indent + " +-- rect.ltrb=(" + left + ", " + top + ", " + right + ", " + bottom + ")\n" + indent + " +-- transform=" + Arrays.toString(transform) + "\n"); if (childrenInTraversalOrder != null && recursive) { String childIndent = indent + " "; - for (SemanticsObject child : childrenInTraversalOrder) { + for (SemanticsNode child : childrenInTraversalOrder) { child.log(childIndent, recursive); } } } - void updateWith(ByteBuffer buffer, String[] strings) { + private void updateWith(@NonNull ByteBuffer buffer, @NonNull String[] strings) { hadPreviousConfig = true; previousValue = value; previousLabel = label; @@ -1190,7 +1793,7 @@ void updateWith(ByteBuffer buffer, String[] strings) { childrenInTraversalOrder.clear(); for (int i = 0; i < childCount; ++i) { - SemanticsObject child = getOrCreateObject(buffer.getInt()); + SemanticsNode child = accessibilityBridge.getOrCreateSemanticsNode(buffer.getInt()); child.parent = this; childrenInTraversalOrder.add(child); } @@ -1201,7 +1804,7 @@ void updateWith(ByteBuffer buffer, String[] strings) { childrenInHitTestOrder.clear(); for (int i = 0; i < childCount; ++i) { - SemanticsObject child = getOrCreateObject(buffer.getInt()); + SemanticsNode child = accessibilityBridge.getOrCreateSemanticsNode(buffer.getInt()); child.parent = this; childrenInHitTestOrder.add(child); } @@ -1216,7 +1819,7 @@ void updateWith(ByteBuffer buffer, String[] strings) { customAccessibilityActions.clear(); for (int i = 0; i < actionCount; i++) { - CustomAccessibilityAction action = getOrCreateAction(buffer.getInt()); + CustomAccessibilityAction action = accessibilityBridge.getOrCreateAccessibilityAction(buffer.getInt()); if (action.overrideId == Action.TAP.value) { onTapOverride = action; } else if (action.overrideId == Action.LONG_PRESS.value) { @@ -1245,12 +1848,12 @@ private void ensureInverseTransform() { } } - Rect getGlobalRect() { + private Rect getGlobalRect() { assert !globalGeometryDirty; return globalRect; } - SemanticsObject hitTest(float[] point) { + private SemanticsNode hitTest(float[] point) { final float w = point[3]; final float x = point[0] / w; final float y = point[1] / w; @@ -1258,13 +1861,13 @@ SemanticsObject hitTest(float[] point) { if (childrenInHitTestOrder != null) { final float[] transformedPoint = new float[4]; for (int i = 0; i < childrenInHitTestOrder.size(); i += 1) { - final SemanticsObject child = childrenInHitTestOrder.get(i); + final SemanticsNode child = childrenInHitTestOrder.get(i); if (child.hasFlag(Flag.IS_HIDDEN)) { continue; } child.ensureInverseTransform(); Matrix.multiplyMV(transformedPoint, 0, child.inverseTransform, 0, point, 0); - final SemanticsObject result = child.hitTest(transformedPoint); + final SemanticsNode result = child.hitTest(transformedPoint); if (result != null) { return result; } @@ -1275,7 +1878,7 @@ SemanticsObject hitTest(float[] point) { // TODO(goderbauer): This should be decided by the framework once we have more information // about focusability there. - boolean isFocusable() { + private boolean isFocusable() { // We enforce in the framework that no other useful semantics are merged with these // nodes. if (hasFlag(Flag.SCOPES_ROUTE)) { @@ -1288,7 +1891,7 @@ boolean isFocusable() { || (hint != null && !hint.isEmpty()); } - void collectRoutes(List edges) { + private void collectRoutes(List edges) { if (hasFlag(Flag.SCOPES_ROUTE)) { edges.add(this); } @@ -1299,7 +1902,7 @@ void collectRoutes(List edges) { } } - String getRouteName() { + private String getRouteName() { // Returns the first non-null and non-empty semantic label of a child // with an NamesRoute flag. Otherwise returns null. if (hasFlag(Flag.NAMES_ROUTE)) { @@ -1318,7 +1921,7 @@ String getRouteName() { return null; } - void updateRecursively(float[] ancestorTransform, Set visitedObjects, + private void updateRecursively(float[] ancestorTransform, Set visitedObjects, boolean forceUpdate) { visitedObjects.add(this); diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 6161a23c5f4af..18434c28924aa 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -8,12 +8,10 @@ import android.app.Activity; import android.content.Context; import android.content.res.Configuration; -import android.database.ContentObserver; 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.os.LocaleList; @@ -52,8 +50,7 @@ /** * An Android view containing a Flutter app. */ -public class FlutterView extends SurfaceView - implements BinaryMessenger, TextureRegistry, AccessibilityManager.AccessibilityStateChangeListener { +public class FlutterView extends SurfaceView implements BinaryMessenger, TextureRegistry { /** * Interface for those objects that maintain and expose a reference to a * {@code FlutterView} (such as a full-screen Flutter activity). @@ -91,7 +88,6 @@ static final class ViewportMetrics { } private final DartExecutor dartExecutor; - private final AccessibilityChannel accessibilityChannel; private final NavigationChannel navigationChannel; private final KeyEventChannel keyEventChannel; private final LifecycleChannel lifecycleChannel; @@ -105,14 +101,19 @@ static final class ViewportMetrics { private AccessibilityBridge mAccessibilityNodeProvider; private final SurfaceHolder.Callback mSurfaceCallback; private final ViewportMetrics mMetrics; - private final AccessibilityManager mAccessibilityManager; private final List mActivityLifecycleListeners; private final List mFirstFrameListeners; private final AtomicLong nextTextureId = new AtomicLong(0L); private FlutterNativeView mNativeView; - private final AnimationScaleObserver mAnimationScaleObserver; private boolean mIsSoftwareRenderingEnabled = false; // using the software renderer or not + private final AccessibilityBridge.OnAccessibilityChangeListener onAccessibilityChangeListener = new AccessibilityBridge.OnAccessibilityChangeListener() { + @Override + public void onAccessibilityChanged(boolean isAccessibilityEnabled, boolean isTouchExplorationEnabled) { + resetWillNotDraw(isAccessibilityEnabled, isTouchExplorationEnabled); + } + }; + public FlutterView(Context context) { this(context, null); } @@ -133,7 +134,6 @@ public FlutterView(Context context, AttributeSet attrs, FlutterNativeView native dartExecutor = mNativeView.getDartExecutor(); mIsSoftwareRenderingEnabled = FlutterJNI.nativeGetIsSoftwareRenderingEnabled(); - mAnimationScaleObserver = new AnimationScaleObserver(new Handler()); mMetrics = new ViewportMetrics(); mMetrics.devicePixelRatio = context.getResources().getDisplayMetrics().density; setFocusable(true); @@ -162,13 +162,10 @@ public void surfaceDestroyed(SurfaceHolder holder) { }; getHolder().addCallback(mSurfaceCallback); - mAccessibilityManager = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); - mActivityLifecycleListeners = new ArrayList<>(); mFirstFrameListeners = new ArrayList<>(); // Create all platform channels - accessibilityChannel = new AccessibilityChannel(dartExecutor); navigationChannel = new NavigationChannel(dartExecutor); keyEventChannel = new KeyEventChannel(dartExecutor); lifecycleChannel = new LifecycleChannel(dartExecutor); @@ -236,7 +233,6 @@ public void onPause() { } public void onPostResume() { - updateAccessibilityFeatures(); for (ActivityLifecycleListener listener : mActivityLifecycleListeners) { listener.onPostResume(); } @@ -573,7 +569,7 @@ public boolean onHoverEvent(MotionEvent event) { return false; } - boolean handled = handleAccessibilityHoverEvent(event); + boolean handled = mAccessibilityNodeProvider.onAccessibilityHoverEvent(event); if (!handled) { // TODO(ianh): Expose hover events to the platform, // implementing ADD, REMOVE, etc. @@ -746,6 +742,12 @@ private void preRun() { resetAccessibilityTree(); } + void resetAccessibilityTree() { + if (mAccessibilityNodeProvider != null) { + mAccessibilityNodeProvider.reset(); + } + } + private void postRun() { } @@ -844,206 +846,52 @@ public void onFirstFrame() { } } - // ACCESSIBILITY - - private boolean mAccessibilityEnabled = false; - private boolean mTouchExplorationEnabled = false; - private int mAccessibilityFeatureFlags = 0; - private TouchExplorationListener mTouchExplorationListener; - - protected void dispatchSemanticsAction(int id, AccessibilityBridge.Action action) { - dispatchSemanticsAction(id, action, null); - } - - protected void dispatchSemanticsAction(int id, AccessibilityBridge.Action action, Object args) { - if (!isAttached()) - return; - ByteBuffer encodedArgs = null; - int position = 0; - if (args != null) { - encodedArgs = StandardMessageCodec.INSTANCE.encodeMessage(args); - position = encodedArgs.position(); - } - mNativeView.getFlutterJNI().dispatchSemanticsAction(id, action.value, encodedArgs, position); - } - @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - mAccessibilityEnabled = mAccessibilityManager.isEnabled(); - mTouchExplorationEnabled = mAccessibilityManager.isTouchExplorationEnabled(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - Uri transitionUri = Settings.Global.getUriFor(Settings.Global.TRANSITION_ANIMATION_SCALE); - getContext().getContentResolver().registerContentObserver(transitionUri, false, mAnimationScaleObserver); - } - if (mAccessibilityEnabled || mTouchExplorationEnabled) { - ensureAccessibilityEnabled(); - } - if (mTouchExplorationEnabled) { - mAccessibilityFeatureFlags |= AccessibilityFeature.ACCESSIBLE_NAVIGATION.value; - } else { - mAccessibilityFeatureFlags &= ~AccessibilityFeature.ACCESSIBLE_NAVIGATION.value; - } - // Apply additional accessibility settings - updateAccessibilityFeatures(); - resetWillNotDraw(); - mAccessibilityManager.addAccessibilityStateChangeListener(this); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - if (mTouchExplorationListener == null) { - mTouchExplorationListener = new TouchExplorationListener(); - } - mAccessibilityManager.addTouchExplorationStateChangeListener(mTouchExplorationListener); - } - } + mAccessibilityNodeProvider = new AccessibilityBridge( + this, + getFlutterNativeView().getFlutterJNI(), + new AccessibilityChannel(dartExecutor), + (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE), + getContext().getContentResolver() + ); + mAccessibilityNodeProvider.setOnAccessibilityChangeListener(onAccessibilityChangeListener); - private void updateAccessibilityFeatures() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - String transitionAnimationScale = Settings.Global.getString(getContext().getContentResolver(), - Settings.Global.TRANSITION_ANIMATION_SCALE); - if (transitionAnimationScale != null && transitionAnimationScale.equals("0")) { - mAccessibilityFeatureFlags |= AccessibilityFeature.DISABLE_ANIMATIONS.value; - } else { - mAccessibilityFeatureFlags &= ~AccessibilityFeature.DISABLE_ANIMATIONS.value; - } - } - mNativeView.getFlutterJNI().setAccessibilityFeatures(mAccessibilityFeatureFlags); + resetWillNotDraw( + mAccessibilityNodeProvider.isAccessibilityEnabled(), + mAccessibilityNodeProvider.isTouchExplorationEnabled() + ); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); - getContext().getContentResolver().unregisterContentObserver(mAnimationScaleObserver); - mAccessibilityManager.removeAccessibilityStateChangeListener(this); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - mAccessibilityManager.removeTouchExplorationStateChangeListener(mTouchExplorationListener); - } + + mAccessibilityNodeProvider.release(); + mAccessibilityNodeProvider = null; } - private void resetWillNotDraw() { + // TODO(mattcarroll): Confer with Ian as to why we need this method. Delete if possible, otherwise add comments. + private void resetWillNotDraw(boolean isAccessibilityEnabled, boolean isTouchExplorationEnabled) { if (!mIsSoftwareRenderingEnabled) { - setWillNotDraw(!(mAccessibilityEnabled || mTouchExplorationEnabled)); + setWillNotDraw(!(isAccessibilityEnabled || isTouchExplorationEnabled)); } else { setWillNotDraw(false); } } - @Override - public void onAccessibilityStateChanged(boolean enabled) { - if (enabled) { - ensureAccessibilityEnabled(); - } else { - mAccessibilityEnabled = false; - if (mAccessibilityNodeProvider != null) { - mAccessibilityNodeProvider.setAccessibilityEnabled(false); - } - mNativeView.getFlutterJNI().setSemanticsEnabled(false); - } - resetWillNotDraw(); - } - - /// Must match the enum defined in window.dart. - private enum AccessibilityFeature { - ACCESSIBLE_NAVIGATION(1 << 0), - INVERT_COLORS(1 << 1), // NOT SUPPORTED - DISABLE_ANIMATIONS(1 << 2); - - AccessibilityFeature(int value) { - this.value = value; - } - - final int value; - } - - // Listens to the global TRANSITION_ANIMATION_SCALE property and notifies us so - // that we can disable animations in Flutter. - private class AnimationScaleObserver extends ContentObserver { - public AnimationScaleObserver(Handler handler) { - super(handler); - } - - @Override - public void onChange(boolean selfChange) { - this.onChange(selfChange, null); - } - - @Override - public void onChange(boolean selfChange, Uri uri) { - String value = Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 ? null - : Settings.Global.getString(getContext().getContentResolver(), - Settings.Global.TRANSITION_ANIMATION_SCALE); - if (value != null && value.equals("0")) { - mAccessibilityFeatureFlags |= AccessibilityFeature.DISABLE_ANIMATIONS.value; - } else { - mAccessibilityFeatureFlags &= ~AccessibilityFeature.DISABLE_ANIMATIONS.value; - } - mNativeView.getFlutterJNI().setAccessibilityFeatures(mAccessibilityFeatureFlags); - } - } - - // This is guarded at instantiation time. - @TargetApi(19) - @RequiresApi(19) - class TouchExplorationListener implements AccessibilityManager.TouchExplorationStateChangeListener { - @Override - public void onTouchExplorationStateChanged(boolean enabled) { - if (enabled) { - mTouchExplorationEnabled = true; - ensureAccessibilityEnabled(); - mAccessibilityFeatureFlags |= AccessibilityFeature.ACCESSIBLE_NAVIGATION.value; - mNativeView.getFlutterJNI().setAccessibilityFeatures(mAccessibilityFeatureFlags); - } else { - mTouchExplorationEnabled = false; - if (mAccessibilityNodeProvider != null) { - mAccessibilityNodeProvider.handleTouchExplorationExit(); - } - mAccessibilityFeatureFlags &= ~AccessibilityFeature.ACCESSIBLE_NAVIGATION.value; - mNativeView.getFlutterJNI().setAccessibilityFeatures(mAccessibilityFeatureFlags); - } - resetWillNotDraw(); - } - } - @Override public AccessibilityNodeProvider getAccessibilityNodeProvider() { - if (mAccessibilityEnabled) + if (mAccessibilityNodeProvider.isAccessibilityEnabled()) { return mAccessibilityNodeProvider; - // TODO(goderbauer): when a11y is off this should return a one-off snapshot of - // the a11y - // tree. - return null; - } - - void ensureAccessibilityEnabled() { - if (!isAttached()) - return; - mAccessibilityEnabled = true; - if (mAccessibilityNodeProvider == null) { - mAccessibilityNodeProvider = new AccessibilityBridge(this, accessibilityChannel); - } - mNativeView.getFlutterJNI().setSemanticsEnabled(true); - mAccessibilityNodeProvider.setAccessibilityEnabled(true); - } - - void resetAccessibilityTree() { - if (mAccessibilityNodeProvider != null) { - mAccessibilityNodeProvider.reset(); - } - } - - private boolean handleAccessibilityHoverEvent(MotionEvent event) { - if (!mTouchExplorationEnabled) { - return false; - } - if (event.getAction() == MotionEvent.ACTION_HOVER_ENTER || event.getAction() == MotionEvent.ACTION_HOVER_MOVE) { - mAccessibilityNodeProvider.handleTouchExploration(event.getX(), event.getY()); - } else if (event.getAction() == MotionEvent.ACTION_HOVER_EXIT) { - mAccessibilityNodeProvider.handleTouchExplorationExit(); } else { - Log.d("flutter", "unexpected accessibility hover event: " + event); - return false; + // TODO(goderbauer): when a11y is off this should return a one-off snapshot of + // the a11y + // tree. + return null; } - return true; } @Override diff --git a/tools/android_lint/baseline.xml b/tools/android_lint/baseline.xml index 93bc535f5737d..8bf5af53ea8c0 100644 --- a/tools/android_lint/baseline.xml +++ b/tools/android_lint/baseline.xml @@ -4,22 +4,22 @@ @@ -30,18 +30,18 @@ errorLine2=" ~~~~~~"> @@ -52,7 +52,7 @@ errorLine2=" ~~~~~~"> @@ -63,7 +63,7 @@ errorLine2=" ~~~~~~"> @@ -74,29 +74,29 @@ errorLine2=" ~~~~~~"> @@ -107,7 +107,7 @@ errorLine2=" ~~~~~~"> @@ -118,7 +118,7 @@ errorLine2=" ~~~~~~"> @@ -129,7 +129,7 @@ errorLine2=" ~~~~~~"> @@ -305,7 +305,7 @@ errorLine2=" ~~~~~~~~~~~"> @@ -327,7 +327,7 @@ errorLine2=" ^"> @@ -360,7 +360,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -371,7 +371,7 @@ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -432,24 +432,24 @@ + message="Use `new SparseArray<SemanticsNode>(...)` instead for better performance" + errorLine1=" private final Map<Integer, SemanticsNode> flutterSemanticsTree = new HashMap<>();" + errorLine2=" ~~~~~~~~~~~~~~~"> + line="135" + column="70"/> + errorLine1=" private final Map<Integer, CustomAccessibilityAction> customAccessibilityActions = new HashMap<>();" + errorLine2=" ~~~~~~~~~~~~~~~"> + line="160" + column="88"/> From 03d5f3c2d1e06e3949232d01233224fe18c196fb Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 8 Mar 2019 18:09:17 -0800 Subject: [PATCH 0394/1117] Clarify arguments to FlutterEngineOnVsync (#8093) --- shell/platform/embedder/embedder.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index bf2343ec6e728..2299650a68ebe 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -654,12 +654,16 @@ FlutterEngineResult FlutterEngineDispatchSemanticsAction( // platform via the vsync callback must be returned. This call must be made on // the thread on which the call to |FlutterEngineRun| was made. // -// |frame_start_time_nanos| is the point at which the vsync event occurred. +// |frame_start_time_nanos| is the point at which the vsync event occurred or +// will occur. If the time point is in the future, the engine will wait till +// that point to begin its frame workload. The system monotonic clock is used as +// the timebase. +// // |frame_target_time_nanos| is the point at which the embedder anticipates the // next vsync to occur. This is a hint the engine uses to schedule Dart VM // garbage collection in periods in which the various threads are most likely to // be idle. For example, for a 60Hz display, embedders should add 16.6 * 1e6 to -// the frame time field. +// the frame time field. The system monotonic clock is used as the timebase. FLUTTER_EXPORT FlutterEngineResult FlutterEngineOnVsync(FlutterEngine engine, intptr_t baton, From 24d990294e0c99b183673d82cd22bfd59a3e7b13 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 8 Mar 2019 23:46:19 -0500 Subject: [PATCH 0395/1117] Roll src/third_party/skia bea1f94f341e..a009d582e812 (18 commits) (#8097) https://skia.googlesource.com/skia.git/%2Blog/bea1f94f341e..a009d582e812 git log bea1f94f341e8b0466ea2bfbda3f3ba44a2fda5c..a009d582e812dba2ce1ba868852124ee4d8a182d --date=short --no-merges --format=%ad %ae %s 2019-03-09 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader dd172cc1eef2..856ebf878c71 (2 commits) 2019-03-09 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 7ddffe6a4a5e..a70166a5efb1 (458 commits) 2019-03-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 14126505b237..b6a2f6bcf657 (1 commits) 2019-03-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 787b4468e49c..dd172cc1eef2 (1 commits) 2019-03-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader f955e638fb15..787b4468e49c (2 commits) 2019-03-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 15dff3606ebf..f955e638fb15 (2 commits) 2019-03-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 53733a68a49a..15dff3606ebf (3 commits) 2019-03-08 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 9d9315341c3e..53733a68a49a (1 commits) 2019-03-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms 5e67e5c19fd3..3b3522324e7b (1 commits) 2019-03-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 653210718292..9d9315341c3e (2 commits) 2019-03-08 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-08 brianosman@google.com Particles: Store stable randoms after spawn affectors 2019-03-08 robertphillips@google.com Make DDL contexts/drawing managers always sort opLists 2019-03-08 bungeman@google.com Move 'Tiling' out of 'Transform' in viewer. 2019-03-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader d2b1d2f936ee..653210718292 (3 commits) 2019-03-08 kjlubick@google.com [canvaskit] Expose more options for working with Surfaces and Contexts 2019-03-07 fmalita@chromium.org [skottie] Gaussian blur layer effect The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index cfe925bba5579..d5d831402f237 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': 'bea1f94f341e8b0466ea2bfbda3f3ba44a2fda5c', + 'skia_revision': 'a009d582e812dba2ce1ba868852124ee4d8a182d', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3892e2013e360..217bde0ca1309 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 9107ca6e7b9595ef1a2eff8ea828c5c4 +Signature: c2e41bb380014997917449637f4ea135 UNUSED LICENSES: From a63ff4632728c6386977dac95699021ee6018449 Mon Sep 17 00:00:00 2001 From: Michael Klimushyn Date: Fri, 8 Mar 2019 22:23:10 -0800 Subject: [PATCH 0396/1117] Android linter prints to the console by default (#8090) The HTML report can still be generated by passing in an `--html` flag to the tool. This will make errors easier to debug in CI. --- tools/android_lint/bin/main.dart | 53 +++++++++++++++++++------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/tools/android_lint/bin/main.dart b/tools/android_lint/bin/main.dart index c96de9afc2226..f64b5a9e9e79f 100644 --- a/tools/android_lint/bin/main.dart +++ b/tools/android_lint/bin/main.dart @@ -14,8 +14,9 @@ const LocalProcessManager processManager = LocalProcessManager(); /// /// This script scans the flutter/shell/platform/android directory for Java /// files to build a `project.xml` file. This file is then passed to the lint -/// tool and HTML output is reqeusted in the directory for the `--out` -/// parameter, which defaults to `lint_report`. +/// tool. If an `--html` flag is also passed in, HTML output is reqeusted in the +/// directory for the optional `--out` parameter, which defaults to +/// `lint_report`. Otherwise the output is printed to STDOUT. /// /// The `--in` parameter may be specified to force this script to scan a /// specific location for the engine repository, and expects to be given the @@ -87,21 +88,21 @@ Future runLint(ArgParser argParser, ArgResults argResults) async { await projectXml.close(); print('Wrote project.xml, starting lint...'); - final Process lintProcess = await processManager.start( - [ - path.join(androidSdkDir.path, 'tools', 'bin', 'lint'), - '--project', - projectXmlPath, - '--html', - argResults['out'], - '--showall', - '--exitcode', // Set non-zero exit code on errors - '-Wall', - '-Werror', - '--baseline', - baselineXmlPath, - ], - ); + final List lintArgs = [ + path.join(androidSdkDir.path, 'tools', 'bin', 'lint'), + '--project', + projectXmlPath, + '--showall', + '--exitcode', // Set non-zero exit code on errors + '-Wall', + '-Werror', + '--baseline', + baselineXmlPath, + ]; + if (argResults['html']) { + lintArgs.addAll(['--html', argResults['out']]); + } + final Process lintProcess = await processManager.start(lintArgs); lintProcess.stdout.pipe(stdout); lintProcess.stderr.pipe(stderr); return await lintProcess.exitCode; @@ -123,11 +124,6 @@ ArgParser setupOptions() { ), ), ) - ..addOption( - 'out', - help: 'The path to write the generated the HTML report to.', - defaultsTo: path.join(projectDir, 'lint_report'), - ) ..addFlag( 'help', help: 'Print usage of the command.', @@ -140,6 +136,19 @@ ArgParser setupOptions() { 'in this project.', negatable: false, defaultsTo: false, + ) + ..addFlag( + 'html', + help: 'Creates an HTML output for this report instead of printing ' + 'command line output.', + negatable: false, + defaultsTo: false, + ) + ..addOption( + 'out', + help: 'The path to write the generated the HTML report to. Ignored if ' + '--html is not also true.', + defaultsTo: path.join(projectDir, 'lint_report'), ); return argParser; From e77337bb1c74bf0595513cc71072b717f8977251 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 8 Mar 2019 23:38:59 -0800 Subject: [PATCH 0397/1117] Use right stream for Java, on mac try to autoselect Java 1.8 (#8099) * Use right stream for Java, on mac try to autoselect Java 1.8 --- tools/android_lint/bin/main.dart | 40 +++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/tools/android_lint/bin/main.dart b/tools/android_lint/bin/main.dart index f64b5a9e9e79f..f9a9e4359dc28 100644 --- a/tools/android_lint/bin/main.dart +++ b/tools/android_lint/bin/main.dart @@ -102,7 +102,15 @@ Future runLint(ArgParser argParser, ArgResults argResults) async { if (argResults['html']) { lintArgs.addAll(['--html', argResults['out']]); } - final Process lintProcess = await processManager.start(lintArgs); + final String javaHome = await getJavaHome(); + final Process lintProcess = await processManager.start( + lintArgs, + environment: javaHome != null + ? { + 'JAVA_HOME': javaHome, + } + : null, + ); lintProcess.stdout.pipe(stdout); lintProcess.stderr.pipe(stderr); return await lintProcess.exitCode; @@ -154,11 +162,36 @@ ArgParser setupOptions() { return argParser; } +/// On macOS, we can try to find Java 1.8. +/// +/// Otherwise, default to whatever JAVA_HOME is already. +Future getJavaHome() async { + if (Platform.isMacOS) { + final ProcessResult result = await processManager.run( + ['/usr/libexec/java_home', '-v', '1.8', '-F'], + ); + if (result.exitCode == 0) { + return result.stdout.trim(); + } + } + return Platform.environment['JAVA_HOME']; +} + /// Checks that `java` points to Java 1.8. /// /// The SDK lint tool may not work with Java > 1.8. Future checkJava1_8() async { print('Checking Java version...'); + + if (Platform.isMacOS) { + final ProcessResult result = await processManager.run( + ['/usr/libexec/java_home', '-v', '1.8', '-F'], + ); + if (result.exitCode != 0) { + print('Java 1.8 not available - the linter may not work properly.'); + } + return; + } final ProcessResult javaResult = await processManager.run( ['java', '-version'], ); @@ -167,8 +200,9 @@ Future checkJava1_8() async { 'Ensure Java is installed and available on your path.'); print(javaResult.stderr); } - final String javaVersionStdout = javaResult.stdout; - if (javaVersionStdout.contains('"1.8')) { + // `java -version` writes to stderr. + final String javaVersionStdout = javaResult.stderr; + if (!javaVersionStdout.contains('"1.8')) { print('The Android SDK tools may not work properly with your Java version. ' 'If this process fails, please retry using Java 1.8.'); } From 76ad08e7db6803a7a4c91c1eb19f645861d40520 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 9 Mar 2019 05:00:58 -0500 Subject: [PATCH 0398/1117] Roll src/third_party/skia a009d582e812..b45e5f1e810a (2 commits) (#8100) https://skia.googlesource.com/skia.git/%2Blog/a009d582e812..b45e5f1e810a git log a009d582e812dba2ce1ba868852124ee4d8a182d..b45e5f1e810ad29128556befccd79b7535998d8e --date=short --no-merges --format=%ad %ae %s 2019-03-09 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 856ebf878c71..3c6dc555a004 (1 commits) 2019-03-09 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d5d831402f237..ab59b021dad1b 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': 'a009d582e812dba2ce1ba868852124ee4d8a182d', + 'skia_revision': 'b45e5f1e810ad29128556befccd79b7535998d8e', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 217bde0ca1309..102c19f6cddbf 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c2e41bb380014997917449637f4ea135 +Signature: 2578322d95bd2f57c45b5ff573a70466 UNUSED LICENSES: From 124fb1a054cdb9d4338b4b7602e795699dbc0108 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 9 Mar 2019 10:04:20 -0500 Subject: [PATCH 0399/1117] Roll src/third_party/skia b45e5f1e810a..29d5dec9a078 (1 commits) (#8101) https://skia.googlesource.com/skia.git/%2Blog/b45e5f1e810a..29d5dec9a078 git log b45e5f1e810ad29128556befccd79b7535998d8e..29d5dec9a0783a033b921dc483fb98d565d684f6 --date=short --no-merges --format=%ad %ae %s 2019-03-09 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3c6dc555a004..ebefaf7ce64a (4 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (reed@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index ab59b021dad1b..af289c6064cba 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': 'b45e5f1e810ad29128556befccd79b7535998d8e', + 'skia_revision': '29d5dec9a0783a033b921dc483fb98d565d684f6', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 102c19f6cddbf..3de349a7eed20 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2578322d95bd2f57c45b5ff573a70466 +Signature: 0dd2b3de568e29ad48747dd78b7125d9 UNUSED LICENSES: From dc216bdcf0b3fbdf5a6ed2ccffa0e33f82c927c1 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Sat, 9 Mar 2019 08:58:07 -0800 Subject: [PATCH 0400/1117] Fix typo (#8102) programatically -> programmatically --- shell/platform/darwin/ios/framework/Headers/FlutterEngine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h b/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h index c7a4836a9f50c..e70877609c032 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h @@ -140,7 +140,7 @@ FLUTTER_EXPORT * the user, or when using a Simulator. This method allows a user to turn * semantics on when they would not ordinarily be generated and the performance * overhead is not a concern, e.g. for UI testing. Note that semantics should - * never be programatically turned off, as it would potentially disable + * never be programmatically turned off, as it would potentially disable * accessibility services an end user has requested. * * This method must only be called after launching the engine via From 21342863aa6018af53c09af2a3e7aa432a6cc844 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Sat, 9 Mar 2019 12:16:34 -0800 Subject: [PATCH 0401/1117] Do not cache gclient sync (#8098) --- .cirrus.yml | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 4ea101ac93b66..2492afbd0fbf4 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -11,10 +11,17 @@ gke_container: task: env: CIRRUS_WORKING_DIR: "/tmp/github_repo" - DEPOT_TOOLS_UPDATE: 0 - replace_engine_script: | + ENGINE_PATH: "/tmp/clean_engine" + DEPOT_TOOLS: "/tmp/depot_tools" + PATH: "$DEPOT_TOOLS:$PATH" + depot_tools_script: + git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS + gclient_sync_script: | + mkdir -p $ENGINE_PATH/src + echo 'solutions = [{"managed": False,"name": "src/flutter","url": "git@github.com:flutter/engine.git","deps_file": "DEPS", "custom_vars": {"download_android_deps" : False, "download_windows_deps" : False,},},]' > $ENGINE_PATH/.gclient cd $ENGINE_PATH/src - rm -r flutter + rm -rf flutter + rm -rf out mv $CIRRUS_WORKING_DIR flutter gclient sync @@ -38,6 +45,10 @@ task: ninja -C out/host_release test_host_script: cd $ENGINE_PATH/src && ./flutter/testing/run_tests.sh host_release - name: build_android + get_android_sdk_script: | + echo 'solutions = [{"managed": False,"name": "src/flutter","url": "git@github.com:flutter/engine.git","deps_file": "DEPS", "custom_vars": {"download_windows_deps" : False,},},]' > $ENGINE_PATH/.gclient + cd $ENGINE_PATH/src + gclient sync lint_host_script: | cd $ENGINE_PATH/src/flutter/tools/android_lint $ENGINE_PATH/src/third_party/dart/tools/sdks/dart-sdk/bin/pub get @@ -60,7 +71,7 @@ task: DEPOT_TOOLS: "/tmp/depot_tools" PATH: "$DEPOT_TOOLS:$PATH" depot_tools_script: - git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS + git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS # jazzy_script: # sudo gem install jazzy@0.9.4 gclient_sync_script: | @@ -88,12 +99,18 @@ format_and_dart_test_task: env: CIRRUS_WORKING_DIR: "/tmp/github_repo" - DEPOT_TOOLS_UPDATE: 0 - replace_engine_script: | + DEPOT_TOOLS: "/tmp/depot_tools" + ENGINE_PATH: "/tmp/clean_engine" + PATH: "$DEPOT_TOOLS:$PATH" + depot_tools_script: + git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS + gclient_sync_script: | + mkdir -p $ENGINE_PATH/src + echo 'solutions = [{"managed": False,"name": "src/flutter","url": "git@github.com:flutter/engine.git","deps_file": "DEPS", "custom_vars": {"download_android_deps" : False, "download_windows_deps" : False,},},]' > $ENGINE_PATH/.gclient cd $ENGINE_PATH/src - rm -r flutter - cp $CIRRUS_WORKING_DIR -r ./flutter + rm -rf flutter + rm -rf out + mv $CIRRUS_WORKING_DIR flutter gclient sync - format_script: cd $ENGINE_PATH/src/flutter && ./ci/format.sh build_script: cd $ENGINE_PATH/src/flutter && ./ci/build.sh From 9e8f8d0889ec04b54def0bf917321a27006623b0 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Sat, 9 Mar 2019 12:39:16 -0800 Subject: [PATCH 0402/1117] Drop android_sdk_downloader in favor of cipd (#8087) * remove sdk downloader, use cipd * roll buildroot to drop android_sdk_downloader --- DEPS | 85 ++-- tools/android_sdk_downloader/.gitignore | 7 - tools/android_sdk_downloader/LICENSE | 27 -- tools/android_sdk_downloader/README.md | 31 -- .../analysis_options.yaml | 155 ------- tools/android_sdk_downloader/lib/main.dart | 220 --------- .../lib/src/android_repository.dart | 416 ------------------ .../lib/src/checksums.dart | 31 -- .../android_sdk_downloader/lib/src/http.dart | 130 ------ .../lib/src/options.dart | 129 ------ tools/android_sdk_downloader/lib/src/zip.dart | 41 -- tools/android_sdk_downloader/pubspec.yaml | 12 - tools/create_ndk_cipd_package.sh | 31 ++ tools/create_sdk_cipd_package.sh | 43 ++ 14 files changed, 130 insertions(+), 1228 deletions(-) delete mode 100644 tools/android_sdk_downloader/.gitignore delete mode 100644 tools/android_sdk_downloader/LICENSE delete mode 100644 tools/android_sdk_downloader/README.md delete mode 100644 tools/android_sdk_downloader/analysis_options.yaml delete mode 100644 tools/android_sdk_downloader/lib/main.dart delete mode 100644 tools/android_sdk_downloader/lib/src/android_repository.dart delete mode 100644 tools/android_sdk_downloader/lib/src/checksums.dart delete mode 100644 tools/android_sdk_downloader/lib/src/http.dart delete mode 100644 tools/android_sdk_downloader/lib/src/options.dart delete mode 100644 tools/android_sdk_downloader/lib/src/zip.dart delete mode 100644 tools/android_sdk_downloader/pubspec.yaml create mode 100755 tools/create_ndk_cipd_package.sh create mode 100755 tools/create_sdk_cipd_package.sh diff --git a/DEPS b/DEPS index af289c6064cba..1b9e0071fa060 100644 --- a/DEPS +++ b/DEPS @@ -122,7 +122,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '4a12b0dfad16723b2190b697a669e3ae17b50b35', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '3f54d4f03112098e164ee62f015fcc54b19d1eda', # Fuchsia compatibility # @@ -387,6 +387,61 @@ deps = { 'src/third_party/pkg/when': Var('dart_git') + '/when.git' + '@' + '0.2.0', + + 'src/third_party/android_tools/ndk': { + 'packages': [ + { + 'package': 'flutter/android/ndk/${{platform}}', + 'version': 'version:r19b' + } + ], + 'condition': 'download_android_deps', + 'dep_type': 'cipd', + }, + + 'src/third_party/android_tools/sdk/build-tools': { + 'packages': [ + { + 'package': 'flutter/android/sdk/build-tools/${{platform}}', + 'version': 'version:28.0.3' + } + ], + 'condition': 'download_android_deps', + 'dep_type': 'cipd', + }, + + 'src/third_party/android_tools/sdk/platform-tools': { + 'packages': [ + { + 'package': 'flutter/android/sdk/platform-tools/${{platform}}', + 'version': 'version:28.0.1' + } + ], + 'condition': 'download_android_deps', + 'dep_type': 'cipd', + }, + + 'src/third_party/android_tools/sdk/platforms': { + 'packages': [ + { + 'package': 'flutter/android/sdk/platforms', + 'version': 'version:28r6' + } + ], + 'condition': 'download_android_deps', + 'dep_type': 'cipd', + }, + + 'src/third_party/android_tools/sdk/tools': { + 'packages': [ + { + 'package': 'flutter/android/sdk/tools/${{platform}}', + 'version': 'version:26.1.1' + } + ], + 'condition': 'download_android_deps', + 'dep_type': 'cipd', + }, } hooks = [ @@ -414,34 +469,6 @@ hooks = [ 'pattern': '.', 'action': ['python', 'src/tools/dart/update.py'], }, - { - 'name': 'prepare_android_downloader', - 'pattern': '.', - 'condition': 'download_android_deps', - 'cwd': 'src/flutter/tools/android_sdk_downloader', - 'action': [ - '../../../third_party/dart/tools/sdks/dart-sdk/bin/pub', # this hook _must_ be run _after_ the dart hook. - 'get' - ], - }, - { - 'name': 'download_android_tools', - 'pattern': '.', - 'condition': 'download_android_deps', - 'action': [ - 'src/third_party/dart/tools/sdks/dart-sdk/bin/dart', # this hook _must_ be run _after_ the dart hook. - '--enable-asserts', - 'src/flutter/tools/android_sdk_downloader/lib/main.dart', - '-y', # Accept licenses - '--out=src/third_party/android_tools', - '--platform=28', - '--platform-revision=6', - '--build-tools-version=28.0.3', - '--platform-tools-version=28.0.1', - '--tools-version=26.1.1', - '--ndk-version=19.1.5304403' - ], - }, { 'name': 'download_android_support', 'pattern': '.', diff --git a/tools/android_sdk_downloader/.gitignore b/tools/android_sdk_downloader/.gitignore deleted file mode 100644 index d6a35f97f7659..0000000000000 --- a/tools/android_sdk_downloader/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -.DS_Store -.atom/ -.idea -.packages -.pub/ -.dart_tool/ -pubspec.lock \ No newline at end of file diff --git a/tools/android_sdk_downloader/LICENSE b/tools/android_sdk_downloader/LICENSE deleted file mode 100644 index 58ab87f9b99b9..0000000000000 --- a/tools/android_sdk_downloader/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -// 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 -// 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. \ No newline at end of file diff --git a/tools/android_sdk_downloader/README.md b/tools/android_sdk_downloader/README.md deleted file mode 100644 index c705ee214278f..0000000000000 --- a/tools/android_sdk_downloader/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Android SDK Downloader - -This program assists with downloading the Android SDK and NDK artifacts for -Flutter engine development. - -## Usage - -``` --r, --repository-xml Specifies the location of the Android Repository XML file. - (defaults to "https://dl.google.com/android/repository/repository2-1.xml") - --p, --platform Specifies the Android platform version, e.g. 28 - - --platform-revision Specifies the Android platform revision, e.g. 6 for 28_r06 - --o, --out The directory to write downloaded files to. - - --os The OS type to download for. Defaults to current platform. - (defaults to current platform), accepts: [windows, macos, linux] - - --build-tools-version The build-tools version to download. Must be in format of .., e.g. 28.0.3; or ..., e.g. 28.0.0.2 - - --platform-tools-version The platform-tools version to download. Must be in format of .., e.g. 28.0.1; or ..., e.g. 28.0.0.2 - - --tools-version The tools version to download. Must be in format of .., e.g. 26.1.1; or ..., e.g. 28.1.1.2 - - --ndk-version The ndk version to download. Must be in format of .., e.g. 28.0.3; or ..., e.g. 28.0.0.2 - --y, --[no-]accept-licenses Automatically accept Android SDK licenses. - --[no-]overwrite Skip download if the target directory exists. -``` \ No newline at end of file diff --git a/tools/android_sdk_downloader/analysis_options.yaml b/tools/android_sdk_downloader/analysis_options.yaml deleted file mode 100644 index 2023b29bda9fe..0000000000000 --- a/tools/android_sdk_downloader/analysis_options.yaml +++ /dev/null @@ -1,155 +0,0 @@ -# Specify analysis options. -# -# Copied from https://github.com/flutter/flutter/blob/master/analysis_options.yaml - -analyzer: - strong-mode: - implicit-dynamic: false - errors: - # treat missing required parameters as a warning (not a hint) - missing_required_param: warning - # treat missing returns as a warning (not a hint) - missing_return: warning - # allow having TODOs in the code - todo: ignore - exclude: - - 'bin/cache/**' - # the following two are relative to the stocks example and the flutter package respectively - # see https://github.com/dart-lang/sdk/issues/28463 - - 'lib/i18n/stock_messages_*.dart' - - 'lib/src/http/**' - -linter: - rules: - # these rules are documented on and in the same order as - # the Dart Lint rules page to make maintenance easier - # https://github.com/dart-lang/linter/blob/master/example/all.yaml - - always_declare_return_types - - always_put_control_body_on_new_line - # - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219 - - always_require_non_null_named_parameters - - always_specify_types - - annotate_overrides - # - avoid_annotating_with_dynamic # conflicts with always_specify_types - - avoid_as - # - avoid_bool_literals_in_conditional_expressions # not yet tested - # - avoid_catches_without_on_clauses # we do this commonly - # - avoid_catching_errors # we do this commonly - - avoid_classes_with_only_static_members - # - avoid_double_and_int_checks # only useful when targeting JS runtime - - avoid_empty_else - - avoid_field_initializers_in_const_classes - - avoid_function_literals_in_foreach_calls - # - avoid_implementing_value_types # not yet tested - - avoid_init_to_null - # - avoid_js_rounded_ints # only useful when targeting JS runtime - - avoid_null_checks_in_equality_operators - # - avoid_positional_boolean_parameters # not yet tested - # - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356) - - avoid_relative_lib_imports - - avoid_renaming_method_parameters - - avoid_return_types_on_setters - # - avoid_returning_null # there are plenty of valid reasons to return null - - avoid_returning_null_for_void - # - avoid_returning_this # there are plenty of valid reasons to return this - # - avoid_setters_without_getters # not yet tested - # - avoid_single_cascade_in_expression_statements # not yet tested - - avoid_slow_async_io - - avoid_types_as_parameter_names - # - avoid_types_on_closure_parameters # conflicts with always_specify_types - - avoid_unused_constructor_parameters - - avoid_void_async - - await_only_futures - - camel_case_types - - cancel_subscriptions - # - cascade_invocations # not yet tested - # - close_sinks # not reliable enough - # - comment_references # blocked on https://github.com/flutter/flutter/issues/20765 - # - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204 - - control_flow_in_finally - # - curly_braces_in_flow_control_structures # not yet tested - - directives_ordering - - empty_catches - - empty_constructor_bodies - - empty_statements - # - file_names # not yet tested - - flutter_style_todos - - hash_and_equals - - implementation_imports - # - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811 - - iterable_contains_unrelated_type - # - join_return_with_assignment # not yet tested - - library_names - - library_prefixes - # - lines_longer_than_80_chars # not yet tested - - list_remove_unrelated_type - # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181 - - no_adjacent_strings_in_list - - no_duplicate_case_values - - non_constant_identifier_names - # - null_closures # not yet tested - # - omit_local_variable_types # opposite of always_specify_types - # - one_member_abstracts # too many false positives - # - only_throw_errors # https://github.com/flutter/flutter/issues/5792 - - overridden_fields - - package_api_docs - - package_names - - package_prefixed_library_names - # - parameter_assignments # we do this commonly - - prefer_adjacent_string_concatenation - - prefer_asserts_in_initializer_lists - - prefer_collection_literals - - prefer_conditional_assignment - - prefer_const_constructors - - prefer_const_constructors_in_immutables - - prefer_const_declarations - - prefer_const_literals_to_create_immutables - # - prefer_constructors_over_static_methods # not yet tested - - prefer_contains - - prefer_equal_for_default_values - # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods - - prefer_final_fields - - prefer_final_locals - - prefer_foreach - # - prefer_function_declarations_over_variables # not yet tested - - prefer_generic_function_type_aliases - - prefer_initializing_formals - # - prefer_int_literals # not yet tested - # - prefer_interpolation_to_compose_strings # not yet tested - - prefer_is_empty - - prefer_is_not_empty - - prefer_iterable_whereType - # - prefer_mixin # https://github.com/dart-lang/language/issues/32 - - prefer_single_quotes - - prefer_typing_uninitialized_variables - - prefer_void_to_null - # - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml - - recursive_getters - - slash_for_doc_comments - - sort_constructors_first - - sort_pub_dependencies - - sort_unnamed_constructors_first - - super_goes_last - - test_types_in_equals - - throw_in_finally - # - type_annotate_public_apis # subset of always_specify_types - - type_init_formals - # - unawaited_futures # too many false positives - - unnecessary_brace_in_string_interps - - unnecessary_const - - unnecessary_getters_setters - # - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498 - - unnecessary_new - - unnecessary_null_aware_assignments - - unnecessary_null_in_if_null_operators - - unnecessary_overrides - - unnecessary_parenthesis - - unnecessary_statements - - unnecessary_this - - unrelated_type_equality_checks - - use_rethrow_when_possible - # - use_setters_to_change_properties # not yet tested - # - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182 - # - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review - - valid_regexps - # - void_checks # not yet tested diff --git a/tools/android_sdk_downloader/lib/main.dart b/tools/android_sdk_downloader/lib/main.dart deleted file mode 100644 index f563889c82b29..0000000000000 --- a/tools/android_sdk_downloader/lib/main.dart +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright 2013 The Flutter 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 'dart:convert'; -import 'dart:io'; - -import 'package:args/args.dart'; -import 'package:path/path.dart' as path; - -import 'src/android_repository.dart'; -import 'src/checksums.dart'; -import 'src/http.dart'; -import 'src/options.dart'; -import 'src/zip.dart'; - -const String _kAndroidRepositoryXml = 'https://dl.google.com/android/repository/repository2-1.xml'; - - -Future main(List args) async { - final ArgParser argParser = ArgParser() - ..addOption( - 'repository-xml', - abbr: 'r', - help: 'Specifies the location of the Android Repository XML file.', - defaultsTo: _kAndroidRepositoryXml, - ) - ..addOption( - 'platform', - abbr: 'p', - help: 'Specifies the Android platform version, e.g. 28', - ) - ..addOption( - 'platform-revision', - help: 'Specifies the Android platform revision, e.g. 6 for 28_r06', - ) - ..addOption( - 'out', - abbr: 'o', - help: 'The directory to write downloaded files to.', - defaultsTo: '.', - ) - ..addOption( - 'os', - help: 'The OS type to download for. Defaults to current platform.', - defaultsTo: Platform.operatingSystem, - allowed: osTypeMap.keys, - ) - ..addOption( - 'build-tools-version', - help: 'The build-tools version to download. Must be in format of ' - '.., e.g. 28.0.3; ' - 'or ..., e.g. 28.0.0.2', - ) - ..addOption( - 'platform-tools-version', - help: 'The platform-tools version to download. Must be in format of ' - '.., e.g. 28.0.1; ' - 'or ..., e.g. 28.0.0.2', - ) - ..addOption( - 'tools-version', - help: 'The tools version to download. Must be in format of ' - '.., e.g. 26.1.1; ' - 'or ..., e.g. 28.1.1.2', - ) - ..addOption( - 'ndk-version', - help: 'The ndk version to download. Must be in format of ' - '.., e.g. 28.0.3; ' - 'or ..., e.g. 28.0.0.2', - ) - ..addFlag('accept-licenses', - abbr: 'y', - defaultsTo: false, - help: 'Automatically accept Android SDK licenses.') - ..addFlag( - 'overwrite', - defaultsTo: false, - help: 'Skip download if the target directory exists.', - ); - - final bool help = args.contains('-h') - || args.contains('--help') - || (args.isNotEmpty && args.first == 'help'); - if (help) { - print(argParser.usage); - return; - } - - final Options options = Options.parseAndValidate(args, argParser); - - final AndroidRepository androidRepository = await _getAndroidRepository(options.repositoryXmlUri); - assert(androidRepository.platforms.isNotEmpty); - assert(androidRepository.buildTools.isNotEmpty); - - if (!options.acceptLicenses) { - for (final AndroidRepositoryLicense license in androidRepository.licenses) { - print('================================================================================\n\n'); - print(license.text); - stdout.write('Do you accept? (Y/n): '); - final String result = stdin.readLineSync().trim().toLowerCase(); - if (result != '' && result.startsWith('y') == false) { - print('Ending.'); - exit(-1); - } - } - } - - await options.outDirectory.create(recursive: true); - - final Directory tempDir = await Directory(options.outDirectory.path).createTemp(); - await tempDir.create(recursive: true); - - final Directory ndkDir = Directory(path.join(options.outDirectory.path, 'ndk')); - final Directory sdkDir = Directory(path.join(options.outDirectory.path, 'sdk')); - final Directory platformDir = Directory(path.join(sdkDir.path, 'platforms', 'android-${options.platformApiLevel}')); - final Directory buildToolsDir = Directory(path.join(sdkDir.path, 'build-tools', options.buildToolsRevision.raw)); - final Directory platformToolsDir = Directory(path.join(sdkDir.path, 'platform-tools')); - final Directory toolsDir = Directory(path.join(sdkDir.path, 'tools')); - - final Map checksums = - await loadChecksums(options.outDirectory); - - print('Downloading Android SDK and NDK artifacts...'); - final List> futures = >[]; - - futures.add(downloadArchive( - androidRepository.platforms, - OptionsRevision(null, options.platformRevision), - options.repositoryBase, - tempDir, - checksumToSkip: options.overwrite ? null : checksums[platformDir.path], - ).then((ArchiveDownloadResult result) { - if (result != ArchiveDownloadResult.empty) { - return unzipFile(result.zipFileName, platformDir).then((_) { - checksums[platformDir.path] = result.checksum; - return writeChecksums(checksums, options.outDirectory); - }); - } - return null; - })); - futures.add(downloadArchive( - androidRepository.buildTools, - options.buildToolsRevision, - options.repositoryBase, - tempDir, - osType: options.osType, - checksumToSkip: options.overwrite ? null : checksums[buildToolsDir.path], - ).then((ArchiveDownloadResult result) { - if (result != ArchiveDownloadResult.empty) { - return unzipFile(result.zipFileName, buildToolsDir).then((_) { - checksums[buildToolsDir.path] = result.checksum; - return writeChecksums(checksums, options.outDirectory); - }); - } - return null; - })); - futures.add(downloadArchive( - androidRepository.platformTools, - options.platformToolsRevision, - options.repositoryBase, - tempDir, - osType: options.osType, - checksumToSkip: options.overwrite ? null : checksums[platformToolsDir.path], - ).then((ArchiveDownloadResult result) { - if (result != ArchiveDownloadResult.empty) { - return unzipFile(result.zipFileName, platformToolsDir).then((_) { - checksums[platformToolsDir.path] = result.checksum; - return writeChecksums(checksums, options.outDirectory); - }); - } - return null; - })); - futures.add(downloadArchive( - androidRepository.tools, - options.toolsRevision, - options.repositoryBase, - tempDir, - osType: options.osType, - checksumToSkip: options.overwrite ? null : checksums[toolsDir.path], - ).then((ArchiveDownloadResult result) { - if (result != ArchiveDownloadResult.empty) { - return unzipFile(result.zipFileName, toolsDir).then((_) { - checksums[toolsDir.path] = result.checksum; - return writeChecksums(checksums, options.outDirectory); - }); - } - return null; - })); - futures.add(downloadArchive( - androidRepository.ndkBundles, - options.ndkRevision, - options.repositoryBase, - tempDir, - osType: options.osType, - checksumToSkip: options.overwrite ? null : checksums[ndkDir.path], - ).then((ArchiveDownloadResult result) { - if (result != ArchiveDownloadResult.empty) { - return unzipFile(result.zipFileName, ndkDir).then((_) { - checksums[ndkDir.path] = result.checksum; - return writeChecksums(checksums, options.outDirectory); - }); - } - return null; - })); - await Future.wait(futures); - await tempDir.delete(recursive: true); -} - -Future _getAndroidRepository(Uri repositoryXmlUri) async { - final StringBuffer repoXmlBuffer = StringBuffer(); - Future _repositoryXmlHandler(HttpClientResponse response) async { - await response.transform(utf8.decoder).forEach(repoXmlBuffer.write); - } - - await httpGet(repositoryXmlUri, _repositoryXmlHandler); - - return parseAndroidRepositoryXml(repoXmlBuffer.toString()); -} diff --git a/tools/android_sdk_downloader/lib/src/android_repository.dart b/tools/android_sdk_downloader/lib/src/android_repository.dart deleted file mode 100644 index 3490d02e95c3c..0000000000000 --- a/tools/android_sdk_downloader/lib/src/android_repository.dart +++ /dev/null @@ -1,416 +0,0 @@ -// Copyright 2013 The Flutter 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 'package:xml/xml.dart' as xml show parse; -import 'package:xml/xml.dart'; - -// see https://android.googlesource.com/platform/tools/base/+/master/sdklib/src/main/java/com/android/sdklib/repository/sdk-repository-10.xsd - -const String _kXsi = 'http://www.w3.org/2001/XMLSchema-instance'; -const String _kSdk = 'http://schemas.android.com/sdk/android/repo/repository2/01'; - -void _debugCheckElement( - XmlElement element, - String name, { - String namespace, -}) { - assert(element != null); - assert(element.name.local == name, '${element.name.local} != $name'); - assert(element.name.namespaceUri == namespace, - '${element.name.namespaceUri} != $namespace'); -} - -XmlElement _firstOrDefault(Iterable list) { - if (list?.isEmpty == true) { - return null; - } - return list.first; -} - -String _getChildText( - XmlElement parent, - String childName, { - String def = '', - String namespace, -}) { - final String value = _firstOrDefault( - parent.findElements( - childName, - namespace: namespace, - ), - )?.text; - return value ?? def; -} - -OSType _parseHostType(String value) { - switch (value) { - case 'linux': - return OSType.linux; - case 'windows': - return OSType.windows; - case 'macosx': - return OSType.mac; - default: - return OSType.any; - } -} - -/// Parses a the Android SDK's https://dl.google.com/android/repository/repository2-1.xml -/// into an [AndroidRepository] object. -AndroidRepository parseAndroidRepositoryXml(String rawXml) { - final XmlDocument doc = xml.parse(rawXml); - return AndroidRepository.fromXml(doc.rootElement); -} - -XmlElement _getTypeDetails(XmlElement parent) { - final XmlElement typeDetails = - _firstOrDefault(parent.findAllElements('type-details')); - if (typeDetails == null) { - throw StateError('Missing .'); - } - return typeDetails; -} - -String _getTypeDetailsType(XmlElement typeDetails) { - return typeDetails.getAttribute('type', namespace: _kXsi); -} - -Iterable _getArchives(XmlElement parent) { - assert(parent != null); - final XmlElement archives = - _firstOrDefault(parent.findAllElements('archives')); - if (archives == null) { - return null; - } - return archives.findElements('archive'); -} - -/// Object class for https://dl.google.com/android/repository/repository2-1.xml. -class AndroidRepository { - const AndroidRepository( - this.licenses, - this.platforms, - this.buildTools, - this.platformTools, - this.tools, - this.ndkBundles, - ) : assert(licenses != null), - assert(platforms != null), - assert(buildTools != null), - assert(platformTools != null), - assert(tools != null), - assert(ndkBundles != null); - - /// Parses the `` element. - factory AndroidRepository.fromXml(XmlElement element) { - _debugCheckElement(element, 'sdk-repository', namespace: _kSdk); - final List licenses = - []; - final List platforms = - []; - final List buildTools = - []; - final List platformTools = - []; - final List tools = - []; - - final List ndkBundles = - []; - for (final XmlElement child in element.children.whereType()) { - switch (child.name.local) { - case 'license': - licenses.add(AndroidRepositoryLicense.fromXml(child)); - break; - case 'remotePackage': - final XmlElement typeDetails = _getTypeDetails(child); - switch (_getTypeDetailsType(typeDetails)) { - case 'sdk:platformDetailsType': - platforms.add( - AndroidRepositoryPlatform.fromXml(child, typeDetails), - ); - break; - case 'generic:genericDetailsType': - final String path = child.getAttribute('path'); - if (path.startsWith('build-tools;')) { - buildTools.add(AndroidRepositoryRemotePackage.fromXml(child)); - } else if (path.startsWith('platform-tools')) { - platformTools - .add(AndroidRepositoryRemotePackage.fromXml(child)); - } else if (path.startsWith('tools')) { - tools.add(AndroidRepositoryRemotePackage.fromXml(child)); - } else if (path.startsWith('ndk-bundle')) { - ndkBundles.add(AndroidRepositoryRemotePackage.fromXml(child)); - } - break; - default: - break; - } - break; - default: - break; - } - } - return AndroidRepository( - licenses, - platforms, - buildTools, - platformTools, - tools, - ndkBundles, - ); - } - - /// Licenses from the repository XML. - final List licenses; - - /// Platform information from the repository XML. - final List platforms; - - /// Build tools information from the repostiory XML. - final List buildTools; - - /// Platform tools information from the repostiory XML. - final List platformTools; - - /// Tools information from the repostiory XML. - final List tools; - - /// Tools information from the repostiory XML. - final List ndkBundles; -} - -/// Object class for the `` element in the Android repo XML. -/// -/// This node contains license information for the packages in the SDK. -class AndroidRepositoryLicense { - /// Creates a new RepositoryLicense holder. - const AndroidRepositoryLicense(this.id, this.text) - : assert(id != null), - assert(text != null); - - /// Parses a `` element. - factory AndroidRepositoryLicense.fromXml(XmlElement element) { - _debugCheckElement(element, 'license'); - return AndroidRepositoryLicense(element.getAttribute('id'), element.text); - } - - /// The identifier for this license. - final String id; - - /// The text of the license. - final String text; -} - -/// Object class for the `` nodes in the repo XML. -/// -/// These nodes contain information about where to download the zipped -/// binaries for various components of the SDK. -class AndroidRepositoryRemotePackage { - const AndroidRepositoryRemotePackage( - this.revision, - this.displayName, - this.archives, { - this.isObsolete = false, - }) : assert(revision != null), - assert(displayName != null), - assert(archives != null), - assert(isObsolete != null); - - factory AndroidRepositoryRemotePackage.fromXml(XmlElement element) { - _debugCheckElement(element, 'remotePackage'); - - return AndroidRepositoryRemotePackage( - AndroidRepositoryRevision.fromXml( - _firstOrDefault(element.findElements('revision'))), - _getChildText(element, 'display-name'), - _getArchives(element) - .map( - (XmlElement archive) => AndroidRepositoryArchive.fromXml(archive), - ) - .toList(), - isObsolete: element.getAttribute('obsolete') == 'true', - ); - } - - /// The `` element, if any. - final AndroidRepositoryRevision revision; - - /// The `` element. - final String displayName; - - /// The list of archives available for this package. - final List archives; - - /// Whether this package is marked as obsolete. - final bool isObsolete; - - @override - String toString() => '$runtimeType{revision: $revision, displayName: $displayName, archives: $archives}'; -} - -/// Object class for instances of `` elements that are for the -/// platform package. -class AndroidRepositoryPlatform extends AndroidRepositoryRemotePackage { - const AndroidRepositoryPlatform( - AndroidRepositoryRevision revision, - String displayName, - List archives, - this.apiLevel, { - bool isObsolete = false, - }) : assert(apiLevel != null), - super(revision, displayName, archives, isObsolete: isObsolete); - - /// Parses an platform from a `` element. - factory AndroidRepositoryPlatform.fromXml( - XmlElement element, - XmlElement typeDetails, - ) { - _debugCheckElement(element, 'remotePackage'); - assert(typeDetails != null); - - return AndroidRepositoryPlatform( - AndroidRepositoryRevision.fromXml( - _firstOrDefault(element.findElements('revision'))), - _getChildText(element, 'display-name'), - _getArchives(element) - .map( - (XmlElement archive) => AndroidRepositoryArchive.fromXml(archive), - ) - .toList(), - int.parse(_getChildText(typeDetails, 'api-level', def: '0')), - isObsolete: element.getAttribute('obsolete') == 'true', - ); - } - - /// The API level for this Platform. - final int apiLevel; - - @override - String toString() => '$runtimeType{revision: $revision, displayName: $displayName, archives: $archives, apiLevel: $apiLevel}'; -} - -/// The OS types supported by Android. -enum OSType { - /// Any OS is supported. - any, - - /// Suppoorts Linux only. - linux, - - /// Supports macOS only. - mac, - - /// Supports windows only. - windows, -} - -/// Object class for the `` element in the Android repo XML. -/// -/// Contains information about the size, checksum, and location of a binary -/// zip archive. Optionally contains information about what host OS is -/// supported. -class AndroidRepositoryArchive { - /// Creates a new AndroidRepositoryArchive. - const AndroidRepositoryArchive( - this.size, - this.checksum, - this.url, { - this.hostOS = OSType.any, - }) : assert(size != null), - assert(checksum != null), - assert(url != null), - assert(hostOS != null); - - /// Parses an `` element. - factory AndroidRepositoryArchive.fromXml(XmlElement element) { - _debugCheckElement(element, 'archive'); - final XmlElement complete = - _firstOrDefault(element.findElements('complete')); - if (complete == null) { - throw StateError('Found element without a node!'); - } - - return AndroidRepositoryArchive( - int.parse(_getChildText(complete, 'size', def: '0')), - _getChildText(complete, 'checksum'), - _getChildText(complete, 'url'), - hostOS: _parseHostType(_getChildText(element, 'host-os')), - ); - } - - /// The download size in bytes of the archive. - final int size; - - /// The SHA-1 checksum of the archive. - final String checksum; - - /// The absolute or relative URL of the file. - final String url; - - /// The OS type, if applicable, for this archive. - final OSType hostOS; - - @override - String toString() => '$runtimeType{size: $size, checksum: $checksum, url: $url, hostOS: $hostOS}'; -} - -/// Object class for a `` node in the Android repo XML. -/// -/// Contains information about the revision of the archive. -/// -/// In the case of the platform package, this is the revision of the platform. -/// -/// In all other cases, this basically works like semver. -class AndroidRepositoryRevision { - /// Creates a new Android repository revision object. All values are required. - const AndroidRepositoryRevision( - this.major, [ - this.minor = 0, - this.micro = 0, - this.preview = 0, - ]) : assert(major != null), - assert(minor != null), - assert(micro != null), - assert(preview != null); - - /// Parses a `` element from the Android repository XML. - factory AndroidRepositoryRevision.fromXml(XmlElement element) { - if (element == null) { - return const AndroidRepositoryRevision(0); - } - _debugCheckElement(element, 'revision'); - return AndroidRepositoryRevision( - int.tryParse(_getChildText(element, 'major', def: '0')), - int.tryParse(_getChildText(element, 'minor', def: '0')), - int.tryParse(_getChildText(element, 'micro', def: '0')), - ); - } - - /// The major revision value. - final int major; - - /// The minor revision value. - final int minor; - - /// The micro revision. - final int micro; - - /// Preview/Release candidate version. A value of 0 indicates that - /// this is not a preview. - final int preview; - - /// Whether this revision represents a preview or release. - bool get isPreview => preview > 0; - - bool matches(int major, int minor, int micro, [int preview = 0]) { - return this.major == major && - this.minor == minor && - this.micro == micro && - this.preview == preview; - } - - @override - String toString() => '$runtimeType:{$major.$minor.$micro.$preview}'; -} diff --git a/tools/android_sdk_downloader/lib/src/checksums.dart b/tools/android_sdk_downloader/lib/src/checksums.dart deleted file mode 100644 index 37e376217e9b6..0000000000000 --- a/tools/android_sdk_downloader/lib/src/checksums.dart +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2013 The Flutter 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 'dart:convert'; -import 'dart:io'; - -import 'package:path/path.dart' as path; - -Future> loadChecksums(Directory directory) async { - final File checksumFile = File(path.join(directory.path, 'checksums.json')); - if (!checksumFile.existsSync()) { - return {}; - } - final Map result = {}; - final Map jsonResult = - json.decode(await checksumFile.readAsString()); - for (final String key in jsonResult.keys) { - result[key] = jsonResult[key]; - } - return result; -} - -Future writeChecksums( - Map checksums, - Directory directory, -) async { - final File checksumFile = File(path.join(directory.path, 'checksums.json')); - const JsonEncoder encoder = JsonEncoder.withIndent(' '); - await checksumFile.writeAsString(encoder.convert(checksums)); -} diff --git a/tools/android_sdk_downloader/lib/src/http.dart b/tools/android_sdk_downloader/lib/src/http.dart deleted file mode 100644 index 4b2fa6cc29cd5..0000000000000 --- a/tools/android_sdk_downloader/lib/src/http.dart +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2013 The Flutter 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 'dart:io'; - -import 'package:path/path.dart' as path; - -import 'android_repository.dart'; -import 'options.dart'; - -typedef HttpResponseHandler = Future Function(HttpClientResponse); - -Future httpGet( - Uri url, - HttpResponseHandler handler, -) async { - assert(url != null); - assert(handler != null); - - final HttpClient httpClient = HttpClient(); - - try { - final HttpClientRequest request = await httpClient.getUrl(url); - final HttpClientResponse response = await request.close(); - await handler(response); - } finally { - httpClient.close(); - } -} - -class DownloadTracker { - DownloadTracker(this.name, this.total) : received = 0; - - final String name; - final int total; - int received; - - String get percent => '${((received / total) * 100).round()}'.padLeft(3) + '%'; - - @override - String toString() => '$name: $received/$total ($percent).'; -} - -final Map _downloadTrackers = - {}; -void _printDownloadTrackers() { - for (final DownloadTracker tracker in _downloadTrackers.values) { - stdout.write( - '${tracker.name.replaceAll('Android ', '')}: ${tracker.percent} '); - } - - if (_downloadTrackers.values - .every((DownloadTracker tracker) => tracker.received == tracker.total)) { - stdout.writeln(); - print('Downloads complete.'); - } else { - stdout.write('\r'); - } -} - -class ArchiveDownloadResult { - const ArchiveDownloadResult(this.zipFileName, this.checksum); - - static const ArchiveDownloadResult empty = ArchiveDownloadResult(null, null); - - final String zipFileName; - final String checksum; -} - -Future downloadArchive( - List packages, - OptionsRevision revision, - String repositoryBase, - Directory outDirectory, { - OSType osType, - int apiLevel, - String checksumToSkip, -}) async { - AndroidRepositoryRemotePackage package; - for (final AndroidRepositoryRemotePackage p in packages) { - if (apiLevel != null && p is AndroidRepositoryPlatform) { - if (p.apiLevel != apiLevel) { - continue; - } - } - if (p.revision.matches( - revision.major, revision.minor, revision.micro, revision.preview)) { - package = p; - break; - } - } - if (package == null) { - throw StateError('Could not find package matching arguments: ' - '$revision, $osType, $apiLevel'); - } - - final String displayName = package.displayName; - final AndroidRepositoryArchive archive = osType == null - ? package.archives.first - : package.archives.firstWhere( - (AndroidRepositoryArchive archive) => archive.hostOS == osType, - ); - - if (archive.checksum == checksumToSkip) { - print('Skipping $displayName, checksum matches current asset.'); - return ArchiveDownloadResult.empty; - } - - Uri uri = Uri.parse(archive.url); - if (!uri.isAbsolute) { - uri = Uri.parse(repositoryBase + archive.url); - } - - _downloadTrackers[displayName] = DownloadTracker(displayName, archive.size); - final String outFileName = path.join(outDirectory.path, archive.url); - final IOSink tempFileSink = File(outFileName).openWrite(); - - Future _handlePlatformZip(HttpClientResponse response) async { - await for (List data in response) { - _downloadTrackers[displayName].received += data.length; - tempFileSink.add(data); - _printDownloadTrackers(); - } - await tempFileSink.close(); - } - - await httpGet(uri, _handlePlatformZip); - return ArchiveDownloadResult(outFileName, archive.checksum); -} diff --git a/tools/android_sdk_downloader/lib/src/options.dart b/tools/android_sdk_downloader/lib/src/options.dart deleted file mode 100644 index 73e3a2f210b35..0000000000000 --- a/tools/android_sdk_downloader/lib/src/options.dart +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright 2013 The Flutter 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 'dart:io'; - -import 'package:args/args.dart'; -import 'package:meta/meta.dart'; - -import 'android_repository.dart'; - -const Map osTypeMap = { - 'windows': OSType.windows, - 'macos': OSType.mac, - 'linux': OSType.linux, -}; - -class OptionsRevision { - const OptionsRevision( - this.raw, [ - this.major = 0, - this.minor = 0, - this.micro = 0, - this.preview = 0, - ]); - - /// Accepted formats: 1.2.3 or 1.2.3.4 - factory OptionsRevision.fromRaw(String raw) { - final List rawParts = raw.split('.'); - if (rawParts == null || (rawParts.length != 3 && rawParts.length != 4)) { - throw ArgumentError('Invalid revision string $raw.'); - } - return OptionsRevision( - raw, - int.parse(rawParts[0]), - int.parse(rawParts[1]), - int.parse(rawParts[2]), - rawParts.length == 4 ? int.parse(rawParts[3]) : 0, - ); - } - - final String raw; - final int major; - final int minor; - final int micro; - final int preview; -} - -class Options { - const Options({ - @required this.platformApiLevel, - @required this.platformRevision, - @required this.repositoryXml, - @required this.repositoryXmlUri, - @required this.buildToolsRevision, - @required this.platformToolsRevision, - @required this.toolsRevision, - @required this.ndkRevision, - @required this.outDirectory, - @required this.repositoryBase, - @required this.osType, - this.acceptLicenses = false, - this.overwrite = false, - }); - - static Options parseAndValidate(List args, ArgParser argParser) { - final ArgResults argResults = argParser.parse(args); - final int platformApiLevel = int.parse(argResults['platform']); - final int platformRevision = int.parse(argResults['platform-revision']); - final Directory outDirectory = Directory(argResults['out']); - - final String rawRepositoryXmlUri = argResults['repository-xml']; - final Uri repositoryXmlUri = Uri.tryParse(rawRepositoryXmlUri); - final int lastSlash = rawRepositoryXmlUri.lastIndexOf('/'); - final String repositoryBase = - rawRepositoryXmlUri.substring(0, lastSlash + 1); - - if (repositoryXmlUri == null) { - throw ArgumentError( - 'Error: could not parse $rawRepositoryXmlUri as a valid URL.'); - } - - String getRawVersion(String argName) { - final String raw = argResults[argName]; - if (raw?.isEmpty == true) { - print('Could not parse required argument $argName.'); - print(argParser.usage); - exit(-1); - } - return raw; - } - - final String rawBuildToolsVersion = getRawVersion('build-tools-version'); - final String rawPlatformToolsVersion = - getRawVersion('platform-tools-version'); - final String rawToolsVersion = getRawVersion('tools-version'); - final String rawNdkVersion = getRawVersion('ndk-version'); - - return Options( - platformApiLevel: platformApiLevel, - platformRevision: platformRevision, - outDirectory: outDirectory, - repositoryXml: rawRepositoryXmlUri, - repositoryXmlUri: repositoryXmlUri, - repositoryBase: repositoryBase, - buildToolsRevision: OptionsRevision.fromRaw(rawBuildToolsVersion), - platformToolsRevision: OptionsRevision.fromRaw(rawPlatformToolsVersion), - toolsRevision: OptionsRevision.fromRaw(rawToolsVersion), - ndkRevision: OptionsRevision.fromRaw(rawNdkVersion), - osType: osTypeMap[argResults['os']], - acceptLicenses: argResults['accept-licenses'], - overwrite: argResults['overwrite'], - ); - } - - final int platformApiLevel; - final String repositoryXml; - final Uri repositoryXmlUri; - final int platformRevision; - final OptionsRevision buildToolsRevision; - final OptionsRevision platformToolsRevision; - final OptionsRevision toolsRevision; - final OptionsRevision ndkRevision; - final String repositoryBase; - final Directory outDirectory; - final OSType osType; - final bool acceptLicenses; - final bool overwrite; -} diff --git a/tools/android_sdk_downloader/lib/src/zip.dart b/tools/android_sdk_downloader/lib/src/zip.dart deleted file mode 100644 index 488cb9b29b512..0000000000000 --- a/tools/android_sdk_downloader/lib/src/zip.dart +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2013 The Flutter 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 'dart:async'; -import 'dart:io'; - -// TODO(dnfield): if/when a streaming unzip routine is available for Dart, use that instead. - -Future unzipFile(String file, Directory outDir) async { - await outDir.parent.create(recursive: true); - final Directory tempDir = await outDir.parent.createTemp(); - - String command; - List args; - if (Platform.isWindows) { - command = 'powershell.exe -nologo -noprofile -command ' - '"& { ' - 'Add-Type -A \'System.IO.Compression.FileSystem\'; ' - '[IO.Compression.ZipFile]::ExtractToDirectory(\'$file\', \'${tempDir.path}\'); ' - '}"'; - args = []; - } else { - command = 'unzip'; - args = [ - file, - '-d', - tempDir.path, - ]; - } - final ProcessResult result = await Process.run(command, args); - if (result.exitCode != 0) { - throw Exception('Failed to unzip archive!'); - } - final Directory dir = await tempDir.list().first; - if (await outDir.exists()) { - await outDir.delete(recursive: true); - } - await dir.rename(outDir.path); - await tempDir.delete(); -} diff --git a/tools/android_sdk_downloader/pubspec.yaml b/tools/android_sdk_downloader/pubspec.yaml deleted file mode 100644 index ef1b304818da9..0000000000000 --- a/tools/android_sdk_downloader/pubspec.yaml +++ /dev/null @@ -1,12 +0,0 @@ -name: 'android_sdk_downloader' -publish_to: none - -environment: - # The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite. - sdk: ">=2.0.0-dev.68.0 <3.0.0" - -dependencies: - args: ^1.5.1 - meta: ^1.1.6 - path: ^1.6.2 - xml: ^3.2.3 diff --git a/tools/create_ndk_cipd_package.sh b/tools/create_ndk_cipd_package.sh new file mode 100755 index 0000000000000..7651b195735c4 --- /dev/null +++ b/tools/create_ndk_cipd_package.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# This script requires depot_tools to be on path. + +print_usage () { + echo "Usage: create_ndk_cipd_package.sh " + echo " where:" + echo " - PATH_TO_NDK_ASSETS is the path to the unzipped NDK folder" + echo " - PLATFORM_NAME is one of linux-amd64, mac-amd64, or windows-amd64" + echo " - VERSION_TAG is the version of the NDK, e.g. r19b" +} + +if [[ $3 == "" ]]; then + print_usage + exit 1 +fi + +if [[ ! -d "$1" ]]; then + echo "Directory $1 not found." + print_usage + exit 1 +fi + +if [[ $2 != "linux-amd64" && $2 != "mac-amd64" && $2 != "windows-amd64" ]]; then + echo "Unsupported platform $2." + echo "Valid options are linux-amd64, mac-amd64, windows-amd64." + print_usage + exit 1 +fi + +cipd create -in $1 -name flutter/android/ndk/$2 -install-mode copy -tag version:$3 diff --git a/tools/create_sdk_cipd_package.sh b/tools/create_sdk_cipd_package.sh new file mode 100755 index 0000000000000..7f1ed33ad9fb9 --- /dev/null +++ b/tools/create_sdk_cipd_package.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# This script requires depot_tools to be on path. + +print_usage () { + echo "Usage: create_ndk_cipd_package.sh " + echo " where:" + echo " - PACKAGE_TYPE is one of build-tools, platform-tools, platforms, or tools" + echo " - PATH_TO_ASSETS is the path to the unzipped asset folder" + echo " - PLATFORM_NAME is one of linux-amd64, mac-amd64, or windows-amd64" + echo " - VERSION_TAG is the version of the package, e.g. 28r6 or 28.0.3" +} + +if [[ $4 == "" ]]; then + print_usage + exit 1 +fi + +if [[ $1 != "build-tools" && $1 != "platform-tools" && $1 != "platforms" && $1 != "tools" ]]; then + echo "Unrecognized paackage type $1." + print_usage + exit 1 +fi + +if [[ ! -d "$2" ]]; then + echo "Directory $1 not found." + print_usage + exit 1 +fi + +if [[ $1 != "platforms" && $3 != "linux-amd64" && $3 != "mac-amd64" && $3 != "windows-amd64" ]]; then + echo "Unsupported platform $3." + echo "Valid options are linux-amd64, mac-amd64, windows-amd64." + print_usage + exit 1 +fi + +if [[ $1 == "platforms" ]]; then + echo "Ignoring PLATFORM_NAME - this package is cross-platform." + cipd create -in $2 -name flutter/android/sdk/$1 -install-mode copy -tag version:$4 +else + cipd create -in $2 -name flutter/android/sdk/$1/$3 -install-mode copy -tag version:$4 +fi From 4e54bc93ca9aaf2156fb06266c9fe509e8599a5f Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Sat, 9 Mar 2019 15:07:26 -0800 Subject: [PATCH 0403/1117] Guard initialization of touch exploration listener (#8103) --- .../io/flutter/view/AccessibilityBridge.java | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index 812170155ec75..7d4e5060aa130 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -266,25 +266,7 @@ public void onAccessibilityStateChanged(boolean accessibilityEnabled) { // This is guarded at instantiation time. @TargetApi(19) @RequiresApi(19) - private final AccessibilityManager.TouchExplorationStateChangeListener touchExplorationStateChangeListener = new AccessibilityManager.TouchExplorationStateChangeListener() { - @Override - public void onTouchExplorationStateChanged(boolean isTouchExplorationEnabled) { - if (isTouchExplorationEnabled) { - accessibilityFeatureFlags |= AccessibilityFeature.ACCESSIBLE_NAVIGATION.value; - } else { - onTouchExplorationExit(); - accessibilityFeatureFlags &= ~AccessibilityFeature.ACCESSIBLE_NAVIGATION.value; - } - sendLatestAccessibilityFlagsToFlutter(); - - if (onAccessibilityChangeListener != null) { - onAccessibilityChangeListener.onAccessibilityChanged( - accessibilityManager.isEnabled(), - isTouchExplorationEnabled - ); - } - } - }; + private final AccessibilityManager.TouchExplorationStateChangeListener touchExplorationStateChangeListener; // Listener that is notified when the global TRANSITION_ANIMATION_SCALE. When this scale goes // to zero, we instruct Flutter to disable animations. @@ -336,8 +318,29 @@ public void onChange(boolean selfChange, Uri uri) { // Tell Flutter whether touch exploration is initially active or not. Then register a listener // to be notified of changes in the future. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + touchExplorationStateChangeListener = new AccessibilityManager.TouchExplorationStateChangeListener() { + @Override + public void onTouchExplorationStateChanged(boolean isTouchExplorationEnabled) { + if (isTouchExplorationEnabled) { + accessibilityFeatureFlags |= AccessibilityFeature.ACCESSIBLE_NAVIGATION.value; + } else { + onTouchExplorationExit(); + accessibilityFeatureFlags &= ~AccessibilityFeature.ACCESSIBLE_NAVIGATION.value; + } + sendLatestAccessibilityFlagsToFlutter(); + + if (onAccessibilityChangeListener != null) { + onAccessibilityChangeListener.onAccessibilityChanged( + accessibilityManager.isEnabled(), + isTouchExplorationEnabled + ); + } + } + }; touchExplorationStateChangeListener.onTouchExplorationStateChanged(accessibilityManager.isTouchExplorationEnabled()); this.accessibilityManager.addTouchExplorationStateChangeListener(touchExplorationStateChangeListener); + } else { + touchExplorationStateChangeListener = null; } // Tell Flutter whether animations should initially be enabled or disabled. Then register a From 14d1584a22627e9a1eefc0e5f3de78caffcde09e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 9 Mar 2019 22:51:47 -0500 Subject: [PATCH 0404/1117] Roll src/third_party/skia 29d5dec9a078..92ae09900456 (1 commits) (#8104) https://skia.googlesource.com/skia.git/%2Blog/29d5dec9a078..92ae09900456 git log 29d5dec9a0783a033b921dc483fb98d565d684f6..92ae09900456256ad9802d8c1c2eb674531cfba9 --date=short --no-merges --format=%ad %ae %s 2019-03-10 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src a70166a5efb1..bc2c6257d015 (100 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 1b9e0071fa060..1ffe28e17c312 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': '29d5dec9a0783a033b921dc483fb98d565d684f6', + 'skia_revision': '92ae09900456256ad9802d8c1c2eb674531cfba9', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3de349a7eed20..2fd2788fb9ce2 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 0dd2b3de568e29ad48747dd78b7125d9 +Signature: 03a03b5889568186f6b1f8db9ff7dc92 UNUSED LICENSES: From a28b530073ed5ead7151b53f9bcb1afd529e2807 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Sat, 9 Mar 2019 20:04:16 -0800 Subject: [PATCH 0405/1117] Log non-kSuccess returns from embedder API calls. (#8096) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Embedders don’t realize that some calls to the API return an error and don’t handle the same. Log such erroneous returns. --- shell/platform/embedder/embedder.cc | 80 ++++++++++++++++------------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 8e56920a32868..8fb7ef07dea94 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -50,6 +50,16 @@ extern const intptr_t kPlatformStrongDillSize; return static_castmember)>((default_value)); \ })() +#define LOG_EMBEDDER_ERROR(code) \ + ({ \ + do { \ + FML_LOG(ERROR) << "Returning error '" << #code << "' (" << code \ + << ") from Flutter Embedder API call to '" \ + << __FUNCTION__ << "'."; \ + } while (0); \ + (code); \ + }) + static bool IsOpenGLRendererConfigValid(const FlutterRendererConfig* config) { if (config->type != kOpenGL) { return false; @@ -308,19 +318,19 @@ FlutterEngineResult FlutterEngineRun(size_t version, FlutterEngine* engine_out) { // Step 0: Figure out arguments for shell creation. if (version != FLUTTER_ENGINE_VERSION) { - return kInvalidLibraryVersion; + return LOG_EMBEDDER_ERROR(kInvalidLibraryVersion); } if (engine_out == nullptr) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } if (args == nullptr) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } if (SAFE_ACCESS(args, assets_path, nullptr) == nullptr) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } if (SAFE_ACCESS(args, main_path__unused__, nullptr) != nullptr) { @@ -334,7 +344,7 @@ FlutterEngineResult FlutterEngineRun(size_t version, } if (!IsRendererValid(config)) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } std::string icu_data_path; @@ -375,7 +385,7 @@ FlutterEngineResult FlutterEngineRun(size_t version, if (!fml::IsFile(application_kernel_path)) { FML_LOG(ERROR) << "Not running in AOT mode but could not resolve the " "kernel binary."; - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } settings.application_kernel_asset = kApplicationKernelSnapshotFileName; } @@ -529,7 +539,7 @@ FlutterEngineResult FlutterEngineRun(size_t version, config, user_data, platform_dispatch_table); if (!on_create_platform_view) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } shell::Shell::CreateCallback on_create_rasterizer = @@ -599,12 +609,12 @@ FlutterEngineResult FlutterEngineRun(size_t version, ); if (!embedder_engine->IsValid()) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } // Step 2: Setup the rendering surface. if (!embedder_engine->NotifyCreated()) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } // Step 3: Run the engine. @@ -618,11 +628,11 @@ FlutterEngineResult FlutterEngineRun(size_t version, std::make_unique(fml::OpenDirectory( settings.assets_path.c_str(), false, fml::FilePermission::kRead))); if (!run_configuration.IsValid()) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } if (!embedder_engine->Run(std::move(run_configuration))) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } // Finally! Release the ownership of the embedder engine to the caller. @@ -632,7 +642,7 @@ FlutterEngineResult FlutterEngineRun(size_t version, FlutterEngineResult FlutterEngineShutdown(FlutterEngine engine) { if (engine == nullptr) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } auto embedder_engine = reinterpret_cast(engine); embedder_engine->NotifyDestroyed(); @@ -644,7 +654,7 @@ FlutterEngineResult FlutterEngineSendWindowMetricsEvent( FlutterEngine engine, const FlutterWindowMetricsEvent* flutter_metrics) { if (engine == nullptr || flutter_metrics == nullptr) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } blink::ViewportMetrics metrics; @@ -656,7 +666,7 @@ FlutterEngineResult FlutterEngineSendWindowMetricsEvent( return reinterpret_cast(engine)->SetViewportMetrics( std::move(metrics)) ? kSuccess - : kInvalidArguments; + : LOG_EMBEDDER_ERROR(kInvalidArguments); } // Returns the blink::PointerData::Change for the given FlutterPointerPhase. @@ -699,7 +709,7 @@ FlutterEngineResult FlutterEngineSendPointerEvent( const FlutterPointerEvent* pointers, size_t events_count) { if (engine == nullptr || pointers == nullptr || events_count == 0) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } auto packet = std::make_unique(events_count); @@ -728,19 +738,19 @@ FlutterEngineResult FlutterEngineSendPointerEvent( return reinterpret_cast(engine) ->DispatchPointerDataPacket(std::move(packet)) ? kSuccess - : kInvalidArguments; + : LOG_EMBEDDER_ERROR(kInvalidArguments); } FlutterEngineResult FlutterEngineSendPlatformMessage( FlutterEngine engine, const FlutterPlatformMessage* flutter_message) { if (engine == nullptr || flutter_message == nullptr) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } if (SAFE_ACCESS(flutter_message, channel, nullptr) == nullptr || SAFE_ACCESS(flutter_message, message, nullptr) == nullptr) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } auto message = fml::MakeRefCounted( @@ -753,7 +763,7 @@ FlutterEngineResult FlutterEngineSendPlatformMessage( return reinterpret_cast(engine)->SendPlatformMessage( std::move(message)) ? kSuccess - : kInvalidArguments; + : LOG_EMBEDDER_ERROR(kInvalidArguments); } FlutterEngineResult FlutterEngineSendPlatformMessageResponse( @@ -762,7 +772,7 @@ FlutterEngineResult FlutterEngineSendPlatformMessageResponse( const uint8_t* data, size_t data_length) { if (data_length != 0 && data == nullptr) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } auto response = handle->message->response(); @@ -788,11 +798,11 @@ FlutterEngineResult FlutterEngineRegisterExternalTexture( FlutterEngine engine, int64_t texture_identifier) { if (engine == nullptr || texture_identifier == 0) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } if (!reinterpret_cast(engine)->RegisterTexture( texture_identifier)) { - return kInternalInconsistency; + return LOG_EMBEDDER_ERROR(kInternalInconsistency); } return kSuccess; } @@ -806,7 +816,7 @@ FlutterEngineResult FlutterEngineUnregisterExternalTexture( if (!reinterpret_cast(engine)->UnregisterTexture( texture_identifier)) { - return kInternalInconsistency; + return LOG_EMBEDDER_ERROR(kInternalInconsistency); } return kSuccess; @@ -816,11 +826,11 @@ FlutterEngineResult FlutterEngineMarkExternalTextureFrameAvailable( FlutterEngine engine, int64_t texture_identifier) { if (engine == nullptr || texture_identifier == 0) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } if (!reinterpret_cast(engine) ->MarkTextureFrameAvailable(texture_identifier)) { - return kInternalInconsistency; + return LOG_EMBEDDER_ERROR(kInternalInconsistency); } return kSuccess; } @@ -828,11 +838,11 @@ FlutterEngineResult FlutterEngineMarkExternalTextureFrameAvailable( FlutterEngineResult FlutterEngineUpdateSemanticsEnabled(FlutterEngine engine, bool enabled) { if (engine == nullptr) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } if (!reinterpret_cast(engine)->SetSemanticsEnabled( enabled)) { - return kInternalInconsistency; + return LOG_EMBEDDER_ERROR(kInternalInconsistency); } return kSuccess; } @@ -841,11 +851,11 @@ FlutterEngineResult FlutterEngineUpdateAccessibilityFeatures( FlutterEngine engine, FlutterAccessibilityFeature flags) { if (engine == nullptr) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } if (!reinterpret_cast(engine) ->SetAccessibilityFeatures(flags)) { - return kInternalInconsistency; + return LOG_EMBEDDER_ERROR(kInternalInconsistency); } return kSuccess; } @@ -857,14 +867,14 @@ FlutterEngineResult FlutterEngineDispatchSemanticsAction( const uint8_t* data, size_t data_length) { if (engine == nullptr) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } auto engine_action = static_cast(action); if (!reinterpret_cast(engine) ->DispatchSemanticsAction( id, engine_action, std::vector({data, data + data_length}))) { - return kInternalInconsistency; + return LOG_EMBEDDER_ERROR(kInternalInconsistency); } return kSuccess; } @@ -874,7 +884,7 @@ FlutterEngineResult FlutterEngineOnVsync(FlutterEngine engine, uint64_t frame_start_time_nanos, uint64_t frame_target_time_nanos) { if (engine == nullptr) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } auto start_time = fml::TimePoint::FromEpochDelta( @@ -885,7 +895,7 @@ FlutterEngineResult FlutterEngineOnVsync(FlutterEngine engine, if (!reinterpret_cast(engine)->OnVsyncEvent( baton, start_time, target_time)) { - return kInternalInconsistency; + return LOG_EMBEDDER_ERROR(kInternalInconsistency); } return kSuccess; @@ -907,7 +917,7 @@ FlutterEngineResult FlutterEnginePostRenderThreadTask(FlutterEngine engine, VoidCallback callback, void* baton) { if (engine == nullptr || callback == nullptr) { - return kInvalidArguments; + return LOG_EMBEDDER_ERROR(kInvalidArguments); } auto task = [callback, baton]() { callback(baton); }; @@ -915,5 +925,5 @@ FlutterEngineResult FlutterEnginePostRenderThreadTask(FlutterEngine engine, return reinterpret_cast(engine)->PostRenderThreadTask( task) ? kSuccess - : kInternalInconsistency; + : LOG_EMBEDDER_ERROR(kInternalInconsistency); } From 0d2cf5857b2be0949435f60c0188f1aed4d93c93 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Sun, 10 Mar 2019 10:46:27 -0700 Subject: [PATCH 0406/1117] Fix the Windows build (#8106) * Make macro for logging embedder errors build on Windows --- shell/platform/embedder/embedder.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 8fb7ef07dea94..09933a32a001e 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -50,15 +50,16 @@ extern const intptr_t kPlatformStrongDillSize; return static_castmember)>((default_value)); \ })() -#define LOG_EMBEDDER_ERROR(code) \ - ({ \ - do { \ - FML_LOG(ERROR) << "Returning error '" << #code << "' (" << code \ - << ") from Flutter Embedder API call to '" \ - << __FUNCTION__ << "'."; \ - } while (0); \ - (code); \ - }) +static FlutterEngineResult LogEmbedderError(FlutterEngineResult code, + const char* name, + const char* function) { + FML_LOG(ERROR) << "Returning error '" << name << "' (" << code + << ") from Flutter Embedder API call to '" << __FUNCTION__ + << "'."; + return code; +} + +#define LOG_EMBEDDER_ERROR(code) LogEmbedderError(code, #code, __FUNCTION__) static bool IsOpenGLRendererConfigValid(const FlutterRendererConfig* config) { if (config->type != kOpenGL) { From 04fe0078ff22ddcd434deb87d7b8b71e5feac2c9 Mon Sep 17 00:00:00 2001 From: Siva Date: Mon, 11 Mar 2019 02:12:07 -0700 Subject: [PATCH 0407/1117] Roll src/third_party/dart 2fb6cd9f5f..674fd0e060 (58 commits) (#8110) 674fd0e060 Fixes VSCode highlighting of num.dart. fa90c9abe5 New summaries work snapshot. ed9e70c771 Add completion support for the ui-as-code features 1335296750 Move SourceLibraryBuilder builder, support for typedef(s), some type parameters. 9ff0a654ca Revert "Reland "[VM runtime] Dual mapping of executable pages."" 9e5cf6b09e Improve set/map/list literal type checking. affcca729b Fix some tests broken by CL 94993 f6c8468a98 Revert "Eliminate uses of old AST node types from pkg/analyzer/lib/src/summary" 303b8bab3a fix for null_closures 231c5c138e Create codegen work item for all members 0b40a46ab5 Eliminate uses of old AST node types from pkg/analyzer/lib/src/summary 37fa71dc4e Resolve types in scopes, resynthesize some elements. 9f7e11c06b Remove extraneous `3` from method name d4ccff7b54 Fix _inferSetOrMapLiteralType to handle a context of `?` correctly. 1e1d19bb02 fix for replace_colon_with_equals 04befc2ab3 Improve type inference tests 73be247e12 Eliminate uses of old AST node types from pkg/analyzer/lib/src/generated 068aa0d2e7 Support eagerly initialized static fields. e6f56a8adf [vm/compiler] first vm implementation of block expression 474e7dc865 update add await fix description b3b9375ca7 Update comments to refer to the greatest/least closure operation. 6387b1bc73 Clarify ambiguity handling logic in _inferSetOrMapLiteralType b72ab0790d Add an Iterable type to the nonstandard SDK test. 1ce3e8af71 Reland "[cfe] Handle spread map entries of static type Null" 9f6476392c Reland "[cfe] Compile null-aware spreads in non-const maps" 10b38fd3f9 Reland "[cfe] Handle spread elements of static type Null" c31be8ab5c Reland "[cfe] Disambiguate between sets and maps with spreads" 8430281a6b Add an implementation of ScopedVisitor.visitForEachPartsWithDeclaration. 6da340bf76 Reland "[VM runtime] Dual mapping of executable pages." 2b501b21aa Revert "[cfe] Disambiguate between sets and maps with spreads" ff5f5de1be Revert "[cfe] Handle spread elements of static type Null" b2cb604b9d improve literal list/map/set control flow recovery d2d098405f [tests] Fix some control flow collections tests 1a2c93ae00 Revert "[cfe] Compile null-aware spreads in non-const maps" afccd8cbc7 Revert "[cfe] Handle spread map entries of static type Null" 6c8dbd84a0 [infra] Support different local named configurations in tools/test.dart. 166c5e4b38 Use subtype rather than assignability to disambiguate maps/sets. 2e9ff26527 Fix overflow bug in BigInt implementations. 9a7679e9e1 Remove some of the tests of the task framework to reduce references to it 6e359857e4 Move ConstantEvaluationTarget out of the task model ccd2c85a1a [cfe] Handle spread map entries of static type Null 3160b084d8 [cfe] Compile null-aware spreads in non-const maps 0a13ef7d03 [cfe] Handle spread elements of static type Null b817b274c2 [cfe] Disambiguate between sets and maps with spreads 0e054b1c6e Some fixes for UI-as-code type inference 8d88316246 fix for unawaited_futures 5eefbd8d14 [vm/ffi] Add a slot for RawPointer::address. ff55d429f6 [kernel] Collection concatenation nodes. 52ff930338 [cfe] Desugar map spread entries in non-const map literals 76ff150df4 [cfe] Add type inference for spreads in map literals 95b0e57ac5 [gardening] Disable ASAN's coredump suppression via ASAN_OPTIONS. 235e5f3709 Allow component to easily adopt libraries at will 64d8a16563 API changes to incremental compiler to support modular compilation 6231ba0b18 Added appropriate comma within comment. 283cabf1a1 [infra] Reject unexpected extra arguments in approve_results. 299c6457cf [vm/ffi] Fix style guide violation b8069cbeca Refactor computation of modular data 889d5d9240 Fix type error in node_tracer --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 1ffe28e17c312..4207ff097a609 100644 --- a/DEPS +++ b/DEPS @@ -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': '2fb6cd9f5ff78fb347795f383a748a1e37d23275', + 'dart_revision': '674fd0e060a33deeedbc2f8fae7c32c7e3f0d8d5', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 80fa218d1863e..810f926095112 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: aeb3ef2d086ef58fb819d6902a51acb5 +Signature: 61c85403b45c4241c745ac885c7da2ce UNUSED LICENSES: From 35e3b2b86944fdd461eefdcbb7b54c95cd808235 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 11 Mar 2019 08:37:28 -0400 Subject: [PATCH 0408/1117] Roll src/third_party/skia 92ae09900456..bd050b90f8c7 (7 commits) (#8111) https://skia.googlesource.com/skia.git/%2Blog/92ae09900456..bd050b90f8c7 git log 92ae09900456256ad9802d8c1c2eb674531cfba9..bd050b90f8c75ea4fdf49f73c4c9744cb98b00d2 --date=short --no-merges --format=%ad %ae %s 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader f2ddde731fb0..fa8603c6113f (1 commits) 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader ebefaf7ce64a..f2ddde731fb0 (1 commits) 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 b6a2f6bcf657..49c9dfe3b832 (1 commits) 2019-03-11 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src bc2c6257d015..ba6c026602da (26 commits) 2019-03-10 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update SKP version 2019-03-10 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4207ff097a609..8be0edff7acf2 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': '92ae09900456256ad9802d8c1c2eb674531cfba9', + 'skia_revision': 'bd050b90f8c75ea4fdf49f73c4c9744cb98b00d2', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2fd2788fb9ce2..e6ae1f67edbfc 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 03a03b5889568186f6b1f8db9ff7dc92 +Signature: 9cb20a68d7afba4c90d920723ea19540 UNUSED LICENSES: From a71609f0695c2977ac96b7a79e67e24767abfda2 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 11 Mar 2019 12:22:28 -0400 Subject: [PATCH 0409/1117] Roll src/third_party/skia bd050b90f8c7..e9c1ce89c005 (8 commits) (#8113) https://skia.googlesource.com/skia.git/%2Blog/bd050b90f8c7..e9c1ce89c005 git log bd050b90f8c75ea4fdf49f73c4c9744cb98b00d2..e9c1ce89c005f2112ecb3b7120116706af1f2222 --date=short --no-merges --format=%ad %ae %s 2019-03-11 kjlubick@google.com Add oss-fuzz compatible fuzzers for sksl2* 2019-03-11 jcgregorio@google.com api.skia.org - Don't document private. 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader fa8603c6113f..cd3e11d9464a (1 commits) 2019-03-07 egdaniel@google.com Make vulkan GrBackendFormats with ycbcr external texture types. 2019-03-06 robertphillips@google.com Add kIdentity_SkYUVColorSpace 2019-03-09 nigeltao@google.com Check that we do not #define WUFFS_IMPLEMENTATION 2019-03-09 nigeltao@google.com Update Wuffs version 2019-03-08 kjlubick@google.com [canvaskit] roll on npm The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 41 ++++++++++++++++++++++++++++++-- sky/packages/sky_engine/LICENSE | 30 +++++++++++++++++++++++ 3 files changed, 70 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 8be0edff7acf2..a43121ecfc46a 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': 'bd050b90f8c75ea4fdf49f73c4c9744cb98b00d2', + 'skia_revision': 'e9c1ce89c005f2112ecb3b7120116706af1f2222', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index e6ae1f67edbfc..41fc2d4297ecc 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 9cb20a68d7afba4c90d920723ea19540 +Signature: 2f8546533f16e65b5b013621e84e1987 UNUSED LICENSES: @@ -4830,6 +4830,43 @@ 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/fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp + ../../../third_party/skia/LICENSE +TYPE: LicenseType.bsd +FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp +FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzSKSL2Metal.cpp +FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp +---------------------------------------------------------------------------------------------------- +Copyright 2019 Google, LLC + +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/gm/backdrop.cpp + ../../../third_party/skia/LICENSE @@ -6180,4 +6217,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: 52 +Total license count: 53 diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index 0a34be8037ede..9359d43fa29a6 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -10965,6 +10965,36 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- skia +Copyright 2019 Google, LLC + +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 From bd0f9085e5bdbac74cc6e611f758768f15ad5415 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 11 Mar 2019 11:30:35 -0700 Subject: [PATCH 0410/1117] Adds a platfromViewId to SemanticsNode (#8055) --- lib/ui/semantics.dart | 8 ++++++++ lib/ui/semantics/semantics_node.h | 1 + lib/ui/semantics/semantics_update_builder.cc | 2 ++ lib/ui/semantics/semantics_update_builder.h | 1 + .../android/io/flutter/view/AccessibilityBridge.java | 2 ++ shell/platform/android/platform_view_android.cc | 3 ++- 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/ui/semantics.dart b/lib/ui/semantics.dart index b98d36fe2b895..55fb0367c5eba 100644 --- a/lib/ui/semantics.dart +++ b/lib/ui/semantics.dart @@ -601,6 +601,11 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { /// The fields 'textSelectionBase' and 'textSelectionExtent' describe the /// currently selected text within `value`. /// + /// The field `platformViewId` references the platform view, whose semantics + /// nodes will be added as children to this node. If a platform view is + /// specified, `childrenInHitTestOrder` and `childrenInTraversalOrder` must be + /// empty. + /// /// For scrollable nodes `scrollPosition` describes the current scroll /// position in logical pixel. `scrollExtentMax` and `scrollExtentMin` /// describe the maximum and minimum in-rage values that `scrollPosition` can @@ -629,6 +634,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { int actions, int textSelectionBase, int textSelectionExtent, + int platformViewId, int scrollChildren, int scrollIndex, double scrollPosition, @@ -656,6 +662,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { actions, textSelectionBase, textSelectionExtent, + platformViewId, scrollChildren, scrollIndex, scrollPosition, @@ -685,6 +692,7 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { int actions, int textSelectionBase, int textSelectionExtent, + int platformViewId, int scrollChildren, int scrollIndex, double scrollPosition, diff --git a/lib/ui/semantics/semantics_node.h b/lib/ui/semantics/semantics_node.h index f6918e54475ba..16a87a32d9c07 100644 --- a/lib/ui/semantics/semantics_node.h +++ b/lib/ui/semantics/semantics_node.h @@ -86,6 +86,7 @@ struct SemanticsNode { int32_t actions = 0; int32_t textSelectionBase = -1; int32_t textSelectionExtent = -1; + int32_t platformViewId = -1; int32_t scrollChildren = 0; int32_t scrollIndex = 0; double scrollPosition = std::nan(""); diff --git a/lib/ui/semantics/semantics_update_builder.cc b/lib/ui/semantics/semantics_update_builder.cc index 575ba6e3227d0..75cfdcf40c95a 100644 --- a/lib/ui/semantics/semantics_update_builder.cc +++ b/lib/ui/semantics/semantics_update_builder.cc @@ -41,6 +41,7 @@ void SemanticsUpdateBuilder::updateNode( int actions, int textSelectionBase, int textSelectionExtent, + int platformViewId, int scrollChildren, int scrollIndex, double scrollPosition, @@ -68,6 +69,7 @@ void SemanticsUpdateBuilder::updateNode( node.actions = actions; node.textSelectionBase = textSelectionBase; node.textSelectionExtent = textSelectionExtent; + node.platformViewId = platformViewId; node.scrollChildren = scrollChildren; node.scrollIndex = scrollIndex; node.scrollPosition = scrollPosition; diff --git a/lib/ui/semantics/semantics_update_builder.h b/lib/ui/semantics/semantics_update_builder.h index ac8424d9f0fbd..fa6201c3d84c1 100644 --- a/lib/ui/semantics/semantics_update_builder.h +++ b/lib/ui/semantics/semantics_update_builder.h @@ -29,6 +29,7 @@ class SemanticsUpdateBuilder int actions, int textSelectionBase, int textSelectionExtent, + int platformViewId, int scrollChildren, int scrollIndex, double scrollPosition, diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index 7d4e5060aa130..3c262fa9fe63d 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -1614,6 +1614,7 @@ private static boolean nullableHasAncestor(SemanticsNode target, Predicate Date: Mon, 11 Mar 2019 14:30:07 -0700 Subject: [PATCH 0411/1117] Improve shadow doc in PhysicalShapeLayer (#8114) The old x is confusing as it often refers to x-axis in 2D graphics. Replace it with t which has a nice interpretation of tangent. --- flow/layers/physical_shape_layer.cc | 36 ++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/flow/layers/physical_shape_layer.cc b/flow/layers/physical_shape_layer.cc index d022ccb223305..005945f8f53be 100644 --- a/flow/layers/physical_shape_layer.cc +++ b/flow/layers/physical_shape_layer.cc @@ -58,32 +58,42 @@ void PhysicalShapeLayer::Preroll(PrerollContext* context, // join the child paint bounds. // The offset is calculated as follows: - // .-- (kLightRadius = 800) - // ----- (light) - // | (kLightHeight = 600) + // .--- (kLightRadius) + // -------/ (light) + // | / + // | / + // |/ + // |O + // /| (kLightHeight) + // / | + // / | + // / | + // / | // ------------- (layer) - // | - // | (elevation) - // | + // /| | + // / | | (elevation) + // A / | |B // ------------------------------------------------ (canvas) - // ----------- (extent of shadow) + // --- (extent of shadow) // - // E = lx } x = (r + w/2)/h + // E = lt } t = (r + w/2)/h // } => - // r + w/2 = hx } E = (l/h)(r + w/2) + // r + w/2 = ht } E = (l/h)(r + w/2) // // Where: E = extent of shadow // l = elevation of layer // r = radius of the light source // w = width of the layer // h = light height - // x = multiplier for elevation to extent + // t = tangent of AOB, i.e., multiplier for elevation to extent SkRect bounds(path_.getBounds()); - double ex = (kLightRadius * device_pixel_ratio_ + bounds.width() * 0.5) / + // tangent for x + double tx = (kLightRadius * device_pixel_ratio_ + bounds.width() * 0.5) / kLightHeight; - double ey = (kLightRadius * device_pixel_ratio_ + bounds.height() * 0.5) / + // tangent for y + double ty = (kLightRadius * device_pixel_ratio_ + bounds.height() * 0.5) / kLightHeight; - bounds.outset(elevation_ * ex, elevation_ * ey); + bounds.outset(elevation_ * tx, elevation_ * ty); set_paint_bounds(bounds); #endif // defined(OS_FUCHSIA) } From 2a0d3542851ae59c2d2f490d1111eeb57b0da388 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 11 Mar 2019 14:44:43 -0700 Subject: [PATCH 0412/1117] Add support for trace counters with variable arguments and instrument the raster cache. (#8094) --- flow/raster_cache.cc | 35 +++++++++++++++++++++-- flow/raster_cache.h | 7 +++++ fml/trace_event.cc | 36 ++++++++++++++++-------- fml/trace_event.h | 67 ++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 126 insertions(+), 19 deletions(-) diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index 1927321a03238..9f10e47de250c 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -97,6 +97,7 @@ static RasterCacheResult Rasterize( bool checkerboard, const SkRect& logical_rect, std::function draw_function) { + TRACE_EVENT0("flutter", "RasterCachePopulate"); SkIRect cache_rect = RasterCache::GetDeviceBounds(logical_rect, ctm); const SkImageInfo image_info = SkImageInfo::MakeN32Premul( @@ -129,8 +130,6 @@ RasterCacheResult RasterizePicture(SkPicture* picture, 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); }); @@ -240,6 +239,7 @@ void RasterCache::SweepAfterFrame() { SweepOneCacheAfterFrame(picture_cache_); SweepOneCacheAfterFrame(layer_cache_); picture_cached_this_frame_ = 0; + TraceStatsToTimeline(); } void RasterCache::Clear() { @@ -259,4 +259,35 @@ void RasterCache::SetCheckboardCacheImages(bool checkerboard) { Clear(); } +void RasterCache::TraceStatsToTimeline() const { +#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE + + size_t layer_cache_count = 0; + size_t layer_cache_bytes = 0; + size_t picture_cache_count = 0; + size_t picture_cache_bytes = 0; + + for (const auto& item : layer_cache_) { + const auto dimensions = item.second.image.image_dimensions(); + layer_cache_count++; + layer_cache_bytes += dimensions.width() * dimensions.height() * 4; + } + + for (const auto& item : picture_cache_) { + const auto dimensions = item.second.image.image_dimensions(); + picture_cache_count++; + picture_cache_bytes += dimensions.width() * dimensions.height() * 4; + } + + FML_TRACE_COUNTER("flutter", "RasterCache", + reinterpret_cast(this), // + "LayerCount", layer_cache_count, // + "LayerMBytes", layer_cache_bytes * 1e-6, // + "PictureCount", picture_cache_count, // + "PictureMBytes", picture_cache_bytes * 1e-6 // + ); + +#endif // FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE +} + } // namespace flow diff --git a/flow/raster_cache.h b/flow/raster_cache.h index 74ce010b07c8c..f0382c9c92872 100644 --- a/flow/raster_cache.h +++ b/flow/raster_cache.h @@ -33,6 +33,10 @@ class RasterCacheResult { void draw(SkCanvas& canvas, const SkPaint* paint = nullptr) const; + SkISize image_dimensions() const { + return image_ ? image_->dimensions() : SkISize::Make(0, 0); + }; + private: sk_sp image_; SkRect logical_rect_; @@ -87,6 +91,7 @@ class RasterCache { 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(); @@ -127,6 +132,8 @@ class RasterCache { bool checkerboard_images_; fml::WeakPtrFactory weak_factory_; + void TraceStatsToTimeline() const; + FML_DISALLOW_COPY_AND_ASSIGN(RasterCache); }; diff --git a/fml/trace_event.cc b/fml/trace_event.cc index 69ed8b2216486..86ba90dd423ce 100644 --- a/fml/trace_event.cc +++ b/fml/trace_event.cc @@ -4,22 +4,34 @@ #include "flutter/fml/trace_event.h" -#include "third_party/dart/runtime/include/dart_tools_api.h" +#include "flutter/fml/logging.h" namespace fml { namespace tracing { -void TraceCounter(TraceArg category_group, TraceArg name, TraceIDArg count) { - auto count_string = std::to_string(count); - const char* arg_names[] = {name}; - const char* arg_values[] = {count_string.c_str()}; - Dart_TimelineEvent(name, // label - Dart_TimelineGetMicros(), // timestamp0 - 0, // timestamp1_or_async_id - Dart_Timeline_Event_Counter, // event type - 1, // argument_count - arg_names, // argument_names - arg_values // argument_values +void TraceTimelineEvent(TraceArg category_group, + TraceArg name, + TraceIDArg identifier, + Dart_Timeline_Event_Type type, + const std::vector& names, + const std::vector& values) { + const auto argument_count = std::min(names.size(), values.size()); + + std::vector c_values; + c_values.resize(argument_count, nullptr); + + for (size_t i = 0; i < argument_count; i++) { + c_values[i] = values[i].c_str(); + } + + Dart_TimelineEvent( + name, // label + Dart_TimelineGetMicros(), // timestamp0 + identifier, // timestamp1_or_async_id + type, // event type + argument_count, // argument_count + const_cast(names.data()), // argument_names + const_cast(c_values.data()) // argument_values ); } diff --git a/fml/trace_event.h b/fml/trace_event.h index b3bba9b281f61..c61fbc1efa364 100644 --- a/fml/trace_event.h +++ b/fml/trace_event.h @@ -13,8 +13,6 @@ #include -#define FML_TRACE_COUNTER(category_group, name, count) \ - TRACE_COUNTER(category_group, name, 0u, name, count) #define TRACE_EVENT0(a, b) TRACE_DURATION(a, b) #define TRACE_EVENT1(a, b, c, d) TRACE_DURATION(a, b, c, d) #define TRACE_EVENT2(a, b, c, d, e, f) TRACE_DURATION(a, b, c, d, e, f) @@ -28,8 +26,11 @@ #include #include #include +#include +#include #include "flutter/fml/macros.h" +#include "third_party/dart/runtime/include/dart_tools_api.h" #if !defined(OS_FUCHSIA) @@ -45,8 +46,8 @@ // from trace/event.h on Fuchsia. // // TODO(chinmaygarde): All macros here should have the FML prefix. -#define FML_TRACE_COUNTER(category_group, name, count) \ - ::fml::tracing::TraceCounter(category_group, name, count); +#define FML_TRACE_COUNTER(category_group, name, counter_id, arg1, args...) \ + ::fml::tracing::TraceCounter(category_group, name, counter_id, arg1, ##args); #define TRACE_EVENT0(category_group, name) \ ::fml::tracing::TraceEvent0(category_group, name); \ @@ -99,7 +100,63 @@ namespace tracing { using TraceArg = const char*; using TraceIDArg = int64_t; -void TraceCounter(TraceArg category_group, TraceArg name, TraceIDArg count); +void TraceTimelineEvent(TraceArg category_group, + TraceArg name, + TraceIDArg id, + Dart_Timeline_Event_Type type, + const std::vector& names, + const std::vector& values); + +inline std::string TraceToString(const char* string) { + return std::string{string}; +} + +inline std::string TraceToString(std::string string) { + return string; +} + +template ::value>> +std::string TraceToString(T string) { + return std::to_string(string); +} + +inline void SplitArgumentsCollect(std::vector& keys, + std::vector& values) {} + +template +void SplitArgumentsCollect(std::vector& keys, + std::vector& values, + Key key, + Value value, + Args... args) { + keys.emplace_back(key); + values.emplace_back(TraceToString(value)); + SplitArgumentsCollect(keys, values, args...); +} + +inline std::pair, std::vector> +SplitArguments() { + return {}; +} + +template +std::pair, std::vector> +SplitArguments(Key key, Value value, Args... args) { + std::vector keys; + std::vector values; + SplitArgumentsCollect(keys, values, key, value, args...); + return std::make_pair(std::move(keys), std::move(values)); +} + +template +void TraceCounter(TraceArg category, + TraceArg name, + TraceIDArg identifier, + Args... args) { + auto split = SplitArguments(args...); + TraceTimelineEvent(category, name, identifier, Dart_Timeline_Event_Counter, + split.first, split.second); +} void TraceEvent0(TraceArg category_group, TraceArg name); From bc901324faf5a24f9220cc7ecbcf5b97b96ae09f Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 11 Mar 2019 15:09:24 -0700 Subject: [PATCH 0413/1117] Revert "Add support for trace counters with variable arguments and instrument the raster cache. (#8094)" (#8122) This reverts commit 2a0d3542851ae59c2d2f490d1111eeb57b0da388. --- flow/raster_cache.cc | 35 ++--------------------- flow/raster_cache.h | 7 ----- fml/trace_event.cc | 36 ++++++++---------------- fml/trace_event.h | 67 ++++---------------------------------------- 4 files changed, 19 insertions(+), 126 deletions(-) diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index 9f10e47de250c..1927321a03238 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -97,7 +97,6 @@ static RasterCacheResult Rasterize( bool checkerboard, const SkRect& logical_rect, std::function draw_function) { - TRACE_EVENT0("flutter", "RasterCachePopulate"); SkIRect cache_rect = RasterCache::GetDeviceBounds(logical_rect, ctm); const SkImageInfo image_info = SkImageInfo::MakeN32Premul( @@ -130,6 +129,8 @@ RasterCacheResult RasterizePicture(SkPicture* picture, 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); }); @@ -239,7 +240,6 @@ void RasterCache::SweepAfterFrame() { SweepOneCacheAfterFrame(picture_cache_); SweepOneCacheAfterFrame(layer_cache_); picture_cached_this_frame_ = 0; - TraceStatsToTimeline(); } void RasterCache::Clear() { @@ -259,35 +259,4 @@ void RasterCache::SetCheckboardCacheImages(bool checkerboard) { Clear(); } -void RasterCache::TraceStatsToTimeline() const { -#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE - - size_t layer_cache_count = 0; - size_t layer_cache_bytes = 0; - size_t picture_cache_count = 0; - size_t picture_cache_bytes = 0; - - for (const auto& item : layer_cache_) { - const auto dimensions = item.second.image.image_dimensions(); - layer_cache_count++; - layer_cache_bytes += dimensions.width() * dimensions.height() * 4; - } - - for (const auto& item : picture_cache_) { - const auto dimensions = item.second.image.image_dimensions(); - picture_cache_count++; - picture_cache_bytes += dimensions.width() * dimensions.height() * 4; - } - - FML_TRACE_COUNTER("flutter", "RasterCache", - reinterpret_cast(this), // - "LayerCount", layer_cache_count, // - "LayerMBytes", layer_cache_bytes * 1e-6, // - "PictureCount", picture_cache_count, // - "PictureMBytes", picture_cache_bytes * 1e-6 // - ); - -#endif // FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE -} - } // namespace flow diff --git a/flow/raster_cache.h b/flow/raster_cache.h index f0382c9c92872..74ce010b07c8c 100644 --- a/flow/raster_cache.h +++ b/flow/raster_cache.h @@ -33,10 +33,6 @@ class RasterCacheResult { void draw(SkCanvas& canvas, const SkPaint* paint = nullptr) const; - SkISize image_dimensions() const { - return image_ ? image_->dimensions() : SkISize::Make(0, 0); - }; - private: sk_sp image_; SkRect logical_rect_; @@ -91,7 +87,6 @@ class RasterCache { 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(); @@ -132,8 +127,6 @@ class RasterCache { bool checkerboard_images_; fml::WeakPtrFactory weak_factory_; - void TraceStatsToTimeline() const; - FML_DISALLOW_COPY_AND_ASSIGN(RasterCache); }; diff --git a/fml/trace_event.cc b/fml/trace_event.cc index 86ba90dd423ce..69ed8b2216486 100644 --- a/fml/trace_event.cc +++ b/fml/trace_event.cc @@ -4,34 +4,22 @@ #include "flutter/fml/trace_event.h" -#include "flutter/fml/logging.h" +#include "third_party/dart/runtime/include/dart_tools_api.h" namespace fml { namespace tracing { -void TraceTimelineEvent(TraceArg category_group, - TraceArg name, - TraceIDArg identifier, - Dart_Timeline_Event_Type type, - const std::vector& names, - const std::vector& values) { - const auto argument_count = std::min(names.size(), values.size()); - - std::vector c_values; - c_values.resize(argument_count, nullptr); - - for (size_t i = 0; i < argument_count; i++) { - c_values[i] = values[i].c_str(); - } - - Dart_TimelineEvent( - name, // label - Dart_TimelineGetMicros(), // timestamp0 - identifier, // timestamp1_or_async_id - type, // event type - argument_count, // argument_count - const_cast(names.data()), // argument_names - const_cast(c_values.data()) // argument_values +void TraceCounter(TraceArg category_group, TraceArg name, TraceIDArg count) { + auto count_string = std::to_string(count); + const char* arg_names[] = {name}; + const char* arg_values[] = {count_string.c_str()}; + Dart_TimelineEvent(name, // label + Dart_TimelineGetMicros(), // timestamp0 + 0, // timestamp1_or_async_id + Dart_Timeline_Event_Counter, // event type + 1, // argument_count + arg_names, // argument_names + arg_values // argument_values ); } diff --git a/fml/trace_event.h b/fml/trace_event.h index c61fbc1efa364..b3bba9b281f61 100644 --- a/fml/trace_event.h +++ b/fml/trace_event.h @@ -13,6 +13,8 @@ #include +#define FML_TRACE_COUNTER(category_group, name, count) \ + TRACE_COUNTER(category_group, name, 0u, name, count) #define TRACE_EVENT0(a, b) TRACE_DURATION(a, b) #define TRACE_EVENT1(a, b, c, d) TRACE_DURATION(a, b, c, d) #define TRACE_EVENT2(a, b, c, d, e, f) TRACE_DURATION(a, b, c, d, e, f) @@ -26,11 +28,8 @@ #include #include #include -#include -#include #include "flutter/fml/macros.h" -#include "third_party/dart/runtime/include/dart_tools_api.h" #if !defined(OS_FUCHSIA) @@ -46,8 +45,8 @@ // from trace/event.h on Fuchsia. // // TODO(chinmaygarde): All macros here should have the FML prefix. -#define FML_TRACE_COUNTER(category_group, name, counter_id, arg1, args...) \ - ::fml::tracing::TraceCounter(category_group, name, counter_id, arg1, ##args); +#define FML_TRACE_COUNTER(category_group, name, count) \ + ::fml::tracing::TraceCounter(category_group, name, count); #define TRACE_EVENT0(category_group, name) \ ::fml::tracing::TraceEvent0(category_group, name); \ @@ -100,63 +99,7 @@ namespace tracing { using TraceArg = const char*; using TraceIDArg = int64_t; -void TraceTimelineEvent(TraceArg category_group, - TraceArg name, - TraceIDArg id, - Dart_Timeline_Event_Type type, - const std::vector& names, - const std::vector& values); - -inline std::string TraceToString(const char* string) { - return std::string{string}; -} - -inline std::string TraceToString(std::string string) { - return string; -} - -template ::value>> -std::string TraceToString(T string) { - return std::to_string(string); -} - -inline void SplitArgumentsCollect(std::vector& keys, - std::vector& values) {} - -template -void SplitArgumentsCollect(std::vector& keys, - std::vector& values, - Key key, - Value value, - Args... args) { - keys.emplace_back(key); - values.emplace_back(TraceToString(value)); - SplitArgumentsCollect(keys, values, args...); -} - -inline std::pair, std::vector> -SplitArguments() { - return {}; -} - -template -std::pair, std::vector> -SplitArguments(Key key, Value value, Args... args) { - std::vector keys; - std::vector values; - SplitArgumentsCollect(keys, values, key, value, args...); - return std::make_pair(std::move(keys), std::move(values)); -} - -template -void TraceCounter(TraceArg category, - TraceArg name, - TraceIDArg identifier, - Args... args) { - auto split = SplitArguments(args...); - TraceTimelineEvent(category, name, identifier, Dart_Timeline_Event_Counter, - split.first, split.second); -} +void TraceCounter(TraceArg category_group, TraceArg name, TraceIDArg count); void TraceEvent0(TraceArg category_group, TraceArg name); From 20165b3147deda242792a13060eb960894367251 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Mon, 11 Mar 2019 16:04:44 -0700 Subject: [PATCH 0414/1117] Integrated AndroidTouchProcessor within the old FlutterView (#8095) --- .../engine/android/AndroidTouchProcessor.java | 61 ++++- .../embedding/engine/android/FlutterView.java | 26 +- .../android/io/flutter/view/FlutterView.java | 226 ++---------------- 3 files changed, 98 insertions(+), 215 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java b/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java index 94c4f7525c51b..f26cc3e2bc84f 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java @@ -1,5 +1,6 @@ package io.flutter.embedding.engine.android; +import android.os.Build; import android.support.annotation.IntDef; import android.support.annotation.NonNull; import android.view.InputDevice; @@ -36,7 +37,6 @@ public class AndroidTouchProcessor { int UP = 6; } - // Must match the PointerDeviceKind enum in pointer.dart. @IntDef({ PointerDeviceKind.TOUCH, @@ -53,10 +53,24 @@ public class AndroidTouchProcessor { int UNKNOWN = 4; } + // Must match the PointerSignalKind enum in pointer.dart. + @IntDef({ + PointerSignalKind.NONE, + PointerSignalKind.SCROLL, + PointerSignalKind.UNKNOWN + }) + private @interface PointerSignalKind { + int NONE = 0; + int SCROLL = 1; + int UNKNOWN = 2; + } + // Must match the unpacking code in hooks.dart. - // TODO(mattcarroll): Update with additional fields for scroll wheel support - private static final int POINTER_DATA_FIELD_COUNT = 21; + private static final int POINTER_DATA_FIELD_COUNT = 24; private static final int BYTES_PER_FIELD = 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. private static final int POINTER_DATA_FLAG_BATCHED = 1; @NonNull @@ -114,7 +128,9 @@ public boolean onTouchEvent(MotionEvent event) { } // Verify that the packet is the expected size. - assert packet.position() % (POINTER_DATA_FIELD_COUNT * BYTES_PER_FIELD) == 0; + if (packet.position() % (POINTER_DATA_FIELD_COUNT * BYTES_PER_FIELD) != 0) { + throw new AssertionError("Packet position is not on field boundary"); + } // Send the packet to Flutter. renderer.dispatchPointerDataPacket(packet, packet.position()); @@ -122,6 +138,35 @@ public boolean onTouchEvent(MotionEvent event) { return true; } + /** + * Sends the given generic {@link MotionEvent} data to Flutter in a format that Flutter + * understands. + * + * Generic motion events include joystick movement, mouse hover, track pad touches, scroll wheel + * movements, etc. + */ + public boolean onGenericMotionEvent(MotionEvent event) { + // Method isFromSource is only available in API 18+ (Jelly Bean MR2) + // Mouse hover support is not implemented for API < 18. + boolean isPointerEvent = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 + && event.isFromSource(InputDevice.SOURCE_CLASS_POINTER); + if (!isPointerEvent || event.getActionMasked() != MotionEvent.ACTION_HOVER_MOVE) { + return false; + } + + int pointerChange = getPointerChangeForAction(event.getActionMasked()); + ByteBuffer packet = ByteBuffer.allocateDirect( + event.getPointerCount() * POINTER_DATA_FIELD_COUNT * BYTES_PER_FIELD + ); + packet.order(ByteOrder.LITTLE_ENDIAN); + + // ACTION_HOVER_MOVE always applies to a single pointer only. + addPointerForIndex(event, event.getActionIndex(), pointerChange, 0, packet); + assert(packet.position() % (POINTER_DATA_FIELD_COUNT * BYTES_PER_FIELD) != 0); + renderer.dispatchPointerDataPacket(packet, packet.position()); + return true; + } + // TODO(mattcarroll): consider creating a PointerPacket class instead of using a procedure that mutates inputs. private void addPointerForIndex( MotionEvent event, @@ -136,11 +181,14 @@ private void addPointerForIndex( int pointerKind = getPointerDeviceTypeForToolType(event.getToolType(pointerIndex)); + int signalKind = PointerSignalKind.NONE; + long timeStamp = event.getEventTime() * 1000; // Convert from milliseconds to microseconds. packet.putLong(timeStamp); // time_stamp packet.putLong(pointerChange); // change packet.putLong(pointerKind); // kind + packet.putLong(signalKind); // signal_kind packet.putLong(event.getPointerId(pointerIndex)); // device packet.putDouble(event.getX(pointerIndex)); // physical_x packet.putDouble(event.getY(pointerIndex)); // physical_y @@ -192,7 +240,10 @@ private void addPointerForIndex( packet.putDouble(0.0); // tilt } - packet.putLong(pointerData); + packet.putLong(pointerData); // platformData + + packet.putDouble(0.0); // scroll_delta_x + packet.putDouble(0.0); // scroll_delta_y } @PointerChange diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java index 1f507cecb3c13..23bd68c5759d8 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java @@ -312,12 +312,34 @@ public boolean onKeyDown(int keyCode, KeyEvent event) { @Override public boolean onTouchEvent(MotionEvent event) { if (!isAttachedToFlutterEngine()) { - return false; + return super.onTouchEvent(event); + } + + // TODO(abarth): This version check might not be effective in some + // versions of Android that statically compile code and will be upset + // at the lack of |requestUnbufferedDispatch|. Instead, we should factor + // version-dependent code into separate classes for each supported + // version and dispatch dynamically. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + requestUnbufferedDispatch(event); } return androidTouchProcessor.onTouchEvent(event); } + /** + * Invoked by Android when a generic motion event occurs, e.g., joystick movement, mouse hover, + * track pad touches, scroll wheel movements, etc. + * + * Flutter handles all of its own gesture detection and processing, therefore this + * method forwards all {@link MotionEvent} data from Android to Flutter. + */ + @Override + public boolean onGenericMotionEvent(MotionEvent event) { + boolean handled = isAttachedToFlutterEngine() && androidTouchProcessor.onGenericMotionEvent(event); + return handled ? true : super.onGenericMotionEvent(event); + } + /** * Invoked by Android when a hover-compliant input system causes a hover event. * @@ -332,7 +354,7 @@ public boolean onTouchEvent(MotionEvent event) { @Override public boolean onHoverEvent(MotionEvent event) { if (!isAttachedToFlutterEngine()) { - return false; + return super.onHoverEvent(event); } // TODO(mattcarroll): hook up to accessibility. diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 18434c28924aa..8a97164ceaae5 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -29,7 +29,9 @@ import io.flutter.app.FlutterPluginRegistry; import io.flutter.embedding.engine.FlutterJNI; import io.flutter.embedding.engine.android.AndroidKeyProcessor; +import io.flutter.embedding.engine.android.AndroidTouchProcessor; import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.embedding.engine.renderer.FlutterRenderer; import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; import io.flutter.embedding.engine.systemchannels.KeyEventChannel; import io.flutter.embedding.engine.systemchannels.LifecycleChannel; @@ -88,6 +90,7 @@ static final class ViewportMetrics { } private final DartExecutor dartExecutor; + private final FlutterRenderer flutterRenderer; private final NavigationChannel navigationChannel; private final KeyEventChannel keyEventChannel; private final LifecycleChannel lifecycleChannel; @@ -98,6 +101,7 @@ static final class ViewportMetrics { private final InputMethodManager mImm; private final TextInputPlugin mTextInputPlugin; private final AndroidKeyProcessor androidKeyProcessor; + private final AndroidTouchProcessor androidTouchProcessor; private AccessibilityBridge mAccessibilityNodeProvider; private final SurfaceHolder.Callback mSurfaceCallback; private final ViewportMetrics mMetrics; @@ -133,6 +137,7 @@ public FlutterView(Context context, AttributeSet attrs, FlutterNativeView native } dartExecutor = mNativeView.getDartExecutor(); + flutterRenderer = new FlutterRenderer(mNativeView.getFlutterJNI()); mIsSoftwareRenderingEnabled = FlutterJNI.nativeGetIsSoftwareRenderingEnabled(); mMetrics = new ViewportMetrics(); mMetrics.devicePixelRatio = context.getResources().getDisplayMetrics().density; @@ -180,6 +185,7 @@ public void surfaceDestroyed(SurfaceHolder holder) { mImm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); mTextInputPlugin = new TextInputPlugin(this, dartExecutor); androidKeyProcessor = new AndroidKeyProcessor(keyEventChannel, mTextInputPlugin); + androidTouchProcessor = new AndroidTouchProcessor(flutterRenderer); // Send initial platform information to Dart sendLocalesToDart(getResources().getConfiguration()); @@ -362,151 +368,10 @@ public InputConnection onCreateInputConnection(EditorInfo outAttrs) { return mTextInputPlugin.createInputConnection(this, outAttrs); } - // Must match the PointerChange enum in pointer.dart. - private static final int kPointerChangeCancel = 0; - private static final int kPointerChangeAdd = 1; - private static final int kPointerChangeRemove = 2; - private static final int kPointerChangeHover = 3; - private static final int kPointerChangeDown = 4; - private static final int kPointerChangeMove = 5; - private static final int kPointerChangeUp = 6; - - // Must match the PointerDeviceKind enum in pointer.dart. - private static final int kPointerDeviceKindTouch = 0; - private static final int kPointerDeviceKindMouse = 1; - private static final int kPointerDeviceKindStylus = 2; - private static final int kPointerDeviceKindInvertedStylus = 3; - private static final int kPointerDeviceKindUnknown = 4; - - // Must match the PointerSignalKind enum in pointer.dart. - private static final int kPointerSignalKindNone = 0; - private static final int kPointerSignalKindScroll = 1; - private static final int kPointerSignalKindUnknown = 2; - - // These values must match the unpacking code in hooks.dart. - private static final int kPointerDataFieldCount = 24; - private static final int kPointerBytesPerField = 8; - - private int getPointerChangeForAction(int maskedAction) { - // Primary pointer: - if (maskedAction == MotionEvent.ACTION_DOWN) { - return kPointerChangeDown; - } - if (maskedAction == MotionEvent.ACTION_UP) { - return kPointerChangeUp; - } - // Secondary pointer: - if (maskedAction == MotionEvent.ACTION_POINTER_DOWN) { - return kPointerChangeDown; - } - if (maskedAction == MotionEvent.ACTION_POINTER_UP) { - return kPointerChangeUp; - } - // All pointers: - if (maskedAction == MotionEvent.ACTION_MOVE) { - return kPointerChangeMove; - } - if (maskedAction == MotionEvent.ACTION_HOVER_MOVE) { - return kPointerChangeHover; - } - if (maskedAction == MotionEvent.ACTION_CANCEL) { - return kPointerChangeCancel; - } - return -1; - } - - private int getPointerDeviceTypeForToolType(int toolType) { - switch (toolType) { - case MotionEvent.TOOL_TYPE_FINGER: - return kPointerDeviceKindTouch; - case MotionEvent.TOOL_TYPE_STYLUS: - return kPointerDeviceKindStylus; - case MotionEvent.TOOL_TYPE_MOUSE: - return kPointerDeviceKindMouse; - case MotionEvent.TOOL_TYPE_ERASER: - return kPointerDeviceKindInvertedStylus; - default: - // MotionEvent.TOOL_TYPE_UNKNOWN will reach here. - return kPointerDeviceKindUnknown; - } - } - - private void addPointerForIndex(MotionEvent event, int pointerIndex, int pointerChange, - int pointerData, ByteBuffer packet) { - if (pointerChange == -1) { - return; - } - - int pointerKind = getPointerDeviceTypeForToolType(event.getToolType(pointerIndex)); - - int signalKind = kPointerSignalKindNone; - - long timeStamp = event.getEventTime() * 1000; // Convert from milliseconds to microseconds. - - packet.putLong(timeStamp); // time_stamp - packet.putLong(pointerChange); // change - packet.putLong(pointerKind); // kind - packet.putLong(signalKind); // signal_kind - packet.putLong(event.getPointerId(pointerIndex)); // device - packet.putDouble(event.getX(pointerIndex)); // physical_x - packet.putDouble(event.getY(pointerIndex)); // physical_y - - if (pointerKind == kPointerDeviceKindMouse) { - packet.putLong(event.getButtonState() & 0x1F); // buttons - } else if (pointerKind == kPointerDeviceKindStylus) { - packet.putLong((event.getButtonState() >> 4) & 0xF); // buttons - } else { - packet.putLong(0); // buttons - } - - packet.putLong(0); // obscured - - packet.putDouble(event.getPressure(pointerIndex)); // pressure - double pressureMin = 0.0, pressureMax = 1.0; - if (event.getDevice() != null) { - InputDevice.MotionRange pressureRange = event.getDevice().getMotionRange(MotionEvent.AXIS_PRESSURE); - if (pressureRange != null) { - pressureMin = pressureRange.getMin(); - pressureMax = pressureRange.getMax(); - } - } - packet.putDouble(pressureMin); // pressure_min - packet.putDouble(pressureMax); // pressure_max - - if (pointerKind == kPointerDeviceKindStylus) { - packet.putDouble(event.getAxisValue(MotionEvent.AXIS_DISTANCE, pointerIndex)); // distance - packet.putDouble(0.0); // distance_max - } else { - packet.putDouble(0.0); // distance - 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 - - packet.putDouble(0.0); // radius_min - packet.putDouble(0.0); // radius_max - - packet.putDouble(event.getAxisValue(MotionEvent.AXIS_ORIENTATION, pointerIndex)); // orientation - - if (pointerKind == kPointerDeviceKindStylus) { - packet.putDouble(event.getAxisValue(MotionEvent.AXIS_TILT, pointerIndex)); // tilt - } else { - packet.putDouble(0.0); // tilt - } - - packet.putLong(pointerData); // platformData - - packet.putDouble(0.0); // scroll_delta_x - packet.putDouble(0.0); // scroll_delta_y - } - @Override public boolean onTouchEvent(MotionEvent event) { if (!isAttached()) { - return false; + return super.onTouchEvent(event); } // TODO(abarth): This version check might not be effective in some @@ -518,55 +383,13 @@ public boolean onTouchEvent(MotionEvent event) { requestUnbufferedDispatch(event); } - // 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 * kPointerBytesPerField); - packet.order(ByteOrder.LITTLE_ENDIAN); - - int maskedAction = event.getActionMasked(); - 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, pointerChange, 0, packet); - } - } - - if (packet.position() % (kPointerDataFieldCount * kPointerBytesPerField) != 0) { - throw new AssertionError("Packet position is not on field boundary"); - } - mNativeView.getFlutterJNI().dispatchPointerDataPacket(packet, packet.position()); - return true; + return androidTouchProcessor.onTouchEvent(event); } @Override public boolean onHoverEvent(MotionEvent event) { if (!isAttached()) { - return false; + return super.onHoverEvent(event); } boolean handled = mAccessibilityNodeProvider.onAccessibilityHoverEvent(event); @@ -577,30 +400,17 @@ public boolean onHoverEvent(MotionEvent event) { return handled; } + /** + * Invoked by Android when a generic motion event occurs, e.g., joystick movement, mouse hover, + * track pad touches, scroll wheel movements, etc. + * + * Flutter handles all of its own gesture detection and processing, therefore this + * method forwards all {@link MotionEvent} data from Android to Flutter. + */ @Override public boolean onGenericMotionEvent(MotionEvent event) { - // Method isFromSource is only available in API 18+ (Jelly Bean MR2) - // Mouse hover support is not implemented for API < 18. - boolean isPointerEvent = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 - && event.isFromSource(InputDevice.SOURCE_CLASS_POINTER); - if (!isPointerEvent || - event.getActionMasked() != MotionEvent.ACTION_HOVER_MOVE || - !isAttached()) { - return super.onGenericMotionEvent(event); - } - - int pointerChange = getPointerChangeForAction(event.getActionMasked()); - ByteBuffer packet = ByteBuffer.allocateDirect( - event.getPointerCount() * kPointerDataFieldCount * kPointerBytesPerField); - packet.order(ByteOrder.LITTLE_ENDIAN); - - // ACTION_HOVER_MOVE always applies to a single pointer only. - addPointerForIndex(event, event.getActionIndex(), pointerChange, 0, packet); - if (packet.position() % (kPointerDataFieldCount * kPointerBytesPerField) != 0) { - throw new AssertionError("Packet position is not on field boundary"); - } - mNativeView.getFlutterJNI().dispatchPointerDataPacket(packet, packet.position()); - return true; + boolean handled = isAttached() && androidTouchProcessor.onGenericMotionEvent(event); + return handled ? true : super.onGenericMotionEvent(event); } @Override From 5ccee95373348854bc4877cfe240024a36847d2d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 11 Mar 2019 19:11:00 -0400 Subject: [PATCH 0415/1117] Roll src/third_party/skia e9c1ce89c005..c6d8781c4036 (29 commits) (#8123) https://skia.googlesource.com/skia.git/%2Blog/e9c1ce89c005..c6d8781c4036 git log e9c1ce89c005f2112ecb3b7120116706af1f2222..c6d8781c4036cd64a3fbf185ca18b9ff3def8cfd --date=short --no-merges --format=%ad %ae %s 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 49c9dfe3b832..f563fdc91e83 (1 commits) 2019-03-11 kjlubick@google.com [canvaskit] Move from experimental to modules 2019-03-11 bsalomon@google.com Add GM for crbug.com/938592 2019-03-08 bsalomon@google.com Reintroduce deinstantiate lazy proxy types and use for promise images. 2019-03-11 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-11 brianosman@google.com Add clamped half-float pixel config to Ganesh 2019-03-11 kjlubick@google.com Add input length check when fuzzing 2019-03-07 michaelludwig@google.com Handle arbitrary and degenerate quadrilaterals in GrQuadPerEdgeAA 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms 2fb061752f70..c6c0aae921ea (1 commits) 2019-03-06 herb@google.com One routine to rule them all! 2019-03-11 reed@google.com rename mixer to lerp (in prep for SkMixer) 2019-03-11 stani@google.com Export libvulkan headers for android libraries depending on skia 2019-03-11 fmalita@chromium.org [skottie] Fix Gaussian blur repeat edge pixels semantics 2019-03-11 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-11 robertphillips@google.com Revert "Always explicitly allocate except in Android Framework" 2019-03-11 hcm@google.com update milestones to 2019 dates 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms d2f7012e6a85..2fb061752f70 (1 commits) 2019-03-11 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-08 herb@google.com Convert templates to virtuals in SkGlyphRunPainter 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader b72d28ff9975..654540e86243 (1 commits) 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms a81211f5ad2a..d2f7012e6a85 (1 commits) 2019-03-11 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-11 robertphillips@google.com Always explicitly allocate except in Android Framework 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms 3b3522324e7b..a81211f5ad2a (1 commits) 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader bb8c8e211402..b72d28ff9975 (2 commits) 2019-03-11 jcgregorio@google.com Change all pointers to doxygen docs to point to api.skia.org. 2019-03-11 jvanverth@google.com Improve Metal texture uploads. 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader cd3e11d9464a..bb8c8e211402 (2 commits) 2019-03-11 brianosman@google.com Add flag to check that F16Norm pixels are clamped properly The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 118 ++++++++++++++++--------------- 2 files changed, 62 insertions(+), 58 deletions(-) diff --git a/DEPS b/DEPS index a43121ecfc46a..39c4af2ae5629 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': 'e9c1ce89c005f2112ecb3b7120116706af1f2222', + 'skia_revision': 'c6d8781c4036cd64a3fbf185ca18b9ff3def8cfd', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 41fc2d4297ecc..fa965f5befc73 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2f8546533f16e65b5b013621e84e1987 +Signature: 1f8afd011d49d76a6bb68cf8f1c1236e UNUSED LICENSES: @@ -1717,6 +1717,8 @@ FILE: ../../../third_party/skia/src/effects/SkTrimPE.h FILE: ../../../third_party/skia/src/effects/SkTrimPathEffect.cpp FILE: ../../../third_party/skia/src/gpu/GrContextThreadSafeProxyPriv.h FILE: ../../../third_party/skia/src/gpu/GrDDLContext.cpp +FILE: ../../../third_party/skia/src/gpu/GrDeinstantiateProxyTracker.cpp +FILE: ../../../third_party/skia/src/gpu/GrDeinstantiateProxyTracker.h FILE: ../../../third_party/skia/src/gpu/GrDriverBugWorkarounds.cpp FILE: ../../../third_party/skia/src/gpu/GrFPArgs.h FILE: ../../../third_party/skia/src/gpu/GrLegacyDirectContext.cpp @@ -2060,46 +2062,6 @@ 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/canvaskit/NotoSerif-Regular.ttf -FILE: ../../../third_party/skia/experimental/canvaskit/canvaskit/Roboto-Regular.ttf -FILE: ../../../third_party/skia/experimental/canvaskit/canvaskit/Roboto-Regular.woff -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/canvaskit/test.png -FILE: ../../../third_party/skia/experimental/canvaskit/cpu.js -FILE: ../../../third_party/skia/experimental/canvaskit/debug.js -FILE: ../../../third_party/skia/experimental/canvaskit/externs.js -FILE: ../../../third_party/skia/experimental/canvaskit/fonts/NotoMono-Regular.ttf -FILE: ../../../third_party/skia/experimental/canvaskit/gpu.js -FILE: ../../../third_party/skia/experimental/canvaskit/helper.js -FILE: ../../../third_party/skia/experimental/canvaskit/htmlcanvas/_namedcolors.js -FILE: ../../../third_party/skia/experimental/canvaskit/htmlcanvas/canvas2dcontext.js -FILE: ../../../third_party/skia/experimental/canvaskit/htmlcanvas/color.js -FILE: ../../../third_party/skia/experimental/canvaskit/htmlcanvas/font.js -FILE: ../../../third_party/skia/experimental/canvaskit/htmlcanvas/htmlcanvas.js -FILE: ../../../third_party/skia/experimental/canvaskit/htmlcanvas/imagedata.js -FILE: ../../../third_party/skia/experimental/canvaskit/htmlcanvas/lineargradient.js -FILE: ../../../third_party/skia/experimental/canvaskit/htmlcanvas/path2d.js -FILE: ../../../third_party/skia/experimental/canvaskit/htmlcanvas/pattern.js -FILE: ../../../third_party/skia/experimental/canvaskit/htmlcanvas/postamble.js -FILE: ../../../third_party/skia/experimental/canvaskit/htmlcanvas/preamble.js -FILE: ../../../third_party/skia/experimental/canvaskit/htmlcanvas/radialgradient.js -FILE: ../../../third_party/skia/experimental/canvaskit/htmlcanvas/util.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/canvaskit/postamble.js -FILE: ../../../third_party/skia/experimental/canvaskit/preamble.js -FILE: ../../../third_party/skia/experimental/canvaskit/ready.js -FILE: ../../../third_party/skia/experimental/canvaskit/release.js -FILE: ../../../third_party/skia/experimental/canvaskit/skottie.js FILE: ../../../third_party/skia/experimental/docs/animationCommon.js FILE: ../../../third_party/skia/experimental/docs/backend.js FILE: ../../../third_party/skia/experimental/docs/canvasBackend.js @@ -2414,6 +2376,46 @@ 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/canvaskit/canvaskit/NotoSerif-Regular.ttf +FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/Roboto-Regular.ttf +FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/Roboto-Regular.woff +FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/example.html +FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/node.example.js +FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/package.json +FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/test.png +FILE: ../../../third_party/skia/modules/canvaskit/cpu.js +FILE: ../../../third_party/skia/modules/canvaskit/debug.js +FILE: ../../../third_party/skia/modules/canvaskit/externs.js +FILE: ../../../third_party/skia/modules/canvaskit/fonts/NotoMono-Regular.ttf +FILE: ../../../third_party/skia/modules/canvaskit/gpu.js +FILE: ../../../third_party/skia/modules/canvaskit/helper.js +FILE: ../../../third_party/skia/modules/canvaskit/htmlcanvas/_namedcolors.js +FILE: ../../../third_party/skia/modules/canvaskit/htmlcanvas/canvas2dcontext.js +FILE: ../../../third_party/skia/modules/canvaskit/htmlcanvas/color.js +FILE: ../../../third_party/skia/modules/canvaskit/htmlcanvas/font.js +FILE: ../../../third_party/skia/modules/canvaskit/htmlcanvas/htmlcanvas.js +FILE: ../../../third_party/skia/modules/canvaskit/htmlcanvas/imagedata.js +FILE: ../../../third_party/skia/modules/canvaskit/htmlcanvas/lineargradient.js +FILE: ../../../third_party/skia/modules/canvaskit/htmlcanvas/path2d.js +FILE: ../../../third_party/skia/modules/canvaskit/htmlcanvas/pattern.js +FILE: ../../../third_party/skia/modules/canvaskit/htmlcanvas/postamble.js +FILE: ../../../third_party/skia/modules/canvaskit/htmlcanvas/preamble.js +FILE: ../../../third_party/skia/modules/canvaskit/htmlcanvas/radialgradient.js +FILE: ../../../third_party/skia/modules/canvaskit/htmlcanvas/util.js +FILE: ../../../third_party/skia/modules/canvaskit/interface.js +FILE: ../../../third_party/skia/modules/canvaskit/karma.bench.conf.js +FILE: ../../../third_party/skia/modules/canvaskit/karma.conf.js +FILE: ../../../third_party/skia/modules/canvaskit/package.json +FILE: ../../../third_party/skia/modules/canvaskit/perf/animation.bench.js +FILE: ../../../third_party/skia/modules/canvaskit/perf/assets/confetti.json +FILE: ../../../third_party/skia/modules/canvaskit/perf/assets/drinks.json +FILE: ../../../third_party/skia/modules/canvaskit/perf/assets/lego_loader.json +FILE: ../../../third_party/skia/modules/canvaskit/perf/assets/onboarding.json +FILE: ../../../third_party/skia/modules/canvaskit/postamble.js +FILE: ../../../third_party/skia/modules/canvaskit/preamble.js +FILE: ../../../third_party/skia/modules/canvaskit/ready.js +FILE: ../../../third_party/skia/modules/canvaskit/release.js +FILE: ../../../third_party/skia/modules/canvaskit/skottie.js FILE: ../../../third_party/skia/modules/pathkit/chaining.js FILE: ../../../third_party/skia/modules/pathkit/externs.js FILE: ../../../third_party/skia/modules/pathkit/helper.js @@ -4650,13 +4652,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== LIBRARY: skia -ORIGIN: ../../../third_party/skia/experimental/canvaskit/WasmAliases.h + ../../../third_party/skia/LICENSE +ORIGIN: ../../../third_party/skia/experimental/wasm-skp-debugger/debugger_bindings.cpp + ../../../third_party/skia/LICENSE TYPE: LicenseType.bsd -FILE: ../../../third_party/skia/experimental/canvaskit/WasmAliases.h -FILE: ../../../third_party/skia/experimental/canvaskit/particles_bindings.cpp -FILE: ../../../third_party/skia/experimental/canvaskit/skottie_bindings.cpp FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/debugger_bindings.cpp FILE: ../../../third_party/skia/gm/runtimecolorfilter.cpp +FILE: ../../../third_party/skia/modules/canvaskit/WasmAliases.h +FILE: ../../../third_party/skia/modules/canvaskit/particles_bindings.cpp +FILE: ../../../third_party/skia/modules/canvaskit/skottie_bindings.cpp FILE: ../../../third_party/skia/modules/particles/include/SkCurve.h FILE: ../../../third_party/skia/modules/particles/include/SkParticleAffector.h FILE: ../../../third_party/skia/modules/particles/include/SkParticleData.h @@ -4702,17 +4704,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== LIBRARY: skia -ORIGIN: ../../../third_party/skia/experimental/canvaskit/canvaskit_bindings.cpp + ../../../third_party/skia/LICENSE +ORIGIN: ../../../third_party/skia/fuzz/FuzzDrawFunctions.cpp + ../../../third_party/skia/LICENSE TYPE: LicenseType.bsd -FILE: ../../../third_party/skia/experimental/canvaskit/canvaskit_bindings.cpp -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 +FILE: ../../../third_party/skia/fuzz/FuzzDrawFunctions.cpp ---------------------------------------------------------------------------------------------------- -Copyright 2018 Google LLC +Copyright 2016 Mozilla Foundation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -4743,11 +4739,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== LIBRARY: skia -ORIGIN: ../../../third_party/skia/fuzz/FuzzDrawFunctions.cpp + ../../../third_party/skia/LICENSE +ORIGIN: ../../../third_party/skia/fuzz/FuzzEncoders.cpp + ../../../third_party/skia/LICENSE TYPE: LicenseType.bsd -FILE: ../../../third_party/skia/fuzz/FuzzDrawFunctions.cpp +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/canvaskit/canvaskit_bindings.cpp +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 2016 Mozilla Foundation +Copyright 2018 Google LLC Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -4873,6 +4875,7 @@ ORIGIN: ../../../third_party/skia/gm/backdrop.cpp + ../../../third_party/skia/LI TYPE: LicenseType.bsd FILE: ../../../third_party/skia/gm/backdrop.cpp FILE: ../../../third_party/skia/gm/compositor_quads.cpp +FILE: ../../../third_party/skia/gm/crbug_938592.cpp FILE: ../../../third_party/skia/gm/mac_aa_explorer.cpp FILE: ../../../third_party/skia/gm/mixercolorfilter.cpp FILE: ../../../third_party/skia/gm/samplelocations.cpp @@ -4885,6 +4888,7 @@ FILE: ../../../third_party/skia/include/private/SkVx.h FILE: ../../../third_party/skia/modules/sksg/include/SkSGRenderEffect.h FILE: ../../../third_party/skia/modules/sksg/src/SkSGRenderEffect.cpp FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h +FILE: ../../../third_party/skia/samplecode/SampleDegenerateQuads.cpp FILE: ../../../third_party/skia/samplecode/SampleSG.cpp FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp From 52b67fdd5a9079cc7f668aa792d35cd00f5f90c7 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Mon, 11 Mar 2019 16:43:11 -0700 Subject: [PATCH 0416/1117] Expose decorationThickness to dart:ui (#8008) --- lib/stub_ui/text.dart | 61 +++++---- lib/ui/text.dart | 133 +++++++++++++------ lib/ui/text/paragraph_builder.cc | 55 +++++--- lib/ui/text/paragraph_builder.h | 1 + third_party/txt/tests/paragraph_unittests.cc | 17 +++ 5 files changed, 185 insertions(+), 82 deletions(-) diff --git a/lib/stub_ui/text.dart b/lib/stub_ui/text.dart index bc152addb837a..e523490d18603 100644 --- a/lib/stub_ui/text.dart +++ b/lib/stub_ui/text.dart @@ -265,6 +265,7 @@ Int32List _encodeTextStyle( TextDecoration decoration, Color decorationColor, TextDecorationStyle decorationStyle, + double decorationThickness, FontWeight fontWeight, FontStyle fontStyle, TextBaseline textBaseline, @@ -296,20 +297,23 @@ Int32List _encodeTextStyle( result[0] |= 1 << 4; result[4] = decorationStyle.index; } - if (fontWeight != null) { + if (decorationThickness != null) { result[0] |= 1 << 5; + } + if (fontWeight != null) { + result[0] |= 1 << 6; result[5] = fontWeight.index; } if (fontStyle != null) { - result[0] |= 1 << 6; + result[0] |= 1 << 7; result[6] = fontStyle.index; } if (textBaseline != null) { - result[0] |= 1 << 7; + result[0] |= 1 << 8; result[7] = textBaseline.index; } if (fontFamily != null || (fontFamilyFallback != null && fontFamilyFallback.isNotEmpty)) { - result[0] |= 1 << 8; + result[0] |= 1 << 9; // Passed separately to native. } if (fontSize != null) { @@ -355,6 +359,7 @@ class TextStyle { /// * `decoration`: The decorations to paint near the text (e.g., an underline). /// * `decorationColor`: The color in which to paint the text decorations. /// * `decorationStyle`: The style in which to paint the text decorations (e.g., dashed). + /// * `decorationThickness`: The thickness of the decoration as a muliplier on the thickness specified by the font. /// * `fontWeight`: The typeface thickness to use when painting the text (e.g., bold). /// * `fontStyle`: The typeface variant to use when drawing the letters (e.g., italics). /// * `fontFamily`: The name of the font to use when painting the text (e.g., Roboto). If a `fontFamilyFallback` is @@ -379,6 +384,7 @@ class TextStyle { TextDecoration decoration, Color decorationColor, TextDecorationStyle decorationStyle, + double decorationThickness, FontWeight fontWeight, FontStyle fontStyle, TextBaseline textBaseline, @@ -401,6 +407,7 @@ class TextStyle { decoration, decorationColor, decorationStyle, + decorationThickness, fontWeight, fontStyle, textBaseline, @@ -421,6 +428,7 @@ class TextStyle { _letterSpacing = letterSpacing, _wordSpacing = wordSpacing, _height = height, + _decorationThickness = decorationThickness, _locale = locale, _background = background, _foreground = foreground, @@ -433,6 +441,7 @@ class TextStyle { final double _letterSpacing; final double _wordSpacing; final double _height; + final double _decorationThickness; final Locale _locale; final Paint _background; final Paint _foreground; @@ -450,6 +459,7 @@ class TextStyle { _letterSpacing != typedOther._letterSpacing || _wordSpacing != typedOther._wordSpacing || _height != typedOther._height || + _decorationThickness != typedOther._decorationThickness || _locale != typedOther._locale || _background != typedOther._background || _foreground != typedOther._foreground) @@ -466,31 +476,32 @@ class TextStyle { } @override - int get hashCode => hashValues(hashList(_encoded), _fontFamily, _fontFamilyFallback, _fontSize, _letterSpacing, _wordSpacing, _height, _locale, _background, _foreground, _shadows); + int get hashCode => hashValues(hashList(_encoded), _fontFamily, _fontFamilyFallback, _fontSize, _letterSpacing, _wordSpacing, _height, _locale, _background, _foreground, _shadows, _decorationThickness); @override String toString() { return 'TextStyle(' - '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 != null ? _fontFamily : "unspecified"}, ' - 'fontFamilyFallback: ${_encoded[0] & 0x00100 == 0x00100 - && _fontFamilyFallback != null - && _fontFamilyFallback.isNotEmpty ? _fontFamilyFallback : "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"}' + '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"}, ' + 'decorationThickness: ${_encoded[0] & 0x00020 == 0x00020 ? _decorationThickness : "unspecified"}, ' + 'fontWeight: ${ _encoded[0] & 0x00040 == 0x00040 ? FontWeight.values[_encoded[5]] : "unspecified"}, ' + 'fontStyle: ${ _encoded[0] & 0x00080 == 0x00080 ? FontStyle.values[_encoded[6]] : "unspecified"}, ' + 'textBaseline: ${ _encoded[0] & 0x00100 == 0x00100 ? TextBaseline.values[_encoded[7]] : "unspecified"}, ' + 'fontFamily: ${ _encoded[0] & 0x00200 == 0x00200 + && _fontFamily != null ? _fontFamily : "unspecified"}, ' + 'fontFamilyFallback: ${ _encoded[0] & 0x00200 == 0x00200 + && _fontFamilyFallback != null + && _fontFamilyFallback.isNotEmpty ? _fontFamilyFallback : "unspecified"}, ' + 'fontSize: ${ _encoded[0] & 0x00400 == 0x00400 ? _fontSize : "unspecified"}, ' + 'letterSpacing: ${ _encoded[0] & 0x00800 == 0x00800 ? "${_letterSpacing}x" : "unspecified"}, ' + 'wordSpacing: ${ _encoded[0] & 0x01000 == 0x01000 ? "${_wordSpacing}x" : "unspecified"}, ' + 'height: ${ _encoded[0] & 0x02000 == 0x02000 ? "${_height}x" : "unspecified"}, ' + 'locale: ${ _encoded[0] & 0x04000 == 0x04000 ? _locale : "unspecified"}, ' + 'background: ${ _encoded[0] & 0x08000 == 0x08000 ? _background : "unspecified"}, ' + 'foreground: ${ _encoded[0] & 0x10000 == 0x10000 ? _foreground : "unspecified"}, ' + 'shadows: ${ _encoded[0] & 0x20000 == 0x20000 ? _shadows : "unspecified"}' ')'; } } diff --git a/lib/ui/text.dart b/lib/ui/text.dart index 1eff826ad2c6c..09f2d95ce68a6 100644 --- a/lib/ui/text.dart +++ b/lib/ui/text.dart @@ -265,6 +265,7 @@ Int32List _encodeTextStyle( TextDecoration decoration, Color decorationColor, TextDecorationStyle decorationStyle, + double decorationThickness, FontWeight fontWeight, FontStyle fontStyle, TextBaseline textBaseline, @@ -296,52 +297,55 @@ Int32List _encodeTextStyle( result[0] |= 1 << 4; result[4] = decorationStyle.index; } - if (fontWeight != null) { + if (decorationThickness != null) { result[0] |= 1 << 5; + } + if (fontWeight != null) { + result[0] |= 1 << 6; result[5] = fontWeight.index; } if (fontStyle != null) { - result[0] |= 1 << 6; + result[0] |= 1 << 7; result[6] = fontStyle.index; } if (textBaseline != null) { - result[0] |= 1 << 7; + result[0] |= 1 << 8; result[7] = textBaseline.index; } if (fontFamily != null || (fontFamilyFallback != null && fontFamilyFallback.isNotEmpty)) { - result[0] |= 1 << 8; + result[0] |= 1 << 9; // Passed separately to native. } if (fontSize != null) { - result[0] |= 1 << 9; + result[0] |= 1 << 10; // Passed separately to native. } if (letterSpacing != null) { - result[0] |= 1 << 10; + result[0] |= 1 << 11; // Passed separately to native. } if (wordSpacing != null) { - result[0] |= 1 << 11; + result[0] |= 1 << 12; // Passed separately to native. } if (height != null) { - result[0] |= 1 << 12; + result[0] |= 1 << 13; // Passed separately to native. } if (locale != null) { - result[0] |= 1 << 13; + result[0] |= 1 << 14; // Passed separately to native. } if (background != null) { - result[0] |= 1 << 14; + result[0] |= 1 << 15; // Passed separately to native. } if (foreground != null) { - result[0] |= 1 << 15; + result[0] |= 1 << 16; // Passed separately to native. } if (shadows != null) { - result[0] |= 1 << 16; + result[0] |= 1 << 17; // Passed separately to native. } return result; @@ -355,6 +359,7 @@ class TextStyle { /// * `decoration`: The decorations to paint near the text (e.g., an underline). /// * `decorationColor`: The color in which to paint the text decorations. /// * `decorationStyle`: The style in which to paint the text decorations (e.g., dashed). + /// * `decorationThickness`: The thickness of the decoration as a muliplier on the thickness specified by the font. /// * `fontWeight`: The typeface thickness to use when painting the text (e.g., bold). /// * `fontStyle`: The typeface variant to use when drawing the letters (e.g., italics). /// * `fontFamily`: The name of the font to use when painting the text (e.g., Roboto). If a `fontFamilyFallback` is @@ -379,6 +384,7 @@ class TextStyle { TextDecoration decoration, Color decorationColor, TextDecorationStyle decorationStyle, + double decorationThickness, FontWeight fontWeight, FontStyle fontStyle, TextBaseline textBaseline, @@ -401,6 +407,7 @@ class TextStyle { decoration, decorationColor, decorationStyle, + decorationThickness, fontWeight, fontStyle, textBaseline, @@ -421,6 +428,7 @@ class TextStyle { _letterSpacing = letterSpacing, _wordSpacing = wordSpacing, _height = height, + _decorationThickness = decorationThickness, _locale = locale, _background = background, _foreground = foreground, @@ -433,6 +441,7 @@ class TextStyle { final double _letterSpacing; final double _wordSpacing; final double _height; + final double _decorationThickness; final Locale _locale; final Paint _background; final Paint _foreground; @@ -450,6 +459,7 @@ class TextStyle { _letterSpacing != typedOther._letterSpacing || _wordSpacing != typedOther._wordSpacing || _height != typedOther._height || + _decorationThickness != typedOther._decorationThickness || _locale != typedOther._locale || _background != typedOther._background || _foreground != typedOther._foreground) @@ -466,31 +476,32 @@ class TextStyle { } @override - int get hashCode => hashValues(hashList(_encoded), _fontFamily, _fontFamilyFallback, _fontSize, _letterSpacing, _wordSpacing, _height, _locale, _background, _foreground, _shadows); + int get hashCode => hashValues(hashList(_encoded), _fontFamily, _fontFamilyFallback, _fontSize, _letterSpacing, _wordSpacing, _height, _locale, _background, _foreground, _shadows, _decorationThickness); @override String toString() { return 'TextStyle(' - '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 != null ? _fontFamily : "unspecified"}, ' - 'fontFamilyFallback: ${_encoded[0] & 0x00100 == 0x00100 - && _fontFamilyFallback != null - && _fontFamilyFallback.isNotEmpty ? _fontFamilyFallback : "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"}' + '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"}, ' + 'decorationThickness: ${_encoded[0] & 0x00020 == 0x00020 ? _decorationThickness : "unspecified"}, ' + 'fontWeight: ${ _encoded[0] & 0x00040 == 0x00040 ? FontWeight.values[_encoded[5]] : "unspecified"}, ' + 'fontStyle: ${ _encoded[0] & 0x00080 == 0x00080 ? FontStyle.values[_encoded[6]] : "unspecified"}, ' + 'textBaseline: ${ _encoded[0] & 0x00100 == 0x00100 ? TextBaseline.values[_encoded[7]] : "unspecified"}, ' + 'fontFamily: ${ _encoded[0] & 0x00200 == 0x00200 + && _fontFamily != null ? _fontFamily : "unspecified"}, ' + 'fontFamilyFallback: ${ _encoded[0] & 0x00200 == 0x00200 + && _fontFamilyFallback != null + && _fontFamilyFallback.isNotEmpty ? _fontFamilyFallback : "unspecified"}, ' + 'fontSize: ${ _encoded[0] & 0x00400 == 0x00400 ? _fontSize : "unspecified"}, ' + 'letterSpacing: ${ _encoded[0] & 0x00800 == 0x00800 ? "${_letterSpacing}x" : "unspecified"}, ' + 'wordSpacing: ${ _encoded[0] & 0x01000 == 0x01000 ? "${_wordSpacing}x" : "unspecified"}, ' + 'height: ${ _encoded[0] & 0x02000 == 0x02000 ? "${_height}x" : "unspecified"}, ' + 'locale: ${ _encoded[0] & 0x04000 == 0x04000 ? _locale : "unspecified"}, ' + 'background: ${ _encoded[0] & 0x08000 == 0x08000 ? _background : "unspecified"}, ' + 'foreground: ${ _encoded[0] & 0x10000 == 0x10000 ? _foreground : "unspecified"}, ' + 'shadows: ${ _encoded[0] & 0x20000 == 0x20000 ? _shadows : "unspecified"}' ')'; } } @@ -1396,9 +1407,28 @@ class ParagraphBuilder extends NativeFieldWrapperClass2 { if (style._strutStyle._fontFamilyFallback != null) strutFontFamilies.addAll(style._strutStyle._fontFamilyFallback); } - _constructor(style._encoded, style._strutStyle?._encoded, style._fontFamily, strutFontFamilies, style._fontSize, style._height, style._ellipsis, _encodeLocale(style._locale)); + _constructor( + style._encoded, + style._strutStyle?._encoded, + style._fontFamily, + strutFontFamilies, + style._fontSize, + style._height, + style._ellipsis, + _encodeLocale(style._locale) + ); } - void _constructor(Int32List encoded, ByteData strutData, String fontFamily, List strutFontFamily, double fontSize, double height, String ellipsis, String locale) native 'ParagraphBuilder_constructor'; + + void _constructor( + Int32List encoded, + ByteData strutData, + String fontFamily, + List strutFontFamily, + double fontSize, + double height, + String ellipsis, + String locale + ) native 'ParagraphBuilder_constructor'; /// Applies the given style to the added text until [pop] is called. /// @@ -1409,9 +1439,38 @@ class ParagraphBuilder extends NativeFieldWrapperClass2 { fullFontFamilies.add(style._fontFamily); if (style._fontFamilyFallback != null) fullFontFamilies.addAll(style._fontFamilyFallback); - _pushStyle(style._encoded, fullFontFamilies, 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)); + _pushStyle( + style._encoded, + fullFontFamilies, + style._fontSize, + style._letterSpacing, + style._wordSpacing, + style._height, + style._decorationThickness, + _encodeLocale(style._locale), + style._background?._objects, + style._background?._data, + style._foreground?._objects, + style._foreground?._data, + Shadow._encodeShadows(style._shadows) + ); } - void _pushStyle(Int32List encoded, List fontFamilies, double fontSize, double letterSpacing, double wordSpacing, double height, String locale, List backgroundObjects, ByteData backgroundData, List foregroundObjects, ByteData foregroundData, ByteData shadowsData) native 'ParagraphBuilder_pushStyle'; + + void _pushStyle( + Int32List encoded, + List fontFamilies, + double fontSize, + double letterSpacing, + double wordSpacing, + double height, + double decorationThickness, + String locale, + List backgroundObjects, + ByteData backgroundData, + List foregroundObjects, + ByteData foregroundData, + ByteData shadowsData + ) native 'ParagraphBuilder_pushStyle'; static String _encodeLocale(Locale locale) => locale?.toString() ?? ''; diff --git a/lib/ui/text/paragraph_builder.cc b/lib/ui/text/paragraph_builder.cc index b6a2c2463cd40..3633fc3546d25 100644 --- a/lib/ui/text/paragraph_builder.cc +++ b/lib/ui/text/paragraph_builder.cc @@ -33,23 +33,25 @@ const int tsColorIndex = 1; const int tsTextDecorationIndex = 2; const int tsTextDecorationColorIndex = 3; const int tsTextDecorationStyleIndex = 4; -const int tsFontWeightIndex = 5; -const int tsFontStyleIndex = 6; -const int tsTextBaselineIndex = 7; -const int tsFontFamilyIndex = 8; -const int tsFontSizeIndex = 9; -const int tsLetterSpacingIndex = 10; -const int tsWordSpacingIndex = 11; -const int tsHeightIndex = 12; -const int tsLocaleIndex = 13; -const int tsBackgroundIndex = 14; -const int tsForegroundIndex = 15; -const int tsTextShadowsIndex = 16; +const int tsTextDecorationThicknessIndex = 5; +const int tsFontWeightIndex = 6; +const int tsFontStyleIndex = 7; +const int tsTextBaselineIndex = 8; +const int tsFontFamilyIndex = 9; +const int tsFontSizeIndex = 10; +const int tsLetterSpacingIndex = 11; +const int tsWordSpacingIndex = 12; +const int tsHeightIndex = 13; +const int tsLocaleIndex = 14; +const int tsBackgroundIndex = 15; +const int tsForegroundIndex = 16; +const int tsTextShadowsIndex = 17; const int tsColorMask = 1 << tsColorIndex; const int tsTextDecorationMask = 1 << tsTextDecorationIndex; const int tsTextDecorationColorMask = 1 << tsTextDecorationColorIndex; const int tsTextDecorationStyleMask = 1 << tsTextDecorationStyleIndex; +const int tsTextDecorationThicknessMask = 1 << tsTextDecorationThicknessIndex; const int tsFontWeightMask = 1 << tsFontWeightIndex; const int tsFontStyleMask = 1 << tsFontStyleIndex; const int tsTextBaselineMask = 1 << tsTextBaselineIndex; @@ -224,11 +226,13 @@ ParagraphBuilder::ParagraphBuilder( int32_t mask = encoded[0]; txt::ParagraphStyle style; - if (mask & psTextAlignMask) + if (mask & psTextAlignMask) { style.text_align = txt::TextAlign(encoded[psTextAlignIndex]); + } - if (mask & psTextDirectionMask) + if (mask & psTextDirectionMask) { style.text_direction = txt::TextDirection(encoded[psTextDirectionIndex]); + } if (mask & psFontWeightMask) { style.font_weight = @@ -255,14 +259,17 @@ ParagraphBuilder::ParagraphBuilder( decodeStrut(strutData, strutFontFamilies, style); } - if (mask & psMaxLinesMask) + 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(); @@ -302,6 +309,7 @@ void ParagraphBuilder::pushStyle(tonic::Int32List& encoded, double letterSpacing, double wordSpacing, double height, + double decorationThickness, const std::string& locale, Dart_Handle background_objects, Dart_Handle background_data, @@ -318,20 +326,27 @@ void ParagraphBuilder::pushStyle(tonic::Int32List& encoded, // Only change the style property from the previous value if a new explicitly // set value is available - if (mask & tsColorMask) + if (mask & tsColorMask) { style.color = encoded[tsColorIndex]; + } if (mask & tsTextDecorationMask) { style.decoration = static_cast(encoded[tsTextDecorationIndex]); } - if (mask & tsTextDecorationColorMask) + if (mask & tsTextDecorationColorMask) { style.decoration_color = encoded[tsTextDecorationColorIndex]; + } - if (mask & tsTextDecorationStyleMask) + if (mask & tsTextDecorationStyleMask) { style.decoration_style = static_cast( encoded[tsTextDecorationStyleIndex]); + } + + if (mask & tsTextDecorationThicknessMask) { + style.decoration_thickness_multiplier = decorationThickness; + } if (mask & tsTextBaselineMask) { // TODO(abarth): Implement TextBaseline. The CSS version of this diff --git a/lib/ui/text/paragraph_builder.h b/lib/ui/text/paragraph_builder.h index 6370e45fc708d..9ef52fbe4c0d6 100644 --- a/lib/ui/text/paragraph_builder.h +++ b/lib/ui/text/paragraph_builder.h @@ -43,6 +43,7 @@ class ParagraphBuilder : public RefCountedDartWrappable { double letterSpacing, double wordSpacing, double height, + double decorationThickness, const std::string& locale, Dart_Handle background_objects, Dart_Handle background_data, diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index ef5966236c787..7d09928f44f90 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -740,11 +740,13 @@ TEST_F(ParagraphTest, DecorationsParagraph) { TextDecoration::kLineThrough; text_style.decoration_style = txt::TextDecorationStyle::kSolid; text_style.decoration_color = SK_ColorBLACK; + text_style.decoration_thickness_multiplier = 2.0; builder.PushStyle(text_style); builder.AddText("This text should be"); text_style.decoration_style = txt::TextDecorationStyle::kDouble; text_style.decoration_color = SK_ColorBLUE; + text_style.decoration_thickness_multiplier = 1.0; builder.PushStyle(text_style); builder.AddText(" decorated even when"); @@ -755,11 +757,13 @@ TEST_F(ParagraphTest, DecorationsParagraph) { text_style.decoration_style = txt::TextDecorationStyle::kDashed; text_style.decoration_color = SK_ColorBLACK; + text_style.decoration_thickness_multiplier = 3.0; builder.PushStyle(text_style); builder.AddText(" the next line."); text_style.decoration_style = txt::TextDecorationStyle::kWavy; text_style.decoration_color = SK_ColorRED; + text_style.decoration_thickness_multiplier = 1.0; builder.PushStyle(text_style); builder.AddText(" Otherwise, bad things happen."); @@ -800,6 +804,19 @@ TEST_F(ParagraphTest, DecorationsParagraph) { ASSERT_EQ(paragraph->records_[3].style().decoration_color, SK_ColorBLACK); ASSERT_EQ(paragraph->records_[4].style().decoration_color, SK_ColorBLACK); ASSERT_EQ(paragraph->records_[5].style().decoration_color, SK_ColorRED); + + ASSERT_EQ(paragraph->records_[0].style().decoration_thickness_multiplier, + 2.0); + ASSERT_EQ(paragraph->records_[1].style().decoration_thickness_multiplier, + 1.0); + ASSERT_EQ(paragraph->records_[2].style().decoration_thickness_multiplier, + 1.0); + ASSERT_EQ(paragraph->records_[3].style().decoration_thickness_multiplier, + 3.0); + ASSERT_EQ(paragraph->records_[4].style().decoration_thickness_multiplier, + 3.0); + ASSERT_EQ(paragraph->records_[5].style().decoration_thickness_multiplier, + 1.0); } TEST_F(ParagraphTest, ItalicsParagraph) { From 8f7b183454b35f545c3fb10da18fe2ec32e498ba Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 11 Mar 2019 23:12:55 -0400 Subject: [PATCH 0417/1117] Roll src/third_party/skia c6d8781c4036..2932a458957d (2 commits) (#8125) https://skia.googlesource.com/skia.git/%2Blog/c6d8781c4036..2932a458957d git log c6d8781c4036cd64a3fbf185ca18b9ff3def8cfd..2932a458957db80b510abb83454f3b0b24af863a --date=short --no-merges --format=%ad %ae %s 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 654540e86243..3364227fa0d8 (1 commits) 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms c6c0aae921ea..04a7830913b3 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 39c4af2ae5629..b5103026ced63 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': 'c6d8781c4036cd64a3fbf185ca18b9ff3def8cfd', + 'skia_revision': '2932a458957db80b510abb83454f3b0b24af863a', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index fa965f5befc73..3180b88d97610 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 1f8afd011d49d76a6bb68cf8f1c1236e +Signature: 06aaf4a09d1af119c35e3899c5c8f024 UNUSED LICENSES: From 8b0df6ded554fd650ef1917e0654a3d78cb8b148 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Mon, 11 Mar 2019 23:45:03 -0700 Subject: [PATCH 0418/1117] Bugfix #29203: NPE in getAccessibilityProvider in old FlutterView. (#8126) --- shell/platform/android/io/flutter/view/FlutterView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 8a97164ceaae5..c8fc94e5a6185 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -694,7 +694,7 @@ private void resetWillNotDraw(boolean isAccessibilityEnabled, boolean isTouchExp @Override public AccessibilityNodeProvider getAccessibilityNodeProvider() { - if (mAccessibilityNodeProvider.isAccessibilityEnabled()) { + if (mAccessibilityNodeProvider != null && mAccessibilityNodeProvider.isAccessibilityEnabled()) { return mAccessibilityNodeProvider; } else { // TODO(goderbauer): when a11y is off this should return a one-off snapshot of From f666adbbda24a80a3bd971ec860e3c7f9c302d85 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 12 Mar 2019 03:43:54 -0400 Subject: [PATCH 0419/1117] Roll src/third_party/skia 2932a458957d..762ddd7e4352 (3 commits) (#8128) https://skia.googlesource.com/skia.git/%2Blog/2932a458957d..762ddd7e4352 git log 2932a458957db80b510abb83454f3b0b24af863a..762ddd7e4352cc8ecb8cd1f7ef9d4c8dbea56669 --date=short --no-merges --format=%ad %ae %s 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 f563fdc91e83..c9bc33cff483 (2 commits) 2019-03-12 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src ba6c026602da..37fe521d6049 (397 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index b5103026ced63..5c82c2d844ea8 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': '2932a458957db80b510abb83454f3b0b24af863a', + 'skia_revision': '762ddd7e4352cc8ecb8cd1f7ef9d4c8dbea56669', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3180b88d97610..117053d5bb3fe 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 06aaf4a09d1af119c35e3899c5c8f024 +Signature: 9316f1d822692d53481bc62c2d94d3eb UNUSED LICENSES: From 48efd0fb76b9ee69fc54b65cf5d12bf8f44a206b Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 12 Mar 2019 07:13:55 -0400 Subject: [PATCH 0420/1117] Roll src/third_party/skia 762ddd7e4352..665bc64a2dc4 (2 commits) (#8129) https://skia.googlesource.com/skia.git/%2Blog/762ddd7e4352..665bc64a2dc4 git log 762ddd7e4352cc8ecb8cd1f7ef9d4c8dbea56669..665bc64a2dc41cfa36a471dc01e37c28f2def2b4 --date=short --no-merges --format=%ad %ae %s 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3e2a4780e607..abb57857c536 (3 commits) 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3364227fa0d8..3e2a4780e607 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 5c82c2d844ea8..08d53e92077a0 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': '762ddd7e4352cc8ecb8cd1f7ef9d4c8dbea56669', + 'skia_revision': '665bc64a2dc41cfa36a471dc01e37c28f2def2b4', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 117053d5bb3fe..b9685047c805f 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 9316f1d822692d53481bc62c2d94d3eb +Signature: f273dca586b4d4128723611e149ca435 UNUSED LICENSES: From ffef51be60b38ba34fd6ab810c603117adaec355 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 12 Mar 2019 12:02:57 -0400 Subject: [PATCH 0421/1117] Roll src/third_party/skia 665bc64a2dc4..406b068942f0 (8 commits) (#8137) https://skia.googlesource.com/skia.git/%2Blog/665bc64a2dc4..406b068942f0 git log 665bc64a2dc41cfa36a471dc01e37c28f2def2b4..406b068942f00a729dd03461b723ac04bda61b43 --date=short --no-merges --format=%ad %ae %s 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader abb57857c536..6193cb187e4a (1 commits) 2019-03-12 gkaiser@google.com GrQuadPerEdgeAA: Fix typo in 'if' check 2019-03-12 kjlubick@google.com [pathkit] Clean up perf/test init 2019-03-12 bsalomon@google.com Revert "Reintroduce deinstantiate lazy proxy types and use for promise images." 2019-03-11 robertphillips@google.com Always explicitly allocate except in Android Framework (take 2) 2019-03-12 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-11 brianosman@google.com Remove SkToSRGBColorFilter (now unused) 2019-03-12 rmistry@google.com Add new recipe autoroller service account to list of recognized accounts The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/DEPS b/DEPS index 08d53e92077a0..e10d8313664f5 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': '665bc64a2dc41cfa36a471dc01e37c28f2def2b4', + 'skia_revision': '406b068942f00a729dd03461b723ac04bda61b43', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b9685047c805f..6feb916aa0410 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f273dca586b4d4128723611e149ca435 +Signature: a4c67abd90b802f779c15f927456b53d UNUSED LICENSES: @@ -1717,8 +1717,6 @@ FILE: ../../../third_party/skia/src/effects/SkTrimPE.h FILE: ../../../third_party/skia/src/effects/SkTrimPathEffect.cpp FILE: ../../../third_party/skia/src/gpu/GrContextThreadSafeProxyPriv.h FILE: ../../../third_party/skia/src/gpu/GrDDLContext.cpp -FILE: ../../../third_party/skia/src/gpu/GrDeinstantiateProxyTracker.cpp -FILE: ../../../third_party/skia/src/gpu/GrDeinstantiateProxyTracker.h FILE: ../../../third_party/skia/src/gpu/GrDriverBugWorkarounds.cpp FILE: ../../../third_party/skia/src/gpu/GrFPArgs.h FILE: ../../../third_party/skia/src/gpu/GrLegacyDirectContext.cpp @@ -4232,7 +4230,6 @@ FILE: ../../../third_party/skia/gm/srgb.cpp FILE: ../../../third_party/skia/gm/testgradient.cpp FILE: ../../../third_party/skia/gm/text_scale_skew.cpp FILE: ../../../third_party/skia/gm/thinconcavepaths.cpp -FILE: ../../../third_party/skia/gm/tosrgb_colorfilter.cpp FILE: ../../../third_party/skia/include/android/SkAndroidFrameworkUtils.h FILE: ../../../third_party/skia/include/atlastext/SkAtlasTextContext.h FILE: ../../../third_party/skia/include/atlastext/SkAtlasTextFont.h @@ -4249,7 +4246,6 @@ FILE: ../../../third_party/skia/include/core/SkSurfaceCharacterization.h FILE: ../../../third_party/skia/include/core/SkVertices.h FILE: ../../../third_party/skia/include/docs/SkXPSDocument.h FILE: ../../../third_party/skia/include/effects/SkHighContrastFilter.h -FILE: ../../../third_party/skia/include/effects/SkToSRGBColorFilter.h FILE: ../../../third_party/skia/include/encode/SkEncoder.h FILE: ../../../third_party/skia/include/encode/SkJpegEncoder.h FILE: ../../../third_party/skia/include/encode/SkPngEncoder.h @@ -4421,7 +4417,6 @@ FILE: ../../../third_party/skia/src/core/SkVptr.h FILE: ../../../third_party/skia/src/core/SkWritePixelsRec.h FILE: ../../../third_party/skia/src/effects/SkDashImpl.h FILE: ../../../third_party/skia/src/effects/SkHighContrastFilter.cpp -FILE: ../../../third_party/skia/src/effects/SkToSRGBColorFilter.cpp FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferImageGenerator.cpp FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferImageGenerator.h FILE: ../../../third_party/skia/src/gpu/GrBackendSurface.cpp From 5cef4a022ddd30dc8b541b963659b56d68ea91e1 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Tue, 12 Mar 2019 10:35:08 -0700 Subject: [PATCH 0422/1117] Use final state passed to dart before initialization as the initial lifecycleState. (#8124) --- lib/ui/hooks.dart | 5 ++++- lib/ui/window.dart | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index 4d299c91a24ed..c7b18b6d34d60 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -92,7 +92,10 @@ void _updateUserSettingsData(String jsonData) { @pragma('vm:entry-point') // ignore: unused_element void _updateLifecycleState(String state) { - window._initialLifecycleState ??= state; + // We do not update the state if the state has already been used to initialize + // the lifecycleState. + if (!window._initialLifecycleStateAccessed) + window._initialLifecycleState = state; } diff --git a/lib/ui/window.dart b/lib/ui/window.dart index 6abceceb0261c..27a8902d2b3ef 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -562,8 +562,15 @@ class Window { /// /// It is used to initialize [SchedulerBinding.lifecycleState] at startup /// with any buffered lifecycle state events. - String get initialLifecycleState => _initialLifecycleState; + String get initialLifecycleState { + _initialLifecycleStateAccessed = true; + return _initialLifecycleState; + } String _initialLifecycleState; + /// Tracks if the initial state has been accessed. Once accessed, we + /// will stop updating the [initialLifecycleState], as it is not the + /// preferred way to access the state. + bool _initialLifecycleStateAccessed = false; /// The system-reported text scale. /// From d87d29054dd83c02757206c045e84e59b526b909 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 12 Mar 2019 16:31:55 -0400 Subject: [PATCH 0423/1117] Roll src/third_party/skia 406b068942f0..2eecc3ea3d71 (11 commits) (#8138) https://skia.googlesource.com/skia.git/%2Blog/406b068942f0..2eecc3ea3d71 git log 406b068942f00a729dd03461b723ac04bda61b43..2eecc3ea3d71613463fe2816c3852e1f6c99105b --date=short --no-merges --format=%ad %ae %s 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 6a1d92b526d4..7ce5de0c17bd (5 commits) 2019-03-12 jcgregorio@google.com Turn on CI/CD for api.skia.org. (skia) 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 6193cb187e4a..6a1d92b526d4 (1 commits) 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms 04a7830913b3..10ed3a8a5eec (1 commits) 2019-03-12 mtklein@google.com simplify filterColor() 2019-03-12 robertphillips@google.com Revert "Always explicitly allocate except in Android Framework (take 2)" 2019-03-12 kjlubick@google.com [particles] Turn on CI/CD for particles.skia.org 2019-03-12 robertphillips@google.com Revert "Always try to reduce opList splitting in DDL contexts/drawingManagers" 2019-03-12 robertphillips@google.com Revert "Temporarily re-add GrContextOptions::fExplicitlyAllocateGPUResources for Fuchsia" 2019-03-11 robertphillips@google.com Always try to reduce opList splitting in DDL contexts/drawingManagers 2019-03-12 robertphillips@google.com Temporarily re-add GrContextOptions::fExplicitlyAllocateGPUResources for Fuchsia The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index e10d8313664f5..1988f3f21b8a7 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': '406b068942f00a729dd03461b723ac04bda61b43', + 'skia_revision': '2eecc3ea3d71613463fe2816c3852e1f6c99105b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6feb916aa0410..4a14a592da226 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: a4c67abd90b802f779c15f927456b53d +Signature: c96897f617fbf476f372b7b6c0239d6a UNUSED LICENSES: From 073aadde14baac41e2cd2a4a89f87dd0cc651512 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Tue, 12 Mar 2019 13:55:31 -0700 Subject: [PATCH 0424/1117] Fix TextStyle decode misalignment (#8141) --- lib/ui/text.dart | 12 ++++++------ lib/ui/text/paragraph_builder.cc | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/ui/text.dart b/lib/ui/text.dart index 09f2d95ce68a6..faa7032121853 100644 --- a/lib/ui/text.dart +++ b/lib/ui/text.dart @@ -297,21 +297,21 @@ Int32List _encodeTextStyle( result[0] |= 1 << 4; result[4] = decorationStyle.index; } - if (decorationThickness != null) { - result[0] |= 1 << 5; - } if (fontWeight != null) { - result[0] |= 1 << 6; + result[0] |= 1 << 5; result[5] = fontWeight.index; } if (fontStyle != null) { - result[0] |= 1 << 7; + result[0] |= 1 << 6; result[6] = fontStyle.index; } if (textBaseline != null) { - result[0] |= 1 << 8; + result[0] |= 1 << 7; result[7] = textBaseline.index; } + if (decorationThickness != null) { + result[0] |= 1 << 8; + } if (fontFamily != null || (fontFamilyFallback != null && fontFamilyFallback.isNotEmpty)) { result[0] |= 1 << 9; // Passed separately to native. diff --git a/lib/ui/text/paragraph_builder.cc b/lib/ui/text/paragraph_builder.cc index 3633fc3546d25..da8a4366ccbcc 100644 --- a/lib/ui/text/paragraph_builder.cc +++ b/lib/ui/text/paragraph_builder.cc @@ -33,10 +33,10 @@ const int tsColorIndex = 1; const int tsTextDecorationIndex = 2; const int tsTextDecorationColorIndex = 3; const int tsTextDecorationStyleIndex = 4; -const int tsTextDecorationThicknessIndex = 5; -const int tsFontWeightIndex = 6; -const int tsFontStyleIndex = 7; -const int tsTextBaselineIndex = 8; +const int tsFontWeightIndex = 5; +const int tsFontStyleIndex = 6; +const int tsTextBaselineIndex = 7; +const int tsTextDecorationThicknessIndex = 8; const int tsFontFamilyIndex = 9; const int tsFontSizeIndex = 10; const int tsLetterSpacingIndex = 11; From 0f19b2de064a4f7e40324ecaadc5be0ae8d39400 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Tue, 12 Mar 2019 14:10:11 -0700 Subject: [PATCH 0425/1117] Reland PerformanceOverlayLayer golden test (#8140) This reverts commit f1f19bba8f0089490962316867bd222727510ac5. Now we shouldn't break the engine build as https://chromium-review.googlesource.com/c/chromium/tools/build/+/1480746 is landed. The golden test is disabled by default and we'll enable it later in our recipe and test it in presubmit tests. --- ci/licenses_golden/licenses_flutter | 5 + flow/BUILD.gn | 7 +- flow/flow_run_all_unittests.cc | 32 ++++++ flow/flow_test_utils.cc | 40 ++++++++ flow/flow_test_utils.h | 29 ++++++ flow/layers/performance_overlay_layer.cc | 31 ++++-- flow/layers/performance_overlay_layer.h | 6 +- .../performance_overlay_layer_unittests.cc | 96 ++++++++++++++++++ .../resources/performance_overlay_gold.png | Bin 0 -> 16572 bytes 9 files changed, 234 insertions(+), 12 deletions(-) create mode 100644 flow/flow_run_all_unittests.cc create mode 100644 flow/flow_test_utils.cc create mode 100644 flow/flow_test_utils.h create mode 100644 flow/layers/performance_overlay_layer_unittests.cc create mode 100644 testing/resources/performance_overlay_gold.png diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index a73eae28ef67d..7f1d66782caae 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -88,6 +88,7 @@ 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/performance_overlay_layer_unittests.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.h FILE: ../../../flutter/flow/layers/picture_layer.cc @@ -733,9 +734,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== ==================================================================================================== +LIBRARY: engine LIBRARY: txt ORIGIN: ../../../flutter/third_party/txt/LICENSE TYPE: LicenseType.apache +FILE: ../../../flutter/flow/flow_run_all_unittests.cc +FILE: ../../../flutter/flow/flow_test_utils.cc +FILE: ../../../flutter/flow/flow_test_utils.h FILE: ../../../flutter/third_party/txt/benchmarks/paint_record_benchmarks.cc FILE: ../../../flutter/third_party/txt/benchmarks/paragraph_benchmarks.cc FILE: ../../../flutter/third_party/txt/benchmarks/paragraph_builder_benchmarks.cc diff --git a/flow/BUILD.gn b/flow/BUILD.gn index 6b345aa87a35a..fbbf0e49db095 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -93,13 +93,18 @@ executable("flow_unittests") { testonly = true sources = [ + "flow_run_all_unittests.cc", + "flow_test_utils.h", + "flow_test_utils.cc", "matrix_decomposition_unittests.cc", "raster_cache_unittests.cc", + "layers/performance_overlay_layer_unittests.cc", ] deps = [ ":flow", - "$flutter_root/testing", + "$flutter_root/fml", + "//third_party/googletest:gtest", "//third_party/dart/runtime:libdart_jit", # for tracing "//third_party/skia", ] diff --git a/flow/flow_run_all_unittests.cc b/flow/flow_run_all_unittests.cc new file mode 100644 index 0000000000000..c1755e639b037 --- /dev/null +++ b/flow/flow_run_all_unittests.cc @@ -0,0 +1,32 @@ +/* + * Copyright 2017 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 "flutter/fml/command_line.h" +#include "flutter/fml/logging.h" +#include "gtest/gtest.h" + +#include "flow_test_utils.h" + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + fml::CommandLine cmd = fml::CommandLineFromArgcArgv(argc, argv); + flow::SetGoldenDir( + cmd.GetOptionValueWithDefault("golden-dir", "flutter/testing/resources")); + flow::SetFontFile(cmd.GetOptionValueWithDefault( + "font-file", + "flutter/third_party/txt/third_party/fonts/Roboto-Regular.ttf")); + return RUN_ALL_TESTS(); +} diff --git a/flow/flow_test_utils.cc b/flow/flow_test_utils.cc new file mode 100644 index 0000000000000..0bf6d4c31d4d9 --- /dev/null +++ b/flow/flow_test_utils.cc @@ -0,0 +1,40 @@ +/* + * Copyright 2017 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 + +namespace flow { + +static std::string gGoldenDir; +static std::string gFontFile; + +const std::string& GetGoldenDir() { + return gGoldenDir; +} + +void SetGoldenDir(const std::string& dir) { + gGoldenDir = dir; +} + +const std::string& GetFontFile() { + return gFontFile; +} + +void SetFontFile(const std::string& file) { + gFontFile = file; +} + +} // namespace flow diff --git a/flow/flow_test_utils.h b/flow/flow_test_utils.h new file mode 100644 index 0000000000000..58da75b3f4dde --- /dev/null +++ b/flow/flow_test_utils.h @@ -0,0 +1,29 @@ +/* + * Copyright 2017 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 + +namespace flow { + +const std::string& GetGoldenDir(); + +void SetGoldenDir(const std::string& dir); + +const std::string& GetFontFile(); + +void SetFontFile(const std::string& dir); + +} // namespace flow diff --git a/flow/layers/performance_overlay_layer.cc b/flow/layers/performance_overlay_layer.cc index c80786e866e1b..e7f40058c3bfb 100644 --- a/flow/layers/performance_overlay_layer.cc +++ b/flow/layers/performance_overlay_layer.cc @@ -15,8 +15,12 @@ namespace { void DrawStatisticsText(SkCanvas& canvas, const std::string& string, int x, - int y) { + int y, + const std::string& font_path) { SkFont font; + if (font_path != "") { + font = SkFont(SkTypeface::MakeFromFile(font_path.c_str())); + } font.setSize(15); font.setLinearMetrics(false); SkPaint paint; @@ -33,7 +37,8 @@ void VisualizeStopWatch(SkCanvas& canvas, SkScalar height, bool show_graph, bool show_labels, - const std::string& label_prefix) { + const std::string& label_prefix, + const std::string& font_path) { const int label_x = 8; // distance from x const int label_y = -10; // distance from y+height @@ -51,14 +56,20 @@ void VisualizeStopWatch(SkCanvas& canvas, stream << label_prefix << " " << "max " << max_ms_per_frame << " ms/frame, " << "avg " << average_ms_per_frame << " ms/frame"; - DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y); + DrawStatisticsText(canvas, stream.str(), x + label_x, y + height + label_y, + font_path); } } } // namespace -PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options) - : options_(options) {} +PerformanceOverlayLayer::PerformanceOverlayLayer(uint64_t options, + const char* font_path) + : options_(options) { + if (font_path != nullptr) { + font_path_ = font_path; + } +} void PerformanceOverlayLayer::Paint(PaintContext& context) const { const int padding = 8; @@ -73,15 +84,15 @@ void PerformanceOverlayLayer::Paint(PaintContext& context) const { SkScalar height = paint_bounds().height() / 2; SkAutoCanvasRestore save(context.leaf_nodes_canvas, true); - VisualizeStopWatch(*context.leaf_nodes_canvas, context.frame_time, x, y, - width, height - padding, - options_ & kVisualizeRasterizerStatistics, - options_ & kDisplayRasterizerStatistics, "GPU"); + VisualizeStopWatch( + *context.leaf_nodes_canvas, context.frame_time, x, y, width, + height - padding, options_ & kVisualizeRasterizerStatistics, + options_ & kDisplayRasterizerStatistics, "GPU", font_path_); VisualizeStopWatch(*context.leaf_nodes_canvas, context.engine_time, x, y + height, width, height - padding, options_ & kVisualizeEngineStatistics, - options_ & kDisplayEngineStatistics, "UI"); + options_ & kDisplayEngineStatistics, "UI", font_path_); } } // namespace flow diff --git a/flow/layers/performance_overlay_layer.h b/flow/layers/performance_overlay_layer.h index b5f20ecbd7a6b..a47b836c49f3a 100644 --- a/flow/layers/performance_overlay_layer.h +++ b/flow/layers/performance_overlay_layer.h @@ -5,6 +5,8 @@ #ifndef FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ #define FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ +#include + #include "flutter/flow/layers/layer.h" #include "flutter/fml/macros.h" @@ -17,12 +19,14 @@ const int kVisualizeEngineStatistics = 1 << 3; class PerformanceOverlayLayer : public Layer { public: - explicit PerformanceOverlayLayer(uint64_t options); + explicit PerformanceOverlayLayer(uint64_t options, + const char* font_path = nullptr); void Paint(PaintContext& context) const override; private: int options_; + std::string font_path_; FML_DISALLOW_COPY_AND_ASSIGN(PerformanceOverlayLayer); }; diff --git a/flow/layers/performance_overlay_layer_unittests.cc b/flow/layers/performance_overlay_layer_unittests.cc new file mode 100644 index 0000000000000..cee659f925bbd --- /dev/null +++ b/flow/layers/performance_overlay_layer_unittests.cc @@ -0,0 +1,96 @@ +// Copyright 2013 The Flutter 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/flow_test_utils.h" +#include "flutter/flow/layers/performance_overlay_layer.h" +#include "flutter/flow/raster_cache.h" + +#include "third_party/skia/include/core/SkSurface.h" +#include "third_party/skia/include/utils/SkBase64.h" + +#include "gtest/gtest.h" + +// To get the size of kMockedTimes in compile time. +template +constexpr int size(const T (&array)[N]) noexcept { + return N; +} + +constexpr int kMockedTimes[] = {17, 1, 4, 24, 4, 25, 30, 4, 13, 34, + 14, 0, 18, 9, 32, 36, 26, 23, 5, 8, + 32, 18, 29, 16, 29, 18, 0, 36, 33, 10}; + +// Relative to the flutter/src/engine/flutter directory +const char* kGoldenFileName = "performance_overlay_gold.png"; + +// Relative to the flutter/src/engine/flutter directory +const char* kNewGoldenFileName = "performance_overlay_gold_new.png"; + +TEST(PerformanceOverlayLayer, Gold) { + const std::string& golden_dir = flow::GetGoldenDir(); + // This unit test should only be run on Linux (not even on Mac since it's a + // golden test). Hence we don't have to worry about the "/" vs. "\". + std::string golden_file_path = golden_dir + "/" + kGoldenFileName; + std::string new_golden_file_path = golden_dir + "/" + kNewGoldenFileName; + + flow::Stopwatch mock_stopwatch; + for (int i = 0; i < size(kMockedTimes); ++i) { + mock_stopwatch.SetLapTime( + fml::TimeDelta::FromMilliseconds(kMockedTimes[i])); + } + + const SkImageInfo image_info = SkImageInfo::MakeN32Premul(1000, 1000); + sk_sp surface = SkSurface::MakeRaster(image_info); + + ASSERT_TRUE(surface != nullptr); + + flow::TextureRegistry unused_texture_registry; + + flow::Layer::PaintContext paintContext = { + nullptr, surface->getCanvas(), nullptr, mock_stopwatch, + mock_stopwatch, unused_texture_registry, nullptr, false}; + + // Specify font file to ensure the same font across different operation + // systems. + flow::PerformanceOverlayLayer layer(flow::kDisplayRasterizerStatistics | + flow::kVisualizeRasterizerStatistics | + flow::kDisplayEngineStatistics | + flow::kVisualizeEngineStatistics, + flow::GetFontFile().c_str()); + layer.set_paint_bounds(SkRect::MakeWH(1000, 400)); + surface->getCanvas()->clear(SK_ColorTRANSPARENT); + layer.Paint(paintContext); + + sk_sp snapshot = surface->makeImageSnapshot(); + sk_sp snapshot_data = snapshot->encodeToData(); + + sk_sp golden_data = + SkData::MakeFromFileName(golden_file_path.c_str()); + EXPECT_TRUE(golden_data != nullptr) + << "Golden file not found: " << golden_file_path << ".\n" + << "Please either set --golden-dir, or make sure that the unit test is " + << "run from the right directory (e.g., flutter/engine/src)."; + + const bool golden_data_matches = golden_data->equals(snapshot_data.get()); + if (!golden_data_matches) { + SkFILEWStream wstream(new_golden_file_path.c_str()); + wstream.write(snapshot_data->data(), snapshot_data->size()); + wstream.flush(); + + size_t b64_size = + SkBase64::Encode(snapshot_data->data(), snapshot_data->size(), nullptr); + sk_sp b64_data = SkData::MakeUninitialized(b64_size + 1); + char* b64_char = static_cast(b64_data->writable_data()); + SkBase64::Encode(snapshot_data->data(), snapshot_data->size(), b64_char); + b64_char[b64_size] = 0; // make it null terminated for printing + + EXPECT_TRUE(golden_data_matches) + << "Golden file mismatch. Please check " + << "the difference between " << kGoldenFileName << " and " + << kNewGoldenFileName << ", and replace the former " + << "with the latter if the difference looks good.\n\n" + << "See also the base64 encoded " << kNewGoldenFileName << ":\n" + << b64_char; + } +} diff --git a/testing/resources/performance_overlay_gold.png b/testing/resources/performance_overlay_gold.png new file mode 100644 index 0000000000000000000000000000000000000000..119551f705793600890950be96b6b0d60688cc54 GIT binary patch literal 16572 zcmeI4c~n!`mjAIV3ra+AKuQrPN(B`KCqS7}f{4nbGLKOiWeN}=Od*ys2ndu?fJ{L_ zWD*dNAwY;S$`}~~1QHp;lmrMQB#`hssp{_4@As--zt#PIfBe>}yOt|@FWh_XIeYK3 z_xH17^lc+Ok=;jj3kV2^+`Mt^u7JSKIsPA^@4y+uoPlZZ@hx2Yrl}A(LWLZk3JClt zaP!(#)4+_S@gQ$AN~Zi4Wx?Lg)Aj297sJiYOr)UXq_{fiLEFQ;i&NEP8jEUxz@-Ki zk<$v&AhV_Oh3p*7K|AGnzuJD2L<5(O)Wh;dlf`jT#K4_TM)v&hbcg;s?Qgypb0v(E zAg)&)#f9(dJkJX)JSoA-2I1kA%d&fPek?&9{Ew+*5%aQsCpKpZ~h_Kc9_9&E1NRloHH} z8j(*tp*XF2pBy)KVZVfcfcN70$9utz_x<>4r+~oE-wFZK6cF3-jT-p4_UO@nz7*Is zDl%DS2`=nu75dND#U$OL+7sogNl&%C{Lh{}k^986v}kdm=1!$;vCYI0FYzX7?0>Qj zw*|2Dilt>`J_GlNQ5jFPg8iB>pQ_T;kxpI_SLUi4mB&s;F2u?zw|*xwCn6$(J2JGg zL*NnqY0Gyq#}KjVe=@SYYFS5^^|M0fjHLwxHp(yjv#<1TZ;O5+U9!X`qq9T=1U{}i ze)}f|*L5{Ye@~^{r`wDB_OQ6%$1D=}{qN25N1qDeuR~>SW;L*Uj zvLLpu3U1n*-;&{A8-*-(7JtAf8PdvR`T{i~b$BTjiUq7R= z@dM_{AKrt0vKM;$Ang(ush8&Ue>RvUSj9elEj?Zth76qgJ%WCWbNO>q#9fa})8V`3 zlYiQI|7VMJ+$&(m*ySSgh)u5m;2Q#=TF3q*KHS@@20cC73*txh=|8*v--njppL4{k z&eMeb+bNsV`=fdFs-%sIV@TwQ)O5Q81bjNI;R=F98)ujln6B25xwP%V{QNo0i1H4B zk16BI!gI&;RK&Z|)&rb^*wK$I&qyrN6pf|SKFoOt#cB)5I$lVv$8m~q9Gb4Y@o`RP zM@P>)Ta52w#ua#)w$KEOHw)v<%=P9ZXtJjh>Gn1BY+a?eBgzZ6SKLdvxTsRIZi303 zUd%>)P^nqM(Gk<%Qc^@HJ%el1QUC1%IK_=4$c%3By+8UvMBJf`7jO;y>{fSrmg_^$ z%r(qa`J`JdD0U~b#LLYs?Pa^;{@mPL7h1z6P2{3;mn+7{VqLv6S<@oD{dfhj3Yk+` zUw`6?Lu;LxUP6y1Vc=3x1rBF~Gm`b49+0$K{bIz3&|osOb6&oDckE6NB^6f#Ul zr)hvjqxA{Ogf0(`RJh3Co>%VO7{P}HKsBU|Q51D@(B|?)QxdVt)8@QW$8XpQ7rfU= z1%*ZIVg4Kz&!&C5wz`@;-I0Wkr!5^#9mQ@oRH4y*26p4WOpa8Lf2j1b+sp`|VO&@r z8^ExKl@YWtV=#AP7`U!_z|zZ#0P1L|d}4dbTf_8#RqKHRyE;?0ANZX~7A97srmo2) ze(ug-8_lfF;NBq_-HRT6} z>3uq-vvd5jb%V$1>V+~494aXuD>80?*I;y|B_}6yPMN&j3RswPS|GuX$+hc(@vNc@hc1?K0i%+^;yV=9;;PVxRP`ufDx*jT(= zl^1fWxjiv4L|f=Si?%sxUdof1x*o5A*6?==g(A5n`;?XAPN)ZHgig-&Ua`}WVtjsn z%;c?6CWlCb;kZ8w$(mYN;J8yV+Z#|Xu%4?6gGDSmx_j+y{_i4@E%Q}X-(zLNe>Gsv zI$c;9s}!Q}Jvb72->*Auedu$bhScKHy9F5!T%4pTX=rRrW2K~y7VN-YorzN|Y`|9p zF=h*P?by?u7Q1dHF;8&m4WEe}S9*XHSF zhYqea*VT2J)CG)_Rm3hSoK8!ua49V+%y&K2HS++&WY#uhs>^s#7mlQoYJ8?V>A-O` zS!C39k+6iK#*16Ilc;SLYMVMaIoU%GW7R3y1@hwK7X}ncw}?6t4auD?Ja({2kZkxl zuQ6I5li7>4*xwTy(<67c!1Su8r|05FcQZ4y@ra0s@#5lQvlLoZ7CD`@UW!6ZetHs1 zba&f(NJ1j38~0*S>CDnod=@Ui)XB-@J}_)5)gK9r?aR=Jm4B}gx5g(#?~*EhZjWrZ zI&EWQuA{?2S2lckF2~qd%jdx@!fZDVG1;q^g&qSwom04QN+E)f%f|sCW-9JRq3jQLXVTvlX=O#Gx&u4eF#^JW-4?Z?4LLbiT zmh%PPk(nG5GqsCB!CBi`2dj+`EM92&xqiYNzDOz_{V-4LPDy`z`;Jfjy~gm&8JlV? z(glZB^`s|*%#}77 z+YsD)^rhOvzBhcYZ-ekwj)BQ@0Dqs)%i<;aOtmU&tq+*MG`MU1s0%@>(+TP6>1`+W zM-Q+XSXk&$jllPA3zi2Vz@%lai9;rGw{Qv)tU>)fKt%0RaKY5{C{2C_x)S zO;pmmiRDh6i5Dy^a+l!}?0t5B0BK-?vswiA_mK$*N_MLR1aX zF3p>QyhsUizjV^xa(G`tn@Q04_{_Y1wLik*O^Onf6o`3VbGw#k~3r ze*BoW(U*%W!7jf%al&Q4lT-1osJ&#1 zDD1B9(r`xnPC;|@;X-6-)hu`;X)_DNtLdBsnme&(g_Yhv|9Gj~33pT~A@9MH_4eEA ze0zWQPQ(0?cgEHhsXitqx$*7W)XXwV#WPl`p`IG(XiqY4xm`1arlssPhQ?FtcJQxR zz7H_f?;PkkApdp`=GAEGMVG=C?T++>u(cc*ZxG5I+~z(3u~S`A#p9*Qa7cqI5xYf& zMKKEtmy5G_m$pd8s3Wzv^qWd~UquzwW}^?t-vV}Z(QTyMNhV6H(ZpDDeW5G$BH}p6 zBv1?(uNxA!XhRMTxko;x7jJ-8^IvF-l~5ujgW!ROY;WlV1qF@BqXQ>f^rVBPlSm}e zWQu+8e2H)ZWLXM1_d06mkhr)%78n}B69n89Da6Olnvh|rmomlp4I#hCa8$&^F zj!ra1$&-U9nRG4Q#*`9&!EnIbM43#c_40mTp4j`_IRW>sT~0b(lTEa%hLIZ{Y%-|| z-|^5O>Zqc4TW1w4O12zHiYBSPW{zx`BdeIrWavLGP#~eS= zB&_z(wu$F0~Uej9(Ov%p2zQ?*hAkgM^}Ojni0-k387LuQ)VCiXhA_EV44SkQ|EQ z8J6y-Vz^k3sYO(8TYSWdplGC+cHkU_(%5hXuC1t~v?uhd*2dQ-sr(S<=H{lRBlPs_A*AQp>_=J9yVuXUo{l8~%%*j|s) zq9PkslMHWJ6pY*oRgnj3?T_9f>aRq@%N@&E{jUNknUKRa=0nzE+Cs(?pyCV9J?yii+$|uue5fWcxh>Fl1?*T{O=u>_tKX1<7wh!E9)04i(YR&VgBG|y z47=Xe_FWJ0%lmiSL}T*|@TC5{wn}p|DTR#7K6>-HJCN@&ZcH@Ee;2mr2LmV+s*%#!GTW8P znE1#M>3?ge&Ia-BURRV%*ky+A4sPrRI}p`To7DHTUcIIS9v3IN4$N%64iTjef_Aop zv{q=~>K2=U*kcA4l0BZ-Zk(qL@-z>yCu(jkRk-(nT{iPp?rt3+*?{(iKnaqaiKXSR zjJD9s%*^=CQt^Wa*C@UiOB4!~4Rjb&#gtB)YOnD$|HUCYKN^Tuhlr@AAp7J*%!@R^1eaaHTKPgXmckNV)bY5xcWe`#_GczM38c1X^ z^j8D9s0?>x?h(lpw7Xl{Ab+cQv9Qpj8+!ODuF_ZN0pF=&_y*GI%u|#+!fsi#mAF>sPOSOuTWNqr_ct zYJR$p5*!i|Te8utW4ZB3@ID8vIWZN)Xq-4@(#SB@6ql2}EY`5zp9R9mFeuAj0+-Hq z>P$vX)Y;V5*1k}xUv7K?qJyEa7JE9@q4n7n7Ly3Wld3$4F|Wy*HT;qJC`PRHB*)s?(5uAqNoOcC@yhpsugibvXBg zhD?*Ntc->=Oa8R#r|@cNSQhWqd?N)NwOsdnsHCKW*U^!qEBj7E{eAJ9X^-sUV%|kY zVn}dDKby_Q8X6k<%Z9gtc;@b|Fu%B{P*PBUk&AT@Kj_y2!lU6J@JtAB_$6DNrgC_q zoTpOeMaue}mKJI>jTYmF%FFu$r-N=py-;{aRw~3I{h*2x!ZS1SyREI?hK+g! z1*Hz>Lc(kfHQVC5X=%#tcI%*qH_z*D_kc6jXkyxPbNRPsD6E;Jq{`VWb=A}2+CnRV zoN_{W2rJEmzuUqm-1)CoRb73F+pEXQT$pDsaYUS)oLth<)Agdn0z~SEMnJ9#RAjQAXk9Q ziCzE#o|CuXH^7=$=)yuZ^T0MK{4=0mB)Ncv?rUjrIl!N@*tV(p#>Pg4Fe8M+)QbxJ zWDRI_C|k)*R0d7nr!54Q@|OOsQ3iq*`nCKRy=k!bPEyCrB)@Vf(C~BZ#jLI#Xup|Q zW#0S%bMD;T2JZ<-+yby1>Ij@Z&*M#Yt<6iGPLRnO37U_Y$TNzgQx_FF&R8xR=YR~T zr+?n>g1Y}gYmA@Tb9XQFkd(HN;NEwxP`>W~QQ^o)pRWxo{Co8dV50lu;$ra;VvQdj zN}jH*z5e#QSyAJc=Uz{I{q&??)noXJxt$#{03_A=2coZ$vvp&Eg%iO540Ltj6JSke zwwcw4Od}90($b7?_02aL7#jzvNgKCZk5ezWQ0V1zaOaZ?w7t15_()I|1;XKQE|*2#<_sRim6Vidf=J3wJaa)&JOdN6aTy08ya0S*b8%)7d}Ex#6-i@H8c z9l|60ogGGpKqk9b+nWQC z_L=_txI#7qb(G*)?Ri>B33h60E=So@Hr)H`$Bv53%ws0PhwAUb+dqu{3NlKNQxUu8 z{q8vTW=ptRyxU;UIhM;eICUO4yE7-ZySpE#5!gDrQtF`RnJksO<@pRUBNE+Nk>$3E&Z2WHIWJ_u@MYq3C9#g zuKzf-dYgWJ*Dkx2?sQzxPvDBrR6xQFU}Fkazicu1#$>~amlCa3Q8lL5Q>(hgi!2}) z0~*7noIvPML-Kk(k!7Q!kuMq>OYosRr615adKCYRZTeVjBYCJeA?vd^}64-5vh@0WEl2>)=zTiU}fw zee>iTRRquNm5JD9yPyu$>gzXEhjIGFI-Q%6&)Rr(;_>t>5N^!kh6w`$ekJx;4i%_u z7W|ZQQBYJm;{uYiHV!6yV|n7L%z4$9{3>W1h-}6IV24l!h*Gz= zvm0j)J0y4>=?MarJvqAN0ZMH+0Ka!O#$$Ndl<_4*SKn!-tT8e&mr78}0A(L2p;={T z&zjVMq<`G%uCE+w^uv0ROV2avVXw;xF%aGqBrIqS3vT9q^JhwOC7kkv;Mx5c6sMl) zDxS!hH#cRH!OpN$VB!#hpmI3=>N0#lcHqmz=?@7o~X29uxbo~5nOXR3*s=-^YYqB5X`U&K$A3Q>?UPx`YQ_1H{ zy1+bn_lSaAy=?=5iD}=+n_8L3aL8vtqX7f;E}giZF=hRs-`kEJ&~T^( zp>BUuau4fhst5iRnfuuBf@a1Pz<*hTWO5c{m?^9G#iC?M>vG07B`rc6Z@u}_mX7fz zY`mmT-qnMn4{N~hLxl--Ql)Q1B9WPr4-y55V*~;#@xBxYxEs$bJ(kb=!vDag8iG;{ zuTG9V1WPs+{7>U*>54=9bTn(-xt!(JxWZi^;!EQHJ}&?K?aL=&aeI`bj)J>?=kRB& z^g<5YP|H=xj)v(AL(^$P#N!sSnyh)7anVC)uF8`^@hB*sfspLh6xc|g0O=_L#dJY27u|hGi^chK zwxOhYLZM!~$7#+Yu4fA>E-qdS5|)wMP$MKNHs;AOs7tCQMcoZ5l>=6ueCkt zMFvQ?3qdaRd$m78hMvg~&93EmPsE7h~KtN9qjr|u+#1uo78$b(}_A?TeIQ8V^YbNS3Vz0sDIHp z^MGH1?@TqA?GFfX=6T7)w z-PBzDtWv|{9Irsg@%_l4!9l&4f2+F&2cu%OKX+0`*FP5UaUI5X>3Ygq?(>wC=~LH#`L1GhI3*g}5T)`sQ@K~cqp8XmyZpjy1Xwl1D0c%7cuPO1k*4N#sVjWP+n{7#Pa zAfCc`_aU2OQ!9S&Dk=(5@3{+$h`9WMhi690rX~)6`_I?jS+^@m7T&C@uDLv&cURW< z9LQikKlS*TzOZnMMt23mM8H&{Z4@a~7gU=M@29LVLc3AVagp-E}|DooUF1K1aPIqg>Ne!%Yj9gkTxga$bX z-T(5)-qcU!c@{Z^K+>v(eXZmdk}#Oh+YcX(;HFaX4O+E@F$ie_t<@w^f;QS|NS6Lz%5BtaOoB zx%f*}Pfy`MM4ODN7yaq%?BPt1rMF2zB<-w%-kl5=lSZ!1x62zD%#YTySwP4VwakyB%_U(>q&1!rL4WZTAv|`R6IEWj2SPT()`Qz=k7Q5 ztOA$@OFci8+40FuQq>FbFl2L%r0_jOqH3JX9p}lbtE+bkF4D!E!^KJ(a0CnVw$$`I zZmaVgHz%QS3bJVx$Whw9&_ymkaWq5a>@<%?M{kh;V2s6YYH6;0(V-6x4F%Y4NNENv zS#obHi-umW81Y!jO|iEo0j7Tzh_0QToyOxKbgZPDVVa*?e!w>Zk8G@_VLlMQxi8b) zO&A2=?*nI%$YXtsS*-a*|AozCpsw5;0OeZcv~St+Y&tCLY`7SJ$6IVl7V0DjUYpGa zjO#b}v7(Piw5j)==u`%4HT}81r>ZJ?yuul4mc)1K3^wz#W4S85NmRy5sy;>xNOm1i z6n9;{qoczJkJj7_6p{s||MqmM0h2eU2jR^A7dUW^u2k##`9h}RXSqad3N`9KU?3=B zKUC%C=Pv?ORp$;!RV=+`DxM`1`1KdUgEC96uN<(Hz1b;l!1zEL0@oQ>qw$A>pit*m zyVQubGpDX3o>Xu@d)d$Rs-BRn$LJb0nJ@SO8E12$2o>f^tZFmbyJTatd9%ID0j{?9 zsAZ5GKYEudxD+%@Q-kk+|!fzNxPu4T31%}Uk;#s>|zr}SL zT^xoL-yIy%w9S&)b_krNK(_tJ36!qy87i>7d>|Nrq4xv6>_>=b``sRt?lORnvMQUR zM2#C5J?dm6XbFM#fT9|;(jp~OtbKzGaJhkNR}p`L!j^E{(K)a zj#Ld>p9eI~4hXNN13pzB*5VcbU%VC;7RD@VleVz|sJN=8<}%P7_2Q3?kVy^h?2jv2 zTg$J9>S&ymjUdL5d4g0OtofIn3dRV3v$tB?OR~THJF^43(YY(nZ>*sh>EzI$dp2sB zimslXQgz-Fjc2!Ka0ZK6msgs~LH~=)AduJ9{0n*6m{y>PS_;XA^2TUOPETBQnqn^g zu8m%lzvKk)`e>!QjCHNwd~!>ygv@T)aG-vTgX-8CsWo;ma&nTn#cy}AwvlH>iZuf1 zqbmL|!{_FiycuhmhL#`lKZT0#aXY?A}Q4us3X9F5ulgjsWfyQR#uR zTSp%4!b+r+tx~I-RuQD{C*o9(Tue0}QIJ^yv@y(dBMb2DuT22h?X`l#V6bc)4&pQS z<#hpqjAW(nBrYy23~`sEAX`lU^9^k?#!mtzH|b#XBVG_Ap23&`dq}VlfO5GPb%dm3 zx4hOc)rjUig=c)xn$LH(yk|)b4UJu&pYPgr(M1btWlu^oI37GD8!i^hRRnrvvNMyq zIa+W9ZZ9(k7;80Xj&Ttz0&PfX12!-u%N2B|H4hX>D)1=Vq3p715@*VR@8Dl_FvBEl zr+OH7(F_Rl4gVKk^SI~5qMSXWA{GxZWo8-4%8<%QLa@ zCbnZ}h^42_AfQst##zz?6N_qC^F$LveQ{y$ZyzcR=XxAh;UF1m2RK_whyog++K(#| zMfvGbqCBj4W4S5Hc+b`k=UxJE4jNHFD~Z*neAYWYQhI{a3PTuL43VR+q3nSHV}`hy z^*_FE`>)7a)Me=e)Tp!$^17s?q~44#rXCQqVk>~sbSYjim{Q$~BRha*=5P2-@b7>u z760rT%1o{UXnT*;EK&F`37Kp3c-GbLU$w_V= zw!tL@56uanTj^F|k*LI3>os3b8)6SyRBIzZUr2Uf;L;%gM4CZQ-e!bMFfx}KqFm(> zl#QvVxPY8+*U^mP-dcF*mNs(5rAKnG-O-rz`MIGku^Qt0Q#gam(KRp3Qt{+|uCMp= zSecYqIHVLd(NE~?uonJ3VSzQU^Yp&Ep09Hma*M00C1bG|%tTmNSgb}!*ayA`IyT5@ zvO;~jUY@6r!ZxWRU=Oo7KUNC}*Cz{r(tAL9_VD4nq16QF^Uj`3>$*z+onoN^URRWt zS2V16orbmFMAeHI715v-axIq*n3-|jUES2@ z$I^ET+AEw^OTQskcfbWdv1i!>e(_Nj__ z4NNY9envCM_bx&%aXZ4o9ruFC%?3FZ3&`}h?ZdL~eU17RBz>kpEa&tQsikkxAd(@R zDuVdEM@9Yfj#ZeTV1$q?2%ovDjLp@K4r_>1ZbDms3O0GXj*t<&SWK73E*k?gLD>+S zX~4B$`nuobQZk6*LxZ8yz2CXsRfI z?|!*rH1k>~wkIhi>xNOR1d^JLN`=P0^v6UMh9b(L4Nx1NvHiEV`x_b02 z_CP@YBMb_?c~1j>F48|0uxp9H~rDJ0N4OtciH=%?j|3#bfdXLpOce`wekkT zcg$~pNpkhD4FwzTTSMaQ-a+LH%IB(UF+py>+c_RxJWmH~8H|eb*{}B8#rMb>&SvaI zaq;d5kmV(B6UiihHQ++-Zd#{q<_TZa)SQ_I(Ls{m0n9H10T+=0Em5;CvDnxsV#@b+2Vje=`Ks zuRwm`l@t}ZCxGTj1S!a6zA-|Wbrcd-9}MzG1{~ZVvE6nsAp~?eEggo0ZOPXGE&gRz zRu=k#Q^!hVWaN3!s%yD6U}DUzt*T;1YI%tPKblT^_Nw}W!6K=A#-@AMuFPn#N(F$j zq`32Wd%B9|hz6hpMY{zpa_Z`S!nzZ<#ZFH0!pVF>GS@4UaM{=K(}-9PB!01qr~*>m z>Vsixy=hgyFV@URPtWs$UBdPS7(cH-5K=e6{tpsA-Bd71@9fGZDLJ6WZG)eO?s=BX z=O`q=ajMQcFq2CxR~YB{D7VTpWUcvQ{cLXzD`{Xz<)G+M2IxqG_)j)_+JWrauF`h~ zuLoMKTC2T~OEI&TpwYI9hk6LMzk=>5f`2uchid~lZi^~t^X6Y^jU#IQ1Qxs0an~yT zqUol+=Q!w28XFzcz%sxKSiH06b`5`jAmBGDpm}R-z3TNAH+RWfyM^nt7*^Q6;CSgw zf)5V|SK5u@m)bw2cX#rGD0OKBW?o%6xDBrh?a|(0@wJa9y}&pRzBhn#2Ted0pnH=! z-=9}RD6!jIeT}DMOi9oNm6rw!5P_Qhv)BcbI z4;K~W4LR>Mz)~1z9wFAb69}b5HeZT6_KJ}-*mt2aFW1SfzqCS2V z@ztb{{GuUYuoolpGJH+7A!m1y64{C@z; C%{D;* literal 0 HcmV?d00001 From fc2e6b61c892ae8c1f64613b7c9cd4751c563650 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Tue, 12 Mar 2019 15:27:33 -0700 Subject: [PATCH 0426/1117] Typo "fast an inline" to "fast and inline" (#8142) --- fml/unique_object.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fml/unique_object.h b/fml/unique_object.h index f42603ef80451..407502a0703b8 100644 --- a/fml/unique_object.h +++ b/fml/unique_object.h @@ -14,10 +14,10 @@ namespace fml { // struct UniqueFooTraits { -// // This function should be fast an inline. +// // This function should be fast and inline. // static int InvalidValue() { return 0; } // -// // This function should be fast an inline. +// // This function should be fast and inline. // static bool IsValid(const T& value) { return value != InvalidValue(); } // // // This free function will not be called if f == InvalidValue()! From 31b289f277c653ea91e20d75309958ac0dd0b865 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Tue, 12 Mar 2019 16:48:47 -0700 Subject: [PATCH 0427/1117] Fix indexing error in dart:ui TextStyle.toString (#8143) --- lib/ui/text.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/ui/text.dart b/lib/ui/text.dart index faa7032121853..899751d4a82cd 100644 --- a/lib/ui/text.dart +++ b/lib/ui/text.dart @@ -485,10 +485,11 @@ class TextStyle { '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"}, ' - 'decorationThickness: ${_encoded[0] & 0x00020 == 0x00020 ? _decorationThickness : "unspecified"}, ' - 'fontWeight: ${ _encoded[0] & 0x00040 == 0x00040 ? FontWeight.values[_encoded[5]] : "unspecified"}, ' - 'fontStyle: ${ _encoded[0] & 0x00080 == 0x00080 ? FontStyle.values[_encoded[6]] : "unspecified"}, ' - 'textBaseline: ${ _encoded[0] & 0x00100 == 0x00100 ? TextBaseline.values[_encoded[7]] : "unspecified"}, ' + // The decorationThickness is not in encoded order in order to keep it near the other decoration properties. + 'decorationThickness: ${_encoded[0] & 0x00100 == 0x00100 ? _decorationThickness : "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] & 0x00200 == 0x00200 && _fontFamily != null ? _fontFamily : "unspecified"}, ' 'fontFamilyFallback: ${ _encoded[0] & 0x00200 == 0x00200 From 59715b71db8e3d9d9c3ca47db6555a7a6789c180 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 12 Mar 2019 18:32:19 -0700 Subject: [PATCH 0428/1117] Disable build_ios task due to lack of credits. (#8150) --- .cirrus.yml | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 2492afbd0fbf4..cc6796b3faf69 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -60,39 +60,6 @@ task: mkdir javadoc_tmp ./flutter/tools/gen_javadoc.py --out-dir javadoc_tmp -task: - name: build_ios - use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' - osx_instance: - image: high-sierra-xcode-9.4.1 - env: - CIRRUS_WORKING_DIR: "/tmp/github_repo" - ENGINE_PATH: "/tmp/engine" - DEPOT_TOOLS: "/tmp/depot_tools" - PATH: "$DEPOT_TOOLS:$PATH" - depot_tools_script: - git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS - # jazzy_script: - # sudo gem install jazzy@0.9.4 - gclient_sync_script: | - mkdir -p $ENGINE_PATH/src - echo 'solutions = [{"managed": False,"name": "src/flutter","url": "git@github.com:flutter/engine.git","deps_file": "DEPS", "custom_vars": {"download_android_deps" : False, "download_windows_deps" : False,},},]' > $ENGINE_PATH/.gclient - cd $ENGINE_PATH/src - rm -rf flutter - rm -rf out - mv $CIRRUS_WORKING_DIR flutter - gclient sync - compile_host_script: | - cd $ENGINE_PATH/src - ./flutter/tools/gn --ios --unoptimized - ninja -C out/ios_debug_unopt - # TODO(dnfield): when we can install jazzy properly, we should do this. - # AFAICT we can't because of Xcode version. - # mkdir objcdoc_tmp - # pushd flutter - # ./tools/gen_objcdoc.sh ../objcdoc_tmp - # popd - format_and_dart_test_task: container: image: gcr.io/flutter-cirrus/build-engine-image:latest From 9f50dae33fdf296aaddc91432a2207da9def853e Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Tue, 12 Mar 2019 18:33:33 -0700 Subject: [PATCH 0429/1117] Look up ICU symbols based on the path to libflutter.so as a fallback (#8139) The ICU data is packaged within libflutter.so, and the engine uses dlsym(RTLD_DEFAULT) to look up the ICU data symbols in the libraries loaded by the process. This approach apparently fails on some Xiaomi devices. If RTLD_DEFAULT can not find the symbols, then the platform will pass the path to the libflutter.so library so the engine can use that to resolve the symbols. Fixes https://github.com/flutter/flutter/issues/28208 --- shell/common/switches.cc | 36 ++++++++++++++----- shell/common/switches.h | 3 ++ .../android/io/flutter/view/FlutterMain.java | 6 ++++ 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 0ef45a944a644..997cd846ec613 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -123,13 +123,29 @@ static bool GetSwitchValue(const fml::CommandLine& command_line, return false; } -std::unique_ptr GetSymbolMapping(std::string symbol_prefix) { - fml::RefPtr proc_library = +std::unique_ptr GetSymbolMapping(std::string symbol_prefix, + std::string native_lib_path) { + const uint8_t* mapping; + intptr_t size; + + auto lookup_symbol = [&mapping, &size, symbol_prefix]( + const fml::RefPtr& library) { + mapping = library->ResolveSymbol((symbol_prefix + "_start").c_str()); + size = reinterpret_cast( + library->ResolveSymbol((symbol_prefix + "_size").c_str())); + }; + + fml::RefPtr library = fml::NativeLibrary::CreateForCurrentProcess(); - const uint8_t* mapping = - proc_library->ResolveSymbol((symbol_prefix + "_start").c_str()); - const intptr_t size = reinterpret_cast( - proc_library->ResolveSymbol((symbol_prefix + "_size").c_str())); + lookup_symbol(library); + + if (!(mapping && size)) { + // Symbol lookup for the current process fails on some devices. As a + // fallback, try doing the lookup based on the path to the Flutter library. + library = fml::NativeLibrary::Create(native_lib_path.c_str()); + lookup_symbol(library); + } + FML_CHECK(mapping && size) << "Unable to resolve symbols: " << symbol_prefix; return std::make_unique(mapping, size); } @@ -228,11 +244,13 @@ blink::Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { command_line.GetOptionValue(FlagForSwitch(Switch::ICUDataFilePath), &settings.icu_data_path); if (command_line.HasOption(FlagForSwitch(Switch::ICUSymbolPrefix))) { - std::string icu_symbol_prefix; + std::string icu_symbol_prefix, native_lib_path; command_line.GetOptionValue(FlagForSwitch(Switch::ICUSymbolPrefix), &icu_symbol_prefix); - settings.icu_mapper = [icu_symbol_prefix] { - return GetSymbolMapping(icu_symbol_prefix); + command_line.GetOptionValue(FlagForSwitch(Switch::ICUNativeLibPath), + &native_lib_path); + settings.icu_mapper = [icu_symbol_prefix, native_lib_path] { + return GetSymbolMapping(icu_symbol_prefix, native_lib_path); }; } } diff --git a/shell/common/switches.h b/shell/common/switches.h index c20589dea6226..a5da872d6d1c9 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -52,6 +52,9 @@ DEF_SWITCH(ICUSymbolPrefix, "icu-symbol-prefix", "Prefix for the symbols representing ICU data linked into the " "Flutter library.") +DEF_SWITCH(ICUNativeLibPath, + "icu-native-lib-path", + "Path to the library file that exports the ICU data.") DEF_SWITCH(DartFlags, "dart-flags", "Flags passed directly to the Dart VM without being interpreted " diff --git a/shell/platform/android/io/flutter/view/FlutterMain.java b/shell/platform/android/io/flutter/view/FlutterMain.java index ae712708573cc..c632dca387ced 100644 --- a/shell/platform/android/io/flutter/view/FlutterMain.java +++ b/shell/platform/android/io/flutter/view/FlutterMain.java @@ -6,6 +6,7 @@ import android.content.Context; import android.content.Intent; +import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.res.AssetManager; import android.app.AlarmManager; @@ -195,7 +196,12 @@ public static void ensureInitializationComplete(Context applicationContext, Stri sResourceExtractor.waitForCompletion(); List shellArgs = new ArrayList<>(); + shellArgs.add("--icu-symbol-prefix=_binary_icudtl_dat"); + ApplicationInfo applicationInfo = applicationContext.getPackageManager().getApplicationInfo( + applicationContext.getPackageName(), PackageManager.GET_META_DATA); + shellArgs.add("--icu-native-lib-path=" + applicationInfo.nativeLibraryDir + File.separator + DEFAULT_LIBRARY); + if (args != null) { Collections.addAll(shellArgs, args); } From 8b1a299ed52d4ef9521ccd65c6c52d563129d8af Mon Sep 17 00:00:00 2001 From: Will Larche Date: Wed, 13 Mar 2019 08:56:11 -0400 Subject: [PATCH 0430/1117] [Skia] Rollback Skia to 29d5dec9a0783a033b921dc483fb98d565d684f6 (#8151) * [Skia] Rollback skia to 29d5dec9a0783a033b921dc483fb98d565d684f6 * [Skia] Rollback Skia License to 0dd2b3de568e29ad48747dd78b7125d9 --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 1988f3f21b8a7..51f4e6284ad5a 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': '2eecc3ea3d71613463fe2816c3852e1f6c99105b', + 'skia_revision': '29d5dec9a0783a033b921dc483fb98d565d684f6', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 4a14a592da226..1070233d9ad34 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c96897f617fbf476f372b7b6c0239d6a +Signature: 0dd2b3de568e29ad48747dd78b7125d9 UNUSED LICENSES: From 8be2aca5670d1fa3beb980f46a3da5f9199a28b1 Mon Sep 17 00:00:00 2001 From: Siva Date: Wed, 13 Mar 2019 09:23:57 -0700 Subject: [PATCH 0431/1117] Roll src/third_party/dart 1bd36d694d..674fd0e060 (48 commits) #8152 674fd0e060 [vm runtime] Dynamically disable dual mapping of code on some platforms 0bd674c374 [VM-Runtime] set environment when creating detached process 578fdb0408 Call becomeMap/becomeSet() in AstCloner. 382cd59388 Update completion target tests for new map syntax 1db664764a Revert "Copy abi dills in create_sdk build rule" a39833d957 Reland "Reland "[VM runtime] Dual mapping of executable pages."" 49a0502f49 Copy abi dills in create_sdk build rule 23eb57c2bf Revert "[vm/ffi] Support Windows 64 bit" 22c2c7ffd8 Sort declarations in build_mode.dart e2b5559c77 [infra] Use gclient.py to apply patches to bypass update_depot_tools f4b524cdf1 [vm] Extract reading of parameter covariance attributes 16e40cef2f Generate a diagnostic when a set or map literal is ambiguous b89d08355b [infra] Only move coredump files on shards 7f812dea1a [vm/ffi] Support Windows 64 bit 469da726d6 [vm] Put covariance attributes into Field flags 09087490e2 update hasFix lookup table bb7b5fcd37 add missing fix tests 48a5c3825a assist to convert to absolute imports b3927f66df [gardening] Mark tests that crash as crashing 2d6ddf2aff Remove unnecessary override from PartialResolverVisitor ba3b9b3b65 Sort static_type_analyzer_test.dart 1edc6d4b4d [infra] Fix approve_results not erroring properly if tryjobs lack results. 1a196d43a7 [VM/AOT] Execute catch-entry moves in parallel (our AOT doesn't generate non-cyclic moves) 6a2aa920cd Support pragma annotations through ir constants d3d077090d [VM/FrontendServer] Add 3head patch to frontend server after breaking API changes 016e3172d1 Default parameters, more metadata, import dart:core. 853d38896e [VM/AOT] Fixes incorrect deserialization of catch entry moves 3cf7d6a9c7 [tests] Changing expected cast errors to type errors for collections tests b87c44d6b3 Generate diagnostic for non-bool conditions in if elements 74395d940f Comment out test_import_short_absolute that fails on Windows. 7c1544898d [vm] Decouple flow graph building of implicit getters and setters from kernel reading 57f4da318c [vm, gc] The mutator's TLAB and the interpreter's lookup cache must be visited even if the mutator is unscheduled. 15842d4583 Build more import scopes, support for enums. f2029f54cd Fix type inference of map/set literals when the context is a type parameter. 11b9481403 [vm/frontend] Fix frontend_server_test on Windows. bfb30bffe0 Fix a bug in the ConstantVerifier so that conditional elements are lazily verified ed1f956991 Fix the abi dills download script 8f03ae05ff [infra] Add --list-configurations option to test.dart. 9faca2fa68 [vm] Document lifetime requirements of arguments to Dart_TimelineEvent. 295ea59385 [vm] Give functions compiled through Dart_LoadCompilationTrace a non-zero usage counter. def0b21225 [infra] Fix test.dart saying untested configurations don't exist. abd1854176 Fix recording of map/literal context type. a8b3461f2e New summaries work snapshot. 9e7627b6a1 Re-land "Eliminate uses of old AST node types from pkg/analyzer/lib/src/summary" 210361ae63 Move IgnoreInfo out of the task model code base 440b4cd84e Insert implicit casts when setting interface targets 567d552de8 [infra] Add versionchecker and debianpackage to test matrix 576c4c71d9 [CFE] Always clone subexpressions of unevaluated constants. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 3 ++- frontend_server/lib/server.dart | 4 ++-- sky/packages/sky_engine/LICENSE | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index 51f4e6284ad5a..95381d48b4bd2 100644 --- a/DEPS +++ b/DEPS @@ -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': '674fd0e060a33deeedbc2f8fae7c32c7e3f0d8d5', + 'dart_revision': '1bd36d694dba00d92651fcd2340e91d5a74efb03', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 810f926095112..f6dcc6e5e6553 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 61c85403b45c4241c745ac885c7da2ce +Signature: b7183327d115ae031ff3f9997d96a04e UNUSED LICENSES: @@ -5708,6 +5708,7 @@ FILE: ../../../third_party/dart/runtime/lib/ffi_native_type_patch.dart FILE: ../../../third_party/dart/runtime/lib/ffi_patch.dart FILE: ../../../third_party/dart/runtime/tools/graphexplorer/graphexplorer.html FILE: ../../../third_party/dart/runtime/tools/graphexplorer/graphexplorer.js +FILE: ../../../third_party/dart/runtime/vm/catch_entry_moves_test.cc FILE: ../../../third_party/dart/runtime/vm/class_id.h FILE: ../../../third_party/dart/runtime/vm/code_entry_kind.h FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier.cc diff --git a/frontend_server/lib/server.dart b/frontend_server/lib/server.dart index 5d84d2dcf95ba..e82b855e6c728 100644 --- a/frontend_server/lib/server.dart +++ b/frontend_server/lib/server.dart @@ -32,8 +32,8 @@ class _FlutterFrontendCompiler implements frontend.CompilerInterface{ } @override - Future recompileDelta({String filename}) async { - return _compiler.recompileDelta(filename: filename); + Future recompileDelta({String entryPoint}) async { + return _compiler.recompileDelta(entryPoint: entryPoint); } @override diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index 9359d43fa29a6..658e1e8c7cd99 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -2808,6 +2808,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- boringssl +engine etc1 observatory_pub_packages skia From 2e427030f616172195297c0c26586f9d85166422 Mon Sep 17 00:00:00 2001 From: "Ray Rischpater, KF6GPE" Date: Wed, 13 Mar 2019 10:19:54 -0700 Subject: [PATCH 0432/1117] Revert "Disable build_ios task due to lack of credits. (#8150)" (#8153) This reverts commit 59715b71db8e3d9d9c3ca47db6555a7a6789c180. --- .cirrus.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index cc6796b3faf69..2492afbd0fbf4 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -60,6 +60,39 @@ task: mkdir javadoc_tmp ./flutter/tools/gen_javadoc.py --out-dir javadoc_tmp +task: + name: build_ios + use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' + osx_instance: + image: high-sierra-xcode-9.4.1 + env: + CIRRUS_WORKING_DIR: "/tmp/github_repo" + ENGINE_PATH: "/tmp/engine" + DEPOT_TOOLS: "/tmp/depot_tools" + PATH: "$DEPOT_TOOLS:$PATH" + depot_tools_script: + git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS + # jazzy_script: + # sudo gem install jazzy@0.9.4 + gclient_sync_script: | + mkdir -p $ENGINE_PATH/src + echo 'solutions = [{"managed": False,"name": "src/flutter","url": "git@github.com:flutter/engine.git","deps_file": "DEPS", "custom_vars": {"download_android_deps" : False, "download_windows_deps" : False,},},]' > $ENGINE_PATH/.gclient + cd $ENGINE_PATH/src + rm -rf flutter + rm -rf out + mv $CIRRUS_WORKING_DIR flutter + gclient sync + compile_host_script: | + cd $ENGINE_PATH/src + ./flutter/tools/gn --ios --unoptimized + ninja -C out/ios_debug_unopt + # TODO(dnfield): when we can install jazzy properly, we should do this. + # AFAICT we can't because of Xcode version. + # mkdir objcdoc_tmp + # pushd flutter + # ./tools/gen_objcdoc.sh ../objcdoc_tmp + # popd + format_and_dart_test_task: container: image: gcr.io/flutter-cirrus/build-engine-image:latest From 2daebebf4b8fab696b99cba2631492ff805ff7bb Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Wed, 13 Mar 2019 11:13:53 -0700 Subject: [PATCH 0433/1117] Fix text.dart height docs (#8079) --- lib/stub_ui/text.dart | 38 +++++++++++++++++--------------------- lib/ui/text.dart | 38 +++++++++++++++++--------------------- 2 files changed, 34 insertions(+), 42 deletions(-) diff --git a/lib/stub_ui/text.dart b/lib/stub_ui/text.dart index e523490d18603..dd07b232980ca 100644 --- a/lib/stub_ui/text.dart +++ b/lib/stub_ui/text.dart @@ -375,7 +375,7 @@ class TextStyle { /// * `letterSpacing`: The amount of space (in logical pixels) to add between each letter. /// * `wordSpacing`: The amount of space (in logical pixels) to add at each sequence of white-space (i.e. between each word). /// * `textBaseline`: The common baseline that should be aligned between this text span and its parent text span, or, for the root text spans, with the line box. - /// * `height`: The height of this text span, as a multiple of the font size. + /// * `height`: The height of this text span, as a multiplier of the font size. /// * `locale`: The locale used to select region-specific glyphs. /// * `background`: The paint drawn as a background for the text. /// * `foreground`: The paint used to draw the text. If this is specified, `color` must be null. @@ -609,19 +609,15 @@ class ParagraphStyle { /// dropped. The width constraints are those set in the /// [ParagraphConstraints] object passed to the [Paragraph.layout] method. /// - /// * `fontFamily`: The name of the font to use when painting the text (e.g., - /// Roboto). + /// * `fontFamily`: The fallback name of the font to use when painting the text + /// (e.g., Roboto). This is used when there is no [TextStyle]. /// - /// * `fontSize`: The size of glyphs (in logical pixels) to use when painting - /// the text. + /// * `fontSize`: The fallback size of glyphs (in logical pixels) to + /// use when painting the text. This is used when there is no [TextStyle]. /// - /// * `height`: The minimum height of the line boxes, as a multiple of the - /// font size. The lines of the paragraph will be at least - /// `(height + leading) * fontSize` tall when fontSize - /// is not null. When fontSize is null, there is no minimum line height. Tall - /// glyphs due to baseline alignment or large [TextStyle.fontSize] may cause - /// the actual line height after layout to be taller than specified here. - /// [fontSize] must be provided for this property to take effect. + /// * `height`: The height of the spans as a multiplier of the font size. The + /// fallback height to use when no height is provided in through + /// [TextStyle.height]. /// /// * `fontWeight`: The typeface thickness to use when painting the text /// (e.g., bold). @@ -807,13 +803,13 @@ class StrutStyle { /// * `fontSize`: The size of glyphs (in logical pixels) to use when painting /// the text. /// - /// * `lineHeight`: The minimum height of the line boxes, as a multiple of the - /// font size. The lines of the paragraph will be at least - /// `(lineHeight + leading) * fontSize` tall when fontSize - /// is not null. When fontSize is null, there is no minimum line height. Tall - /// glyphs due to baseline alignment or large [TextStyle.fontSize] may cause - /// the actual line height after layout to be taller than specified here. - /// [fontSize] must be provided for this property to take effect. + /// * `height`: The minimum height of the line boxes, as a multiplier of the + /// font size. The lines of the paragraph will be at least `(height + leading) + /// * fontSize` tall when fontSize is not null. When fontSize is null, there + /// is no minimum line height. Tall glyphs due to baseline alignment or large + /// [TextStyle.fontSize] may cause the actual line height after layout to be + /// taller than specified here. [fontSize] must be provided for this property + /// to take effect. /// /// * `leading`: The minimum amount of leading between lines as a multiple of /// the font size. [fontSize] must be provided for this property to take effect. @@ -825,11 +821,11 @@ class StrutStyle { /// italics). /// /// * `forceStrutHeight`: When true, the paragraph will force all lines to be exactly - /// `(lineHeight + leading) * fontSize` tall from baseline to baseline. + /// `(height + leading) * fontSize` tall from baseline to baseline. /// [TextStyle] is no longer able to influence the line height, and any tall /// glyphs may overlap with lines above. If a [fontFamily] is specified, the /// total ascent of the first line will be the min of the `Ascent + half-leading` - /// of the [fontFamily] and `(lineHeight + leading) * fontSize`. Otherwise, it + /// of the [fontFamily] and `(height + leading) * fontSize`. Otherwise, it /// will be determined by the Ascent + half-leading of the first text. StrutStyle({ String fontFamily, diff --git a/lib/ui/text.dart b/lib/ui/text.dart index 899751d4a82cd..312b917573d89 100644 --- a/lib/ui/text.dart +++ b/lib/ui/text.dart @@ -375,7 +375,7 @@ class TextStyle { /// * `letterSpacing`: The amount of space (in logical pixels) to add between each letter. /// * `wordSpacing`: The amount of space (in logical pixels) to add at each sequence of white-space (i.e. between each word). /// * `textBaseline`: The common baseline that should be aligned between this text span and its parent text span, or, for the root text spans, with the line box. - /// * `height`: The height of this text span, as a multiple of the font size. + /// * `height`: The height of this text span, as a multiplier of the font size. /// * `locale`: The locale used to select region-specific glyphs. /// * `background`: The paint drawn as a background for the text. /// * `foreground`: The paint used to draw the text. If this is specified, `color` must be null. @@ -610,19 +610,15 @@ class ParagraphStyle { /// dropped. The width constraints are those set in the /// [ParagraphConstraints] object passed to the [Paragraph.layout] method. /// - /// * `fontFamily`: The name of the font to use when painting the text (e.g., - /// Roboto). + /// * `fontFamily`: The name of the font family to apply when painting the text, + /// in the absence of a `textStyle` being attached to the span. /// - /// * `fontSize`: The size of glyphs (in logical pixels) to use when painting - /// the text. + /// * `fontSize`: The fallback size of glyphs (in logical pixels) to + /// use when painting the text. This is used when there is no [TextStyle]. /// - /// * `height`: The minimum height of the line boxes, as a multiple of the - /// font size. The lines of the paragraph will be at least - /// `(height + leading) * fontSize` tall when fontSize - /// is not null. When fontSize is null, there is no minimum line height. Tall - /// glyphs due to baseline alignment or large [TextStyle.fontSize] may cause - /// the actual line height after layout to be taller than specified here. - /// [fontSize] must be provided for this property to take effect. + /// * `height`: The height of the spans as a multiplier of the font size. The + /// fallback height to use when no height is provided in through + /// [TextStyle.height]. /// /// * `fontWeight`: The typeface thickness to use when painting the text /// (e.g., bold). @@ -808,13 +804,13 @@ class StrutStyle { /// * `fontSize`: The size of glyphs (in logical pixels) to use when painting /// the text. /// - /// * `lineHeight`: The minimum height of the line boxes, as a multiple of the - /// font size. The lines of the paragraph will be at least - /// `(lineHeight + leading) * fontSize` tall when fontSize - /// is not null. When fontSize is null, there is no minimum line height. Tall - /// glyphs due to baseline alignment or large [TextStyle.fontSize] may cause - /// the actual line height after layout to be taller than specified here. - /// [fontSize] must be provided for this property to take effect. + /// * `height`: The minimum height of the line boxes, as a multiplier of the + /// font size. The lines of the paragraph will be at least `(height + leading) + /// * fontSize` tall when fontSize is not null. When fontSize is null, there + /// is no minimum line height. Tall glyphs due to baseline alignment or large + /// [TextStyle.fontSize] may cause the actual line height after layout to be + /// taller than specified here. [fontSize] must be provided for this property + /// to take effect. /// /// * `leading`: The minimum amount of leading between lines as a multiple of /// the font size. [fontSize] must be provided for this property to take effect. @@ -826,11 +822,11 @@ class StrutStyle { /// italics). /// /// * `forceStrutHeight`: When true, the paragraph will force all lines to be exactly - /// `(lineHeight + leading) * fontSize` tall from baseline to baseline. + /// `(height + leading) * fontSize` tall from baseline to baseline. /// [TextStyle] is no longer able to influence the line height, and any tall /// glyphs may overlap with lines above. If a [fontFamily] is specified, the /// total ascent of the first line will be the min of the `Ascent + half-leading` - /// of the [fontFamily] and `(lineHeight + leading) * fontSize`. Otherwise, it + /// of the [fontFamily] and `(height + leading) * fontSize`. Otherwise, it /// will be determined by the Ascent + half-leading of the first text. StrutStyle({ String fontFamily, From b1b388f1c2356a865240e706acdb37af982991ad Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 13 Mar 2019 11:30:42 -0700 Subject: [PATCH 0434/1117] Encode scroll motion events in the Android touch processor (#8149) --- .../engine/android/AndroidTouchProcessor.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java b/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java index f26cc3e2bc84f..8598b8a8df772 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java @@ -150,7 +150,9 @@ public boolean onGenericMotionEvent(MotionEvent event) { // Mouse hover support is not implemented for API < 18. boolean isPointerEvent = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && event.isFromSource(InputDevice.SOURCE_CLASS_POINTER); - if (!isPointerEvent || event.getActionMasked() != MotionEvent.ACTION_HOVER_MOVE) { + boolean isMovementEvent = (event.getActionMasked() == MotionEvent.ACTION_HOVER_MOVE + || event.getActionMasked() == MotionEvent.ACTION_SCROLL); + if (!isPointerEvent || !isMovementEvent) { return false; } @@ -181,7 +183,9 @@ private void addPointerForIndex( int pointerKind = getPointerDeviceTypeForToolType(event.getToolType(pointerIndex)); - int signalKind = PointerSignalKind.NONE; + int signalKind = event.getActionMasked() == MotionEvent.ACTION_SCROLL + ? PointerSignalKind.SCROLL + : PointerSignalKind.NONE; long timeStamp = event.getEventTime() * 1000; // Convert from milliseconds to microseconds. @@ -242,8 +246,13 @@ private void addPointerForIndex( packet.putLong(pointerData); // platformData - packet.putDouble(0.0); // scroll_delta_x - packet.putDouble(0.0); // scroll_delta_y + if (signalKind == PointerSignalKind.SCROLL) { + packet.putDouble(-event.getAxisValue(MotionEvent.AXIS_HSCROLL)); // scroll_delta_x + packet.putDouble(-event.getAxisValue(MotionEvent.AXIS_VSCROLL)); // scroll_delta_y + } else { + packet.putDouble(0.0); // scroll_delta_x + packet.putDouble(0.0); // scroll_delta_x + } } @PointerChange @@ -269,6 +278,9 @@ private int getPointerChangeForAction(int maskedAction) { if (maskedAction == MotionEvent.ACTION_CANCEL) { return PointerChange.CANCEL; } + if (maskedAction == MotionEvent.ACTION_SCROLL) { + return PointerChange.HOVER; + } return -1; } From 3c93817839bd557a045b17322b797fb4772c18f4 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 13 Mar 2019 12:54:57 -0700 Subject: [PATCH 0435/1117] =?UTF-8?q?Add=20=E2=80=9Cfull-dart-debug?= =?UTF-8?q?=E2=80=9D=20that=20disabled=20optimizations=20in=20the=20Dart?= =?UTF-8?q?=20VM.=20(#8147)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/gn | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/gn b/tools/gn index ee784e5300d33..16bdcf034b040 100755 --- a/tools/gn +++ b/tools/gn @@ -139,6 +139,10 @@ def to_gn_args(args): if args.dart_debug: gn_args['dart_debug'] = True + if args.full_dart_debug: + gn_args['dart_debug'] = True + gn_args['dart_debug_optimization_level'] = '0' + if args.target_os == 'android': gn_args['target_cpu'] = args.android_cpu elif args.target_os == 'ios': @@ -247,7 +251,10 @@ def parse_args(args): parser.add_argument('--runtime-mode', type=str, choices=['debug', 'profile', 'release'], default='debug') parser.add_argument('--dynamic', default=False, action='store_true') parser.add_argument('--interpreter', default=False, action='store_true') - parser.add_argument('--dart-debug', default=False, action='store_true') + parser.add_argument('--dart-debug', default=False, action='store_true', help='Enables assertsion in the Dart VM. ' + + 'Does not affect affect optimization levels. If you need to disable optimizations in Dart, use --full-dart-debug') + parser.add_argument('--full-dart-debug', default=False, action='store_true', help='Implies --dart-debug ' + + 'and also disables optimizations in the Dart VM making it easier to step through VM code in the debugger.') parser.add_argument('--target-os', type=str, choices=['android', 'ios', 'linux']) parser.add_argument('--android', dest='target_os', action='store_const', const='android') From 906d684a7765cfe37b0edcdd167d3e319c7a22d4 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 13 Mar 2019 13:53:22 -0700 Subject: [PATCH 0436/1117] Reland ""Add support for trace counters with variable arguments and instrument the raster cache." (#8145) This reverts commit bc901324faf5a24f9220cc7ecbcf5b97b96ae09f and fixes the discovered on Windows builds. --- flow/raster_cache.cc | 35 +++++++++++++++++++++-- flow/raster_cache.h | 7 +++++ fml/trace_event.cc | 38 +++++++++++++++++-------- fml/trace_event.h | 68 ++++++++++++++++++++++++++++++++++++++++---- tools/gn | 2 -- 5 files changed, 129 insertions(+), 21 deletions(-) diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index 1927321a03238..9f10e47de250c 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -97,6 +97,7 @@ static RasterCacheResult Rasterize( bool checkerboard, const SkRect& logical_rect, std::function draw_function) { + TRACE_EVENT0("flutter", "RasterCachePopulate"); SkIRect cache_rect = RasterCache::GetDeviceBounds(logical_rect, ctm); const SkImageInfo image_info = SkImageInfo::MakeN32Premul( @@ -129,8 +130,6 @@ RasterCacheResult RasterizePicture(SkPicture* picture, 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); }); @@ -240,6 +239,7 @@ void RasterCache::SweepAfterFrame() { SweepOneCacheAfterFrame(picture_cache_); SweepOneCacheAfterFrame(layer_cache_); picture_cached_this_frame_ = 0; + TraceStatsToTimeline(); } void RasterCache::Clear() { @@ -259,4 +259,35 @@ void RasterCache::SetCheckboardCacheImages(bool checkerboard) { Clear(); } +void RasterCache::TraceStatsToTimeline() const { +#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE + + size_t layer_cache_count = 0; + size_t layer_cache_bytes = 0; + size_t picture_cache_count = 0; + size_t picture_cache_bytes = 0; + + for (const auto& item : layer_cache_) { + const auto dimensions = item.second.image.image_dimensions(); + layer_cache_count++; + layer_cache_bytes += dimensions.width() * dimensions.height() * 4; + } + + for (const auto& item : picture_cache_) { + const auto dimensions = item.second.image.image_dimensions(); + picture_cache_count++; + picture_cache_bytes += dimensions.width() * dimensions.height() * 4; + } + + FML_TRACE_COUNTER("flutter", "RasterCache", + reinterpret_cast(this), // + "LayerCount", layer_cache_count, // + "LayerMBytes", layer_cache_bytes * 1e-6, // + "PictureCount", picture_cache_count, // + "PictureMBytes", picture_cache_bytes * 1e-6 // + ); + +#endif // FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE +} + } // namespace flow diff --git a/flow/raster_cache.h b/flow/raster_cache.h index 74ce010b07c8c..f0382c9c92872 100644 --- a/flow/raster_cache.h +++ b/flow/raster_cache.h @@ -33,6 +33,10 @@ class RasterCacheResult { void draw(SkCanvas& canvas, const SkPaint* paint = nullptr) const; + SkISize image_dimensions() const { + return image_ ? image_->dimensions() : SkISize::Make(0, 0); + }; + private: sk_sp image_; SkRect logical_rect_; @@ -87,6 +91,7 @@ class RasterCache { 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(); @@ -127,6 +132,8 @@ class RasterCache { bool checkerboard_images_; fml::WeakPtrFactory weak_factory_; + void TraceStatsToTimeline() const; + FML_DISALLOW_COPY_AND_ASSIGN(RasterCache); }; diff --git a/fml/trace_event.cc b/fml/trace_event.cc index 69ed8b2216486..fc0ee72f4021b 100644 --- a/fml/trace_event.cc +++ b/fml/trace_event.cc @@ -4,22 +4,36 @@ #include "flutter/fml/trace_event.h" -#include "third_party/dart/runtime/include/dart_tools_api.h" +#include + +#include "flutter/fml/logging.h" namespace fml { namespace tracing { -void TraceCounter(TraceArg category_group, TraceArg name, TraceIDArg count) { - auto count_string = std::to_string(count); - const char* arg_names[] = {name}; - const char* arg_values[] = {count_string.c_str()}; - Dart_TimelineEvent(name, // label - Dart_TimelineGetMicros(), // timestamp0 - 0, // timestamp1_or_async_id - Dart_Timeline_Event_Counter, // event type - 1, // argument_count - arg_names, // argument_names - arg_values // argument_values +void TraceTimelineEvent(TraceArg category_group, + TraceArg name, + TraceIDArg identifier, + Dart_Timeline_Event_Type type, + const std::vector& c_names, + const std::vector& values) { + const auto argument_count = std::min(c_names.size(), values.size()); + + std::vector c_values; + c_values.resize(argument_count, nullptr); + + for (size_t i = 0; i < argument_count; i++) { + c_values[i] = values[i].c_str(); + } + + Dart_TimelineEvent( + name, // label + Dart_TimelineGetMicros(), // timestamp0 + identifier, // timestamp1_or_async_id + type, // event type + argument_count, // argument_count + const_cast(c_names.data()), // argument_names + c_values.data() // argument_values ); } diff --git a/fml/trace_event.h b/fml/trace_event.h index b3bba9b281f61..b8063aca3a2df 100644 --- a/fml/trace_event.h +++ b/fml/trace_event.h @@ -13,8 +13,6 @@ #include -#define FML_TRACE_COUNTER(category_group, name, count) \ - TRACE_COUNTER(category_group, name, 0u, name, count) #define TRACE_EVENT0(a, b) TRACE_DURATION(a, b) #define TRACE_EVENT1(a, b, c, d) TRACE_DURATION(a, b, c, d) #define TRACE_EVENT2(a, b, c, d, e, f) TRACE_DURATION(a, b, c, d, e, f) @@ -28,8 +26,11 @@ #include #include #include +#include +#include #include "flutter/fml/macros.h" +#include "third_party/dart/runtime/include/dart_tools_api.h" #if !defined(OS_FUCHSIA) @@ -45,8 +46,9 @@ // from trace/event.h on Fuchsia. // // TODO(chinmaygarde): All macros here should have the FML prefix. -#define FML_TRACE_COUNTER(category_group, name, count) \ - ::fml::tracing::TraceCounter(category_group, name, count); +#define FML_TRACE_COUNTER(category_group, name, counter_id, arg1, ...) \ + ::fml::tracing::TraceCounter((category_group), (name), (counter_id), (arg1), \ + __VA_ARGS__); #define TRACE_EVENT0(category_group, name) \ ::fml::tracing::TraceEvent0(category_group, name); \ @@ -99,7 +101,63 @@ namespace tracing { using TraceArg = const char*; using TraceIDArg = int64_t; -void TraceCounter(TraceArg category_group, TraceArg name, TraceIDArg count); +void TraceTimelineEvent(TraceArg category_group, + TraceArg name, + TraceIDArg id, + Dart_Timeline_Event_Type type, + const std::vector& names, + const std::vector& values); + +inline std::string TraceToString(const char* string) { + return std::string{string}; +} + +inline std::string TraceToString(std::string string) { + return string; +} + +template ::value>> +std::string TraceToString(T string) { + return std::to_string(string); +} + +inline void SplitArgumentsCollect(std::vector& keys, + std::vector& values) {} + +template +void SplitArgumentsCollect(std::vector& keys, + std::vector& values, + Key key, + Value value, + Args... args) { + keys.emplace_back(key); + values.emplace_back(TraceToString(value)); + SplitArgumentsCollect(keys, values, args...); +} + +inline std::pair, std::vector> +SplitArguments() { + return {}; +} + +template +std::pair, std::vector> +SplitArguments(Key key, Value value, Args... args) { + std::vector keys; + std::vector values; + SplitArgumentsCollect(keys, values, key, value, args...); + return std::make_pair(std::move(keys), std::move(values)); +} + +template +void TraceCounter(TraceArg category, + TraceArg name, + TraceIDArg identifier, + Args... args) { + auto split = SplitArguments(args...); + TraceTimelineEvent(category, name, identifier, Dart_Timeline_Event_Counter, + split.first, split.second); +} void TraceEvent0(TraceArg category_group, TraceArg name); diff --git a/tools/gn b/tools/gn index 16bdcf034b040..344d8475e5f96 100755 --- a/tools/gn +++ b/tools/gn @@ -93,8 +93,6 @@ def to_gn_args(args): if not sys.platform.startswith(('cygwin', 'win')): gn_args['use_clang_static_analyzer'] = args.clang_static_analyzer - else: - gn_args['use_clang_static_analyzer'] = False gn_args['embedder_for_target'] = args.embedder_for_target From fdad56f5fbbcc3f7cdbc7c07f4cfb58a631969a4 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Wed, 13 Mar 2019 14:26:42 -0700 Subject: [PATCH 0437/1117] Anti-Aliasing for shape layers (#8157) --- flow/layers/physical_shape_layer.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/flow/layers/physical_shape_layer.cc b/flow/layers/physical_shape_layer.cc index 005945f8f53be..93bd2664a916c 100644 --- a/flow/layers/physical_shape_layer.cc +++ b/flow/layers/physical_shape_layer.cc @@ -142,6 +142,7 @@ void PhysicalShapeLayer::Paint(PaintContext& context) const { // Call drawPath without clip if possible for better performance. SkPaint paint; paint.setColor(color_); + paint.setAntiAlias(true); if (clip_behavior_ != Clip::antiAliasWithSaveLayer) { context.leaf_nodes_canvas->drawPath(path_, paint); } From fcc66fc2357fb273c69d572b9034e4d4a66eeb81 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 13 Mar 2019 14:36:35 -0700 Subject: [PATCH 0438/1117] Suppress deprecation warning for use of Build.CPU_ABI (#8154) --- shell/platform/android/io/flutter/view/ResourceExtractor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/platform/android/io/flutter/view/ResourceExtractor.java b/shell/platform/android/io/flutter/view/ResourceExtractor.java index ecbd026c9db09..2895db56b4cbb 100644 --- a/shell/platform/android/io/flutter/view/ResourceExtractor.java +++ b/shell/platform/android/io/flutter/view/ResourceExtractor.java @@ -409,8 +409,9 @@ private String getAPKPath() { } } + @SuppressWarnings("deprecation") private static String[] getSupportedAbis() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.SUPPORTED_ABIS.length > 0) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return Build.SUPPORTED_ABIS; } else { ArrayList cpuAbis = new ArrayList(asList(Build.CPU_ABI, Build.CPU_ABI2)); From cae0836576df83c7d75432226a81f16eb76b285e Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 13 Mar 2019 13:46:24 -0700 Subject: [PATCH 0439/1117] Roll src/third_party/dart 1bd36d694d..7d560f8385 (27 commits) 7d560f8385 Remove outdated entries from .packages ee529e3451 [vm] Fix typo forwader => forwarder 2ddb2d2d20 Change 'analyze tests co19_2' to use '-asserts'. b03db45379 [vm] Decouple flow graph building of dynamic invocation forwarders from kernel reading 6587483d33 [frontend] Dont re-report compile-expression errors. 81fa14eb3c Hollow out AnalysisContextImpl. b10a6bd5ce [testing] Multitests' copied imports should not be read-only 9684748784 Removes superfluous Dart_ExitScope() call in CreateVmServiceIsolate. 4a7556840f Rename tests ending with Test_Driver 8c3f74817e dartfmt -w --fix dart:collection afb459f7fa [cfe] Iterate map entries in map spreads ed5bc9c538 [vm] Fix AssertAssignable strengthening sometimes using wrong deopt_id. 8436dca626 [co19] DEPS updated a43c525de2 Reland "[vm/ffi] Support Windows 64 bit" 3bc3205e39 Move ConstantValue handling outside BehaviorBuilder 63e22ea497 Remove unused parts of NativeDataBuilder f307524421 Support native member annotations through ir constants 7cfe216e6b TypeInferrer.library is null iff topLevel 03ecefc0b2 Move ShadowMember.resolveInferenceNode to TypeInferenceEngine c7270f25fe Add Declaration.isAnonymousMixinApplication 0cbce074ac Add toString to Substitution b990c503c8 Fix typo in mixin transformer da3c23bdaa Test override-based inference when inheriting conflicting types f200c37553 Enable extra VM options in fasta script 69c1d1096d Update test as combined member signature would fail 68aeb5cec2 Tweak error messages related to inference and overriding. 0a337bb36f Report CONST_SPREAD_EXPECTED_LIST_OR_SET and CONST_SPREAD_EXPECTED_MAP. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- sky/packages/sky_engine/LICENSE | 30 ------------------------- 3 files changed, 2 insertions(+), 32 deletions(-) diff --git a/DEPS b/DEPS index 95381d48b4bd2..4830e8b8d614a 100644 --- a/DEPS +++ b/DEPS @@ -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': '1bd36d694dba00d92651fcd2340e91d5a74efb03', + 'dart_revision': '7d560f8385eaeee0fd95ec08e25db0c217b1cd3e', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index f6dcc6e5e6553..a957b5281d8ba 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: b7183327d115ae031ff3f9997d96a04e +Signature: 16a53deb75e70c3091e030f3f0214527 UNUSED LICENSES: diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index 658e1e8c7cd99..e86eeeeced451 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -10966,36 +10966,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- skia -Copyright 2019 Google, LLC - -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 From cdf55a8d796c36f8378934ce0fede40806a0d8ff Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 13 Mar 2019 22:28:55 -0400 Subject: [PATCH 0440/1117] Roll src/third_party/skia 29d5dec9a078..1386b2d5579d (123 commits) (#8161) https://skia.googlesource.com/skia.git/%2Blog/29d5dec9a078..1386b2d5579d git log 29d5dec9a0783a033b921dc483fb98d565d684f6..1386b2d5579d45be7a81f8706ad1c407e1210dab --date=short --no-merges --format=%ad %ae %s 2019-03-13 reed@google.com pass common SkStageRec to all effects using rasterpipeline 2019-03-13 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 4e87659e289c..494afea985e6 (2 commits) 2019-03-14 bsalomon@google.com Revert "Try to avoid vertex colors in Texture/FillRect ops when possible." 2019-03-13 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-13 bsalomon@google.com Try to avoid vertex colors in Texture/FillRect ops when possible. 2019-03-13 herb@google.com Fallback for source should not use sub-pixel positioning. 2019-03-13 reed@google.com assert that during restore, the layer and its parent are in the same colorspace 2019-03-13 herb@google.com Use bulk api in direct-to-screen fallback 2019-03-13 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 6480d4e10cb5..4ef71eb81f5d (3 commits) 2019-03-13 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 25ec7b0cd393..6480d4e10cb5 (1 commits) 2019-03-13 enne@chromium.org Fix uninitialized read in too small SkDescriptor 2019-03-13 csmartdalton@google.com Remove GrAAType::kMixedSamples 2019-03-13 csmartdalton@google.com Replace GrAAType with flags for path renderers 2019-03-12 benjaminwagner@google.com Omit some SKPs that seem to cause GalaxyS9 to crash. 2018-11-15 mtklein@google.com reland: add private non-copying SkReadBuffer::readString() 2019-03-13 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-03-13 fmalita@chromium.org [skottie] Use kMedium_SkFilterQuality for image filtering 2019-03-13 stephana@google.com Fix Pixel 3 dimension 2019-03-13 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 3c1f5a6bd487..4e87659e289c (1 commits) 2019-03-13 brianosman@google.com Clamp in GrBicubicEffect (to match SW and for general sanity) 2019-03-13 brianosman@google.com Include test name in error messages for failing tests 2019-03-13 mtklein@google.com Revert "add private non-copying SkReadBuffer::readString()" 2019-03-12 herb@google.com Check that a glyph will fit in the atlas instead of a bogus check 2019-03-13 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 1407297b7f7d..25ec7b0cd393 (1 commits) 2019-03-13 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader dd2faaeee6b2..1407297b7f7d (1 commits) 2019-03-13 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader bea4751348ca..dd2faaeee6b2 (1 commits) 2019-03-13 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 b6eb34122e07..3c1f5a6bd487 (2 commits) 2019-03-13 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader aa8f699a90af..bea4751348ca (2 commits) 2019-03-13 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 37fe521d6049..54744c955cd6 (411 commits) 2019-03-13 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 914a46d47952..aa8f699a90af (1 commits) 2019-03-12 mtklein@google.com tweak Descriptor_invalid_rec_size to not over-copy 2019-03-12 reed@google.com retain colorspace in blurimagefilter_raster 2019-03-12 enne@chromium.org Fix null pointer crash in looking up nonexistent typeface 2019-03-12 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-11 herb@google.com Introduce bulk strike api for glyph metrics for one draw case 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader b4de34ef039f..914a46d47952 (2 commits) 2019-03-12 reed@google.com remove dead SK_SUPPORT_LEGACY_RASTERLAYERCOLORSPACE code 2019-03-12 kjlubick@google.com [pathkit/canvaskit] Address race when uploading results 2019-03-12 enne@chromium.org Add validation to reading kRec_SkDescriptorTags 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader f945a5e172d0..b4de34ef039f (1 commits) 2019-03-12 herb@google.com Move GlyphAndPos and PathAndPos to interface and rename. 2019-03-12 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-12 mtklein@google.com simplify matrix color filter clamps 2019-03-12 reed@google.com Initial add SkMixers 2018-11-15 mtklein@google.com add private non-copying SkReadBuffer::readString() 2019-03-11 stephana@google.com [infra] Add Pixel3 devices 2019-03-11 khushalsagar@chromium.org remote fonts: Remove debug asserts for deserialization failures. 2019-03-12 ethannicholas@google.com added SK_API to SkSK::Compiler 2019-03-12 mtklein@google.com remove unused clamp_a_dst 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 c9bc33cff483..b6eb34122e07 (1 commits) 2019-03-12 robertphillips@google.com Always explicitly allocate except in Android Framework (take 3) 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 7ce5de0c17bd..f945a5e172d0 (1 commits) 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 6a1d92b526d4..7ce5de0c17bd (5 commits) 2019-03-12 jcgregorio@google.com Turn on CI/CD for api.skia.org. (skia) 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 6193cb187e4a..6a1d92b526d4 (1 commits) 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms 04a7830913b3..10ed3a8a5eec (1 commits) 2019-03-12 mtklein@google.com simplify filterColor() 2019-03-12 robertphillips@google.com Revert "Always explicitly allocate except in Android Framework (take 2)" 2019-03-12 kjlubick@google.com [particles] Turn on CI/CD for particles.skia.org 2019-03-12 robertphillips@google.com Revert "Always try to reduce opList splitting in DDL contexts/drawingManagers" 2019-03-12 robertphillips@google.com Revert "Temporarily re-add GrContextOptions::fExplicitlyAllocateGPUResources for Fuchsia" 2019-03-11 robertphillips@google.com Always try to reduce opList splitting in DDL contexts/drawingManagers 2019-03-12 robertphillips@google.com Temporarily re-add GrContextOptions::fExplicitlyAllocateGPUResources for Fuchsia 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader abb57857c536..6193cb187e4a (1 commits) 2019-03-12 gkaiser@google.com GrQuadPerEdgeAA: Fix typo in 'if' check 2019-03-12 kjlubick@google.com [pathkit] Clean up perf/test init 2019-03-12 bsalomon@google.com Revert "Reintroduce deinstantiate lazy proxy types and use for promise images." 2019-03-11 robertphillips@google.com Always explicitly allocate except in Android Framework (take 2) 2019-03-12 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-11 brianosman@google.com Remove SkToSRGBColorFilter (now unused) 2019-03-12 rmistry@google.com Add new recipe autoroller service account to list of recognized accounts 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3e2a4780e607..abb57857c536 (3 commits) 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3364227fa0d8..3e2a4780e607 (1 commits) 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 f563fdc91e83..c9bc33cff483 (2 commits) 2019-03-12 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src ba6c026602da..37fe521d6049 (397 commits) 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 654540e86243..3364227fa0d8 (1 commits) 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms c6c0aae921ea..04a7830913b3 (1 commits) 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 49c9dfe3b832..f563fdc91e83 (1 commits) 2019-03-11 kjlubick@google.com [canvaskit] Move from experimental to modules 2019-03-11 bsalomon@google.com Add GM for crbug.com/938592 2019-03-08 bsalomon@google.com Reintroduce deinstantiate lazy proxy types and use for promise images. 2019-03-11 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-11 brianosman@google.com Add clamped half-float pixel config to Ganesh 2019-03-11 kjlubick@google.com Add input length check when fuzzing 2019-03-07 michaelludwig@google.com Handle arbitrary and degenerate quadrilaterals in GrQuadPerEdgeAA 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms 2fb061752f70..c6c0aae921ea (1 commits) 2019-03-06 herb@google.com One routine to rule them all! 2019-03-11 reed@google.com rename mixer to lerp (in prep for SkMixer) 2019-03-11 stani@google.com Export libvulkan headers for android libraries depending on skia 2019-03-11 fmalita@chromium.org [skottie] Fix Gaussian blur repeat edge pixels semantics 2019-03-11 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-11 robertphillips@google.com Revert "Always explicitly allocate except in Android Framework" 2019-03-11 hcm@google.com update milestones to 2019 dates 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms d2f7012e6a85..2fb061752f70 (1 commits) 2019-03-11 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-08 herb@google.com Convert templates to virtuals in SkGlyphRunPainter 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader b72d28ff9975..654540e86243 (1 commits) 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms a81211f5ad2a..d2f7012e6a85 (1 commits) 2019-03-11 recipe-roller@chromium.org Roll recipe dependencies (trivial). 2019-03-11 robertphillips@google.com Always explicitly allocate except in Android Framework 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms 3b3522324e7b..a81211f5ad2a (1 commits) 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader bb8c8e211402..b72d28ff9975 (2 commits) 2019-03-11 jcgregorio@google.com Change all pointers to doxygen docs to point to api.skia.org. 2019-03-11 jvanverth@google.com Improve Metal texture uploads. 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader cd3e11d9464a..bb8c8e211402 (2 commits) 2019-03-11 brianosman@google.com Add flag to check that F16Norm pixels are clamped properly 2019-03-11 kjlubick@google.com Add oss-fuzz compatible fuzzers for sksl2* 2019-03-11 jcgregorio@google.com api.skia.org - Don't document private. 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader fa8603c6113f..cd3e11d9464a (1 commits) 2019-03-07 egdaniel@google.com Make vulkan GrBackendFormats with ycbcr external texture types. 2019-03-06 robertphillips@google.com Add kIdentity_SkYUVColorSpace 2019-03-09 nigeltao@google.com Check that we do not #define WUFFS_IMPLEMENTATION 2019-03-09 nigeltao@google.com Update Wuffs version 2019-03-08 kjlubick@google.com [canvaskit] roll on npm 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader f2ddde731fb0..fa8603c6113f (1 commits) 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader ebefaf7ce64a..f2ddde731fb0 (1 commits) 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 b6a2f6bcf657..49c9dfe3b832 (1 commits) 2019-03-11 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-03-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src bc2c6257d015..ba6c026602da (26 commits) 2019-03-10 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update SKP version 2019-03-10 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-03-10 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src a70166a5efb1..bc2c6257d015 (100 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 9 ++++++++- sky/packages/sky_engine/LICENSE | 30 ++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4830e8b8d614a..746019c0d3c68 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': '29d5dec9a0783a033b921dc483fb98d565d684f6', + 'skia_revision': '1386b2d5579d45be7a81f8706ad1c407e1210dab', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 1070233d9ad34..96d00ab4e0be7 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 0dd2b3de568e29ad48747dd78b7125d9 +Signature: 2f6d3d116cd822ba2dfe40076649205b UNUSED LICENSES: @@ -2238,6 +2238,7 @@ FILE: ../../../third_party/skia/infra/bots/recipes/compute_test.expected/Test-De 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 +FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Android-Clang-GalaxyS9-GPU-MaliG72-arm64-Debug-All-Android_Vulkan.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus5-GPU-Adreno330-arm-Debug-All-Android.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Release-All-Android_NoGPUThreads.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-ChromeOS-Clang-ASUSChromebookFlipC100-GPU-MaliT764-arm-Release-All.json @@ -4875,6 +4876,7 @@ FILE: ../../../third_party/skia/gm/mac_aa_explorer.cpp FILE: ../../../third_party/skia/gm/mixercolorfilter.cpp FILE: ../../../third_party/skia/gm/samplelocations.cpp FILE: ../../../third_party/skia/gm/skbug_8664.cpp +FILE: ../../../third_party/skia/include/core/SkMixer.h FILE: ../../../third_party/skia/include/gpu/GrContextThreadSafeProxy.h FILE: ../../../third_party/skia/include/private/GrContext_Base.h FILE: ../../../third_party/skia/include/private/GrImageContext.h @@ -4887,6 +4889,9 @@ FILE: ../../../third_party/skia/samplecode/SampleDegenerateQuads.cpp FILE: ../../../third_party/skia/samplecode/SampleSG.cpp FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp +FILE: ../../../third_party/skia/src/core/SkEffectPriv.h +FILE: ../../../third_party/skia/src/core/SkMixer.cpp +FILE: ../../../third_party/skia/src/core/SkMixerBase.h FILE: ../../../third_party/skia/src/core/SkStrikeInterface.h FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.cpp FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.h @@ -4909,6 +4914,8 @@ FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.fp FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.h FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.h +FILE: ../../../third_party/skia/src/shaders/SkMixerShader.cpp +FILE: ../../../third_party/skia/src/shaders/SkMixerShader.h FILE: ../../../third_party/skia/src/sksl/SkSLDefines.h FILE: ../../../third_party/skia/src/sksl/SkSLOutputStream.cpp ---------------------------------------------------------------------------------------------------- diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index e86eeeeced451..658e1e8c7cd99 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -10966,6 +10966,36 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- skia +Copyright 2019 Google, LLC + +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 From bbd58fab5b27fae56082f552bbcea2822508311c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 14 Mar 2019 02:05:54 -0400 Subject: [PATCH 0441/1117] Roll src/third_party/skia 1386b2d5579d..8b9b8f8c5846 (3 commits) (#8162) https://skia.googlesource.com/skia.git/%2Blog/1386b2d5579d..8b9b8f8c5846 git log 1386b2d5579d45be7a81f8706ad1c407e1210dab..8b9b8f8c58467fef47b74250301d574ee31d5f79 --date=short --no-merges --format=%ad %ae %s 2019-03-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 54744c955cd6..6299cd6e9d2d (421 commits) 2019-03-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader b6d4ce3158ee..868ed908f432 (1 commits) 2019-03-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 4ef71eb81f5d..b6d4ce3158ee (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 746019c0d3c68..4669b8cf0b5c3 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': '1386b2d5579d45be7a81f8706ad1c407e1210dab', + 'skia_revision': '8b9b8f8c58467fef47b74250301d574ee31d5f79', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 96d00ab4e0be7..b5a21a0908dd5 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2f6d3d116cd822ba2dfe40076649205b +Signature: 4a847808a214cad2d193d34eccac95b7 UNUSED LICENSES: From 23cff1a1c000d496a7ffabd8b189a5f9c94c57f9 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 14 Mar 2019 06:06:55 -0400 Subject: [PATCH 0442/1117] Roll src/third_party/skia 8b9b8f8c5846..5412618d503c (1 commits) (#8163) https://skia.googlesource.com/skia.git/%2Blog/8b9b8f8c5846..5412618d503c git log 8b9b8f8c58467fef47b74250301d574ee31d5f79..5412618d503cdd2f0dbf8bcb3e63110bd9d2c94d --date=short --no-merges --format=%ad %ae %s 2019-03-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 868ed908f432..19f1db6e92b4 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4669b8cf0b5c3..0331eb38d9217 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': '8b9b8f8c58467fef47b74250301d574ee31d5f79', + 'skia_revision': '5412618d503cdd2f0dbf8bcb3e63110bd9d2c94d', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b5a21a0908dd5..ec37e596aa474 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 4a847808a214cad2d193d34eccac95b7 +Signature: dedc43fc2f054bb7bdf7d825e6c79edd UNUSED LICENSES: From fbca3d34e6264d8f0081cced601a2db4e36429a4 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 14 Mar 2019 09:37:55 -0400 Subject: [PATCH 0443/1117] Roll src/third_party/skia 5412618d503c..f699bf0437db (2 commits) (#8164) https://skia.googlesource.com/skia.git/%2Blog/5412618d503c..f699bf0437db git log 5412618d503cdd2f0dbf8bcb3e63110bd9d2c94d..f699bf0437dbfd1b50b027751ad251335a1eb2b6 --date=short --no-merges --format=%ad %ae %s 2019-03-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 19f1db6e92b4..9b62c5ea2af3 (2 commits) 2019-03-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 494afea985e6..37b996425a0e (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 0331eb38d9217..66c435acea131 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': '5412618d503cdd2f0dbf8bcb3e63110bd9d2c94d', + 'skia_revision': 'f699bf0437dbfd1b50b027751ad251335a1eb2b6', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index ec37e596aa474..cb64f8c00c0bb 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: dedc43fc2f054bb7bdf7d825e6c79edd +Signature: 8c7f6a7aafe929103e78df23ccf4b18d UNUSED LICENSES: From f2b42d6c5481bbcb8bd8750d4657f8e41ba47e0f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 14 Mar 2019 13:20:20 -0400 Subject: [PATCH 0444/1117] Roll src/third_party/skia f699bf0437db..feb720f746dc (15 commits) (#8165) https://skia.googlesource.com/skia.git/%2Blog/f699bf0437db..feb720f746dc git log f699bf0437dbfd1b50b027751ad251335a1eb2b6..feb720f746dcecfd80e47b060d620c3ffa29a43b --date=short --no-merges --format=%ad %ae %s 2019-03-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader ca56e8b07a1a..eb7cf3c4b0b1 (1 commits) 2019-03-14 reed@google.com Use '&' to toggle showing the gm's size in viewer 2019-03-13 mtklein@google.com move in center of radial_gradient_precision 2019-03-14 bsalomon@google.com Update color type after color override in GrFillRectOp. 2019-03-14 jvanverth@google.com Set RG_float to be texturable on Metal 2019-03-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 49d2c13943ef..ca56e8b07a1a (1 commits) 2019-03-14 kjlubick@google.com [canvaskit] missing extern 2019-03-08 bsalomon@google.com Reland "Reintroduce deinstantiate lazy proxy types and use for promise images." 2019-03-14 michaelludwig@google.com Revert "Update SkCanvas' experimental SkiaRenderer API" 2019-03-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 9b62c5ea2af3..49d2c13943ef (1 commits) 2019-03-14 brianosman@google.com SkLumaColorFilter: Keep alpha in [0,1] 2019-03-13 michaelludwig@google.com Update SkCanvas' experimental SkiaRenderer API 2019-03-13 mtklein@google.com remove plus clamp 2019-03-13 nifong@google.com fill out more of SkDebugCanvas interface 2019-03-13 bsalomon@google.com Reland "Try to avoid vertex colors in Texture/FillRect ops when possible." The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 66c435acea131..47a0facf7e9b2 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': 'f699bf0437dbfd1b50b027751ad251335a1eb2b6', + 'skia_revision': 'feb720f746dcecfd80e47b060d620c3ffa29a43b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index cb64f8c00c0bb..8722498d7cb2b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8c7f6a7aafe929103e78df23ccf4b18d +Signature: d9f6707a9eabeae331acff2af41e7b80 UNUSED LICENSES: @@ -1717,6 +1717,8 @@ FILE: ../../../third_party/skia/src/effects/SkTrimPE.h FILE: ../../../third_party/skia/src/effects/SkTrimPathEffect.cpp FILE: ../../../third_party/skia/src/gpu/GrContextThreadSafeProxyPriv.h FILE: ../../../third_party/skia/src/gpu/GrDDLContext.cpp +FILE: ../../../third_party/skia/src/gpu/GrDeinstantiateProxyTracker.cpp +FILE: ../../../third_party/skia/src/gpu/GrDeinstantiateProxyTracker.h FILE: ../../../third_party/skia/src/gpu/GrDriverBugWorkarounds.cpp FILE: ../../../third_party/skia/src/gpu/GrFPArgs.h FILE: ../../../third_party/skia/src/gpu/GrLegacyDirectContext.cpp From e514f0bd18a98472f481733480119729f2f2c19a Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 14 Mar 2019 12:02:46 -0700 Subject: [PATCH 0445/1117] Ensure that typed data is released within SendPlatformMessage scope. (#8155) We used to make tonic make the wrapper before the SendPlatformMessage invocation. However, tonic would not collect the wrapper before make the Dart API call to return the value from the native method. This is illegal and would trip an assertion in the Dart VM. A more systematic fix required reworking tonic to handle this case. However, to fix our illegal use of the Dart API now, this patch creates the wrapper manually in function scope. Fixes https://github.com/flutter/flutter/issues/29058 --- lib/ui/window/window.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/ui/window/window.cc b/lib/ui/window/window.cc index bfeb86cef66f4..fb53dda3f1028 100644 --- a/lib/ui/window/window.cc +++ b/lib/ui/window/window.cc @@ -84,12 +84,10 @@ void ReportUnhandledException(Dart_NativeArguments args) { Dart_Handle SendPlatformMessage(Dart_Handle window, const std::string& name, Dart_Handle callback, - const tonic::DartByteData& data) { + Dart_Handle data_handle) { UIDartState* dart_state = UIDartState::Current(); if (!dart_state->window()) { - // Must release the TypedData buffer before allocating other Dart objects. - data.Release(); return tonic::ToDart( "Platform messages can only be sent from the main isolate"); } @@ -100,12 +98,12 @@ Dart_Handle SendPlatformMessage(Dart_Handle window, tonic::DartPersistentValue(dart_state, callback), dart_state->GetTaskRunners().GetUITaskRunner()); } - if (Dart_IsNull(data.dart_handle())) { + if (Dart_IsNull(data_handle)) { dart_state->window()->client()->HandlePlatformMessage( fml::MakeRefCounted(name, response)); } else { + tonic::DartByteData data(data_handle); const uint8_t* buffer = static_cast(data.data()); - dart_state->window()->client()->HandlePlatformMessage( fml::MakeRefCounted( name, std::vector(buffer, buffer + data.length_in_bytes()), From 403337ebb893380101d1fa9cc435ce9b6cfeb22c Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 14 Mar 2019 12:49:42 -0700 Subject: [PATCH 0446/1117] Do not pass short-lived buffers as labels to Dart_TimelineEvent (#8166) Dart no longer makes a copy of the label string when recording events. See https://github.com/flutter/engine/pull/8152 --- fml/trace_event.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fml/trace_event.h b/fml/trace_event.h index b8063aca3a2df..1f979d4e35e64 100644 --- a/fml/trace_event.h +++ b/fml/trace_event.h @@ -205,12 +205,12 @@ void TraceEventFlowEnd0(TraceArg category_group, TraceArg name, TraceIDArg id); class ScopedInstantEnd { public: - ScopedInstantEnd(std::string str) : label_(std::move(str)) {} + ScopedInstantEnd(const char* str) : label_(str) {} - ~ScopedInstantEnd() { TraceEventEnd(label_.c_str()); } + ~ScopedInstantEnd() { TraceEventEnd(label_); } private: - const std::string label_; + const char* label_; FML_DISALLOW_COPY_AND_ASSIGN(ScopedInstantEnd); }; From 66fdeb163ef6fed6e9bac652bb36c7495aa17fb8 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Thu, 14 Mar 2019 12:58:09 -0700 Subject: [PATCH 0447/1117] Add dump-shader-skp switch to help ShaderWarmUp (#8148) Allow Flutter to automatically dump the skp that triggers new shader compilations. This is useful for writing custom ShaderWarmUp to reduce jank. By default, it's not enabled to reduce the overhead. This is only available in profile or debug build. Later, we can add service protocol support to pull the skp from the client to the host. Currently, it works fine for Android-based devices (including our urgent internal clients) where we can `adb shell` into the cache directory. --- common/settings.cc | 3 +++ common/settings.h | 1 + shell/common/persistent_cache.cc | 20 +++++++++++++++++++ shell/common/persistent_cache.h | 12 +++++++++++ shell/common/rasterizer.cc | 12 +++++++++++ shell/common/shell.cc | 3 +++ shell/common/switches.cc | 3 +++ shell/common/switches.h | 7 ++++++- .../flutter/app/FlutterActivityDelegate.java | 3 +++ .../embedding/engine/FlutterShellArgs.java | 5 +++++ 10 files changed, 68 insertions(+), 1 deletion(-) diff --git a/common/settings.cc b/common/settings.cc index d2d1c702787fd..b292d376be0c3 100644 --- a/common/settings.cc +++ b/common/settings.cc @@ -33,6 +33,9 @@ std::string Settings::ToString() const { stream << "start_paused: " << start_paused << std::endl; stream << "trace_skia: " << trace_skia << std::endl; stream << "trace_startup: " << trace_startup << std::endl; + stream << "trace_systrace: " << trace_systrace << std::endl; + stream << "dump_skp_on_shader_compilation: " << dump_skp_on_shader_compilation + << std::endl; stream << "endless_trace_buffer: " << endless_trace_buffer << std::endl; stream << "enable_dart_profiling: " << enable_dart_profiling << std::endl; stream << "disable_dart_asserts: " << disable_dart_asserts << std::endl; diff --git a/common/settings.h b/common/settings.h index 812e2167d31e2..bfbfd4139d322 100644 --- a/common/settings.h +++ b/common/settings.h @@ -64,6 +64,7 @@ struct Settings { bool trace_skia = false; bool trace_startup = false; bool trace_systrace = false; + bool dump_skp_on_shader_compilation = false; bool endless_trace_buffer = false; bool enable_dart_profiling = false; bool disable_dart_asserts = false; diff --git a/shell/common/persistent_cache.cc b/shell/common/persistent_cache.cc index 6e52a810e59ec..e771ab502acb3 100644 --- a/shell/common/persistent_cache.cc +++ b/shell/common/persistent_cache.cc @@ -134,6 +134,8 @@ static void PersistentCacheStore(fml::RefPtr worker, // |GrContextOptions::PersistentCache| void PersistentCache::store(const SkData& key, const SkData& data) { + stored_new_shaders_ = true; + if (is_read_only_) { return; } @@ -159,6 +161,24 @@ void PersistentCache::store(const SkData& key, const SkData& data) { std::move(file_name), std::move(mapping)); } +void PersistentCache::DumpSkp(const SkData& data) { + if (is_read_only_ || !IsValid()) { + FML_LOG(ERROR) << "Could not dump SKP from read-only or invalid persistent " + "cache."; + return; + } + + std::stringstream name_stream; + auto ticks = fml::TimePoint::Now().ToEpochDelta().ToNanoseconds(); + name_stream << "shader_dump_" << std::to_string(ticks) << ".skp"; + std::string file_name = name_stream.str(); + FML_LOG(ERROR) << "Dumping " << file_name; + auto mapping = std::make_unique( + std::vector{data.bytes(), data.bytes() + data.size()}); + PersistentCacheStore(GetWorkerTaskRunner(), cache_directory_, + std::move(file_name), std::move(mapping)); +} + void PersistentCache::AddWorkerTaskRunner( fml::RefPtr task_runner) { std::lock_guard lock(worker_task_runners_mutex_); diff --git a/shell/common/persistent_cache.h b/shell/common/persistent_cache.h index 51662994dde70..7b3310e849bae 100644 --- a/shell/common/persistent_cache.h +++ b/shell/common/persistent_cache.h @@ -36,6 +36,15 @@ class PersistentCache : public GrContextOptions::PersistentCache { void RemoveWorkerTaskRunner(fml::RefPtr task_runner); + // Whether Skia tries to store any shader into this persistent cache after + // |ResetStoredNewShaders| is called. This flag is usually reset before each + // frame so we can know if Skia tries to compile new shaders in that frame. + bool StoredNewShaders() const { return stored_new_shaders_; } + void ResetStoredNewShaders() { stored_new_shaders_ = false; } + void DumpSkp(const SkData& data); + bool IsDumpingSkp() const { return is_dumping_skp_; } + void SetIsDumpingSkp(bool value) { is_dumping_skp_ = value; } + private: static std::string cache_base_path_; @@ -45,6 +54,9 @@ class PersistentCache : public GrContextOptions::PersistentCache { std::multiset> worker_task_runners_ FML_GUARDED_BY(worker_task_runners_mutex_); + bool stored_new_shaders_ = false; + bool is_dumping_skp_ = false; + bool IsValid() const; PersistentCache(bool read_only = false); diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index 39766a5877c99..b86e7cf19c469 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -4,6 +4,8 @@ #include "flutter/shell/common/rasterizer.h" +#include "flutter/shell/common/persistent_cache.h" + #include #include "third_party/skia/include/core/SkEncodedImageFormat.h" @@ -150,9 +152,19 @@ void Rasterizer::DoDraw(std::unique_ptr layer_tree) { return; } + PersistentCache* persistent_cache = PersistentCache::GetCacheForProcess(); + persistent_cache->ResetStoredNewShaders(); + if (DrawToSurface(*layer_tree)) { last_layer_tree_ = std::move(layer_tree); } + + if (persistent_cache->IsDumpingSkp() && + persistent_cache->StoredNewShaders()) { + auto screenshot = + ScreenshotLastLayerTree(ScreenshotType::SkiaPicture, false); + persistent_cache->DumpSkp(*screenshot.data); + } } bool Rasterizer::DrawToSurface(flow::LayerTree& layer_tree) { diff --git a/shell/common/shell.cc b/shell/common/shell.cc index ef177eacabcc3..3c43ef2d12f50 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -382,6 +382,9 @@ bool Shell::Setup(std::unique_ptr platform_view, PersistentCache::GetCacheForProcess()->AddWorkerTaskRunner( task_runners_.GetIOTaskRunner()); + PersistentCache::GetCacheForProcess()->SetIsDumpingSkp( + settings_.dump_skp_on_shader_compilation); + return true; } diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 997cd846ec613..215e043f78505 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -276,6 +276,9 @@ blink::Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { command_line.HasOption(FlagForSwitch(Switch::TraceSystrace)); #endif + settings.dump_skp_on_shader_compilation = + command_line.HasOption(FlagForSwitch(Switch::DumpSkpOnShaderCompilation)); + return settings; } diff --git a/shell/common/switches.h b/shell/common/switches.h index a5da872d6d1c9..951bf7ad55b24 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -109,8 +109,13 @@ DEF_SWITCH(TraceStartup, DEF_SWITCH(TraceSkia, "trace-skia", "Trace Skia calls. This is useful when debugging the GPU threed." - "By default, Skia tracing is not enable to reduce the number of " + "By default, Skia tracing is not enabled to reduce the number of " "traced events") +DEF_SWITCH(DumpSkpOnShaderCompilation, + "dump-skp-on-shader-compilation", + "Automatically dump the skp that triggers new shader compilations. " + "This is useful for writing custom ShaderWarmUp to reduce jank. " + "By default, this is not enabled to reduce the overhead. ") DEF_SWITCH( TraceSystrace, "trace-systrace", diff --git a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java index 4230208eb4608..c56908db643b3 100644 --- a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java +++ b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java @@ -315,6 +315,9 @@ private static String[] getArgsFromIntent(Intent intent) { if (intent.getBooleanExtra("trace-systrace", false)) { args.add("--trace-systrace"); } + if (intent.getBooleanExtra("dump-skp-on-shader-compilation", false)) { + args.add("--dump-skp-on-shader-compilation"); + } if (intent.getBooleanExtra("verbose-logging", false)) { args.add("--verbose-logging"); } diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java b/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java index c3b2c9b71531e..6e5ec8c7ba7bc 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java @@ -37,6 +37,8 @@ public class FlutterShellArgs { public static final String ARG_SKIA_DETERMINISTIC_RENDERING = "--skia-deterministic-rendering"; public static final String ARG_KEY_TRACE_SKIA = "trace-skia"; public static final String ARG_TRACE_SKIA = "--trace-skia"; + public static final String ARG_KEY_DUMP_SHADER_SKP_ON_SHADER_COMPILATION = "dump-skp-on-shader-compilation"; + public static final String ARG_DUMP_SHADER_SKP_ON_SHADER_COMPILATION = "--dump-skp-on-shader-compilation"; public static final String ARG_KEY_VERBOSE_LOGGING = "verbose-logging"; public static final String ARG_VERBOSE_LOGGING = "--verbose-logging"; @@ -69,6 +71,9 @@ public static FlutterShellArgs fromIntent(@NonNull Intent intent) { if (intent.getBooleanExtra(ARG_KEY_TRACE_SKIA, false)) { args.add(ARG_TRACE_SKIA); } + if (intent.getBooleanExtra(ARG_KEY_DUMP_SHADER_SKP_ON_SHADER_COMPILATION, false)) { + args.add(ARG_KEY_DUMP_SHADER_SKP_ON_SHADER_COMPILATION); + } if (intent.getBooleanExtra(ARG_KEY_VERBOSE_LOGGING, false)) { args.add(ARG_VERBOSE_LOGGING); } From 5825bdac92cdf86e83d1f4c2ee924e8fb9875f1a Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 14 Mar 2019 13:14:25 -0700 Subject: [PATCH 0448/1117] Roll src/third_party/dart 7d560f8385..7418238239 (61 commits) 7418238239 Implement LibraryElementForLink.session and return (empty) AnalysisSessionForLink. 806ec1161f Issue 3270. Put StreamBuilder's type argument into linked edit. eeb19b0416 Remove usages of ExtensionManager and package:plugin in general. 6c5194cfe1 [VM/Flutter] Remove 2 golden-file tests completely to avoid flutter analyze warning about missing copyright header f31b7928ae [VM] Adding regexp lookbehind assertion support. dfb6d250b1 [kernel] Better printing of string and unevaluated constants. c9e9b76d4d Skip control-flow-collections tests on all runtimes 1af9d3e14b Update breaking-changes.md dbea5c6884 [fasta] Commandline option to leave environment constants unevaluated. 10a8663e74 [VM/Flutter] Disabled golden tests until next engine -> flutter roll (which probably fixes it) 9aea5536fb [cfe] Initial support for compiling if in collections 1ac41d26b4 Support @Creates and @Returns from ir constants ac4eca7eb9 [vm, gc] Take advantage of object alignment and non-overlap when copying objects during a scavenge. d5ab8b4da2 Resolve ForElement(s) in separate scopes. 5b07ef9d1c [tests] Fix new tests b1a3629547 [vm] Move receiver variable to ParsedFunction, add ParameterVariable() 037b273753 Make List literal inference match the proposal f2579a8ede Add override annotations in dart2js tests d1a943281b Change path order when trying to open tracing 6483f5238f [dart/vm] be more flexible with precomputed constants 580e5731d6 [vm] Test compilation traces, type feedback, reused instructions. 217a027456 [vm, interpreter] Support unboxed fields. 1bd7920367 Resolve generic function default parameter values 31c47567dc Remove AnalysisOptionsForLink and plumb analysis options through linker. 69a4f20347 Add override annotations consistently 4339fe9b51 Add constant evaluation tests for IfNull. 8adcab9fec Add constant evaluation tests for Identity. 3552dbb429 Add constant evaluation tests for Equals. 27328840f9 Add constant evaluation tests for GreaterEqual. 9f680cd0bd Add constant evaluation tests for Greater. 0950d473ad Add constant evaluation tests for LessEqual. 7ff70237d4 Add constant evaluation tests for Less. ce9a1bb24e Add constant evaluation tests for Add. 2fa96dd653 Add constant evaluation tests for Divide. 952421a68d Add constant evaluation tests for TruncatingDivide. 9fd0ec2560 Add constant evaluation tests for Modulo. 9262d111fd Add constant evaluation tests for Multiply. aba9392f0e Add constant evaluation tests for Subtract. 3a38f0bb89 Add constant evaluation tests for BooleanOr. 052d6d235c Add constant evaluation tests for BooleanAnd. be5332c0a5 Add constant evaluation tests for ShiftRight. 4f34218ce1 Add constant evaluation tests for ShiftLeft. 3df5334137 Add constant evaluation tests for BitXor. 84d8d6b513 Add constant evaluation tests for BitOr. f7972480bd Add constant evaluation tests for BitAnd. 432c6c8c39 Add constant evaluation tests for Not. 2e1c78db7b Add constant evaluation tests for Negate. 5853f129b2 Add constant evaluation tests for BitNot. aa4a2df5a2 Add structure of constant folding tests. 078c834f25 Extract CONST_SET_ELEMENT_TYPE_IMPLEMENTS_EQUALS test and fix for spreads in sets. 2d48159e38 Issue 36187. Fix for getSuggestionDetails() fails in part file. e7562917f1 Reland https://dart-review.googlesource.com/c/sdk/+/96500 b5528fa84d Improve the docs for isSet and isMap in SetOrMapLiteral e55e13ffbd Merge remote-tracking branch 'github/master' 632abb6a25 Improve 'Import Library' code generation when has 'part' directive. d3a0293a9d Replace unnecessary `?.`s with `.`. e711486873 [vm,dart:io,fuchsia] Be happy with any open fd for Stdio handles if fstat fails 0bf8a1e591 Update breaking-changes.md f08e213bb1 Extract CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS tests. 2b00685d38 Make SetOrMapLiteral set/map unless we are linking, so going to infer it. bc5d613533 Fix typo in diagnostic when non-bool is passed to logical or. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 47a0facf7e9b2..6ce4cd4b4a5a0 100644 --- a/DEPS +++ b/DEPS @@ -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': '7d560f8385eaeee0fd95ec08e25db0c217b1cd3e', + 'dart_revision': '7418238239f885ba92093c44a1768f8ec93b121f', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index a957b5281d8ba..c447c7b75883c 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 16a53deb75e70c3091e030f3f0214527 +Signature: c9257a9b2c77469fbf18cd1859ef65ba UNUSED LICENSES: From 7a6bb9998ed4ce7705beb59018c9e1f068d50476 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 14 Mar 2019 17:13:55 -0400 Subject: [PATCH 0449/1117] Roll src/third_party/skia feb720f746dc..512e38091c85 (11 commits) (#8169) https://skia.googlesource.com/skia.git/%2Blog/feb720f746dc..512e38091c85 git log feb720f746dcecfd80e47b060d620c3ffa29a43b..512e38091c8511847334b89365d46cbb0452309a --date=short --no-merges --format=%ad %ae %s 2019-03-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 37b996425a0e..979f3bbe2c50 (5 commits) 2019-03-14 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-14 mtklein@google.com skvx: allow more implicit conversions 2019-03-14 michaelludwig@google.com Avoid unsafe casts to int in SkNx 2019-03-14 mtklein@google.com update docs for SkLumaColorFilter 2019-03-14 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-14 ethannicholas@google.com re-re-fixed RelaxedPrecision 2019-03-14 robertphillips@google.com Allocate the backing SkBitmap in the SerializedImageFilter fuzzer 2019-03-14 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader eb7cf3c4b0b1..af973b67141e (2 commits) 2019-03-14 michaelludwig@google.com Reland "Update SkCanvas' experimental SkiaRenderer API" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 6ce4cd4b4a5a0..b28772df19a33 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': 'feb720f746dcecfd80e47b060d620c3ffa29a43b', + 'skia_revision': '512e38091c8511847334b89365d46cbb0452309a', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 8722498d7cb2b..5393cbab00488 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: d9f6707a9eabeae331acff2af41e7b80 +Signature: 0b30f75a389dd244bf9fe53576e7b76c UNUSED LICENSES: From 246f0e3f4ab402ece70784d86f3c0a230c40c02a Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 14 Mar 2019 14:15:46 -0700 Subject: [PATCH 0450/1117] Add an allocator specific check to ensure that strings passed to the timeline are not heap allocated. (#8168) Verified that the tests fail on issues like https://github.com/flutter/engine/pull/8166. Unfortunately, there is no x-platform way to perform this check but this should gate incorrect traces being added to the engine. --- fml/trace_event.cc | 59 +++++++++++++++++++++--------- shell/platform/embedder/embedder.h | 10 +++-- 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/fml/trace_event.cc b/fml/trace_event.cc index fc0ee72f4021b..434e7883d981b 100644 --- a/fml/trace_event.cc +++ b/fml/trace_event.cc @@ -6,8 +6,28 @@ #include +#include "flutter/fml/build_config.h" #include "flutter/fml/logging.h" +#if OS_MACOSX && !defined(NDEBUG) + +#include + +#define DCHECK_LITERAL(x) \ + ({ \ + do { \ + FML_DCHECK(malloc_size((x)) == 0) \ + << "Timeline string must not be on the heap."; \ + } while (0); \ + ((x)); \ + }) + +#else // OS_MACOSX + +#define DCHECK_LITERAL(x) ((x)) + +#endif // OS_MACOSX + namespace fml { namespace tracing { @@ -23,11 +43,15 @@ void TraceTimelineEvent(TraceArg category_group, c_values.resize(argument_count, nullptr); for (size_t i = 0; i < argument_count; i++) { +#if !defined(NDEBUG) + DCHECK_LITERAL(c_names[i]); +#endif // !defined(NDEBUG) + c_values[i] = values[i].c_str(); } Dart_TimelineEvent( - name, // label + DCHECK_LITERAL(name), // label Dart_TimelineGetMicros(), // timestamp0 identifier, // timestamp1_or_async_id type, // event type @@ -38,7 +62,7 @@ void TraceTimelineEvent(TraceArg category_group, } void TraceEvent0(TraceArg category_group, TraceArg name) { - Dart_TimelineEvent(name, // label + Dart_TimelineEvent(DCHECK_LITERAL(name), // label Dart_TimelineGetMicros(), // timestamp0 0, // timestamp1_or_async_id Dart_Timeline_Event_Begin, // event type @@ -52,9 +76,9 @@ void TraceEvent1(TraceArg category_group, TraceArg name, TraceArg arg1_name, TraceArg arg1_val) { - const char* arg_names[] = {arg1_name}; + const char* arg_names[] = {DCHECK_LITERAL(arg1_name)}; const char* arg_values[] = {arg1_val}; - Dart_TimelineEvent(name, // label + Dart_TimelineEvent(DCHECK_LITERAL(name), // label Dart_TimelineGetMicros(), // timestamp0 0, // timestamp1_or_async_id Dart_Timeline_Event_Begin, // event type @@ -70,9 +94,10 @@ void TraceEvent2(TraceArg category_group, TraceArg arg1_val, TraceArg arg2_name, TraceArg arg2_val) { - const char* arg_names[] = {arg1_name, arg2_name}; + const char* arg_names[] = {DCHECK_LITERAL(arg1_name), + DCHECK_LITERAL(arg2_name)}; const char* arg_values[] = {arg1_val, arg2_val}; - Dart_TimelineEvent(name, // label + Dart_TimelineEvent(DCHECK_LITERAL(name), // label Dart_TimelineGetMicros(), // timestamp0 0, // timestamp1_or_async_id Dart_Timeline_Event_Begin, // event type @@ -83,7 +108,7 @@ void TraceEvent2(TraceArg category_group, } void TraceEventEnd(TraceArg name) { - Dart_TimelineEvent(name, // label + Dart_TimelineEvent(DCHECK_LITERAL(name), // label Dart_TimelineGetMicros(), // timestamp0 0, // timestamp1_or_async_id Dart_Timeline_Event_End, // event type @@ -96,7 +121,7 @@ void TraceEventEnd(TraceArg name) { void TraceEventAsyncBegin0(TraceArg category_group, TraceArg name, TraceIDArg id) { - Dart_TimelineEvent(name, // label + Dart_TimelineEvent(DCHECK_LITERAL(name), // label Dart_TimelineGetMicros(), // timestamp0 id, // timestamp1_or_async_id Dart_Timeline_Event_Async_Begin, // event type @@ -109,7 +134,7 @@ void TraceEventAsyncBegin0(TraceArg category_group, void TraceEventAsyncEnd0(TraceArg category_group, TraceArg name, TraceIDArg id) { - Dart_TimelineEvent(name, // label + Dart_TimelineEvent(DCHECK_LITERAL(name), // label Dart_TimelineGetMicros(), // timestamp0 id, // timestamp1_or_async_id Dart_Timeline_Event_Async_End, // event type @@ -124,9 +149,9 @@ void TraceEventAsyncBegin1(TraceArg category_group, TraceIDArg id, TraceArg arg1_name, TraceArg arg1_val) { - const char* arg_names[] = {arg1_name}; + const char* arg_names[] = {DCHECK_LITERAL(arg1_name)}; const char* arg_values[] = {arg1_val}; - Dart_TimelineEvent(name, // label + Dart_TimelineEvent(DCHECK_LITERAL(name), // label Dart_TimelineGetMicros(), // timestamp0 id, // timestamp1_or_async_id Dart_Timeline_Event_Async_Begin, // event type @@ -141,9 +166,9 @@ void TraceEventAsyncEnd1(TraceArg category_group, TraceIDArg id, TraceArg arg1_name, TraceArg arg1_val) { - const char* arg_names[] = {arg1_name}; + const char* arg_names[] = {DCHECK_LITERAL(arg1_name)}; const char* arg_values[] = {arg1_val}; - Dart_TimelineEvent(name, // label + Dart_TimelineEvent(DCHECK_LITERAL(name), // label Dart_TimelineGetMicros(), // timestamp0 id, // timestamp1_or_async_id Dart_Timeline_Event_Async_End, // event type @@ -154,7 +179,7 @@ void TraceEventAsyncEnd1(TraceArg category_group, } void TraceEventInstant0(TraceArg category_group, TraceArg name) { - Dart_TimelineEvent(name, // label + Dart_TimelineEvent(DCHECK_LITERAL(name), // label Dart_TimelineGetMicros(), // timestamp0 0, // timestamp1_or_async_id Dart_Timeline_Event_Instant, // event type @@ -167,7 +192,7 @@ void TraceEventInstant0(TraceArg category_group, TraceArg name) { void TraceEventFlowBegin0(TraceArg category_group, TraceArg name, TraceIDArg id) { - Dart_TimelineEvent(name, // label + Dart_TimelineEvent(DCHECK_LITERAL(name), // label Dart_TimelineGetMicros(), // timestamp0 id, // timestamp1_or_async_id Dart_Timeline_Event_Flow_Begin, // event type @@ -180,7 +205,7 @@ void TraceEventFlowBegin0(TraceArg category_group, void TraceEventFlowStep0(TraceArg category_group, TraceArg name, TraceIDArg id) { - Dart_TimelineEvent(name, // label + Dart_TimelineEvent(DCHECK_LITERAL(name), // label Dart_TimelineGetMicros(), // timestamp0 id, // timestamp1_or_async_id Dart_Timeline_Event_Flow_Step, // event type @@ -191,7 +216,7 @@ void TraceEventFlowStep0(TraceArg category_group, } void TraceEventFlowEnd0(TraceArg category_group, TraceArg name, TraceIDArg id) { - Dart_TimelineEvent(name, // label + Dart_TimelineEvent(DCHECK_LITERAL(name), // label Dart_TimelineGetMicros(), // timestamp0 id, // timestamp1_or_async_id Dart_Timeline_Event_Flow_End, // event type diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 2299650a68ebe..8f2453867276b 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -674,7 +674,8 @@ FlutterEngineResult FlutterEngineOnVsync(FlutterEngine engine, // the timeline is unavailable or disabled, this has no effect. Must be // balanced with an duration end event (via // |FlutterEngineTraceEventDurationEnd|) with the same name on the same thread. -// Can be called on any thread. +// Can be called on any thread. Strings passed into the function will NOT be +// copied when added to the timeline. Only string literals may be passed in. FLUTTER_EXPORT void FlutterEngineTraceEventDurationBegin(const char* name); @@ -682,13 +683,16 @@ void FlutterEngineTraceEventDurationBegin(const char* name); // timeline is unavailable or disabled, this has no effect. This call must be // preceded by a trace duration begin call (via // |FlutterEngineTraceEventDurationBegin|) with the same name on the same -// thread. Can be called on any thread. +// thread. Can be called on any thread. Strings passed into the function will +// NOT be copied when added to the timeline. Only string literals may be passed +// in. FLUTTER_EXPORT void FlutterEngineTraceEventDurationEnd(const char* name); // A profiling utility. Logs a trace duration instant event to the timeline. If // the timeline is unavailable or disabled, this has no effect. Can be called -// on any thread. +// on any thread. Strings passed into the function will NOT be copied when added +// to the timeline. Only string literals may be passed in. FLUTTER_EXPORT void FlutterEngineTraceEventInstant(const char* name); From 09db84fad6299947211d705a7e202093223294a1 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 14 Mar 2019 14:24:49 -0700 Subject: [PATCH 0451/1117] Android Embedding PR 19: Add accessibility to new FlutterView. (#8109) --- .../embedding/engine/FlutterEngine.java | 2 +- .../flutter/embedding/engine/FlutterJNI.java | 56 ++++++++++-- .../engine/android/FlutterFragment.java | 5 -- .../engine/android/FlutterSurfaceView.java | 10 --- .../engine/android/FlutterTextureView.java | 10 --- .../embedding/engine/android/FlutterView.java | 56 ++++++++++-- .../engine/renderer/FlutterRenderer.java | 8 +- .../systemchannels/AccessibilityChannel.java | 65 +++++++++++++- .../io/flutter/view/AccessibilityBridge.java | 87 ++++++++++--------- .../android/io/flutter/view/FlutterView.java | 3 +- 10 files changed, 207 insertions(+), 95 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java b/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java index 74bab64129119..2b941f3d01a05 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java @@ -110,7 +110,7 @@ public FlutterEngine(@NonNull Context context) { // TODO(mattcarroll): FlutterRenderer is temporally coupled to attach(). Remove that coupling if possible. this.renderer = new FlutterRenderer(flutterJNI); - accessibilityChannel = new AccessibilityChannel(dartExecutor); + accessibilityChannel = new AccessibilityChannel(dartExecutor, flutterJNI); keyEventChannel = new KeyEventChannel(dartExecutor); lifecycleChannel = new LifecycleChannel(dartExecutor); localizationChannel = new LocalizationChannel(dartExecutor); diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java index 41e128ecd63f7..f8405852a5217 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java @@ -97,6 +97,7 @@ public class FlutterJNI { private Long nativePlatformViewId; private FlutterRenderer.RenderSurface renderSurface; + private AccessibilityDelegate accessibilityDelegate; private PlatformMessageHandler platformMessageHandler; private final Set engineLifecycleListeners = new HashSet<>(); private final Set firstFrameListeners = new HashSet<>(); @@ -106,9 +107,7 @@ public class FlutterJNI { * * Flutter expects a user interface to exist on the platform side (Android), and that interface * is expected to offer some capabilities that Flutter depends upon. The {@link FlutterRenderer.RenderSurface} - * interface represents those expectations. For example, Flutter expects to be able to request - * that its user interface "update custom accessibility actions" and therefore the delegate interface - * declares a corresponding method, {@link FlutterRenderer.RenderSurface#updateCustomAccessibilityActions(ByteBuffer, String[])}. + * interface represents those expectations. * * If an app includes a user interface that renders a Flutter UI then a {@link FlutterRenderer.RenderSurface} * should be set (this is the typical Flutter scenario). If no UI is being rendered, such as a @@ -123,7 +122,22 @@ public void setRenderSurface(@Nullable FlutterRenderer.RenderSurface renderSurfa } /** - * Call invoked by native to be forwarded to an {@link io.flutter.view.AccessibilityBridge}. + * Sets the {@link AccessibilityDelegate} for the attached Flutter context. + * + * The {@link AccessibilityDelegate} is responsible for maintaining an Android-side cache of + * Flutter's semantics tree and custom accessibility actions. This cache should be hooked up + * to Android's accessibility system. + * + * See {@link AccessibilityBridge} for an example of an {@link AccessibilityDelegate} and the + * surrounding responsibilities. + */ + @UiThread + public void setAccessibilityDelegate(@Nullable AccessibilityDelegate accessibilityDelegate) { + this.accessibilityDelegate = accessibilityDelegate; + } + + /** + * Invoked by native to send semantics tree updates from Flutter to Android. * * The {@code buffer} and {@code strings} form a communication protocol that is implemented here: * https://github.com/flutter/engine/blob/master/shell/platform/android/platform_view_android.cc#L207 @@ -131,14 +145,14 @@ public void setRenderSurface(@Nullable FlutterRenderer.RenderSurface renderSurfa @SuppressWarnings("unused") @UiThread private void updateSemantics(ByteBuffer buffer, String[] strings) { - if (renderSurface != null) { - renderSurface.updateSemantics(buffer, strings); + if (accessibilityDelegate != null) { + accessibilityDelegate.updateSemantics(buffer, strings); } // TODO(mattcarroll): log dropped messages when in debug mode (https://github.com/flutter/flutter/issues/25391) } /** - * Call invoked by native to be forwarded to an {@link io.flutter.view.AccessibilityBridge}. + * Invoked by native to send new custom accessibility events from Flutter to Android. * * The {@code buffer} and {@code strings} form a communication protocol that is implemented here: * https://github.com/flutter/engine/blob/master/shell/platform/android/platform_view_android.cc#L207 @@ -148,8 +162,8 @@ private void updateSemantics(ByteBuffer buffer, String[] strings) { @SuppressWarnings("unused") @UiThread private void updateCustomAccessibilityActions(ByteBuffer buffer, String[] strings) { - if (renderSurface != null) { - renderSurface.updateCustomAccessibilityActions(buffer, strings); + if (accessibilityDelegate != null) { + accessibilityDelegate.updateCustomAccessibilityActions(buffer, strings); } // TODO(mattcarroll): log dropped messages when in debug mode (https://github.com/flutter/flutter/issues/25391) } @@ -532,4 +546,28 @@ private void ensureAttachedToNative() { throw new RuntimeException("Cannot execute operation because FlutterJNI is not attached to native."); } } + + /** + * Delegate responsible for creating and updating Android-side caches of Flutter's semantics + * tree and custom accessibility actions. + * + * {@link AccessibilityBridge} is an example of an {@code AccessibilityDelegate}. + */ + public interface AccessibilityDelegate { + /** + * Sends new custom accessibility actions from Flutter to Android. + * + * Implementers are expected to maintain an Android-side cache of custom accessibility actions. + * This method provides new actions to add to that cache. + */ + void updateCustomAccessibilityActions(ByteBuffer buffer, String[] strings); + + /** + * Sends new {@code SemanticsNode} information from Flutter to Android. + * + * Implementers are expected to maintain an Android-side cache of Flutter's semantics tree. + * This method provides updates from Flutter for the Android-side semantics tree cache. + */ + void updateSemantics(ByteBuffer buffer, String[] strings); + } } diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java index 47defdf13367a..bc19348f7f06a 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java @@ -336,11 +336,6 @@ public void onPostResume() { // to platformPlugin. We're implicitly entangling the Window, Activity, Fragment, // and engine all with this one call. platformPlugin.onPostResume(); - - // TODO(mattcarroll): consider a more abstract way to invoke this behavior. It is very strange for - // a Fragment to have a seemingly random View responsibility, but this is what - // existed in the original embedding and I don't have a good alternative yet. - flutterView.updateAccessibilityFeatures(); } else { Log.w(TAG, "onPostResume() invoked before FlutterFragment was attached to an Activity."); } diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java index cbff0b4ac828c..944e26b7c84a8 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java @@ -172,16 +172,6 @@ private void disconnectSurfaceFromRenderer() { flutterRenderer.surfaceDestroyed(); } - @Override - public void updateCustomAccessibilityActions(ByteBuffer buffer, String[] strings) { - // TODO(mattcarroll): refactor RenderSurface to move this method somewhere else. - } - - @Override - public void updateSemantics(ByteBuffer buffer, String[] strings) { - // TODO(mattcarroll): refactor RenderSurface to move this method somewhere else. - } - @Override public void onFirstFrameRendered() { // TODO(mattcarroll): decide where this method should live and what it needs to do. diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java index f39c6d4e77a82..048fc71a4430f 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java @@ -183,16 +183,6 @@ private void disconnectSurfaceFromRenderer() { flutterRenderer.surfaceDestroyed(); } - @Override - public void updateCustomAccessibilityActions(ByteBuffer buffer, String[] strings) { - // TODO(mattcarroll): refactor RenderSurface to move this method somewhere else. - } - - @Override - public void updateSemantics(ByteBuffer buffer, String[] strings) { - // TODO(mattcarroll): refactor RenderSurface to move this method somewhere else. - } - @Override public void onFirstFrameRendered() { // TODO(mattcarroll): decide where this method should live and what it needs to do. diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java index 23bd68c5759d8..e8216f97b360a 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java @@ -21,6 +21,8 @@ import android.view.MotionEvent; import android.view.WindowInsets; import android.view.WindowManager; +import android.view.accessibility.AccessibilityManager; +import android.view.accessibility.AccessibilityNodeProvider; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.widget.FrameLayout; @@ -31,7 +33,9 @@ import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.renderer.FlutterRenderer; +import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; import io.flutter.plugin.editing.TextInputPlugin; +import io.flutter.view.AccessibilityBridge; import io.flutter.view.VsyncWaiter; /** @@ -81,10 +85,19 @@ public class FlutterView extends FrameLayout { private AndroidKeyProcessor androidKeyProcessor; @Nullable private AndroidTouchProcessor androidTouchProcessor; + @Nullable + private AccessibilityBridge accessibilityBridge; // Directly implemented View behavior that communicates with Flutter. private final FlutterRenderer.ViewportMetrics viewportMetrics = new FlutterRenderer.ViewportMetrics(); + private final AccessibilityBridge.OnAccessibilityChangeListener onAccessibilityChangeListener = new AccessibilityBridge.OnAccessibilityChangeListener() { + @Override + public void onAccessibilityChanged(boolean isAccessibilityEnabled, boolean isTouchExplorationEnabled) { + resetWillNotDraw(isAccessibilityEnabled, isTouchExplorationEnabled); + } + }; + /** * Constructs a {@code FlutterSurfaceView} programmatically, without any XML attributes. * @@ -357,17 +370,35 @@ public boolean onHoverEvent(MotionEvent event) { return super.onHoverEvent(event); } - // TODO(mattcarroll): hook up to accessibility. - return false; + boolean handled = accessibilityBridge.onAccessibilityHoverEvent(event); + if (!handled) { + // TODO(ianh): Expose hover events to the platform, + // implementing ADD, REMOVE, etc. + } + return handled; } //-------- End: Process UI I/O that Flutter cares about. --------- //-------- Start: Accessibility ------- - /** - * No-op. Placeholder so that the containing Fragment can call through, but not yet implemented. - */ - public void updateAccessibilityFeatures() { - // TODO(mattcarroll): bring in accessibility code from old FlutterView. + @Override + public AccessibilityNodeProvider getAccessibilityNodeProvider() { + if (accessibilityBridge != null && accessibilityBridge.isAccessibilityEnabled()) { + return accessibilityBridge; + } else { + // TODO(goderbauer): when a11y is off this should return a one-off snapshot of + // the a11y + // tree. + return null; + } + } + + // TODO(mattcarroll): Confer with Ian as to why we need this method. Delete if possible, otherwise add comments. + private void resetWillNotDraw(boolean isAccessibilityEnabled, boolean isTouchExplorationEnabled) { + if (!flutterEngine.getRenderer().isSoftwareRenderingEnabled()) { + setWillNotDraw(!(isAccessibilityEnabled || isTouchExplorationEnabled)); + } else { + setWillNotDraw(false); + } } //-------- End: Accessibility --------- @@ -412,6 +443,17 @@ public void attachToFlutterEngine(@NonNull FlutterEngine flutterEngine) { textInputPlugin ); androidTouchProcessor = new AndroidTouchProcessor(this.flutterEngine.getRenderer()); + accessibilityBridge = new AccessibilityBridge( + this, + flutterEngine.getAccessibilityChannel(), + (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE), + getContext().getContentResolver() + ); + accessibilityBridge.setOnAccessibilityChangeListener(onAccessibilityChangeListener); + resetWillNotDraw( + accessibilityBridge.isAccessibilityEnabled(), + accessibilityBridge.isTouchExplorationEnabled() + ); // Inform the Android framework that it should retrieve a new InputConnection // now that an engine is attached. 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 35dacea6d467d..dd0e198c1f26a 100644 --- a/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java +++ b/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java @@ -233,7 +233,7 @@ public void dispatchSemanticsAction(int id, * UI. * * A {@code RenderSurface} is responsible for carrying out behaviors that are needed by a - * corresponding {@link FlutterRenderer}, e.g., {@link #updateSemantics(ByteBuffer, String[])}. + * corresponding {@link FlutterRenderer}. * * A {@code RenderSurface} also receives callbacks for important events, e.g., * {@link #onFirstFrameRendered()}. @@ -255,12 +255,6 @@ public interface RenderSurface { */ void detachFromRenderer(); - // TODO(mattcarroll): describe what this callback is intended to do - void updateCustomAccessibilityActions(ByteBuffer buffer, String[] strings); - - // TODO(mattcarroll): describe what this callback is intended to do - void updateSemantics(ByteBuffer buffer, String[] strings); - /** * The {@link FlutterRenderer} corresponding to this {@code RenderSurface} has painted its * first frame since being initialized. diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java index 7eed2619bebda..c4252e234df0a 100644 --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java @@ -4,10 +4,13 @@ import android.support.annotation.Nullable; import java.util.HashMap; +import java.util.Map; +import io.flutter.embedding.engine.FlutterJNI; import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.plugin.common.BasicMessageChannel; import io.flutter.plugin.common.StandardMessageCodec; +import io.flutter.view.AccessibilityBridge; /** * System channel that sends accessibility requests and events from Flutter to Android. @@ -17,7 +20,9 @@ */ public class AccessibilityChannel { @NonNull - public BasicMessageChannel channel; + public final BasicMessageChannel channel; + @NonNull + public final FlutterJNI flutterJNI; @Nullable private AccessibilityMessageHandler handler; @@ -76,9 +81,62 @@ public void onMessage(Object message, BasicMessageChannel.Reply reply) { * * See {@link DartExecutor}. */ - public AccessibilityChannel(@NonNull DartExecutor dartExecutor) { + public AccessibilityChannel(@NonNull DartExecutor dartExecutor, @NonNull FlutterJNI flutterJNI) { channel = new BasicMessageChannel<>(dartExecutor, "flutter/accessibility", StandardMessageCodec.INSTANCE); channel.setMessageHandler(parsingMessageHandler); + this.flutterJNI = flutterJNI; + } + + /** + * Informs Flutter that the Android OS currently has accessibility enabled. + * + * To accommodate enabled accessibility, this method instructs Flutter to activate + * its semantics tree, which forms the basis of Flutter's accessibility support. + */ + public void onAndroidAccessibilityEnabled() { + flutterJNI.setSemanticsEnabled(true); + } + + /** + * Informs Flutter that the Android OS currently has accessibility disabled. + * + * Given that accessibility is not required at this time, this method instructs Flutter + * to deactivate its semantics tree. + */ + public void onAndroidAccessibilityDisabled() { + flutterJNI.setSemanticsEnabled(false); + } + + /** + * Instructs Flutter to activate/deactivate accessibility features corresponding to the + * flags provided by {@code accessibilityFeatureFlags}. + */ + public void setAccessibilityFeatures(int accessibilityFeatureFlags) { + flutterJNI.setAccessibilityFeatures(accessibilityFeatureFlags); + } + + /** + * Instructs Flutter to perform the given {@code action} on the {@code SemanticsNode} + * referenced by the given {@code virtualViewId}. + * + * One might wonder why Flutter would need to be instructed that the user wants to perform + * an action. When the user is touching the screen in accessibility mode, Android takes over the + * touch input, categorizing input as one of a many accessibility gestures. Therefore, Flutter + * does not have an opportunity to react to said touch input. Instead, Flutter must be notified + * by Android of the desired action. Additionally, some accessibility systems use other input + * methods, such as speech, to take virtual actions. Android interprets those requests and then + * instructs the app to take the appropriate action. + */ + public void dispatchSemanticsAction(int virtualViewId, @NonNull AccessibilityBridge.Action action) { + flutterJNI.dispatchSemanticsAction(virtualViewId, action); + } + + /** + * Instructs Flutter to perform the given {@code action} on the {@code SemanticsNode} + * referenced by the given {@code virtualViewId}, passing the given {@code args}. + */ + public void dispatchSemanticsAction(int virtualViewId, @NonNull AccessibilityBridge.Action action, @Nullable Object args) { + flutterJNI.dispatchSemanticsAction(virtualViewId, action, args); } /** @@ -87,6 +145,7 @@ public AccessibilityChannel(@NonNull DartExecutor dartExecutor) { */ public void setAccessibilityMessageHandler(@Nullable AccessibilityMessageHandler handler) { this.handler = handler; + flutterJNI.setAccessibilityDelegate(handler); } /** @@ -96,7 +155,7 @@ public void setAccessibilityMessageHandler(@Nullable AccessibilityMessageHandler * To register an {@code AccessibilityMessageHandler} with a {@link AccessibilityChannel}, * see {@link AccessibilityChannel#setAccessibilityMessageHandler(AccessibilityMessageHandler)}. */ - public interface AccessibilityMessageHandler { + public interface AccessibilityMessageHandler extends FlutterJNI.AccessibilityDelegate { /** * The Dart application would like the given {@code message} to be announced. */ diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index 3c262fa9fe63d..b0f8e92888de7 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -32,6 +32,7 @@ import io.flutter.util.Predicate; import java.nio.ByteBuffer; +import java.nio.ByteOrder; import java.util.*; /** @@ -48,7 +49,6 @@ * {@link #rootAccessibilityView} is expected to notify the {@code AccessibilityBridge} of * relevant interactions: {@link #onAccessibilityHoverEvent(MotionEvent)}, {@link #reset()}, * {@link #updateSemantics(ByteBuffer, String[])}, and {@link #updateCustomAccessibilityActions(ByteBuffer, String[])} - *
  • A {@link FlutterJNI} instance, corresponding to the running Flutter app.
  • *
  • An {@link AccessibilityChannel} that is connected to the running Flutter app.
  • *
  • Android's {@link AccessibilityManager} to query and listen for accessibility settings.
  • *
  • Android's {@link ContentResolver} to listen for changes to system animation settings.
  • @@ -60,12 +60,6 @@ * accessibility events may be consumed by a Flutter widget, as if it were an Android * {@link View}. {@code AccessibilityBridge} refers to Flutter's accessible widgets as * "virtual views" and identifies them with "virtual view IDs". - * - * Most communication between the Android OS accessibility system and Flutter's accessibility - * system is achieved via the {@link AccessibilityChannel} system channel. However, some - * information is exchanged directly between the Android embedding and Flutter framework - * via {@link FlutterJNI}. - * TODO(mattcarroll): consider moving FlutterJNI calls over to AccessibilityChannel */ public class AccessibilityBridge extends AccessibilityNodeProvider { private static final String TAG = "AccessibilityBridge"; @@ -86,10 +80,6 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { @NonNull private final View rootAccessibilityView; - // Direct interface between Flutter's Android embedding and the Flutter framework. - @NonNull - private final FlutterJNI flutterJNI; - // The accessibility communication API between Flutter's Android embedding and // the Flutter framework. @NonNull @@ -239,6 +229,24 @@ public void onTooltip(@NonNull String message) { e.getText().add(message); sendAccessibilityEvent(e); } + + /** + * New custom accessibility actions exist in Flutter. Update our Android-side cache. + */ + @Override + public void updateCustomAccessibilityActions(ByteBuffer buffer, String[] strings) { + buffer.order(ByteOrder.LITTLE_ENDIAN); + AccessibilityBridge.this.updateCustomAccessibilityActions(buffer, strings); + } + + /** + * Flutter's semantics tree has changed. Update our Android-side cache. + */ + @Override + public void updateSemantics(ByteBuffer buffer, String[] strings) { + buffer.order(ByteOrder.LITTLE_ENDIAN); + AccessibilityBridge.this.updateSemantics(buffer, strings); + } }; // Listener that is notified when accessibility is turned on/off. @@ -247,10 +255,10 @@ public void onTooltip(@NonNull String message) { public void onAccessibilityStateChanged(boolean accessibilityEnabled) { if (accessibilityEnabled) { accessibilityChannel.setAccessibilityMessageHandler(accessibilityMessageHandler); - flutterJNI.setSemanticsEnabled(true); + accessibilityChannel.onAndroidAccessibilityEnabled(); } else { accessibilityChannel.setAccessibilityMessageHandler(null); - flutterJNI.setSemanticsEnabled(false); + accessibilityChannel.onAndroidAccessibilityDisabled(); } if (onAccessibilityChangeListener != null) { @@ -295,15 +303,13 @@ public void onChange(boolean selfChange, Uri uri) { } }; - AccessibilityBridge( + public AccessibilityBridge( @NonNull View rootAccessibilityView, - @NonNull FlutterJNI flutterJNI, @NonNull AccessibilityChannel accessibilityChannel, @NonNull AccessibilityManager accessibilityManager, @NonNull ContentResolver contentResolver ) { this.rootAccessibilityView = rootAccessibilityView; - this.flutterJNI = flutterJNI; this.accessibilityChannel = accessibilityChannel; this.accessibilityManager = accessibilityManager; this.contentResolver = contentResolver; @@ -391,10 +397,10 @@ public void setOnAccessibilityChangeListener(@Nullable OnAccessibilityChangeList } /** - * Sends the current value of {@link #accessibilityFeatureFlags} to Flutter via {@link FlutterJNI}. + * Sends the current value of {@link #accessibilityFeatureFlags} to Flutter. */ private void sendLatestAccessibilityFlagsToFlutter() { - flutterJNI.setAccessibilityFeatures(accessibilityFeatureFlags); + accessibilityChannel.setAccessibilityFeatures(accessibilityFeatureFlags); } private boolean shouldSetCollectionInfo(final SemanticsNode semanticsNode) { @@ -712,8 +718,7 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { * In a traditional Android app, the given view ID refers to a {@link View} within an Android * {@link View} hierarchy. Flutter does not have an Android {@link View} hierarchy, therefore * the given view ID is a {@code virtualViewId} that refers to a {@code SemanticsNode} within - * a Flutter app. The given arguments of this method are forwarded from Android to Flutter - * via {@link FlutterJNI}. + * a Flutter app. The given arguments of this method are forwarded from Android to Flutter. */ @Override public boolean performAction(int virtualViewId, int accessibilityAction, @Nullable Bundle arguments) { @@ -726,27 +731,27 @@ public boolean performAction(int virtualViewId, int accessibilityAction, @Nullab // Note: TalkBack prior to Oreo doesn't use this handler and instead simulates a // click event at the center of the SemanticsNode. Other a11y services might go // through this handler though. - flutterJNI.dispatchSemanticsAction(virtualViewId, Action.TAP); + accessibilityChannel.dispatchSemanticsAction(virtualViewId, Action.TAP); return true; } case AccessibilityNodeInfo.ACTION_LONG_CLICK: { // Note: TalkBack doesn't use this handler and instead simulates a long click event // at the center of the SemanticsNode. Other a11y services might go through this // handler though. - flutterJNI.dispatchSemanticsAction(virtualViewId, Action.LONG_PRESS); + accessibilityChannel.dispatchSemanticsAction(virtualViewId, Action.LONG_PRESS); return true; } case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: { if (semanticsNode.hasAction(Action.SCROLL_UP)) { - flutterJNI.dispatchSemanticsAction(virtualViewId, Action.SCROLL_UP); + accessibilityChannel.dispatchSemanticsAction(virtualViewId, Action.SCROLL_UP); } else if (semanticsNode.hasAction(Action.SCROLL_LEFT)) { // TODO(ianh): bidi support using textDirection - flutterJNI.dispatchSemanticsAction(virtualViewId, Action.SCROLL_LEFT); + accessibilityChannel.dispatchSemanticsAction(virtualViewId, Action.SCROLL_LEFT); } else if (semanticsNode.hasAction(Action.INCREASE)) { semanticsNode.value = semanticsNode.increasedValue; // Event causes Android to read out the updated value. sendAccessibilityEvent(virtualViewId, AccessibilityEvent.TYPE_VIEW_SELECTED); - flutterJNI.dispatchSemanticsAction(virtualViewId, Action.INCREASE); + accessibilityChannel.dispatchSemanticsAction(virtualViewId, Action.INCREASE); } else { return false; } @@ -754,15 +759,15 @@ public boolean performAction(int virtualViewId, int accessibilityAction, @Nullab } case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: { if (semanticsNode.hasAction(Action.SCROLL_DOWN)) { - flutterJNI.dispatchSemanticsAction(virtualViewId, Action.SCROLL_DOWN); + accessibilityChannel.dispatchSemanticsAction(virtualViewId, Action.SCROLL_DOWN); } else if (semanticsNode.hasAction(Action.SCROLL_RIGHT)) { // TODO(ianh): bidi support using textDirection - flutterJNI.dispatchSemanticsAction(virtualViewId, Action.SCROLL_RIGHT); + accessibilityChannel.dispatchSemanticsAction(virtualViewId, Action.SCROLL_RIGHT); } else if (semanticsNode.hasAction(Action.DECREASE)) { semanticsNode.value = semanticsNode.decreasedValue; // Event causes Android to read out the updated value. sendAccessibilityEvent(virtualViewId, AccessibilityEvent.TYPE_VIEW_SELECTED); - flutterJNI.dispatchSemanticsAction(virtualViewId, Action.DECREASE); + accessibilityChannel.dispatchSemanticsAction(virtualViewId, Action.DECREASE); } else { return false; } @@ -787,7 +792,7 @@ public boolean performAction(int virtualViewId, int accessibilityAction, @Nullab return performCursorMoveAction(semanticsNode, virtualViewId, arguments, true); } case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: { - flutterJNI.dispatchSemanticsAction( + accessibilityChannel.dispatchSemanticsAction( virtualViewId, Action.DID_LOSE_ACCESSIBILITY_FOCUS ); @@ -799,7 +804,7 @@ public boolean performAction(int virtualViewId, int accessibilityAction, @Nullab return true; } case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: { - flutterJNI.dispatchSemanticsAction( + accessibilityChannel.dispatchSemanticsAction( virtualViewId, Action.DID_GAIN_ACCESSIBILITY_FOCUS ); @@ -824,7 +829,7 @@ public boolean performAction(int virtualViewId, int accessibilityAction, @Nullab return true; } case ACTION_SHOW_ON_SCREEN: { - flutterJNI.dispatchSemanticsAction(virtualViewId, Action.SHOW_ON_SCREEN); + accessibilityChannel.dispatchSemanticsAction(virtualViewId, Action.SHOW_ON_SCREEN); return true; } case AccessibilityNodeInfo.ACTION_SET_SELECTION: { @@ -852,23 +857,23 @@ public boolean performAction(int virtualViewId, int accessibilityAction, @Nullab selection.put("base", semanticsNode.textSelectionExtent); selection.put("extent", semanticsNode.textSelectionExtent); } - flutterJNI.dispatchSemanticsAction(virtualViewId, Action.SET_SELECTION, selection); + accessibilityChannel.dispatchSemanticsAction(virtualViewId, Action.SET_SELECTION, selection); return true; } case AccessibilityNodeInfo.ACTION_COPY: { - flutterJNI.dispatchSemanticsAction(virtualViewId, Action.COPY); + accessibilityChannel.dispatchSemanticsAction(virtualViewId, Action.COPY); return true; } case AccessibilityNodeInfo.ACTION_CUT: { - flutterJNI.dispatchSemanticsAction(virtualViewId, Action.CUT); + accessibilityChannel.dispatchSemanticsAction(virtualViewId, Action.CUT); return true; } case AccessibilityNodeInfo.ACTION_PASTE: { - flutterJNI.dispatchSemanticsAction(virtualViewId, Action.PASTE); + accessibilityChannel.dispatchSemanticsAction(virtualViewId, Action.PASTE); return true; } case AccessibilityNodeInfo.ACTION_DISMISS: { - flutterJNI.dispatchSemanticsAction(virtualViewId, Action.DISMISS); + accessibilityChannel.dispatchSemanticsAction(virtualViewId, Action.DISMISS); return true; } default: @@ -876,7 +881,7 @@ public boolean performAction(int virtualViewId, int accessibilityAction, @Nullab final int flutterId = accessibilityAction - FIRST_RESOURCE_ID; CustomAccessibilityAction contextAction = customAccessibilityActions.get(flutterId); if (contextAction != null) { - flutterJNI.dispatchSemanticsAction( + accessibilityChannel.dispatchSemanticsAction( virtualViewId, Action.CUSTOM_ACTION, contextAction.id @@ -908,7 +913,7 @@ private boolean performCursorMoveAction( switch (granularity) { case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER: { if (forward && semanticsNode.hasAction(Action.MOVE_CURSOR_FORWARD_BY_CHARACTER)) { - flutterJNI.dispatchSemanticsAction( + accessibilityChannel.dispatchSemanticsAction( virtualViewId, Action.MOVE_CURSOR_FORWARD_BY_CHARACTER, extendSelection @@ -916,7 +921,7 @@ private boolean performCursorMoveAction( return true; } if (!forward && semanticsNode.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER)) { - flutterJNI.dispatchSemanticsAction( + accessibilityChannel.dispatchSemanticsAction( virtualViewId, Action.MOVE_CURSOR_BACKWARD_BY_CHARACTER, extendSelection @@ -927,7 +932,7 @@ private boolean performCursorMoveAction( } case AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD: if (forward && semanticsNode.hasAction(Action.MOVE_CURSOR_FORWARD_BY_WORD)) { - flutterJNI.dispatchSemanticsAction( + accessibilityChannel.dispatchSemanticsAction( virtualViewId, Action.MOVE_CURSOR_FORWARD_BY_WORD, extendSelection @@ -935,7 +940,7 @@ private boolean performCursorMoveAction( return true; } if (!forward && semanticsNode.hasAction(Action.MOVE_CURSOR_BACKWARD_BY_WORD)) { - flutterJNI.dispatchSemanticsAction( + accessibilityChannel.dispatchSemanticsAction( virtualViewId, Action.MOVE_CURSOR_BACKWARD_BY_WORD, extendSelection diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index c8fc94e5a6185..0ef972ebdcbe1 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -662,8 +662,7 @@ protected void onAttachedToWindow() { mAccessibilityNodeProvider = new AccessibilityBridge( this, - getFlutterNativeView().getFlutterJNI(), - new AccessibilityChannel(dartExecutor), + new AccessibilityChannel(dartExecutor, getFlutterNativeView().getFlutterJNI()), (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE), getContext().getContentResolver() ); From f7a092262cf3c69fb1b90bf79392cc247c78d52c Mon Sep 17 00:00:00 2001 From: David Worsham Date: Thu, 14 Mar 2019 16:05:21 -0700 Subject: [PATCH 0452/1117] [fuchsia] Remove deprecated libraries from snapshot (#8085) --- lib/snapshot/BUILD.gn | 10 +--------- lib/stub_ui/compositing.dart | 2 +- lib/ui/compositing.dart | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn index ca00ad71efa80..595f73994f3fd 100644 --- a/lib/snapshot/BUILD.gn +++ b/lib/snapshot/BUILD.gn @@ -2,17 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("$flutter_root/lib/ui/dart_ui.gni") import("//build/compiled_action.gni") import("//third_party/dart/utils/compile_platform.gni") - -if (is_fuchsia) { - import("//build/dart/dart_library.gni") - import("//build/dart/toolchain.gni") - import("//topaz/public/dart-pkg/fuchsia/sdk_ext.gni") - import("//topaz/public/dart-pkg/zircon/sdk_ext.gni") - import("//topaz/public/lib/ui/flutter/sdk_ext/sdk_ext.gni") -} +import("$flutter_root/lib/ui/dart_ui.gni") bindings_output_dir = "$root_gen_dir/sky/bindings" diff --git a/lib/stub_ui/compositing.dart b/lib/stub_ui/compositing.dart index 071b1d45cdacd..1575db3a06a51 100644 --- a/lib/stub_ui/compositing.dart +++ b/lib/stub_ui/compositing.dart @@ -314,7 +314,7 @@ class SceneHost { /// /// The export token is a dart:zircon Handle, but that type isn't /// available here. This is called by ChildViewConnection in - /// //topaz/public/lib/ui/flutter/. + /// //topaz/public/dart/fuchsia_scenic_flutter/. /// /// The scene host takes ownership of the provided export token handle. SceneHost(dynamic exportTokenHandle); diff --git a/lib/ui/compositing.dart b/lib/ui/compositing.dart index e7675c0a26e74..9eb7c317485b0 100644 --- a/lib/ui/compositing.dart +++ b/lib/ui/compositing.dart @@ -370,7 +370,7 @@ class SceneHost extends NativeFieldWrapperClass2 { /// /// The export token is a dart:zircon Handle, but that type isn't /// available here. This is called by ChildViewConnection in - /// //topaz/public/lib/ui/flutter/. + /// //topaz/public/dart/fuchsia_scenic_flutter/. /// /// The scene host takes ownership of the provided export token handle. SceneHost(dynamic exportTokenHandle) { From 4b01d795feec3ba8231a397a4ec2759954d8216e Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 14 Mar 2019 16:48:01 -0700 Subject: [PATCH 0453/1117] Add frame and target time metadata to vsync events and connect platform vsync events using flows. (#8172) This will allow us to easily visualize the time the platform informed the engine of a vsync event, its arguments, and when the engine began its UI thread workload using this information. --- fml/trace_event.cc | 6 +++++ fml/trace_event.h | 18 +++++++++++++ shell/common/vsync_waiter.cc | 39 ++++++++++++++++++++--------- shell/platform/embedder/embedder.cc | 2 ++ shell/platform/embedder/embedder.h | 2 ++ 5 files changed, 55 insertions(+), 12 deletions(-) diff --git a/fml/trace_event.cc b/fml/trace_event.cc index 434e7883d981b..843aa6b6d5b92 100644 --- a/fml/trace_event.cc +++ b/fml/trace_event.cc @@ -5,6 +5,7 @@ #include "flutter/fml/trace_event.h" #include +#include #include "flutter/fml/build_config.h" #include "flutter/fml/logging.h" @@ -31,6 +32,11 @@ namespace fml { namespace tracing { +size_t TraceNonce() { + static std::atomic_size_t gLastItem; + return ++gLastItem; +} + void TraceTimelineEvent(TraceArg category_group, TraceArg name, TraceIDArg identifier, diff --git a/fml/trace_event.h b/fml/trace_event.h index 1f979d4e35e64..45221a09c4108 100644 --- a/fml/trace_event.h +++ b/fml/trace_event.h @@ -30,6 +30,7 @@ #include #include "flutter/fml/macros.h" +#include "flutter/fml/time/time_point.h" #include "third_party/dart/runtime/include/dart_tools_api.h" #if !defined(OS_FUCHSIA) @@ -50,6 +51,10 @@ ::fml::tracing::TraceCounter((category_group), (name), (counter_id), (arg1), \ __VA_ARGS__); +#define FML_TRACE_EVENT(category_group, name, ...) \ + ::fml::tracing::TraceEvent((category_group), (name), __VA_ARGS__); \ + __FML__AUTO_TRACE_END(name) + #define TRACE_EVENT0(category_group, name) \ ::fml::tracing::TraceEvent0(category_group, name); \ __FML__AUTO_TRACE_END(name) @@ -116,6 +121,10 @@ inline std::string TraceToString(std::string string) { return string; } +inline std::string TraceToString(TimePoint point) { + return std::to_string(point.ToEpochDelta().ToNanoseconds()); +} + template ::value>> std::string TraceToString(T string) { return std::to_string(string); @@ -149,6 +158,8 @@ SplitArguments(Key key, Value value, Args... args) { return std::make_pair(std::move(keys), std::move(values)); } +size_t TraceNonce(); + template void TraceCounter(TraceArg category, TraceArg name, @@ -159,6 +170,13 @@ void TraceCounter(TraceArg category, split.first, split.second); } +template +void TraceEvent(TraceArg category, TraceArg name, Args... args) { + auto split = SplitArguments(args...); + TraceTimelineEvent(category, name, 0, Dart_Timeline_Event_Begin, split.first, + split.second); +} + void TraceEvent0(TraceArg category_group, TraceArg name); void TraceEvent1(TraceArg category_group, diff --git a/shell/common/vsync_waiter.cc b/shell/common/vsync_waiter.cc index a117c7fff5142..b6b55df11b227 100644 --- a/shell/common/vsync_waiter.cc +++ b/shell/common/vsync_waiter.cc @@ -9,6 +9,20 @@ namespace shell { +#if defined(OS_FUCHSIA) +// In general, traces on Fuchsia are recorded across the whole system. +// Because of this, emitting a "VSYNC" event per flutter process is +// undesirable, as the events will collide with each other. We +// instead let another area of the system emit them. +static constexpr const char* kVsyncTraceName = "vsync callback"; +#else // defined(OS_FUCHSIA) +// Note: The tag name must be "VSYNC" (it is special) so that the +// "Highlight Vsync" checkbox in the timeline can be enabled. +static constexpr const char* kVsyncTraceName = "VSYNC"; +#endif // defined(OS_FUCHSIA) + +static constexpr const char* kVsyncFlowName = "VsyncFlow"; + VsyncWaiter::VsyncWaiter(blink::TaskRunners task_runners) : task_runners_(std::move(task_runners)) {} @@ -35,19 +49,20 @@ void VsyncWaiter::FireCallback(fml::TimePoint frame_start_time, return; } + auto flow_identifier = fml::tracing::TraceNonce(); + + // The base trace ensures that flows have a root to begin from if one does not + // exist. The trace viewer will ignore traces that have no base event trace. + // While all our message loops insert a base trace trace + // (MessageLoop::RunExpiredTasks), embedders may not. + TRACE_EVENT0("flutter", "VsyncFireCallback"); + TRACE_FLOW_BEGIN("flutter", kVsyncFlowName, flow_identifier); + task_runners_.GetUITaskRunner()->PostTaskForTime( - [callback, frame_start_time, frame_target_time]() { -#if defined(OS_FUCHSIA) - // In general, traces on Fuchsia are recorded across the whole system. - // Because of this, emitting a "VSYNC" event per flutter process is - // undesirable, as the events will collide with each other. We - // instead let another area of the system emit them. - TRACE_EVENT0("flutter", "vsync callback"); -#else - // Note: The tag name must be "VSYNC" (it is special) so that the - // "Highlight Vsync" checkbox in the timeline can be enabled. - TRACE_EVENT0("flutter", "VSYNC"); -#endif + [callback, flow_identifier, frame_start_time, frame_target_time]() { + FML_TRACE_EVENT("flutter", kVsyncTraceName, "StartTime", + frame_start_time, "TargetTime", frame_target_time); + TRACE_FLOW_END("flutter", kVsyncFlowName, flow_identifier); callback(frame_start_time, frame_target_time); }, frame_start_time); diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 09933a32a001e..65aa88808f875 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -888,6 +888,8 @@ FlutterEngineResult FlutterEngineOnVsync(FlutterEngine engine, return LOG_EMBEDDER_ERROR(kInvalidArguments); } + TRACE_EVENT0("flutter", "FlutterEngineOnVsync"); + auto start_time = fml::TimePoint::FromEpochDelta( fml::TimeDelta::FromNanoseconds(frame_start_time_nanos)); diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 8f2453867276b..6127681c55774 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -664,6 +664,8 @@ FlutterEngineResult FlutterEngineDispatchSemanticsAction( // garbage collection in periods in which the various threads are most likely to // be idle. For example, for a 60Hz display, embedders should add 16.6 * 1e6 to // the frame time field. The system monotonic clock is used as the timebase. +// +// That frame timepoints are in nanoseconds. FLUTTER_EXPORT FlutterEngineResult FlutterEngineOnVsync(FlutterEngine engine, intptr_t baton, From d9b2f0946582f2824b62d227b629a47d9d830f98 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 15 Mar 2019 00:05:54 -0400 Subject: [PATCH 0454/1117] Roll src/third_party/skia 512e38091c85..05201fc7e77e (10 commits) (#8173) https://skia.googlesource.com/skia.git/%2Blog/512e38091c85..05201fc7e77e git log 512e38091c8511847334b89365d46cbb0452309a..05201fc7e77e0d2682763dbbe15cf6b65a0d6cb9 --date=short --no-merges --format=%ad %ae %s 2019-03-14 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-14 brianosman@google.com Ganesh: Clamp blend inputs when using F16_Clamped pixel config 2019-03-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader becb44f1177a..9b156615197d (1 commits) 2019-03-14 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader a2749f39f47d..becb44f1177a (1 commits) 2019-03-14 jvanverth@google.com Fix cached perspective shadows 2019-03-14 michaelludwig@google.com Blacklist compositor_quads_filter on chromecast 2019-03-14 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader af973b67141e..a2749f39f47d (1 commits) 2019-03-14 bsalomon@google.com Clamp override color to bytes in GrFillRectOp when half float vertex attrs not supported. 2019-03-14 kjlubick@google.com [canvaskit] Fallback to CPU more gracefully The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index b28772df19a33..d254717f8ceaa 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': '512e38091c8511847334b89365d46cbb0452309a', + 'skia_revision': '05201fc7e77e0d2682763dbbe15cf6b65a0d6cb9', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 5393cbab00488..b2e10fe23a06b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 0b30f75a389dd244bf9fe53576e7b76c +Signature: 8a89af94f3b409ce70b53afbfb2b7c5c UNUSED LICENSES: From b32d0ab982bf0d47e74365fbc9fe7e7b709b7596 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 14 Mar 2019 21:13:03 -0700 Subject: [PATCH 0455/1117] Bugfix: Prevent crash when responding to a platform message after FlutterJNI detaches from native (#28651). (#8170) --- .../flutter/embedding/engine/FlutterJNI.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java index f8405852a5217..925e2a8d7290f 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java @@ -10,6 +10,7 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.UiThread; +import android.util.Log; import android.view.Surface; import java.nio.ByteBuffer; @@ -494,8 +495,11 @@ private native void nativeDispatchPlatformMessage( @UiThread public void invokePlatformMessageEmptyResponseCallback(int responseId) { - ensureAttachedToNative(); - nativeInvokePlatformMessageEmptyResponseCallback(nativePlatformViewId, responseId); + if (isAttached()) { + nativeInvokePlatformMessageEmptyResponseCallback(nativePlatformViewId, responseId); + } else { + Log.w(TAG, "Tried to send a platform message response, but FlutterJNI was detached from native C++. Could not send. Response ID: " + responseId); + } } // Send an empty response to a platform message received from Dart. @@ -506,13 +510,16 @@ private native void nativeInvokePlatformMessageEmptyResponseCallback( @UiThread public void invokePlatformMessageResponseCallback(int responseId, ByteBuffer message, int position) { - ensureAttachedToNative(); - nativeInvokePlatformMessageResponseCallback( - nativePlatformViewId, - responseId, - message, - position - ); + if (isAttached()) { + nativeInvokePlatformMessageResponseCallback( + nativePlatformViewId, + responseId, + message, + position + ); + } else { + Log.w(TAG, "Tried to send a platform message response, but FlutterJNI was detached from native C++. Could not send. Response ID: " + responseId); + } } // Send a data-carrying response to a platform message received from Dart. From b36068c3778c014ac999ce03412af2690bc713bc Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 15 Mar 2019 03:46:55 -0400 Subject: [PATCH 0456/1117] Roll src/third_party/skia 05201fc7e77e..aefecad7c0d2 (5 commits) (#8176) https://skia.googlesource.com/skia.git/%2Blog/05201fc7e77e..aefecad7c0d2 git log 05201fc7e77e0d2682763dbbe15cf6b65a0d6cb9..aefecad7c0d2c29c147a05ea385a2ad855cbbc20 --date=short --no-merges --format=%ad %ae %s 2019-03-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 6299cd6e9d2d..558a982945cf (482 commits) 2019-03-15 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-03-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 979f3bbe2c50..2fb6563bf503 (2 commits) 2019-03-14 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 9b156615197d..1b8cd2d9ce2c (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d254717f8ceaa..442e2d91206e0 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': '05201fc7e77e0d2682763dbbe15cf6b65a0d6cb9', + 'skia_revision': 'aefecad7c0d2c29c147a05ea385a2ad855cbbc20', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b2e10fe23a06b..1a8991d91a7af 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8a89af94f3b409ce70b53afbfb2b7c5c +Signature: 102988759bda2da07e57919dc14f8812 UNUSED LICENSES: From c0690e6ec85e3a92e840cef05c8ba56c269395f3 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 15 Mar 2019 08:35:12 -0400 Subject: [PATCH 0457/1117] Roll src/third_party/skia aefecad7c0d2..69600007e278 (2 commits) (#8177) https://skia.googlesource.com/skia.git/%2Blog/aefecad7c0d2..69600007e278 git log aefecad7c0d2c29c147a05ea385a2ad855cbbc20..69600007e278d1bd3fed1df28a6dd9cb9ed23f20 --date=short --no-merges --format=%ad %ae %s 2019-03-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 633b2fb00ed0..e37ce613d1c7 (2 commits) 2019-03-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 1b8cd2d9ce2c..633b2fb00ed0 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 442e2d91206e0..3d39e710a7dfc 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': 'aefecad7c0d2c29c147a05ea385a2ad855cbbc20', + 'skia_revision': '69600007e278d1bd3fed1df28a6dd9cb9ed23f20', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 1a8991d91a7af..ec676718e2ca8 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 102988759bda2da07e57919dc14f8812 +Signature: 4038d23ce57b0f85d883bcc7c754bfd9 UNUSED LICENSES: From cad97fe7467c60de645d47acffd0e00cd83178ab Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Fri, 15 Mar 2019 08:35:48 -0700 Subject: [PATCH 0458/1117] Update overlays_gr_context_ correctly (#8175) There can be cases where SubmitFrame gets called before overlays are a part of the frame, in these cases, we should not update the GRContext ahead of time. This commit makes it so we will update it only when the frame really shows the overlay. This addresses: https://github.com/flutter/flutter/issues/28920 --- flow/embedded_views.h | 2 +- .../ios/framework/Source/FlutterPlatformViews.mm | 10 ++++------ .../framework/Source/FlutterPlatformViews_Internal.h | 3 +-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/flow/embedded_views.h b/flow/embedded_views.h index 6f2e684c4841e..0fd474adb0812 100644 --- a/flow/embedded_views.h +++ b/flow/embedded_views.h @@ -21,7 +21,7 @@ class EmbeddedViewParams { }; // This is only used on iOS when running in a non headless mode, -// in this case ViewEmbedded is a reference to the +// in this case ExternalViewEmbedder is a reference to the // FlutterPlatformViewsController which is owned by FlutterViewController. class ExternalViewEmbedder { public: diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm index 304ae123bc364..fddc75fa541a0 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm @@ -210,8 +210,7 @@ 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, - gr_context != overlays_gr_context_); + EnsureGLOverlayInitialized(view_id, gl_context, gr_context); } else { EnsureOverlayInitialized(view_id); } @@ -221,7 +220,6 @@ canvas->flush(); did_submit &= frame->Submit(); } - overlays_gr_context_ = gr_context; picture_recorders_.clear(); if (composition_order_ == active_composition_order_) { composition_order_.clear(); @@ -267,10 +265,10 @@ void FlutterPlatformViewsController::EnsureGLOverlayInitialized( int64_t overlay_id, std::shared_ptr gl_context, - GrContext* gr_context, - bool update_gr_context) { + GrContext* gr_context) { if (overlays_.count(overlay_id) != 0) { - if (update_gr_context) { + if (gr_context != overlays_gr_context_) { + overlays_gr_context_ = gr_context; // The overlay already exists, but the GrContext was changed so we need to recreate // the rendering surface with the new GrContext. IOSSurfaceGL* ios_surface_gl = (IOSSurfaceGL*)overlays_[overlay_id]->ios_surface.get(); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h index 87aa5a3626343..a89a2ff9bc3f3 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h @@ -101,8 +101,7 @@ class FlutterPlatformViewsController { void EnsureOverlayInitialized(int64_t overlay_id); void EnsureGLOverlayInitialized(int64_t overlay_id, std::shared_ptr gl_context, - GrContext* gr_context, - bool update_gr_context); + GrContext* gr_context); FML_DISALLOW_COPY_AND_ASSIGN(FlutterPlatformViewsController); }; From 7da45be4a9afec572ebc110ad52511f5e2dc63e3 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 15 Mar 2019 12:23:46 -0400 Subject: [PATCH 0459/1117] Roll src/third_party/skia 69600007e278..46f5ee156155 (8 commits) (#8178) https://skia.googlesource.com/skia.git/%2Blog/69600007e278..46f5ee156155 git log 69600007e278d1bd3fed1df28a6dd9cb9ed23f20..46f5ee1561558857a1c669b43b71ca84f6ba6f22 --date=short --no-merges --format=%ad %ae %s 2019-03-15 nifong@google.com Add selectable GPU backend to wasm debugger 2019-03-07 halcanary@google.com Compile all fiddle examples locally 2019-03-15 brianosman@google.com Add shader based blending of kPlus for configs that need clamping 2019-03-15 mtklein@google.com Revert "remove plus clamp" 2019-03-14 fmalita@chromium.org [skottie] Initial text box support 2019-03-15 bsalomon@google.com Revert "Reland "Update SkCanvas' experimental SkiaRenderer API"" 2019-03-15 brianosman@google.com Change --checkF16 behavior to just print - it's easier to see all failures 2019-03-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 2fb6563bf503..de52ca373d98 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 1200 +++++++++++++++++++++++++++++- 2 files changed, 1165 insertions(+), 37 deletions(-) diff --git a/DEPS b/DEPS index 3d39e710a7dfc..c304f870ff095 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': '69600007e278d1bd3fed1df28a6dd9cb9ed23f20', + 'skia_revision': '46f5ee1561558857a1c669b43b71ca84f6ba6f22', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index ec676718e2ca8..92e606ef6f905 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 4038d23ce57b0f85d883bcc7c754bfd9 +Signature: bd6c6df433f7f05bc56ed2578837d560 UNUSED LICENSES: @@ -2076,6 +2076,7 @@ FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/debugger/index.ht FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/debugger/sample.skp FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/externs.js FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/fonts/NotoMono-Regular.ttf +FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/gpu.js FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/karma.conf.js FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/package.json FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/ready.js @@ -4648,6 +4649,1168 @@ 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/docs/examples/AutoCanvasRestore_000.cpp + ../../../third_party/skia/LICENSE +TYPE: LicenseType.bsd +FILE: ../../../third_party/skia/docs/examples/AutoCanvasRestore_000.cpp +FILE: ../../../third_party/skia/docs/examples/AutoCanvasRestore_001.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_000.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_001.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_002.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_003.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_004.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_005.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_006.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_007.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_008.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_009.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_010.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_011.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_012.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_013.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_014.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_015.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_016.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_017.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_018.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_019.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_020.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_021.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_022.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_023.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_024.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_025.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_026.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_027.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_028.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_029.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_030.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_031.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_032.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_033.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_034.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_035.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_036.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_037.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_038.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_039.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_040.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_041.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_042.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_043.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_044.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_045.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_046.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_047.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_048.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_049.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_050.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_051.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_052.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_053.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_054.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_055.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_056.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_057.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_058.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_059.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_060.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_061.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_062.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_063.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_064.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_065.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_066.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_067.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_068.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_069.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_070.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_071.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_072.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_073.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_074.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_075.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_076.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_077.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_000.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_001.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_002.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_003.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_004.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_005.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_006.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_007.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_008.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_009.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_010.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_011.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_012.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_013.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_014.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_015.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_016.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_017.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_018.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_019.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_020.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_021.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_022.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_023.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_024.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_025.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_026.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_027.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_028.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_029.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_000.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_001.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_002.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_003.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_004.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_005.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_006.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_008.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_009.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_010.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_011.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_012.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_013.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_014.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_015.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_016.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_017.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_018.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_019.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_020.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_021.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_022.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_023.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_024.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_025.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_026.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_027.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_028.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_029.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_030.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_031.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_032.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_033.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_034.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_035.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_036.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_037.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_038.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_039.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_040.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_041.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_042.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_043.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_044.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_045.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_046.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_047.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_048.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_049.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_050.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_051.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_052.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_053.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_054.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_055.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_056.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_057.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_058.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_059.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_060.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_061.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_062.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_063.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_064.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_065.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_066.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_067.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_068.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_069.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_070.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_071.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_072.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_073.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_074.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_075.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_076.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_077.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_078.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_079.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_080.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_081.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_082.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_083.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_084.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_085.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_086.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_087.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_088.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_089.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_090.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_091.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_092.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_093.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_094.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_095.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_096.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_097.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_098.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_099.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_100.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_101.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_102.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_103.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_104.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_105.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_106.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_107.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_108.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_109.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_110.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_111.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_112.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_113.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_114.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_115.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_116.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_117.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_118.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_119.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_120.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_121.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_122.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_123.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_124.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_125.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_126.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_127.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_128.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_129.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_130.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_131.cpp +FILE: ../../../third_party/skia/docs/examples/Color4f_000.cpp +FILE: ../../../third_party/skia/docs/examples/Color4f_001.cpp +FILE: ../../../third_party/skia/docs/examples/Color4f_002.cpp +FILE: ../../../third_party/skia/docs/examples/Color4f_003.cpp +FILE: ../../../third_party/skia/docs/examples/Color4f_004.cpp +FILE: ../../../third_party/skia/docs/examples/Color4f_005.cpp +FILE: ../../../third_party/skia/docs/examples/Color_000.cpp +FILE: ../../../third_party/skia/docs/examples/Color_001.cpp +FILE: ../../../third_party/skia/docs/examples/Color_002.cpp +FILE: ../../../third_party/skia/docs/examples/Color_003.cpp +FILE: ../../../third_party/skia/docs/examples/Color_004.cpp +FILE: ../../../third_party/skia/docs/examples/Color_005.cpp +FILE: ../../../third_party/skia/docs/examples/Color_006.cpp +FILE: ../../../third_party/skia/docs/examples/Color_007.cpp +FILE: ../../../third_party/skia/docs/examples/Color_008.cpp +FILE: ../../../third_party/skia/docs/examples/Color_009.cpp +FILE: ../../../third_party/skia/docs/examples/Color_010.cpp +FILE: ../../../third_party/skia/docs/examples/Color_011.cpp +FILE: ../../../third_party/skia/docs/examples/Color_012.cpp +FILE: ../../../third_party/skia/docs/examples/Color_013.cpp +FILE: ../../../third_party/skia/docs/examples/Color_014.cpp +FILE: ../../../third_party/skia/docs/examples/Color_015.cpp +FILE: ../../../third_party/skia/docs/examples/Color_016.cpp +FILE: ../../../third_party/skia/docs/examples/Color_017.cpp +FILE: ../../../third_party/skia/docs/examples/Color_018.cpp +FILE: ../../../third_party/skia/docs/examples/Font_000.cpp +FILE: ../../../third_party/skia/docs/examples/Font_001.cpp +FILE: ../../../third_party/skia/docs/examples/Font_002.cpp +FILE: ../../../third_party/skia/docs/examples/Font_003.cpp +FILE: ../../../third_party/skia/docs/examples/Font_004.cpp +FILE: ../../../third_party/skia/docs/examples/Font_005.cpp +FILE: ../../../third_party/skia/docs/examples/Font_006.cpp +FILE: ../../../third_party/skia/docs/examples/Font_007.cpp +FILE: ../../../third_party/skia/docs/examples/Font_008.cpp +FILE: ../../../third_party/skia/docs/examples/Font_009.cpp +FILE: ../../../third_party/skia/docs/examples/Font_010.cpp +FILE: ../../../third_party/skia/docs/examples/Font_011.cpp +FILE: ../../../third_party/skia/docs/examples/Font_012.cpp +FILE: ../../../third_party/skia/docs/examples/Font_013.cpp +FILE: ../../../third_party/skia/docs/examples/Font_014.cpp +FILE: ../../../third_party/skia/docs/examples/Font_015.cpp +FILE: ../../../third_party/skia/docs/examples/Font_016.cpp +FILE: ../../../third_party/skia/docs/examples/Font_017.cpp +FILE: ../../../third_party/skia/docs/examples/Font_018.cpp +FILE: ../../../third_party/skia/docs/examples/Font_019.cpp +FILE: ../../../third_party/skia/docs/examples/Font_020.cpp +FILE: ../../../third_party/skia/docs/examples/Font_021.cpp +FILE: ../../../third_party/skia/docs/examples/Font_022.cpp +FILE: ../../../third_party/skia/docs/examples/Font_023.cpp +FILE: ../../../third_party/skia/docs/examples/Font_024.cpp +FILE: ../../../third_party/skia/docs/examples/Font_025.cpp +FILE: ../../../third_party/skia/docs/examples/Font_026.cpp +FILE: ../../../third_party/skia/docs/examples/Font_027.cpp +FILE: ../../../third_party/skia/docs/examples/Font_028.cpp +FILE: ../../../third_party/skia/docs/examples/Font_029.cpp +FILE: ../../../third_party/skia/docs/examples/Font_030.cpp +FILE: ../../../third_party/skia/docs/examples/Font_031.cpp +FILE: ../../../third_party/skia/docs/examples/Font_032.cpp +FILE: ../../../third_party/skia/docs/examples/Font_033.cpp +FILE: ../../../third_party/skia/docs/examples/Font_034.cpp +FILE: ../../../third_party/skia/docs/examples/Font_035.cpp +FILE: ../../../third_party/skia/docs/examples/Font_036.cpp +FILE: ../../../third_party/skia/docs/examples/Font_037.cpp +FILE: ../../../third_party/skia/docs/examples/Font_038.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_000.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_001.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_002.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_003.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_004.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_005.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_006.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_007.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_008.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_009.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_010.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_011.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_012.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_000.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_001.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_002.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_003.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_004.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_005.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_006.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_007.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_008.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_009.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_010.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_011.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_012.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_013.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_014.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_015.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_016.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_017.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_018.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_019.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_020.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_021.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_022.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_023.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_024.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_025.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_026.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_027.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_028.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_029.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_030.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_031.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_032.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_033.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_034.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_035.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_036.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_037.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_038.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_039.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_040.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_041.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_042.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_043.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_044.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_045.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_046.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_047.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_048.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_049.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_000.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_001.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_002.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_003.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_004.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_005.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_006.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_007.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_008.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_009.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_010.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_011.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_012.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_013.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_014.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_015.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_016.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_017.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_018.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_019.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_020.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_021.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_022.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_023.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_024.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_025.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_026.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_027.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_028.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_029.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_030.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_031.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_032.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_033.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_034.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_035.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_036.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_037.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_038.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_039.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_040.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_041.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_042.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_043.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_044.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_045.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_046.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_047.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_048.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_049.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_050.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_051.cpp +FILE: ../../../third_party/skia/docs/examples/Image_000.cpp +FILE: ../../../third_party/skia/docs/examples/Image_001.cpp +FILE: ../../../third_party/skia/docs/examples/Image_002.cpp +FILE: ../../../third_party/skia/docs/examples/Image_003.cpp +FILE: ../../../third_party/skia/docs/examples/Image_004.cpp +FILE: ../../../third_party/skia/docs/examples/Image_005.cpp +FILE: ../../../third_party/skia/docs/examples/Image_006.cpp +FILE: ../../../third_party/skia/docs/examples/Image_007.cpp +FILE: ../../../third_party/skia/docs/examples/Image_008.cpp +FILE: ../../../third_party/skia/docs/examples/Image_009.cpp +FILE: ../../../third_party/skia/docs/examples/Image_010.cpp +FILE: ../../../third_party/skia/docs/examples/Image_011.cpp +FILE: ../../../third_party/skia/docs/examples/Image_012.cpp +FILE: ../../../third_party/skia/docs/examples/Image_013.cpp +FILE: ../../../third_party/skia/docs/examples/Image_014.cpp +FILE: ../../../third_party/skia/docs/examples/Image_015.cpp +FILE: ../../../third_party/skia/docs/examples/Image_016.cpp +FILE: ../../../third_party/skia/docs/examples/Image_017.cpp +FILE: ../../../third_party/skia/docs/examples/Image_018.cpp +FILE: ../../../third_party/skia/docs/examples/Image_019.cpp +FILE: ../../../third_party/skia/docs/examples/Image_020.cpp +FILE: ../../../third_party/skia/docs/examples/Image_021.cpp +FILE: ../../../third_party/skia/docs/examples/Image_022.cpp +FILE: ../../../third_party/skia/docs/examples/Image_023.cpp +FILE: ../../../third_party/skia/docs/examples/Image_024.cpp +FILE: ../../../third_party/skia/docs/examples/Image_025.cpp +FILE: ../../../third_party/skia/docs/examples/Image_026.cpp +FILE: ../../../third_party/skia/docs/examples/Image_027.cpp +FILE: ../../../third_party/skia/docs/examples/Image_028.cpp +FILE: ../../../third_party/skia/docs/examples/Image_029.cpp +FILE: ../../../third_party/skia/docs/examples/Image_030.cpp +FILE: ../../../third_party/skia/docs/examples/Image_031.cpp +FILE: ../../../third_party/skia/docs/examples/Image_032.cpp +FILE: ../../../third_party/skia/docs/examples/Image_033.cpp +FILE: ../../../third_party/skia/docs/examples/Image_034.cpp +FILE: ../../../third_party/skia/docs/examples/Image_035.cpp +FILE: ../../../third_party/skia/docs/examples/Image_036.cpp +FILE: ../../../third_party/skia/docs/examples/Image_037.cpp +FILE: ../../../third_party/skia/docs/examples/Image_038.cpp +FILE: ../../../third_party/skia/docs/examples/Image_039.cpp +FILE: ../../../third_party/skia/docs/examples/Image_040.cpp +FILE: ../../../third_party/skia/docs/examples/Image_041.cpp +FILE: ../../../third_party/skia/docs/examples/Image_042.cpp +FILE: ../../../third_party/skia/docs/examples/Image_043.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_000.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_001.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_002.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_003.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_004.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_005.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_006.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_007.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_008.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_009.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_010.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_011.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_012.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_013.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_014.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_015.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_016.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_017.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_018.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_019.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_020.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_021.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_022.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_023.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_024.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_025.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_026.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_027.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_028.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_029.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_030.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_031.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_032.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_033.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_034.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_035.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_036.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_037.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_038.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_039.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_040.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_041.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_042.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_043.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_044.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_045.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_046.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_047.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_048.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_049.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_050.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_051.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_052.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_053.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_054.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_055.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_056.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_057.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_058.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_059.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_060.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_061.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_062.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_063.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_064.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_065.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_066.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_067.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_068.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_069.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_070.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_071.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_072.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_073.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_074.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_075.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_076.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_077.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_078.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_079.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_080.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_081.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_082.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_083.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_084.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_085.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_086.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_087.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_088.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_089.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_090.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_091.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_092.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_093.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_094.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_095.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_096.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_097.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_098.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_099.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_100.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_101.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_102.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_103.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_104.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_105.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_106.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_107.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_000.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_001.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_002.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_003.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_004.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_005.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_006.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_007.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_008.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_009.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_010.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_011.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_012.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_013.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_014.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_015.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_016.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_017.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_018.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_019.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_020.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_021.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_022.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_023.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_024.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_025.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_026.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_027.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_028.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_029.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_030.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_031.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_032.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_033.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_034.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_035.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_036.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_037.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_038.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_039.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_040.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_041.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_042.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_043.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_044.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_045.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_046.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_047.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_048.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_049.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_050.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_051.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_052.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_053.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_054.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_055.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_056.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_057.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_058.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_059.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_060.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_061.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_062.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_063.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_064.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_065.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_066.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_067.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_068.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_069.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_070.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_071.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_072.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_073.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_074.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_075.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_076.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_077.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_078.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_079.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_080.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_081.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_082.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_083.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_084.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_085.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_086.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_087.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_088.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_089.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_090.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_091.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_092.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_093.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_094.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_095.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_096.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_097.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_098.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_099.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_100.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_101.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_102.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_103.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_104.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_105.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_106.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_107.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_108.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_109.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_110.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_111.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_112.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_113.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_114.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_115.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_116.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_117.cpp +FILE: ../../../third_party/skia/docs/examples/Path_000.cpp +FILE: ../../../third_party/skia/docs/examples/Path_001.cpp +FILE: ../../../third_party/skia/docs/examples/Path_002.cpp +FILE: ../../../third_party/skia/docs/examples/Path_003.cpp +FILE: ../../../third_party/skia/docs/examples/Path_004.cpp +FILE: ../../../third_party/skia/docs/examples/Path_005.cpp +FILE: ../../../third_party/skia/docs/examples/Path_006.cpp +FILE: ../../../third_party/skia/docs/examples/Path_007.cpp +FILE: ../../../third_party/skia/docs/examples/Path_008.cpp +FILE: ../../../third_party/skia/docs/examples/Path_009.cpp +FILE: ../../../third_party/skia/docs/examples/Path_010.cpp +FILE: ../../../third_party/skia/docs/examples/Path_011.cpp +FILE: ../../../third_party/skia/docs/examples/Path_012.cpp +FILE: ../../../third_party/skia/docs/examples/Path_013.cpp +FILE: ../../../third_party/skia/docs/examples/Path_014.cpp +FILE: ../../../third_party/skia/docs/examples/Path_015.cpp +FILE: ../../../third_party/skia/docs/examples/Path_016.cpp +FILE: ../../../third_party/skia/docs/examples/Path_017.cpp +FILE: ../../../third_party/skia/docs/examples/Path_018.cpp +FILE: ../../../third_party/skia/docs/examples/Path_019.cpp +FILE: ../../../third_party/skia/docs/examples/Path_020.cpp +FILE: ../../../third_party/skia/docs/examples/Path_021.cpp +FILE: ../../../third_party/skia/docs/examples/Path_022.cpp +FILE: ../../../third_party/skia/docs/examples/Path_023.cpp +FILE: ../../../third_party/skia/docs/examples/Path_024.cpp +FILE: ../../../third_party/skia/docs/examples/Path_025.cpp +FILE: ../../../third_party/skia/docs/examples/Path_026.cpp +FILE: ../../../third_party/skia/docs/examples/Path_027.cpp +FILE: ../../../third_party/skia/docs/examples/Path_028.cpp +FILE: ../../../third_party/skia/docs/examples/Path_029.cpp +FILE: ../../../third_party/skia/docs/examples/Path_030.cpp +FILE: ../../../third_party/skia/docs/examples/Path_031.cpp +FILE: ../../../third_party/skia/docs/examples/Path_032.cpp +FILE: ../../../third_party/skia/docs/examples/Path_033.cpp +FILE: ../../../third_party/skia/docs/examples/Path_034.cpp +FILE: ../../../third_party/skia/docs/examples/Path_035.cpp +FILE: ../../../third_party/skia/docs/examples/Path_036.cpp +FILE: ../../../third_party/skia/docs/examples/Path_037.cpp +FILE: ../../../third_party/skia/docs/examples/Path_038.cpp +FILE: ../../../third_party/skia/docs/examples/Path_039.cpp +FILE: ../../../third_party/skia/docs/examples/Path_040.cpp +FILE: ../../../third_party/skia/docs/examples/Path_041.cpp +FILE: ../../../third_party/skia/docs/examples/Path_042.cpp +FILE: ../../../third_party/skia/docs/examples/Path_043.cpp +FILE: ../../../third_party/skia/docs/examples/Path_044.cpp +FILE: ../../../third_party/skia/docs/examples/Path_045.cpp +FILE: ../../../third_party/skia/docs/examples/Path_046.cpp +FILE: ../../../third_party/skia/docs/examples/Path_047.cpp +FILE: ../../../third_party/skia/docs/examples/Path_048.cpp +FILE: ../../../third_party/skia/docs/examples/Path_049.cpp +FILE: ../../../third_party/skia/docs/examples/Path_050.cpp +FILE: ../../../third_party/skia/docs/examples/Path_051.cpp +FILE: ../../../third_party/skia/docs/examples/Path_052.cpp +FILE: ../../../third_party/skia/docs/examples/Path_053.cpp +FILE: ../../../third_party/skia/docs/examples/Path_054.cpp +FILE: ../../../third_party/skia/docs/examples/Path_055.cpp +FILE: ../../../third_party/skia/docs/examples/Path_056.cpp +FILE: ../../../third_party/skia/docs/examples/Path_057.cpp +FILE: ../../../third_party/skia/docs/examples/Path_058.cpp +FILE: ../../../third_party/skia/docs/examples/Path_059.cpp +FILE: ../../../third_party/skia/docs/examples/Path_060.cpp +FILE: ../../../third_party/skia/docs/examples/Path_061.cpp +FILE: ../../../third_party/skia/docs/examples/Path_062.cpp +FILE: ../../../third_party/skia/docs/examples/Path_063.cpp +FILE: ../../../third_party/skia/docs/examples/Path_064.cpp +FILE: ../../../third_party/skia/docs/examples/Path_065.cpp +FILE: ../../../third_party/skia/docs/examples/Path_066.cpp +FILE: ../../../third_party/skia/docs/examples/Path_067.cpp +FILE: ../../../third_party/skia/docs/examples/Path_068.cpp +FILE: ../../../third_party/skia/docs/examples/Path_069.cpp +FILE: ../../../third_party/skia/docs/examples/Path_070.cpp +FILE: ../../../third_party/skia/docs/examples/Path_071.cpp +FILE: ../../../third_party/skia/docs/examples/Path_072.cpp +FILE: ../../../third_party/skia/docs/examples/Path_073.cpp +FILE: ../../../third_party/skia/docs/examples/Path_074.cpp +FILE: ../../../third_party/skia/docs/examples/Path_075.cpp +FILE: ../../../third_party/skia/docs/examples/Path_076.cpp +FILE: ../../../third_party/skia/docs/examples/Path_077.cpp +FILE: ../../../third_party/skia/docs/examples/Path_078.cpp +FILE: ../../../third_party/skia/docs/examples/Path_079.cpp +FILE: ../../../third_party/skia/docs/examples/Path_080.cpp +FILE: ../../../third_party/skia/docs/examples/Path_081.cpp +FILE: ../../../third_party/skia/docs/examples/Path_082.cpp +FILE: ../../../third_party/skia/docs/examples/Path_083.cpp +FILE: ../../../third_party/skia/docs/examples/Path_084.cpp +FILE: ../../../third_party/skia/docs/examples/Path_085.cpp +FILE: ../../../third_party/skia/docs/examples/Path_086.cpp +FILE: ../../../third_party/skia/docs/examples/Path_087.cpp +FILE: ../../../third_party/skia/docs/examples/Path_088.cpp +FILE: ../../../third_party/skia/docs/examples/Path_089.cpp +FILE: ../../../third_party/skia/docs/examples/Path_090.cpp +FILE: ../../../third_party/skia/docs/examples/Path_091.cpp +FILE: ../../../third_party/skia/docs/examples/Path_092.cpp +FILE: ../../../third_party/skia/docs/examples/Path_093.cpp +FILE: ../../../third_party/skia/docs/examples/Path_094.cpp +FILE: ../../../third_party/skia/docs/examples/Path_095.cpp +FILE: ../../../third_party/skia/docs/examples/Path_096.cpp +FILE: ../../../third_party/skia/docs/examples/Path_097.cpp +FILE: ../../../third_party/skia/docs/examples/Path_098.cpp +FILE: ../../../third_party/skia/docs/examples/Path_099.cpp +FILE: ../../../third_party/skia/docs/examples/Path_100.cpp +FILE: ../../../third_party/skia/docs/examples/Path_101.cpp +FILE: ../../../third_party/skia/docs/examples/Path_102.cpp +FILE: ../../../third_party/skia/docs/examples/Path_103.cpp +FILE: ../../../third_party/skia/docs/examples/Path_104.cpp +FILE: ../../../third_party/skia/docs/examples/Path_105.cpp +FILE: ../../../third_party/skia/docs/examples/Path_106.cpp +FILE: ../../../third_party/skia/docs/examples/Path_107.cpp +FILE: ../../../third_party/skia/docs/examples/Path_108.cpp +FILE: ../../../third_party/skia/docs/examples/Path_109.cpp +FILE: ../../../third_party/skia/docs/examples/Path_110.cpp +FILE: ../../../third_party/skia/docs/examples/Path_111.cpp +FILE: ../../../third_party/skia/docs/examples/Path_112.cpp +FILE: ../../../third_party/skia/docs/examples/Path_113.cpp +FILE: ../../../third_party/skia/docs/examples/Path_114.cpp +FILE: ../../../third_party/skia/docs/examples/Path_115.cpp +FILE: ../../../third_party/skia/docs/examples/Path_116.cpp +FILE: ../../../third_party/skia/docs/examples/Path_117.cpp +FILE: ../../../third_party/skia/docs/examples/Path_118.cpp +FILE: ../../../third_party/skia/docs/examples/Path_119.cpp +FILE: ../../../third_party/skia/docs/examples/Path_120.cpp +FILE: ../../../third_party/skia/docs/examples/Path_121.cpp +FILE: ../../../third_party/skia/docs/examples/Path_122.cpp +FILE: ../../../third_party/skia/docs/examples/Path_123.cpp +FILE: ../../../third_party/skia/docs/examples/Path_124.cpp +FILE: ../../../third_party/skia/docs/examples/Path_125.cpp +FILE: ../../../third_party/skia/docs/examples/Path_126.cpp +FILE: ../../../third_party/skia/docs/examples/Path_127.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_000.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_001.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_002.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_003.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_004.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_005.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_006.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_007.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_008.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_009.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_010.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_011.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_000.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_001.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_002.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_003.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_004.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_005.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_006.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_007.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_008.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_009.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_010.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_011.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_012.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_013.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_014.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_015.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_016.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_017.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_018.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_019.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_020.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_021.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_022.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_023.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_024.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_025.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_026.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_027.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_028.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_029.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_030.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_031.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_032.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_033.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_034.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_035.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_036.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_037.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_038.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_039.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_040.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_041.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_042.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_043.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_044.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_045.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_046.cpp +FILE: ../../../third_party/skia/docs/examples/Point_000.cpp +FILE: ../../../third_party/skia/docs/examples/Point_001.cpp +FILE: ../../../third_party/skia/docs/examples/Point_002.cpp +FILE: ../../../third_party/skia/docs/examples/Point_003.cpp +FILE: ../../../third_party/skia/docs/examples/Point_004.cpp +FILE: ../../../third_party/skia/docs/examples/Point_005.cpp +FILE: ../../../third_party/skia/docs/examples/Point_006.cpp +FILE: ../../../third_party/skia/docs/examples/Point_007.cpp +FILE: ../../../third_party/skia/docs/examples/Point_008.cpp +FILE: ../../../third_party/skia/docs/examples/Point_009.cpp +FILE: ../../../third_party/skia/docs/examples/Point_010.cpp +FILE: ../../../third_party/skia/docs/examples/Point_011.cpp +FILE: ../../../third_party/skia/docs/examples/Point_012.cpp +FILE: ../../../third_party/skia/docs/examples/Point_013.cpp +FILE: ../../../third_party/skia/docs/examples/Point_014.cpp +FILE: ../../../third_party/skia/docs/examples/Point_015.cpp +FILE: ../../../third_party/skia/docs/examples/Point_016.cpp +FILE: ../../../third_party/skia/docs/examples/Point_017.cpp +FILE: ../../../third_party/skia/docs/examples/Point_018.cpp +FILE: ../../../third_party/skia/docs/examples/Point_019.cpp +FILE: ../../../third_party/skia/docs/examples/Point_020.cpp +FILE: ../../../third_party/skia/docs/examples/Point_021.cpp +FILE: ../../../third_party/skia/docs/examples/Point_022.cpp +FILE: ../../../third_party/skia/docs/examples/Point_023.cpp +FILE: ../../../third_party/skia/docs/examples/Point_024.cpp +FILE: ../../../third_party/skia/docs/examples/Point_025.cpp +FILE: ../../../third_party/skia/docs/examples/Point_026.cpp +FILE: ../../../third_party/skia/docs/examples/Point_027.cpp +FILE: ../../../third_party/skia/docs/examples/Point_028.cpp +FILE: ../../../third_party/skia/docs/examples/Point_029.cpp +FILE: ../../../third_party/skia/docs/examples/Point_030.cpp +FILE: ../../../third_party/skia/docs/examples/Point_031.cpp +FILE: ../../../third_party/skia/docs/examples/Point_032.cpp +FILE: ../../../third_party/skia/docs/examples/Point_033.cpp +FILE: ../../../third_party/skia/docs/examples/Point_034.cpp +FILE: ../../../third_party/skia/docs/examples/Point_035.cpp +FILE: ../../../third_party/skia/docs/examples/Point_036.cpp +FILE: ../../../third_party/skia/docs/examples/Point_037.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_000.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_001.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_002.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_003.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_004.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_005.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_006.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_007.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_008.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_009.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_010.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_011.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_012.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_013.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_014.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_015.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_016.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_017.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_018.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_019.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_020.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_021.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_022.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_023.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_024.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_025.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_026.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_027.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_028.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_029.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_030.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_031.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_032.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_033.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_034.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_035.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_036.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_037.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_038.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_039.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_040.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_041.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_042.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_043.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_044.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_000.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_001.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_002.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_003.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_004.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_005.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_006.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_007.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_008.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_009.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_010.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_011.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_012.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_013.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_014.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_015.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_016.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_017.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_018.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_019.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_020.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_021.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_022.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_023.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_024.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_025.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_026.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_027.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_028.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_029.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_030.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_031.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_032.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_033.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_034.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_035.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_036.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_037.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_038.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_039.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_040.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_041.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_042.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_043.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_044.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_045.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_046.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_047.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_048.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_049.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_050.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_051.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_052.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_053.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_054.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_055.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_056.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_057.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_058.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_059.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_060.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_061.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_062.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_063.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_064.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_065.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_066.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_067.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_068.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_069.cpp +FILE: ../../../third_party/skia/docs/examples/Region_000.cpp +FILE: ../../../third_party/skia/docs/examples/Region_001.cpp +FILE: ../../../third_party/skia/docs/examples/Region_002.cpp +FILE: ../../../third_party/skia/docs/examples/Region_003.cpp +FILE: ../../../third_party/skia/docs/examples/Region_004.cpp +FILE: ../../../third_party/skia/docs/examples/Region_005.cpp +FILE: ../../../third_party/skia/docs/examples/Region_006.cpp +FILE: ../../../third_party/skia/docs/examples/Region_007.cpp +FILE: ../../../third_party/skia/docs/examples/Region_008.cpp +FILE: ../../../third_party/skia/docs/examples/Region_009.cpp +FILE: ../../../third_party/skia/docs/examples/Region_010.cpp +FILE: ../../../third_party/skia/docs/examples/Region_011.cpp +FILE: ../../../third_party/skia/docs/examples/Region_012.cpp +FILE: ../../../third_party/skia/docs/examples/Region_013.cpp +FILE: ../../../third_party/skia/docs/examples/Region_014.cpp +FILE: ../../../third_party/skia/docs/examples/Region_015.cpp +FILE: ../../../third_party/skia/docs/examples/Region_016.cpp +FILE: ../../../third_party/skia/docs/examples/Region_017.cpp +FILE: ../../../third_party/skia/docs/examples/Region_018.cpp +FILE: ../../../third_party/skia/docs/examples/Region_019.cpp +FILE: ../../../third_party/skia/docs/examples/Region_020.cpp +FILE: ../../../third_party/skia/docs/examples/Region_021.cpp +FILE: ../../../third_party/skia/docs/examples/Region_022.cpp +FILE: ../../../third_party/skia/docs/examples/Region_023.cpp +FILE: ../../../third_party/skia/docs/examples/Region_024.cpp +FILE: ../../../third_party/skia/docs/examples/Region_025.cpp +FILE: ../../../third_party/skia/docs/examples/Region_026.cpp +FILE: ../../../third_party/skia/docs/examples/Region_027.cpp +FILE: ../../../third_party/skia/docs/examples/Region_028.cpp +FILE: ../../../third_party/skia/docs/examples/Region_029.cpp +FILE: ../../../third_party/skia/docs/examples/Region_030.cpp +FILE: ../../../third_party/skia/docs/examples/Region_031.cpp +FILE: ../../../third_party/skia/docs/examples/Region_032.cpp +FILE: ../../../third_party/skia/docs/examples/Region_033.cpp +FILE: ../../../third_party/skia/docs/examples/Region_034.cpp +FILE: ../../../third_party/skia/docs/examples/Region_035.cpp +FILE: ../../../third_party/skia/docs/examples/Region_036.cpp +FILE: ../../../third_party/skia/docs/examples/Region_037.cpp +FILE: ../../../third_party/skia/docs/examples/Region_038.cpp +FILE: ../../../third_party/skia/docs/examples/Region_039.cpp +FILE: ../../../third_party/skia/docs/examples/Region_040.cpp +FILE: ../../../third_party/skia/docs/examples/Region_041.cpp +FILE: ../../../third_party/skia/docs/examples/Region_042.cpp +FILE: ../../../third_party/skia/docs/examples/Region_043.cpp +FILE: ../../../third_party/skia/docs/examples/Region_044.cpp +FILE: ../../../third_party/skia/docs/examples/Region_045.cpp +FILE: ../../../third_party/skia/docs/examples/Region_046.cpp +FILE: ../../../third_party/skia/docs/examples/Region_047.cpp +FILE: ../../../third_party/skia/docs/examples/Region_048.cpp +FILE: ../../../third_party/skia/docs/examples/Region_049.cpp +FILE: ../../../third_party/skia/docs/examples/Region_050.cpp +FILE: ../../../third_party/skia/docs/examples/Region_051.cpp +FILE: ../../../third_party/skia/docs/examples/Region_052.cpp +FILE: ../../../third_party/skia/docs/examples/Region_053.cpp +FILE: ../../../third_party/skia/docs/examples/Region_054.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_000.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_001.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_002.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_003.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_004.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_005.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_006.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_007.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_008.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_009.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_010.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_011.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_012.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_013.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_014.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_015.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_016.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_017.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_018.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_019.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_020.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_021.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_022.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_023.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_024.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_025.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_026.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_027.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_028.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_000.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_001.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_002.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_003.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_004.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_000.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_001.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_002.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_003.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_004.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_005.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_006.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_007.cpp +FILE: ../../../third_party/skia/gm/crbug_918512.cpp +---------------------------------------------------------------------------------------------------- +Copyright 2019 Google LLC. + +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/experimental/wasm-skp-debugger/debugger_bindings.cpp + ../../../third_party/skia/LICENSE @@ -4985,41 +6148,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/gm/crbug_918512.cpp + ../../../third_party/skia/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../third_party/skia/gm/crbug_918512.cpp ----------------------------------------------------------------------------------------------------- -Copyright 2019 Google LLC. - -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/include/config/SkUserConfig.h + ../../../third_party/skia/LICENSE From 0e0e0a98f5111ebf4032ef25eaf568f19867ecf1 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 15 Mar 2019 16:04:11 -0400 Subject: [PATCH 0460/1117] Roll src/third_party/skia 46f5ee156155..49ea3194535c (8 commits) (#8179) https://skia.googlesource.com/skia.git/%2Blog/46f5ee156155..49ea3194535c git log 46f5ee1561558857a1c669b43b71ca84f6ba6f22..49ea3194535c1783554149aab1d17f931512497e --date=short --no-merges --format=%ad %ae %s 2019-03-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader f3b57974620d..1e6a9898b73b (1 commits) 2019-02-26 halcanary@google.com GN: split out skia_*_public from skia_*_sources 2019-03-15 robertphillips@google.com Reduce work done by GrYUVtoRGBEffect for kIdentity_SkYUVColorSpace 2019-03-15 halcanary@google.com Revert "Compile all fiddle examples locally" 2019-03-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 36411219ff2b..f3b57974620d (3 commits) 2019-03-15 brianosman@google.com Standardize naming on CoverageAsAlpha (rather than AlphaAsCoverage) 2019-03-08 bsalomon@google.com Revert "Revert "Distinguish between "flushed" and "finished" idle state callbacks on GrTexture."" 2019-03-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader e37ce613d1c7..36411219ff2b (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 1199 +----------------------------- 2 files changed, 37 insertions(+), 1164 deletions(-) diff --git a/DEPS b/DEPS index c304f870ff095..ac0eaddc36797 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': '46f5ee1561558857a1c669b43b71ca84f6ba6f22', + 'skia_revision': '49ea3194535c1783554149aab1d17f931512497e', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 92e606ef6f905..aead963c45d9f 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: bd6c6df433f7f05bc56ed2578837d560 +Signature: f4dfa9d74e47ae57a6f9aa3dac650510 UNUSED LICENSES: @@ -4649,1168 +4649,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/docs/examples/AutoCanvasRestore_000.cpp + ../../../third_party/skia/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../third_party/skia/docs/examples/AutoCanvasRestore_000.cpp -FILE: ../../../third_party/skia/docs/examples/AutoCanvasRestore_001.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_000.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_001.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_002.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_003.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_004.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_005.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_006.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_007.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_008.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_009.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_010.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_011.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_012.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_013.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_014.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_015.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_016.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_017.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_018.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_019.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_020.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_021.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_022.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_023.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_024.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_025.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_026.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_027.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_028.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_029.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_030.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_031.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_032.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_033.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_034.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_035.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_036.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_037.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_038.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_039.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_040.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_041.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_042.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_043.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_044.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_045.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_046.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_047.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_048.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_049.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_050.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_051.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_052.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_053.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_054.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_055.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_056.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_057.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_058.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_059.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_060.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_061.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_062.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_063.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_064.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_065.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_066.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_067.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_068.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_069.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_070.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_071.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_072.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_073.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_074.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_075.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_076.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_077.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_000.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_001.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_002.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_003.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_004.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_005.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_006.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_007.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_008.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_009.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_010.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_011.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_012.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_013.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_014.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_015.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_016.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_017.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_018.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_019.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_020.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_021.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_022.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_023.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_024.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_025.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_026.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_027.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_028.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_029.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_000.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_001.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_002.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_003.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_004.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_005.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_006.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_008.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_009.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_010.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_011.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_012.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_013.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_014.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_015.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_016.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_017.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_018.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_019.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_020.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_021.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_022.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_023.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_024.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_025.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_026.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_027.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_028.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_029.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_030.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_031.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_032.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_033.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_034.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_035.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_036.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_037.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_038.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_039.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_040.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_041.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_042.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_043.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_044.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_045.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_046.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_047.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_048.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_049.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_050.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_051.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_052.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_053.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_054.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_055.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_056.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_057.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_058.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_059.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_060.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_061.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_062.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_063.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_064.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_065.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_066.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_067.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_068.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_069.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_070.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_071.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_072.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_073.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_074.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_075.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_076.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_077.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_078.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_079.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_080.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_081.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_082.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_083.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_084.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_085.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_086.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_087.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_088.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_089.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_090.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_091.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_092.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_093.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_094.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_095.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_096.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_097.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_098.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_099.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_100.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_101.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_102.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_103.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_104.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_105.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_106.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_107.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_108.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_109.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_110.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_111.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_112.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_113.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_114.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_115.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_116.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_117.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_118.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_119.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_120.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_121.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_122.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_123.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_124.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_125.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_126.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_127.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_128.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_129.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_130.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_131.cpp -FILE: ../../../third_party/skia/docs/examples/Color4f_000.cpp -FILE: ../../../third_party/skia/docs/examples/Color4f_001.cpp -FILE: ../../../third_party/skia/docs/examples/Color4f_002.cpp -FILE: ../../../third_party/skia/docs/examples/Color4f_003.cpp -FILE: ../../../third_party/skia/docs/examples/Color4f_004.cpp -FILE: ../../../third_party/skia/docs/examples/Color4f_005.cpp -FILE: ../../../third_party/skia/docs/examples/Color_000.cpp -FILE: ../../../third_party/skia/docs/examples/Color_001.cpp -FILE: ../../../third_party/skia/docs/examples/Color_002.cpp -FILE: ../../../third_party/skia/docs/examples/Color_003.cpp -FILE: ../../../third_party/skia/docs/examples/Color_004.cpp -FILE: ../../../third_party/skia/docs/examples/Color_005.cpp -FILE: ../../../third_party/skia/docs/examples/Color_006.cpp -FILE: ../../../third_party/skia/docs/examples/Color_007.cpp -FILE: ../../../third_party/skia/docs/examples/Color_008.cpp -FILE: ../../../third_party/skia/docs/examples/Color_009.cpp -FILE: ../../../third_party/skia/docs/examples/Color_010.cpp -FILE: ../../../third_party/skia/docs/examples/Color_011.cpp -FILE: ../../../third_party/skia/docs/examples/Color_012.cpp -FILE: ../../../third_party/skia/docs/examples/Color_013.cpp -FILE: ../../../third_party/skia/docs/examples/Color_014.cpp -FILE: ../../../third_party/skia/docs/examples/Color_015.cpp -FILE: ../../../third_party/skia/docs/examples/Color_016.cpp -FILE: ../../../third_party/skia/docs/examples/Color_017.cpp -FILE: ../../../third_party/skia/docs/examples/Color_018.cpp -FILE: ../../../third_party/skia/docs/examples/Font_000.cpp -FILE: ../../../third_party/skia/docs/examples/Font_001.cpp -FILE: ../../../third_party/skia/docs/examples/Font_002.cpp -FILE: ../../../third_party/skia/docs/examples/Font_003.cpp -FILE: ../../../third_party/skia/docs/examples/Font_004.cpp -FILE: ../../../third_party/skia/docs/examples/Font_005.cpp -FILE: ../../../third_party/skia/docs/examples/Font_006.cpp -FILE: ../../../third_party/skia/docs/examples/Font_007.cpp -FILE: ../../../third_party/skia/docs/examples/Font_008.cpp -FILE: ../../../third_party/skia/docs/examples/Font_009.cpp -FILE: ../../../third_party/skia/docs/examples/Font_010.cpp -FILE: ../../../third_party/skia/docs/examples/Font_011.cpp -FILE: ../../../third_party/skia/docs/examples/Font_012.cpp -FILE: ../../../third_party/skia/docs/examples/Font_013.cpp -FILE: ../../../third_party/skia/docs/examples/Font_014.cpp -FILE: ../../../third_party/skia/docs/examples/Font_015.cpp -FILE: ../../../third_party/skia/docs/examples/Font_016.cpp -FILE: ../../../third_party/skia/docs/examples/Font_017.cpp -FILE: ../../../third_party/skia/docs/examples/Font_018.cpp -FILE: ../../../third_party/skia/docs/examples/Font_019.cpp -FILE: ../../../third_party/skia/docs/examples/Font_020.cpp -FILE: ../../../third_party/skia/docs/examples/Font_021.cpp -FILE: ../../../third_party/skia/docs/examples/Font_022.cpp -FILE: ../../../third_party/skia/docs/examples/Font_023.cpp -FILE: ../../../third_party/skia/docs/examples/Font_024.cpp -FILE: ../../../third_party/skia/docs/examples/Font_025.cpp -FILE: ../../../third_party/skia/docs/examples/Font_026.cpp -FILE: ../../../third_party/skia/docs/examples/Font_027.cpp -FILE: ../../../third_party/skia/docs/examples/Font_028.cpp -FILE: ../../../third_party/skia/docs/examples/Font_029.cpp -FILE: ../../../third_party/skia/docs/examples/Font_030.cpp -FILE: ../../../third_party/skia/docs/examples/Font_031.cpp -FILE: ../../../third_party/skia/docs/examples/Font_032.cpp -FILE: ../../../third_party/skia/docs/examples/Font_033.cpp -FILE: ../../../third_party/skia/docs/examples/Font_034.cpp -FILE: ../../../third_party/skia/docs/examples/Font_035.cpp -FILE: ../../../third_party/skia/docs/examples/Font_036.cpp -FILE: ../../../third_party/skia/docs/examples/Font_037.cpp -FILE: ../../../third_party/skia/docs/examples/Font_038.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_000.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_001.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_002.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_003.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_004.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_005.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_006.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_007.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_008.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_009.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_010.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_011.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_012.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_000.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_001.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_002.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_003.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_004.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_005.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_006.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_007.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_008.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_009.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_010.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_011.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_012.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_013.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_014.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_015.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_016.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_017.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_018.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_019.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_020.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_021.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_022.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_023.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_024.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_025.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_026.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_027.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_028.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_029.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_030.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_031.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_032.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_033.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_034.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_035.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_036.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_037.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_038.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_039.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_040.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_041.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_042.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_043.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_044.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_045.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_046.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_047.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_048.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_049.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_000.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_001.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_002.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_003.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_004.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_005.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_006.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_007.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_008.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_009.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_010.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_011.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_012.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_013.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_014.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_015.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_016.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_017.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_018.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_019.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_020.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_021.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_022.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_023.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_024.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_025.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_026.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_027.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_028.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_029.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_030.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_031.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_032.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_033.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_034.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_035.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_036.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_037.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_038.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_039.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_040.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_041.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_042.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_043.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_044.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_045.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_046.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_047.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_048.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_049.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_050.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_051.cpp -FILE: ../../../third_party/skia/docs/examples/Image_000.cpp -FILE: ../../../third_party/skia/docs/examples/Image_001.cpp -FILE: ../../../third_party/skia/docs/examples/Image_002.cpp -FILE: ../../../third_party/skia/docs/examples/Image_003.cpp -FILE: ../../../third_party/skia/docs/examples/Image_004.cpp -FILE: ../../../third_party/skia/docs/examples/Image_005.cpp -FILE: ../../../third_party/skia/docs/examples/Image_006.cpp -FILE: ../../../third_party/skia/docs/examples/Image_007.cpp -FILE: ../../../third_party/skia/docs/examples/Image_008.cpp -FILE: ../../../third_party/skia/docs/examples/Image_009.cpp -FILE: ../../../third_party/skia/docs/examples/Image_010.cpp -FILE: ../../../third_party/skia/docs/examples/Image_011.cpp -FILE: ../../../third_party/skia/docs/examples/Image_012.cpp -FILE: ../../../third_party/skia/docs/examples/Image_013.cpp -FILE: ../../../third_party/skia/docs/examples/Image_014.cpp -FILE: ../../../third_party/skia/docs/examples/Image_015.cpp -FILE: ../../../third_party/skia/docs/examples/Image_016.cpp -FILE: ../../../third_party/skia/docs/examples/Image_017.cpp -FILE: ../../../third_party/skia/docs/examples/Image_018.cpp -FILE: ../../../third_party/skia/docs/examples/Image_019.cpp -FILE: ../../../third_party/skia/docs/examples/Image_020.cpp -FILE: ../../../third_party/skia/docs/examples/Image_021.cpp -FILE: ../../../third_party/skia/docs/examples/Image_022.cpp -FILE: ../../../third_party/skia/docs/examples/Image_023.cpp -FILE: ../../../third_party/skia/docs/examples/Image_024.cpp -FILE: ../../../third_party/skia/docs/examples/Image_025.cpp -FILE: ../../../third_party/skia/docs/examples/Image_026.cpp -FILE: ../../../third_party/skia/docs/examples/Image_027.cpp -FILE: ../../../third_party/skia/docs/examples/Image_028.cpp -FILE: ../../../third_party/skia/docs/examples/Image_029.cpp -FILE: ../../../third_party/skia/docs/examples/Image_030.cpp -FILE: ../../../third_party/skia/docs/examples/Image_031.cpp -FILE: ../../../third_party/skia/docs/examples/Image_032.cpp -FILE: ../../../third_party/skia/docs/examples/Image_033.cpp -FILE: ../../../third_party/skia/docs/examples/Image_034.cpp -FILE: ../../../third_party/skia/docs/examples/Image_035.cpp -FILE: ../../../third_party/skia/docs/examples/Image_036.cpp -FILE: ../../../third_party/skia/docs/examples/Image_037.cpp -FILE: ../../../third_party/skia/docs/examples/Image_038.cpp -FILE: ../../../third_party/skia/docs/examples/Image_039.cpp -FILE: ../../../third_party/skia/docs/examples/Image_040.cpp -FILE: ../../../third_party/skia/docs/examples/Image_041.cpp -FILE: ../../../third_party/skia/docs/examples/Image_042.cpp -FILE: ../../../third_party/skia/docs/examples/Image_043.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_000.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_001.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_002.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_003.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_004.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_005.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_006.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_007.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_008.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_009.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_010.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_011.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_012.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_013.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_014.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_015.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_016.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_017.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_018.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_019.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_020.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_021.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_022.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_023.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_024.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_025.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_026.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_027.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_028.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_029.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_030.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_031.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_032.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_033.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_034.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_035.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_036.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_037.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_038.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_039.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_040.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_041.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_042.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_043.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_044.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_045.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_046.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_047.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_048.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_049.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_050.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_051.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_052.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_053.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_054.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_055.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_056.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_057.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_058.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_059.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_060.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_061.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_062.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_063.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_064.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_065.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_066.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_067.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_068.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_069.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_070.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_071.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_072.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_073.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_074.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_075.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_076.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_077.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_078.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_079.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_080.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_081.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_082.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_083.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_084.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_085.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_086.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_087.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_088.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_089.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_090.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_091.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_092.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_093.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_094.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_095.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_096.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_097.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_098.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_099.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_100.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_101.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_102.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_103.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_104.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_105.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_106.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_107.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_000.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_001.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_002.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_003.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_004.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_005.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_006.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_007.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_008.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_009.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_010.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_011.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_012.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_013.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_014.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_015.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_016.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_017.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_018.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_019.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_020.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_021.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_022.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_023.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_024.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_025.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_026.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_027.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_028.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_029.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_030.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_031.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_032.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_033.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_034.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_035.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_036.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_037.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_038.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_039.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_040.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_041.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_042.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_043.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_044.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_045.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_046.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_047.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_048.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_049.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_050.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_051.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_052.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_053.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_054.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_055.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_056.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_057.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_058.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_059.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_060.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_061.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_062.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_063.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_064.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_065.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_066.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_067.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_068.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_069.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_070.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_071.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_072.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_073.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_074.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_075.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_076.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_077.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_078.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_079.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_080.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_081.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_082.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_083.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_084.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_085.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_086.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_087.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_088.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_089.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_090.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_091.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_092.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_093.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_094.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_095.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_096.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_097.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_098.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_099.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_100.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_101.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_102.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_103.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_104.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_105.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_106.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_107.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_108.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_109.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_110.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_111.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_112.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_113.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_114.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_115.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_116.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_117.cpp -FILE: ../../../third_party/skia/docs/examples/Path_000.cpp -FILE: ../../../third_party/skia/docs/examples/Path_001.cpp -FILE: ../../../third_party/skia/docs/examples/Path_002.cpp -FILE: ../../../third_party/skia/docs/examples/Path_003.cpp -FILE: ../../../third_party/skia/docs/examples/Path_004.cpp -FILE: ../../../third_party/skia/docs/examples/Path_005.cpp -FILE: ../../../third_party/skia/docs/examples/Path_006.cpp -FILE: ../../../third_party/skia/docs/examples/Path_007.cpp -FILE: ../../../third_party/skia/docs/examples/Path_008.cpp -FILE: ../../../third_party/skia/docs/examples/Path_009.cpp -FILE: ../../../third_party/skia/docs/examples/Path_010.cpp -FILE: ../../../third_party/skia/docs/examples/Path_011.cpp -FILE: ../../../third_party/skia/docs/examples/Path_012.cpp -FILE: ../../../third_party/skia/docs/examples/Path_013.cpp -FILE: ../../../third_party/skia/docs/examples/Path_014.cpp -FILE: ../../../third_party/skia/docs/examples/Path_015.cpp -FILE: ../../../third_party/skia/docs/examples/Path_016.cpp -FILE: ../../../third_party/skia/docs/examples/Path_017.cpp -FILE: ../../../third_party/skia/docs/examples/Path_018.cpp -FILE: ../../../third_party/skia/docs/examples/Path_019.cpp -FILE: ../../../third_party/skia/docs/examples/Path_020.cpp -FILE: ../../../third_party/skia/docs/examples/Path_021.cpp -FILE: ../../../third_party/skia/docs/examples/Path_022.cpp -FILE: ../../../third_party/skia/docs/examples/Path_023.cpp -FILE: ../../../third_party/skia/docs/examples/Path_024.cpp -FILE: ../../../third_party/skia/docs/examples/Path_025.cpp -FILE: ../../../third_party/skia/docs/examples/Path_026.cpp -FILE: ../../../third_party/skia/docs/examples/Path_027.cpp -FILE: ../../../third_party/skia/docs/examples/Path_028.cpp -FILE: ../../../third_party/skia/docs/examples/Path_029.cpp -FILE: ../../../third_party/skia/docs/examples/Path_030.cpp -FILE: ../../../third_party/skia/docs/examples/Path_031.cpp -FILE: ../../../third_party/skia/docs/examples/Path_032.cpp -FILE: ../../../third_party/skia/docs/examples/Path_033.cpp -FILE: ../../../third_party/skia/docs/examples/Path_034.cpp -FILE: ../../../third_party/skia/docs/examples/Path_035.cpp -FILE: ../../../third_party/skia/docs/examples/Path_036.cpp -FILE: ../../../third_party/skia/docs/examples/Path_037.cpp -FILE: ../../../third_party/skia/docs/examples/Path_038.cpp -FILE: ../../../third_party/skia/docs/examples/Path_039.cpp -FILE: ../../../third_party/skia/docs/examples/Path_040.cpp -FILE: ../../../third_party/skia/docs/examples/Path_041.cpp -FILE: ../../../third_party/skia/docs/examples/Path_042.cpp -FILE: ../../../third_party/skia/docs/examples/Path_043.cpp -FILE: ../../../third_party/skia/docs/examples/Path_044.cpp -FILE: ../../../third_party/skia/docs/examples/Path_045.cpp -FILE: ../../../third_party/skia/docs/examples/Path_046.cpp -FILE: ../../../third_party/skia/docs/examples/Path_047.cpp -FILE: ../../../third_party/skia/docs/examples/Path_048.cpp -FILE: ../../../third_party/skia/docs/examples/Path_049.cpp -FILE: ../../../third_party/skia/docs/examples/Path_050.cpp -FILE: ../../../third_party/skia/docs/examples/Path_051.cpp -FILE: ../../../third_party/skia/docs/examples/Path_052.cpp -FILE: ../../../third_party/skia/docs/examples/Path_053.cpp -FILE: ../../../third_party/skia/docs/examples/Path_054.cpp -FILE: ../../../third_party/skia/docs/examples/Path_055.cpp -FILE: ../../../third_party/skia/docs/examples/Path_056.cpp -FILE: ../../../third_party/skia/docs/examples/Path_057.cpp -FILE: ../../../third_party/skia/docs/examples/Path_058.cpp -FILE: ../../../third_party/skia/docs/examples/Path_059.cpp -FILE: ../../../third_party/skia/docs/examples/Path_060.cpp -FILE: ../../../third_party/skia/docs/examples/Path_061.cpp -FILE: ../../../third_party/skia/docs/examples/Path_062.cpp -FILE: ../../../third_party/skia/docs/examples/Path_063.cpp -FILE: ../../../third_party/skia/docs/examples/Path_064.cpp -FILE: ../../../third_party/skia/docs/examples/Path_065.cpp -FILE: ../../../third_party/skia/docs/examples/Path_066.cpp -FILE: ../../../third_party/skia/docs/examples/Path_067.cpp -FILE: ../../../third_party/skia/docs/examples/Path_068.cpp -FILE: ../../../third_party/skia/docs/examples/Path_069.cpp -FILE: ../../../third_party/skia/docs/examples/Path_070.cpp -FILE: ../../../third_party/skia/docs/examples/Path_071.cpp -FILE: ../../../third_party/skia/docs/examples/Path_072.cpp -FILE: ../../../third_party/skia/docs/examples/Path_073.cpp -FILE: ../../../third_party/skia/docs/examples/Path_074.cpp -FILE: ../../../third_party/skia/docs/examples/Path_075.cpp -FILE: ../../../third_party/skia/docs/examples/Path_076.cpp -FILE: ../../../third_party/skia/docs/examples/Path_077.cpp -FILE: ../../../third_party/skia/docs/examples/Path_078.cpp -FILE: ../../../third_party/skia/docs/examples/Path_079.cpp -FILE: ../../../third_party/skia/docs/examples/Path_080.cpp -FILE: ../../../third_party/skia/docs/examples/Path_081.cpp -FILE: ../../../third_party/skia/docs/examples/Path_082.cpp -FILE: ../../../third_party/skia/docs/examples/Path_083.cpp -FILE: ../../../third_party/skia/docs/examples/Path_084.cpp -FILE: ../../../third_party/skia/docs/examples/Path_085.cpp -FILE: ../../../third_party/skia/docs/examples/Path_086.cpp -FILE: ../../../third_party/skia/docs/examples/Path_087.cpp -FILE: ../../../third_party/skia/docs/examples/Path_088.cpp -FILE: ../../../third_party/skia/docs/examples/Path_089.cpp -FILE: ../../../third_party/skia/docs/examples/Path_090.cpp -FILE: ../../../third_party/skia/docs/examples/Path_091.cpp -FILE: ../../../third_party/skia/docs/examples/Path_092.cpp -FILE: ../../../third_party/skia/docs/examples/Path_093.cpp -FILE: ../../../third_party/skia/docs/examples/Path_094.cpp -FILE: ../../../third_party/skia/docs/examples/Path_095.cpp -FILE: ../../../third_party/skia/docs/examples/Path_096.cpp -FILE: ../../../third_party/skia/docs/examples/Path_097.cpp -FILE: ../../../third_party/skia/docs/examples/Path_098.cpp -FILE: ../../../third_party/skia/docs/examples/Path_099.cpp -FILE: ../../../third_party/skia/docs/examples/Path_100.cpp -FILE: ../../../third_party/skia/docs/examples/Path_101.cpp -FILE: ../../../third_party/skia/docs/examples/Path_102.cpp -FILE: ../../../third_party/skia/docs/examples/Path_103.cpp -FILE: ../../../third_party/skia/docs/examples/Path_104.cpp -FILE: ../../../third_party/skia/docs/examples/Path_105.cpp -FILE: ../../../third_party/skia/docs/examples/Path_106.cpp -FILE: ../../../third_party/skia/docs/examples/Path_107.cpp -FILE: ../../../third_party/skia/docs/examples/Path_108.cpp -FILE: ../../../third_party/skia/docs/examples/Path_109.cpp -FILE: ../../../third_party/skia/docs/examples/Path_110.cpp -FILE: ../../../third_party/skia/docs/examples/Path_111.cpp -FILE: ../../../third_party/skia/docs/examples/Path_112.cpp -FILE: ../../../third_party/skia/docs/examples/Path_113.cpp -FILE: ../../../third_party/skia/docs/examples/Path_114.cpp -FILE: ../../../third_party/skia/docs/examples/Path_115.cpp -FILE: ../../../third_party/skia/docs/examples/Path_116.cpp -FILE: ../../../third_party/skia/docs/examples/Path_117.cpp -FILE: ../../../third_party/skia/docs/examples/Path_118.cpp -FILE: ../../../third_party/skia/docs/examples/Path_119.cpp -FILE: ../../../third_party/skia/docs/examples/Path_120.cpp -FILE: ../../../third_party/skia/docs/examples/Path_121.cpp -FILE: ../../../third_party/skia/docs/examples/Path_122.cpp -FILE: ../../../third_party/skia/docs/examples/Path_123.cpp -FILE: ../../../third_party/skia/docs/examples/Path_124.cpp -FILE: ../../../third_party/skia/docs/examples/Path_125.cpp -FILE: ../../../third_party/skia/docs/examples/Path_126.cpp -FILE: ../../../third_party/skia/docs/examples/Path_127.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_000.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_001.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_002.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_003.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_004.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_005.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_006.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_007.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_008.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_009.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_010.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_011.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_000.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_001.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_002.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_003.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_004.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_005.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_006.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_007.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_008.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_009.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_010.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_011.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_012.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_013.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_014.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_015.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_016.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_017.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_018.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_019.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_020.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_021.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_022.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_023.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_024.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_025.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_026.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_027.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_028.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_029.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_030.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_031.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_032.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_033.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_034.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_035.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_036.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_037.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_038.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_039.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_040.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_041.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_042.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_043.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_044.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_045.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_046.cpp -FILE: ../../../third_party/skia/docs/examples/Point_000.cpp -FILE: ../../../third_party/skia/docs/examples/Point_001.cpp -FILE: ../../../third_party/skia/docs/examples/Point_002.cpp -FILE: ../../../third_party/skia/docs/examples/Point_003.cpp -FILE: ../../../third_party/skia/docs/examples/Point_004.cpp -FILE: ../../../third_party/skia/docs/examples/Point_005.cpp -FILE: ../../../third_party/skia/docs/examples/Point_006.cpp -FILE: ../../../third_party/skia/docs/examples/Point_007.cpp -FILE: ../../../third_party/skia/docs/examples/Point_008.cpp -FILE: ../../../third_party/skia/docs/examples/Point_009.cpp -FILE: ../../../third_party/skia/docs/examples/Point_010.cpp -FILE: ../../../third_party/skia/docs/examples/Point_011.cpp -FILE: ../../../third_party/skia/docs/examples/Point_012.cpp -FILE: ../../../third_party/skia/docs/examples/Point_013.cpp -FILE: ../../../third_party/skia/docs/examples/Point_014.cpp -FILE: ../../../third_party/skia/docs/examples/Point_015.cpp -FILE: ../../../third_party/skia/docs/examples/Point_016.cpp -FILE: ../../../third_party/skia/docs/examples/Point_017.cpp -FILE: ../../../third_party/skia/docs/examples/Point_018.cpp -FILE: ../../../third_party/skia/docs/examples/Point_019.cpp -FILE: ../../../third_party/skia/docs/examples/Point_020.cpp -FILE: ../../../third_party/skia/docs/examples/Point_021.cpp -FILE: ../../../third_party/skia/docs/examples/Point_022.cpp -FILE: ../../../third_party/skia/docs/examples/Point_023.cpp -FILE: ../../../third_party/skia/docs/examples/Point_024.cpp -FILE: ../../../third_party/skia/docs/examples/Point_025.cpp -FILE: ../../../third_party/skia/docs/examples/Point_026.cpp -FILE: ../../../third_party/skia/docs/examples/Point_027.cpp -FILE: ../../../third_party/skia/docs/examples/Point_028.cpp -FILE: ../../../third_party/skia/docs/examples/Point_029.cpp -FILE: ../../../third_party/skia/docs/examples/Point_030.cpp -FILE: ../../../third_party/skia/docs/examples/Point_031.cpp -FILE: ../../../third_party/skia/docs/examples/Point_032.cpp -FILE: ../../../third_party/skia/docs/examples/Point_033.cpp -FILE: ../../../third_party/skia/docs/examples/Point_034.cpp -FILE: ../../../third_party/skia/docs/examples/Point_035.cpp -FILE: ../../../third_party/skia/docs/examples/Point_036.cpp -FILE: ../../../third_party/skia/docs/examples/Point_037.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_000.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_001.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_002.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_003.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_004.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_005.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_006.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_007.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_008.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_009.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_010.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_011.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_012.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_013.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_014.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_015.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_016.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_017.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_018.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_019.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_020.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_021.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_022.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_023.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_024.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_025.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_026.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_027.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_028.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_029.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_030.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_031.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_032.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_033.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_034.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_035.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_036.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_037.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_038.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_039.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_040.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_041.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_042.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_043.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_044.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_000.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_001.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_002.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_003.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_004.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_005.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_006.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_007.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_008.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_009.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_010.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_011.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_012.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_013.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_014.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_015.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_016.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_017.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_018.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_019.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_020.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_021.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_022.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_023.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_024.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_025.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_026.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_027.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_028.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_029.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_030.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_031.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_032.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_033.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_034.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_035.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_036.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_037.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_038.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_039.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_040.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_041.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_042.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_043.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_044.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_045.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_046.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_047.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_048.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_049.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_050.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_051.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_052.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_053.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_054.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_055.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_056.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_057.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_058.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_059.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_060.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_061.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_062.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_063.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_064.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_065.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_066.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_067.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_068.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_069.cpp -FILE: ../../../third_party/skia/docs/examples/Region_000.cpp -FILE: ../../../third_party/skia/docs/examples/Region_001.cpp -FILE: ../../../third_party/skia/docs/examples/Region_002.cpp -FILE: ../../../third_party/skia/docs/examples/Region_003.cpp -FILE: ../../../third_party/skia/docs/examples/Region_004.cpp -FILE: ../../../third_party/skia/docs/examples/Region_005.cpp -FILE: ../../../third_party/skia/docs/examples/Region_006.cpp -FILE: ../../../third_party/skia/docs/examples/Region_007.cpp -FILE: ../../../third_party/skia/docs/examples/Region_008.cpp -FILE: ../../../third_party/skia/docs/examples/Region_009.cpp -FILE: ../../../third_party/skia/docs/examples/Region_010.cpp -FILE: ../../../third_party/skia/docs/examples/Region_011.cpp -FILE: ../../../third_party/skia/docs/examples/Region_012.cpp -FILE: ../../../third_party/skia/docs/examples/Region_013.cpp -FILE: ../../../third_party/skia/docs/examples/Region_014.cpp -FILE: ../../../third_party/skia/docs/examples/Region_015.cpp -FILE: ../../../third_party/skia/docs/examples/Region_016.cpp -FILE: ../../../third_party/skia/docs/examples/Region_017.cpp -FILE: ../../../third_party/skia/docs/examples/Region_018.cpp -FILE: ../../../third_party/skia/docs/examples/Region_019.cpp -FILE: ../../../third_party/skia/docs/examples/Region_020.cpp -FILE: ../../../third_party/skia/docs/examples/Region_021.cpp -FILE: ../../../third_party/skia/docs/examples/Region_022.cpp -FILE: ../../../third_party/skia/docs/examples/Region_023.cpp -FILE: ../../../third_party/skia/docs/examples/Region_024.cpp -FILE: ../../../third_party/skia/docs/examples/Region_025.cpp -FILE: ../../../third_party/skia/docs/examples/Region_026.cpp -FILE: ../../../third_party/skia/docs/examples/Region_027.cpp -FILE: ../../../third_party/skia/docs/examples/Region_028.cpp -FILE: ../../../third_party/skia/docs/examples/Region_029.cpp -FILE: ../../../third_party/skia/docs/examples/Region_030.cpp -FILE: ../../../third_party/skia/docs/examples/Region_031.cpp -FILE: ../../../third_party/skia/docs/examples/Region_032.cpp -FILE: ../../../third_party/skia/docs/examples/Region_033.cpp -FILE: ../../../third_party/skia/docs/examples/Region_034.cpp -FILE: ../../../third_party/skia/docs/examples/Region_035.cpp -FILE: ../../../third_party/skia/docs/examples/Region_036.cpp -FILE: ../../../third_party/skia/docs/examples/Region_037.cpp -FILE: ../../../third_party/skia/docs/examples/Region_038.cpp -FILE: ../../../third_party/skia/docs/examples/Region_039.cpp -FILE: ../../../third_party/skia/docs/examples/Region_040.cpp -FILE: ../../../third_party/skia/docs/examples/Region_041.cpp -FILE: ../../../third_party/skia/docs/examples/Region_042.cpp -FILE: ../../../third_party/skia/docs/examples/Region_043.cpp -FILE: ../../../third_party/skia/docs/examples/Region_044.cpp -FILE: ../../../third_party/skia/docs/examples/Region_045.cpp -FILE: ../../../third_party/skia/docs/examples/Region_046.cpp -FILE: ../../../third_party/skia/docs/examples/Region_047.cpp -FILE: ../../../third_party/skia/docs/examples/Region_048.cpp -FILE: ../../../third_party/skia/docs/examples/Region_049.cpp -FILE: ../../../third_party/skia/docs/examples/Region_050.cpp -FILE: ../../../third_party/skia/docs/examples/Region_051.cpp -FILE: ../../../third_party/skia/docs/examples/Region_052.cpp -FILE: ../../../third_party/skia/docs/examples/Region_053.cpp -FILE: ../../../third_party/skia/docs/examples/Region_054.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_000.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_001.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_002.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_003.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_004.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_005.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_006.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_007.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_008.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_009.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_010.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_011.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_012.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_013.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_014.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_015.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_016.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_017.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_018.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_019.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_020.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_021.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_022.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_023.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_024.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_025.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_026.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_027.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_028.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_000.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_001.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_002.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_003.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_004.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_000.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_001.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_002.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_003.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_004.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_005.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_006.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_007.cpp -FILE: ../../../third_party/skia/gm/crbug_918512.cpp ----------------------------------------------------------------------------------------------------- -Copyright 2019 Google LLC. - -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/experimental/wasm-skp-debugger/debugger_bindings.cpp + ../../../third_party/skia/LICENSE @@ -6148,6 +4986,41 @@ 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/gm/crbug_918512.cpp + ../../../third_party/skia/LICENSE +TYPE: LicenseType.bsd +FILE: ../../../third_party/skia/gm/crbug_918512.cpp +---------------------------------------------------------------------------------------------------- +Copyright 2019 Google LLC. + +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/include/config/SkUserConfig.h + ../../../third_party/skia/LICENSE From d92f9373014f3e62016033c38bf83173ed3e22bc Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Fri, 15 Mar 2019 13:13:44 -0700 Subject: [PATCH 0461/1117] Add flag to allow only building full sdk on release to speed up bots (#8080) --- tools/gn | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/gn b/tools/gn index 344d8475e5f96..4cb0fe099bf9f 100755 --- a/tools/gn +++ b/tools/gn @@ -234,9 +234,9 @@ def to_gn_args(args): if args.arm_float_abi: gn_args['arm_float_abi'] = args.arm_float_abi - # Switch flutter to full Dart SDK when building for the host system. - if args.target_os is None: - gn_args['dart_platform_sdk'] = False + # Whether to build all dart snapshots. + if args.full_dart_sdk: + gn_args['dart_platform_sdk'] = False return gn_args @@ -289,6 +289,9 @@ def parse_args(args): parser.add_argument('--out-dir', default='', type=str) + parser.add_argument('--full-dart-sdk', default=True, action='store_true', + help='include trained dart2js and dartdevc snapshots. Enable only on steps that create an sdk') + return parser.parse_args(args) def main(argv): From c033aa469685b865d185b39296cd502cfa0c18f0 Mon Sep 17 00:00:00 2001 From: "P.Y. Laligand" Date: Fri, 15 Mar 2019 13:58:25 -0700 Subject: [PATCH 0462/1117] Fix include of libzx. (#8181) --- flow/export_node.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow/export_node.h b/flow/export_node.h index 20be1e45f7bfa..50df904bc4116 100644 --- a/flow/export_node.h +++ b/flow/export_node.h @@ -7,7 +7,7 @@ #include -#include +#include #include "dart-pkg/zircon/sdk_ext/handle.h" #include "flutter/flow/scene_update_context.h" From 015c0246aebc6fc23f30004e3319b6d1e85a885a Mon Sep 17 00:00:00 2001 From: liyuqian Date: Fri, 15 Mar 2019 14:01:23 -0700 Subject: [PATCH 0463/1117] Fix log level typo from ERROR to INFO (#8180) The old typo is probably caused by https://github.com/flutter/flutter/issues/29320 which has just been fixed. TBR: chinmaygarde@google.com --- shell/common/persistent_cache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/common/persistent_cache.cc b/shell/common/persistent_cache.cc index e771ab502acb3..64d29f15c2b58 100644 --- a/shell/common/persistent_cache.cc +++ b/shell/common/persistent_cache.cc @@ -172,7 +172,7 @@ void PersistentCache::DumpSkp(const SkData& data) { auto ticks = fml::TimePoint::Now().ToEpochDelta().ToNanoseconds(); name_stream << "shader_dump_" << std::to_string(ticks) << ".skp"; std::string file_name = name_stream.str(); - FML_LOG(ERROR) << "Dumping " << file_name; + FML_LOG(INFO) << "Dumping " << file_name; auto mapping = std::make_unique( std::vector{data.bytes(), data.bytes() + data.size()}); PersistentCacheStore(GetWorkerTaskRunner(), cache_directory_, From 575d61f49910a6df7718b99723eecfc5902222b6 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 15 Mar 2019 21:18:11 -0400 Subject: [PATCH 0464/1117] Roll src/third_party/skia 49ea3194535c..d3cfbcae10eb (9 commits) (#8184) https://skia.googlesource.com/skia.git/%2Blog/49ea3194535c..d3cfbcae10eb git log 49ea3194535c1783554149aab1d17f931512497e..d3cfbcae10eb903841819cb6fbf0ad6e35f7f88a --date=short --no-merges --format=%ad %ae %s 2019-03-15 kjlubick@google.com [canvaskit] Add TextOnPath helper to TextBlob 2019-03-07 mtklein@google.com hash and encode rework, wip 2019-03-15 reed@google.com use load_f32_dst 2019-03-15 reed@google.com allow mixer to defer to a shader 2019-03-15 jvanverth@google.com Fix asserts in Metal tests. 2019-03-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 1e6a9898b73b..71673c81fb1e (8 commits) 2019-03-15 enne@chromium.org Enforce alignment in SkDescriptor deserialization 2019-03-15 benjaminwagner@google.com [infra] Update Win10 in Skolo. 2019-03-15 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index ac0eaddc36797..69982320f7193 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': '49ea3194535c1783554149aab1d17f931512497e', + 'skia_revision': 'd3cfbcae10eb903841819cb6fbf0ad6e35f7f88a', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index aead963c45d9f..c607fee655854 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f4dfa9d74e47ae57a6f9aa3dac650510 +Signature: f6b0590d46f66bd65f23d97a1d980916 UNUSED LICENSES: From 926e65531cab90dfff23c22b7b5028e0ddc36fac Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 16 Mar 2019 00:50:11 -0400 Subject: [PATCH 0465/1117] Roll src/third_party/skia d3cfbcae10eb..f34d0c79dc6c (2 commits) (#8186) https://skia.googlesource.com/skia.git/%2Blog/d3cfbcae10eb..f34d0c79dc6c git log d3cfbcae10eb903841819cb6fbf0ad6e35f7f88a..f34d0c79dc6cc5595f8452696bc9e88d27f34452 --date=short --no-merges --format=%ad %ae %s 2019-03-15 mtklein@google.com re-hash images once more artificially 2019-03-15 halcanary@google.com Revert "Revert "Compile all fiddle examples locally"" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 1199 +++++++++++++++++++++++++++++- 2 files changed, 1164 insertions(+), 37 deletions(-) diff --git a/DEPS b/DEPS index 69982320f7193..fffef129d7020 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': 'd3cfbcae10eb903841819cb6fbf0ad6e35f7f88a', + 'skia_revision': 'f34d0c79dc6cc5595f8452696bc9e88d27f34452', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index c607fee655854..d93b05557d55c 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f6b0590d46f66bd65f23d97a1d980916 +Signature: 6c5efbff1420dc3200e1c15a1406967f UNUSED LICENSES: @@ -4649,6 +4649,1168 @@ 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/docs/examples/AutoCanvasRestore_000.cpp + ../../../third_party/skia/LICENSE +TYPE: LicenseType.bsd +FILE: ../../../third_party/skia/docs/examples/AutoCanvasRestore_000.cpp +FILE: ../../../third_party/skia/docs/examples/AutoCanvasRestore_001.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_000.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_001.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_002.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_003.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_004.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_005.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_006.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_007.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_008.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_009.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_010.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_011.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_012.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_013.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_014.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_015.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_016.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_017.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_018.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_019.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_020.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_021.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_022.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_023.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_024.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_025.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_026.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_027.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_028.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_029.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_030.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_031.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_032.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_033.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_034.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_035.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_036.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_037.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_038.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_039.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_040.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_041.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_042.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_043.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_044.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_045.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_046.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_047.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_048.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_049.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_050.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_051.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_052.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_053.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_054.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_055.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_056.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_057.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_058.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_059.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_060.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_061.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_062.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_063.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_064.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_065.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_066.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_067.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_068.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_069.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_070.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_071.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_072.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_073.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_074.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_075.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_076.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_077.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_000.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_001.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_002.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_003.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_004.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_005.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_006.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_007.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_008.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_009.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_010.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_011.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_012.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_013.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_014.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_015.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_016.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_017.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_018.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_019.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_020.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_021.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_022.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_023.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_024.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_025.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_026.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_027.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_028.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_029.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_000.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_001.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_002.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_003.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_004.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_005.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_006.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_008.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_009.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_010.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_011.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_012.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_013.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_014.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_015.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_016.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_017.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_018.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_019.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_020.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_021.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_022.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_023.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_024.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_025.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_026.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_027.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_028.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_029.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_030.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_031.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_032.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_033.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_034.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_035.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_036.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_037.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_038.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_039.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_040.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_041.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_042.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_043.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_044.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_045.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_046.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_047.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_048.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_049.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_050.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_051.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_052.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_053.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_054.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_055.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_056.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_057.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_058.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_059.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_060.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_061.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_062.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_063.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_064.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_065.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_066.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_067.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_068.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_069.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_070.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_071.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_072.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_073.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_074.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_075.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_076.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_077.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_078.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_079.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_080.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_081.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_082.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_083.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_084.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_085.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_086.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_087.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_088.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_089.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_090.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_091.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_092.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_093.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_094.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_095.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_096.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_097.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_098.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_099.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_100.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_101.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_102.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_103.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_104.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_105.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_106.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_107.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_108.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_109.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_110.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_111.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_112.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_113.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_114.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_115.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_116.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_117.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_118.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_119.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_120.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_121.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_122.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_123.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_124.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_125.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_126.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_127.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_128.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_129.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_130.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_131.cpp +FILE: ../../../third_party/skia/docs/examples/Color4f_000.cpp +FILE: ../../../third_party/skia/docs/examples/Color4f_001.cpp +FILE: ../../../third_party/skia/docs/examples/Color4f_002.cpp +FILE: ../../../third_party/skia/docs/examples/Color4f_003.cpp +FILE: ../../../third_party/skia/docs/examples/Color4f_004.cpp +FILE: ../../../third_party/skia/docs/examples/Color4f_005.cpp +FILE: ../../../third_party/skia/docs/examples/Color_000.cpp +FILE: ../../../third_party/skia/docs/examples/Color_001.cpp +FILE: ../../../third_party/skia/docs/examples/Color_002.cpp +FILE: ../../../third_party/skia/docs/examples/Color_003.cpp +FILE: ../../../third_party/skia/docs/examples/Color_004.cpp +FILE: ../../../third_party/skia/docs/examples/Color_005.cpp +FILE: ../../../third_party/skia/docs/examples/Color_006.cpp +FILE: ../../../third_party/skia/docs/examples/Color_007.cpp +FILE: ../../../third_party/skia/docs/examples/Color_008.cpp +FILE: ../../../third_party/skia/docs/examples/Color_009.cpp +FILE: ../../../third_party/skia/docs/examples/Color_010.cpp +FILE: ../../../third_party/skia/docs/examples/Color_011.cpp +FILE: ../../../third_party/skia/docs/examples/Color_012.cpp +FILE: ../../../third_party/skia/docs/examples/Color_013.cpp +FILE: ../../../third_party/skia/docs/examples/Color_014.cpp +FILE: ../../../third_party/skia/docs/examples/Color_015.cpp +FILE: ../../../third_party/skia/docs/examples/Color_016.cpp +FILE: ../../../third_party/skia/docs/examples/Color_017.cpp +FILE: ../../../third_party/skia/docs/examples/Color_018.cpp +FILE: ../../../third_party/skia/docs/examples/Font_000.cpp +FILE: ../../../third_party/skia/docs/examples/Font_001.cpp +FILE: ../../../third_party/skia/docs/examples/Font_002.cpp +FILE: ../../../third_party/skia/docs/examples/Font_003.cpp +FILE: ../../../third_party/skia/docs/examples/Font_004.cpp +FILE: ../../../third_party/skia/docs/examples/Font_005.cpp +FILE: ../../../third_party/skia/docs/examples/Font_006.cpp +FILE: ../../../third_party/skia/docs/examples/Font_007.cpp +FILE: ../../../third_party/skia/docs/examples/Font_008.cpp +FILE: ../../../third_party/skia/docs/examples/Font_009.cpp +FILE: ../../../third_party/skia/docs/examples/Font_010.cpp +FILE: ../../../third_party/skia/docs/examples/Font_011.cpp +FILE: ../../../third_party/skia/docs/examples/Font_012.cpp +FILE: ../../../third_party/skia/docs/examples/Font_013.cpp +FILE: ../../../third_party/skia/docs/examples/Font_014.cpp +FILE: ../../../third_party/skia/docs/examples/Font_015.cpp +FILE: ../../../third_party/skia/docs/examples/Font_016.cpp +FILE: ../../../third_party/skia/docs/examples/Font_017.cpp +FILE: ../../../third_party/skia/docs/examples/Font_018.cpp +FILE: ../../../third_party/skia/docs/examples/Font_019.cpp +FILE: ../../../third_party/skia/docs/examples/Font_020.cpp +FILE: ../../../third_party/skia/docs/examples/Font_021.cpp +FILE: ../../../third_party/skia/docs/examples/Font_022.cpp +FILE: ../../../third_party/skia/docs/examples/Font_023.cpp +FILE: ../../../third_party/skia/docs/examples/Font_024.cpp +FILE: ../../../third_party/skia/docs/examples/Font_025.cpp +FILE: ../../../third_party/skia/docs/examples/Font_026.cpp +FILE: ../../../third_party/skia/docs/examples/Font_027.cpp +FILE: ../../../third_party/skia/docs/examples/Font_028.cpp +FILE: ../../../third_party/skia/docs/examples/Font_029.cpp +FILE: ../../../third_party/skia/docs/examples/Font_030.cpp +FILE: ../../../third_party/skia/docs/examples/Font_031.cpp +FILE: ../../../third_party/skia/docs/examples/Font_032.cpp +FILE: ../../../third_party/skia/docs/examples/Font_033.cpp +FILE: ../../../third_party/skia/docs/examples/Font_034.cpp +FILE: ../../../third_party/skia/docs/examples/Font_035.cpp +FILE: ../../../third_party/skia/docs/examples/Font_036.cpp +FILE: ../../../third_party/skia/docs/examples/Font_037.cpp +FILE: ../../../third_party/skia/docs/examples/Font_038.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_000.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_001.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_002.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_003.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_004.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_005.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_006.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_007.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_008.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_009.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_010.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_011.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_012.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_000.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_001.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_002.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_003.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_004.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_005.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_006.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_007.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_008.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_009.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_010.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_011.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_012.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_013.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_014.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_015.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_016.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_017.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_018.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_019.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_020.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_021.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_022.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_023.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_024.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_025.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_026.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_027.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_028.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_029.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_030.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_031.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_032.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_033.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_034.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_035.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_036.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_037.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_038.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_039.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_040.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_041.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_042.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_043.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_044.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_045.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_046.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_047.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_048.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_049.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_000.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_001.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_002.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_003.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_004.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_005.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_006.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_007.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_008.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_009.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_010.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_011.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_012.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_013.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_014.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_015.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_016.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_017.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_018.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_019.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_020.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_021.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_022.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_023.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_024.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_025.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_026.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_027.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_028.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_029.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_030.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_031.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_032.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_033.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_034.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_035.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_036.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_037.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_038.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_039.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_040.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_041.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_042.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_043.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_044.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_045.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_046.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_047.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_048.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_049.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_050.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_051.cpp +FILE: ../../../third_party/skia/docs/examples/Image_000.cpp +FILE: ../../../third_party/skia/docs/examples/Image_001.cpp +FILE: ../../../third_party/skia/docs/examples/Image_002.cpp +FILE: ../../../third_party/skia/docs/examples/Image_003.cpp +FILE: ../../../third_party/skia/docs/examples/Image_004.cpp +FILE: ../../../third_party/skia/docs/examples/Image_005.cpp +FILE: ../../../third_party/skia/docs/examples/Image_006.cpp +FILE: ../../../third_party/skia/docs/examples/Image_007.cpp +FILE: ../../../third_party/skia/docs/examples/Image_008.cpp +FILE: ../../../third_party/skia/docs/examples/Image_009.cpp +FILE: ../../../third_party/skia/docs/examples/Image_010.cpp +FILE: ../../../third_party/skia/docs/examples/Image_011.cpp +FILE: ../../../third_party/skia/docs/examples/Image_012.cpp +FILE: ../../../third_party/skia/docs/examples/Image_013.cpp +FILE: ../../../third_party/skia/docs/examples/Image_014.cpp +FILE: ../../../third_party/skia/docs/examples/Image_015.cpp +FILE: ../../../third_party/skia/docs/examples/Image_016.cpp +FILE: ../../../third_party/skia/docs/examples/Image_017.cpp +FILE: ../../../third_party/skia/docs/examples/Image_018.cpp +FILE: ../../../third_party/skia/docs/examples/Image_019.cpp +FILE: ../../../third_party/skia/docs/examples/Image_020.cpp +FILE: ../../../third_party/skia/docs/examples/Image_021.cpp +FILE: ../../../third_party/skia/docs/examples/Image_022.cpp +FILE: ../../../third_party/skia/docs/examples/Image_023.cpp +FILE: ../../../third_party/skia/docs/examples/Image_024.cpp +FILE: ../../../third_party/skia/docs/examples/Image_025.cpp +FILE: ../../../third_party/skia/docs/examples/Image_026.cpp +FILE: ../../../third_party/skia/docs/examples/Image_027.cpp +FILE: ../../../third_party/skia/docs/examples/Image_028.cpp +FILE: ../../../third_party/skia/docs/examples/Image_029.cpp +FILE: ../../../third_party/skia/docs/examples/Image_030.cpp +FILE: ../../../third_party/skia/docs/examples/Image_031.cpp +FILE: ../../../third_party/skia/docs/examples/Image_032.cpp +FILE: ../../../third_party/skia/docs/examples/Image_033.cpp +FILE: ../../../third_party/skia/docs/examples/Image_034.cpp +FILE: ../../../third_party/skia/docs/examples/Image_035.cpp +FILE: ../../../third_party/skia/docs/examples/Image_036.cpp +FILE: ../../../third_party/skia/docs/examples/Image_037.cpp +FILE: ../../../third_party/skia/docs/examples/Image_038.cpp +FILE: ../../../third_party/skia/docs/examples/Image_039.cpp +FILE: ../../../third_party/skia/docs/examples/Image_040.cpp +FILE: ../../../third_party/skia/docs/examples/Image_041.cpp +FILE: ../../../third_party/skia/docs/examples/Image_042.cpp +FILE: ../../../third_party/skia/docs/examples/Image_043.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_000.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_001.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_002.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_003.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_004.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_005.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_006.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_007.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_008.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_009.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_010.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_011.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_012.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_013.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_014.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_015.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_016.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_017.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_018.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_019.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_020.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_021.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_022.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_023.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_024.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_025.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_026.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_027.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_028.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_029.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_030.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_031.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_032.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_033.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_034.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_035.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_036.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_037.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_038.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_039.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_040.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_041.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_042.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_043.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_044.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_045.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_046.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_047.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_048.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_049.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_050.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_051.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_052.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_053.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_054.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_055.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_056.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_057.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_058.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_059.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_060.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_061.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_062.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_063.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_064.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_065.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_066.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_067.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_068.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_069.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_070.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_071.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_072.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_073.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_074.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_075.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_076.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_077.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_078.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_079.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_080.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_081.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_082.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_083.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_084.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_085.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_086.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_087.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_088.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_089.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_090.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_091.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_092.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_093.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_094.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_095.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_096.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_097.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_098.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_099.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_100.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_101.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_102.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_103.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_104.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_105.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_106.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_107.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_000.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_001.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_002.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_003.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_004.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_005.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_006.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_007.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_008.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_009.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_010.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_011.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_012.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_013.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_014.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_015.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_016.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_017.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_018.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_019.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_020.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_021.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_022.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_023.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_024.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_025.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_026.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_027.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_028.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_029.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_030.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_031.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_032.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_033.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_034.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_035.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_036.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_037.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_038.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_039.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_040.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_041.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_042.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_043.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_044.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_045.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_046.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_047.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_048.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_049.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_050.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_051.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_052.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_053.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_054.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_055.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_056.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_057.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_058.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_059.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_060.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_061.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_062.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_063.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_064.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_065.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_066.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_067.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_068.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_069.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_070.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_071.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_072.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_073.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_074.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_075.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_076.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_077.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_078.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_079.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_080.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_081.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_082.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_083.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_084.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_085.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_086.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_087.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_088.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_089.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_090.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_091.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_092.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_093.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_094.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_095.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_096.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_097.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_098.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_099.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_100.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_101.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_102.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_103.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_104.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_105.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_106.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_107.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_108.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_109.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_110.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_111.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_112.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_113.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_114.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_115.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_116.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_117.cpp +FILE: ../../../third_party/skia/docs/examples/Path_000.cpp +FILE: ../../../third_party/skia/docs/examples/Path_001.cpp +FILE: ../../../third_party/skia/docs/examples/Path_002.cpp +FILE: ../../../third_party/skia/docs/examples/Path_003.cpp +FILE: ../../../third_party/skia/docs/examples/Path_004.cpp +FILE: ../../../third_party/skia/docs/examples/Path_005.cpp +FILE: ../../../third_party/skia/docs/examples/Path_006.cpp +FILE: ../../../third_party/skia/docs/examples/Path_007.cpp +FILE: ../../../third_party/skia/docs/examples/Path_008.cpp +FILE: ../../../third_party/skia/docs/examples/Path_009.cpp +FILE: ../../../third_party/skia/docs/examples/Path_010.cpp +FILE: ../../../third_party/skia/docs/examples/Path_011.cpp +FILE: ../../../third_party/skia/docs/examples/Path_012.cpp +FILE: ../../../third_party/skia/docs/examples/Path_013.cpp +FILE: ../../../third_party/skia/docs/examples/Path_014.cpp +FILE: ../../../third_party/skia/docs/examples/Path_015.cpp +FILE: ../../../third_party/skia/docs/examples/Path_016.cpp +FILE: ../../../third_party/skia/docs/examples/Path_017.cpp +FILE: ../../../third_party/skia/docs/examples/Path_018.cpp +FILE: ../../../third_party/skia/docs/examples/Path_019.cpp +FILE: ../../../third_party/skia/docs/examples/Path_020.cpp +FILE: ../../../third_party/skia/docs/examples/Path_021.cpp +FILE: ../../../third_party/skia/docs/examples/Path_022.cpp +FILE: ../../../third_party/skia/docs/examples/Path_023.cpp +FILE: ../../../third_party/skia/docs/examples/Path_024.cpp +FILE: ../../../third_party/skia/docs/examples/Path_025.cpp +FILE: ../../../third_party/skia/docs/examples/Path_026.cpp +FILE: ../../../third_party/skia/docs/examples/Path_027.cpp +FILE: ../../../third_party/skia/docs/examples/Path_028.cpp +FILE: ../../../third_party/skia/docs/examples/Path_029.cpp +FILE: ../../../third_party/skia/docs/examples/Path_030.cpp +FILE: ../../../third_party/skia/docs/examples/Path_031.cpp +FILE: ../../../third_party/skia/docs/examples/Path_032.cpp +FILE: ../../../third_party/skia/docs/examples/Path_033.cpp +FILE: ../../../third_party/skia/docs/examples/Path_034.cpp +FILE: ../../../third_party/skia/docs/examples/Path_035.cpp +FILE: ../../../third_party/skia/docs/examples/Path_036.cpp +FILE: ../../../third_party/skia/docs/examples/Path_037.cpp +FILE: ../../../third_party/skia/docs/examples/Path_038.cpp +FILE: ../../../third_party/skia/docs/examples/Path_039.cpp +FILE: ../../../third_party/skia/docs/examples/Path_040.cpp +FILE: ../../../third_party/skia/docs/examples/Path_041.cpp +FILE: ../../../third_party/skia/docs/examples/Path_042.cpp +FILE: ../../../third_party/skia/docs/examples/Path_043.cpp +FILE: ../../../third_party/skia/docs/examples/Path_044.cpp +FILE: ../../../third_party/skia/docs/examples/Path_045.cpp +FILE: ../../../third_party/skia/docs/examples/Path_046.cpp +FILE: ../../../third_party/skia/docs/examples/Path_047.cpp +FILE: ../../../third_party/skia/docs/examples/Path_048.cpp +FILE: ../../../third_party/skia/docs/examples/Path_049.cpp +FILE: ../../../third_party/skia/docs/examples/Path_050.cpp +FILE: ../../../third_party/skia/docs/examples/Path_051.cpp +FILE: ../../../third_party/skia/docs/examples/Path_052.cpp +FILE: ../../../third_party/skia/docs/examples/Path_053.cpp +FILE: ../../../third_party/skia/docs/examples/Path_054.cpp +FILE: ../../../third_party/skia/docs/examples/Path_055.cpp +FILE: ../../../third_party/skia/docs/examples/Path_056.cpp +FILE: ../../../third_party/skia/docs/examples/Path_057.cpp +FILE: ../../../third_party/skia/docs/examples/Path_058.cpp +FILE: ../../../third_party/skia/docs/examples/Path_059.cpp +FILE: ../../../third_party/skia/docs/examples/Path_060.cpp +FILE: ../../../third_party/skia/docs/examples/Path_061.cpp +FILE: ../../../third_party/skia/docs/examples/Path_062.cpp +FILE: ../../../third_party/skia/docs/examples/Path_063.cpp +FILE: ../../../third_party/skia/docs/examples/Path_064.cpp +FILE: ../../../third_party/skia/docs/examples/Path_065.cpp +FILE: ../../../third_party/skia/docs/examples/Path_066.cpp +FILE: ../../../third_party/skia/docs/examples/Path_067.cpp +FILE: ../../../third_party/skia/docs/examples/Path_068.cpp +FILE: ../../../third_party/skia/docs/examples/Path_069.cpp +FILE: ../../../third_party/skia/docs/examples/Path_070.cpp +FILE: ../../../third_party/skia/docs/examples/Path_071.cpp +FILE: ../../../third_party/skia/docs/examples/Path_072.cpp +FILE: ../../../third_party/skia/docs/examples/Path_073.cpp +FILE: ../../../third_party/skia/docs/examples/Path_074.cpp +FILE: ../../../third_party/skia/docs/examples/Path_075.cpp +FILE: ../../../third_party/skia/docs/examples/Path_076.cpp +FILE: ../../../third_party/skia/docs/examples/Path_077.cpp +FILE: ../../../third_party/skia/docs/examples/Path_078.cpp +FILE: ../../../third_party/skia/docs/examples/Path_079.cpp +FILE: ../../../third_party/skia/docs/examples/Path_080.cpp +FILE: ../../../third_party/skia/docs/examples/Path_081.cpp +FILE: ../../../third_party/skia/docs/examples/Path_082.cpp +FILE: ../../../third_party/skia/docs/examples/Path_083.cpp +FILE: ../../../third_party/skia/docs/examples/Path_084.cpp +FILE: ../../../third_party/skia/docs/examples/Path_085.cpp +FILE: ../../../third_party/skia/docs/examples/Path_086.cpp +FILE: ../../../third_party/skia/docs/examples/Path_087.cpp +FILE: ../../../third_party/skia/docs/examples/Path_088.cpp +FILE: ../../../third_party/skia/docs/examples/Path_089.cpp +FILE: ../../../third_party/skia/docs/examples/Path_090.cpp +FILE: ../../../third_party/skia/docs/examples/Path_091.cpp +FILE: ../../../third_party/skia/docs/examples/Path_092.cpp +FILE: ../../../third_party/skia/docs/examples/Path_093.cpp +FILE: ../../../third_party/skia/docs/examples/Path_094.cpp +FILE: ../../../third_party/skia/docs/examples/Path_095.cpp +FILE: ../../../third_party/skia/docs/examples/Path_096.cpp +FILE: ../../../third_party/skia/docs/examples/Path_097.cpp +FILE: ../../../third_party/skia/docs/examples/Path_098.cpp +FILE: ../../../third_party/skia/docs/examples/Path_099.cpp +FILE: ../../../third_party/skia/docs/examples/Path_100.cpp +FILE: ../../../third_party/skia/docs/examples/Path_101.cpp +FILE: ../../../third_party/skia/docs/examples/Path_102.cpp +FILE: ../../../third_party/skia/docs/examples/Path_103.cpp +FILE: ../../../third_party/skia/docs/examples/Path_104.cpp +FILE: ../../../third_party/skia/docs/examples/Path_105.cpp +FILE: ../../../third_party/skia/docs/examples/Path_106.cpp +FILE: ../../../third_party/skia/docs/examples/Path_107.cpp +FILE: ../../../third_party/skia/docs/examples/Path_108.cpp +FILE: ../../../third_party/skia/docs/examples/Path_109.cpp +FILE: ../../../third_party/skia/docs/examples/Path_110.cpp +FILE: ../../../third_party/skia/docs/examples/Path_111.cpp +FILE: ../../../third_party/skia/docs/examples/Path_112.cpp +FILE: ../../../third_party/skia/docs/examples/Path_113.cpp +FILE: ../../../third_party/skia/docs/examples/Path_114.cpp +FILE: ../../../third_party/skia/docs/examples/Path_115.cpp +FILE: ../../../third_party/skia/docs/examples/Path_116.cpp +FILE: ../../../third_party/skia/docs/examples/Path_117.cpp +FILE: ../../../third_party/skia/docs/examples/Path_118.cpp +FILE: ../../../third_party/skia/docs/examples/Path_119.cpp +FILE: ../../../third_party/skia/docs/examples/Path_120.cpp +FILE: ../../../third_party/skia/docs/examples/Path_121.cpp +FILE: ../../../third_party/skia/docs/examples/Path_122.cpp +FILE: ../../../third_party/skia/docs/examples/Path_123.cpp +FILE: ../../../third_party/skia/docs/examples/Path_124.cpp +FILE: ../../../third_party/skia/docs/examples/Path_125.cpp +FILE: ../../../third_party/skia/docs/examples/Path_126.cpp +FILE: ../../../third_party/skia/docs/examples/Path_127.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_000.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_001.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_002.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_003.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_004.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_005.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_006.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_007.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_008.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_009.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_010.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_011.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_000.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_001.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_002.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_003.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_004.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_005.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_006.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_007.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_008.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_009.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_010.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_011.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_012.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_013.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_014.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_015.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_016.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_017.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_018.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_019.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_020.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_021.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_022.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_023.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_024.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_025.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_026.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_027.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_028.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_029.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_030.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_031.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_032.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_033.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_034.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_035.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_036.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_037.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_038.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_039.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_040.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_041.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_042.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_043.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_044.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_045.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_046.cpp +FILE: ../../../third_party/skia/docs/examples/Point_000.cpp +FILE: ../../../third_party/skia/docs/examples/Point_001.cpp +FILE: ../../../third_party/skia/docs/examples/Point_002.cpp +FILE: ../../../third_party/skia/docs/examples/Point_003.cpp +FILE: ../../../third_party/skia/docs/examples/Point_004.cpp +FILE: ../../../third_party/skia/docs/examples/Point_005.cpp +FILE: ../../../third_party/skia/docs/examples/Point_006.cpp +FILE: ../../../third_party/skia/docs/examples/Point_007.cpp +FILE: ../../../third_party/skia/docs/examples/Point_008.cpp +FILE: ../../../third_party/skia/docs/examples/Point_009.cpp +FILE: ../../../third_party/skia/docs/examples/Point_010.cpp +FILE: ../../../third_party/skia/docs/examples/Point_011.cpp +FILE: ../../../third_party/skia/docs/examples/Point_012.cpp +FILE: ../../../third_party/skia/docs/examples/Point_013.cpp +FILE: ../../../third_party/skia/docs/examples/Point_014.cpp +FILE: ../../../third_party/skia/docs/examples/Point_015.cpp +FILE: ../../../third_party/skia/docs/examples/Point_016.cpp +FILE: ../../../third_party/skia/docs/examples/Point_017.cpp +FILE: ../../../third_party/skia/docs/examples/Point_018.cpp +FILE: ../../../third_party/skia/docs/examples/Point_019.cpp +FILE: ../../../third_party/skia/docs/examples/Point_020.cpp +FILE: ../../../third_party/skia/docs/examples/Point_021.cpp +FILE: ../../../third_party/skia/docs/examples/Point_022.cpp +FILE: ../../../third_party/skia/docs/examples/Point_023.cpp +FILE: ../../../third_party/skia/docs/examples/Point_024.cpp +FILE: ../../../third_party/skia/docs/examples/Point_025.cpp +FILE: ../../../third_party/skia/docs/examples/Point_026.cpp +FILE: ../../../third_party/skia/docs/examples/Point_027.cpp +FILE: ../../../third_party/skia/docs/examples/Point_028.cpp +FILE: ../../../third_party/skia/docs/examples/Point_029.cpp +FILE: ../../../third_party/skia/docs/examples/Point_030.cpp +FILE: ../../../third_party/skia/docs/examples/Point_031.cpp +FILE: ../../../third_party/skia/docs/examples/Point_032.cpp +FILE: ../../../third_party/skia/docs/examples/Point_033.cpp +FILE: ../../../third_party/skia/docs/examples/Point_034.cpp +FILE: ../../../third_party/skia/docs/examples/Point_035.cpp +FILE: ../../../third_party/skia/docs/examples/Point_036.cpp +FILE: ../../../third_party/skia/docs/examples/Point_037.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_000.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_001.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_002.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_003.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_004.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_005.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_006.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_007.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_008.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_009.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_010.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_011.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_012.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_013.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_014.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_015.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_016.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_017.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_018.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_019.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_020.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_021.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_022.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_023.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_024.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_025.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_026.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_027.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_028.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_029.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_030.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_031.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_032.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_033.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_034.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_035.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_036.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_037.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_038.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_039.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_040.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_041.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_042.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_043.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_044.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_000.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_001.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_002.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_003.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_004.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_005.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_006.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_007.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_008.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_009.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_010.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_011.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_012.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_013.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_014.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_015.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_016.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_017.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_018.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_019.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_020.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_021.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_022.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_023.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_024.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_025.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_026.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_027.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_028.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_029.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_030.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_031.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_032.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_033.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_034.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_035.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_036.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_037.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_038.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_039.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_040.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_041.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_042.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_043.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_044.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_045.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_046.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_047.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_048.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_049.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_050.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_051.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_052.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_053.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_054.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_055.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_056.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_057.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_058.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_059.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_060.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_061.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_062.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_063.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_064.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_065.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_066.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_067.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_068.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_069.cpp +FILE: ../../../third_party/skia/docs/examples/Region_000.cpp +FILE: ../../../third_party/skia/docs/examples/Region_001.cpp +FILE: ../../../third_party/skia/docs/examples/Region_002.cpp +FILE: ../../../third_party/skia/docs/examples/Region_003.cpp +FILE: ../../../third_party/skia/docs/examples/Region_004.cpp +FILE: ../../../third_party/skia/docs/examples/Region_005.cpp +FILE: ../../../third_party/skia/docs/examples/Region_006.cpp +FILE: ../../../third_party/skia/docs/examples/Region_007.cpp +FILE: ../../../third_party/skia/docs/examples/Region_008.cpp +FILE: ../../../third_party/skia/docs/examples/Region_009.cpp +FILE: ../../../third_party/skia/docs/examples/Region_010.cpp +FILE: ../../../third_party/skia/docs/examples/Region_011.cpp +FILE: ../../../third_party/skia/docs/examples/Region_012.cpp +FILE: ../../../third_party/skia/docs/examples/Region_013.cpp +FILE: ../../../third_party/skia/docs/examples/Region_014.cpp +FILE: ../../../third_party/skia/docs/examples/Region_015.cpp +FILE: ../../../third_party/skia/docs/examples/Region_016.cpp +FILE: ../../../third_party/skia/docs/examples/Region_017.cpp +FILE: ../../../third_party/skia/docs/examples/Region_018.cpp +FILE: ../../../third_party/skia/docs/examples/Region_019.cpp +FILE: ../../../third_party/skia/docs/examples/Region_020.cpp +FILE: ../../../third_party/skia/docs/examples/Region_021.cpp +FILE: ../../../third_party/skia/docs/examples/Region_022.cpp +FILE: ../../../third_party/skia/docs/examples/Region_023.cpp +FILE: ../../../third_party/skia/docs/examples/Region_024.cpp +FILE: ../../../third_party/skia/docs/examples/Region_025.cpp +FILE: ../../../third_party/skia/docs/examples/Region_026.cpp +FILE: ../../../third_party/skia/docs/examples/Region_027.cpp +FILE: ../../../third_party/skia/docs/examples/Region_028.cpp +FILE: ../../../third_party/skia/docs/examples/Region_029.cpp +FILE: ../../../third_party/skia/docs/examples/Region_030.cpp +FILE: ../../../third_party/skia/docs/examples/Region_031.cpp +FILE: ../../../third_party/skia/docs/examples/Region_032.cpp +FILE: ../../../third_party/skia/docs/examples/Region_033.cpp +FILE: ../../../third_party/skia/docs/examples/Region_034.cpp +FILE: ../../../third_party/skia/docs/examples/Region_035.cpp +FILE: ../../../third_party/skia/docs/examples/Region_036.cpp +FILE: ../../../third_party/skia/docs/examples/Region_037.cpp +FILE: ../../../third_party/skia/docs/examples/Region_038.cpp +FILE: ../../../third_party/skia/docs/examples/Region_039.cpp +FILE: ../../../third_party/skia/docs/examples/Region_040.cpp +FILE: ../../../third_party/skia/docs/examples/Region_041.cpp +FILE: ../../../third_party/skia/docs/examples/Region_042.cpp +FILE: ../../../third_party/skia/docs/examples/Region_043.cpp +FILE: ../../../third_party/skia/docs/examples/Region_044.cpp +FILE: ../../../third_party/skia/docs/examples/Region_045.cpp +FILE: ../../../third_party/skia/docs/examples/Region_046.cpp +FILE: ../../../third_party/skia/docs/examples/Region_047.cpp +FILE: ../../../third_party/skia/docs/examples/Region_048.cpp +FILE: ../../../third_party/skia/docs/examples/Region_049.cpp +FILE: ../../../third_party/skia/docs/examples/Region_050.cpp +FILE: ../../../third_party/skia/docs/examples/Region_051.cpp +FILE: ../../../third_party/skia/docs/examples/Region_052.cpp +FILE: ../../../third_party/skia/docs/examples/Region_053.cpp +FILE: ../../../third_party/skia/docs/examples/Region_054.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_000.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_001.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_002.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_003.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_004.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_005.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_006.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_007.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_008.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_009.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_010.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_011.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_012.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_013.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_014.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_015.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_016.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_017.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_018.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_019.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_020.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_021.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_022.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_023.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_024.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_025.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_026.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_027.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_028.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_000.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_001.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_002.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_003.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_004.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_000.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_001.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_002.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_003.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_004.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_005.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_006.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_007.cpp +FILE: ../../../third_party/skia/gm/crbug_918512.cpp +---------------------------------------------------------------------------------------------------- +Copyright 2019 Google LLC. + +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/experimental/wasm-skp-debugger/debugger_bindings.cpp + ../../../third_party/skia/LICENSE @@ -4986,41 +6148,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/gm/crbug_918512.cpp + ../../../third_party/skia/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../third_party/skia/gm/crbug_918512.cpp ----------------------------------------------------------------------------------------------------- -Copyright 2019 Google LLC. - -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/include/config/SkUserConfig.h + ../../../third_party/skia/LICENSE From 39fea550209f34a74e4f00b813d5ef098e2c4507 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 16 Mar 2019 09:19:11 -0400 Subject: [PATCH 0466/1117] Roll src/third_party/skia f34d0c79dc6c..3d42a0521d12 (1 commits) (#8187) https://skia.googlesource.com/skia.git/%2Blog/f34d0c79dc6c..3d42a0521d12 git log f34d0c79dc6cc5595f8452696bc9e88d27f34452..3d42a0521d12745bd580a53b920a23e65f6f3f5b --date=short --no-merges --format=%ad %ae %s 2019-03-15 halcanary@google.com Examples: Two changes from kevin The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index fffef129d7020..3dfa22a629157 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': 'f34d0c79dc6cc5595f8452696bc9e88d27f34452', + 'skia_revision': '3d42a0521d12745bd580a53b920a23e65f6f3f5b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index d93b05557d55c..76955de5a3d74 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 6c5efbff1420dc3200e1c15a1406967f +Signature: a7dfe7c35edb35fa264989d522147b7c UNUSED LICENSES: From 4a4f1823eb5b3a08b703f0190ab309af8b65f721 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 16 Mar 2019 12:50:11 -0400 Subject: [PATCH 0467/1117] Roll src/third_party/skia 3d42a0521d12..f3f7059cb736 (6 commits) (#8188) https://skia.googlesource.com/skia.git/%2Blog/3d42a0521d12..f3f7059cb736 git log 3d42a0521d12745bd580a53b920a23e65f6f3f5b..f3f7059cb73661fc647a60e8eab5bb7fc471a71a --date=short --no-merges --format=%ad %ae %s 2019-03-16 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader faed9d31b44d..4af8826ee423 (9 commits) 2019-03-16 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 558a982945cf..f4c60d43323d (337 commits) 2019-03-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 de52ca373d98..f06076396afa (3 commits) 2019-03-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 71673c81fb1e..faed9d31b44d (1 commits) 2019-03-16 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-03-15 kjlubick@google.com Clean up some types in SkFont The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 3dfa22a629157..c18a9b4fb851b 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': '3d42a0521d12745bd580a53b920a23e65f6f3f5b', + 'skia_revision': 'f3f7059cb73661fc647a60e8eab5bb7fc471a71a', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 76955de5a3d74..452f7c03357a8 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: a7dfe7c35edb35fa264989d522147b7c +Signature: 0de493b18e4c66bb5f9abd4f7c6c0d7f UNUSED LICENSES: From 0f97c920ff90aaa0cbfd960ef61089a124ffafae Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 16 Mar 2019 16:22:11 -0400 Subject: [PATCH 0468/1117] Roll src/third_party/skia f3f7059cb736..90155edf140b (1 commits) (#8189) https://skia.googlesource.com/skia.git/%2Blog/f3f7059cb736..90155edf140b git log f3f7059cb73661fc647a60e8eab5bb7fc471a71a..90155edf140bb337f512f91d0a10bd2c20c3d7e6 --date=short --no-merges --format=%ad %ae %s 2019-03-16 reed@google.com add bench for mixers The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 169 ++++++++++++++++--------------- 2 files changed, 86 insertions(+), 85 deletions(-) diff --git a/DEPS b/DEPS index c18a9b4fb851b..6dbc881657c21 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': 'f3f7059cb73661fc647a60e8eab5bb7fc471a71a', + 'skia_revision': '90155edf140bb337f512f91d0a10bd2c20c3d7e6', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 452f7c03357a8..6633397bc33ca 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 0de493b18e4c66bb5f9abd4f7c6c0d7f +Signature: a2cfef3a5a4d95324bb583d3320800d2 UNUSED LICENSES: @@ -4596,6 +4596,90 @@ 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/bench/MixerBench.cpp + ../../../third_party/skia/LICENSE +TYPE: LicenseType.bsd +FILE: ../../../third_party/skia/bench/MixerBench.cpp +FILE: ../../../third_party/skia/gm/backdrop.cpp +FILE: ../../../third_party/skia/gm/compositor_quads.cpp +FILE: ../../../third_party/skia/gm/crbug_938592.cpp +FILE: ../../../third_party/skia/gm/mac_aa_explorer.cpp +FILE: ../../../third_party/skia/gm/mixercolorfilter.cpp +FILE: ../../../third_party/skia/gm/samplelocations.cpp +FILE: ../../../third_party/skia/gm/skbug_8664.cpp +FILE: ../../../third_party/skia/include/core/SkMixer.h +FILE: ../../../third_party/skia/include/gpu/GrContextThreadSafeProxy.h +FILE: ../../../third_party/skia/include/private/GrContext_Base.h +FILE: ../../../third_party/skia/include/private/GrImageContext.h +FILE: ../../../third_party/skia/include/private/GrRecordingContext.h +FILE: ../../../third_party/skia/include/private/SkVx.h +FILE: ../../../third_party/skia/modules/sksg/include/SkSGRenderEffect.h +FILE: ../../../third_party/skia/modules/sksg/src/SkSGRenderEffect.cpp +FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h +FILE: ../../../third_party/skia/samplecode/SampleDegenerateQuads.cpp +FILE: ../../../third_party/skia/samplecode/SampleSG.cpp +FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp +FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp +FILE: ../../../third_party/skia/src/core/SkEffectPriv.h +FILE: ../../../third_party/skia/src/core/SkMixer.cpp +FILE: ../../../third_party/skia/src/core/SkMixerBase.h +FILE: ../../../third_party/skia/src/core/SkStrikeInterface.h +FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.cpp +FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.h +FILE: ../../../third_party/skia/src/gpu/GrBaseContextPriv.h +FILE: ../../../third_party/skia/src/gpu/GrBuffer.h +FILE: ../../../third_party/skia/src/gpu/GrContextPriv.cpp +FILE: ../../../third_party/skia/src/gpu/GrContextThreadSafeProxy.cpp +FILE: ../../../third_party/skia/src/gpu/GrContext_Base.cpp +FILE: ../../../third_party/skia/src/gpu/GrCpuBuffer.h +FILE: ../../../third_party/skia/src/gpu/GrGpuBuffer.cpp +FILE: ../../../third_party/skia/src/gpu/GrGpuBuffer.h +FILE: ../../../third_party/skia/src/gpu/GrImageContext.cpp +FILE: ../../../third_party/skia/src/gpu/GrImageContextPriv.h +FILE: ../../../third_party/skia/src/gpu/GrRecordingContext.cpp +FILE: ../../../third_party/skia/src/gpu/GrRecordingContextPriv.h +FILE: ../../../third_party/skia/src/gpu/GrSamplePatternDictionary.cpp +FILE: ../../../third_party/skia/src/gpu/GrSamplePatternDictionary.h +FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.fp +FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.h +FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp +FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.h +FILE: ../../../third_party/skia/src/shaders/SkMixerShader.cpp +FILE: ../../../third_party/skia/src/shaders/SkMixerShader.h +FILE: ../../../third_party/skia/src/sksl/SkSLDefines.h +FILE: ../../../third_party/skia/src/sksl/SkSLOutputStream.cpp +---------------------------------------------------------------------------------------------------- +Copyright 2019 Google Inc. + +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/bench/ReadPixBench.cpp + ../../../third_party/skia/LICENSE @@ -6030,89 +6114,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/gm/backdrop.cpp + ../../../third_party/skia/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../third_party/skia/gm/backdrop.cpp -FILE: ../../../third_party/skia/gm/compositor_quads.cpp -FILE: ../../../third_party/skia/gm/crbug_938592.cpp -FILE: ../../../third_party/skia/gm/mac_aa_explorer.cpp -FILE: ../../../third_party/skia/gm/mixercolorfilter.cpp -FILE: ../../../third_party/skia/gm/samplelocations.cpp -FILE: ../../../third_party/skia/gm/skbug_8664.cpp -FILE: ../../../third_party/skia/include/core/SkMixer.h -FILE: ../../../third_party/skia/include/gpu/GrContextThreadSafeProxy.h -FILE: ../../../third_party/skia/include/private/GrContext_Base.h -FILE: ../../../third_party/skia/include/private/GrImageContext.h -FILE: ../../../third_party/skia/include/private/GrRecordingContext.h -FILE: ../../../third_party/skia/include/private/SkVx.h -FILE: ../../../third_party/skia/modules/sksg/include/SkSGRenderEffect.h -FILE: ../../../third_party/skia/modules/sksg/src/SkSGRenderEffect.cpp -FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h -FILE: ../../../third_party/skia/samplecode/SampleDegenerateQuads.cpp -FILE: ../../../third_party/skia/samplecode/SampleSG.cpp -FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp -FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp -FILE: ../../../third_party/skia/src/core/SkEffectPriv.h -FILE: ../../../third_party/skia/src/core/SkMixer.cpp -FILE: ../../../third_party/skia/src/core/SkMixerBase.h -FILE: ../../../third_party/skia/src/core/SkStrikeInterface.h -FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.cpp -FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.h -FILE: ../../../third_party/skia/src/gpu/GrBaseContextPriv.h -FILE: ../../../third_party/skia/src/gpu/GrBuffer.h -FILE: ../../../third_party/skia/src/gpu/GrContextPriv.cpp -FILE: ../../../third_party/skia/src/gpu/GrContextThreadSafeProxy.cpp -FILE: ../../../third_party/skia/src/gpu/GrContext_Base.cpp -FILE: ../../../third_party/skia/src/gpu/GrCpuBuffer.h -FILE: ../../../third_party/skia/src/gpu/GrGpuBuffer.cpp -FILE: ../../../third_party/skia/src/gpu/GrGpuBuffer.h -FILE: ../../../third_party/skia/src/gpu/GrImageContext.cpp -FILE: ../../../third_party/skia/src/gpu/GrImageContextPriv.h -FILE: ../../../third_party/skia/src/gpu/GrRecordingContext.cpp -FILE: ../../../third_party/skia/src/gpu/GrRecordingContextPriv.h -FILE: ../../../third_party/skia/src/gpu/GrSamplePatternDictionary.cpp -FILE: ../../../third_party/skia/src/gpu/GrSamplePatternDictionary.h -FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.cpp -FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.h -FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp -FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.h -FILE: ../../../third_party/skia/src/shaders/SkMixerShader.cpp -FILE: ../../../third_party/skia/src/shaders/SkMixerShader.h -FILE: ../../../third_party/skia/src/sksl/SkSLDefines.h -FILE: ../../../third_party/skia/src/sksl/SkSLOutputStream.cpp ----------------------------------------------------------------------------------------------------- -Copyright 2019 Google Inc. - -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/gm/circles.cpp + ../../../third_party/skia/LICENSE From c6f9fe7e00e2648de1a7aa02673b7771a9b92c49 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 16 Mar 2019 19:55:11 -0400 Subject: [PATCH 0469/1117] Roll src/third_party/skia 90155edf140b..d95286de1dda (2 commits) (#8190) https://skia.googlesource.com/skia.git/%2Blog/90155edf140b..d95286de1dda git log 90155edf140bb337f512f91d0a10bd2c20c3d7e6..d95286de1dda8c1c0403de22151e1b2a9b7ddf96 --date=short --no-merges --format=%ad %ae %s 2019-03-16 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 f06076396afa..38e282570676 (4 commits) 2019-03-16 reed@google.com add animated version of mixer gm The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (benjaminwagner@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 6dbc881657c21..5859f178659ce 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': '90155edf140bb337f512f91d0a10bd2c20c3d7e6', + 'skia_revision': 'd95286de1dda8c1c0403de22151e1b2a9b7ddf96', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6633397bc33ca..456558576caad 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: a2cfef3a5a4d95324bb583d3320800d2 +Signature: 40d0169084d7987c00d4bb2ddd612a20 UNUSED LICENSES: From c14fde8416ab7cf0cc6cf178c1fa3c08c24491f9 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 17 Mar 2019 02:28:11 -0400 Subject: [PATCH 0470/1117] Roll src/third_party/skia d95286de1dda..e1f2a572cec0 (1 commits) (#8191) https://skia.googlesource.com/skia.git/%2Blog/d95286de1dda..e1f2a572cec0 git log d95286de1dda8c1c0403de22151e1b2a9b7ddf96..e1f2a572cec06bcf86e392b3f40647f8e485efb4 --date=short --no-merges --format=%ad %ae %s 2019-03-17 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 5859f178659ce..3cfb86a318209 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': 'd95286de1dda8c1c0403de22151e1b2a9b7ddf96', + 'skia_revision': 'e1f2a572cec06bcf86e392b3f40647f8e485efb4', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 456558576caad..b51404b2d1bc9 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 40d0169084d7987c00d4bb2ddd612a20 +Signature: 59458d2a878023794e0b4075ed701845 UNUSED LICENSES: From 4d9b9aacd07602031ab9cee863a74ecf02686ed4 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 17 Mar 2019 05:59:11 -0400 Subject: [PATCH 0471/1117] Roll src/third_party/skia e1f2a572cec0..143542fa28e9 (1 commits) (#8192) https://skia.googlesource.com/skia.git/%2Blog/e1f2a572cec0..143542fa28e9 git log e1f2a572cec06bcf86e392b3f40647f8e485efb4..143542fa28e92485df53f0d2ad33f8cd096b5eb0 --date=short --no-merges --format=%ad %ae %s 2019-03-17 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update SKP version The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 3cfb86a318209..dc6a2821321f9 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': 'e1f2a572cec06bcf86e392b3f40647f8e485efb4', + 'skia_revision': '143542fa28e92485df53f0d2ad33f8cd096b5eb0', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b51404b2d1bc9..6a7539b8494ed 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 59458d2a878023794e0b4075ed701845 +Signature: cb2c5204335c1c2da3e7fc6998215b42 UNUSED LICENSES: From 5ca92fbe9eeab46f11fab434d96b47a59553c8f3 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 17 Mar 2019 11:21:11 -0400 Subject: [PATCH 0472/1117] Roll src/third_party/skia 143542fa28e9..3ea586f9f959 (1 commits) (#8193) https://skia.googlesource.com/skia.git/%2Blog/143542fa28e9..3ea586f9f959 git log 143542fa28e92485df53f0d2ad33f8cd096b5eb0..3ea586f9f95904090ae780b22b514b18686a8038 --date=short --no-merges --format=%ad %ae %s 2019-03-17 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src f4c60d43323d..ad85caa87461 (55 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index dc6a2821321f9..1e46a0ff026b9 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': '143542fa28e92485df53f0d2ad33f8cd096b5eb0', + 'skia_revision': '3ea586f9f95904090ae780b22b514b18686a8038', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6a7539b8494ed..91a2908097b77 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: cb2c5204335c1c2da3e7fc6998215b42 +Signature: 4cfaf6117dd349c9ae3d13265b68aa9e UNUSED LICENSES: From a47e12d259cd5ac8fd28acb7546f968504d73bed Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 17 Mar 2019 14:42:11 -0400 Subject: [PATCH 0473/1117] Roll src/third_party/skia 3ea586f9f959..72ef2d519a0e (1 commits) (#8194) https://skia.googlesource.com/skia.git/%2Blog/3ea586f9f959..72ef2d519a0e git log 3ea586f9f95904090ae780b22b514b18686a8038..72ef2d519a0eecfffa9bf10ef6d027a58942875c --date=short --no-merges --format=%ad %ae %s 2019-03-17 brianosman@google.com Suppress MSVC C4756 (constant arithmetic overflow) in fiddle examples The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 1e46a0ff026b9..d1e1617456fec 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': '3ea586f9f95904090ae780b22b514b18686a8038', + 'skia_revision': '72ef2d519a0eecfffa9bf10ef6d027a58942875c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the From 5b09204e3037a8e03fcffc9161cd474b41f4db3b Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 17 Mar 2019 18:12:11 -0400 Subject: [PATCH 0474/1117] Roll src/third_party/skia 72ef2d519a0e..895e1eedb420 (1 commits) (#8195) https://skia.googlesource.com/skia.git/%2Blog/72ef2d519a0e..895e1eedb420 git log 72ef2d519a0eecfffa9bf10ef6d027a58942875c..895e1eedb4205ad2246f5670a8aa50dd01add5cc --date=short --no-merges --format=%ad %ae %s 2019-03-16 reed@google.com lowp stages for load/stores and lerp-native The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d1e1617456fec..25aece49d2310 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': '72ef2d519a0eecfffa9bf10ef6d027a58942875c', + 'skia_revision': '895e1eedb4205ad2246f5670a8aa50dd01add5cc', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 91a2908097b77..4e53424fbff32 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 4cfaf6117dd349c9ae3d13265b68aa9e +Signature: ce945b43dbdf5c785a103ee114166c52 UNUSED LICENSES: From d9fda1c208193cc9e2a5600ccbd149d2adb420b1 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Sun, 17 Mar 2019 15:52:41 -0700 Subject: [PATCH 0475/1117] Add --no-full-dart-sdk option to GN (#8196) Allows enabling/disabling building trained snapshots for dart2js and dartdevc. --- tools/gn | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/gn b/tools/gn index 4cb0fe099bf9f..ff0f29978e2de 100755 --- a/tools/gn +++ b/tools/gn @@ -234,9 +234,8 @@ def to_gn_args(args): if args.arm_float_abi: gn_args['arm_float_abi'] = args.arm_float_abi - # Whether to build all dart snapshots. - if args.full_dart_sdk: - gn_args['dart_platform_sdk'] = False + # Whether to build trained Dart SDK snapshots of dart2js and dartdevc. + gn_args['dart_platform_sdk'] = not args.full_dart_sdk return gn_args @@ -289,8 +288,9 @@ def parse_args(args): parser.add_argument('--out-dir', default='', type=str) - parser.add_argument('--full-dart-sdk', default=True, action='store_true', - help='include trained dart2js and dartdevc snapshots. Enable only on steps that create an sdk') + parser.add_argument('--full-dart-sdk', default=False, action='store_true', + help='include trained dart2js and dartdevc snapshots. Enable only on steps that create an SDK') + parser.add_argument('--no-full-dart-sdk', dest='full_dart_sdk', action='store_false') return parser.parse_args(args) From e75f6de01fee738eb15f24efb0ec549587009f1a Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 18 Mar 2019 01:44:12 -0400 Subject: [PATCH 0476/1117] Roll src/third_party/skia 895e1eedb420..576b2a5596bc (1 commits) (#8198) https://skia.googlesource.com/skia.git/%2Blog/895e1eedb420..576b2a5596bc git log 895e1eedb4205ad2246f5670a8aa50dd01add5cc..576b2a5596bc8dda294a069e3fdc6b8b8e48ffcf --date=short --no-merges --format=%ad %ae %s 2019-03-15 csmartdalton@google.com Disable coverage counting by default The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 25aece49d2310..f1b8dc2de7b96 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': '895e1eedb4205ad2246f5670a8aa50dd01add5cc', + 'skia_revision': '576b2a5596bc8dda294a069e3fdc6b8b8e48ffcf', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 4e53424fbff32..993a854d4c418 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ce945b43dbdf5c785a103ee114166c52 +Signature: ee805bb38a883c424fed98ccbbcde946 UNUSED LICENSES: From e0782dec717049413679318ecf61e30788bf143c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 18 Mar 2019 08:11:12 -0400 Subject: [PATCH 0477/1117] Roll src/third_party/skia 576b2a5596bc..2c043c288169 (2 commits) (#8200) https://skia.googlesource.com/skia.git/%2Blog/576b2a5596bc..2c043c288169 git log 576b2a5596bc8dda294a069e3fdc6b8b8e48ffcf..2c043c28816981f4002e72a12d7ec446672aeb1c --date=short --no-merges --format=%ad %ae %s 2019-03-18 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 4af8826ee423..62758f581672 (1 commits) 2019-03-18 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f1b8dc2de7b96..6a2ffd4f37f84 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': '576b2a5596bc8dda294a069e3fdc6b8b8e48ffcf', + 'skia_revision': '2c043c28816981f4002e72a12d7ec446672aeb1c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 993a854d4c418..0f1a4f155a80b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ee805bb38a883c424fed98ccbbcde946 +Signature: a3c1d11b2ee8f43fdf008204a0b26395 UNUSED LICENSES: From 048d70bc0948de3bad60e2056f186f336cd5aad9 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Mon, 18 Mar 2019 11:58:35 -0700 Subject: [PATCH 0478/1117] Support dartdevc, dart2js with shared source files, dartdevc sdk (#8105) --- BUILD.gn | 13 +- ci/licenses_golden/licenses_flutter | 1 + tools/gn | 4 +- web_sdk/BUILD.gn | 95 +++++++++------ web_sdk/flutter_kernel_sdk.dart | 109 +++++++++++++++++ web_sdk/libraries.json | 176 ++++++++++++++-------------- web_sdk/libraries.yaml | 176 ++++++++++++++-------------- 7 files changed, 359 insertions(+), 215 deletions(-) create mode 100644 web_sdk/flutter_kernel_sdk.dart diff --git a/BUILD.gn b/BUILD.gn index 248524f872551..b57d63f91fde2 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -4,6 +4,12 @@ import("$flutter_root/common/config.gni") +# Whether to build the dartdevc sdk, libraries, and source files +# required for the flutter web sdk. +declare_args() { + full_dart_sdk = false +} + group("flutter") { testonly = true @@ -23,8 +29,13 @@ group("flutter") { public_deps += [ "$flutter_root/frontend_server", "//third_party/dart:create_sdk", - "$flutter_root/web_sdk", ] + + if (full_dart_sdk) { + public_deps += [ + "$flutter_root/web_sdk", + ] + } } } diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 7f1d66782caae..6196b918d31a5 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -704,6 +704,7 @@ FILE: ../../../flutter/vulkan/vulkan_utilities.cc FILE: ../../../flutter/vulkan/vulkan_utilities.h FILE: ../../../flutter/vulkan/vulkan_window.cc FILE: ../../../flutter/vulkan/vulkan_window.h +FILE: ../../../flutter/web_sdk/flutter_kernel_sdk.dart FILE: ../../../flutter/web_sdk/libraries.json ---------------------------------------------------------------------------------------------------- Copyright 2013 The Flutter Authors. All rights reserved. diff --git a/tools/gn b/tools/gn index ff0f29978e2de..c1f381b64642b 100755 --- a/tools/gn +++ b/tools/gn @@ -234,8 +234,10 @@ def to_gn_args(args): if args.arm_float_abi: gn_args['arm_float_abi'] = args.arm_float_abi - # Whether to build trained Dart SDK snapshots of dart2js and dartdevc. + # Whether to build trained Dart SDK snapshots of dart2js and dartdevc, + # including the web sdk kernel and source files. gn_args['dart_platform_sdk'] = not args.full_dart_sdk + gn_args['full_dart_sdk'] = args.full_dart_sdk return gn_args diff --git a/web_sdk/BUILD.gn b/web_sdk/BUILD.gn index 47d8121cbec45..925f6000499b5 100644 --- a/web_sdk/BUILD.gn +++ b/web_sdk/BUILD.gn @@ -2,63 +2,82 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//third_party/dart/build/dart/dart_action.gni") +import("//third_party/dart/utils/compile_platform.gni") + +sdk_dill = "$root_out_dir/flutter_web_sdk/kernel/flutter_ddc_sdk.dill" +sdk_libraries_json = "$flutter_root/web_sdk/libraries.json" + +web_ui_sources = [ + "$flutter_root/lib/stub_ui/compositing.dart", + "$flutter_root/lib/stub_ui/geometry.dart", + "$flutter_root/lib/stub_ui/hash_codes.dart", + "$flutter_root/lib/stub_ui/hooks.dart", + "$flutter_root/lib/stub_ui/isolate_name_server.dart", + "$flutter_root/lib/stub_ui/lerp.dart", + "$flutter_root/lib/stub_ui/natives.dart", + "$flutter_root/lib/stub_ui/painting.dart", + "$flutter_root/lib/stub_ui/plugins.dart", + "$flutter_root/lib/stub_ui/pointer.dart", + "$flutter_root/lib/stub_ui/semantics.dart", + "$flutter_root/lib/stub_ui/text.dart", + "$flutter_root/lib/stub_ui/ui.dart", + "$flutter_root/lib/stub_ui/versions.dart", + "$flutter_root/lib/stub_ui/window.dart", +] + group("web_sdk") { deps = [ ":web_ui_sources", - ":web_libraries_json", - #":dart_sdk_internal", + ":web_ui_library", + ":flutter_dartdevc_kernel_sdk", ] } copy("web_ui_sources") { - sources = [ - "$flutter_root/lib/stub_ui/compositing.dart", - "$flutter_root/lib/stub_ui/geometry.dart", - "$flutter_root/lib/stub_ui/hash_codes.dart", - "$flutter_root/lib/stub_ui/hooks.dart", - "$flutter_root/lib/stub_ui/isolate_name_server.dart", - "$flutter_root/lib/stub_ui/lerp.dart", - "$flutter_root/lib/stub_ui/natives.dart", - "$flutter_root/lib/stub_ui/painting.dart", - "$flutter_root/lib/stub_ui/plugins.dart", - "$flutter_root/lib/stub_ui/pointer.dart", - "$flutter_root/lib/stub_ui/semantics.dart", - "$flutter_root/lib/stub_ui/text.dart", - "$flutter_root/lib/stub_ui/ui.dart", - "$flutter_root/lib/stub_ui/versions.dart", - "$flutter_root/lib/stub_ui/window.dart", - ] + sources = web_ui_sources outputs = [ "$root_out_dir/flutter_web_sdk/lib/ui/{{source_file_part}}" ] } -copy("web_libraries_json") { +copy("web_ui_library") { sources = [ - "libraries.json" + "$flutter_root/web_sdk/libraries.json", ] outputs = [ - "$root_out_dir/flutter_web_sdk/lib/libraries.json" + "$root_out_dir/flutter_web_sdk/{{source_file_part}}" ] } -# copy("dart_sdk_internal") { -# deps = [ -# "//third_party/dart:create_sdk" -# ] +prebuilt_dart_action("flutter_dartdevc_kernel_sdk") { + deps = [ + "//third_party/dart/pkg:pkg_files_stamp", + "//third_party/dart/utils/dartdevc:dartdevc_files_stamp", + "//third_party/dart/utils/dartdevc:dartdevc_sdk_patch_stamp", + ] -# sources = [ -# "$root_out_dir/dart-sdk/lib/_internal/ddc_sdk.dill", -# "$root_out_dir/dart-sdk/lib/_internal/dart2js_platform.dill", -# "$root_out_dir/dart-sdk/lib/_internal/dart2js_server_platform.dill", -# "$root_out_dir/dart-sdk/lib/_internal/ddc_sdk.sum", -# "$root_out_dir/dart-sdk/lib/_internal/strong.sum", -# "$root_out_dir/dart-sdk/lib/_internal/vm_platform_strong.dill", -# ] + inputs = [ + "//third_party/dart/pkg/dev_compiler/tool/kernel_sdk.dart", + ] -# outputs = [ -# "$root_out_dir/flutter_web_sdk/lib/_internal/{{source_file_part}}" -# ] -# } + outputs = [ + sdk_dill, + "$root_out_dir/flutter_web_sdk/lib/_internal/libraries.json", + "$root_out_dir/flutter_web_sdk/kernel/amd/dart_sdk.js", + "$root_out_dir/flutter_web_sdk/kernel/amd/dart_sdk.js.map", + ] + + script = "flutter_kernel_sdk.dart" + packages = "//third_party/dart/.packages" + + output_path = rebase_path(sdk_dill) + libraries_path = rebase_path(sdk_libraries_json) + + args = [ + "--output=$output_path", + "--libraries=$libraries_path", + ] +} diff --git a/web_sdk/flutter_kernel_sdk.dart b/web_sdk/flutter_kernel_sdk.dart new file mode 100644 index 0000000000000..dea21c2de8ae5 --- /dev/null +++ b/web_sdk/flutter_kernel_sdk.dart @@ -0,0 +1,109 @@ +// Copyright 2013 The Flutter 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 'dart:async'; +import 'dart:convert' show json; +import 'dart:io'; +import 'package:args/args.dart' show ArgParser; +import 'package:dev_compiler/src/compiler/module_builder.dart'; +import 'package:dev_compiler/src/compiler/shared_command.dart' show SharedCompilerOptions; +import 'package:dev_compiler/src/kernel/target.dart'; +import 'package:dev_compiler/src/kernel/command.dart'; +import 'package:dev_compiler/src/kernel/compiler.dart'; +import 'package:front_end/src/api_unstable/ddc.dart' show CompilerOptions, kernelForComponent; +import 'package:kernel/kernel.dart'; +import 'package:path/path.dart' as path; + +// This script is forked from https://github.com/dart-lang/sdk/blob/master/pkg/dev_compiler/tool/kernel_sdk.dart +// and produces the precompiled sdk for dartdevc. This has been modified to include a dart:ui target. +Future main(List args) async { + var ddcPath = path.dirname(path.dirname(path.fromUri(Platform.script))); + + // Parse flags. + var parser = ArgParser() + ..addOption('output') + ..addOption('libraries', + defaultsTo: path.join(ddcPath, '../../sdk/lib/libraries.json')); + var parserOptions = parser.parse(args); + + var outputPath = parserOptions['output'] as String; + if (outputPath == null) { + var sdkRoot = path.absolute(path.dirname(path.dirname(ddcPath))); + var buildDir = path.join(sdkRoot, Platform.isMacOS ? 'xcodebuild' : 'out'); + var genDir = path.join(buildDir, 'ReleaseX64', 'gen', 'utils', 'dartdevc'); + outputPath = path.join(genDir, 'kernel', 'ddc_sdk.dill'); + } + + var librarySpecPath = parserOptions['libraries'] as String; + + var target = FlutterDevCompilerTarget(); + var options = CompilerOptions() + ..compileSdk = true + // TODO(sigmund): remove this unnecessary option when possible. + ..sdkRoot = Uri.base + ..librariesSpecificationUri = Uri.base.resolveUri(Uri.file(librarySpecPath)) + ..target = target; + + var inputs = target.extraRequiredLibraries.map(Uri.parse).toList(); + var component = await kernelForComponent(inputs, options); + + var outputDir = path.dirname(outputPath); + await Directory(outputDir).create(recursive: true); + await writeComponentToBinary(component, outputPath); + + var jsModule = ProgramCompiler( + component, + target.hierarchy, + SharedCompilerOptions(moduleName: 'dart_sdk'), + {}).emitModule(component, [], [], {}); + var moduleFormats = { + 'amd': ModuleFormat.amd, + }; + + for (var name in moduleFormats.keys) { + var format = moduleFormats[name]; + var jsDir = path.join(outputDir, name); + var jsPath = path.join(jsDir, 'dart_sdk.js'); + await Directory(jsDir).create(); + var jsCode = jsProgramToCode(jsModule, format); + await File(jsPath).writeAsString(jsCode.code); + await File('$jsPath.map').writeAsString(json.encode(jsCode.sourceMap)); + } +} + +class FlutterDevCompilerTarget extends DevCompilerTarget { + @override + List get extraRequiredLibraries => const [ + 'dart:_runtime', + 'dart:_debugger', + 'dart:_foreign_helper', + 'dart:_interceptors', + 'dart:_internal', + 'dart:_isolate_helper', + 'dart:_js_helper', + 'dart:_js_mirrors', + 'dart:_js_primitives', + 'dart:_metadata', + 'dart:_native_typed_data', + 'dart:async', + 'dart:collection', + 'dart:convert', + 'dart:developer', + 'dart:io', + 'dart:isolate', + 'dart:js', + 'dart:js_util', + 'dart:math', + 'dart:mirrors', + 'dart:typed_data', + 'dart:indexed_db', + 'dart:html', + 'dart:html_common', + 'dart:svg', + 'dart:web_audio', + 'dart:web_gl', + 'dart:web_sql', + 'dart:ui', + ]; +} diff --git a/web_sdk/libraries.json b/web_sdk/libraries.json index a9203707e82f4..38eb0788b0516 100644 --- a/web_sdk/libraries.json +++ b/web_sdk/libraries.json @@ -1,235 +1,235 @@ { "comment:0": "NOTE: THIS FILE IS GENERATED. DO NOT EDIT.", - "comment:1": "Instead modify 'flutter/flutter_web/libraries.yaml' and follow the instructions therein.", + "comment:1": "Instead modify 'flutter/web_sdk/libraries.yaml' and follow the instructions therein.", "dart2js": { "libraries": { "async": { - "patches": "lib/_internal/js_runtime/lib/async_patch.dart", - "uri": "lib/async/async.dart" + "patches": "../dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart", + "uri": "../dart-sdk/lib/async/async.dart" }, "_interceptors": { - "uri": "lib/_internal/js_runtime/lib/interceptors.dart" + "uri": "../dart-sdk/lib/_internal/js_runtime/lib/interceptors.dart" }, "mirrors": { - "patches": "lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart", + "patches": "../dart-sdk/lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart", "supported": false, - "uri": "lib/mirrors/mirrors.dart" + "uri": "../dart-sdk/lib/mirrors/mirrors.dart" }, "_js_embedded_names": { - "uri": "lib/_internal/js_runtime/lib/shared/embedded_names.dart" + "uri": "../dart-sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart" }, "io": { - "patches": "lib/_internal/js_runtime/lib/io_patch.dart", + "patches": "io_patch.dart", "supported": false, - "uri": "lib/io/io.dart" + "uri": "../dart-sdk/lib/io/io.dart" }, "_internal": { - "patches": "lib/_internal/js_runtime/lib/internal_patch.dart", - "uri": "lib/internal/internal.dart" + "patches": "../dart-sdk/lib/_internal/js_runtime/lib/internal_patch.dart", + "uri": "../dart-sdk/lib/internal/internal.dart" }, "_metadata": { - "uri": "lib/html/html_common/metadata.dart" + "uri": "../dart-sdk/lib/html/html_common/metadata.dart" }, "_async_await_error_codes": { - "uri": "lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart" + "uri": "../dart-sdk/lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart" }, "_http": { - "uri": "lib/_http/http.dart" + "uri": "../dart-sdk/lib/_http/http.dart" }, "_js_primitives": { - "uri": "lib/_internal/js_runtime/lib/js_primitives.dart" + "uri": "../dart-sdk/lib/_internal/js_runtime/lib/js_primitives.dart" }, "_js_helper": { - "uri": "lib/_internal/js_runtime/lib/js_helper.dart" + "uri": "../dart-sdk/lib/_internal/js_runtime/lib/js_helper.dart" }, "_chrome": { - "uri": "lib/_chrome/dart2js/chrome_dart2js.dart" + "uri": "../dart-sdk/lib/_chrome/dart2js/chrome_dart2js.dart" }, "html_common": { - "uri": "lib/html/html_common/html_common_dart2js.dart" + "uri": "../dart-sdk/lib/html/html_common/html_common_dart2js.dart" }, "ui": { - "uri": "../lib/ui/ui.dart" + "uri": "lib/ui/ui.dart" }, "js": { - "uri": "lib/js/dart2js/js_dart2js.dart" + "uri": "../dart-sdk/lib/js/dart2js/js_dart2js.dart" }, "_native_typed_data": { - "uri": "lib/_internal/js_runtime/lib/native_typed_data.dart" + "uri": "../dart-sdk/lib/_internal/js_runtime/lib/native_typed_data.dart" }, "_js_names": { - "uri": "lib/_internal/js_runtime/lib/js_names.dart" + "uri": "../dart-sdk/lib/_internal/js_runtime/lib/js_names.dart" }, "core": { - "patches": "lib/_internal/js_runtime/lib/core_patch.dart", - "uri": "lib/core/core.dart" + "patches": "../dart-sdk/lib/_internal/js_runtime/lib/core_patch.dart", + "uri": "../dart-sdk/lib/core/core.dart" }, "collection": { - "patches": "lib/_internal/js_runtime/lib/collection_patch.dart", - "uri": "lib/collection/collection.dart" + "patches": "../dart-sdk/lib/_internal/js_runtime/lib/collection_patch.dart", + "uri": "../dart-sdk/lib/collection/collection.dart" }, "js_util": { - "uri": "lib/js_util/dart2js/js_util_dart2js.dart" + "uri": "../dart-sdk/lib/js_util/dart2js/js_util_dart2js.dart" }, "typed_data": { - "patches": "lib/_internal/js_runtime/lib/typed_data_patch.dart", - "uri": "lib/typed_data/typed_data.dart" + "patches": "../dart-sdk/lib/_internal/js_runtime/lib/typed_data_patch.dart", + "uri": "../dart-sdk/lib/typed_data/typed_data.dart" }, "web_audio": { - "uri": "lib/web_audio/dart2js/web_audio_dart2js.dart" + "uri": "../dart-sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" }, "html": { - "uri": "lib/html/dart2js/html_dart2js.dart" + "uri": "../dart-sdk/lib/html/dart2js/html_dart2js.dart" }, "isolate": { - "patches": "lib/_internal/js_runtime/lib/isolate_patch.dart", + "patches": "../dart-sdk/lib/_internal/js_runtime/lib/isolate_patch.dart", "supported": false, - "uri": "lib/isolate/isolate.dart" + "uri": "../dart-sdk/lib/isolate/isolate.dart" }, "developer": { - "patches": "lib/_internal/js_runtime/lib/developer_patch.dart", - "uri": "lib/developer/developer.dart" + "patches": "../dart-sdk/lib/_internal/js_runtime/lib/developer_patch.dart", + "uri": "../dart-sdk/lib/developer/developer.dart" }, "web_gl": { - "uri": "lib/web_gl/dart2js/web_gl_dart2js.dart" + "uri": "../dart-sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" }, "indexed_db": { - "uri": "lib/indexed_db/dart2js/indexed_db_dart2js.dart" + "uri": "../dart-sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" }, "_js": { - "patches": "lib/js/_js_client.dart", - "uri": "lib/js/_js.dart" + "patches": "../dart-sdk/lib/js/_js_client.dart", + "uri": "../dart-sdk/lib/js/_js.dart" }, "convert": { - "patches": "lib/_internal/js_runtime/lib/convert_patch.dart", - "uri": "lib/convert/convert.dart" + "patches": "../dart-sdk/lib/_internal/js_runtime/lib/convert_patch.dart", + "uri": "../dart-sdk/lib/convert/convert.dart" }, "math": { - "patches": "lib/_internal/js_runtime/lib/math_patch.dart", - "uri": "lib/math/math.dart" + "patches": "../dart-sdk/lib/_internal/js_runtime/lib/math_patch.dart", + "uri": "../dart-sdk/lib/math/math.dart" }, "_foreign_helper": { - "uri": "lib/_internal/js_runtime/lib/foreign_helper.dart" + "uri": "../dart-sdk/lib/_internal/js_runtime/lib/foreign_helper.dart" }, "web_sql": { - "uri": "lib/web_sql/dart2js/web_sql_dart2js.dart" + "uri": "../dart-sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" }, "svg": { - "uri": "lib/svg/dart2js/svg_dart2js.dart" + "uri": "../dart-sdk/lib/svg/dart2js/svg_dart2js.dart" } } }, "dartdevc": { "libraries": { "async": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/async_patch.dart", - "uri": "lib/async/async.dart" + "patches": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/async_patch.dart", + "uri": "../../third_party/dart/sdk/lib/async/async.dart" }, "_runtime": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart" + "uri": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart" }, "_interceptors": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart" + "uri": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart" }, "mirrors": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/mirrors_patch.dart", + "patches": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/mirrors_patch.dart", "supported": false, - "uri": "lib/mirrors/mirrors.dart" + "uri": "../../third_party/dart/sdk/lib/mirrors/mirrors.dart" }, "_debugger": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/debugger.dart" + "uri": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/debugger.dart" }, "io": { - "patches": "io_patch.dart", + "patches": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/io_patch.dart", "supported": false, - "uri": "lib/io/io.dart" + "uri": "../../third_party/dart/sdk/lib/io/io.dart" }, "_internal": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart", - "uri": "lib/internal/internal.dart" + "patches": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart", + "uri": "../../third_party/dart/sdk/lib/internal/internal.dart" }, "_metadata": { - "uri": "lib/html/html_common/metadata.dart" + "uri": "../../third_party/dart/sdk/lib/html/html_common/metadata.dart" }, "_http": { - "uri": "lib/_http/http.dart" + "uri": "../../third_party/dart/sdk/lib/_http/http.dart" }, "_js_primitives": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_primitives.dart" + "uri": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_primitives.dart" }, "_js_helper": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart" + "uri": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart" }, "ui": { "uri": "../lib/ui/ui.dart" }, "js": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart" + "uri": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart" }, "_js_mirrors": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart" + "uri": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart" }, "html_common": { - "uri": "lib/html/html_common/html_common_dart2js.dart" + "uri": "../../third_party/dart/sdk/lib/html/html_common/html_common_dart2js.dart" }, "_native_typed_data": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/native_typed_data.dart" + "uri": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/native_typed_data.dart" }, "core": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart", - "uri": "lib/core/core.dart" + "patches": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart", + "uri": "../../third_party/dart/sdk/lib/core/core.dart" }, "js_util": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js_util/dart2js/js_util_dart2js.dart" + "uri": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js_util/dart2js/js_util_dart2js.dart" }, "collection": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart", - "uri": "lib/collection/collection.dart" + "patches": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart", + "uri": "../../third_party/dart/sdk/lib/collection/collection.dart" }, "typed_data": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/typed_data_patch.dart", - "uri": "lib/typed_data/typed_data.dart" + "patches": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/typed_data_patch.dart", + "uri": "../../third_party/dart/sdk/lib/typed_data/typed_data.dart" }, "web_audio": { - "uri": "lib/web_audio/dart2js/web_audio_dart2js.dart" + "uri": "../../third_party/dart/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" }, "html": { - "uri": "lib/html/dart2js/html_dart2js.dart" + "uri": "../../third_party/dart/sdk/lib/html/dart2js/html_dart2js.dart" }, "developer": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart", - "uri": "lib/developer/developer.dart" + "patches": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart", + "uri": "../../third_party/dart/sdk/lib/developer/developer.dart" }, "isolate": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/isolate_patch.dart", + "patches": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/isolate_patch.dart", "supported": false, - "uri": "lib/isolate/isolate.dart" + "uri": "../../third_party/dart/sdk/lib/isolate/isolate.dart" }, "web_gl": { - "uri": "lib/web_gl/dart2js/web_gl_dart2js.dart" + "uri": "../../third_party/dart/sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" }, "indexed_db": { - "uri": "lib/indexed_db/dart2js/indexed_db_dart2js.dart" + "uri": "../../third_party/dart/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" }, "convert": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/convert_patch.dart", - "uri": "lib/convert/convert.dart" + "patches": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/convert_patch.dart", + "uri": "../../third_party/dart/sdk/lib/convert/convert.dart" }, "_isolate_helper": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart" + "uri": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart" }, "math": { - "patches": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart", - "uri": "lib/math/math.dart" + "patches": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart", + "uri": "../../third_party/dart/sdk/lib/math/math.dart" }, "_foreign_helper": { - "uri": "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/foreign_helper.dart" + "uri": "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/foreign_helper.dart" }, "web_sql": { - "uri": "lib/web_sql/dart2js/web_sql_dart2js.dart" + "uri": "../../third_party/dart/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" }, "svg": { - "uri": "lib/svg/dart2js/svg_dart2js.dart" + "uri": "../../third_party/dart/sdk/lib/svg/dart2js/svg_dart2js.dart" } } } diff --git a/web_sdk/libraries.yaml b/web_sdk/libraries.yaml index 2516e18d4fdbf..56e100b6c11ad 100644 --- a/web_sdk/libraries.yaml +++ b/web_sdk/libraries.yaml @@ -2,10 +2,12 @@ # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. +# This libraries file is only used for building the ddc kernel. +# # Note: if you edit this file, you must also edit libraries.json in this # directory: # -#. python third_party/dart/tools/yaml2json.py flutter/lib/snapshot/libraries.yaml flutter/lib/snapshot/libraries.json +#. python third_party/dart/tools/yaml2json.py flutter/web_sdk/libraries.yaml flutter/web_sdk/libraries.json # # We currently have several different files that needs to be updated when # changing libraries, sources, and patch files. See @@ -14,111 +16,111 @@ dartdevc: libraries: _runtime: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart" + uri: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart" _debugger: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/debugger.dart" + uri: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/debugger.dart" _foreign_helper: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/foreign_helper.dart" + uri: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/foreign_helper.dart" _http: - uri: "lib/_http/http.dart" + uri: "../../third_party/dart/sdk/lib/_http/http.dart" _interceptors: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart" + uri: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart" _internal: - uri: "lib/internal/internal.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart" + uri: "../../third_party/dart/sdk/lib/internal/internal.dart" + patches: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart" _isolate_helper: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart" + uri: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart" _js_helper: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart" + uri: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart" _js_mirrors: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart" + uri: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart" _js_primitives: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_primitives.dart" + uri: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/js_primitives.dart" _metadata: - uri: "lib/html/html_common/metadata.dart" + uri: "../../third_party/dart/sdk/lib/html/html_common/metadata.dart" _native_typed_data: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/native_typed_data.dart" + uri: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/private/native_typed_data.dart" async: - uri: "lib/async/async.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/async_patch.dart" + uri: "../../third_party/dart/sdk/lib/async/async.dart" + patches: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/async_patch.dart" collection: - uri: "lib/collection/collection.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart" + uri: "../../third_party/dart/sdk/lib/collection/collection.dart" + patches: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/collection_patch.dart" convert: - uri: "lib/convert/convert.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/convert_patch.dart" + uri: "../../third_party/dart/sdk/lib/convert/convert.dart" + patches: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/convert_patch.dart" core: - uri: "lib/core/core.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart" + uri: "../../third_party/dart/sdk/lib/core/core.dart" + patches: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart" developer: - uri: "lib/developer/developer.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart" + uri: "../../third_party/dart/sdk/lib/developer/developer.dart" + patches: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart" io: - uri: "lib/io/io.dart" - patches: "io_patch.dart" + uri: "../../third_party/dart/sdk/lib/io/io.dart" + patches: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/io_patch.dart" supported: false isolate: - uri: "lib/isolate/isolate.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/isolate_patch.dart" + uri: "../../third_party/dart/sdk/lib/isolate/isolate.dart" + patches: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/isolate_patch.dart" supported: false mirrors: - uri: "lib/mirrors/mirrors.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/mirrors_patch.dart" + uri: "../../third_party/dart/sdk/lib/mirrors/mirrors.dart" + patches: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/mirrors_patch.dart" supported: false math: - uri: "lib/math/math.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart" + uri: "../../third_party/dart/sdk/lib/math/math.dart" + patches: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart" typed_data: - uri: "lib/typed_data/typed_data.dart" - patches: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/typed_data_patch.dart" + uri: "../../third_party/dart/sdk/lib/typed_data/typed_data.dart" + patches: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/patch/typed_data_patch.dart" html: - uri: "lib/html/dart2js/html_dart2js.dart" + uri: "../../third_party/dart/sdk/lib/html/dart2js/html_dart2js.dart" html_common: - uri: "lib/html/html_common/html_common_dart2js.dart" + uri: "../../third_party/dart/sdk/lib/html/html_common/html_common_dart2js.dart" indexed_db: - uri: "lib/indexed_db/dart2js/indexed_db_dart2js.dart" + uri: "../../third_party/dart/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" js: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart" + uri: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart" js_util: - uri: "../../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js_util/dart2js/js_util_dart2js.dart" + uri: "../../third_party/dart/pkg/dev_compiler/tool/input_sdk/lib/js_util/dart2js/js_util_dart2js.dart" svg: - uri: "lib/svg/dart2js/svg_dart2js.dart" + uri: "../../third_party/dart/sdk/lib/svg/dart2js/svg_dart2js.dart" web_audio: - uri: "lib/web_audio/dart2js/web_audio_dart2js.dart" + uri: "../../third_party/dart/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" web_gl: - uri: "lib/web_gl/dart2js/web_gl_dart2js.dart" + uri: "../../third_party/dart/sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" web_sql: - uri: "lib/web_sql/dart2js/web_sql_dart2js.dart" + uri: "../../third_party/dart/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" ui: uri: "../lib/ui/ui.dart" @@ -126,115 +128,115 @@ dartdevc: dart2js: libraries: ui: - uri: "../lib/ui/ui.dart" + uri: "lib/ui/ui.dart" async: - uri: "lib/async/async.dart" - patches: "lib/_internal/js_runtime/lib/async_patch.dart" + uri: "../dart-sdk/lib/async/async.dart" + patches: "../dart-sdk/lib/_internal/js_runtime/lib/async_patch.dart" _chrome: - uri: "lib/_chrome/dart2js/chrome_dart2js.dart" + uri: "../dart-sdk/lib/_chrome/dart2js/chrome_dart2js.dart" collection: - uri: "lib/collection/collection.dart" - patches: "lib/_internal/js_runtime/lib/collection_patch.dart" + uri: "../dart-sdk/lib/collection/collection.dart" + patches: "../dart-sdk/lib/_internal/js_runtime/lib/collection_patch.dart" convert: - uri: "lib/convert/convert.dart" - patches: "lib/_internal/js_runtime/lib/convert_patch.dart" + uri: "../dart-sdk/lib/convert/convert.dart" + patches: "../dart-sdk/lib/_internal/js_runtime/lib/convert_patch.dart" core: - uri: "lib/core/core.dart" - patches: "lib/_internal/js_runtime/lib/core_patch.dart" + uri: "../dart-sdk/lib/core/core.dart" + patches: "../dart-sdk/lib/_internal/js_runtime/lib/core_patch.dart" developer: - uri: "lib/developer/developer.dart" - patches: "lib/_internal/js_runtime/lib/developer_patch.dart" + uri: "../dart-sdk/lib/developer/developer.dart" + patches: "../dart-sdk/lib/_internal/js_runtime/lib/developer_patch.dart" html: - uri: "lib/html/dart2js/html_dart2js.dart" + uri: "../dart-sdk/lib/html/dart2js/html_dart2js.dart" html_common: - uri: "lib/html/html_common/html_common_dart2js.dart" + uri: "../dart-sdk/lib/html/html_common/html_common_dart2js.dart" indexed_db: - uri: "lib/indexed_db/dart2js/indexed_db_dart2js.dart" + uri: "../dart-sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart" _http: - uri: "lib/_http/http.dart" + uri: "../dart-sdk/lib/_http/http.dart" io: - uri: "lib/io/io.dart" + uri: "../dart-sdk/lib/io/io.dart" patches: "io_patch.dart" supported: false isolate: - uri: "lib/isolate/isolate.dart" - patches: "lib/_internal/js_runtime/lib/isolate_patch.dart" + uri: "../dart-sdk/lib/isolate/isolate.dart" + patches: "../dart-sdk/lib/_internal/js_runtime/lib/isolate_patch.dart" supported: false js: - uri: "lib/js/dart2js/js_dart2js.dart" + uri: "../dart-sdk/lib/js/dart2js/js_dart2js.dart" _js: - uri: "lib/js/_js.dart" - patches: "lib/js/_js_client.dart" + uri: "../dart-sdk/lib/js/_js.dart" + patches: "../dart-sdk/lib/js/_js_client.dart" js_util: - uri: "lib/js_util/dart2js/js_util_dart2js.dart" + uri: "../dart-sdk/lib/js_util/dart2js/js_util_dart2js.dart" math: - uri: "lib/math/math.dart" - patches: "lib/_internal/js_runtime/lib/math_patch.dart" + uri: "../dart-sdk/lib/math/math.dart" + patches: "../dart-sdk/lib/_internal/js_runtime/lib/math_patch.dart" mirrors: - uri: "lib/mirrors/mirrors.dart" - patches: "lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart" + uri: "../dart-sdk/lib/mirrors/mirrors.dart" + patches: "../dart-sdk/lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart" supported: false typed_data: - uri: "lib/typed_data/typed_data.dart" - patches: "lib/_internal/js_runtime/lib/typed_data_patch.dart" + uri: "../dart-sdk/lib/typed_data/typed_data.dart" + patches: "../dart-sdk/lib/_internal/js_runtime/lib/typed_data_patch.dart" _native_typed_data: - uri: "lib/_internal/js_runtime/lib/native_typed_data.dart" + uri: "../dart-sdk/lib/_internal/js_runtime/lib/native_typed_data.dart" svg: - uri: "lib/svg/dart2js/svg_dart2js.dart" + uri: "../dart-sdk/lib/svg/dart2js/svg_dart2js.dart" web_audio: - uri: "lib/web_audio/dart2js/web_audio_dart2js.dart" + uri: "../dart-sdk/lib/web_audio/dart2js/web_audio_dart2js.dart" web_gl: - uri: "lib/web_gl/dart2js/web_gl_dart2js.dart" + uri: "../dart-sdk/lib/web_gl/dart2js/web_gl_dart2js.dart" web_sql: - uri: "lib/web_sql/dart2js/web_sql_dart2js.dart" + uri: "../dart-sdk/lib/web_sql/dart2js/web_sql_dart2js.dart" _internal: - uri: "lib/internal/internal.dart" - patches: "lib/_internal/js_runtime/lib/internal_patch.dart" + uri: "../dart-sdk/lib/internal/internal.dart" + patches: "../dart-sdk/lib/_internal/js_runtime/lib/internal_patch.dart" _js_helper: - uri: "lib/_internal/js_runtime/lib/js_helper.dart" + uri: "../dart-sdk/lib/_internal/js_runtime/lib/js_helper.dart" _interceptors: - uri: "lib/_internal/js_runtime/lib/interceptors.dart" + uri: "../dart-sdk/lib/_internal/js_runtime/lib/interceptors.dart" _foreign_helper: - uri: "lib/_internal/js_runtime/lib/foreign_helper.dart" + uri: "../dart-sdk/lib/_internal/js_runtime/lib/foreign_helper.dart" _js_names: - uri: "lib/_internal/js_runtime/lib/js_names.dart" + uri: "../dart-sdk/lib/_internal/js_runtime/lib/js_names.dart" _js_primitives: - uri: "lib/_internal/js_runtime/lib/js_primitives.dart" + uri: "../dart-sdk/lib/_internal/js_runtime/lib/js_primitives.dart" _js_embedded_names: - uri: "lib/_internal/js_runtime/lib/shared/embedded_names.dart" + uri: "../dart-sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart" _async_await_error_codes: - uri: "lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart" + uri: "../dart-sdk/lib/_internal/js_runtime/lib/shared/async_await_error_codes.dart" _metadata: - uri: "lib/html/html_common/metadata.dart" \ No newline at end of file + uri: "../dart-sdk/lib/html/html_common/metadata.dart" \ No newline at end of file From 8818a6c4188ed330d363db8bd5eabb606429a287 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 18 Mar 2019 15:35:14 -0400 Subject: [PATCH 0479/1117] Roll src/third_party/skia 2c043c288169..4a522b7e916c (3 commits) (#8201) https://skia.googlesource.com/skia.git/%2Blog/2c043c288169..4a522b7e916c git log 2c043c28816981f4002e72a12d7ec446672aeb1c..4a522b7e916c85c53df9d21351652857e3ff2512 --date=short --no-merges --format=%ad %ae %s 2019-03-18 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader c2bb50b73101..00424c1bc233 (1 commits) 2019-03-18 yikong@google.com [Android] Do not build for Windows 2019-03-18 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 62758f581672..c2bb50b73101 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 6a2ffd4f37f84..48326a25e05d8 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': '2c043c28816981f4002e72a12d7ec446672aeb1c', + 'skia_revision': '4a522b7e916c85c53df9d21351652857e3ff2512', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 0f1a4f155a80b..cdd4d31d3e33b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: a3c1d11b2ee8f43fdf008204a0b26395 +Signature: aa6c73966a5ec1867116b4523182926d UNUSED LICENSES: From 5088735e5f54f7fb34215b6665cb4da1fd8f075d Mon Sep 17 00:00:00 2001 From: liyuqian Date: Mon, 18 Mar 2019 12:43:41 -0700 Subject: [PATCH 0480/1117] Clip to clip_rect instead of paint bounds (#8183) Otherwise, we'll have issues such as https://github.com/flutter/flutter/issues/29070 The engine roll that includes this PR needs a tiny golden image update. Will do a manual roll. --- flow/layers/clip_rect_layer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flow/layers/clip_rect_layer.cc b/flow/layers/clip_rect_layer.cc index 9e4d06df8b18e..73c76bff33118 100644 --- a/flow/layers/clip_rect_layer.cc +++ b/flow/layers/clip_rect_layer.cc @@ -48,10 +48,10 @@ void ClipRectLayer::Paint(PaintContext& context) const { FML_DCHECK(needs_painting()); SkAutoCanvasRestore save(context.internal_nodes_canvas, true); - context.internal_nodes_canvas->clipRect(paint_bounds(), + context.internal_nodes_canvas->clipRect(clip_rect_, clip_behavior_ != Clip::hardEdge); if (clip_behavior_ == Clip::antiAliasWithSaveLayer) { - context.internal_nodes_canvas->saveLayer(paint_bounds(), nullptr); + context.internal_nodes_canvas->saveLayer(clip_rect_, nullptr); } PaintChildren(context); if (clip_behavior_ == Clip::antiAliasWithSaveLayer) { From 629072277dc73e0628afab7ba7142f7d582996ad Mon Sep 17 00:00:00 2001 From: Amir Hardon Date: Mon, 18 Mar 2019 14:13:30 -0700 Subject: [PATCH 0481/1117] Merge only gpu and platform threads for platform views, fix deadlock. (#8045) The reason we didn't merge just the gpu and platform threads from the get go was a deadlock in Shell:OnPlatformViewCreated and Shell:OnPlatformViewDestroyed. The deadlock was caused by the platform thread starting a thread-hopping flow that ends ends up with the gpu thread releasing a latch that the platform thread is waiting on just after starting the cross-thread dance. If the platform and gpu threads are the same, that last task that is posted to the gpu thread will never get executed as the gpu/platform thread is blocked on a latch. This works around the deadlock by having a special case in the code for the scenario where the gpu and platform threads are the same. Fixes: flutter/flutter#23974 --- shell/common/shell.cc | 60 +++++++++++++++++-- shell/common/shell_unittests.cc | 2 +- .../ios/framework/Source/FlutterEngine.mm | 10 ++-- 3 files changed, 61 insertions(+), 11 deletions(-) diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 3c43ef2d12f50..6ba709e879f19 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -437,16 +437,35 @@ void Shell::OnPlatformViewCreated(std::unique_ptr surface) { latch.Signal(); }); + // The normal flow exectued by this method is that the platform thread is + // starting the sequence and waiting on the latch. Later the UI thread posts + // gpu_task to the GPU thread which signals the latch. If the GPU the and + // platform threads are the same this results in a deadlock as the gpu_task + // will never be posted to the plaform/gpu thread that is blocked on a latch. + // To avoid the described deadlock, if the gpu and the platform threads are + // the same, should_post_gpu_task will be false, and then instead of posting a + // task to the gpu thread, the ui thread just signals the latch and the + // platform/gpu thread follows with executing gpu_task. + bool should_post_gpu_task = + task_runners_.GetGPUTaskRunner() != task_runners_.GetPlatformTaskRunner(); + auto ui_task = [engine = engine_->GetWeakPtr(), // gpu_task_runner = task_runners_.GetGPUTaskRunner(), // - gpu_task // + gpu_task, should_post_gpu_task, + &latch // ] { if (engine) { engine->OnOutputSurfaceCreated(); } // Step 2: Next, tell the GPU thread that it should create a surface for its // rasterizer. - fml::TaskRunner::RunNowOrPostTask(gpu_task_runner, gpu_task); + if (should_post_gpu_task) { + fml::TaskRunner::RunNowOrPostTask(gpu_task_runner, gpu_task); + } else { + // See comment on should_post_gpu_task, in this case we just unblock + // the platform thread. + latch.Signal(); + } }; // Threading: Capture platform view by raw pointer and not the weak pointer. @@ -471,6 +490,12 @@ void Shell::OnPlatformViewCreated(std::unique_ptr surface) { fml::TaskRunner::RunNowOrPostTask(task_runners_.GetIOTaskRunner(), io_task); latch.Wait(); + if (!should_post_gpu_task) { + // See comment on should_post_gpu_task, in this case the gpu_task + // wasn't executed, and we just run it here as the platform thread + // is the GPU thread. + gpu_task(); + } } // |shell::PlatformView::Delegate| @@ -504,21 +529,46 @@ void Shell::OnPlatformViewDestroyed() { fml::TaskRunner::RunNowOrPostTask(io_task_runner, io_task); }; + // The normal flow exectued by this method is that the platform thread is + // starting the sequence and waiting on the latch. Later the UI thread posts + // gpu_task to the GPU thread triggers signaling the latch(on the IO thread). + // If the GPU the and platform threads are the same this results in a deadlock + // as the gpu_task will never be posted to the plaform/gpu thread that is + // blocked on a latch. To avoid the described deadlock, if the gpu and the + // platform threads are the same, should_post_gpu_task will be false, and then + // instead of posting a task to the gpu thread, the ui thread just signals the + // latch and the platform/gpu thread follows with executing gpu_task. + bool should_post_gpu_task = + task_runners_.GetGPUTaskRunner() != task_runners_.GetPlatformTaskRunner(); + auto ui_task = [engine = engine_->GetWeakPtr(), - gpu_task_runner = task_runners_.GetGPUTaskRunner(), - gpu_task]() { + gpu_task_runner = task_runners_.GetGPUTaskRunner(), gpu_task, + should_post_gpu_task, &latch]() { if (engine) { engine->OnOutputSurfaceDestroyed(); } // Step 1: Next, tell the GPU thread that its rasterizer should suspend // access to the underlying surface. - fml::TaskRunner::RunNowOrPostTask(gpu_task_runner, gpu_task); + if (should_post_gpu_task) { + fml::TaskRunner::RunNowOrPostTask(gpu_task_runner, gpu_task); + } else { + // See comment on should_post_gpu_task, in this case we just unblock + // the platform thread. + latch.Signal(); + } }; // Step 0: Post a task onto the UI thread to tell the engine that its output // surface is about to go away. fml::TaskRunner::RunNowOrPostTask(task_runners_.GetUITaskRunner(), ui_task); latch.Wait(); + if (!should_post_gpu_task) { + // See comment on should_post_gpu_task, in this case the gpu_task + // wasn't executed, and we just run it here as the platform thread + // is the GPU thread. + gpu_task(); + latch.Wait(); + } } // |shell::PlatformView::Delegate| diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc index 9e09bbc6366a2..85c6b7962ae55 100644 --- a/shell/common/shell_unittests.cc +++ b/shell/common/shell_unittests.cc @@ -193,7 +193,7 @@ TEST(ShellTest, InitializeWithMultipleThreadButCallingThreadAsPlatformThread) { // 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) { +TEST(ShellTest, InitializeWithGPUAndPlatformThreadsTheSame) { blink::Settings settings = {}; settings.task_observer_add = [](intptr_t, fml::closure) {}; settings.task_observer_remove = [](intptr_t) {}; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm index a90e49c7085fa..00fead7de304c 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -355,16 +355,16 @@ - (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI { // 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 + // For now we use a fixed thread configuration with the same thread used as the + // gpu and platform task runner. // 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 + _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 From 568841923653c9048fbae97eac7e269d32ebf2e7 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 18 Mar 2019 15:33:06 -0700 Subject: [PATCH 0482/1117] Disable build_ios due to large queue times. (#8204) --- .cirrus.yml | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 2492afbd0fbf4..cc6796b3faf69 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -60,39 +60,6 @@ task: mkdir javadoc_tmp ./flutter/tools/gen_javadoc.py --out-dir javadoc_tmp -task: - name: build_ios - use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' - osx_instance: - image: high-sierra-xcode-9.4.1 - env: - CIRRUS_WORKING_DIR: "/tmp/github_repo" - ENGINE_PATH: "/tmp/engine" - DEPOT_TOOLS: "/tmp/depot_tools" - PATH: "$DEPOT_TOOLS:$PATH" - depot_tools_script: - git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS - # jazzy_script: - # sudo gem install jazzy@0.9.4 - gclient_sync_script: | - mkdir -p $ENGINE_PATH/src - echo 'solutions = [{"managed": False,"name": "src/flutter","url": "git@github.com:flutter/engine.git","deps_file": "DEPS", "custom_vars": {"download_android_deps" : False, "download_windows_deps" : False,},},]' > $ENGINE_PATH/.gclient - cd $ENGINE_PATH/src - rm -rf flutter - rm -rf out - mv $CIRRUS_WORKING_DIR flutter - gclient sync - compile_host_script: | - cd $ENGINE_PATH/src - ./flutter/tools/gn --ios --unoptimized - ninja -C out/ios_debug_unopt - # TODO(dnfield): when we can install jazzy properly, we should do this. - # AFAICT we can't because of Xcode version. - # mkdir objcdoc_tmp - # pushd flutter - # ./tools/gen_objcdoc.sh ../objcdoc_tmp - # popd - format_and_dart_test_task: container: image: gcr.io/flutter-cirrus/build-engine-image:latest From 6980a83563146edb3c8b6017f7a629aa3f3e9a4c Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Mon, 18 Mar 2019 15:38:40 -0700 Subject: [PATCH 0483/1117] [platform_view] iOSP platformView composition optimize. (#8202) Optimize the performance of the platform view composition. When recomposition is required, we previously remove all the platform view related views (intercepting view, platform view) and re-add them for each frame. This is mentioned in flutter/flutter#23793. This PR enhanced the performance by re-arrange the existing UIViews and only add the newly created Views. As a result, it would also fix flutter/flutter#29427 --- .../framework/Source/FlutterPlatformViews.mm | 41 +++++++++++++------ .../Source/FlutterPlatformViews_Internal.h | 1 + 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm index fddc75fa541a0..82659b4fe2481 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm @@ -225,22 +225,24 @@ composition_order_.clear(); return did_submit; } + DetachUnusedLayers(); + active_composition_order_.clear(); 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()]; + UIView* intercepter = touch_interceptors_[view_id].get(); + UIView* overlay = overlays_[view_id]->overlay_view; + FML_CHECK(intercepter.superview == overlay.superview); + + if (intercepter.superview == flutter_view) { + [flutter_view bringSubviewToFront:intercepter]; + [flutter_view bringSubviewToFront:overlay]; + } else { + [flutter_view addSubview:intercepter]; + [flutter_view addSubview:overlay]; + } + active_composition_order_.push_back(view_id); } @@ -248,6 +250,21 @@ return did_submit; } +void FlutterPlatformViewsController::DetachUnusedLayers() { + std::unordered_set composition_order_set; + + for (int64_t view_id : composition_order_) { + composition_order_set.insert(view_id); + } + + for (int64_t view_id : active_composition_order_) { + if (composition_order_set.find(view_id) == composition_order_set.end()) { + [touch_interceptors_[view_id].get() removeFromSuperview]; + [overlays_[view_id]->overlay_view.get() removeFromSuperview]; + } + } +} + void FlutterPlatformViewsController::EnsureOverlayInitialized(int64_t overlay_id) { if (overlays_.count(overlay_id) != 0) { return; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h index a89a2ff9bc3f3..118822c3b7962 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h @@ -98,6 +98,7 @@ class FlutterPlatformViewsController { void OnAcceptGesture(FlutterMethodCall* call, FlutterResult& result); void OnRejectGesture(FlutterMethodCall* call, FlutterResult& result); + void DetachUnusedLayers(); void EnsureOverlayInitialized(int64_t overlay_id); void EnsureGLOverlayInitialized(int64_t overlay_id, std::shared_ptr gl_context, From ad5b722a722394008195d46c173990217f8c7f88 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 18 Mar 2019 15:49:16 -0700 Subject: [PATCH 0484/1117] Simplify the fallback waiter and add traces for vsync scheduling overhead. (#8185) --- fml/trace_event.cc | 29 ++++++++++++++++++++++++++ fml/trace_event.h | 5 +++++ shell/common/vsync_waiter.cc | 24 ++++++++++++++++++++- shell/common/vsync_waiter.h | 3 ++- shell/common/vsync_waiter_fallback.cc | 30 ++++++++++----------------- shell/common/vsync_waiter_fallback.h | 1 - 6 files changed, 70 insertions(+), 22 deletions(-) diff --git a/fml/trace_event.cc b/fml/trace_event.cc index 843aa6b6d5b92..826e37f189eca 100644 --- a/fml/trace_event.cc +++ b/fml/trace_event.cc @@ -6,6 +6,7 @@ #include #include +#include #include "flutter/fml/build_config.h" #include "flutter/fml/logging.h" @@ -124,6 +125,34 @@ void TraceEventEnd(TraceArg name) { ); } +void TraceEventAsyncComplete(TraceArg category_group, + TraceArg name, + TimePoint begin, + TimePoint end) { + auto identifier = TraceNonce(); + + if (begin > end) { + std::swap(begin, end); + } + + Dart_TimelineEvent(DCHECK_LITERAL(name), // label + begin.ToEpochDelta().ToMicroseconds(), // timestamp0 + identifier, // timestamp1_or_async_id + Dart_Timeline_Event_Async_Begin, // event type + 0, // argument_count + nullptr, // argument_names + nullptr // argument_values + ); + Dart_TimelineEvent(DCHECK_LITERAL(name), // label + end.ToEpochDelta().ToMicroseconds(), // timestamp0 + identifier, // timestamp1_or_async_id + Dart_Timeline_Event_Async_End, // event type + 0, // argument_count + nullptr, // argument_names + nullptr // argument_values + ); +} + void TraceEventAsyncBegin0(TraceArg category_group, TraceArg name, TraceIDArg id) { diff --git a/fml/trace_event.h b/fml/trace_event.h index 45221a09c4108..b3a58a04d6ef9 100644 --- a/fml/trace_event.h +++ b/fml/trace_event.h @@ -193,6 +193,11 @@ void TraceEvent2(TraceArg category_group, void TraceEventEnd(TraceArg name); +void TraceEventAsyncComplete(TraceArg category_group, + TraceArg name, + TimePoint begin, + TimePoint end); + void TraceEventAsyncBegin0(TraceArg category_group, TraceArg name, TraceIDArg id); diff --git a/shell/common/vsync_waiter.cc b/shell/common/vsync_waiter.cc index b6b55df11b227..87ead7cc205cf 100644 --- a/shell/common/vsync_waiter.cc +++ b/shell/common/vsync_waiter.cc @@ -28,9 +28,23 @@ VsyncWaiter::VsyncWaiter(blink::TaskRunners task_runners) VsyncWaiter::~VsyncWaiter() = default; +// Public method invoked by the animator. void VsyncWaiter::AsyncWaitForVsync(Callback callback) { + if (!callback) { + return; + } + + TRACE_EVENT0("flutter", "AsyncWaitForVsync"); + { std::lock_guard lock(callback_mutex_); + if (callback_) { + // The animator may request a frame more than once within a frame + // interval. Multiple calls to request frame must result in a single + // callback per frame interval. + TRACE_EVENT_INSTANT0("flutter", "MultipleCallsToVsyncInFrameInterval"); + return; + } callback_ = std::move(callback); } AwaitVSync(); @@ -46,6 +60,10 @@ void VsyncWaiter::FireCallback(fml::TimePoint frame_start_time, } if (!callback) { + // This means that the vsync waiter implementation fired a callback for a + // request we did not make. This is a paranoid check but we still want to + // make sure we catch misbehaving vsync implementations. + TRACE_EVENT_INSTANT0("flutter", "MismatchedFrameCallback"); return; } @@ -56,14 +74,18 @@ void VsyncWaiter::FireCallback(fml::TimePoint frame_start_time, // While all our message loops insert a base trace trace // (MessageLoop::RunExpiredTasks), embedders may not. TRACE_EVENT0("flutter", "VsyncFireCallback"); + TRACE_FLOW_BEGIN("flutter", kVsyncFlowName, flow_identifier); task_runners_.GetUITaskRunner()->PostTaskForTime( [callback, flow_identifier, frame_start_time, frame_target_time]() { FML_TRACE_EVENT("flutter", kVsyncTraceName, "StartTime", frame_start_time, "TargetTime", frame_target_time); - TRACE_FLOW_END("flutter", kVsyncFlowName, flow_identifier); + fml::tracing::TraceEventAsyncComplete( + "flutter", "VsyncSchedulingOverhead", fml::TimePoint::Now(), + frame_start_time); callback(frame_start_time, frame_target_time); + TRACE_FLOW_END("flutter", kVsyncFlowName, flow_identifier); }, frame_start_time); } diff --git a/shell/common/vsync_waiter.h b/shell/common/vsync_waiter.h index 4c6251da8e277..afb7d3cd36b72 100644 --- a/shell/common/vsync_waiter.h +++ b/shell/common/vsync_waiter.h @@ -10,6 +10,7 @@ #include #include "flutter/common/task_runners.h" +#include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/time/time_point.h" namespace shell { @@ -50,7 +51,7 @@ class VsyncWaiter : public std::enable_shared_from_this { private: std::mutex callback_mutex_; - Callback callback_; + Callback callback_ FML_GUARDED_BY(callback_mutex_); FML_DISALLOW_COPY_AND_ASSIGN(VsyncWaiter); }; diff --git a/shell/common/vsync_waiter_fallback.cc b/shell/common/vsync_waiter_fallback.cc index a768380c4314b..602770ba677ff 100644 --- a/shell/common/vsync_waiter_fallback.cc +++ b/shell/common/vsync_waiter_fallback.cc @@ -9,9 +9,9 @@ namespace shell { namespace { -fml::TimePoint SnapToNextTick(fml::TimePoint value, - fml::TimePoint tick_phase, - fml::TimeDelta tick_interval) { +static fml::TimePoint SnapToNextTick(fml::TimePoint value, + fml::TimePoint tick_phase, + fml::TimeDelta tick_interval) { fml::TimeDelta offset = (tick_phase - value) % tick_interval; if (offset != fml::TimeDelta::Zero()) offset = offset + tick_interval; @@ -21,27 +21,19 @@ fml::TimePoint SnapToNextTick(fml::TimePoint value, } // namespace VsyncWaiterFallback::VsyncWaiterFallback(blink::TaskRunners task_runners) - : VsyncWaiter(std::move(task_runners)), - phase_(fml::TimePoint::Now()), - weak_factory_(this) {} + : VsyncWaiter(std::move(task_runners)), phase_(fml::TimePoint::Now()) {} VsyncWaiterFallback::~VsyncWaiterFallback() = default; -constexpr fml::TimeDelta interval = fml::TimeDelta::FromSecondsF(1.0 / 60.0); - // |shell::VsyncWaiter| void VsyncWaiterFallback::AwaitVSync() { - fml::TimePoint now = fml::TimePoint::Now(); - fml::TimePoint next = SnapToNextTick(now, phase_, interval); - - task_runners_.GetUITaskRunner()->PostDelayedTask( - [self = weak_factory_.GetWeakPtr()] { - if (self) { - const auto frame_time = fml::TimePoint::Now(); - self->FireCallback(frame_time, frame_time + interval); - } - }, - next - now); + constexpr fml::TimeDelta kSingleFrameInterval = + fml::TimeDelta::FromSecondsF(1.0 / 60.0); + + auto next = + SnapToNextTick(fml::TimePoint::Now(), phase_, kSingleFrameInterval); + + FireCallback(next, next + kSingleFrameInterval); } } // namespace shell diff --git a/shell/common/vsync_waiter_fallback.h b/shell/common/vsync_waiter_fallback.h index 92930ee192c61..b3ab8db9f43f2 100644 --- a/shell/common/vsync_waiter_fallback.h +++ b/shell/common/vsync_waiter_fallback.h @@ -20,7 +20,6 @@ class VsyncWaiterFallback final : public VsyncWaiter { private: fml::TimePoint phase_; - fml::WeakPtrFactory weak_factory_; // |shell::VsyncWaiter| void AwaitVSync() override; From 71e2d7d8c0f5a3d6596e8fc68c0a8a42cbddc812 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 18 Mar 2019 19:05:12 -0400 Subject: [PATCH 0485/1117] Roll src/third_party/skia 4a522b7e916c..389b4b267d15 (32 commits) (#8205) https://skia.googlesource.com/skia.git/%2Blog/4a522b7e916c..389b4b267d15 git log 4a522b7e916c85c53df9d21351652857e3ff2512..389b4b267d15c1e06cc4d8b2222d96e50e6ddb00 --date=short --no-merges --format=%ad %ae %s 2019-03-18 brianosman@google.com Fix the preallocated size of string arrays in GrGLSLShaderBuilder 2019-03-18 halcanary@google.com Docs: Give documentation examples better names 2019-03-18 kjlubick@google.com Add SkSL2Pipeline fuzzer 2019-03-18 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 1bd9e2f80b9a..bbf5cf1e4762 (1 commits) 2019-03-18 brianosman@google.com Remove unused variant of compileAndAttachShaders 2019-03-18 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-18 mtklein@google.com SkScan_AAAPath style and refactoring 2019-03-18 jvanverth@google.com Fix more failing tests on Metal. 2019-03-18 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 1cef4e693fc3..1bd9e2f80b9a (1 commits) 2019-03-15 khushalsagar@chromium.org remote fonts: Make DiscardableManager for tests thread-safe. 2019-03-08 bsalomon@google.com Revert "Revert "Change promise image contract to for when Release and Done are called."" 2019-03-18 benjaminwagner@google.com Revert "Omit some SKPs that seem to cause GalaxyS9 to crash." 2019-03-18 kjlubick@google.com Break out GrGLAssembleInterface into a few files 2019-03-18 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-18 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 38e282570676..cda4383919b9 (1 commits) 2019-03-18 mtklein@google.com don't bother passing lowp kernels dummy unnamed variables 2019-03-18 mtklein@google.com limit n7/np to main thread 2019-03-18 bsalomon@google.com Revert "Add small offset to t in GrLinearGradientLayout." 2019-03-18 robertphillips@google.com Mark tmp path in shadow utils as volatile 2019-03-18 mtklein@google.com shard failing bots 2019-03-18 mtklein@google.com rework --ignoreSigInt 2019-03-18 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 036614c8468c..1cef4e693fc3 (1 commits) 2019-03-18 csmartdalton@google.com Reland "Disable coverage counting by default" 2019-03-18 csmartdalton@google.com Revert "Disable coverage counting by default" 2019-03-18 kjlubick@google.com [canvaskit] Various cleanups around docs/build 2019-03-18 robertphillips@google.com Unblock Flutter 2019-03-18 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src ad85caa87461..69be71e10036 (116 commits) 2019-03-18 brianosman@google.com Suppress /RTCc error about losing information during case to smaller type 2019-03-13 bsalomon@google.com Add small offset to t in GrLinearGradientLayout. 2019-03-18 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 00424c1bc233..036614c8468c (2 commits) 2019-03-18 borenet@google.com [infra] Add some logging to go_deps asset creation 2019-03-18 brianosman@google.com Delay half-float vertex color determination until Op::finalize The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 53 +++++--------------------------- 2 files changed, 8 insertions(+), 47 deletions(-) diff --git a/DEPS b/DEPS index 48326a25e05d8..d988130830c2e 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': '4a522b7e916c85c53df9d21351652857e3ff2512', + 'skia_revision': '389b4b267d15c1e06cc4d8b2222d96e50e6ddb00', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index cdd4d31d3e33b..541ac47398145 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: aa6c73966a5ec1867116b4523182926d +Signature: 7bd6f84ef1b06ea794bfafa29dbf8044 UNUSED LICENSES: @@ -2241,7 +2241,6 @@ FILE: ../../../third_party/skia/infra/bots/recipes/compute_test.expected/Test-De 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 -FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Android-Clang-GalaxyS9-GPU-MaliG72-arm64-Debug-All-Android_Vulkan.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus5-GPU-Adreno330-arm-Debug-All-Android.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Release-All-Android_NoGPUThreads.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-ChromeOS-Clang-ASUSChromebookFlipC100-GPU-MaliT764-arm-Release-All.json @@ -2382,6 +2381,7 @@ FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/NotoSerif-Regular.tt FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/Roboto-Regular.ttf FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/Roboto-Regular.woff FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/example.html +FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/extra.html FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/node.example.js FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/package.json FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/test.png @@ -4942,7 +4942,6 @@ FILE: ../../../third_party/skia/docs/examples/Canvas_092.cpp FILE: ../../../third_party/skia/docs/examples/Canvas_093.cpp FILE: ../../../third_party/skia/docs/examples/Canvas_094.cpp FILE: ../../../third_party/skia/docs/examples/Canvas_095.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_096.cpp FILE: ../../../third_party/skia/docs/examples/Canvas_097.cpp FILE: ../../../third_party/skia/docs/examples/Canvas_098.cpp FILE: ../../../third_party/skia/docs/examples/Canvas_099.cpp @@ -4959,7 +4958,6 @@ FILE: ../../../third_party/skia/docs/examples/Canvas_109.cpp FILE: ../../../third_party/skia/docs/examples/Canvas_110.cpp FILE: ../../../third_party/skia/docs/examples/Canvas_111.cpp FILE: ../../../third_party/skia/docs/examples/Canvas_112.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_113.cpp FILE: ../../../third_party/skia/docs/examples/Canvas_114.cpp FILE: ../../../third_party/skia/docs/examples/Canvas_115.cpp FILE: ../../../third_party/skia/docs/examples/Canvas_116.cpp @@ -5003,45 +5001,7 @@ FILE: ../../../third_party/skia/docs/examples/Color_015.cpp FILE: ../../../third_party/skia/docs/examples/Color_016.cpp FILE: ../../../third_party/skia/docs/examples/Color_017.cpp FILE: ../../../third_party/skia/docs/examples/Color_018.cpp -FILE: ../../../third_party/skia/docs/examples/Font_000.cpp -FILE: ../../../third_party/skia/docs/examples/Font_001.cpp -FILE: ../../../third_party/skia/docs/examples/Font_002.cpp -FILE: ../../../third_party/skia/docs/examples/Font_003.cpp -FILE: ../../../third_party/skia/docs/examples/Font_004.cpp -FILE: ../../../third_party/skia/docs/examples/Font_005.cpp -FILE: ../../../third_party/skia/docs/examples/Font_006.cpp -FILE: ../../../third_party/skia/docs/examples/Font_007.cpp -FILE: ../../../third_party/skia/docs/examples/Font_008.cpp -FILE: ../../../third_party/skia/docs/examples/Font_009.cpp -FILE: ../../../third_party/skia/docs/examples/Font_010.cpp -FILE: ../../../third_party/skia/docs/examples/Font_011.cpp -FILE: ../../../third_party/skia/docs/examples/Font_012.cpp -FILE: ../../../third_party/skia/docs/examples/Font_013.cpp -FILE: ../../../third_party/skia/docs/examples/Font_014.cpp -FILE: ../../../third_party/skia/docs/examples/Font_015.cpp -FILE: ../../../third_party/skia/docs/examples/Font_016.cpp -FILE: ../../../third_party/skia/docs/examples/Font_017.cpp -FILE: ../../../third_party/skia/docs/examples/Font_018.cpp -FILE: ../../../third_party/skia/docs/examples/Font_019.cpp -FILE: ../../../third_party/skia/docs/examples/Font_020.cpp -FILE: ../../../third_party/skia/docs/examples/Font_021.cpp -FILE: ../../../third_party/skia/docs/examples/Font_022.cpp -FILE: ../../../third_party/skia/docs/examples/Font_023.cpp -FILE: ../../../third_party/skia/docs/examples/Font_024.cpp -FILE: ../../../third_party/skia/docs/examples/Font_025.cpp -FILE: ../../../third_party/skia/docs/examples/Font_026.cpp -FILE: ../../../third_party/skia/docs/examples/Font_027.cpp -FILE: ../../../third_party/skia/docs/examples/Font_028.cpp -FILE: ../../../third_party/skia/docs/examples/Font_029.cpp -FILE: ../../../third_party/skia/docs/examples/Font_030.cpp -FILE: ../../../third_party/skia/docs/examples/Font_031.cpp -FILE: ../../../third_party/skia/docs/examples/Font_032.cpp FILE: ../../../third_party/skia/docs/examples/Font_033.cpp -FILE: ../../../third_party/skia/docs/examples/Font_034.cpp -FILE: ../../../third_party/skia/docs/examples/Font_035.cpp -FILE: ../../../third_party/skia/docs/examples/Font_036.cpp -FILE: ../../../third_party/skia/docs/examples/Font_037.cpp -FILE: ../../../third_party/skia/docs/examples/Font_038.cpp FILE: ../../../third_party/skia/docs/examples/IPoint_000.cpp FILE: ../../../third_party/skia/docs/examples/IPoint_001.cpp FILE: ../../../third_party/skia/docs/examples/IPoint_002.cpp @@ -5226,7 +5186,6 @@ FILE: ../../../third_party/skia/docs/examples/Matrix_021.cpp FILE: ../../../third_party/skia/docs/examples/Matrix_022.cpp FILE: ../../../third_party/skia/docs/examples/Matrix_023.cpp FILE: ../../../third_party/skia/docs/examples/Matrix_024.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_025.cpp FILE: ../../../third_party/skia/docs/examples/Matrix_026.cpp FILE: ../../../third_party/skia/docs/examples/Matrix_027.cpp FILE: ../../../third_party/skia/docs/examples/Matrix_028.cpp @@ -5382,7 +5341,6 @@ FILE: ../../../third_party/skia/docs/examples/Paint_069.cpp FILE: ../../../third_party/skia/docs/examples/Paint_070.cpp FILE: ../../../third_party/skia/docs/examples/Paint_071.cpp FILE: ../../../third_party/skia/docs/examples/Paint_072.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_073.cpp FILE: ../../../third_party/skia/docs/examples/Paint_074.cpp FILE: ../../../third_party/skia/docs/examples/Paint_075.cpp FILE: ../../../third_party/skia/docs/examples/Paint_076.cpp @@ -5502,7 +5460,6 @@ FILE: ../../../third_party/skia/docs/examples/Path_071.cpp FILE: ../../../third_party/skia/docs/examples/Path_072.cpp FILE: ../../../third_party/skia/docs/examples/Path_073.cpp FILE: ../../../third_party/skia/docs/examples/Path_074.cpp -FILE: ../../../third_party/skia/docs/examples/Path_075.cpp FILE: ../../../third_party/skia/docs/examples/Path_076.cpp FILE: ../../../third_party/skia/docs/examples/Path_077.cpp FILE: ../../../third_party/skia/docs/examples/Path_078.cpp @@ -5836,7 +5793,6 @@ FILE: ../../../third_party/skia/docs/examples/Surface_010.cpp FILE: ../../../third_party/skia/docs/examples/Surface_011.cpp FILE: ../../../third_party/skia/docs/examples/Surface_012.cpp FILE: ../../../third_party/skia/docs/examples/Surface_013.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_014.cpp FILE: ../../../third_party/skia/docs/examples/Surface_015.cpp FILE: ../../../third_party/skia/docs/examples/Surface_016.cpp FILE: ../../../third_party/skia/docs/examples/Surface_017.cpp @@ -5901,6 +5857,7 @@ ORIGIN: ../../../third_party/skia/experimental/wasm-skp-debugger/debugger_bindin TYPE: LicenseType.bsd FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/debugger_bindings.cpp FILE: ../../../third_party/skia/gm/runtimecolorfilter.cpp +FILE: ../../../third_party/skia/include/gpu/gl/GrGLAssembleHelpers.h FILE: ../../../third_party/skia/modules/canvaskit/WasmAliases.h FILE: ../../../third_party/skia/modules/canvaskit/particles_bindings.cpp FILE: ../../../third_party/skia/modules/canvaskit/skottie_bindings.cpp @@ -5917,6 +5874,9 @@ FILE: ../../../third_party/skia/modules/particles/src/SkParticleDrawable.cpp FILE: ../../../third_party/skia/modules/particles/src/SkParticleEffect.cpp FILE: ../../../third_party/skia/modules/particles/src/SkReflected.cpp FILE: ../../../third_party/skia/src/core/SkColorFilterPriv.h +FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleHelpers.cpp +FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleInterface_gl.cpp +FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleInterface_gles.cpp ---------------------------------------------------------------------------------------------------- Copyright 2019 Google LLC @@ -6083,6 +6043,7 @@ ORIGIN: ../../../third_party/skia/fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp + ../../../thi TYPE: LicenseType.bsd FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzSKSL2Metal.cpp +FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp ---------------------------------------------------------------------------------------------------- Copyright 2019 Google, LLC From b404c69fdb8aa6a7272240ccab15c327ea1b63a9 Mon Sep 17 00:00:00 2001 From: freiling Date: Mon, 18 Mar 2019 16:33:57 -0700 Subject: [PATCH 0486/1117] [scenic][SCN-1054] Move back off of SetTranslationRH (#8174) The behavior of SetTranslation() is now in its final state so we can migrate back off the temporary function. --- flow/export_node.cc | 2 +- flow/scene_update_context.cc | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/flow/export_node.cc b/flow/export_node.cc index 3bf840dbc6a89..acf7e42da3215 100644 --- a/flow/export_node.cc +++ b/flow/export_node.cc @@ -56,7 +56,7 @@ void ExportNode::Bind(SceneUpdateContext& context, if (node_) { container.AddChild(*node_); - node_->SetTranslationRH(offset.x(), offset.y(), 0.f); + node_->SetTranslation(offset.x(), offset.y(), 0.f); node_->SetHitTestBehavior( hit_testable ? fuchsia::ui::gfx::HitTestBehavior::kDefault : fuchsia::ui::gfx::HitTestBehavior::kSuppress); diff --git a/flow/scene_update_context.cc b/flow/scene_update_context.cc index 0e057edc2f0a7..d0e9f5b930b69 100644 --- a/flow/scene_update_context.cc +++ b/flow/scene_update_context.cc @@ -110,9 +110,9 @@ void SceneUpdateContext::CreateFrame( ); scenic::ShapeNode shape_node(session_); shape_node.SetShape(shape); - shape_node.SetTranslationRH(shape_bounds.width() * 0.5f + shape_bounds.left(), - shape_bounds.height() * 0.5f + shape_bounds.top(), - 0.f); + shape_node.SetTranslation(shape_bounds.width() * 0.5f + shape_bounds.left(), + shape_bounds.height() * 0.5f + shape_bounds.top(), + 0.f); // TODO(SCN-1274): AddPart() and SetClip() will be deleted. entity_node->AddPart(shape_node); @@ -141,9 +141,9 @@ void SceneUpdateContext::CreateFrame( inner_bounds.height()); scenic::ShapeNode inner_node(session_); inner_node.SetShape(inner_shape); - inner_node.SetTranslationRH( - inner_bounds.width() * 0.5f + inner_bounds.left(), - inner_bounds.height() * 0.5f + inner_bounds.top(), 0.f); + inner_node.SetTranslation(inner_bounds.width() * 0.5f + inner_bounds.left(), + inner_bounds.height() * 0.5f + inner_bounds.top(), + 0.f); entity_node->AddPart(inner_node); SetShapeTextureOrColor(inner_node, color, scale_x, scale_y, inner_bounds, std::move(paint_layers), layer, @@ -282,9 +282,9 @@ SceneUpdateContext::Clip::Clip(SceneUpdateContext& context, : Entity(context) { scenic::ShapeNode shape_node(context.session()); shape_node.SetShape(shape); - shape_node.SetTranslationRH(shape_bounds.width() * 0.5f + shape_bounds.left(), - shape_bounds.height() * 0.5f + shape_bounds.top(), - 0.f); + shape_node.SetTranslation(shape_bounds.width() * 0.5f + shape_bounds.left(), + shape_bounds.height() * 0.5f + shape_bounds.top(), + 0.f); // TODO(SCN-1274): AddPart() and SetClip() will be deleted. entity_node().AddPart(shape_node); @@ -305,9 +305,9 @@ SceneUpdateContext::Transform::Transform(SceneUpdateContext& context, // are not handled correctly. MatrixDecomposition decomposition(transform); if (decomposition.IsValid()) { - entity_node().SetTranslationRH(decomposition.translation().x(), // - decomposition.translation().y(), // - decomposition.translation().z() // + entity_node().SetTranslation(decomposition.translation().x(), // + decomposition.translation().y(), // + decomposition.translation().z() // ); entity_node().SetScale(decomposition.scale().x(), // @@ -356,7 +356,7 @@ SceneUpdateContext::Frame::Frame(SceneUpdateContext& context, paint_bounds_(SkRect::MakeEmpty()), layer_(layer) { if (elevation != 0.0) - entity_node().SetTranslationRH(0.f, 0.f, -elevation); + entity_node().SetTranslation(0.f, 0.f, -elevation); } SceneUpdateContext::Frame::~Frame() { From bc8ebcb96bae717ee4cc2c152f66260007bd1d0f Mon Sep 17 00:00:00 2001 From: Dan Field Date: Mon, 18 Mar 2019 19:32:49 -0700 Subject: [PATCH 0487/1117] Export FlutterSemanticsUpdateNotification and improve docs (#8203) * Export FlutterSemanticsUpdateNotification and improve docs --- .../platform/darwin/ios/framework/Headers/FlutterEngine.h | 8 +++++++- .../darwin/ios/framework/Headers/FlutterViewController.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h b/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h index e70877609c032..bf1e757687695 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h @@ -146,10 +146,16 @@ FLUTTER_EXPORT * This method must only be called after launching the engine via * `-runWithEntrypoint:` or `-runWithEntryPoint:libraryURI`. * + * Although this method returns synchronously, it does not guarantee that a + * semantics tree is actually available when the method returns. It + * synchronously ensures that the next frame the Flutter framework creates will + * have a semantics tree. + * * You can subscribe to semantics updates via `NSNotificationCenter` by adding * an observer for the name `FlutterSemanticsUpdateNotification`. The `object` * parameter will be the `FlutterViewController` associated with the semantics - * update. + * update. This will asynchronously fire after a semantics tree has actually + * built (which may be some time after the frame has been rendered). */ - (void)ensureSemanticsEnabled; diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h b/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h index 5881b3c1aeff6..b38b118fff9cd 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h @@ -23,6 +23,7 @@ * The object passed as the sender is the `FlutterViewController` associated * with the update. */ +FLUTTER_EXPORT extern NSNotificationName const FlutterSemanticsUpdateNotification; /** From e73dbf6a6f991332315e20cd712314750051d885 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 18 Mar 2019 22:34:12 -0400 Subject: [PATCH 0488/1117] Roll src/third_party/skia 389b4b267d15..7eba20aef187 (2 commits) (#8209) https://skia.googlesource.com/skia.git/%2Blog/389b4b267d15..7eba20aef187 git log 389b4b267d15c1e06cc4d8b2222d96e50e6ddb00..7eba20aef187388ba81afa5aa3165a2914f319c8 --date=short --no-merges --format=%ad %ae %s 2019-03-18 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-18 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d988130830c2e..c4db7cab58548 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': '389b4b267d15c1e06cc4d8b2222d96e50e6ddb00', + 'skia_revision': '7eba20aef187388ba81afa5aa3165a2914f319c8', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 541ac47398145..abf628a547833 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 7bd6f84ef1b06ea794bfafa29dbf8044 +Signature: 2d480ae491e3a95acaa84857a25734e7 UNUSED LICENSES: From e28fc3c810ee3c62ad201bc49f4934f0ed20a82c Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Tue, 19 Mar 2019 09:43:17 -0700 Subject: [PATCH 0489/1117] Define the dart_platform_sdk GN variable only on host targets (#8206) dart_platform_sdk is not available in Android builds --- tools/gn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/gn b/tools/gn index c1f381b64642b..083b8c821554f 100755 --- a/tools/gn +++ b/tools/gn @@ -236,7 +236,9 @@ def to_gn_args(args): # Whether to build trained Dart SDK snapshots of dart2js and dartdevc, # including the web sdk kernel and source files. - gn_args['dart_platform_sdk'] = not args.full_dart_sdk + if args.target_os is None: + # dart_platform_sdk is not declared for Android targets. + gn_args['dart_platform_sdk'] = not args.full_dart_sdk gn_args['full_dart_sdk'] = args.full_dart_sdk return gn_args From 571964e1d7b49e5424c800b461006207d670736f Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 19 Mar 2019 11:56:55 -0700 Subject: [PATCH 0490/1117] Allow exported __const on iOS (#8217) --- testing/symbols/verify_exported.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/symbols/verify_exported.dart b/testing/symbols/verify_exported.dart index df9770988fd54..921f90c0d01f5 100644 --- a/testing/symbols/verify_exported.dart +++ b/testing/symbols/verify_exported.dart @@ -69,7 +69,7 @@ int _checkIos(String outPath, String nmPath, Iterable builds) { continue; } final Iterable unexpectedEntries = NmEntry.parse(nmResult.stdout).where((NmEntry entry) { - return !((entry.type == '(__DATA,__common)' && entry.name.startsWith('_Flutter')) + return !(((entry.type == '(__DATA,__common)' || entry.type == '(__DATA,__const)') && entry.name.startsWith('_Flutter')) || (entry.type == '(__DATA,__objc_data)' && (entry.name.startsWith('_OBJC_METACLASS_\$_Flutter') || entry.name.startsWith('_OBJC_CLASS_\$_Flutter')))); }); From e8bca6391091f323a9173165f7f8be7001ea252b Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 19 Mar 2019 16:23:56 -0400 Subject: [PATCH 0491/1117] Roll src/third_party/skia 7eba20aef187..dd0544078d05 (1 commits) (#8211) https://skia.googlesource.com/skia.git/%2Blog/7eba20aef187..dd0544078d05 git log 7eba20aef187388ba81afa5aa3165a2914f319c8..dd0544078d058e68cf91404745b493d7d5a184d0 --date=short --no-merges --format=%ad %ae %s 2019-03-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 cda4383919b9..eb986426cd6d (5 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c4db7cab58548..94a951c90599b 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': '7eba20aef187388ba81afa5aa3165a2914f319c8', + 'skia_revision': 'dd0544078d058e68cf91404745b493d7d5a184d0', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index abf628a547833..bae76d3885006 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2d480ae491e3a95acaa84857a25734e7 +Signature: c3be07455b3622a7b69ee4ec3797c619 UNUSED LICENSES: From 146646d1b992b9ba428be379321e0a4ad87e03ef Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 19 Mar 2019 13:41:47 -0700 Subject: [PATCH 0492/1117] Correct greater than or equal logic in offset base (#8210) --- lib/stub_ui/geometry.dart | 2 +- lib/ui/geometry.dart | 2 +- testing/dart/geometry_test.dart | 34 +++++++++++++++++++++++++++++++++ testing/dart/pubspec.yaml | 2 +- 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/lib/stub_ui/geometry.dart b/lib/stub_ui/geometry.dart index f0916021419c0..0bc96c2b1eb3a 100644 --- a/lib/stub_ui/geometry.dart +++ b/lib/stub_ui/geometry.dart @@ -73,7 +73,7 @@ abstract class OffsetBase { /// /// This is a partial ordering. It is possible for two values to be neither /// less, nor greater than, nor equal to, another. - bool operator >=(OffsetBase other) => _dx > other._dx && _dy >= other._dy; + bool operator >=(OffsetBase other) => _dx >= other._dx && _dy >= other._dy; /// Equality operator. Compares an [Offset] or [Size] to another [Offset] or /// [Size], and returns true if the horizontal and vertical values of the diff --git a/lib/ui/geometry.dart b/lib/ui/geometry.dart index 56b6e55759cdc..2e8a79980c2dc 100644 --- a/lib/ui/geometry.dart +++ b/lib/ui/geometry.dart @@ -73,7 +73,7 @@ abstract class OffsetBase { /// /// This is a partial ordering. It is possible for two values to be neither /// less, nor greater than, nor equal to, another. - bool operator >=(OffsetBase other) => _dx > other._dx && _dy >= other._dy; + bool operator >=(OffsetBase other) => _dx >= other._dx && _dy >= other._dy; /// Equality operator. Compares an [Offset] or [Size] to another [Offset] or /// [Size], and returns true if the horizontal and vertical values of the diff --git a/testing/dart/geometry_test.dart b/testing/dart/geometry_test.dart index 9d14a5c25a700..20445b862ca4e 100644 --- a/testing/dart/geometry_test.dart +++ b/testing/dart/geometry_test.dart @@ -9,6 +9,40 @@ import 'dart:ui'; import 'package:test/test.dart'; void main() { + test('OffsetBase.>=', () { + expect(const Offset(0, 0), greaterThanOrEqualTo(const Offset(0, -1))); + expect(const Offset(0, 0), greaterThanOrEqualTo(const Offset(-1, 0))); + expect(const Offset(0, 0), greaterThanOrEqualTo(const Offset(-1, -1))); + expect(const Offset(0, 0), greaterThanOrEqualTo(const Offset(0, 0))); + expect(const Offset(0, 0), isNot(greaterThanOrEqualTo(const Offset(0, double.nan)))); + expect(const Offset(0, 0), isNot(greaterThanOrEqualTo(const Offset(double.nan, 0)))); + expect(const Offset(0, 0), isNot(greaterThanOrEqualTo(const Offset(10, -10)))); + }); + test('OffsetBase.<=', () { + expect(const Offset(0, 0), lessThanOrEqualTo(const Offset(0, 1))); + expect(const Offset(0, 0), lessThanOrEqualTo(const Offset(1, 0))); + expect(const Offset(0, 0), lessThanOrEqualTo(const Offset(0, 0))); + expect(const Offset(0, 0), isNot(lessThanOrEqualTo(const Offset(0, double.nan)))); + expect(const Offset(0, 0), isNot(lessThanOrEqualTo(const Offset(double.nan, 0)))); + expect(const Offset(0, 0), isNot(lessThanOrEqualTo(const Offset(10, -10)))); + }); + test('OffsetBase.>', () { + expect(const Offset(0, 0), greaterThan(const Offset(-1, -1))); + expect(const Offset(0, 0), isNot(greaterThan(const Offset(0, -1)))); + expect(const Offset(0, 0), isNot(greaterThan(const Offset(-1, 0)))); + expect(const Offset(0, 0), isNot(greaterThan(const Offset(double.nan, -1)))); + }); + test('OffsetBase.<', () { + expect(const Offset(0, 0), lessThan(const Offset(1, 1))); + expect(const Offset(0, 0), isNot(lessThan(const Offset(0, 1)))); + expect(const Offset(0, 0), isNot(lessThan(const Offset(1, 0)))); + expect(const Offset(0, 0), isNot(lessThan(const Offset(double.nan, 1)))); + }); + test('OffsetBase.==', () { + expect(const Offset(0, 0), equals(const Offset(0, 0))); + expect(const Offset(0, 0), isNot(equals(const Offset(1, 0)))); + expect(const Offset(0, 0), isNot(equals(const Offset(0, 1)))); + }); test('Offset.direction', () { expect(const Offset(0.0, 0.0).direction, 0.0); expect(const Offset(0.0, 1.0).direction, pi / 2.0); diff --git a/testing/dart/pubspec.yaml b/testing/dart/pubspec.yaml index ccffd1626119b..1c06c331bf831 100644 --- a/testing/dart/pubspec.yaml +++ b/testing/dart/pubspec.yaml @@ -7,4 +7,4 @@ dependency_overrides: sky_engine: path: ../../../out/host_debug_unopt/gen/dart-pkg/sky_engine sky_services: - path: ../../../out/host_debug_unopt/gen/dart-pkg/sky_services \ No newline at end of file + path: ../../../out/host_debug_unopt/gen/dart-pkg/sky_services From 96ad0c8926b0493d4276a39ee9bc6de6fa97bece Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 19 Mar 2019 13:42:42 -0700 Subject: [PATCH 0493/1117] Roll src/third_party/dart 7418238239..70e3e67dd7 (108 commits) (#8216) * Updated protobuf and bazel_worker revs for SDK roll * Roll src/third_party/dart 7418238239..70e3e67dd7 (108 commits) 70e3e67dd7 Expect different errors depending on the state of the spread_collections experiment. c85108d2f9 Fix parse expression "a ~ b" f890800fb0 Rework tracking of variables in scope while resynthesizing expressions. e830338919 Updated spec_parser such that it runs with ANTLR v4 37c7992ac3 [testing] Make tests with multiple VMOptions have multiple names. af5fc2d4d2 [VM] Partial support for named regexp captures. efb3f85c7e Fix for element type inference tests. f5c16512cc [Tests] Pass VM options (Platform.executableArguments) to sub-processes 234a1726d3 bump linter to 0.1.83 eda9ccb744 Early exit on VM String.replaceAll 527b10879e Begin adding summary support for `for` elements. 42ab0a6a63 Handle downcasts for spreads fc7d25e0e3 Revert "[vm] Add data field to TypedData" 9c9ab11450 Reland "Handle ir constants in field analysis and impact tests" 91b62553ce Make scanner reportErrors field final 1c685bf370 Sort declarations in pkg/analyzer/lib/src/dart/ast/ast.dart 231061c15a [gardening] Moving patch to be based on dart hash. 1ea717f1c9 [CFE] Use Fasta diagnostics in constant evaluator. 22718f4d60 [CFE] Always call the constant evaluator by the evaluate method. c10ee9971f [CFE] Move constant evaluator to Fasta. ae72776312 New DomExceptions added to browsers. 9d3988eb67 [vm] First stab at a protobuf aware treeshaker e62391a162 Revert "Handle ir constants in field analysis and impact tests" 3b2e368376 Revert 5 changes with failures a6e2c5eb4c Rename import after moving file. e6d2751e9c [CFE] Check for null in constant evaluation c7b572aa29 [CFE] Use Fasta diagnostics in the constant evaluator. 91bc4ec2b9 [CFE] Always call the constant evaluator by the evaluate method. 845b5b2df1 [CFE] Move constant evaluator to Fasta. 0cd89e5bd1 Handle ir constants in field analysis and impact tests eeb8fc8ccd [dartdevc] Adding support for async operations in block expressions d7ad6b8c67 Ensure that all tests are run via test_all and add a test to ensure that it stays that way daa6ee6da9 Report NOT_ITERABLE_SPREAD and NOT_MAP_SPREAD. d920a2a5ab Report NON_CONSTANT_XYZ in not taken branches of IfElement. 976b897bd0 Report non-bool conditions in const expressions in evaluation 1d9f34963e Use StoreBasedSummaryResynthesizer directly in LibraryContext. 43a31ff24e Report equal keys in maps when the keys come from a spread element 0d5ab9380a Add getNotPotentiallyConstants() and isConstantTypeExpression(). cc1ddfb337 Issue 36212. Fix for updated part without library. d597166f9b Remove Dart tasks and work manager. 68bfd72e44 [dartdevc] fix #36174, add flutter inspector transform to DDC b9ce1496f1 Sort declarations in expr_builder_test.dart 8475338d58 Remove references to non-existent Resource type 724d956fd4 Move use_abi_version from vm directory to bin 44753660ec Prepare to publish analyzer 0.35.4 7a2949521d Handle ConstantExpression in ssa and kernel impact 7a90563ee3 [js_runtime] Try to avoid String.prototype.replace with replacement patterns 3dda726bca [gardening] Update flutter patch to reflect engine roll. d445d29fa3 [VM] Define layout of _*ArrayView/_ByteDataView in C+++ d267fb6bf3 change the SummaryTarget to extend the DevCompilerTarget 626cb68ad2 More spread test fixes. eb6f1b6abd Handle effectively constant fields in class stub generator efe9366eeb Remove references to pkg:plugin in DEPS and .packages 43c13284e4 Revert "Reland "Add hints to check the SDK constraints for both set literals and for the ui-as-code features"" d1085e80be [vm] Add data field to TypedData d53311866f [vm/bytecode] Support native methods in BytecodeFlowGraphBuilder 06eeeec92e [tests] Remove obsolete VM option --error-on-bad-type from tests 0a42e8e062 [dart/vm] fix potential buffer overrun in unicode utils 74a23b96b0 Add support for dart2js targets to kernel_worker 9b185051a9 Don't use lazy static initializer in Random.secure() 75679e06c2 Reland "Add hints to check the SDK constraints for both set literals and for the ui-as-code features" 7f8eed0862 Update the partial constant evaluator to handle a limited subset of map literals in unresolved code 02ffcb8f42 Add summary support for `if` elements. 025825dc0f [vm] Update ffi status files and fix function_stress_test on Windows. 638f13ff3d Revert "[ VM / dart:isolate ] Added ability to set names for spawned isolates." af633531ab Report key/value type mismatch. 8e550f6a4c Support super completions from superclass constraints in a mixin b216335e69 Add summary support for spread elements. 001d4ed85d [infra] Update checked in SDKs to 2.2.1-dev.1.1 85f8d3c047 [vm] Build FFI trampolines with IL. 4e68a04f3e [vm] Minor improvements to FFI function tests. 652948175e Use a `dynamic` downward inference context for invalid ambiguous set/map literals. d6ffee639b [co19] Roll co19 cded39ebf3 DEPS rename protobuf_tag to protobuf_rev e6c3bc4ba9 [gardening] update Flutter engine patch file d0c4d6b329 Take variance into account when computing rti checks 3e794ec16a Add tests for rti emission on function types 4ca57befd7 [dartfmt] Bump dart_style to 1.2.4 495b9c4519 Remove set-literals experimental flag from tests 7c496bfd76 Update protobuf version in DEPS eb47bc112e [gardening] Rename flutter/flutter patch so it matches engines hash. de2d83b9e3 [gardening] Fix flutter patch after recent dart roll into engine. 262878086d Extract _ConstLiteralVerifier and split it into literal / operation methods. 092a552a52 Fix spread disambiguation test. 888596af88 Add support for a production dart2js mode in test.dart 90d0443848 [dartdevc] Implementing block expressions and set constants c52e1b83fb [vm/frontend_server] Fix outdated flutter patch. 59525264e8 [ VM / dart:isolate ] Added ability to set names for spawned isolates. 0ee1413095 [dartdevc] Initial support for control flow collections c3005ee81f Add error codes for expressions in maps and map entries not in maps 1b5f7c1047 Remove unnecessary flags for dart2js from test.dart 1efe7e2518 [ VM / Service ] Added `getMemoryUsage` RPC and `MemoryUsage` object to service protocol 35fb67158b [vm/frontend] Change frontend server interface so compile response contains delta of sources files that were used by the compiler. 208f8b5441 Restore checks for leaf elements in ErrorVerifier. 0f4a208c3e Revert "Add hints to check the SDK constraints for both set literals and for the ui-as-code features" 00a478ca80 [VM runtime] Do not leak file descriptors of dual mappings to child processes. 5fdb3c5057 Add hints to check the SDK constraints for both set literals and for the ui-as-code features ca2fc831c4 Check types of values in constant List/Set against the element types. 7c3ab264e5 Change link methods to take a DeclaredVariables object. f7a36792b2 [vm] Fix memory leaks in --load_compilation_trace and --load_type_feedback. 5d6e17a20d Improve initializer missing comma recovery a8c94d0b52 Remove tools we no longer need to manage status files c5624274e1 Update the SDK constraints to match the fact that set literals are being used 28d697a6c1 Enforce override annotations in dart2js 5e1397fc4e Remove unused import ae8a47e92c Add changelog entry for RegExp lookbehind support. 1c02016b7b [infra] Fall back on inexact baseline commits in test.dart. e2a86d9081 [VM runtime] Use memfd_create instead of shm_open for dual mapping of code. --- DEPS | 8 +- ci/licenses_golden/licenses_third_party | 210 ++++++++++++------------ 2 files changed, 110 insertions(+), 108 deletions(-) diff --git a/DEPS b/DEPS index 94a951c90599b..bd1147f3e2e06 100644 --- a/DEPS +++ b/DEPS @@ -31,13 +31,13 @@ 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': '7418238239f885ba92093c44a1768f8ec93b121f', + 'dart_revision': '70e3e67dd71267a611429602b342d484fca9b89b', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py 'dart_args_tag': '1.4.4', 'dart_async_tag': '2.0.8', - 'dart_bazel_worker_tag': '0.1.14', + 'dart_bazel_worker_tag': 'bazel_worker-v0.1.20', 'dart_boolean_selector_tag': '1.0.4', 'dart_boringssl_gen_rev': 'bbf52f18f425e29b1185f2f6753bec02ed8c5880', 'dart_boringssl_rev': '702e2b6d3831486535e958f262a05c75a5cb312e', @@ -74,7 +74,7 @@ vars = { 'dart_path_tag': '1.6.2', 'dart_plugin_tag': 'f5b4b0e32d1406d62daccea030ba6457d14b1c47', 'dart_pool_tag': '1.3.6', - 'dart_protobuf_tag': '0.9.0', + 'dart_protobuf_rev': '0c77167b16d00b561a6055bfe26690af7f26ae88', 'dart_pub_rev': '3c060aae47985e9a248b850f1d0450304a5c97e3', 'dart_pub_semver_tag': '1.4.2', 'dart_quiver_tag': '2.0.0+1', @@ -283,7 +283,7 @@ deps = { Var('dart_git') + '/plugin.git' + '@' + Var('dart_plugin_tag'), 'src/third_party/dart/third_party/pkg/protobuf': - Var('dart_git') + '/protobuf.git' + '@' + Var('dart_protobuf_tag'), + Var('dart_git') + '/protobuf.git' + '@' + Var('dart_protobuf_rev'), 'src/third_party/dart/third_party/pkg/pub_semver': Var('dart_git') + '/pub_semver.git' + '@' + Var('dart_pub_semver_tag'), diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index c447c7b75883c..fa339383e919c 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: c9257a9b2c77469fbf18cd1859ef65ba +Signature: c306c24d471bef4884795341830a763e UNUSED LICENSES: @@ -5119,6 +5119,111 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== +==================================================================================================== +LIBRARY: dart +ORIGIN: ../../../third_party/dart/runtime/bin/abi_version.h + ../../../third_party/dart/LICENSE +TYPE: LicenseType.bsd +FILE: ../../../third_party/dart/runtime/bin/abi_version.h +FILE: ../../../third_party/dart/runtime/bin/abi_version_in.cc +FILE: ../../../third_party/dart/runtime/bin/entrypoints_verification_test_extension.cc +FILE: ../../../third_party/dart/runtime/bin/entrypoints_verification_test_extension_dllmain_win.cc +FILE: ../../../third_party/dart/runtime/bin/ffi_test_dynamic_library.cc +FILE: ../../../third_party/dart/runtime/bin/ffi_test_functions.cc +FILE: ../../../third_party/dart/runtime/bin/namespace_fuchsia.h +FILE: ../../../third_party/dart/runtime/lib/ffi.cc +FILE: ../../../third_party/dart/runtime/lib/ffi_dynamic_library.cc +FILE: ../../../third_party/dart/runtime/lib/ffi_dynamic_library_patch.dart +FILE: ../../../third_party/dart/runtime/lib/ffi_native_type_patch.dart +FILE: ../../../third_party/dart/runtime/lib/ffi_patch.dart +FILE: ../../../third_party/dart/runtime/tools/graphexplorer/graphexplorer.html +FILE: ../../../third_party/dart/runtime/tools/graphexplorer/graphexplorer.js +FILE: ../../../third_party/dart/runtime/vm/catch_entry_moves_test.cc +FILE: ../../../third_party/dart/runtime/vm/class_id.h +FILE: ../../../third_party/dart/runtime/vm/code_entry_kind.h +FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier.h +FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_arm.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_arm64.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_ia32.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_x64.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/backend/flow_graph_checker.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/backend/flow_graph_checker.h +FILE: ../../../third_party/dart/runtime/vm/compiler/backend/slot_test.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/ffi.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/ffi.h +FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier.h +FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier_arm.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier_arm64.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier_ia32.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier_x64.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/recognized_methods_list.h +FILE: ../../../third_party/dart/runtime/vm/compiler/relocation.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/runtime_api.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/runtime_api.h +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler.h +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm64.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_dbc.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_ia32.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_x64.cc +FILE: ../../../third_party/dart/runtime/vm/constants_x64.cc +FILE: ../../../third_party/dart/runtime/vm/ffi_trampoline_stubs_x64.cc +FILE: ../../../third_party/dart/runtime/vm/frame_layout.h +FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist.h +FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist_test.cc +FILE: ../../../third_party/dart/runtime/vm/longjump.h +FILE: ../../../third_party/dart/runtime/vm/pointer_tagging.h +FILE: ../../../third_party/dart/runtime/vm/static_type_exactness_state.h +FILE: ../../../third_party/dart/runtime/vm/stub_code_list.h +FILE: ../../../third_party/dart/runtime/vm/thread_stack_resource.cc +FILE: ../../../third_party/dart/runtime/vm/thread_stack_resource.h +FILE: ../../../third_party/dart/runtime/vm/thread_state.cc +FILE: ../../../third_party/dart/runtime/vm/thread_state.h +FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm.cc +FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm64.cc +FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_x64.cc +FILE: ../../../third_party/dart/samples/ffi/coordinate.dart +FILE: ../../../third_party/dart/samples/ffi/dylib_utils.dart +FILE: ../../../third_party/dart/samples/ffi/sample_ffi_data.dart +FILE: ../../../third_party/dart/samples/ffi/sample_ffi_dynamic_library.dart +FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions.dart +FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions_callbacks.dart +FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions_structs.dart +FILE: ../../../third_party/dart/samples/ffi/sample_ffi_structs.dart +FILE: ../../../third_party/dart/sdk/lib/ffi/annotations.dart +FILE: ../../../third_party/dart/sdk/lib/ffi/dynamic_library.dart +FILE: ../../../third_party/dart/sdk/lib/ffi/ffi.dart +FILE: ../../../third_party/dart/sdk/lib/ffi/native_type.dart +---------------------------------------------------------------------------------------------------- +Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file +for details. 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: dart ORIGIN: ../../../third_party/dart/runtime/bin/cli.cc + ../../../third_party/dart/LICENSE @@ -5692,109 +5797,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== -==================================================================================================== -LIBRARY: dart -ORIGIN: ../../../third_party/dart/runtime/bin/entrypoints_verification_test_extension.cc + ../../../third_party/dart/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../third_party/dart/runtime/bin/entrypoints_verification_test_extension.cc -FILE: ../../../third_party/dart/runtime/bin/entrypoints_verification_test_extension_dllmain_win.cc -FILE: ../../../third_party/dart/runtime/bin/ffi_test_dynamic_library.cc -FILE: ../../../third_party/dart/runtime/bin/ffi_test_functions.cc -FILE: ../../../third_party/dart/runtime/bin/namespace_fuchsia.h -FILE: ../../../third_party/dart/runtime/lib/ffi.cc -FILE: ../../../third_party/dart/runtime/lib/ffi_dynamic_library.cc -FILE: ../../../third_party/dart/runtime/lib/ffi_dynamic_library_patch.dart -FILE: ../../../third_party/dart/runtime/lib/ffi_native_type_patch.dart -FILE: ../../../third_party/dart/runtime/lib/ffi_patch.dart -FILE: ../../../third_party/dart/runtime/tools/graphexplorer/graphexplorer.html -FILE: ../../../third_party/dart/runtime/tools/graphexplorer/graphexplorer.js -FILE: ../../../third_party/dart/runtime/vm/catch_entry_moves_test.cc -FILE: ../../../third_party/dart/runtime/vm/class_id.h -FILE: ../../../third_party/dart/runtime/vm/code_entry_kind.h -FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier.h -FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_arm.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_arm64.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_ia32.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_x64.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/backend/flow_graph_checker.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/backend/flow_graph_checker.h -FILE: ../../../third_party/dart/runtime/vm/compiler/backend/slot_test.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/ffi.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/ffi.h -FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier.h -FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier_arm.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier_arm64.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier_ia32.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier_x64.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/recognized_methods_list.h -FILE: ../../../third_party/dart/runtime/vm/compiler/relocation.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/runtime_api.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/runtime_api.h -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler.h -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm64.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_dbc.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_ia32.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_x64.cc -FILE: ../../../third_party/dart/runtime/vm/constants_x64.cc -FILE: ../../../third_party/dart/runtime/vm/ffi_trampoline_stubs_x64.cc -FILE: ../../../third_party/dart/runtime/vm/frame_layout.h -FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist.h -FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist_test.cc -FILE: ../../../third_party/dart/runtime/vm/longjump.h -FILE: ../../../third_party/dart/runtime/vm/pointer_tagging.h -FILE: ../../../third_party/dart/runtime/vm/static_type_exactness_state.h -FILE: ../../../third_party/dart/runtime/vm/stub_code_list.h -FILE: ../../../third_party/dart/runtime/vm/thread_stack_resource.cc -FILE: ../../../third_party/dart/runtime/vm/thread_stack_resource.h -FILE: ../../../third_party/dart/runtime/vm/thread_state.cc -FILE: ../../../third_party/dart/runtime/vm/thread_state.h -FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm.cc -FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_arm64.cc -FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs_x64.cc -FILE: ../../../third_party/dart/samples/ffi/coordinate.dart -FILE: ../../../third_party/dart/samples/ffi/dylib_utils.dart -FILE: ../../../third_party/dart/samples/ffi/sample_ffi_data.dart -FILE: ../../../third_party/dart/samples/ffi/sample_ffi_dynamic_library.dart -FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions.dart -FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions_callbacks.dart -FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions_structs.dart -FILE: ../../../third_party/dart/samples/ffi/sample_ffi_structs.dart -FILE: ../../../third_party/dart/sdk/lib/ffi/annotations.dart -FILE: ../../../third_party/dart/sdk/lib/ffi/dynamic_library.dart -FILE: ../../../third_party/dart/sdk/lib/ffi/ffi.dart -FILE: ../../../third_party/dart/sdk/lib/ffi/native_type.dart ----------------------------------------------------------------------------------------------------- -Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file -for details. 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: dart ORIGIN: ../../../third_party/dart/runtime/bin/process_test.cc + ../../../third_party/dart/LICENSE From d764b69b28420cf616fd9c4378f81c7c7b1b0828 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Tue, 19 Mar 2019 14:03:45 -0700 Subject: [PATCH 0494/1117] Add docs for helpful commands to fix format (#8171) --- ci/format.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/format.sh b/ci/format.sh index de00b6d3a67b7..93f0be6c47618 100755 --- a/ci/format.sh +++ b/ci/format.sh @@ -57,7 +57,7 @@ done if [[ $FAILED_CHECKS -ne 0 ]]; then echo "" - echo "ERROR: Some files are formatted incorrectly. To fix, apply diffs above via patch -p0." + echo "ERROR: Some files are formatted incorrectly. To fix, run \`./ci/format.sh | patch -p0\` from the flutter/engine/src/flutter directory." exit 1 fi From 172810342dcbdc5d534768d92c4f59214bdd297b Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Tue, 19 Mar 2019 17:23:32 -0400 Subject: [PATCH 0495/1117] Add a build dependencies script for Linux desktop (#8160) Installs the dependencies necessary to build the Linux desktop shell. Similar to the existing install-build-deps.sh and install-build-deps-android.sh but specifically for the desktop shell requirements. --- build/install-build-deps-linux-desktop.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 build/install-build-deps-linux-desktop.sh diff --git a/build/install-build-deps-linux-desktop.sh b/build/install-build-deps-linux-desktop.sh new file mode 100755 index 0000000000000..ce754c6f1464b --- /dev/null +++ b/build/install-build-deps-linux-desktop.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Installs the dependencies necessary to build the Linux Flutter shell, beyond +# those installed by install-build-deps.sh. + +set -e + +sudo apt-get -y install libglfw3-dev libepoxy-dev libjsoncpp-dev libgtk-3-dev \ + libx11-dev From 7cbbdb4002517cff02dffa9b1346398f40bab141 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Tue, 19 Mar 2019 14:43:54 -0700 Subject: [PATCH 0496/1117] libtxt: more accurate tracking of run positioning and width for justified text (#8214) Fixes https://github.com/flutter/flutter/issues/28891 --- third_party/txt/src/txt/paragraph.cc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index 68c06fc143a21..cba46048d7b9e 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -677,6 +677,8 @@ void Paragraph::Layout(double width, bool force) { const SkTextBlobBuilder::RunBuffer& blob_buffer = builder.allocRunPos(font, glyph_blob.end - glyph_blob.start); + double justify_x_offset_delta = 0; + for (size_t glyph_index = glyph_blob.start; glyph_index < glyph_blob.end;) { size_t cluster_start_glyph_index = glyph_index; @@ -690,7 +692,7 @@ void Paragraph::Layout(double width, bool force) { size_t pos_index = blob_index * 2; blob_buffer.pos[pos_index] = - layout.getX(glyph_index) + justify_x_offset; + layout.getX(glyph_index) + justify_x_offset_delta; blob_buffer.pos[pos_index + 1] = layout.getY(glyph_index); if (glyph_index == cluster_start_glyph_index) @@ -770,7 +772,7 @@ void Paragraph::Layout(double width, bool force) { if (at_word_end) { if (justify_line) { - justify_x_offset += word_gap_width; + justify_x_offset_delta += word_gap_width; } word_index++; @@ -787,9 +789,11 @@ void Paragraph::Layout(double width, bool force) { continue; SkFontMetrics metrics; font.getMetrics(&metrics); - paint_records.emplace_back(run.style(), SkPoint::Make(run_x_offset, 0), - builder.make(), metrics, line_number, - layout.getAdvance(), run.is_ghost()); + paint_records.emplace_back( + run.style(), SkPoint::Make(run_x_offset + justify_x_offset, 0), + builder.make(), metrics, line_number, + layout.getAdvance() + justify_x_offset_delta, run.is_ghost()); + justify_x_offset += justify_x_offset_delta; line_glyph_positions.insert(line_glyph_positions.end(), glyph_positions.begin(), @@ -1050,13 +1054,7 @@ void Paragraph::PaintDecorations(SkCanvas* canvas, // Filled when drawing wavy decorations. SkPath path; - double width = 0; - if (paragraph_style_.text_align == TextAlign::justify && - record.line() != GetLineCount() - 1) { - width = width_; - } else { - width = record.GetRunWidth(); - } + double width = record.GetRunWidth(); SkScalar underline_thickness; if ((metrics.fFlags & From 45f69ac471b47e95dfeef36e5e81597b05ed19f5 Mon Sep 17 00:00:00 2001 From: Amir Hardon Date: Tue, 19 Mar 2019 15:48:45 -0700 Subject: [PATCH 0497/1117] Plumb a reference of PlatformViewsController and AccessibilityBridge to each other (#8208) This is in preparation for implementing platform views a11y on Android. And e2e working prototype is available here: https://github.com/amirh/engine/tree/a11y_hacks flutter/flutter#19418 --- ci/licenses_golden/licenses_flutter | 1 + shell/platform/android/BUILD.gn | 1 + .../io/flutter/app/FlutterPluginRegistry.java | 4 +++ .../embedding/engine/android/FlutterView.java | 5 ++- .../PlatformViewsAccessibilityDelegate.java | 13 +++++++ .../platform/PlatformViewsController.java | 36 ++++++++++++++++++- .../io/flutter/view/AccessibilityBridge.java | 12 +++++-- .../android/io/flutter/view/FlutterView.java | 7 +++- 8 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 6196b918d31a5..55a5f63693062 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -516,6 +516,7 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/Platfor 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/PlatformViewsAccessibilityDelegate.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 diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index 9ff065b3ab830..bb5b74c05e5b7 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -158,6 +158,7 @@ java_library("flutter_shell_java") { "io/flutter/plugin/platform/PlatformViewFactory.java", "io/flutter/plugin/platform/PlatformViewRegistry.java", "io/flutter/plugin/platform/PlatformViewRegistryImpl.java", + "io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java", "io/flutter/plugin/platform/PlatformViewsController.java", "io/flutter/plugin/platform/SingleViewPresentation.java", "io/flutter/plugin/platform/VirtualDisplayController.java", diff --git a/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java b/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java index 7710a6089830d..13297ae5921ab 100644 --- a/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java +++ b/shell/platform/android/io/flutter/app/FlutterPluginRegistry.java @@ -94,6 +94,10 @@ public void onPreEngineRestart() { mPlatformViewsController.onPreEngineRestart(); } + public PlatformViewsController getPlatformViewsController() { + return mPlatformViewsController; + } + private class FlutterRegistrar implements Registrar { private final String pluginKey; diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java index e8216f97b360a..3c104b32c61f3 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java @@ -447,7 +447,10 @@ public void attachToFlutterEngine(@NonNull FlutterEngine flutterEngine) { this, flutterEngine.getAccessibilityChannel(), (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE), - getContext().getContentResolver() + getContext().getContentResolver(), + // TODO(mattcaroll): plumb the platform views controller to the accessibility bridge. + // https://github.com/flutter/flutter/issues/29618 + null ); accessibilityBridge.setOnAccessibilityChangeListener(onAccessibilityChangeListener); resetWillNotDraw( diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java new file mode 100644 index 0000000000000..8f07f6b0c5b5b --- /dev/null +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java @@ -0,0 +1,13 @@ +// Copyright 2013 The Flutter 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.platform; + +/** + * Facilitates interaction between the accessibility bridge and embedded platform views. + */ +public interface PlatformViewsAccessibilityDelegate { + // TODO(amirh): add a View getViewById(int id) here. + // not filing a tracking issue as this is going to be done in the next PR. +} diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java index e7297567e198c..bd2ba001e22d3 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java @@ -14,6 +14,7 @@ import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.StandardMethodCodec; +import io.flutter.view.AccessibilityBridge; import io.flutter.view.TextureRegistry; import java.nio.ByteBuffer; @@ -31,7 +32,7 @@ * Each {@link io.flutter.app.FlutterPluginRegistry} has a single platform views controller. * A platform views controller can be attached to at most one Flutter view. */ -public class PlatformViewsController implements MethodChannel.MethodCallHandler { +public class PlatformViewsController implements MethodChannel.MethodCallHandler, PlatformViewsAccessibilityDelegate { private static final String TAG = "PlatformViewsController"; private static final String CHANNEL_NAME = "flutter/platform_views"; @@ -50,6 +51,9 @@ public class PlatformViewsController implements MethodChannel.MethodCallHandler // The messenger used to communicate with the framework over the platform views channel. private BinaryMessenger mMessenger; + // The accessibility bridge to which accessibility events form the platform views will be dispatched. + private AccessibilityBridge accessibilityBridge; + private final HashMap vdControllers; public PlatformViewsController() { @@ -94,6 +98,25 @@ public void detach() { mTextureRegistry = null; } + /** + * Attaches an accessibility bridge for this platform views controller. + * + * Accessibility events sent by platform views that belonging to this controller will be + * dispatched to this accessibility bridge. + */ + public void attachAccessibilityBridge(AccessibilityBridge accessibilityBridge) { + this.accessibilityBridge = accessibilityBridge; + } + + /** + * Detaches the current accessibility bridge. + * + * Any accessibility events sent by platform views belonging to this controller will be ignored. + */ + public void detachAccessibiltyBridge() { + this.accessibilityBridge = null; + } + public PlatformViewRegistry getRegistry() { return mRegistry; } @@ -106,6 +129,17 @@ public void onPreEngineRestart() { flushAllViews(); } + /** + * Returns the embedded view with id, or null if no view with this id is registered. + */ + public View getPlatformViewById(Integer id) { + VirtualDisplayController controller = vdControllers.get(id); + if (controller == null) { + return null; + } + return controller.getView(); + } + @Override public void onMethodCall(final MethodCall call, final MethodChannel.Result result) { if (Build.VERSION.SDK_INT < MINIMAL_SDK) { diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index b0f8e92888de7..f18616b1578e9 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -15,7 +15,6 @@ import android.os.Bundle; import android.os.Handler; import android.provider.Settings; -import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.NonNull; import android.support.annotation.RequiresApi; @@ -27,8 +26,8 @@ import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeProvider; -import io.flutter.embedding.engine.FlutterJNI; import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; +import io.flutter.plugin.platform.PlatformViewsAccessibilityDelegate; import io.flutter.util.Predicate; import java.nio.ByteBuffer; @@ -90,6 +89,11 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { @NonNull private final AccessibilityManager accessibilityManager; + // The delegate for interacting with embedded platform views. Used to embed accessibility data for an embedded + // view in the accessibility tree. + @NonNull + private final PlatformViewsAccessibilityDelegate platformViewsAccessibilityDelegate; + // Android's {@link ContentResolver}, which is used to observe the global TRANSITION_ANIMATION_SCALE, // which determines whether Flutter's animations should be enabled or disabled for accessibility // purposes. @@ -307,12 +311,14 @@ public AccessibilityBridge( @NonNull View rootAccessibilityView, @NonNull AccessibilityChannel accessibilityChannel, @NonNull AccessibilityManager accessibilityManager, - @NonNull ContentResolver contentResolver + @NonNull ContentResolver contentResolver, + @NonNull PlatformViewsAccessibilityDelegate platformViewsAccessibilityDelegate ) { this.rootAccessibilityView = rootAccessibilityView; this.accessibilityChannel = accessibilityChannel; this.accessibilityManager = accessibilityManager; this.contentResolver = contentResolver; + this.platformViewsAccessibilityDelegate = platformViewsAccessibilityDelegate; decorView = ((Activity) rootAccessibilityView.getContext()).getWindow().getDecorView(); diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 0ef972ebdcbe1..0935ab6af2e86 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -43,6 +43,7 @@ import io.flutter.plugin.common.*; import io.flutter.plugin.editing.TextInputPlugin; import io.flutter.plugin.platform.PlatformPlugin; +import io.flutter.plugin.platform.PlatformViewsController; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -660,12 +661,15 @@ public void onFirstFrame() { protected void onAttachedToWindow() { super.onAttachedToWindow(); + PlatformViewsController platformViewsController = getPluginRegistry().getPlatformViewsController(); mAccessibilityNodeProvider = new AccessibilityBridge( this, new AccessibilityChannel(dartExecutor, getFlutterNativeView().getFlutterJNI()), (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE), - getContext().getContentResolver() + getContext().getContentResolver(), + platformViewsController ); + platformViewsController.attachAccessibilityBridge(mAccessibilityNodeProvider); mAccessibilityNodeProvider.setOnAccessibilityChangeListener(onAccessibilityChangeListener); resetWillNotDraw( @@ -678,6 +682,7 @@ protected void onAttachedToWindow() { protected void onDetachedFromWindow() { super.onDetachedFromWindow(); + getPluginRegistry().getPlatformViewsController().detachAccessibiltyBridge(); mAccessibilityNodeProvider.release(); mAccessibilityNodeProvider = null; } From fa1931f6a054a6641c267487e04754def15bf894 Mon Sep 17 00:00:00 2001 From: Francisco Magdaleno Date: Tue, 19 Mar 2019 15:58:11 -0700 Subject: [PATCH 0498/1117] Send macOS keyboard data to the engine (#8219) --- .../macos/framework/Source/FLEViewController.mm | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/shell/platform/darwin/macos/framework/Source/FLEViewController.mm b/shell/platform/darwin/macos/framework/Source/FLEViewController.mm index 76a1e08557004..b0f732e31015b 100644 --- a/shell/platform/darwin/macos/framework/Source/FLEViewController.mm +++ b/shell/platform/darwin/macos/framework/Source/FLEViewController.mm @@ -16,12 +16,6 @@ static const int kDefaultWindowFramebuffer = 0; -// Android KeyEvent constants from https://developer.android.com/reference/android/view/KeyEvent -static const int kAndroidMetaStateShift = 1 << 0; -static const int kAndroidMetaStateAlt = 1 << 1; -static const int kAndroidMetaStateCtrl = 1 << 12; -static const int kAndroidMetaStateMeta = 1 << 16; - #pragma mark - Private interface declaration. /** @@ -476,14 +470,12 @@ - (void)dispatchMouseEvent:(NSEvent*)event phase:(FlutterPointerPhase)phase { - (void)dispatchKeyEvent:(NSEvent*)event ofType:(NSString*)type { [_keyEventChannel sendMessage:@{ - @"keymap" : @"android", + @"keymap" : @"macos", @"type" : type, @"keyCode" : @(event.keyCode), - @"metaState" : - @(((event.modifierFlags & NSEventModifierFlagShift) ? kAndroidMetaStateShift : 0) | - ((event.modifierFlags & NSEventModifierFlagOption) ? kAndroidMetaStateAlt : 0) | - ((event.modifierFlags & NSEventModifierFlagControl) ? kAndroidMetaStateCtrl : 0) | - ((event.modifierFlags & NSEventModifierFlagCommand) ? kAndroidMetaStateMeta : 0)) + @"modifiers" : @(event.modifierFlags), + @"characters" : event.characters, + @"charactersIgnoringModifiers" : event.charactersIgnoringModifiers, }]; } From a1dcb2ea987efe0e257832160a1b0583ac219584 Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Tue, 19 Mar 2019 16:36:11 -0700 Subject: [PATCH 0499/1117] [ios] Set contentsScale before we commit CATransaction (#8218) Layout occurs after [CATransaction commit]. layoutSubviews was where we set the contentsScale on the CALayer. This meant that for one frame, we would see content on the overlay view which was did not have the correct content scale. This change makes it so that we initialize the FlutterOverlayView with the correct contentsScale. This also updates the overlay_gr_context_ when we first create the overlay_view. This is an artifact of #8175. This manifests as jank as seen in: flutter/flutter#29573 --- .../ios/framework/Source/FlutterOverlayView.h | 1 + .../ios/framework/Source/FlutterOverlayView.mm | 15 ++++++++------- .../ios/framework/Source/FlutterPlatformViews.mm | 6 ++++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h b/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h index a344179057bab..7332e46115313 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h @@ -23,6 +23,7 @@ - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; - (instancetype)init NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithContentsScale:(CGFloat)contentsScale; - (std::unique_ptr)createSoftwareSurface; - (std::unique_ptr)createGLSurfaceWithContext: (std::shared_ptr)gl_context; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm b/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm index 83f59d24e0b81..394ae89550150 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm @@ -21,13 +21,13 @@ @implementation FlutterOverlayView - (instancetype)initWithFrame:(CGRect)frame { - @throw([NSException exceptionWithName:@"FlutterOverlayView must initWithDelegate" + @throw([NSException exceptionWithName:@"FlutterOverlayView must init or initWithContentsScale" reason:nil userInfo:nil]); } - (instancetype)initWithCoder:(NSCoder*)aDecoder { - @throw([NSException exceptionWithName:@"FlutterOverlayView must initWithDelegate" + @throw([NSException exceptionWithName:@"FlutterOverlayView must init or initWithContentsScale" reason:nil userInfo:nil]); } @@ -43,16 +43,17 @@ - (instancetype)init { return self; } -- (void)layoutSubviews { +- (instancetype)initWithContentsScale:(CGFloat)contentsScale { + self = [self init]; + 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; + layer.contentsScale = contentsScale; + layer.rasterizationScale = contentsScale; } - [super layoutSubviews]; + return self; } + (Class)layerClass { diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm index 82659b4fe2481..4eb773532a183 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm @@ -245,7 +245,6 @@ active_composition_order_.push_back(view_id); } - composition_order_.clear(); return did_submit; } @@ -294,7 +293,9 @@ } return; } - FlutterOverlayView* overlay_view = [[FlutterOverlayView alloc] init]; + auto contentsScale = flutter_view_.get().layer.contentsScale; + FlutterOverlayView* overlay_view = + [[FlutterOverlayView alloc] initWithContentsScale:contentsScale]; overlay_view.frame = flutter_view_.get().bounds; overlay_view.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); @@ -303,6 +304,7 @@ 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)); + overlays_gr_context_ = gr_context; } } // namespace shell From 3496156bd9bfe61788bf64ce3ca3cf1bc2663f95 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 19 Mar 2019 19:54:21 -0400 Subject: [PATCH 0500/1117] Roll src/third_party/skia dd0544078d05..2894d13a0d9b (33 commits) (#8220) https://skia.googlesource.com/skia.git/%2Blog/dd0544078d05..2894d13a0d9b git log dd0544078d058e68cf91404745b493d7d5a184d0..2894d13a0d9b133587760f50c6026d536f869c29 --date=short --no-merges --format=%ad %ae %s 2019-03-19 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 2dc0303903b1..f2564656e7af (3 commits) 2019-03-19 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-19 halcanary@google.com Documentation: notes on example fiddles 2019-03-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 9b050f846a06..df35e382de78 (2 commits) 2019-03-19 bsalomon@google.com Reland "Add small offset to t in GrLinearGradientLayout." 2019-03-19 fmalita@chromium.org [skottie] Turn on AA for solid layers 2019-03-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 0e712410582f..2dc0303903b1 (1 commits) 2019-03-19 ethannicholas@google.com Revert "more relaxed precision decorations for SPIR-V output" 2019-03-19 halcanary@google.com Docs: fix more case-sensitive names 2019-03-19 fmalita@chromium.org [skottie] Initial camera support 2019-03-19 michaelludwig@google.com Respect strict constraint in drawEdgeAAImageSet 2019-03-19 egdaniel@google.com Don't directly map vertex/index buffers on qualcomm vulkan. 2019-03-19 halcanary@google.com Docs: rename examples files to match names 2019-03-19 kjlubick@google.com Add macro to decide GrGLStandard 2019-03-19 michaelludwig@google.com Add SK_API to ImageSetEntry 2019-03-08 bungeman@google.com Add planet emoji font. 2019-03-19 mtklein@google.com regen from .fp files after .clang-format change 2019-03-19 mtklein@google.com try 2 threads on n7/np 2019-03-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 69be71e10036..ca0130108117 (351 commits) 2019-03-18 ethannicholas@google.com more relaxed precision decorations for SPIR-V output 2019-03-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 7cdf79cccb8e..0e712410582f (1 commits) 2019-03-18 mtklein@google.com tweak .clang-format 2019-03-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 24cb99d44e9c..7cdf79cccb8e (3 commits) 2019-03-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader b8c63935328f..24cb99d44e9c (1 commits) 2019-03-19 michaelludwig@google.com Reland "Reland "Update SkCanvas' experimental SkiaRenderer API"" 2019-03-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 289a576d337a..b8c63935328f (1 commits) 2019-03-18 robertphillips@google.com Have DM's "--pr ~*" processing start from the default list of path renderers 2019-03-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 eb986426cd6d..9b050f846a06 (1 commits) 2019-03-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader bbf5cf1e4762..289a576d337a (1 commits) 2019-03-19 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-18 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-19 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2158 +++++++++++++++--------------- 2 files changed, 1080 insertions(+), 1080 deletions(-) diff --git a/DEPS b/DEPS index bd1147f3e2e06..385733c55aaca 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': 'dd0544078d058e68cf91404745b493d7d5a184d0', + 'skia_revision': '2894d13a0d9b133587760f50c6026d536f869c29', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index bae76d3885006..82c2d1c9653b0 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c3be07455b3622a7b69ee4ec3797c619 +Signature: 3d1439a49fb74adc7f9c3154a6738954 UNUSED LICENSES: @@ -4735,1091 +4735,1091 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== LIBRARY: skia -ORIGIN: ../../../third_party/skia/docs/examples/AutoCanvasRestore_000.cpp + ../../../third_party/skia/LICENSE +ORIGIN: ../../../third_party/skia/docs/examples/Alpha_Constants_a.cpp + ../../../third_party/skia/LICENSE TYPE: LicenseType.bsd -FILE: ../../../third_party/skia/docs/examples/AutoCanvasRestore_000.cpp -FILE: ../../../third_party/skia/docs/examples/AutoCanvasRestore_001.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_000.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_001.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_002.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_003.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_004.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_005.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_006.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_007.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_008.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_009.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_010.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_011.cpp +FILE: ../../../third_party/skia/docs/examples/Alpha_Constants_a.cpp +FILE: ../../../third_party/skia/docs/examples/Alpha_Constants_b.cpp +FILE: ../../../third_party/skia/docs/examples/Alpha_Type_Opaque.cpp +FILE: ../../../third_party/skia/docs/examples/Alpha_Type_Premul.cpp +FILE: ../../../third_party/skia/docs/examples/Alpha_Type_Unpremul.cpp +FILE: ../../../third_party/skia/docs/examples/Anti_Alias.cpp +FILE: ../../../third_party/skia/docs/examples/Arc.cpp +FILE: ../../../third_party/skia/docs/examples/AutoCanvasRestore_SkCanvas_star.cpp +FILE: ../../../third_party/skia/docs/examples/AutoCanvasRestore_restore.cpp FILE: ../../../third_party/skia/docs/examples/Bitmap_012.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_013.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_014.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_015.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_016.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_017.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_018.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_019.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_020.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_021.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_022.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_023.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_024.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_025.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_026.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_027.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_028.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_029.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_030.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_031.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_032.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_033.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_034.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_035.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_036.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_037.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_038.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_039.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_040.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_041.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_042.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_043.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_044.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_045.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_046.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_047.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_048.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_049.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_050.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_051.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_052.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_053.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_054.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_055.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_056.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_057.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_058.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_059.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_060.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_061.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_062.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_063.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_064.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_065.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_066.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_067.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_068.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_069.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_070.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_071.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_072.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_073.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_074.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_075.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_076.cpp -FILE: ../../../third_party/skia/docs/examples/Bitmap_077.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_000.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_001.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_002.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_003.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_004.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_005.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_006.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_007.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_008.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_009.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_010.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_011.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_012.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_013.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_014.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_015.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_016.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_017.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_018.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_019.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_020.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_021.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_022.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_023.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_024.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_025.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_026.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_027.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_028.cpp -FILE: ../../../third_party/skia/docs/examples/BlendMode_029.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_000.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_001.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_002.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_003.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_004.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_005.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_006.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_008.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_009.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_010.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_011.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_012.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_013.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_014.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_015.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_016.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_017.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_018.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_019.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_020.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_021.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_022.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_023.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_024.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_025.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_026.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_027.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_028.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_029.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_030.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_031.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_032.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_033.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_034.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_035.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_036.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_037.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_038.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_039.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_040.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_041.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_042.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_043.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_044.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_045.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_046.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_047.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_048.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_049.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_050.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_051.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_052.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_053.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_054.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_055.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_056.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_057.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_058.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_059.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_060.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_061.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_062.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_063.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_064.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_065.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_066.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_067.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_068.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_069.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_070.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_071.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_072.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_073.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_074.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_075.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_076.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_077.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_078.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_079.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_080.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_081.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_082.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_083.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_084.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_085.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_086.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_087.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_088.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_089.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_090.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_091.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_092.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_093.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_094.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_095.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_097.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_098.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_099.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_100.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_101.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_102.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_103.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_104.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_105.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_106.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_107.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_108.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_109.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_110.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_111.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_112.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_114.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_115.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_116.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_117.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_118.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_119.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_120.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_121.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_122.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_123.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_124.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_125.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_126.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_127.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_128.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_ComputeIsOpaque.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_HeapAllocator_allocPixelRef.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_allocN32Pixels.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_allocPixels.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_allocPixelsFlags.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_allocPixels_2.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_allocPixels_3.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_allocPixels_4.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_bounds.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_bytesPerPixel.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_colorSpace.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_colorType.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_computeByteSize.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_copy_const_SkBitmap.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_copy_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_dimensions.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_drawsNothing.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_empty.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_empty_constructor.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_erase.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_eraseARGB.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_eraseColor.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_extractAlpha.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_extractAlpha_2.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_extractAlpha_3.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_extractSubset.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_getAddr.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_getAddr16.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_getAddr32.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_getAddr8.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_getBounds.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_getBounds_2.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_getColor.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_getGenerationID.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_getPixels.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_getSubset.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_height.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_info.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_installPixels.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_installPixels_2.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_installPixels_3.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_isImmutable.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_isNull.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_isOpaque.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_isVolatile.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_move_SkBitmap.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_move_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_notifyPixelsChanged.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_peekPixels.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_pixelRef.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_pixelRefOrigin.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_pixmap.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_readPixels.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_readPixels_2.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_readPixels_3.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_readyToDraw.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_refColorSpace.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_reset.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_rowBytes.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_rowBytesAsPixels.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_setAlphaType.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_setImmutable.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_setInfo.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_setIsVolatile.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_setPixelRef.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_setPixels.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_shiftPerPixel.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_swap.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_tryAllocN32Pixels.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_tryAllocPixels.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_tryAllocPixelsFlags.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_tryAllocPixels_2.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_tryAllocPixels_3.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_tryAllocPixels_4.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_width.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_writePixels.cpp +FILE: ../../../third_party/skia/docs/examples/Bitmap_writePixels_2.cpp +FILE: ../../../third_party/skia/docs/examples/BlendMode_Name.cpp +FILE: ../../../third_party/skia/docs/examples/Blend_Mode_Methods.cpp FILE: ../../../third_party/skia/docs/examples/Canvas_129.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_130.cpp -FILE: ../../../third_party/skia/docs/examples/Canvas_131.cpp -FILE: ../../../third_party/skia/docs/examples/Color4f_000.cpp -FILE: ../../../third_party/skia/docs/examples/Color4f_001.cpp -FILE: ../../../third_party/skia/docs/examples/Color4f_002.cpp -FILE: ../../../third_party/skia/docs/examples/Color4f_003.cpp -FILE: ../../../third_party/skia/docs/examples/Color4f_004.cpp -FILE: ../../../third_party/skia/docs/examples/Color4f_005.cpp -FILE: ../../../third_party/skia/docs/examples/Color_000.cpp -FILE: ../../../third_party/skia/docs/examples/Color_001.cpp -FILE: ../../../third_party/skia/docs/examples/Color_002.cpp -FILE: ../../../third_party/skia/docs/examples/Color_003.cpp -FILE: ../../../third_party/skia/docs/examples/Color_004.cpp -FILE: ../../../third_party/skia/docs/examples/Color_005.cpp -FILE: ../../../third_party/skia/docs/examples/Color_006.cpp -FILE: ../../../third_party/skia/docs/examples/Color_007.cpp -FILE: ../../../third_party/skia/docs/examples/Color_008.cpp -FILE: ../../../third_party/skia/docs/examples/Color_009.cpp -FILE: ../../../third_party/skia/docs/examples/Color_010.cpp -FILE: ../../../third_party/skia/docs/examples/Color_011.cpp -FILE: ../../../third_party/skia/docs/examples/Color_012.cpp -FILE: ../../../third_party/skia/docs/examples/Color_013.cpp -FILE: ../../../third_party/skia/docs/examples/Color_014.cpp -FILE: ../../../third_party/skia/docs/examples/Color_015.cpp -FILE: ../../../third_party/skia/docs/examples/Color_016.cpp -FILE: ../../../third_party/skia/docs/examples/Color_017.cpp -FILE: ../../../third_party/skia/docs/examples/Color_018.cpp -FILE: ../../../third_party/skia/docs/examples/Font_033.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_000.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_001.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_002.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_003.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_004.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_005.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_006.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_007.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_008.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_009.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_010.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_011.cpp -FILE: ../../../third_party/skia/docs/examples/IPoint_012.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_000.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_001.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_002.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_003.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_004.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_005.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_006.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_007.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_008.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_009.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_010.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_011.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_012.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_013.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_014.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_015.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_016.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_017.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_018.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_019.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_020.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_021.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_022.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_023.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_024.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_025.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_026.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_027.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_028.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_029.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_030.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_031.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_032.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_033.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_034.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_035.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_036.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_037.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_038.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_039.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_040.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_041.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_042.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_043.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_044.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_045.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_046.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_047.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_048.cpp -FILE: ../../../third_party/skia/docs/examples/IRect_049.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_000.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_001.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_002.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_003.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_004.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_005.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_006.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_007.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_008.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_009.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_010.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_011.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_012.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_013.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_014.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_015.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_016.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_017.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_018.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_019.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_020.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_021.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_022.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_023.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_024.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_025.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_026.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_027.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_028.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_029.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_030.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_031.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_032.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_033.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_034.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_035.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_036.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_037.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_038.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_039.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_040.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_041.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_042.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_043.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_044.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_045.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_046.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_047.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_048.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_049.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_050.cpp -FILE: ../../../third_party/skia/docs/examples/ImageInfo_051.cpp -FILE: ../../../third_party/skia/docs/examples/Image_000.cpp -FILE: ../../../third_party/skia/docs/examples/Image_001.cpp -FILE: ../../../third_party/skia/docs/examples/Image_002.cpp -FILE: ../../../third_party/skia/docs/examples/Image_003.cpp -FILE: ../../../third_party/skia/docs/examples/Image_004.cpp -FILE: ../../../third_party/skia/docs/examples/Image_005.cpp -FILE: ../../../third_party/skia/docs/examples/Image_006.cpp -FILE: ../../../third_party/skia/docs/examples/Image_007.cpp -FILE: ../../../third_party/skia/docs/examples/Image_008.cpp -FILE: ../../../third_party/skia/docs/examples/Image_009.cpp -FILE: ../../../third_party/skia/docs/examples/Image_010.cpp -FILE: ../../../third_party/skia/docs/examples/Image_011.cpp -FILE: ../../../third_party/skia/docs/examples/Image_012.cpp -FILE: ../../../third_party/skia/docs/examples/Image_013.cpp -FILE: ../../../third_party/skia/docs/examples/Image_014.cpp -FILE: ../../../third_party/skia/docs/examples/Image_015.cpp -FILE: ../../../third_party/skia/docs/examples/Image_016.cpp -FILE: ../../../third_party/skia/docs/examples/Image_017.cpp -FILE: ../../../third_party/skia/docs/examples/Image_018.cpp -FILE: ../../../third_party/skia/docs/examples/Image_019.cpp -FILE: ../../../third_party/skia/docs/examples/Image_020.cpp -FILE: ../../../third_party/skia/docs/examples/Image_021.cpp -FILE: ../../../third_party/skia/docs/examples/Image_022.cpp -FILE: ../../../third_party/skia/docs/examples/Image_023.cpp -FILE: ../../../third_party/skia/docs/examples/Image_024.cpp -FILE: ../../../third_party/skia/docs/examples/Image_025.cpp -FILE: ../../../third_party/skia/docs/examples/Image_026.cpp -FILE: ../../../third_party/skia/docs/examples/Image_027.cpp -FILE: ../../../third_party/skia/docs/examples/Image_028.cpp -FILE: ../../../third_party/skia/docs/examples/Image_029.cpp -FILE: ../../../third_party/skia/docs/examples/Image_030.cpp -FILE: ../../../third_party/skia/docs/examples/Image_031.cpp -FILE: ../../../third_party/skia/docs/examples/Image_032.cpp -FILE: ../../../third_party/skia/docs/examples/Image_033.cpp -FILE: ../../../third_party/skia/docs/examples/Image_034.cpp -FILE: ../../../third_party/skia/docs/examples/Image_035.cpp -FILE: ../../../third_party/skia/docs/examples/Image_036.cpp -FILE: ../../../third_party/skia/docs/examples/Image_037.cpp -FILE: ../../../third_party/skia/docs/examples/Image_038.cpp -FILE: ../../../third_party/skia/docs/examples/Image_039.cpp -FILE: ../../../third_party/skia/docs/examples/Image_040.cpp -FILE: ../../../third_party/skia/docs/examples/Image_041.cpp -FILE: ../../../third_party/skia/docs/examples/Image_042.cpp -FILE: ../../../third_party/skia/docs/examples/Image_043.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_000.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_001.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_002.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_003.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_004.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_005.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_006.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_007.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_008.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_009.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_010.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_011.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_012.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_013.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_014.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_015.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_016.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_017.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_018.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_019.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_020.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_021.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_022.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_023.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_024.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_026.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_027.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_028.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_029.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_030.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_031.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_032.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_033.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_034.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_035.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_036.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_037.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_038.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_039.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_040.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_041.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_042.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_043.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_044.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_045.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_046.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_047.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_048.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_049.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_050.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_051.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_052.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_053.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_054.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_055.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_056.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_057.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_058.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_059.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_060.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_061.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_062.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_MakeRasterDirect.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_MakeRasterDirectN32.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_PointMode.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_SaveLayerRec.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_SaveLayerRec_SaveLayerRec.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_SaveLayerRec_const_SkRect_star_const_SkPaint_star_const_SkImageFilter_star.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_SrcRectConstraint.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_accessTopLayerPixels_a.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_accessTopLayerPixels_b.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_accessTopRasterHandle.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_clear.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_clipPath.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_clipPath_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_clipPath_3.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_clipRRect.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_clipRRect_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_clipRRect_3.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_clipRect.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_clipRect_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_clipRect_3.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_clipRegion.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_concat.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_const_SkBitmap_const_SkSurfaceProps.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_copy_const_SkBitmap.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_destructor.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawAnnotation_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawArc_a.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawArc_b.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawAtlas.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawAtlas_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawAtlas_3.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawAtlas_4.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawBitmap.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawBitmapLattice.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawBitmapNine.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawBitmapRect.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawBitmapRect_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawBitmapRect_3.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawCircle.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawCircle_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawColor.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawDRRect_a.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawDRRect_b.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawDrawable.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawDrawable_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawIRect.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawImage.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawImageNine.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawImageNine_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawImageRect.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawImageRect_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawImageRect_3.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawImageRect_4.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawImageRect_5.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawImageRect_6.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawImage_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawLine.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawLine_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawOval.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawPaint.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawPatch.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawPatch_2_a.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawPatch_2_b.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawPath.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawPicture_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawPicture_3.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawPicture_4.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawPoint.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawPoint_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawPoints.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawPosText.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawPosTextH.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawRRect.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawRect.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawRegion.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawRoundRect.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawString.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawString_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawText.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawTextBlob.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawTextBlob_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawTextRSXform.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawVertices.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_drawVertices_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_empty_constructor.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_getBaseLayerSize.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_getDeviceClipBounds.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_getDeviceClipBounds_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_getGrContext.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_getLocalClipBounds.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_getLocalClipBounds_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_getProps.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_getSaveCount.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_getTotalMatrix.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_imageInfo.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_int_int_const_SkSurfaceProps_star.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_isClipEmpty.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_isClipRect.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_kInitWithPrevious_SaveLayerFlag.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_makeSurface.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_peekPixels.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_quickReject.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_quickReject_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_readPixels_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_readPixels_3.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_readPixels_a.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_readPixels_b.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_resetMatrix.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_restore.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_restoreToCount.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_rotate.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_rotate_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_save.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_saveLayer.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_saveLayerAlpha.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_saveLayerPreserveLCDTextRequests.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_saveLayer_2.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_saveLayer_3.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_scale.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_setMatrix.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_skew.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_translate.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_writePixels.cpp +FILE: ../../../third_party/skia/docs/examples/Canvas_writePixels_2.cpp +FILE: ../../../third_party/skia/docs/examples/Clear.cpp +FILE: ../../../third_party/skia/docs/examples/Clip.cpp +FILE: ../../../third_party/skia/docs/examples/Color.cpp +FILE: ../../../third_party/skia/docs/examples/ColorGetA.cpp +FILE: ../../../third_party/skia/docs/examples/ColorGetB.cpp +FILE: ../../../third_party/skia/docs/examples/ColorGetG.cpp +FILE: ../../../third_party/skia/docs/examples/ColorGetR.cpp +FILE: ../../../third_party/skia/docs/examples/ColorSetA.cpp +FILE: ../../../third_party/skia/docs/examples/ColorSetARGB.cpp +FILE: ../../../third_party/skia/docs/examples/ColorSetRGB.cpp +FILE: ../../../third_party/skia/docs/examples/ColorToHSV.cpp +FILE: ../../../third_party/skia/docs/examples/ColorTypeBytesPerPixel.cpp +FILE: ../../../third_party/skia/docs/examples/ColorTypeIsAlwaysOpaque.cpp +FILE: ../../../third_party/skia/docs/examples/ColorTypeValidateAlphaType.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Burn.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Constants_a.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Constants_b.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Constants_c.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Constants_d.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Dodge.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Filter_Methods.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Methods.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Type_ARGB_4444.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Type_Alpha_8.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Type_BGRA_8888.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Type_Gray_8.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Type_RGBA_1010102.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Type_RGBA_8888.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Type_RGBA_F16.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Type_RGB_101010.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Type_RGB_565.cpp +FILE: ../../../third_party/skia/docs/examples/Color_Type_RGB_888.cpp +FILE: ../../../third_party/skia/docs/examples/Conic_Weight_a.cpp +FILE: ../../../third_party/skia/docs/examples/Conic_Weight_b.cpp +FILE: ../../../third_party/skia/docs/examples/Conic_Weight_c.cpp +FILE: ../../../third_party/skia/docs/examples/Cubic.cpp +FILE: ../../../third_party/skia/docs/examples/Darken.cpp +FILE: ../../../third_party/skia/docs/examples/Device_Text.cpp +FILE: ../../../third_party/skia/docs/examples/Difference.cpp +FILE: ../../../third_party/skia/docs/examples/Dither_a.cpp +FILE: ../../../third_party/skia/docs/examples/Dither_b.cpp +FILE: ../../../third_party/skia/docs/examples/Draw_Looper_Methods.cpp +FILE: ../../../third_party/skia/docs/examples/Dst.cpp +FILE: ../../../third_party/skia/docs/examples/Dst_Atop.cpp +FILE: ../../../third_party/skia/docs/examples/Dst_In.cpp +FILE: ../../../third_party/skia/docs/examples/Dst_Out.cpp +FILE: ../../../third_party/skia/docs/examples/Dst_Over.cpp +FILE: ../../../third_party/skia/docs/examples/Exclusion.cpp +FILE: ../../../third_party/skia/docs/examples/Fake_Bold.cpp +FILE: ../../../third_party/skia/docs/examples/Filter_Quality_Methods.cpp +FILE: ../../../third_party/skia/docs/examples/Font_breakText.cpp +FILE: ../../../third_party/skia/docs/examples/HSVToColor.cpp +FILE: ../../../third_party/skia/docs/examples/HSVToColor_2.cpp +FILE: ../../../third_party/skia/docs/examples/Hard_Light.cpp +FILE: ../../../third_party/skia/docs/examples/Hue.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_Make.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_add_operator.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_addto_operator.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_equal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_equals.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_isZero.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_minus_operator.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_notequal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_set.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_subtract_operator.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_subtractfrom_operator.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_x.cpp +FILE: ../../../third_party/skia/docs/examples/IPoint_y.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_EmptyIRect.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_Intersects.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_IntersectsNoEmptyCheck.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_MakeEmpty.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_MakeLTRB.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_MakeSize.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_MakeWH.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_MakeXYWH.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_adjust.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_bottom.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_contains.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_containsNoEmptyCheck.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_containsNoEmptyCheck_2.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_contains_2.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_contains_3.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_contains_4.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_equal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_height.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_height64.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_inset.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_intersect.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_intersectNoEmptyCheck.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_intersect_2.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_intersect_3.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_isEmpty.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_isEmpty64.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_join.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_join_2.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_left.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_makeInset.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_makeOffset.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_makeOutset.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_makeSorted.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_notequal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_offset.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_offsetTo.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_offset_2.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_outset.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_right.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_set.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_setEmpty.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_setLTRB.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_setXYWH.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_size.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_sort.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_top.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_width.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_width64.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_x.cpp +FILE: ../../../third_party/skia/docs/examples/IRect_y.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_ByteSizeOverflowed.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_Make.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_MakeA8.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_MakeN32.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_MakeN32Premul.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_MakeN32Premul_2.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_MakeS32.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_MakeUnknown.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_MakeUnknown_2.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_alphaType.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_bounds.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_bytesPerPixel.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_colorSpace.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_colorType.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_computeByteSize.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_computeMinByteSize.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_computeOffset.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_dimensions.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_empty_constructor.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_equal1_operator.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_gammaCloseToSRGB.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_height.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_isEmpty.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_isOpaque.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_makeAlphaType.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_makeColorSpace.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_makeColorType.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_makeWH.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_minRowBytes.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_minRowBytes64.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_notequal1_operator.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_refColorSpace.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_reset.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_shiftPerPixel.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_validRowBytes.cpp +FILE: ../../../third_party/skia/docs/examples/ImageInfo_width.cpp +FILE: ../../../third_party/skia/docs/examples/Image_Filter_Methods.cpp +FILE: ../../../third_party/skia/docs/examples/Image_MakeBackendTextureFromSkImage.cpp +FILE: ../../../third_party/skia/docs/examples/Image_MakeCrossContextFromEncoded.cpp +FILE: ../../../third_party/skia/docs/examples/Image_MakeCrossContextFromPixmap.cpp +FILE: ../../../third_party/skia/docs/examples/Image_MakeFromAdoptedTexture.cpp +FILE: ../../../third_party/skia/docs/examples/Image_MakeFromBitmap.cpp +FILE: ../../../third_party/skia/docs/examples/Image_MakeFromEncoded.cpp +FILE: ../../../third_party/skia/docs/examples/Image_MakeFromGenerator.cpp +FILE: ../../../third_party/skia/docs/examples/Image_MakeFromPicture.cpp +FILE: ../../../third_party/skia/docs/examples/Image_MakeFromRaster.cpp +FILE: ../../../third_party/skia/docs/examples/Image_MakeFromTexture.cpp +FILE: ../../../third_party/skia/docs/examples/Image_MakeFromTexture_2.cpp +FILE: ../../../third_party/skia/docs/examples/Image_MakeRasterCopy.cpp +FILE: ../../../third_party/skia/docs/examples/Image_MakeRasterData.cpp +FILE: ../../../third_party/skia/docs/examples/Image_alphaType.cpp +FILE: ../../../third_party/skia/docs/examples/Image_bounds.cpp +FILE: ../../../third_party/skia/docs/examples/Image_colorSpace.cpp +FILE: ../../../third_party/skia/docs/examples/Image_colorType.cpp +FILE: ../../../third_party/skia/docs/examples/Image_dimensions.cpp +FILE: ../../../third_party/skia/docs/examples/Image_encodeToData.cpp +FILE: ../../../third_party/skia/docs/examples/Image_encodeToData_2.cpp +FILE: ../../../third_party/skia/docs/examples/Image_getBackendTexture.cpp +FILE: ../../../third_party/skia/docs/examples/Image_height.cpp +FILE: ../../../third_party/skia/docs/examples/Image_isAlphaOnly.cpp +FILE: ../../../third_party/skia/docs/examples/Image_isLazyGenerated_a.cpp +FILE: ../../../third_party/skia/docs/examples/Image_isLazyGenerated_b.cpp +FILE: ../../../third_party/skia/docs/examples/Image_isOpaque.cpp +FILE: ../../../third_party/skia/docs/examples/Image_isTextureBacked.cpp +FILE: ../../../third_party/skia/docs/examples/Image_isValid.cpp +FILE: ../../../third_party/skia/docs/examples/Image_makeColorSpace.cpp +FILE: ../../../third_party/skia/docs/examples/Image_makeNonTextureImage.cpp +FILE: ../../../third_party/skia/docs/examples/Image_makeRasterImage.cpp +FILE: ../../../third_party/skia/docs/examples/Image_makeShader.cpp +FILE: ../../../third_party/skia/docs/examples/Image_makeShader_2.cpp +FILE: ../../../third_party/skia/docs/examples/Image_makeSubset.cpp +FILE: ../../../third_party/skia/docs/examples/Image_makeTextureImage.cpp +FILE: ../../../third_party/skia/docs/examples/Image_makeWithFilter.cpp +FILE: ../../../third_party/skia/docs/examples/Image_peekPixels.cpp +FILE: ../../../third_party/skia/docs/examples/Image_readPixels.cpp +FILE: ../../../third_party/skia/docs/examples/Image_readPixels_2.cpp +FILE: ../../../third_party/skia/docs/examples/Image_refColorSpace.cpp +FILE: ../../../third_party/skia/docs/examples/Image_refEncodedData.cpp +FILE: ../../../third_party/skia/docs/examples/Image_scalePixels.cpp +FILE: ../../../third_party/skia/docs/examples/Image_uniqueID.cpp +FILE: ../../../third_party/skia/docs/examples/Image_width.cpp +FILE: ../../../third_party/skia/docs/examples/Lighten.cpp +FILE: ../../../third_party/skia/docs/examples/Luminosity.cpp +FILE: ../../../third_party/skia/docs/examples/Mask_Filter_Methods.cpp FILE: ../../../third_party/skia/docs/examples/Matrix_063.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_064.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_065.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_066.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_067.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_068.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_069.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_070.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_071.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_072.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_073.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_074.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_075.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_076.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_077.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_078.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_079.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_080.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_081.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_082.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_083.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_084.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_085.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_086.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_087.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_088.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_089.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_090.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_091.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_092.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_093.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_094.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_095.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_096.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_097.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_098.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_099.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_100.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_101.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_102.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_103.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_104.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_105.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_106.cpp -FILE: ../../../third_party/skia/docs/examples/Matrix_107.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_000.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_001.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_002.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_003.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_004.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_005.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_006.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_007.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_008.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_009.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_010.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_011.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_012.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_013.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_014.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_015.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_016.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_017.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_018.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_019.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_020.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_021.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_022.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_023.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_024.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_025.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_026.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_027.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_028.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_029.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_030.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_031.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_032.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_033.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_034.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_035.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_036.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_037.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_038.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_039.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_040.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_041.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_042.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_043.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_044.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_045.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_046.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_047.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_048.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_049.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_050.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_051.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_052.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_Concat.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_I.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_InvalidMatrix.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_MakeAll.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_MakeRectToRect.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_MakeScale.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_MakeScale_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_MakeTrans.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_ScaleToFit.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_SetAffineIdentity.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_TypeMask.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_array_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_asAffine.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_cheapEqualTo.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_decomposeScale.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_dirtyMatrixTypeCache.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_dump.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_equal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_fixedStepInX.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_get.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_get9.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_getMaxScale.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_getMinMaxScales.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_getMinScale.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_getPerspX.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_getPerspY.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_getScaleX.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_getScaleY.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_getSkewX.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_getSkewY.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_getTranslateX.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_getTranslateY.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_getType.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_hasPerspective.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_invert.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_isFinite.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_isFixedStepInX.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_isIdentity.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_isScaleTranslate.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_isSimilarity.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_isTranslate.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_mapHomogeneousPoints.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_mapPoints.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_mapPoints_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_mapRadius.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_mapRect.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_mapRectScaleTranslate.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_mapRectToQuad.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_mapRect_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_mapRect_3.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_mapVector.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_mapVector_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_mapVectors.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_mapVectors_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_mapXY.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_mapXY_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_notequal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_postConcat.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_postRotate.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_postRotate_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_postScale.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_postScale_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_postSkew.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_postSkew_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_postTranslate.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_preConcat.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_preRotate.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_preRotate_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_preScale.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_preScale_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_preSkew.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_preSkew_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_preTranslate.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_preservesAxisAlignment.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_preservesRightAngles.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_rectStaysRect.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_reset.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_set.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_set9.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setAffine.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setAll.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setConcat.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setIdentity.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setPerspX.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setPerspY.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setPolyToPoly.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setRSXform.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setRectToRect.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setRotate.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setRotate_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setScale.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setScaleTranslate.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setScaleX.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setScaleY.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setScale_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setSinCos.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setSinCos_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setSkew.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setSkewX.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setSkewY.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setSkew_2.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setTranslate.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setTranslateX.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setTranslateY.cpp +FILE: ../../../third_party/skia/docs/examples/Matrix_setTranslate_2.cpp +FILE: ../../../third_party/skia/docs/examples/MemberIndex.cpp +FILE: ../../../third_party/skia/docs/examples/Miter_Limit.cpp +FILE: ../../../third_party/skia/docs/examples/Modulate.cpp +FILE: ../../../third_party/skia/docs/examples/Multiply.cpp +FILE: ../../../third_party/skia/docs/examples/Overlay.cpp FILE: ../../../third_party/skia/docs/examples/Paint_053.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_054.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_055.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_056.cpp FILE: ../../../third_party/skia/docs/examples/Paint_057.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_058.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_059.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_060.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_061.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_062.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_063.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_064.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_065.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_066.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_067.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_068.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_069.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_070.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_071.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_072.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_074.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_075.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_076.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_077.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_078.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_079.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_080.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_081.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_082.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_083.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_084.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_085.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_086.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_087.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_088.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_089.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_090.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_091.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_092.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_093.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_094.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_095.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_096.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_097.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_098.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_099.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_100.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_101.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_102.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_103.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_104.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_105.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_106.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_107.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_108.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_109.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_110.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_111.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_112.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_113.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_114.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_115.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_116.cpp -FILE: ../../../third_party/skia/docs/examples/Paint_117.cpp -FILE: ../../../third_party/skia/docs/examples/Path_000.cpp -FILE: ../../../third_party/skia/docs/examples/Path_001.cpp -FILE: ../../../third_party/skia/docs/examples/Path_002.cpp -FILE: ../../../third_party/skia/docs/examples/Path_003.cpp -FILE: ../../../third_party/skia/docs/examples/Path_004.cpp -FILE: ../../../third_party/skia/docs/examples/Path_005.cpp -FILE: ../../../third_party/skia/docs/examples/Path_006.cpp -FILE: ../../../third_party/skia/docs/examples/Path_007.cpp -FILE: ../../../third_party/skia/docs/examples/Path_008.cpp -FILE: ../../../third_party/skia/docs/examples/Path_009.cpp -FILE: ../../../third_party/skia/docs/examples/Path_010.cpp -FILE: ../../../third_party/skia/docs/examples/Path_011.cpp -FILE: ../../../third_party/skia/docs/examples/Path_012.cpp -FILE: ../../../third_party/skia/docs/examples/Path_013.cpp -FILE: ../../../third_party/skia/docs/examples/Path_014.cpp -FILE: ../../../third_party/skia/docs/examples/Path_015.cpp -FILE: ../../../third_party/skia/docs/examples/Path_016.cpp -FILE: ../../../third_party/skia/docs/examples/Path_017.cpp -FILE: ../../../third_party/skia/docs/examples/Path_018.cpp -FILE: ../../../third_party/skia/docs/examples/Path_019.cpp -FILE: ../../../third_party/skia/docs/examples/Path_020.cpp -FILE: ../../../third_party/skia/docs/examples/Path_021.cpp -FILE: ../../../third_party/skia/docs/examples/Path_022.cpp -FILE: ../../../third_party/skia/docs/examples/Path_023.cpp -FILE: ../../../third_party/skia/docs/examples/Path_024.cpp -FILE: ../../../third_party/skia/docs/examples/Path_025.cpp -FILE: ../../../third_party/skia/docs/examples/Path_026.cpp -FILE: ../../../third_party/skia/docs/examples/Path_027.cpp -FILE: ../../../third_party/skia/docs/examples/Path_028.cpp -FILE: ../../../third_party/skia/docs/examples/Path_029.cpp -FILE: ../../../third_party/skia/docs/examples/Path_030.cpp -FILE: ../../../third_party/skia/docs/examples/Path_031.cpp -FILE: ../../../third_party/skia/docs/examples/Path_032.cpp -FILE: ../../../third_party/skia/docs/examples/Path_033.cpp -FILE: ../../../third_party/skia/docs/examples/Path_034.cpp -FILE: ../../../third_party/skia/docs/examples/Path_035.cpp -FILE: ../../../third_party/skia/docs/examples/Path_036.cpp -FILE: ../../../third_party/skia/docs/examples/Path_037.cpp -FILE: ../../../third_party/skia/docs/examples/Path_038.cpp -FILE: ../../../third_party/skia/docs/examples/Path_039.cpp -FILE: ../../../third_party/skia/docs/examples/Path_040.cpp -FILE: ../../../third_party/skia/docs/examples/Path_041.cpp -FILE: ../../../third_party/skia/docs/examples/Path_042.cpp -FILE: ../../../third_party/skia/docs/examples/Path_043.cpp -FILE: ../../../third_party/skia/docs/examples/Path_044.cpp -FILE: ../../../third_party/skia/docs/examples/Path_045.cpp -FILE: ../../../third_party/skia/docs/examples/Path_046.cpp -FILE: ../../../third_party/skia/docs/examples/Path_047.cpp -FILE: ../../../third_party/skia/docs/examples/Path_048.cpp -FILE: ../../../third_party/skia/docs/examples/Path_049.cpp -FILE: ../../../third_party/skia/docs/examples/Path_050.cpp -FILE: ../../../third_party/skia/docs/examples/Path_051.cpp -FILE: ../../../third_party/skia/docs/examples/Path_052.cpp -FILE: ../../../third_party/skia/docs/examples/Path_053.cpp -FILE: ../../../third_party/skia/docs/examples/Path_054.cpp -FILE: ../../../third_party/skia/docs/examples/Path_055.cpp -FILE: ../../../third_party/skia/docs/examples/Path_056.cpp -FILE: ../../../third_party/skia/docs/examples/Path_057.cpp -FILE: ../../../third_party/skia/docs/examples/Path_058.cpp -FILE: ../../../third_party/skia/docs/examples/Path_059.cpp -FILE: ../../../third_party/skia/docs/examples/Path_060.cpp -FILE: ../../../third_party/skia/docs/examples/Path_061.cpp -FILE: ../../../third_party/skia/docs/examples/Path_062.cpp -FILE: ../../../third_party/skia/docs/examples/Path_063.cpp -FILE: ../../../third_party/skia/docs/examples/Path_064.cpp -FILE: ../../../third_party/skia/docs/examples/Path_065.cpp -FILE: ../../../third_party/skia/docs/examples/Path_066.cpp -FILE: ../../../third_party/skia/docs/examples/Path_067.cpp -FILE: ../../../third_party/skia/docs/examples/Path_068.cpp -FILE: ../../../third_party/skia/docs/examples/Path_069.cpp -FILE: ../../../third_party/skia/docs/examples/Path_070.cpp -FILE: ../../../third_party/skia/docs/examples/Path_071.cpp -FILE: ../../../third_party/skia/docs/examples/Path_072.cpp -FILE: ../../../third_party/skia/docs/examples/Path_073.cpp -FILE: ../../../third_party/skia/docs/examples/Path_074.cpp -FILE: ../../../third_party/skia/docs/examples/Path_076.cpp -FILE: ../../../third_party/skia/docs/examples/Path_077.cpp -FILE: ../../../third_party/skia/docs/examples/Path_078.cpp -FILE: ../../../third_party/skia/docs/examples/Path_079.cpp -FILE: ../../../third_party/skia/docs/examples/Path_080.cpp -FILE: ../../../third_party/skia/docs/examples/Path_081.cpp -FILE: ../../../third_party/skia/docs/examples/Path_082.cpp -FILE: ../../../third_party/skia/docs/examples/Path_083.cpp -FILE: ../../../third_party/skia/docs/examples/Path_084.cpp -FILE: ../../../third_party/skia/docs/examples/Path_085.cpp -FILE: ../../../third_party/skia/docs/examples/Path_086.cpp -FILE: ../../../third_party/skia/docs/examples/Path_087.cpp -FILE: ../../../third_party/skia/docs/examples/Path_088.cpp -FILE: ../../../third_party/skia/docs/examples/Path_089.cpp -FILE: ../../../third_party/skia/docs/examples/Path_090.cpp -FILE: ../../../third_party/skia/docs/examples/Path_091.cpp -FILE: ../../../third_party/skia/docs/examples/Path_092.cpp -FILE: ../../../third_party/skia/docs/examples/Path_093.cpp -FILE: ../../../third_party/skia/docs/examples/Path_094.cpp -FILE: ../../../third_party/skia/docs/examples/Path_095.cpp -FILE: ../../../third_party/skia/docs/examples/Path_096.cpp -FILE: ../../../third_party/skia/docs/examples/Path_097.cpp -FILE: ../../../third_party/skia/docs/examples/Path_098.cpp -FILE: ../../../third_party/skia/docs/examples/Path_099.cpp -FILE: ../../../third_party/skia/docs/examples/Path_100.cpp -FILE: ../../../third_party/skia/docs/examples/Path_101.cpp -FILE: ../../../third_party/skia/docs/examples/Path_102.cpp -FILE: ../../../third_party/skia/docs/examples/Path_103.cpp -FILE: ../../../third_party/skia/docs/examples/Path_104.cpp -FILE: ../../../third_party/skia/docs/examples/Path_105.cpp -FILE: ../../../third_party/skia/docs/examples/Path_106.cpp -FILE: ../../../third_party/skia/docs/examples/Path_107.cpp -FILE: ../../../third_party/skia/docs/examples/Path_108.cpp -FILE: ../../../third_party/skia/docs/examples/Path_109.cpp -FILE: ../../../third_party/skia/docs/examples/Path_110.cpp -FILE: ../../../third_party/skia/docs/examples/Path_111.cpp -FILE: ../../../third_party/skia/docs/examples/Path_112.cpp -FILE: ../../../third_party/skia/docs/examples/Path_113.cpp -FILE: ../../../third_party/skia/docs/examples/Path_114.cpp -FILE: ../../../third_party/skia/docs/examples/Path_115.cpp -FILE: ../../../third_party/skia/docs/examples/Path_116.cpp -FILE: ../../../third_party/skia/docs/examples/Path_117.cpp -FILE: ../../../third_party/skia/docs/examples/Path_118.cpp -FILE: ../../../third_party/skia/docs/examples/Path_119.cpp -FILE: ../../../third_party/skia/docs/examples/Path_120.cpp -FILE: ../../../third_party/skia/docs/examples/Path_121.cpp -FILE: ../../../third_party/skia/docs/examples/Path_122.cpp -FILE: ../../../third_party/skia/docs/examples/Path_123.cpp -FILE: ../../../third_party/skia/docs/examples/Path_124.cpp -FILE: ../../../third_party/skia/docs/examples/Path_125.cpp -FILE: ../../../third_party/skia/docs/examples/Path_126.cpp -FILE: ../../../third_party/skia/docs/examples/Path_127.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_000.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_001.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_002.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_003.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_004.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_005.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_006.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_007.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_containsText.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_copy_const_SkPaint.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_copy_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_countText.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_empty_constructor.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_equal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getAlpha.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getBlendMode.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getColor.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getColor4f.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getColorFilter.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getDrawLooper.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getFillPath.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getFillPath_2.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getFilterQuality.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getFlags.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getFontMetrics.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getFontSpacing.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getHash.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getHinting.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getImageFilter.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getMaskFilter.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getPathEffect.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getPosTextPath.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getShader.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getStrokeCap.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getStrokeJoin.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getStrokeMiter.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getStrokeWidth.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getStyle.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getTextEncoding.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getTextPath.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getTextScaleX.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getTextSize.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getTextSkewX.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getTextWidths.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_getTypeface.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_isAntiAlias.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_isAutohinted.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_isDither.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_isEmbeddedBitmapText.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_isFakeBoldText.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_isLCDRenderText.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_isLinearText.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_isSubpixelText.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_measureText.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_measureText_2.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_move_SkPaint.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_move_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_notequal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_nothingToDraw.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_refColorFilter.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_refDrawLooper.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_refImageFilter.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_refMaskFilter.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_refPathEffect.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_refShader.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_refTypeface.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_reset.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setARGB.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setAlpha.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setAntiAlias.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setAutohinted.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setBlendMode.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setColor.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setColor4f.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setColorFilter.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setDither.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setDrawLooper.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setEmbeddedBitmapText.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setFakeBoldText.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setFilterQuality.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setFlags.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setHinting.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setImageFilter.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setLCDRenderText.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setLinearText.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setMaskFilter.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setPathEffect.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setShader.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setStrokeCap_a.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setStrokeCap_b.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setStrokeJoin.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setStrokeMiter.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setStrokeWidth.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setStyle.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setSubpixelText.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setTextEncoding.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setTextScaleX.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setTextSize.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setTextSkewX.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_setTypeface.cpp +FILE: ../../../third_party/skia/docs/examples/Paint_textToGlyphs.cpp +FILE: ../../../third_party/skia/docs/examples/Path_AddPathMode.cpp +FILE: ../../../third_party/skia/docs/examples/Path_ArcSize.cpp +FILE: ../../../third_party/skia/docs/examples/Path_ConvertConicToQuads.cpp +FILE: ../../../third_party/skia/docs/examples/Path_ConvertToNonInverseFillType.cpp +FILE: ../../../third_party/skia/docs/examples/Path_Convexity.cpp +FILE: ../../../third_party/skia/docs/examples/Path_Direction.cpp +FILE: ../../../third_party/skia/docs/examples/Path_Effect_Methods.cpp +FILE: ../../../third_party/skia/docs/examples/Path_FillType_a.cpp +FILE: ../../../third_party/skia/docs/examples/Path_FillType_b.cpp +FILE: ../../../third_party/skia/docs/examples/Path_IsCubicDegenerate.cpp +FILE: ../../../third_party/skia/docs/examples/Path_IsInverseFillType.cpp +FILE: ../../../third_party/skia/docs/examples/Path_IsLineDegenerate.cpp +FILE: ../../../third_party/skia/docs/examples/Path_IsQuadDegenerate.cpp +FILE: ../../../third_party/skia/docs/examples/Path_Iter.cpp +FILE: ../../../third_party/skia/docs/examples/Path_Iter_Iter.cpp +FILE: ../../../third_party/skia/docs/examples/Path_Iter_conicWeight.cpp +FILE: ../../../third_party/skia/docs/examples/Path_Iter_const_SkPath.cpp +FILE: ../../../third_party/skia/docs/examples/Path_Iter_isCloseLine.cpp +FILE: ../../../third_party/skia/docs/examples/Path_Iter_isClosedContour.cpp +FILE: ../../../third_party/skia/docs/examples/Path_Iter_next.cpp +FILE: ../../../third_party/skia/docs/examples/Path_Iter_setPath.cpp +FILE: ../../../third_party/skia/docs/examples/Path_RawIter_conicWeight.cpp +FILE: ../../../third_party/skia/docs/examples/Path_RawIter_next.cpp +FILE: ../../../third_party/skia/docs/examples/Path_RawIter_peek.cpp +FILE: ../../../third_party/skia/docs/examples/Path_SegmentMask.cpp +FILE: ../../../third_party/skia/docs/examples/Path_Verb.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addArc.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addCircle.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addOval.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addOval_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addPath.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addPath_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addPath_3.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addPoly.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addPoly_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addRRect.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addRRect_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addRect.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addRect_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addRect_3.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addRoundRect.cpp +FILE: ../../../third_party/skia/docs/examples/Path_addRoundRect_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_arcTo.cpp +FILE: ../../../third_party/skia/docs/examples/Path_arcTo_2_a.cpp +FILE: ../../../third_party/skia/docs/examples/Path_arcTo_2_b.cpp +FILE: ../../../third_party/skia/docs/examples/Path_arcTo_2_c.cpp +FILE: ../../../third_party/skia/docs/examples/Path_arcTo_3.cpp +FILE: ../../../third_party/skia/docs/examples/Path_arcTo_4.cpp +FILE: ../../../third_party/skia/docs/examples/Path_close.cpp +FILE: ../../../third_party/skia/docs/examples/Path_computeTightBounds.cpp +FILE: ../../../third_party/skia/docs/examples/Path_conicTo.cpp +FILE: ../../../third_party/skia/docs/examples/Path_conicTo_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_conservativelyContainsRect.cpp +FILE: ../../../third_party/skia/docs/examples/Path_contains.cpp +FILE: ../../../third_party/skia/docs/examples/Path_copy_const_SkPath.cpp +FILE: ../../../third_party/skia/docs/examples/Path_copy_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Path_countPoints.cpp +FILE: ../../../third_party/skia/docs/examples/Path_countVerbs.cpp +FILE: ../../../third_party/skia/docs/examples/Path_cubicTo.cpp +FILE: ../../../third_party/skia/docs/examples/Path_cubicTo_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_destructor.cpp +FILE: ../../../third_party/skia/docs/examples/Path_dump.cpp +FILE: ../../../third_party/skia/docs/examples/Path_dumpHex.cpp +FILE: ../../../third_party/skia/docs/examples/Path_dump_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_empty_constructor.cpp +FILE: ../../../third_party/skia/docs/examples/Path_equal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Path_getBounds.cpp +FILE: ../../../third_party/skia/docs/examples/Path_getConvexity.cpp +FILE: ../../../third_party/skia/docs/examples/Path_getConvexityOrUnknown.cpp +FILE: ../../../third_party/skia/docs/examples/Path_getFillType.cpp +FILE: ../../../third_party/skia/docs/examples/Path_getGenerationID.cpp +FILE: ../../../third_party/skia/docs/examples/Path_getLastPt.cpp +FILE: ../../../third_party/skia/docs/examples/Path_getPoint.cpp +FILE: ../../../third_party/skia/docs/examples/Path_getPoints.cpp +FILE: ../../../third_party/skia/docs/examples/Path_getSegmentMasks.cpp +FILE: ../../../third_party/skia/docs/examples/Path_getVerbs.cpp +FILE: ../../../third_party/skia/docs/examples/Path_incReserve.cpp +FILE: ../../../third_party/skia/docs/examples/Path_interpolate.cpp +FILE: ../../../third_party/skia/docs/examples/Path_isConvex.cpp +FILE: ../../../third_party/skia/docs/examples/Path_isEmpty.cpp +FILE: ../../../third_party/skia/docs/examples/Path_isFinite.cpp +FILE: ../../../third_party/skia/docs/examples/Path_isInterpolatable.cpp +FILE: ../../../third_party/skia/docs/examples/Path_isInverseFillType_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_isLastContourClosed.cpp +FILE: ../../../third_party/skia/docs/examples/Path_isLine.cpp +FILE: ../../../third_party/skia/docs/examples/Path_isNestedFillRects.cpp +FILE: ../../../third_party/skia/docs/examples/Path_isOval.cpp +FILE: ../../../third_party/skia/docs/examples/Path_isRRect.cpp +FILE: ../../../third_party/skia/docs/examples/Path_isRect.cpp +FILE: ../../../third_party/skia/docs/examples/Path_isVolatile.cpp +FILE: ../../../third_party/skia/docs/examples/Path_lineTo.cpp +FILE: ../../../third_party/skia/docs/examples/Path_lineTo_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_moveTo.cpp +FILE: ../../../third_party/skia/docs/examples/Path_moveTo_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_notequal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Path_offset.cpp +FILE: ../../../third_party/skia/docs/examples/Path_offset_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_quadTo.cpp +FILE: ../../../third_party/skia/docs/examples/Path_quadTo_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_rArcTo.cpp +FILE: ../../../third_party/skia/docs/examples/Path_rConicTo.cpp +FILE: ../../../third_party/skia/docs/examples/Path_rCubicTo.cpp +FILE: ../../../third_party/skia/docs/examples/Path_rLineTo.cpp +FILE: ../../../third_party/skia/docs/examples/Path_rMoveTo.cpp +FILE: ../../../third_party/skia/docs/examples/Path_rQuadTo.cpp +FILE: ../../../third_party/skia/docs/examples/Path_readFromMemory.cpp +FILE: ../../../third_party/skia/docs/examples/Path_reset.cpp +FILE: ../../../third_party/skia/docs/examples/Path_reverseAddPath.cpp +FILE: ../../../third_party/skia/docs/examples/Path_rewind.cpp +FILE: ../../../third_party/skia/docs/examples/Path_serialize.cpp +FILE: ../../../third_party/skia/docs/examples/Path_setConvexity.cpp +FILE: ../../../third_party/skia/docs/examples/Path_setFillType.cpp +FILE: ../../../third_party/skia/docs/examples/Path_setIsVolatile.cpp +FILE: ../../../third_party/skia/docs/examples/Path_setLastPt.cpp +FILE: ../../../third_party/skia/docs/examples/Path_setLastPt_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_swap.cpp +FILE: ../../../third_party/skia/docs/examples/Path_toggleInverseFillType.cpp +FILE: ../../../third_party/skia/docs/examples/Path_transform.cpp +FILE: ../../../third_party/skia/docs/examples/Path_transform_2.cpp +FILE: ../../../third_party/skia/docs/examples/Path_updateBoundsCache.cpp +FILE: ../../../third_party/skia/docs/examples/Path_writeToMemory.cpp FILE: ../../../third_party/skia/docs/examples/Picture_008.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_009.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_010.cpp -FILE: ../../../third_party/skia/docs/examples/Picture_011.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_000.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_001.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_002.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_003.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_004.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_005.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_006.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_007.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_008.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_009.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_010.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_011.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_012.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_013.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_014.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_015.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_016.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_017.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_018.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_019.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_020.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_021.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_022.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_023.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_024.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_025.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_026.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_027.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_028.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_029.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_030.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_031.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_032.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_033.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_034.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_035.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_036.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_037.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_038.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_039.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_040.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_041.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_042.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_043.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_044.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_045.cpp -FILE: ../../../third_party/skia/docs/examples/Pixmap_046.cpp -FILE: ../../../third_party/skia/docs/examples/Point_000.cpp -FILE: ../../../third_party/skia/docs/examples/Point_001.cpp -FILE: ../../../third_party/skia/docs/examples/Point_002.cpp -FILE: ../../../third_party/skia/docs/examples/Point_003.cpp -FILE: ../../../third_party/skia/docs/examples/Point_004.cpp -FILE: ../../../third_party/skia/docs/examples/Point_005.cpp -FILE: ../../../third_party/skia/docs/examples/Point_006.cpp -FILE: ../../../third_party/skia/docs/examples/Point_007.cpp -FILE: ../../../third_party/skia/docs/examples/Point_008.cpp -FILE: ../../../third_party/skia/docs/examples/Point_009.cpp -FILE: ../../../third_party/skia/docs/examples/Point_010.cpp -FILE: ../../../third_party/skia/docs/examples/Point_011.cpp -FILE: ../../../third_party/skia/docs/examples/Point_012.cpp -FILE: ../../../third_party/skia/docs/examples/Point_013.cpp -FILE: ../../../third_party/skia/docs/examples/Point_014.cpp -FILE: ../../../third_party/skia/docs/examples/Point_015.cpp -FILE: ../../../third_party/skia/docs/examples/Point_016.cpp -FILE: ../../../third_party/skia/docs/examples/Point_017.cpp -FILE: ../../../third_party/skia/docs/examples/Point_018.cpp -FILE: ../../../third_party/skia/docs/examples/Point_019.cpp -FILE: ../../../third_party/skia/docs/examples/Point_020.cpp -FILE: ../../../third_party/skia/docs/examples/Point_021.cpp -FILE: ../../../third_party/skia/docs/examples/Point_022.cpp -FILE: ../../../third_party/skia/docs/examples/Point_023.cpp -FILE: ../../../third_party/skia/docs/examples/Point_024.cpp -FILE: ../../../third_party/skia/docs/examples/Point_025.cpp -FILE: ../../../third_party/skia/docs/examples/Point_026.cpp -FILE: ../../../third_party/skia/docs/examples/Point_027.cpp -FILE: ../../../third_party/skia/docs/examples/Point_028.cpp -FILE: ../../../third_party/skia/docs/examples/Point_029.cpp -FILE: ../../../third_party/skia/docs/examples/Point_030.cpp -FILE: ../../../third_party/skia/docs/examples/Point_031.cpp -FILE: ../../../third_party/skia/docs/examples/Point_032.cpp -FILE: ../../../third_party/skia/docs/examples/Point_033.cpp -FILE: ../../../third_party/skia/docs/examples/Point_034.cpp -FILE: ../../../third_party/skia/docs/examples/Point_035.cpp -FILE: ../../../third_party/skia/docs/examples/Point_036.cpp -FILE: ../../../third_party/skia/docs/examples/Point_037.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_000.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_001.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_002.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_003.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_004.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_005.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_006.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_007.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_008.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_009.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_010.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_011.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_012.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_013.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_014.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_015.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_016.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_017.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_018.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_019.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_020.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_021.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_022.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_023.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_024.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_025.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_026.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_027.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_028.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_029.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_030.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_031.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_032.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_033.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_034.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_035.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_036.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_037.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_038.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_039.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_040.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_041.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_042.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_043.cpp -FILE: ../../../third_party/skia/docs/examples/RRect_044.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_000.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_001.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_002.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_003.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_004.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_005.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_006.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_007.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_008.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_009.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_010.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_011.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_012.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_013.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_014.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_015.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_016.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_017.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_018.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_019.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_020.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_021.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_022.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_023.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_024.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_025.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_026.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_027.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_028.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_029.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_030.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_031.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_032.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_033.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_034.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_035.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_036.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_037.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_038.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_039.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_040.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_041.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_042.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_043.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_044.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_045.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_046.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_047.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_048.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_049.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_050.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_051.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_052.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_053.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_054.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_055.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_056.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_057.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_058.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_059.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_060.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_061.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_062.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_063.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_064.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_065.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_066.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_067.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_068.cpp -FILE: ../../../third_party/skia/docs/examples/Rect_069.cpp -FILE: ../../../third_party/skia/docs/examples/Region_000.cpp -FILE: ../../../third_party/skia/docs/examples/Region_001.cpp -FILE: ../../../third_party/skia/docs/examples/Region_002.cpp -FILE: ../../../third_party/skia/docs/examples/Region_003.cpp -FILE: ../../../third_party/skia/docs/examples/Region_004.cpp -FILE: ../../../third_party/skia/docs/examples/Region_005.cpp -FILE: ../../../third_party/skia/docs/examples/Region_006.cpp -FILE: ../../../third_party/skia/docs/examples/Region_007.cpp -FILE: ../../../third_party/skia/docs/examples/Region_008.cpp -FILE: ../../../third_party/skia/docs/examples/Region_009.cpp -FILE: ../../../third_party/skia/docs/examples/Region_010.cpp -FILE: ../../../third_party/skia/docs/examples/Region_011.cpp -FILE: ../../../third_party/skia/docs/examples/Region_012.cpp -FILE: ../../../third_party/skia/docs/examples/Region_013.cpp -FILE: ../../../third_party/skia/docs/examples/Region_014.cpp -FILE: ../../../third_party/skia/docs/examples/Region_015.cpp -FILE: ../../../third_party/skia/docs/examples/Region_016.cpp -FILE: ../../../third_party/skia/docs/examples/Region_017.cpp -FILE: ../../../third_party/skia/docs/examples/Region_018.cpp -FILE: ../../../third_party/skia/docs/examples/Region_019.cpp -FILE: ../../../third_party/skia/docs/examples/Region_020.cpp -FILE: ../../../third_party/skia/docs/examples/Region_021.cpp -FILE: ../../../third_party/skia/docs/examples/Region_022.cpp -FILE: ../../../third_party/skia/docs/examples/Region_023.cpp -FILE: ../../../third_party/skia/docs/examples/Region_024.cpp -FILE: ../../../third_party/skia/docs/examples/Region_025.cpp -FILE: ../../../third_party/skia/docs/examples/Region_026.cpp -FILE: ../../../third_party/skia/docs/examples/Region_027.cpp -FILE: ../../../third_party/skia/docs/examples/Region_028.cpp -FILE: ../../../third_party/skia/docs/examples/Region_029.cpp -FILE: ../../../third_party/skia/docs/examples/Region_030.cpp -FILE: ../../../third_party/skia/docs/examples/Region_031.cpp -FILE: ../../../third_party/skia/docs/examples/Region_032.cpp -FILE: ../../../third_party/skia/docs/examples/Region_033.cpp -FILE: ../../../third_party/skia/docs/examples/Region_034.cpp -FILE: ../../../third_party/skia/docs/examples/Region_035.cpp -FILE: ../../../third_party/skia/docs/examples/Region_036.cpp -FILE: ../../../third_party/skia/docs/examples/Region_037.cpp -FILE: ../../../third_party/skia/docs/examples/Region_038.cpp -FILE: ../../../third_party/skia/docs/examples/Region_039.cpp -FILE: ../../../third_party/skia/docs/examples/Region_040.cpp -FILE: ../../../third_party/skia/docs/examples/Region_041.cpp -FILE: ../../../third_party/skia/docs/examples/Region_042.cpp -FILE: ../../../third_party/skia/docs/examples/Region_043.cpp -FILE: ../../../third_party/skia/docs/examples/Region_044.cpp -FILE: ../../../third_party/skia/docs/examples/Region_045.cpp -FILE: ../../../third_party/skia/docs/examples/Region_046.cpp -FILE: ../../../third_party/skia/docs/examples/Region_047.cpp -FILE: ../../../third_party/skia/docs/examples/Region_048.cpp -FILE: ../../../third_party/skia/docs/examples/Region_049.cpp -FILE: ../../../third_party/skia/docs/examples/Region_050.cpp -FILE: ../../../third_party/skia/docs/examples/Region_051.cpp -FILE: ../../../third_party/skia/docs/examples/Region_052.cpp -FILE: ../../../third_party/skia/docs/examples/Region_053.cpp -FILE: ../../../third_party/skia/docs/examples/Region_054.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_000.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_001.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_002.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_003.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_004.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_005.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_006.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_007.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_008.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_009.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_010.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_011.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_012.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_013.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_015.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_016.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_017.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_018.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_019.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_020.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_021.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_022.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_023.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_024.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_025.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_026.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_027.cpp -FILE: ../../../third_party/skia/docs/examples/Surface_028.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_000.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_001.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_002.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_003.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_004.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_000.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_001.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_002.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_003.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_004.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_005.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_006.cpp -FILE: ../../../third_party/skia/docs/examples/TextBlob_007.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_AbortCallback_abort.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_MakeFromData.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_MakeFromStream.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_MakePlaceholder.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_approximateBytesUsed.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_approximateOpCount.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_cullRect.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_playback.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_serialize.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_serialize_2.cpp +FILE: ../../../third_party/skia/docs/examples/Picture_uniqueID.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_addr.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_addr16.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_addr16_2.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_addr32.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_addr32_2.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_addr64.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_addr64_2.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_addr8.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_addr8_2.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_addrF16.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_addrF16_2.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_addr_2.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_alphaType.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_bounds.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_colorSpace.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_colorType.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_computeByteSize.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_computeIsOpaque.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_const_SkImageInfo_const_star.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_empty_constructor.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_erase.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_erase_2.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_erase_3.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_extractSubset.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_getColor.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_height.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_info.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_isOpaque.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_readPixels.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_readPixels_2.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_readPixels_3.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_readPixels_4.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_reset.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_reset_2.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_rowBytes.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_rowBytesAsPixels.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_scalePixels.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_setColorSpace.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_shiftPerPixel.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_width.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_writable_addr.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_writable_addr16.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_writable_addr32.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_writable_addr64.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_writable_addr8.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_writable_addrF16.cpp +FILE: ../../../third_party/skia/docs/examples/Pixmap_writable_addr_2.cpp +FILE: ../../../third_party/skia/docs/examples/Plus.cpp +FILE: ../../../third_party/skia/docs/examples/Point_CrossProduct.cpp +FILE: ../../../third_party/skia/docs/examples/Point_Distance.cpp +FILE: ../../../third_party/skia/docs/examples/Point_DotProduct.cpp +FILE: ../../../third_party/skia/docs/examples/Point_Length.cpp +FILE: ../../../third_party/skia/docs/examples/Point_Make.cpp +FILE: ../../../third_party/skia/docs/examples/Point_Normalize.cpp +FILE: ../../../third_party/skia/docs/examples/Point_Offset.cpp +FILE: ../../../third_party/skia/docs/examples/Point_Offset_2.cpp +FILE: ../../../third_party/skia/docs/examples/Point_add_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Point_addto_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Point_cross.cpp +FILE: ../../../third_party/skia/docs/examples/Point_distanceToOrigin.cpp +FILE: ../../../third_party/skia/docs/examples/Point_dot.cpp +FILE: ../../../third_party/skia/docs/examples/Point_equal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Point_equals.cpp +FILE: ../../../third_party/skia/docs/examples/Point_isFinite.cpp +FILE: ../../../third_party/skia/docs/examples/Point_isZero.cpp +FILE: ../../../third_party/skia/docs/examples/Point_iset.cpp +FILE: ../../../third_party/skia/docs/examples/Point_iset_2.cpp +FILE: ../../../third_party/skia/docs/examples/Point_length_2.cpp +FILE: ../../../third_party/skia/docs/examples/Point_minus_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Point_multiply_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Point_multiplyby_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Point_negate.cpp +FILE: ../../../third_party/skia/docs/examples/Point_normalize_2.cpp +FILE: ../../../third_party/skia/docs/examples/Point_notequal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Point_offset_3.cpp +FILE: ../../../third_party/skia/docs/examples/Point_scale.cpp +FILE: ../../../third_party/skia/docs/examples/Point_scale_2.cpp +FILE: ../../../third_party/skia/docs/examples/Point_set.cpp +FILE: ../../../third_party/skia/docs/examples/Point_setAbs.cpp +FILE: ../../../third_party/skia/docs/examples/Point_setLength.cpp +FILE: ../../../third_party/skia/docs/examples/Point_setLength_2.cpp +FILE: ../../../third_party/skia/docs/examples/Point_setNormalize.cpp +FILE: ../../../third_party/skia/docs/examples/Point_subtract_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Point_subtractfrom_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Point_x.cpp +FILE: ../../../third_party/skia/docs/examples/Point_y.cpp +FILE: ../../../third_party/skia/docs/examples/PreMultiplyARGB.cpp +FILE: ../../../third_party/skia/docs/examples/PreMultiplyColor.cpp +FILE: ../../../third_party/skia/docs/examples/Quad_a.cpp +FILE: ../../../third_party/skia/docs/examples/Quad_b.cpp +FILE: ../../../third_party/skia/docs/examples/RGBA4f_FromColor.cpp +FILE: ../../../third_party/skia/docs/examples/RGBA4f_equal1_operator.cpp +FILE: ../../../third_party/skia/docs/examples/RGBA4f_notequal1_operator.cpp +FILE: ../../../third_party/skia/docs/examples/RGBA4f_toSkColor.cpp +FILE: ../../../third_party/skia/docs/examples/RGBA4f_vec.cpp +FILE: ../../../third_party/skia/docs/examples/RGBA4f_vec_2.cpp +FILE: ../../../third_party/skia/docs/examples/RGBToHSV.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_Corner.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_MakeEmpty.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_MakeOval.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_MakeRect.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_MakeRectXY.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_Type.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_contains.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_copy_const_SkRRect.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_copy_operator.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_dump.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_dumpHex.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_dump_2.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_empty_constructor.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_equal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_getBounds.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_getSimpleRadii.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_getType.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_height.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_inset.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_inset_2.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_isComplex.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_isEmpty.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_isNinePatch.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_isOval.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_isRect.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_isSimple.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_isValid.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_makeOffset.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_notequal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_offset.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_outset.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_outset_2.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_radii.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_readFromMemory.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_rect.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_setEmpty.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_setNinePatch.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_setOval.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_setRect.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_setRectRadii.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_setRectXY.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_transform.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_type_2.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_width.cpp +FILE: ../../../third_party/skia/docs/examples/RRect_writeToMemory.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_Intersects.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_Make.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_MakeEmpty.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_MakeIWH.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_MakeLTRB.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_MakeSize.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_MakeWH.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_MakeXYWH.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_Make_2.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_asScalars.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_bottom.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_centerX.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_centerY.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_contains.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_contains_2.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_contains_3.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_dump.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_dumpHex.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_dump_2.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_equal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_height.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_inset.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_intersect.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_intersect_2.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_intersect_3.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_intersects_2.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_intersects_3.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_isEmpty.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_isFinite.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_isSorted.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_iset.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_isetWH.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_join.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_joinNonEmptyArg.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_joinPossiblyEmptyRect.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_join_2.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_left.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_makeInset.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_makeOffset.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_makeOutset.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_makeSorted.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_notequal_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_offset.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_offsetTo.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_offset_2.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_outset.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_right.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_round.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_roundIn.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_roundOut.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_roundOut_2.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_roundOut_3.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_round_2.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_set.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_setBounds.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_setBoundsCheck.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_setBoundsNoCheck.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_setEmpty.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_setLTRB.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_setWH.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_setXYWH.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_set_2.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_set_3.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_set_4.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_sort.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_toQuad.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_top.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_width.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_x.cpp +FILE: ../../../third_party/skia/docs/examples/Rect_y.cpp +FILE: ../../../third_party/skia/docs/examples/Region_Cliperator_const_SkRegion_const_SkIRect.cpp +FILE: ../../../third_party/skia/docs/examples/Region_Cliperator_done.cpp +FILE: ../../../third_party/skia/docs/examples/Region_Cliperator_next.cpp +FILE: ../../../third_party/skia/docs/examples/Region_Cliperator_rect.cpp +FILE: ../../../third_party/skia/docs/examples/Region_Iterator_Iterator.cpp +FILE: ../../../third_party/skia/docs/examples/Region_Iterator_copy_const_SkRegion.cpp +FILE: ../../../third_party/skia/docs/examples/Region_Iterator_done.cpp +FILE: ../../../third_party/skia/docs/examples/Region_Iterator_next.cpp +FILE: ../../../third_party/skia/docs/examples/Region_Iterator_rect.cpp +FILE: ../../../third_party/skia/docs/examples/Region_Iterator_reset.cpp +FILE: ../../../third_party/skia/docs/examples/Region_Iterator_rewind.cpp +FILE: ../../../third_party/skia/docs/examples/Region_Iterator_rgn.cpp +FILE: ../../../third_party/skia/docs/examples/Region_Op.cpp +FILE: ../../../third_party/skia/docs/examples/Region_Spanerator_const_SkRegion_int_int_int.cpp +FILE: ../../../third_party/skia/docs/examples/Region_Spanerator_next.cpp +FILE: ../../../third_party/skia/docs/examples/Region_computeRegionComplexity.cpp +FILE: ../../../third_party/skia/docs/examples/Region_contains.cpp +FILE: ../../../third_party/skia/docs/examples/Region_contains_2.cpp +FILE: ../../../third_party/skia/docs/examples/Region_contains_3.cpp +FILE: ../../../third_party/skia/docs/examples/Region_copy_const_SkIRect.cpp +FILE: ../../../third_party/skia/docs/examples/Region_copy_const_SkRegion.cpp +FILE: ../../../third_party/skia/docs/examples/Region_copy_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Region_destructor.cpp +FILE: ../../../third_party/skia/docs/examples/Region_empty_constructor.cpp +FILE: ../../../third_party/skia/docs/examples/Region_equal1_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Region_getBoundaryPath.cpp +FILE: ../../../third_party/skia/docs/examples/Region_getBounds.cpp +FILE: ../../../third_party/skia/docs/examples/Region_intersects.cpp +FILE: ../../../third_party/skia/docs/examples/Region_intersects_2.cpp +FILE: ../../../third_party/skia/docs/examples/Region_isComplex.cpp +FILE: ../../../third_party/skia/docs/examples/Region_isEmpty.cpp +FILE: ../../../third_party/skia/docs/examples/Region_isRect.cpp +FILE: ../../../third_party/skia/docs/examples/Region_notequal1_operator.cpp +FILE: ../../../third_party/skia/docs/examples/Region_op_1.cpp +FILE: ../../../third_party/skia/docs/examples/Region_op_2.cpp +FILE: ../../../third_party/skia/docs/examples/Region_op_3.cpp +FILE: ../../../third_party/skia/docs/examples/Region_op_4.cpp +FILE: ../../../third_party/skia/docs/examples/Region_op_5.cpp +FILE: ../../../third_party/skia/docs/examples/Region_op_6.cpp +FILE: ../../../third_party/skia/docs/examples/Region_quickContains.cpp +FILE: ../../../third_party/skia/docs/examples/Region_quickContains_2.cpp +FILE: ../../../third_party/skia/docs/examples/Region_quickReject.cpp +FILE: ../../../third_party/skia/docs/examples/Region_quickReject_2.cpp +FILE: ../../../third_party/skia/docs/examples/Region_readFromMemory.cpp +FILE: ../../../third_party/skia/docs/examples/Region_set.cpp +FILE: ../../../third_party/skia/docs/examples/Region_setEmpty.cpp +FILE: ../../../third_party/skia/docs/examples/Region_setPath.cpp +FILE: ../../../third_party/skia/docs/examples/Region_setRect.cpp +FILE: ../../../third_party/skia/docs/examples/Region_setRect_2.cpp +FILE: ../../../third_party/skia/docs/examples/Region_setRects.cpp +FILE: ../../../third_party/skia/docs/examples/Region_setRegion.cpp +FILE: ../../../third_party/skia/docs/examples/Region_swap.cpp +FILE: ../../../third_party/skia/docs/examples/Region_translate.cpp +FILE: ../../../third_party/skia/docs/examples/Region_translate_2.cpp +FILE: ../../../third_party/skia/docs/examples/Region_writeToMemory.cpp +FILE: ../../../third_party/skia/docs/examples/Saturation.cpp +FILE: ../../../third_party/skia/docs/examples/Screen.cpp +FILE: ../../../third_party/skia/docs/examples/Shader_Methods_a.cpp +FILE: ../../../third_party/skia/docs/examples/Shader_Methods_b.cpp +FILE: ../../../third_party/skia/docs/examples/Soft_Light.cpp +FILE: ../../../third_party/skia/docs/examples/Src.cpp +FILE: ../../../third_party/skia/docs/examples/Src_Atop.cpp +FILE: ../../../third_party/skia/docs/examples/Src_In.cpp +FILE: ../../../third_party/skia/docs/examples/Src_Out.cpp +FILE: ../../../third_party/skia/docs/examples/Src_Over.cpp +FILE: ../../../third_party/skia/docs/examples/State_Stack_a.cpp +FILE: ../../../third_party/skia/docs/examples/State_Stack_b.cpp +FILE: ../../../third_party/skia/docs/examples/Stroke_Width.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_MakeFromBackendTexture.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_MakeFromBackendTextureAsRenderTarget.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_MakeNull.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_MakeRaster.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_MakeRasterDirect.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_MakeRasterDirectReleaseProc.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_MakeRasterN32Premul.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_MakeRaster_2.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_MakeRenderTarget.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_MakeRenderTarget_2.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_MakeRenderTarget_3.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_characterize.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_draw.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_draw_2.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_getCanvas.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_height.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_makeImageSnapshot.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_makeImageSnapshot_2.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_makeSurface.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_notifyContentWillChange.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_peekPixels.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_props.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_readPixels.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_readPixels_2.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_readPixels_3.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_width.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_writePixels.cpp +FILE: ../../../third_party/skia/docs/examples/Surface_writePixels_2.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_allocRun.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_allocRunPos.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_allocRunPosH.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_empty_constructor.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlobBuilder_make.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_Deserialize.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_MakeFromString.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_MakeFromText.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_bounds.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_getIntercepts.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_serialize.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_serialize_2.cpp +FILE: ../../../third_party/skia/docs/examples/TextBlob_uniqueID.cpp +FILE: ../../../third_party/skia/docs/examples/Text_Encoding.cpp +FILE: ../../../third_party/skia/docs/examples/Text_Scale_X.cpp +FILE: ../../../third_party/skia/docs/examples/Text_Size.cpp +FILE: ../../../third_party/skia/docs/examples/Text_Skew_X.cpp +FILE: ../../../third_party/skia/docs/examples/Typeface_Methods.cpp +FILE: ../../../third_party/skia/docs/examples/Xor.cpp FILE: ../../../third_party/skia/gm/crbug_918512.cpp ---------------------------------------------------------------------------------------------------- Copyright 2019 Google LLC. From ee4abba58ce8b7ca576497ebe0d804b0a51a3c2a Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 20 Mar 2019 01:23:56 -0400 Subject: [PATCH 0501/1117] Roll src/third_party/skia 2894d13a0d9b..37a9294d2eb9 (1 commits) (#8222) https://skia.googlesource.com/skia.git/%2Blog/2894d13a0d9b..37a9294d2eb9 git log 2894d13a0d9b133587760f50c6026d536f869c29..37a9294d2eb985c5c8bf1462646e7b8b70aef5cb --date=short --no-merges --format=%ad %ae %s 2019-03-19 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 385733c55aaca..1ae592d55e60e 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': '2894d13a0d9b133587760f50c6026d536f869c29', + 'skia_revision': '37a9294d2eb985c5c8bf1462646e7b8b70aef5cb', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 82c2d1c9653b0..cfcc2fa934341 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 3d1439a49fb74adc7f9c3154a6738954 +Signature: d7f06ebd15c8ce18dc4e0d9f873af3fc UNUSED LICENSES: From be9067cc764d4adced316db8a96186089d87892e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 20 Mar 2019 04:52:13 -0400 Subject: [PATCH 0502/1117] Roll src/third_party/skia 37a9294d2eb9..d7d93001ead2 (2 commits) (#8223) https://skia.googlesource.com/skia.git/%2Blog/37a9294d2eb9..d7d93001ead2 git log 37a9294d2eb985c5c8bf1462646e7b8b70aef5cb..d7d93001ead20ddf31d2c4352ccf2fd6b87f791b --date=short --no-merges --format=%ad %ae %s 2019-03-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 df35e382de78..6ce1be5a5a53 (2 commits) 2019-03-20 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 1ae592d55e60e..4d0bff78fbe2f 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': '37a9294d2eb985c5c8bf1462646e7b8b70aef5cb', + 'skia_revision': 'd7d93001ead20ddf31d2c4352ccf2fd6b87f791b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index cfcc2fa934341..64c2a23bb2907 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: d7f06ebd15c8ce18dc4e0d9f873af3fc +Signature: 8074c43ec379bde76e8bce94445a404b UNUSED LICENSES: From e88573aef75d3bb906512ad35ce7ab547cb4d9a2 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 20 Mar 2019 08:21:12 -0400 Subject: [PATCH 0503/1117] Roll src/third_party/skia d7d93001ead2..4273a150f84d (1 commits) (#8224) https://skia.googlesource.com/skia.git/%2Blog/d7d93001ead2..4273a150f84d git log d7d93001ead20ddf31d2c4352ccf2fd6b87f791b..4273a150f84d70a9acc340261fd5e7be1af310a5 --date=short --no-merges --format=%ad %ae %s 2019-03-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader f2564656e7af..3e485a4f3ec8 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4d0bff78fbe2f..e54cf9ce84691 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': 'd7d93001ead20ddf31d2c4352ccf2fd6b87f791b', + 'skia_revision': '4273a150f84d70a9acc340261fd5e7be1af310a5', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 64c2a23bb2907..670d982e48c54 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8074c43ec379bde76e8bce94445a404b +Signature: 0a2fd38c998e20b99ec89e55e3387451 UNUSED LICENSES: From d9b6629b61050a530dbe8d15b53c19068bc30c07 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 20 Mar 2019 11:51:14 -0400 Subject: [PATCH 0504/1117] Roll src/third_party/skia 4273a150f84d..ba91f65f2070 (6 commits) (#8225) https://skia.googlesource.com/skia.git/%2Blog/4273a150f84d..ba91f65f2070 git log 4273a150f84d70a9acc340261fd5e7be1af310a5..ba91f65f20701ce6ae6b43556d1ffb7c8be61a73 --date=short --no-merges --format=%ad %ae %s 2019-03-19 jvanverth@google.com Tweaks to Metal pipeline state. 2019-03-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3e485a4f3ec8..5851ef46d285 (1 commits) 2019-03-20 kjlubick@google.com Make ios actually fail 2019-03-20 brianosman@google.com Remove all of the _as_paths GMs 2019-03-19 kjlubick@google.com [canvaskit] Add requestAnimationFrame to SkSurface 2019-03-20 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index e54cf9ce84691..c46ff955513f2 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': '4273a150f84d70a9acc340261fd5e7be1af310a5', + 'skia_revision': 'ba91f65f20701ce6ae6b43556d1ffb7c8be61a73', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 670d982e48c54..f31176df3dbc4 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 0a2fd38c998e20b99ec89e55e3387451 +Signature: affcc1ae5b1bd60f3e3e4839e61b054a UNUSED LICENSES: @@ -4228,7 +4228,6 @@ FILE: ../../../third_party/skia/gm/pictureshadercache.cpp FILE: ../../../third_party/skia/gm/radial_gradient_precision.cpp FILE: ../../../third_party/skia/gm/savelayer.cpp FILE: ../../../third_party/skia/gm/shadowutils.cpp -FILE: ../../../third_party/skia/gm/shapes_as_paths.cpp FILE: ../../../third_party/skia/gm/simple_magnification.cpp FILE: ../../../third_party/skia/gm/srgb.cpp FILE: ../../../third_party/skia/gm/testgradient.cpp From 3b19a4d30f50e183ed998484c42b02607c674d5c Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 20 Mar 2019 08:42:25 -0700 Subject: [PATCH 0505/1117] Removed dart_plugin_tag from DEPS --- DEPS | 4 ---- 1 file changed, 4 deletions(-) diff --git a/DEPS b/DEPS index c46ff955513f2..14ff86a7710d6 100644 --- a/DEPS +++ b/DEPS @@ -72,7 +72,6 @@ vars = { 'dart_package_config_tag': '1.0.5', 'dart_package_resolver_tag': '1.0.10', 'dart_path_tag': '1.6.2', - 'dart_plugin_tag': 'f5b4b0e32d1406d62daccea030ba6457d14b1c47', 'dart_pool_tag': '1.3.6', 'dart_protobuf_rev': '0c77167b16d00b561a6055bfe26690af7f26ae88', 'dart_pub_rev': '3c060aae47985e9a248b850f1d0450304a5c97e3', @@ -279,9 +278,6 @@ deps = { 'src/third_party/dart/third_party/pkg/pool': Var('dart_git') + '/pool.git' + '@' + Var('dart_pool_tag'), - 'src/third_party/dart/third_party/pkg/plugin': - Var('dart_git') + '/plugin.git' + '@' + Var('dart_plugin_tag'), - 'src/third_party/dart/third_party/pkg/protobuf': Var('dart_git') + '/protobuf.git' + '@' + Var('dart_protobuf_rev'), From bb354363e0bb5cee5d8e561f144a9bc7e1d364cc Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 20 Mar 2019 09:44:09 -0700 Subject: [PATCH 0506/1117] Roll src/third_party/dart 70e3e67dd7..5e9df35a57 (45 commits) 5e9df35a57 [vm/ffi] Correctly sign- or zero-extend arguments and return values from native code. 33491a7d61 [infra] Remove unneeded check in test.py def9671d32 [VM/SIMDBC] Add simdbc64 bytecodes to allow LoadIndexed/StoreIndexed to work on untagged arrays 8af57275eb Can't override implied setter covariantly 578249629d [co19 DEPS updated] c4c0db440c Handle ir constants in noSuchMethod handling and deferred load 58882ffdd4 VM reads import uri if kernel binary version >= 22 3c2bfa554a Resolve type conflicts in dart:js e9e0daee5c Add importUri and fileUri to Source. 4daa9b94ea [cfe] Compile if elements in lists and sets c9efa472da Remove instrumentTopLevelInference as it is redundant with expectation files 57ac8b1ad9 Remove redundant instrumentation from tests and expectations. 6e1888af6b Circular type inference leads to InvalidType 479483ed13 Compute isGenericCovariantImpl in outline phase b18b626d78 Remove deprecated AST structures related to the "UI as code" feature. 7fe4253a4e [analyzer] fix #36158, implicit cast missing on covariant return type 7e14f2aded Removed mirror methods from DeferredLoadTask dec7e65334 Delete Flags.enableExperimentalMirrors 7eabbe70cd Make the --repl-compile option visible 9c8e6dc42c [analyzer] rewrite mostSpecificTypeArgument to use asInstanceOf 565e56dba6 [vm] Reduce cost of allocation tracing. eaf41e49bf Re-land Linter 0.1.83 337a252c31 [analyzer] UI as code test cleanup 89f00ab25f Add a build rule for bytecode version of kernel_service.dill fadf9b5fb3 [vm] Account for direct code calls from unoptimized code for --reused_instructions. d0bdfee041 Fix DDC cast -- cast key/value/element individually & don't clobber names. 67243e0396 AstTextPrinter that prints AST tokens into their original positions. d214646d89 Remove TestAnalysisContext and related. 22c535ac6e [dartdevc] simplify code for emitting constants 040fa0f83c Add undefined identifier test for for loops 21810c2aa1 Include gen_kernel_bytecode in create_sdk so that it can be uploaded by the builders 5614f8d771 Revert "bump linter to 0.1.83" 85e5684863 Remove OptionsWorkManager and GenerateOptionsErrorsTask is not a task. 33100aa1ce Delete some copy/pasted doc comments 2c001aacc0 [vm] Address various quirks observed in Fuchsia profiling samples. 9910374c20 Fix mistakes in control flow ambiguity test. 87108efecb [gardening] Update flutter patch so flutter compile_test passes. 55f3edadbe [dartdevc] Initial support for spread collections 2ceaccf5f6 Report EQUAL_ELEMENTS_IN_CONST_SET. 0c34bf13ea update ElementResolver postfix NNBD bang processing 9788949db8 Run dartfmt on pkg/analyzer/test/dart/ast/ast_test.dart d012972c8d [CFE] Fold the asExpression call into the unique function. ee1e036adf [CFE] Lazy constant evaluation for maybe-evaluated expressions. 330b958e20 [CFE] Check for null in constant evaluation. ca5ac975fe Fix for crash in _DartNavigationComputerVisitor._addUriDirectiveRegion when part has invalid URI. --- DEPS | 6 +++--- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index 14ff86a7710d6..b5165ea9e0442 100644 --- a/DEPS +++ b/DEPS @@ -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': '70e3e67dd71267a611429602b342d484fca9b89b', + 'dart_revision': '5e9df35a5794413202fbcaf0c41f6d4c5d2e7b81', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -48,7 +48,7 @@ vars = { 'dart_crypto_tag': '2.0.6', 'dart_csslib_tag': '0.14.4+1', 'dart_dart2js_info_tag': '0.6.0', - 'dart_dart_style_tag': '1.2.2', + 'dart_dart_style_tag': '1.2.4', 'dart_dartdoc_tag': 'v0.28.2', 'dart_fixnum_tag': '0.10.9', 'dart_glob_tag': '1.1.7', @@ -60,7 +60,7 @@ vars = { 'dart_http_throttle_tag': '1.0.2', 'dart_intl_tag': '0.15.7', 'dart_json_rpc_2_tag': '2.0.9', - 'dart_linter_tag': '0.1.82', + 'dart_linter_tag': '0.1.83', 'dart_logging_tag': '0.11.3+2', 'dart_markdown_tag': '2.0.2', 'dart_matcher_tag': '0.12.3', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index fa339383e919c..6e749b255b82f 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: c306c24d471bef4884795341830a763e +Signature: d8611addc54dd5fe85355e2e888206d4 UNUSED LICENSES: From 1dbd2046b57a5d6a952a80365f12d8651e7cbd18 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 20 Mar 2019 11:30:49 -0700 Subject: [PATCH 0507/1117] Moved io.flutter.embedding.engine.android package to io.flutter.embedding.android (#8221) --- ci/licenses_golden/licenses_flutter | 14 +++++++------- shell/platform/android/BUILD.gn | 14 +++++++------- .../{engine => }/android/AndroidKeyProcessor.java | 2 +- .../android/AndroidTouchProcessor.java | 6 ++++-- .../{engine => }/android/FlutterActivity.java | 2 +- .../{engine => }/android/FlutterFragment.java | 2 +- .../{engine => }/android/FlutterSurfaceView.java | 4 +--- .../{engine => }/android/FlutterTextureView.java | 4 +--- .../{engine => }/android/FlutterView.java | 6 +----- .../embedding/engine/renderer/FlutterRenderer.java | 3 ++- .../android/io/flutter/view/FlutterView.java | 5 ++--- tools/android_lint/baseline.xml | 2 +- 12 files changed, 29 insertions(+), 35 deletions(-) rename shell/platform/android/io/flutter/embedding/{engine => }/android/AndroidKeyProcessor.java (98%) rename shell/platform/android/io/flutter/embedding/{engine => }/android/AndroidTouchProcessor.java (98%) rename shell/platform/android/io/flutter/embedding/{engine => }/android/FlutterActivity.java (99%) rename shell/platform/android/io/flutter/embedding/{engine => }/android/FlutterFragment.java (99%) rename shell/platform/android/io/flutter/embedding/{engine => }/android/FlutterSurfaceView.java (98%) rename shell/platform/android/io/flutter/embedding/{engine => }/android/FlutterTextureView.java (98%) rename shell/platform/android/io/flutter/embedding/{engine => }/android/FlutterView.java (99%) diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 55a5f63693062..6c669632c5213 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -467,16 +467,16 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/app/FlutterActivityEven 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/AndroidKeyProcessor.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.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/FlutterSurfaceView.java +FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterTextureView.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/android/AndroidKeyProcessor.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterActivity.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java -FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartMessenger.java FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/PlatformMessageHandler.java diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index bb5b74c05e5b7..e26d71a30e38e 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -109,16 +109,16 @@ java_library("flutter_shell_java") { "io/flutter/app/FlutterApplication.java", "io/flutter/app/FlutterFragmentActivity.java", "io/flutter/app/FlutterPluginRegistry.java", + "io/flutter/embedding/android/AndroidKeyProcessor.java", + "io/flutter/embedding/android/AndroidTouchProcessor.java", + "io/flutter/embedding/android/FlutterActivity.java", + "io/flutter/embedding/android/FlutterFragment.java", + "io/flutter/embedding/android/FlutterSurfaceView.java", + "io/flutter/embedding/android/FlutterTextureView.java", + "io/flutter/embedding/android/FlutterView.java", "io/flutter/embedding/engine/FlutterEngine.java", "io/flutter/embedding/engine/FlutterJNI.java", "io/flutter/embedding/engine/FlutterShellArgs.java", - "io/flutter/embedding/engine/android/AndroidKeyProcessor.java", - "io/flutter/embedding/engine/android/AndroidTouchProcessor.java", - "io/flutter/embedding/engine/android/FlutterActivity.java", - "io/flutter/embedding/engine/android/FlutterFragment.java", - "io/flutter/embedding/engine/android/FlutterSurfaceView.java", - "io/flutter/embedding/engine/android/FlutterTextureView.java", - "io/flutter/embedding/engine/android/FlutterView.java", "io/flutter/embedding/engine/dart/DartExecutor.java", "io/flutter/embedding/engine/dart/DartMessenger.java", "io/flutter/embedding/engine/dart/PlatformMessageHandler.java", diff --git a/shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.java b/shell/platform/android/io/flutter/embedding/android/AndroidKeyProcessor.java similarity index 98% rename from shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.java rename to shell/platform/android/io/flutter/embedding/android/AndroidKeyProcessor.java index 09f992de7c6d1..9ceb3900506e4 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/AndroidKeyProcessor.java +++ b/shell/platform/android/io/flutter/embedding/android/AndroidKeyProcessor.java @@ -2,7 +2,7 @@ // 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.android; +package io.flutter.embedding.android; import android.support.annotation.NonNull; import android.support.annotation.Nullable; diff --git a/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java b/shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java similarity index 98% rename from shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java rename to shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java index 8598b8a8df772..ce69702143551 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/AndroidTouchProcessor.java +++ b/shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java @@ -1,4 +1,4 @@ -package io.flutter.embedding.engine.android; +package io.flutter.embedding.android; import android.os.Build; import android.support.annotation.IntDef; @@ -164,7 +164,9 @@ public boolean onGenericMotionEvent(MotionEvent event) { // ACTION_HOVER_MOVE always applies to a single pointer only. addPointerForIndex(event, event.getActionIndex(), pointerChange, 0, packet); - assert(packet.position() % (POINTER_DATA_FIELD_COUNT * BYTES_PER_FIELD) != 0); + if (packet.position() % (POINTER_DATA_FIELD_COUNT * BYTES_PER_FIELD) != 0) { + throw new AssertionError("Packet position is not on field boundary."); + } renderer.dispatchPointerDataPacket(packet, packet.position()); return true; } diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterActivity.java b/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java similarity index 99% rename from shell/platform/android/io/flutter/embedding/engine/android/FlutterActivity.java rename to shell/platform/android/io/flutter/embedding/android/FlutterActivity.java index cdaab64827699..0b75d129c6cf6 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterActivity.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java @@ -2,7 +2,7 @@ // 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.android; +package io.flutter.embedding.android; import android.content.Context; import android.content.Intent; diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java similarity index 99% rename from shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java rename to shell/platform/android/io/flutter/embedding/android/FlutterFragment.java index bc19348f7f06a..53c283d934c1a 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterFragment.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java @@ -2,7 +2,7 @@ // 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.android; +package io.flutter.embedding.android; import android.content.Context; import android.content.Intent; diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java b/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java similarity index 98% rename from shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java rename to shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java index 944e26b7c84a8..c28eac9c5d1a1 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterSurfaceView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java @@ -2,7 +2,7 @@ // 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.android; +package io.flutter.embedding.android; import android.content.Context; import android.support.annotation.NonNull; @@ -12,8 +12,6 @@ import android.view.SurfaceHolder; import android.view.SurfaceView; -import java.nio.ByteBuffer; - import io.flutter.embedding.engine.renderer.FlutterRenderer; /** diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java b/shell/platform/android/io/flutter/embedding/android/FlutterTextureView.java similarity index 98% rename from shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java rename to shell/platform/android/io/flutter/embedding/android/FlutterTextureView.java index 048fc71a4430f..32850ff17e875 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterTextureView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterTextureView.java @@ -2,7 +2,7 @@ // 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.android; +package io.flutter.embedding.android; import android.content.Context; import android.graphics.SurfaceTexture; @@ -13,8 +13,6 @@ import android.view.Surface; import android.view.TextureView; -import java.nio.ByteBuffer; - import io.flutter.embedding.engine.renderer.FlutterRenderer; /** diff --git a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/android/FlutterView.java similarity index 99% rename from shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java rename to shell/platform/android/io/flutter/embedding/android/FlutterView.java index 3c104b32c61f3..8469519b3ee63 100644 --- a/shell/platform/android/io/flutter/embedding/engine/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -2,7 +2,7 @@ // 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.android; +package io.flutter.embedding.android; import android.annotation.TargetApi; import android.content.Context; @@ -10,7 +10,6 @@ import android.graphics.Rect; import android.os.Build; import android.os.LocaleList; -import android.provider.Settings; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.RequiresApi; @@ -20,7 +19,6 @@ import android.view.KeyEvent; import android.view.MotionEvent; import android.view.WindowInsets; -import android.view.WindowManager; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeProvider; import android.view.inputmethod.EditorInfo; @@ -33,10 +31,8 @@ import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.renderer.FlutterRenderer; -import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; import io.flutter.plugin.editing.TextInputPlugin; import io.flutter.view.AccessibilityBridge; -import io.flutter.view.VsyncWaiter; /** * Displays a Flutter UI on an Android device. 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 dd0e198c1f26a..5fd3521e545df 100644 --- a/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java +++ b/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java @@ -15,6 +15,7 @@ import java.nio.ByteBuffer; import java.util.concurrent.atomic.AtomicLong; +import io.flutter.embedding.android.FlutterView; import io.flutter.embedding.engine.FlutterJNI; import io.flutter.view.TextureRegistry; @@ -29,7 +30,7 @@ * code via JNI. The corresponding {@link RenderSurface} is used as a delegate to carry out * certain actions on behalf of this {@code FlutterRenderer} within an Android view hierarchy. * - * {@link io.flutter.embedding.engine.android.FlutterView} is an implementation of a {@link RenderSurface}. + * {@link FlutterView} is an implementation of a {@link RenderSurface}. */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public class FlutterRenderer implements TextureRegistry { diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 0935ab6af2e86..4faef7d518ba9 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -15,7 +15,6 @@ import android.os.Build; import android.os.Handler; import android.os.LocaleList; -import android.provider.Settings; import android.support.annotation.RequiresApi; import android.text.format.DateFormat; import android.util.AttributeSet; @@ -28,8 +27,8 @@ import android.view.inputmethod.InputMethodManager; import io.flutter.app.FlutterPluginRegistry; import io.flutter.embedding.engine.FlutterJNI; -import io.flutter.embedding.engine.android.AndroidKeyProcessor; -import io.flutter.embedding.engine.android.AndroidTouchProcessor; +import io.flutter.embedding.android.AndroidKeyProcessor; +import io.flutter.embedding.android.AndroidTouchProcessor; import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.embedding.engine.renderer.FlutterRenderer; import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; diff --git a/tools/android_lint/baseline.xml b/tools/android_lint/baseline.xml index 8bf5af53ea8c0..bc6c463610096 100644 --- a/tools/android_lint/baseline.xml +++ b/tools/android_lint/baseline.xml @@ -480,7 +480,7 @@ errorLine1=" public boolean onTouchEvent(MotionEvent event) {" errorLine2=" ~~~~~~~~~~~~"> From 45b19e47c370dac2589e108bd97e6c80a5cd2d01 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 20 Mar 2019 15:21:13 -0400 Subject: [PATCH 0508/1117] Roll src/third_party/skia ba91f65f2070..7e2c0614a2fd (13 commits) (#8228) https://skia.googlesource.com/skia.git/%2Blog/ba91f65f2070..7e2c0614a2fd git log ba91f65f20701ce6ae6b43556d1ffb7c8be61a73..7e2c0614a2fd08e418b789939dfdad9b76e70fa7 --date=short --no-merges --format=%ad %ae %s 2019-03-20 brianosman@google.com Remove spurious ';' 2019-03-20 mtklein@google.com de-Sk tools/trace 2019-03-20 mtklein@google.com de-Sk tools/debugger 2019-03-20 mtklein@google.com SkAnimTimer -> AnimTimer 2019-03-20 mtklein@google.com fold sk_pixel_iter.h into ToolUtils 2019-03-20 mtklein@google.com sk_tool_utils -> ToolUtils, and git clang-format 2019-03-20 rmistry@google.com Add ability to skip adb binary push 2019-03-20 mtklein@google.com de-Sk tools/font, and git clang-format 2019-03-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 6ce1be5a5a53..a532570a09b8 (4 commits) 2019-03-20 mtklein@google.com remove Sk prefix from CommandLineFlags 2019-03-20 mtklein@google.com upgrade clang_linux to LLVM 8 2019-03-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 5851ef46d285..00ba176c0c40 (1 commits) 2019-03-20 ethannicholas@google.com Revert "Revert "more relaxed precision decorations for SPIR-V output"" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index b5165ea9e0442..8cb76a7291be3 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': 'ba91f65f20701ce6ae6b43556d1ffb7c8be61a73', + 'skia_revision': '7e2c0614a2fd08e418b789939dfdad9b76e70fa7', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index f31176df3dbc4..f045a7abd0fcd 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: affcc1ae5b1bd60f3e3e4839e61b054a +Signature: 69cdeba5983041274e6ecad0313aaa0a UNUSED LICENSES: @@ -2182,6 +2182,7 @@ FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full.expected/trybot.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-AndroidOne-GPU-Mali400MP2-arm-Release-All-Android_SkottieTracing.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 FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/Perf-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Debug-All-Android.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/Perf-ChromeOS-Clang-SamsungChromebookPlus-GPU-MaliT860-arm-Release-All.json From 6a8a45fc4f698364d03b5902c1818d2acc79db22 Mon Sep 17 00:00:00 2001 From: Amir Hardon Date: Wed, 20 Mar 2019 12:26:30 -0700 Subject: [PATCH 0509/1117] Have the AccessibilityBridge attach/detach itself to the (#8229) PlatformViewsDelegate. Since onDetachedFromWindow can be called after the activity was destroyed, the previous call to detach the accessibility bridge could have crash as the NativeFlutterView was already null. --- .../PlatformViewsAccessibilityDelegate.java | 18 +++++++++++++++++ .../platform/PlatformViewsController.java | 13 ++---------- .../io/flutter/view/AccessibilityBridge.java | 20 ++++++++++++++++++- .../android/io/flutter/view/FlutterView.java | 2 -- 4 files changed, 39 insertions(+), 14 deletions(-) diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java index 8f07f6b0c5b5b..a48a7d59ff65d 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java @@ -4,10 +4,28 @@ package io.flutter.plugin.platform; +import io.flutter.view.AccessibilityBridge; + /** * Facilitates interaction between the accessibility bridge and embedded platform views. */ public interface PlatformViewsAccessibilityDelegate { // TODO(amirh): add a View getViewById(int id) here. // not filing a tracking issue as this is going to be done in the next PR. + + /** + * Attaches an accessibility bridge for this platform views accessibility delegate. + * + * Accessibility events originating in platform views belonging to this delegate will be delegated + * to this accessibility bridge. + */ + void attachAccessibilityBridge(AccessibilityBridge accessibilityBridge); + + /** + * Detaches the current accessibility bridge. + * + * Any accessibility events sent by platform views belonging to this delegate will be ignored until + * a new accessibility bridge is attached. + */ + void detachAccessibiltyBridge(); } diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java index bd2ba001e22d3..55a5d10f4732b 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java @@ -98,21 +98,12 @@ public void detach() { mTextureRegistry = null; } - /** - * Attaches an accessibility bridge for this platform views controller. - * - * Accessibility events sent by platform views that belonging to this controller will be - * dispatched to this accessibility bridge. - */ + @Override public void attachAccessibilityBridge(AccessibilityBridge accessibilityBridge) { this.accessibilityBridge = accessibilityBridge; } - /** - * Detaches the current accessibility bridge. - * - * Any accessibility events sent by platform views belonging to this controller will be ignored. - */ + @Override public void detachAccessibiltyBridge() { this.accessibilityBridge = null; } diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index f18616b1578e9..7a94b3303595c 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -312,7 +312,10 @@ public AccessibilityBridge( @NonNull AccessibilityChannel accessibilityChannel, @NonNull AccessibilityManager accessibilityManager, @NonNull ContentResolver contentResolver, - @NonNull PlatformViewsAccessibilityDelegate platformViewsAccessibilityDelegate + // This should be @NonNull once the plumbing for io.flutter.embedding.engine.android.FlutterView is done. + // TODO(mattcarrol): Add the annotation once the plumbing is done. + // https://github.com/flutter/flutter/issues/29618 + PlatformViewsAccessibilityDelegate platformViewsAccessibilityDelegate ) { this.rootAccessibilityView = rootAccessibilityView; this.accessibilityChannel = accessibilityChannel; @@ -362,6 +365,14 @@ public void onTouchExplorationStateChanged(boolean isTouchExplorationEnabled) { Uri transitionUri = Settings.Global.getUriFor(Settings.Global.TRANSITION_ANIMATION_SCALE); this.contentResolver.registerContentObserver(transitionUri, false, animationScaleObserver); } + + // platformViewsAccessibilityDelegate should be @NonNull once the plumbing + // for io.flutter.embedding.engine.android.FlutterView is done. + // TODO(mattcarrol): Remove the null check once the plumbing is done. + // https://github.com/flutter/flutter/issues/29618 + if (platformViewsAccessibilityDelegate != null) { + platformViewsAccessibilityDelegate.attachAccessibilityBridge(this); + } } /** @@ -372,6 +383,13 @@ public void onTouchExplorationStateChanged(boolean isTouchExplorationEnabled) { * on this {@code AccessibilityBridge} after invoking {@code release()} is undefined. */ public void release() { + // platformViewsAccessibilityDelegate should be @NonNull once the plumbing + // for io.flutter.embedding.engine.android.FlutterView is done. + // TODO(mattcarrol): Remove the null check once the plumbing is done. + // https://github.com/flutter/flutter/issues/29618 + if (platformViewsAccessibilityDelegate != null) { + platformViewsAccessibilityDelegate.detachAccessibiltyBridge(); + } setOnAccessibilityChangeListener(null); accessibilityManager.removeAccessibilityStateChangeListener(accessibilityStateChangeListener); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 4faef7d518ba9..f8f38abbd48dc 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -668,7 +668,6 @@ protected void onAttachedToWindow() { getContext().getContentResolver(), platformViewsController ); - platformViewsController.attachAccessibilityBridge(mAccessibilityNodeProvider); mAccessibilityNodeProvider.setOnAccessibilityChangeListener(onAccessibilityChangeListener); resetWillNotDraw( @@ -681,7 +680,6 @@ protected void onAttachedToWindow() { protected void onDetachedFromWindow() { super.onDetachedFromWindow(); - getPluginRegistry().getPlatformViewsController().detachAccessibiltyBridge(); mAccessibilityNodeProvider.release(); mAccessibilityNodeProvider = null; } From d8c89e2bfe9b0b0d50da41c1349ef1534517c3c8 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 20 Mar 2019 16:11:40 -0400 Subject: [PATCH 0510/1117] Add the Linux desktop setup script to Dockerfile (#8227) In preparation for enabling Linux shell builds, add the script that installs necessary system-level dependencies. --- ci/docker/build/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/docker/build/Dockerfile b/ci/docker/build/Dockerfile index bf1a470f0e4aa..7307ac0a33470 100644 --- a/ci/docker/build/Dockerfile +++ b/ci/docker/build/Dockerfile @@ -17,6 +17,7 @@ RUN gclient sync WORKDIR $ENGINE_PATH/src RUN ./build/install-build-deps.sh --no-prompt RUN ./build/install-build-deps-android.sh --no-prompt +RUN ./flutter/build/install-build-deps-linux-desktop.sh WORKDIR $HOME/dart RUN wget https://storage.googleapis.com/dart-archive/channels/dev/release/2.1.0-dev.7.1/sdk/dartsdk-linux-x64-release.zip From 512004503fd5f3989350442ad7a64e386c7d6abf Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 20 Mar 2019 17:05:58 -0400 Subject: [PATCH 0511/1117] Remove jsoncpp from desktop Linux shell setup (#8230) The jsoncpp requirement was removed in the migration from FDE to this repository, so it doesn't need to be installed by the script. --- build/install-build-deps-linux-desktop.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build/install-build-deps-linux-desktop.sh b/build/install-build-deps-linux-desktop.sh index ce754c6f1464b..e3c47a69a3375 100755 --- a/build/install-build-deps-linux-desktop.sh +++ b/build/install-build-deps-linux-desktop.sh @@ -8,5 +8,4 @@ set -e -sudo apt-get -y install libglfw3-dev libepoxy-dev libjsoncpp-dev libgtk-3-dev \ - libx11-dev +sudo apt-get -y install libglfw3-dev libepoxy-dev libgtk-3-dev libx11-dev From d452dd5c36d7285769bdffc99f9a37976961b3cf Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 20 Mar 2019 17:15:52 -0400 Subject: [PATCH 0512/1117] Initial import of GLFW Linux shell from FDE (#8159) Changes include: - File structure - Header guards - Include paths - Namespaces - Integration with the engine's GN build - Conversion from jsoncpp to rapidjson - Style and clang-format adjustment to match engine repository --- ci/licenses_golden/licenses_flutter | 35 ++ shell/platform/common/cpp/BUILD.gn | 63 ++ .../common/cpp/client_wrapper/BUILD.gn | 88 +++ .../platform/common/cpp/client_wrapper/README | 9 + .../client_wrapper/engine_method_result.cc | 45 ++ .../include/flutter/basic_message_channel.h | 98 +++ .../include/flutter/binary_messenger.h | 56 ++ .../include/flutter/engine_method_result.h | 86 +++ .../include/flutter/json_message_codec.h | 42 ++ .../include/flutter/json_method_codec.h | 52 ++ .../include/flutter/json_type.h | 26 + .../include/flutter/message_codec.h | 54 ++ .../include/flutter/method_call.h | 41 ++ .../include/flutter/method_channel.h | 92 +++ .../include/flutter/method_codec.h | 85 +++ .../include/flutter/method_result.h | 58 ++ .../include/flutter/plugin_registrar.h | 74 +++ .../cpp/client_wrapper/json_message_codec.cc | 70 +++ .../cpp/client_wrapper/json_method_codec.cc | 135 ++++ .../client_wrapper/method_call_unittests.cc | 23 + .../cpp/client_wrapper/plugin_registrar.cc | 125 ++++ .../plugin_registrar_unittests.cc | 50 ++ .../common/cpp/client_wrapper/publish.gni | 42 ++ .../testing/stub_flutter_api.cc | 81 +++ .../client_wrapper/testing/stub_flutter_api.h | 74 +++ .../common/cpp/incoming_message_dispatcher.cc | 57 ++ .../common/cpp/incoming_message_dispatcher.h | 78 +++ .../common/cpp/public/flutter_export.h | 28 + .../common/cpp/public/flutter_messenger.h | 81 +++ .../cpp/public/flutter_plugin_registrar.h | 42 ++ shell/platform/common/cpp/text_input_model.cc | 181 ++++++ shell/platform/common/cpp/text_input_model.h | 101 +++ shell/platform/glfw/BUILD.gn | 80 +++ shell/platform/glfw/client_wrapper/BUILD.gn | 78 +++ .../flutter_window_controller.cc | 77 +++ .../flutter_window_controller_unittests.cc | 54 ++ .../flutter/flutter_window_controller.h | 83 +++ .../testing/stub_flutter_glfw_api.cc | 101 +++ .../testing/stub_flutter_glfw_api.h | 87 +++ shell/platform/glfw/flutter_glfw.cc | 595 ++++++++++++++++++ shell/platform/glfw/key_event_handler.cc | 60 ++ shell/platform/glfw/key_event_handler.h | 44 ++ shell/platform/glfw/keyboard_hook_handler.h | 32 + shell/platform/glfw/public/flutter_glfw.h | 109 ++++ shell/platform/glfw/text_input_plugin.cc | 210 +++++++ shell/platform/glfw/text_input_plugin.h | 62 ++ shell/platform/linux/BUILD.gn | 15 +- shell/platform/linux/config/BUILD.gn | 21 + 48 files changed, 3878 insertions(+), 2 deletions(-) create mode 100644 shell/platform/common/cpp/BUILD.gn create mode 100644 shell/platform/common/cpp/client_wrapper/BUILD.gn create mode 100644 shell/platform/common/cpp/client_wrapper/README create mode 100644 shell/platform/common/cpp/client_wrapper/engine_method_result.cc create mode 100644 shell/platform/common/cpp/client_wrapper/include/flutter/basic_message_channel.h create mode 100644 shell/platform/common/cpp/client_wrapper/include/flutter/binary_messenger.h create mode 100644 shell/platform/common/cpp/client_wrapper/include/flutter/engine_method_result.h create mode 100644 shell/platform/common/cpp/client_wrapper/include/flutter/json_message_codec.h create mode 100644 shell/platform/common/cpp/client_wrapper/include/flutter/json_method_codec.h create mode 100644 shell/platform/common/cpp/client_wrapper/include/flutter/json_type.h create mode 100644 shell/platform/common/cpp/client_wrapper/include/flutter/message_codec.h create mode 100644 shell/platform/common/cpp/client_wrapper/include/flutter/method_call.h create mode 100644 shell/platform/common/cpp/client_wrapper/include/flutter/method_channel.h create mode 100644 shell/platform/common/cpp/client_wrapper/include/flutter/method_codec.h create mode 100644 shell/platform/common/cpp/client_wrapper/include/flutter/method_result.h create mode 100644 shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h create mode 100644 shell/platform/common/cpp/client_wrapper/json_message_codec.cc create mode 100644 shell/platform/common/cpp/client_wrapper/json_method_codec.cc create mode 100644 shell/platform/common/cpp/client_wrapper/method_call_unittests.cc create mode 100644 shell/platform/common/cpp/client_wrapper/plugin_registrar.cc create mode 100644 shell/platform/common/cpp/client_wrapper/plugin_registrar_unittests.cc create mode 100644 shell/platform/common/cpp/client_wrapper/publish.gni create mode 100644 shell/platform/common/cpp/client_wrapper/testing/stub_flutter_api.cc create mode 100644 shell/platform/common/cpp/client_wrapper/testing/stub_flutter_api.h create mode 100644 shell/platform/common/cpp/incoming_message_dispatcher.cc create mode 100644 shell/platform/common/cpp/incoming_message_dispatcher.h create mode 100644 shell/platform/common/cpp/public/flutter_export.h create mode 100644 shell/platform/common/cpp/public/flutter_messenger.h create mode 100644 shell/platform/common/cpp/public/flutter_plugin_registrar.h create mode 100644 shell/platform/common/cpp/text_input_model.cc create mode 100644 shell/platform/common/cpp/text_input_model.h create mode 100644 shell/platform/glfw/BUILD.gn create mode 100644 shell/platform/glfw/client_wrapper/BUILD.gn create mode 100644 shell/platform/glfw/client_wrapper/flutter_window_controller.cc create mode 100644 shell/platform/glfw/client_wrapper/flutter_window_controller_unittests.cc create mode 100644 shell/platform/glfw/client_wrapper/include/flutter/flutter_window_controller.h create mode 100644 shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.cc create mode 100644 shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.h create mode 100644 shell/platform/glfw/flutter_glfw.cc create mode 100644 shell/platform/glfw/key_event_handler.cc create mode 100644 shell/platform/glfw/key_event_handler.h create mode 100644 shell/platform/glfw/keyboard_hook_handler.h create mode 100644 shell/platform/glfw/public/flutter_glfw.h create mode 100644 shell/platform/glfw/text_input_plugin.cc create mode 100644 shell/platform/glfw/text_input_plugin.h create mode 100644 shell/platform/linux/config/BUILD.gn diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 6c669632c5213..3867e7226454f 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -544,6 +544,31 @@ 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/common/cpp/client_wrapper/engine_method_result.cc +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/basic_message_channel.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/binary_messenger.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/engine_method_result.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/json_message_codec.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/json_method_codec.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/json_type.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/message_codec.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/method_call.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/method_channel.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/method_codec.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/method_result.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/json_message_codec.cc +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/json_method_codec.cc +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/method_call_unittests.cc +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/plugin_registrar.cc +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/plugin_registrar_unittests.cc +FILE: ../../../flutter/shell/platform/common/cpp/incoming_message_dispatcher.cc +FILE: ../../../flutter/shell/platform/common/cpp/incoming_message_dispatcher.h +FILE: ../../../flutter/shell/platform/common/cpp/public/flutter_export.h +FILE: ../../../flutter/shell/platform/common/cpp/public/flutter_messenger.h +FILE: ../../../flutter/shell/platform/common/cpp/public/flutter_plugin_registrar.h +FILE: ../../../flutter/shell/platform/common/cpp/text_input_model.cc +FILE: ../../../flutter/shell/platform/common/cpp/text_input_model.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 @@ -660,6 +685,16 @@ FILE: ../../../flutter/shell/platform/embedder/platform_view_embedder.cc FILE: ../../../flutter/shell/platform/embedder/platform_view_embedder.h FILE: ../../../flutter/shell/platform/embedder/vsync_waiter_embedder.cc FILE: ../../../flutter/shell/platform/embedder/vsync_waiter_embedder.h +FILE: ../../../flutter/shell/platform/glfw/client_wrapper/flutter_window_controller.cc +FILE: ../../../flutter/shell/platform/glfw/client_wrapper/flutter_window_controller_unittests.cc +FILE: ../../../flutter/shell/platform/glfw/client_wrapper/include/flutter/flutter_window_controller.h +FILE: ../../../flutter/shell/platform/glfw/flutter_glfw.cc +FILE: ../../../flutter/shell/platform/glfw/key_event_handler.cc +FILE: ../../../flutter/shell/platform/glfw/key_event_handler.h +FILE: ../../../flutter/shell/platform/glfw/keyboard_hook_handler.h +FILE: ../../../flutter/shell/platform/glfw/public/flutter_glfw.h +FILE: ../../../flutter/shell/platform/glfw/text_input_plugin.cc +FILE: ../../../flutter/shell/platform/glfw/text_input_plugin.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 diff --git a/shell/platform/common/cpp/BUILD.gn b/shell/platform/common/cpp/BUILD.gn new file mode 100644 index 0000000000000..265cb37b906ab --- /dev/null +++ b/shell/platform/common/cpp/BUILD.gn @@ -0,0 +1,63 @@ +# Copyright 2013 The Flutter 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("desktop_library_implementation") { + defines = [ "FLUTTER_DESKTOP_LIBRARY" ] +} + +_public_headers = [ + "public/flutter_export.h", + "public/flutter_messenger.h", + "public/flutter_plugin_registrar.h", +] + +# Any files that are built by clients (client_wrapper code, library headers for +# implementations using this shared code, etc.) include the public headers +# assuming they are in the include path. This configuration should be added to +# any such code that is also built by GN to make the includes work. +config("relative_flutter_library_headers") { + include_dirs = [ "public" ] +} + +# The headers are a separate source set since the client wrapper is allowed +# to depend on the public headers, but none of the rest of the code. +source_set("common_cpp_library_headers") { + public = _public_headers + + configs += [ ":desktop_library_implementation" ] +} + +source_set("common_cpp") { + public = [ + "incoming_message_dispatcher.h", + "text_input_model.h", + ] + + # TODO: Refactor flutter_glfw.cc to move the implementations corresponding + # to the _public_headers above into this target. + sources = [ + "incoming_message_dispatcher.cc", + "text_input_model.cc", + ] + + configs += [ ":desktop_library_implementation" ] + + deps = [ + ":common_cpp_library_headers", + "$flutter_root/shell/platform/common/cpp/client_wrapper:client_wrapper", + "$flutter_root/shell/platform/embedder:embedder", + ] + + # TODO: Remove once text input model refactor lands, at which point this code + # won't have a JSON dependency. + defines = [ "USE_RAPID_JSON" ] + deps += [ "//third_party/rapidjson" ] +} + +copy("publish_headers") { + sources = _public_headers + outputs = [ + "$root_out_dir/{{source_file_part}}", + ] +} diff --git a/shell/platform/common/cpp/client_wrapper/BUILD.gn b/shell/platform/common/cpp/client_wrapper/BUILD.gn new file mode 100644 index 0000000000000..1aacc758abea3 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/BUILD.gn @@ -0,0 +1,88 @@ +# Copyright 2013 The Flutter 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("publish.gni") + +_wrapper_includes = [ + "include/flutter/basic_message_channel.h", + "include/flutter/binary_messenger.h", + "include/flutter/engine_method_result.h", + "include/flutter/json_message_codec.h", + "include/flutter/json_method_codec.h", + "include/flutter/json_type.h", + "include/flutter/message_codec.h", + "include/flutter/method_call.h", + "include/flutter/method_channel.h", + "include/flutter/method_codec.h", + "include/flutter/method_result.h", + "include/flutter/plugin_registrar.h", +] + +# TODO: Once the wrapper API is more stable, consolidate to as few files as is +# reasonable (without forcing different kinds of clients to take unnecessary +# code) to simplify use. +_wrapper_sources = [ + "engine_method_result.cc", + "json_message_codec.cc", + "json_method_codec.cc", + "plugin_registrar.cc", +] + +# Client library build for internal use by the shell implementation. +source_set("client_wrapper") { + sources = _wrapper_sources + public = _wrapper_includes + + deps = [ + "$flutter_root/shell/platform/common/cpp:common_cpp_library_headers", + "//third_party/rapidjson", + ] + + defines = [ "USE_RAPID_JSON" ] + + configs += [ + "$flutter_root/shell/platform/common/cpp:desktop_library_implementation", + ] + + public_configs = [ + "$flutter_root/shell/platform/common/cpp:relative_flutter_library_headers", + ] +} + +# Copies the client wrapper code to the output directory. +publish_client_wrapper("publish_wrapper") { + public = _wrapper_includes + sources = _wrapper_sources + [ "README" ] +} + +source_set("client_wrapper_library_stubs") { + sources = [ + "testing/stub_flutter_api.cc", + "testing/stub_flutter_api.h", + ] + + public_deps = [ + "$flutter_root/shell/platform/common/cpp:common_cpp_library_headers", + ] +} + +executable("client_wrapper_unittests") { + testonly = true + + # TODO: Add more unit tests. + sources = [ + "method_call_unittests.cc", + "plugin_registrar_unittests.cc", + ] + + deps = [ + ":client_wrapper", + ":client_wrapper_library_stubs", + "$flutter_root/testing", + + # TODO: Consider refactoring flutter_root/testing so that there's a testing + # target that doesn't require a Dart runtime to be linked in. + "//third_party/dart/runtime:libdart_jit", + ] +} diff --git a/shell/platform/common/cpp/client_wrapper/README b/shell/platform/common/cpp/client_wrapper/README new file mode 100644 index 0000000000000..a7f8764867088 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/README @@ -0,0 +1,9 @@ +This code is intended to be built into plugins and applications to provide +higher-level, C++ abstractions for interacting with the Flutter library. + +Over time, the goal is to move more of this code into the library in a way that +provides a usable ABI (e.g., does not use standard libary in the interfaces). + +Note that this wrapper is still in early stages. Expect significant churn in +both the APIs and the structure of the wrapper (e.g., the exact set of files +that need to be built). diff --git a/shell/platform/common/cpp/client_wrapper/engine_method_result.cc b/shell/platform/common/cpp/client_wrapper/engine_method_result.cc new file mode 100644 index 0000000000000..03e17a82e6bd5 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/engine_method_result.cc @@ -0,0 +1,45 @@ +// Copyright 2013 The Flutter 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/engine_method_result.h" + +#include +#include + +namespace flutter { +namespace internal { + +ReplyManager::ReplyManager(BinaryReply reply_handler) + : reply_handler_(std::move(reply_handler)) { + assert(reply_handler_); +} + +ReplyManager::~ReplyManager() { + if (reply_handler_) { + // Warn, rather than send a not-implemented response, since the engine may + // no longer be valid at this point. + std::cerr + << "Warning: Failed to respond to a message. This is a memory leak." + << std::endl; + } +} + +void ReplyManager::SendResponseData(const std::vector* data) { + if (!reply_handler_) { + std::cerr + << "Error: Only one of Success, Error, or NotImplemented can be " + "called," + << " and it can be called exactly once. Ignoring duplicate result." + << std::endl; + return; + } + + const uint8_t* message = data && !data->empty() ? data->data() : nullptr; + size_t message_size = data ? data->size() : 0; + reply_handler_(message, message_size); + reply_handler_ = nullptr; +} + +} // namespace internal +} // namespace flutter diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/basic_message_channel.h b/shell/platform/common/cpp/client_wrapper/include/flutter/basic_message_channel.h new file mode 100644 index 0000000000000..a864a36343d4e --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/basic_message_channel.h @@ -0,0 +1,98 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_BASIC_MESSAGE_CHANNEL_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_BASIC_MESSAGE_CHANNEL_H_ + +#include +#include + +#include "binary_messenger.h" +#include "message_codec.h" + +namespace flutter { + +// A message reply callback. +// +// Used for submitting a reply back to a Flutter message sender. +template +using MessageReply = std::function; + +// A handler for receiving a message from the Flutter engine. +// +// Implementations must asynchronously call reply exactly once with the reply +// to the message. +template +using MessageHandler = + std::function reply)>; + +// A channel for communicating with the Flutter engine by sending asynchronous +// messages. +template +class BasicMessageChannel { + public: + // Creates an instance that sends and receives method calls on the channel + // named |name|, encoded with |codec| and dispatched via |messenger|. + // + // TODO: Make codec optional once the standard codec is supported (Issue #67). + BasicMessageChannel(BinaryMessenger* messenger, + const std::string& name, + const MessageCodec* codec) + : messenger_(messenger), name_(name), codec_(codec) {} + + ~BasicMessageChannel() = default; + + // Prevent copying. + BasicMessageChannel(BasicMessageChannel const&) = delete; + BasicMessageChannel& operator=(BasicMessageChannel const&) = delete; + + // Sends a message to the Flutter engine on this channel. + void Send(const T& message) { + std::unique_ptr> raw_message = + codec_->EncodeMessage(message); + messenger_->Send(name_, raw_message->data(), raw_message->size()); + } + + // TODO: Add support for a version of Send expecting a reply once + // https://github.com/flutter/flutter/issues/18852 is fixed. + + // Registers a handler that should be called any time a message is + // received on this channel. + void SetMessageHandler(MessageHandler handler) const { + const auto* codec = codec_; + std::string channel_name = name_; + BinaryMessageHandler binary_handler = [handler, codec, channel_name]( + const uint8_t* binary_message, + const size_t binary_message_size, + BinaryReply binary_reply) { + // Use this channel's codec to decode the message and build a reply + // handler. + std::unique_ptr message = + codec->DecodeMessage(binary_message, binary_message_size); + if (!message) { + std::cerr << "Unable to decode message on channel " << channel_name + << std::endl; + binary_reply(nullptr, 0); + return; + } + + MessageReply unencoded_reply = [binary_reply, + codec](const T& unencoded_response) { + auto binary_response = codec->EncodeMessage(unencoded_response); + binary_reply(binary_response->data(), binary_response->size()); + }; + handler(*message, std::move(unencoded_reply)); + }; + messenger_->SetMessageHandler(name_, std::move(binary_handler)); + } + + private: + BinaryMessenger* messenger_; + std::string name_; + const MessageCodec* codec_; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_BASIC_MESSAGE_CHANNEL_H_ diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/binary_messenger.h b/shell/platform/common/cpp/client_wrapper/include/flutter/binary_messenger.h new file mode 100644 index 0000000000000..ae91941fedc6c --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/binary_messenger.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_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_BINARY_MESSENGER_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_BINARY_MESSENGER_H_ + +#include +#include + +// TODO: Consider adding absl as a dependency and using absl::Span for all of +// the message/message_size pairs. +namespace flutter { + +// A binary message reply callback. +// +// Used for submitting a binary reply back to a Flutter message sender. +typedef std::function + BinaryReply; + +// A message handler callback. +// +// Used for receiving messages from Flutter and providing an asynchronous reply. +typedef std::function< + void(const uint8_t* message, const size_t message_size, BinaryReply reply)> + BinaryMessageHandler; + +// A protocol for a class that handles communication of binary data on named +// channels to and from the Flutter engine. +class BinaryMessenger { + public: + virtual ~BinaryMessenger() = default; + + // Sends a binary message to the Flutter side on the specified channel, + // expecting no reply. + // + // TODO: Consider adding absl as a dependency and using absl::Span. + virtual void Send(const std::string& channel, + const uint8_t* message, + const size_t message_size) const = 0; + + // TODO: Add support for a version of Send expecting a reply once + // https://github.com/flutter/flutter/issues/18852 is fixed. + + // Registers a message handler for incoming binary messages from the Flutter + // side on the specified channel. + // + // Replaces any existing handler. Provide a null handler to unregister the + // existing handler. + virtual void SetMessageHandler(const std::string& channel, + BinaryMessageHandler handler) = 0; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_BINARY_MESSENGER_H_ diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/engine_method_result.h b/shell/platform/common/cpp/client_wrapper/include/flutter/engine_method_result.h new file mode 100644 index 0000000000000..9c28a85e3de43 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/engine_method_result.h @@ -0,0 +1,86 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_ENGINE_METHOD_RESULT_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_ENGINE_METHOD_RESULT_H_ + +#include +#include +#include + +#include "binary_messenger.h" +#include "method_codec.h" +#include "method_result.h" + +namespace flutter { + +namespace internal { +// Manages the one-time sending of response data. This is an internal helper +// class for EngineMethodResult, separated out since the implementation doesn't +// vary based on the template type. +class ReplyManager { + public: + ReplyManager(BinaryReply reply_handler_); + ~ReplyManager(); + + // Prevent copying. + ReplyManager(ReplyManager const&) = delete; + ReplyManager& operator=(ReplyManager const&) = delete; + + // Sends the given response data (which must either be nullptr, which + // indicates an unhandled method, or a response serialized with |codec_|) to + // the engine. + void SendResponseData(const std::vector* data); + + private: + BinaryReply reply_handler_; +}; +} // namespace internal + +// Implemention of MethodResult that sends a response to the Flutter engine +// exactly once, encoded using a given codec. +template +class EngineMethodResult : public MethodResult { + public: + // Creates a result object that will send results to |reply_handler|, encoded + // using |codec|. The |codec| pointer must remain valid for as long as this + // object exists. + EngineMethodResult(BinaryReply reply_handler, const MethodCodec* codec) + : reply_manager_( + std::make_unique(std::move(reply_handler))), + codec_(codec) {} + + ~EngineMethodResult() = default; + + protected: + // |flutter::MethodResult| + void SuccessInternal(const T* result) override { + std::unique_ptr> data = + codec_->EncodeSuccessEnvelope(result); + reply_manager_->SendResponseData(data.get()); + } + + // |flutter::MethodResult| + void ErrorInternal(const std::string& error_code, + const std::string& error_message, + const T* error_details) override { + std::unique_ptr> data = + codec_->EncodeErrorEnvelope(error_code, error_message, error_details); + reply_manager_->SendResponseData(data.get()); + } + + // |flutter::MethodResult| + void NotImplementedInternal() override { + reply_manager_->SendResponseData(nullptr); + } + + private: + std::unique_ptr reply_manager_; + + const MethodCodec* codec_; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_ENGINE_METHOD_RESULT_H_ diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/json_message_codec.h b/shell/platform/common/cpp/client_wrapper/include/flutter/json_message_codec.h new file mode 100644 index 0000000000000..ba1aa2ffc3520 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/json_message_codec.h @@ -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. + +#ifndef FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_JSON_MESSAGE_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_JSON_MESSAGE_CODEC_H_ + +#include "json_type.h" +#include "message_codec.h" + +namespace flutter { + +// A message encoding/decoding mechanism for communications to/from the +// Flutter engine via JSON channels. +class JsonMessageCodec : public MessageCodec { + public: + // Returns the shared instance of the codec. + static const JsonMessageCodec& GetInstance(); + + ~JsonMessageCodec() = default; + + // Prevent copying. + JsonMessageCodec(JsonMessageCodec const&) = delete; + JsonMessageCodec& operator=(JsonMessageCodec const&) = delete; + + protected: + // Instances should be obtained via GetInstance. + JsonMessageCodec() = default; + + // |flutter::MessageCodec| + std::unique_ptr DecodeMessageInternal( + const uint8_t* binary_message, + const size_t message_size) const override; + + // |flutter::MessageCodec| + std::unique_ptr> EncodeMessageInternal( + const JsonValueType& message) const override; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_JSON_MESSAGE_CODEC_H_ diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/json_method_codec.h b/shell/platform/common/cpp/client_wrapper/include/flutter/json_method_codec.h new file mode 100644 index 0000000000000..92af82000ac96 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/json_method_codec.h @@ -0,0 +1,52 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_JSON_METHOD_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_JSON_METHOD_CODEC_H_ + +#include "json_type.h" +#include "method_call.h" +#include "method_codec.h" + +namespace flutter { + +// An implementation of MethodCodec that uses JSON strings as the serialization. +class JsonMethodCodec : public MethodCodec { + public: + // Returns the shared instance of the codec. + static const JsonMethodCodec& GetInstance(); + + ~JsonMethodCodec() = default; + + // Prevent copying. + JsonMethodCodec(JsonMethodCodec const&) = delete; + JsonMethodCodec& operator=(JsonMethodCodec const&) = delete; + + protected: + // Instances should be obtained via GetInstance. + JsonMethodCodec() = default; + + // |flutter::MethodCodec| + std::unique_ptr> DecodeMethodCallInternal( + const uint8_t* message, + const size_t message_size) const override; + + // |flutter::MethodCodec| + std::unique_ptr> EncodeMethodCallInternal( + const MethodCall& method_call) const override; + + // |flutter::MethodCodec| + std::unique_ptr> EncodeSuccessEnvelopeInternal( + const JsonValueType* result) const override; + + // |flutter::MethodCodec| + std::unique_ptr> EncodeErrorEnvelopeInternal( + const std::string& error_code, + const std::string& error_message, + const JsonValueType* error_details) const override; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_JSON_METHOD_CODEC_H_ diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/json_type.h b/shell/platform/common/cpp/client_wrapper/include/flutter/json_type.h new file mode 100644 index 0000000000000..476cee7bfb941 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/json_type.h @@ -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. + +#ifndef FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_JSON_TYPE_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_JSON_TYPE_H_ + +// By default, the Json codecs use jsoncpp, but a version using RapidJSON is +// implemented as well. To use the latter, set USE_RAPID_JSON. +// +// When writing code using the JSON codec classes, do not use JsonValueType; +// instead use the underlying type for the library you have selected directly. + +#ifdef USE_RAPID_JSON +#include + +// The APIs often pass owning references, which in RapidJSON must include the +// allocator, so the value type for the APIs is Document rather than Value. +using JsonValueType = rapidjson::Document; +#else +#include + +using JsonValueType = Json::Value; +#endif + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_JSON_TYPE_H_ \ No newline at end of file diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/message_codec.h b/shell/platform/common/cpp/client_wrapper/include/flutter/message_codec.h new file mode 100644 index 0000000000000..fb012e7a535d4 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/message_codec.h @@ -0,0 +1,54 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_MESSAGE_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_MESSAGE_CODEC_H_ + +#include +#include +#include + +namespace flutter { + +// Translates between a binary message and higher-level method call and +// response/error objects. +template +class MessageCodec { + public: + MessageCodec() = default; + + virtual ~MessageCodec() = default; + + // Prevent copying. + MessageCodec(MessageCodec const&) = delete; + MessageCodec& operator=(MessageCodec const&) = delete; + + // Returns the message encoded in |binary_message|, or nullptr if it cannot be + // decoded by this codec. + // TODO: Consider adding absl as a dependency and using absl::Span. + std::unique_ptr DecodeMessage(const uint8_t* binary_message, + const size_t message_size) const { + return std::move(DecodeMessageInternal(binary_message, message_size)); + } + + // Returns a binary encoding of the given |message|, or nullptr if the + // message cannot be serialized by this codec. + std::unique_ptr> EncodeMessage(const T& message) const { + return std::move(EncodeMessageInternal(message)); + } + + protected: + // Implementation of the public interface, to be provided by subclasses. + virtual std::unique_ptr DecodeMessageInternal( + const uint8_t* binary_message, + const size_t message_size) const = 0; + + // Implementation of the public interface, to be provided by subclasses. + virtual std::unique_ptr> EncodeMessageInternal( + const T& message) const = 0; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_MESSAGE_CODEC_H_ diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/method_call.h b/shell/platform/common/cpp/client_wrapper/include/flutter/method_call.h new file mode 100644 index 0000000000000..80274e7b0c5b0 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/method_call.h @@ -0,0 +1,41 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_TYPED_METHOD_CALL_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_TYPED_METHOD_CALL_H_ + +#include +#include + +namespace flutter { + +// An object encapsulating a method call from Flutter whose arguments are of +// type T. +template +class MethodCall { + public: + // Creates a MethodCall with the given name and arguments. + MethodCall(const std::string& method_name, std::unique_ptr arguments) + : method_name_(method_name), arguments_(std::move(arguments)) {} + + virtual ~MethodCall() = default; + + // Prevent copying. + MethodCall(MethodCall const&) = delete; + MethodCall& operator=(MethodCall const&) = delete; + + // The name of the method being called. + const std::string& method_name() const { return method_name_; } + + // The arguments to the method call, or NULL if there are none. + const T* arguments() const { return arguments_.get(); } + + private: + std::string method_name_; + std::unique_ptr arguments_; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_TYPED_METHOD_CALL_H_ diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/method_channel.h b/shell/platform/common/cpp/client_wrapper/include/flutter/method_channel.h new file mode 100644 index 0000000000000..9e28f9b3812e5 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/method_channel.h @@ -0,0 +1,92 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_CHANNEL_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_CHANNEL_H_ + +#include +#include + +#include "binary_messenger.h" +#include "engine_method_result.h" +#include "method_call.h" +#include "method_codec.h" +#include "method_result.h" + +namespace flutter { + +// A handler for receiving a method call from the Flutter engine. +// +// Implementations must asynchronously call exactly one of the methods on +// |result| to indicate the result of the method call. +template +using MethodCallHandler = + std::function& call, + std::unique_ptr> result)>; + +// A channel for communicating with the Flutter engine using invocation of +// asynchronous methods. +template +class MethodChannel { + public: + // Creates an instance that sends and receives method calls on the channel + // named |name|, encoded with |codec| and dispatched via |messenger|. + // + // TODO: Make codec optional once the standard codec is supported (Issue #67). + MethodChannel(BinaryMessenger* messenger, + const std::string& name, + const MethodCodec* codec) + : messenger_(messenger), name_(name), codec_(codec) {} + + ~MethodChannel() = default; + + // Prevent copying. + MethodChannel(MethodChannel const&) = delete; + MethodChannel& operator=(MethodChannel const&) = delete; + + // Sends a message to the Flutter engine on this channel. + void InvokeMethod(const std::string& method, std::unique_ptr arguments) { + MethodCall method_call(method, std::move(arguments)); + std::unique_ptr> message = + codec_->EncodeMethodCall(method_call); + messenger_->Send(name_, message->data(), message->size()); + } + + // TODO: Add support for a version of InvokeMethod expecting a reply once + // https://github.com/flutter/flutter/issues/18852 is fixed. + + // Registers a handler that should be called any time a method call is + // received on this channel. + void SetMethodCallHandler(MethodCallHandler handler) const { + const auto* codec = codec_; + std::string channel_name = name_; + BinaryMessageHandler binary_handler = [handler, codec, channel_name]( + const uint8_t* message, + const size_t message_size, + BinaryReply reply) { + // Use this channel's codec to decode the call and build a result handler. + auto result = + std::make_unique>(std::move(reply), codec); + std::unique_ptr> method_call = + codec->DecodeMethodCall(message, message_size); + if (!method_call) { + std::cerr << "Unable to construct method call from message on channel " + << channel_name << std::endl; + result->NotImplemented(); + return; + } + handler(*method_call, std::move(result)); + }; + messenger_->SetMessageHandler(name_, std::move(binary_handler)); + } + + private: + BinaryMessenger* messenger_; + std::string name_; + const MethodCodec* codec_; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_CHANNEL_H_ diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/method_codec.h b/shell/platform/common/cpp/client_wrapper/include/flutter/method_codec.h new file mode 100644 index 0000000000000..3d45e59c0a8f3 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/method_codec.h @@ -0,0 +1,85 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_CODEC_H_ + +#include +#include +#include + +#include "method_call.h" + +namespace flutter { + +// Translates between a binary message and higher-level method call and +// response/error objects. +template +class MethodCodec { + public: + MethodCodec() = default; + + virtual ~MethodCodec() = default; + + // Prevent copying. + MethodCodec(MethodCodec const&) = delete; + MethodCodec& operator=(MethodCodec const&) = delete; + + // Returns the MethodCall encoded in |message|, or nullptr if it cannot be + // decoded. + // TODO: Consider adding absl as a dependency and using absl::Span. + std::unique_ptr> DecodeMethodCall( + const uint8_t* message, + const size_t message_size) const { + return std::move(DecodeMethodCallInternal(message, message_size)); + } + + // Returns a binary encoding of the given |method_call|, or nullptr if the + // method call cannot be serialized by this codec. + std::unique_ptr> EncodeMethodCall( + const MethodCall& method_call) const { + return std::move(EncodeMethodCallInternal(method_call)); + } + + // Returns a binary encoding of |result|. |result| must be a type supported + // by the codec. + std::unique_ptr> EncodeSuccessEnvelope( + const T* result = nullptr) const { + return std::move(EncodeSuccessEnvelopeInternal(result)); + } + + // Returns a binary encoding of |error|. The |error_details| must be a type + // supported by the codec. + std::unique_ptr> EncodeErrorEnvelope( + const std::string& error_code, + const std::string& error_message = "", + const T* error_details = nullptr) const { + return std::move( + EncodeErrorEnvelopeInternal(error_code, error_message, error_details)); + } + + protected: + // Implementation of the public interface, to be provided by subclasses. + virtual std::unique_ptr> DecodeMethodCallInternal( + const uint8_t* message, + const size_t message_size) const = 0; + + // Implementation of the public interface, to be provided by subclasses. + virtual std::unique_ptr> EncodeMethodCallInternal( + const MethodCall& method_call) const = 0; + + // Implementation of the public interface, to be provided by subclasses. + virtual std::unique_ptr> EncodeSuccessEnvelopeInternal( + const T* result) const = 0; + + // Implementation of the public interface, to be provided by subclasses. + virtual std::unique_ptr> EncodeErrorEnvelopeInternal( + const std::string& error_code, + const std::string& error_message, + const T* error_details) const = 0; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_CODEC_H_ diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/method_result.h b/shell/platform/common/cpp/client_wrapper/include/flutter/method_result.h new file mode 100644 index 0000000000000..e3bf572996eb4 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/method_result.h @@ -0,0 +1,58 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_RESULT_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_RESULT_H_ + +#include + +namespace flutter { + +// Encapsulates a result sent back to the Flutter engine in response to a +// MethodCall. Only one method should be called on any given instance. +template +class MethodResult { + public: + MethodResult() = default; + + virtual ~MethodResult() = default; + + // Prevent copying. + MethodResult(MethodResult const&) = delete; + MethodResult& operator=(MethodResult const&) = delete; + + // Sends a success response, indicating that the call completed successfully. + // An optional value can be provided as part of the success message. + void Success(const T* result = nullptr) { SuccessInternal(result); } + + // Sends an error response, indicating that the call was understood but + // handling failed in some way. A string error code must be provided, and in + // addition an optional user-readable error_message and/or details object can + // be included. + void Error(const std::string& error_code, + const std::string& error_message = "", + const T* error_details = nullptr) { + ErrorInternal(error_code, error_message, error_details); + } + + // Sends a not-implemented response, indicating that the method either was not + // recognized, or has not been implemented. + void NotImplemented() { NotImplementedInternal(); } + + protected: + // Implementation of the public interface, to be provided by subclasses. + virtual void SuccessInternal(const T* result) = 0; + + // Implementation of the public interface, to be provided by subclasses. + virtual void ErrorInternal(const std::string& error_code, + const std::string& error_message, + const T* error_details) = 0; + + // Implementation of the public interface, to be provided by subclasses. + virtual void NotImplementedInternal() = 0; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_METHOD_RESULT_H_ diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h b/shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h new file mode 100644 index 0000000000000..228a6a311fad0 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h @@ -0,0 +1,74 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_PLUGIN_REGISTRAR_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_PLUGIN_REGISTRAR_H_ + +#include +#include +#include + +#include + +#include "binary_messenger.h" + +namespace flutter { + +class Plugin; + +// A object managing the registration of a plugin for various events. +// +// Currently this class has very limited functionality, but is expected to +// expand over time to more closely match the functionality of +// the Flutter mobile plugin APIs' plugin registrars. +class PluginRegistrar { + public: + // Creates a new PluginRegistrar. |core_registrar| and the messenger it + // provides must remain valid as long as this object exists. + explicit PluginRegistrar(FlutterDesktopPluginRegistrarRef core_registrar); + + ~PluginRegistrar(); + + // Prevent copying. + PluginRegistrar(PluginRegistrar const&) = delete; + PluginRegistrar& operator=(PluginRegistrar const&) = delete; + + // Returns the messenger to use for creating channels to communicate with the + // Flutter engine. + // + // This pointer will remain valid for the lifetime of this instance. + BinaryMessenger* messenger() { return messenger_.get(); } + + // Takes ownership of |plugin|. + // + // Plugins are not required to call this method if they have other lifetime + // management, but this is a convient place for plugins to be owned to ensure + // that they stay valid for any registered callbacks. + void AddPlugin(std::unique_ptr plugin); + + // Enables input blocking on the given channel name. + // + // If set, then the parent window should disable input callbacks + // while waiting for the handler for messages on that channel to run. + void EnableInputBlockingForChannel(const std::string& channel); + + private: + // Handle for interacting with the C API's registrar. + FlutterDesktopPluginRegistrarRef registrar_; + + std::unique_ptr messenger_; + + // Plugins registered for ownership. + std::set> plugins_; +}; + +// A plugin that can be registered for ownership by a PluginRegistrar. +class Plugin { + public: + virtual ~Plugin() = default; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_PLUGIN_REGISTRAR_H_ diff --git a/shell/platform/common/cpp/client_wrapper/json_message_codec.cc b/shell/platform/common/cpp/client_wrapper/json_message_codec.cc new file mode 100644 index 0000000000000..5610c4762ea83 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/json_message_codec.cc @@ -0,0 +1,70 @@ +// Copyright 2013 The Flutter 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/json_message_codec.h" + +#include +#include + +#ifdef USE_RAPID_JSON +#include "rapidjson/error/en.h" +#include "rapidjson/stringbuffer.h" +#include "rapidjson/writer.h" +#endif + +namespace flutter { + +// static +const JsonMessageCodec& JsonMessageCodec::GetInstance() { + static JsonMessageCodec sInstance; + return sInstance; +} + +std::unique_ptr> JsonMessageCodec::EncodeMessageInternal( + const JsonValueType& message) const { +#ifdef USE_RAPID_JSON + // TODO: Look into alternate writers that would avoid the buffer copy. + rapidjson::StringBuffer buffer; + rapidjson::Writer writer(buffer); + message.Accept(writer); + const char* buffer_start = buffer.GetString(); + return std::make_unique>( + buffer_start, buffer_start + buffer.GetSize()); +#else + Json::StreamWriterBuilder writer_builder; + std::string serialization = Json::writeString(writer_builder, message); + return std::make_unique>(serialization.begin(), + serialization.end()); +#endif +} + +std::unique_ptr JsonMessageCodec::DecodeMessageInternal( + const uint8_t* binary_message, + const size_t message_size) const { + auto raw_message = reinterpret_cast(binary_message); + auto json_message = std::make_unique(); + std::string parse_errors; + bool parsing_successful = false; +#ifdef USE_RAPID_JSON + rapidjson::ParseResult result = + json_message->Parse(raw_message, message_size); + parsing_successful = result == rapidjson::ParseErrorCode::kParseErrorNone; + if (!parsing_successful) { + parse_errors = rapidjson::GetParseError_En(result.Code()); + } +#else + Json::CharReaderBuilder reader_builder; + std::unique_ptr parser(reader_builder.newCharReader()); + parsing_successful = parser->parse(raw_message, raw_message + message_size, + json_message.get(), &parse_errors); +#endif + if (!parsing_successful) { + std::cerr << "Unable to parse JSON message:" << std::endl + << parse_errors << std::endl; + return nullptr; + } + return json_message; +} + +} // namespace flutter diff --git a/shell/platform/common/cpp/client_wrapper/json_method_codec.cc b/shell/platform/common/cpp/client_wrapper/json_method_codec.cc new file mode 100644 index 0000000000000..f576d4ebf994f --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/json_method_codec.cc @@ -0,0 +1,135 @@ +// Copyright 2013 The Flutter 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/json_method_codec.h" + +#include "include/flutter/json_message_codec.h" + +namespace flutter { + +namespace { +// Keys used in MethodCall encoding. +constexpr char kMessageMethodKey[] = "method"; +constexpr char kMessageArgumentsKey[] = "args"; +} // namespace + +// static +const JsonMethodCodec& JsonMethodCodec::GetInstance() { + static JsonMethodCodec sInstance; + return sInstance; +} + +std::unique_ptr> +JsonMethodCodec::DecodeMethodCallInternal(const uint8_t* message, + const size_t message_size) const { + std::unique_ptr json_message = + JsonMessageCodec::GetInstance().DecodeMessage(message, message_size); + if (!json_message) { + return nullptr; + } + +#if USE_RAPID_JSON + auto method_name_iter = json_message->FindMember(kMessageMethodKey); + if (method_name_iter == json_message->MemberEnd()) { + return nullptr; + } + if (!method_name_iter->value.IsString()) { + return nullptr; + } + std::string method_name(method_name_iter->value.GetString()); + auto arguments_iter = json_message->FindMember(kMessageArgumentsKey); + std::unique_ptr arguments; + if (arguments_iter != json_message->MemberEnd()) { + // Pull the arguments subtree up to the root of json_message. This is + // destructive to json_message, but the full value is no longer needed, and + // this avoids a subtree copy. + json_message->Swap(arguments_iter->value); + // Swap it into |arguments|. This moves the allocator ownership, so that + // the data won't be deleted when json_message goes out of scope. + arguments = std::make_unique(); + arguments->Swap(*json_message); + } + return std::make_unique>( + method_name, std::move(arguments)); +#else + Json::Value method = (*json_message)[kMessageMethodKey]; + if (method.isNull()) { + return nullptr; + } + return std::make_unique>( + method.asString(), + std::make_unique((*json_message)[kMessageArgumentsKey])); +#endif +} + +std::unique_ptr> JsonMethodCodec::EncodeMethodCallInternal( + const MethodCall& method_call) const { +#if USE_RAPID_JSON + // TODO: Consider revisiting the codec APIs to avoid the need to copy + // everything when doing encoding (e.g., by having a version that takes + // owership of the object to encode, so that it can be moved instead). + rapidjson::Document message(rapidjson::kObjectType); + auto& allocator = message.GetAllocator(); + rapidjson::Value name(method_call.method_name(), allocator); + rapidjson::Value arguments; + if (method_call.arguments()) { + arguments.CopyFrom(*method_call.arguments(), allocator); + } + message.AddMember(kMessageMethodKey, name, allocator); + message.AddMember(kMessageArgumentsKey, arguments, allocator); +#else + Json::Value message(Json::objectValue); + message[kMessageMethodKey] = method_call.method_name(); + const Json::Value* arguments = method_call.arguments(); + message[kMessageArgumentsKey] = arguments ? *arguments : Json::Value(); +#endif + + return JsonMessageCodec::GetInstance().EncodeMessage(message); +} + +std::unique_ptr> +JsonMethodCodec::EncodeSuccessEnvelopeInternal( + const JsonValueType* result) const { +#if USE_RAPID_JSON + rapidjson::Document envelope; + envelope.SetArray(); + rapidjson::Value result_value; + if (result) { + result_value.CopyFrom(*result, envelope.GetAllocator()); + } + envelope.PushBack(result_value, envelope.GetAllocator()); +#else + Json::Value envelope(Json::arrayValue); + envelope.append(result == nullptr ? Json::Value() : *result); +#endif + + return JsonMessageCodec::GetInstance().EncodeMessage(envelope); +} + +std::unique_ptr> +JsonMethodCodec::EncodeErrorEnvelopeInternal( + const std::string& error_code, + const std::string& error_message, + const JsonValueType* error_details) const { +#if USE_RAPID_JSON + rapidjson::Document envelope(rapidjson::kArrayType); + auto& allocator = envelope.GetAllocator(); + envelope.PushBack(rapidjson::Value(error_code, allocator), allocator); + envelope.PushBack(rapidjson::Value(error_message, allocator), allocator); + rapidjson::Value details_value; + if (error_details) { + details_value.CopyFrom(*error_details, allocator); + } + envelope.PushBack(details_value, allocator); +#else + Json::Value envelope(Json::arrayValue); + envelope.append(error_code); + envelope.append(error_message.empty() ? Json::Value() : error_message); + envelope.append(error_details == nullptr ? Json::Value() : *error_details); +#endif + + return JsonMessageCodec::GetInstance().EncodeMessage(envelope); +} + +} // namespace flutter diff --git a/shell/platform/common/cpp/client_wrapper/method_call_unittests.cc b/shell/platform/common/cpp/client_wrapper/method_call_unittests.cc new file mode 100644 index 0000000000000..a3d093d8c8bae --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/method_call_unittests.cc @@ -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/common/cpp/client_wrapper/include/flutter/method_call.h" + +#include +#include + +#include "gtest/gtest.h" + +namespace flutter { + +TEST(MethodCallTest, Basic) { + const std::string method_name("method_name"); + const int argument = 42; + MethodCall method_call(method_name, std::make_unique(argument)); + EXPECT_EQ(method_call.method_name(), method_name); + ASSERT_NE(method_call.arguments(), nullptr); + EXPECT_EQ(*method_call.arguments(), 42); +} + +} // namespace flutter diff --git a/shell/platform/common/cpp/client_wrapper/plugin_registrar.cc b/shell/platform/common/cpp/client_wrapper/plugin_registrar.cc new file mode 100644 index 0000000000000..46c117377b22e --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/plugin_registrar.cc @@ -0,0 +1,125 @@ +// Copyright 2013 The Flutter 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/plugin_registrar.h" + +#include "include/flutter/engine_method_result.h" +#include "include/flutter/method_channel.h" + +#include +#include + +namespace flutter { + +namespace { + +// Passes |message| to |user_data|, which must be a BinaryMessageHandler, along +// with a BinaryReply that will send a response on |message|'s response handle. +// +// This serves as an adaptor between the function-pointer-based message callback +// interface provided by the C API and the std::function-based message handler +// interface of BinaryMessenger. +void ForwardToHandler(FlutterDesktopMessengerRef messenger, + const FlutterDesktopMessage* message, + void* user_data) { + auto* response_handle = message->response_handle; + BinaryReply reply_handler = [messenger, response_handle]( + const uint8_t* reply, + const size_t reply_size) mutable { + if (!response_handle) { + std::cerr << "Error: Response can be set only once. Ignoring " + "duplicate response." + << std::endl; + return; + } + FlutterDesktopMessengerSendResponse(messenger, response_handle, reply, + reply_size); + // The engine frees the response handle once + // FlutterDesktopSendMessageResponse is called. + response_handle = nullptr; + }; + + const BinaryMessageHandler& message_handler = + *static_cast(user_data); + + message_handler(message->message, message->message_size, + std::move(reply_handler)); +} + +} // namespace + +// Wrapper around a FlutterDesktopMessengerRef that implements the +// BinaryMessenger API. +class BinaryMessengerImpl : public BinaryMessenger { + public: + explicit BinaryMessengerImpl(FlutterDesktopMessengerRef core_messenger) + : messenger_(core_messenger) {} + + virtual ~BinaryMessengerImpl() = default; + + // Prevent copying. + BinaryMessengerImpl(BinaryMessengerImpl const&) = delete; + BinaryMessengerImpl& operator=(BinaryMessengerImpl const&) = delete; + + // |flutter::BinaryMessenger| + void Send(const std::string& channel, + const uint8_t* message, + const size_t message_size) const override; + + // |flutter::BinaryMessenger| + void SetMessageHandler(const std::string& channel, + BinaryMessageHandler handler) override; + + private: + // Handle for interacting with the C API. + FlutterDesktopMessengerRef messenger_; + + // A map from channel names to the BinaryMessageHandler that should be called + // for incoming messages on that channel. + std::map handlers_; +}; + +void BinaryMessengerImpl::Send(const std::string& channel, + const uint8_t* message, + const size_t message_size) const { + FlutterDesktopMessengerSend(messenger_, channel.c_str(), message, + message_size); +} + +void BinaryMessengerImpl::SetMessageHandler(const std::string& channel, + BinaryMessageHandler handler) { + if (!handler) { + handlers_.erase(channel); + FlutterDesktopMessengerSetCallback(messenger_, channel.c_str(), nullptr, + nullptr); + return; + } + // Save the handler, to keep it alive. + handlers_[channel] = std::move(handler); + BinaryMessageHandler* message_handler = &handlers_[channel]; + // Set an adaptor callback that will invoke the handler. + FlutterDesktopMessengerSetCallback(messenger_, channel.c_str(), + ForwardToHandler, message_handler); +} + +// PluginRegistrar: + +PluginRegistrar::PluginRegistrar(FlutterDesktopPluginRegistrarRef registrar) + : registrar_(registrar) { + auto core_messenger = FlutterDesktopRegistrarGetMessenger(registrar_); + messenger_ = std::make_unique(core_messenger); +} + +PluginRegistrar::~PluginRegistrar() {} + +void PluginRegistrar::AddPlugin(std::unique_ptr plugin) { + plugins_.insert(std::move(plugin)); +} + +void PluginRegistrar::EnableInputBlockingForChannel( + const std::string& channel) { + FlutterDesktopRegistrarEnableInputBlocking(registrar_, channel.c_str()); +} + +} // namespace flutter diff --git a/shell/platform/common/cpp/client_wrapper/plugin_registrar_unittests.cc b/shell/platform/common/cpp/client_wrapper/plugin_registrar_unittests.cc new file mode 100644 index 0000000000000..c4e5de5b46b50 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/plugin_registrar_unittests.cc @@ -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. + +#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h" + +#include +#include + +#include "flutter/shell/platform/common/cpp/client_wrapper/testing/stub_flutter_api.h" +#include "gtest/gtest.h" + +namespace flutter { + +namespace { + +// Stub implementation to validate calls to the API. +class TestApi : public testing::StubFlutterApi { + public: + // |flutter::testing::StubFlutterApi| + void MessengerSend(const char* channel, + const uint8_t* message, + const size_t message_size) override { + last_data_sent_ = message; + } + + const uint8_t* last_data_sent() { return last_data_sent_; } + + private: + const uint8_t* last_data_sent_ = nullptr; +}; + +} // namespace + +// Tests that the registrar returns a messenger that calls through to the C API. +TEST(MethodCallTest, MessengerSend) { + testing::ScopedStubFlutterApi scoped_api_stub(std::make_unique()); + auto test_api = static_cast(scoped_api_stub.stub()); + + auto dummy_registrar_handle = + reinterpret_cast(1); + PluginRegistrar registrar(dummy_registrar_handle); + BinaryMessenger* messenger = registrar.messenger(); + + std::vector message = {1, 2, 3, 4}; + messenger->Send("some_channel", &message[0], message.size()); + EXPECT_EQ(test_api->last_data_sent(), &message[0]); +} + +} // namespace flutter diff --git a/shell/platform/common/cpp/client_wrapper/publish.gni b/shell/platform/common/cpp/client_wrapper/publish.gni new file mode 100644 index 0000000000000..8913062ced2f4 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/publish.gni @@ -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. + +# Publishes client wrapper files to the output directory for distribution. +# This can be used multiple times to combine various portions of a wrapper +# library into one cohesive library for clients to consume. +# +# Files that should be built by clients go into 'sources', while headers meant +# to be included by the consuming code go into 'public'. +# +# All public code is assumed to be in the 'flutter' namespace. +template("publish_client_wrapper") { + template_target_name = target_name + publish_dir_root = "$root_out_dir/cpp_client_wrapper" + namespace = "flutter" + + group(template_target_name) { + deps = [ + ":${template_target_name}_publish_includes", + ":${template_target_name}_publish_sources", + ] + } + + copy("${template_target_name}_publish_includes") { + visibility = [ ":$template_target_name" ] + + sources = invoker.public + outputs = [ + "$publish_dir_root/include/$namespace/{{source_file_part}}", + ] + } + + copy("${template_target_name}_publish_sources") { + visibility = [ ":$template_target_name" ] + + sources = invoker.sources + outputs = [ + "$publish_dir_root/{{source_file_part}}", + ] + } +} diff --git a/shell/platform/common/cpp/client_wrapper/testing/stub_flutter_api.cc b/shell/platform/common/cpp/client_wrapper/testing/stub_flutter_api.cc new file mode 100644 index 0000000000000..55f4100b72efb --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/testing/stub_flutter_api.cc @@ -0,0 +1,81 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Copyright 2013 The Flutter 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/common/cpp/client_wrapper/testing/stub_flutter_api.h" + +static flutter::testing::StubFlutterApi* s_stub_implementation; + +namespace flutter { +namespace testing { + +// static +void StubFlutterApi::SetTestStub(StubFlutterApi* stub) { + s_stub_implementation = stub; +} + +// static +StubFlutterApi* StubFlutterApi::GetTestStub() { + return s_stub_implementation; +} + +ScopedStubFlutterApi::ScopedStubFlutterApi(std::unique_ptr stub) + : stub_(std::move(stub)) { + previous_stub_ = StubFlutterApi::GetTestStub(); + StubFlutterApi::SetTestStub(stub_.get()); +} + +ScopedStubFlutterApi::~ScopedStubFlutterApi() { + StubFlutterApi::SetTestStub(previous_stub_); +} + +} // namespace testing +} // namespace flutter + +// Forwarding dummy implementations of the C API. + +FlutterDesktopMessengerRef FlutterDesktopRegistrarGetMessenger( + FlutterDesktopPluginRegistrarRef registrar) { + // The stub ignores this, so just return an arbitrary non-zero value. + return reinterpret_cast(1); +} + +void FlutterDesktopRegistrarEnableInputBlocking( + FlutterDesktopPluginRegistrarRef registrar, + const char* channel) { + if (s_stub_implementation) { + s_stub_implementation->RegistrarEnableInputBlocking(channel); + } +} + +void FlutterDesktopMessengerSend(FlutterDesktopMessengerRef messenger, + const char* channel, + const uint8_t* message, + const size_t message_size) { + if (s_stub_implementation) { + s_stub_implementation->MessengerSend(channel, message, message_size); + } +} + +void FlutterDesktopMessengerSendResponse( + FlutterDesktopMessengerRef messenger, + const FlutterDesktopMessageResponseHandle* handle, + const uint8_t* data, + size_t data_length) { + if (s_stub_implementation) { + s_stub_implementation->MessengerSendResponse(handle, data, data_length); + } +} + +void FlutterDesktopMessengerSetCallback(FlutterDesktopMessengerRef messenger, + const char* channel, + FlutterDesktopMessageCallback callback, + void* user_data) { + if (s_stub_implementation) { + s_stub_implementation->MessengerSetCallback(channel, callback, user_data); + } +} diff --git a/shell/platform/common/cpp/client_wrapper/testing/stub_flutter_api.h b/shell/platform/common/cpp/client_wrapper/testing/stub_flutter_api.h new file mode 100644 index 0000000000000..64491405cb805 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/testing/stub_flutter_api.h @@ -0,0 +1,74 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_CLIENT_WRAPPER_TESTING_STUB_FLUTTER_API_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_TESTING_STUB_FLUTTER_API_H_ + +#include + +#include "flutter/shell/platform/common/cpp/public/flutter_messenger.h" +#include "flutter/shell/platform/common/cpp/public/flutter_plugin_registrar.h" + +namespace flutter { +namespace testing { + +// Base class for a object that provides test implementations of the APIs in +// the headers in platform/common/cpp/public/. + +// Linking this class into a test binary will provide dummy forwarding +// implementantions of that C API, so that the wrapper can be tested separately +// from the actual library. +class StubFlutterApi { + public: + // Sets |stub| as the instance to which calls to the Flutter library C APIs + // will be forwarded. + static void SetTestStub(StubFlutterApi* stub); + + // Returns the current stub, as last set by SetTestFluttterStub. + static StubFlutterApi* GetTestStub(); + + virtual ~StubFlutterApi() {} + + // Called for FlutterDesktopRegistrarEnableInputBlocking. + virtual void RegistrarEnableInputBlocking(const char* channel) {} + + // Called for FlutterDesktopMessengerSend. + virtual void MessengerSend(const char* channel, + const uint8_t* message, + const size_t message_size) {} + + // Called for FlutterDesktopMessengerSendResponse. + virtual void MessengerSendResponse( + const FlutterDesktopMessageResponseHandle* handle, + const uint8_t* data, + size_t data_length) {} + + // Called for FlutterDesktopMessengerSetCallback. + virtual void MessengerSetCallback(const char* channel, + FlutterDesktopMessageCallback callback, + void* user_data) {} +}; + +// A test helper that owns a stub implementation, making it the test stub for +// the lifetime of the object, then restoring the previous value. +class ScopedStubFlutterApi { + public: + // Calls SetTestFlutterStub with |stub|. + ScopedStubFlutterApi(std::unique_ptr stub); + + // Restores the previous test stub. + ~ScopedStubFlutterApi(); + + StubFlutterApi* stub() { return stub_.get(); } + + private: + std::unique_ptr stub_; + // The previous stub. + StubFlutterApi* previous_stub_; +}; + +} // namespace testing +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_TESTING_STUB_FLUTTER_API_H_ diff --git a/shell/platform/common/cpp/incoming_message_dispatcher.cc b/shell/platform/common/cpp/incoming_message_dispatcher.cc new file mode 100644 index 0000000000000..f766f7738135a --- /dev/null +++ b/shell/platform/common/cpp/incoming_message_dispatcher.cc @@ -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. + +#include "flutter/shell/platform/common/cpp/incoming_message_dispatcher.h" + +namespace shell { + +IncomingMessageDispatcher::IncomingMessageDispatcher( + FlutterDesktopMessengerRef messenger) + : messenger_(messenger) {} + +IncomingMessageDispatcher::~IncomingMessageDispatcher() = default; + +void IncomingMessageDispatcher::HandleMessage( + const FlutterDesktopMessage& message, + std::function input_block_cb, + std::function input_unblock_cb) { + std::string channel(message.channel); + + // Find the handler for the channel; if there isn't one, report the failure. + if (callbacks_.find(channel) == callbacks_.end()) { + FlutterDesktopMessengerSendResponse(messenger_, message.response_handle, + nullptr, 0); + return; + } + auto& callback_info = callbacks_[channel]; + FlutterDesktopMessageCallback message_callback = callback_info.first; + + // Process the call, handling input blocking if requested. + bool block_input = input_blocking_channels_.count(channel) > 0; + if (block_input) { + input_block_cb(); + } + message_callback(messenger_, &message, callback_info.second); + if (block_input) { + input_unblock_cb(); + } +} + +void IncomingMessageDispatcher::SetMessageCallback( + const std::string& channel, + FlutterDesktopMessageCallback callback, + void* user_data) { + if (!callback) { + callbacks_.erase(channel); + return; + } + callbacks_[channel] = std::make_pair(callback, user_data); +} + +void IncomingMessageDispatcher::EnableInputBlockingForChannel( + const std::string& channel) { + input_blocking_channels_.insert(channel); +} + +} // namespace shell diff --git a/shell/platform/common/cpp/incoming_message_dispatcher.h b/shell/platform/common/cpp/incoming_message_dispatcher.h new file mode 100644 index 0000000000000..fced7db7a8e24 --- /dev/null +++ b/shell/platform/common/cpp/incoming_message_dispatcher.h @@ -0,0 +1,78 @@ +// Copyright 2013 The Flutter 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_CPP_INCOMING_MESSAGE_DISPATCHER_H_ +#define FLUTTER_SHELL_PLATFORM_CPP_INCOMING_MESSAGE_DISPATCHER_H_ + +#include +#include +#include +#include +#include + +#include "flutter/shell/platform/common/cpp/public/flutter_messenger.h" + +namespace shell { + +// Manages per-channel registration of callbacks for handling messages from the +// Flutter engine, and dispatching incoming messages to those handlers. +class IncomingMessageDispatcher { + public: + // Creates a new IncomingMessageDispatcher. |messenger| must remain valid as + // long as this object exists. + explicit IncomingMessageDispatcher(FlutterDesktopMessengerRef messenger); + + virtual ~IncomingMessageDispatcher(); + + // Prevent copying. + IncomingMessageDispatcher(IncomingMessageDispatcher const&) = delete; + IncomingMessageDispatcher& operator=(IncomingMessageDispatcher const&) = + delete; + + // Routes |message| to to the registered handler for its channel, if any. + // + // If input blocking has been enabled on that channel, wraps the call to the + // handler with calls to the given callbacks to block and then unblock input. + // + // If no handler is registered for the message's channel, sends a + // NotImplemented response to the engine. + void HandleMessage( + const FlutterDesktopMessage& message, + std::function input_block_cb = [] {}, + std::function input_unblock_cb = [] {}); + + // Registers a message callback for incoming messages from the Flutter + // side on the specified channel. |callback| will be called with the message + // and |user_data| any time a message arrives on that channel. + // + // Replaces any existing callback. Pass a null callback to unregister the + // existing callback. + void SetMessageCallback(const std::string& channel, + FlutterDesktopMessageCallback callback, + void* user_data); + + // Enables input blocking on the given channel name. + // + // If set, then the parent window should disable input callbacks + // while waiting for the handler for messages on that channel to run. + void EnableInputBlockingForChannel(const std::string& channel); + + private: + // Handle for interacting with the C messaging API. + FlutterDesktopMessengerRef messenger_; + + // A map from channel names to the FlutterDesktopMessageCallback that should + // be called for incoming messages on that channel, along with the void* user + // data to pass to it. + std::map> + callbacks_; + + // Channel names for which input blocking should be enabled during the call to + // that channel's handler. + std::set input_blocking_channels_; +}; + +} // namespace shell + +#endif // FLUTTER_SHELL_PLATFORM_CPP_INCOMING_MESSAGE_DISPATCHER_H_ diff --git a/shell/platform/common/cpp/public/flutter_export.h b/shell/platform/common/cpp/public/flutter_export.h new file mode 100644 index 0000000000000..2f380915f9510 --- /dev/null +++ b/shell/platform/common/cpp/public/flutter_export.h @@ -0,0 +1,28 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_PUBLIC_FLUTTER_EXPORT_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_PUBLIC_FLUTTER_EXPORT_H_ + +#ifdef FLUTTER_DESKTOP_LIBRARY +// Add visibility/export annotations when building the library. + +#ifdef _WIN32 +#define FLUTTER_EXPORT __declspec(dllexport) +#else +#define FLUTTER_EXPORT __attribute__((visibility("default"))) +#endif + +#else // FLUTTER_DESKTOP_LIBRARY + +// Add import annotations when consuming the library. +#ifdef _WIN32 +#define FLUTTER_EXPORT __declspec(dllimport) +#else +#define FLUTTER_EXPORT +#endif + +#endif // FLUTTER_DESKTOP_LIBRARY + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_PUBLIC_FLUTTER_EXPORT_H_ \ No newline at end of file diff --git a/shell/platform/common/cpp/public/flutter_messenger.h b/shell/platform/common/cpp/public/flutter_messenger.h new file mode 100644 index 0000000000000..ff9f43437708d --- /dev/null +++ b/shell/platform/common/cpp/public/flutter_messenger.h @@ -0,0 +1,81 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_PUBLIC_FLUTTER_MESSENGER_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_PUBLIC_FLUTTER_MESSENGER_H_ + +#include +#include + +#include "flutter_export.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +// Opaque reference to a Flutter engine messenger. +typedef struct FlutterDesktopMessenger* FlutterDesktopMessengerRef; + +// Opaque handle for tracking responses to messages. +typedef struct _FlutterPlatformMessageResponseHandle + FlutterDesktopMessageResponseHandle; + +// A message received from Flutter. +typedef struct { + // Size of this struct as created by Flutter. + size_t struct_size; + // The name of the channel used for this message. + const char* channel; + // The raw message data. + const uint8_t* message; + // The length of |message|. + size_t message_size; + // The response handle. If non-null, the receiver of this message must call + // FlutterDesktopSendMessageResponse exactly once with this handle. + const FlutterDesktopMessageResponseHandle* response_handle; +} FlutterDesktopMessage; + +// Function pointer type for message handler callback registration. +// +// The user data will be whatever was passed to FlutterDesktopSetMessageHandler +// for the channel the message is received on. +typedef void (*FlutterDesktopMessageCallback)( + FlutterDesktopMessengerRef /* messenger */, + const FlutterDesktopMessage* /* message*/, + void* /* user data */); + +// Sends a binary message to the Flutter side on the specified channel. +FLUTTER_EXPORT void FlutterDesktopMessengerSend( + FlutterDesktopMessengerRef messenger, + const char* channel, + const uint8_t* message, + const size_t message_size); + +// Sends a reply to a FlutterDesktopMessage for the given response handle. +// +// Once this has been called, |handle| is invalid and must not be used again. +FLUTTER_EXPORT void FlutterDesktopMessengerSendResponse( + FlutterDesktopMessengerRef messenger, + const FlutterDesktopMessageResponseHandle* handle, + const uint8_t* data, + size_t data_length); + +// Registers a callback function for incoming binary messages from the Flutter +// side on the specified channel. +// +// Replaces any existing callback. Provide a null handler to unregister the +// existing callback. +// +// If |user_data| is provided, it will be passed in |callback| calls. +FLUTTER_EXPORT void FlutterDesktopMessengerSetCallback( + FlutterDesktopMessengerRef messenger, + const char* channel, + FlutterDesktopMessageCallback callback, + void* user_data); + +#if defined(__cplusplus) +} // extern "C" +#endif + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_PUBLIC_FLUTTER_MESSENGER_H_ diff --git a/shell/platform/common/cpp/public/flutter_plugin_registrar.h b/shell/platform/common/cpp/public/flutter_plugin_registrar.h new file mode 100644 index 0000000000000..1caa3cee1f9e4 --- /dev/null +++ b/shell/platform/common/cpp/public/flutter_plugin_registrar.h @@ -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. + +#ifndef FLUTTER_SHELL_PLATFORM_COMMON_CPP_PUBLIC_FLUTTER_PLUGIN_REGISTRAR_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_PUBLIC_FLUTTER_PLUGIN_REGISTRAR_H_ + +#include +#include + +#include "flutter_export.h" +#include "flutter_messenger.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +// Opaque reference to a plugin registrar. +typedef struct FlutterDesktopPluginRegistrar* FlutterDesktopPluginRegistrarRef; + +// Returns the engine messenger associated with this registrar. +FLUTTER_EXPORT FlutterDesktopMessengerRef +FlutterDesktopRegistrarGetMessenger(FlutterDesktopPluginRegistrarRef registrar); + +// Enables input blocking on the given channel. +// +// If set, then the Flutter window will disable input callbacks +// while waiting for the handler for messages on that channel to run. This is +// useful if handling the message involves showing a modal window, for instance. +// +// This must be called after FlutterDesktopSetMessageHandler, as setting a +// handler on a channel will reset the input blocking state back to the +// default of disabled. +FLUTTER_EXPORT void FlutterDesktopRegistrarEnableInputBlocking( + FlutterDesktopPluginRegistrarRef registrar, + const char* channel); + +#if defined(__cplusplus) +} // extern "C" +#endif + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_PUBLIC_FLUTTER_PLUGIN_REGISTRAR_H_ diff --git a/shell/platform/common/cpp/text_input_model.cc b/shell/platform/common/cpp/text_input_model.cc new file mode 100644 index 0000000000000..2f1c9b3741f1f --- /dev/null +++ b/shell/platform/common/cpp/text_input_model.cc @@ -0,0 +1,181 @@ +// Copyright 2013 The Flutter 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/common/cpp/text_input_model.h" + +#include + +// TODO(awdavies): Need to fix this regarding issue #47. +static constexpr char kComposingBaseKey[] = "composingBase"; + +static constexpr char kComposingExtentKey[] = "composingExtent"; + +static constexpr char kSelectionAffinityKey[] = "selectionAffinity"; +static constexpr char kAffinityDownstream[] = "TextAffinity.downstream"; + +static constexpr char kSelectionBaseKey[] = "selectionBase"; +static constexpr char kSelectionExtentKey[] = "selectionExtent"; + +static constexpr char kSelectionIsDirectionalKey[] = "selectionIsDirectional"; + +static constexpr char kTextKey[] = "text"; + +// Input client configuration keys. +static constexpr char kTextInputAction[] = "inputAction"; +static constexpr char kTextInputType[] = "inputType"; +static constexpr char kTextInputTypeName[] = "name"; + +namespace shell { + +TextInputModel::TextInputModel(int client_id, const rapidjson::Value& config) + : text_(""), + client_id_(client_id), + selection_base_(text_.begin()), + selection_extent_(text_.begin()) { + // TODO: Improve error handling during refactoring; this is just minimal + // checking to avoid asserts since RapidJSON is stricter than jsoncpp. + if (config.IsObject()) { + auto input_action = config.FindMember(kTextInputAction); + if (input_action != config.MemberEnd() && input_action->value.IsString()) { + input_action_ = input_action->value.GetString(); + } + auto input_type_info = config.FindMember(kTextInputType); + if (input_type_info != config.MemberEnd() && + input_type_info->value.IsObject()) { + auto input_type = input_type_info->value.FindMember(kTextInputTypeName); + if (input_type != input_type_info->value.MemberEnd() && + input_type->value.IsString()) { + input_type_ = input_type->value.GetString(); + } + } + } +} + +TextInputModel::~TextInputModel() = default; + +bool TextInputModel::SetEditingState(size_t selection_base, + size_t selection_extent, + const std::string& text) { + if (selection_base > selection_extent) { + return false; + } + // Only checks extent since it is implicitly greater-than-or-equal-to base. + if (selection_extent > text.size()) { + return false; + } + text_ = std::string(text); + selection_base_ = text_.begin() + selection_base; + selection_extent_ = text_.begin() + selection_extent; + return true; +} + +void TextInputModel::DeleteSelected() { + selection_base_ = text_.erase(selection_base_, selection_extent_); + // Moves extent back to base, so that it is a single cursor placement again. + selection_extent_ = selection_base_; +} + +void TextInputModel::AddCharacter(char c) { + if (selection_base_ != selection_extent_) { + DeleteSelected(); + } + selection_extent_ = text_.insert(selection_extent_, c); + selection_extent_++; + selection_base_ = selection_extent_; +} + +bool TextInputModel::Backspace() { + if (selection_base_ != selection_extent_) { + DeleteSelected(); + return true; + } + if (selection_base_ != text_.begin()) { + selection_base_ = text_.erase(selection_base_ - 1, selection_base_); + selection_extent_ = selection_base_; + return true; + } + return false; // No edits happened. +} + +bool TextInputModel::Delete() { + if (selection_base_ != selection_extent_) { + DeleteSelected(); + return true; + } + if (selection_base_ != text_.end()) { + selection_base_ = text_.erase(selection_base_, selection_base_ + 1); + selection_extent_ = selection_base_; + return true; + } + return false; +} + +void TextInputModel::MoveCursorToBeginning() { + selection_base_ = text_.begin(); + selection_extent_ = text_.begin(); +} + +void TextInputModel::MoveCursorToEnd() { + selection_base_ = text_.end(); + selection_extent_ = text_.end(); +} + +bool TextInputModel::MoveCursorForward() { + // If about to move set to the end of the highlight (when not selecting). + if (selection_base_ != selection_extent_) { + selection_base_ = selection_extent_; + return true; + } + // If not at the end, move the extent forward. + if (selection_extent_ != text_.end()) { + selection_extent_++; + selection_base_++; + return true; + } + return false; +} + +bool TextInputModel::MoveCursorBack() { + // If about to move set to the beginning of the highlight + // (when not selecting). + if (selection_base_ != selection_extent_) { + selection_extent_ = selection_base_; + return true; + } + // If not at the start, move the beginning backward. + if (selection_base_ != text_.begin()) { + selection_base_--; + selection_extent_--; + return true; + } + return false; +} + +std::unique_ptr TextInputModel::GetState() const { + // TODO(stuartmorgan): Move client_id out up to the plugin so that this + // function just returns the editing state. + auto args = std::make_unique(rapidjson::kArrayType); + auto& allocator = args->GetAllocator(); + args->PushBack(client_id_, allocator); + + rapidjson::Value editing_state(rapidjson::kObjectType); + // TODO(awdavies): Most of these are hard-coded for now. + editing_state.AddMember(kComposingBaseKey, -1, allocator); + editing_state.AddMember(kComposingExtentKey, -1, allocator); + editing_state.AddMember(kSelectionAffinityKey, kAffinityDownstream, + allocator); + editing_state.AddMember(kSelectionBaseKey, + static_cast(selection_base_ - text_.begin()), + allocator); + editing_state.AddMember(kSelectionExtentKey, + static_cast(selection_extent_ - text_.begin()), + allocator); + editing_state.AddMember(kSelectionIsDirectionalKey, false, allocator); + editing_state.AddMember(kTextKey, rapidjson::Value(text_, allocator).Move(), + allocator); + args->PushBack(editing_state, allocator); + return args; +} + +} // namespace shell diff --git a/shell/platform/common/cpp/text_input_model.h b/shell/platform/common/cpp/text_input_model.h new file mode 100644 index 0000000000000..3ae567c50c463 --- /dev/null +++ b/shell/platform/common/cpp/text_input_model.h @@ -0,0 +1,101 @@ +// Copyright 2013 The Flutter 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_CPP_TEXT_INPUT_MODEL_H_ +#define FLUTTER_SHELL_PLATFORM_CPP_TEXT_INPUT_MODEL_H_ + +#include + +#include "rapidjson/document.h" + +namespace shell { +// Handles underlying text input state, using a simple ASCII model. +// +// Ignores special states like "insert mode" for now. +class TextInputModel { + public: + TextInputModel(int client_id, const rapidjson::Value& config); + virtual ~TextInputModel(); + + // Attempts to set the text state. + // + // Returns false if the state is not valid (base or extent are out of + // bounds, or base is less than extent). + bool SetEditingState(size_t selection_base, + size_t selection_extent, + const std::string& text); + + // Adds a character. + // + // Either appends after the cursor (when selection base and extent are the + // same), or deletes the selected characters, replacing the text with the + // character specified. + void AddCharacter(char c); + + // Deletes either the selection, or one character ahead of the cursor. + // + // Deleting one character ahead of the cursor occurs when the selection base + // and extent are the same. + // + // Returns true if any deletion actually occurred. + bool Delete(); + + // Deletes either the selection, or one character behind the cursor. + // + // Deleting one character behind the cursor occurs when the selection base + // and extent are the same. + // + // Returns true if any deletion actually occurred. + bool Backspace(); + + // Attempts to move the cursor backward. + // + // Returns true if the cursor could be moved. Changes base and extent to be + // equal to either the extent (if extent is at the end of the string), or + // for extent to be equal to + bool MoveCursorBack(); + + // Attempts to move the cursor forward. + // + // Returns true if the cursor could be moved. + bool MoveCursorForward(); + + // Attempts to move the cursor to the beginning. + // + // Returns true if the cursor could be moved. + void MoveCursorToBeginning(); + + // Attempts to move the cursor to the back. + // + // Returns true if the cursor could be moved. + void MoveCursorToEnd(); + + // Returns the state in the form of a platform message. + std::unique_ptr GetState() const; + + // Id of the text input client. + int client_id() const { return client_id_; } + + // Keyboard type of the client. See available options: + // https://docs.flutter.io/flutter/services/TextInputType-class.html + std::string input_type() const { return input_type_; } + + // An action requested by the user on the input client. See available options: + // https://docs.flutter.io/flutter/services/TextInputAction-class.html + std::string input_action() const { return input_action_; } + + private: + void DeleteSelected(); + + std::string text_; + int client_id_; + std::string input_type_; + std::string input_action_; + std::string::iterator selection_base_; + std::string::iterator selection_extent_; +}; + +} // namespace shell + +#endif // FLUTTER_SHELL_PLATFORM_CPP_TEXT_INPUT_MODEL_H_ diff --git a/shell/platform/glfw/BUILD.gn b/shell/platform/glfw/BUILD.gn new file mode 100644 index 0000000000000..5fa29fc02c717 --- /dev/null +++ b/shell/platform/glfw/BUILD.gn @@ -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. + +_public_headers = [ "public/flutter_glfw.h" ] + +# Any files that are built by clients (client_wrapper code, library headers for +# implementations using this shared code, etc.) include the public headers +# assuming they are in the include path. This configuration should be added to +# any such code that is also built by GN to make the includes work. +config("relative_flutter_glfw_headers") { + include_dirs = [ "public" ] +} + +# The headers are a separate source set since the client wrapper is allowed +# to depend on the public headers, but none of the rest of the code. +source_set("flutter_glfw_headers") { + public = _public_headers + + public_deps = [ + "$flutter_root/shell/platform/common/cpp:common_cpp_library_headers", + ] + + configs += [ + "$flutter_root/shell/platform/common/cpp:desktop_library_implementation", + ] + + public_configs = [ + "$flutter_root/shell/platform/common/cpp:relative_flutter_library_headers", + ] +} + +source_set("flutter_glfw") { + sources = [ + "flutter_glfw.cc", + "key_event_handler.cc", + "key_event_handler.h", + "keyboard_hook_handler.h", + "text_input_plugin.cc", + "text_input_plugin.h", + ] + + defines = [ "USE_RAPID_JSON" ] + + configs += [ + "$flutter_root/shell/platform/common/cpp:desktop_library_implementation", + ] + + deps = [ + ":flutter_glfw_headers", + "$flutter_root/shell/platform/common/cpp:common_cpp", + "$flutter_root/shell/platform/common/cpp/client_wrapper:client_wrapper", + "$flutter_root/shell/platform/embedder:embedder", + "$flutter_root/shell/platform/glfw/client_wrapper:client_wrapper_glfw", + "//third_party/rapidjson", + ] + + if (is_linux) { + libs = [ "GL" ] + + configs += [ + "$flutter_root/shell/platform/linux/config:epoxy", + "$flutter_root/shell/platform/linux/config:glfw3", + "$flutter_root/shell/platform/linux/config:gtk3", + "$flutter_root/shell/platform/linux/config:x11", + ] + } +} + +copy("publish_headers_glfw") { + sources = _public_headers + outputs = [ + "$root_out_dir/{{source_file_part}}", + ] + + # The GLFW header assumes the presence of the common headers. + deps = [ + "$flutter_root/shell/platform/common/cpp:publish_headers", + ] +} diff --git a/shell/platform/glfw/client_wrapper/BUILD.gn b/shell/platform/glfw/client_wrapper/BUILD.gn new file mode 100644 index 0000000000000..d9e1b482dbaf6 --- /dev/null +++ b/shell/platform/glfw/client_wrapper/BUILD.gn @@ -0,0 +1,78 @@ +# Copyright 2013 The Flutter 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/platform/common/cpp/client_wrapper/publish.gni") + +_wrapper_includes = [ "include/flutter/flutter_window_controller.h" ] + +_wrapper_sources = [ "flutter_window_controller.cc" ] + +# This code will be merged into .../common/cpp/client_wrapper for client use, +# so uses header paths that assume the merged state. Include the header +# header directory of the core wrapper files so these includes will work. +config("relative_core_wrapper_headers") { + include_dirs = [ + "$flutter_root/shell/platform/common/cpp/client_wrapper/include/flutter", + ] +} + +# GLFW client wrapper build for internal use by the shell implementation. +source_set("client_wrapper_glfw") { + sources = _wrapper_sources + public = _wrapper_includes + + deps = [ + "$flutter_root/shell/platform/common/cpp:common_cpp_library_headers", + "$flutter_root/shell/platform/common/cpp/client_wrapper:client_wrapper", + "$flutter_root/shell/platform/glfw:flutter_glfw_headers", + ] + + configs += [ + "$flutter_root/shell/platform/common/cpp:desktop_library_implementation", + ] + + public_configs = [ + ":relative_core_wrapper_headers", + "$flutter_root/shell/platform/common/cpp:relative_flutter_library_headers", + "$flutter_root/shell/platform/glfw:relative_flutter_glfw_headers", + ] +} + +# Copies the GLFW client wrapper code to the output directory, merging it into +# the core wrapper. +publish_client_wrapper("publish_wrapper_glfw") { + public = _wrapper_includes + sources = _wrapper_sources +} + +source_set("client_wrapper_library_stubs_glfw") { + sources = [ + "testing/stub_flutter_glfw_api.cc", + "testing/stub_flutter_glfw_api.h", + ] + + public_deps = [ + "$flutter_root/shell/platform/glfw:flutter_glfw_headers", + ] +} + +executable("client_wrapper_glfw_unittests") { + testonly = true + + # TODO: Add more unit tests. + sources = [ + "flutter_window_controller_unittests.cc", + ] + + deps = [ + ":client_wrapper_glfw", + ":client_wrapper_library_stubs_glfw", + "$flutter_root/shell/platform/common/cpp/client_wrapper:client_wrapper_library_stubs", + "$flutter_root/testing", + + # TODO: Consider refactoring flutter_root/testing so that there's a testing + # target that doesn't require a Dart runtime to be linked in. + "//third_party/dart/runtime:libdart_jit", + ] +} diff --git a/shell/platform/glfw/client_wrapper/flutter_window_controller.cc b/shell/platform/glfw/client_wrapper/flutter_window_controller.cc new file mode 100644 index 0000000000000..c73d6e7078699 --- /dev/null +++ b/shell/platform/glfw/client_wrapper/flutter_window_controller.cc @@ -0,0 +1,77 @@ +// Copyright 2013 The Flutter 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/flutter_window_controller.h" + +#include +#include + +namespace flutter { + +FlutterWindowController::FlutterWindowController( + const std::string& icu_data_path) + : icu_data_path_(icu_data_path) { + init_succeeded_ = FlutterDesktopInit(); +} + +FlutterWindowController::~FlutterWindowController() { + if (init_succeeded_) { + FlutterDesktopTerminate(); + } +} + +bool FlutterWindowController::CreateWindow( + int width, + int height, + const std::string& assets_path, + const std::vector& arguments) { + if (!init_succeeded_) { + std::cerr << "Could not create window; FlutterDesktopInit failed." + << std::endl; + return false; + } + + if (window_) { + std::cerr << "Only one Flutter window can exist at a time." << std::endl; + return false; + } + + std::vector engine_arguments; + std::transform( + arguments.begin(), arguments.end(), std::back_inserter(engine_arguments), + [](const std::string& arg) -> const char* { return arg.c_str(); }); + size_t arg_count = engine_arguments.size(); + + window_ = FlutterDesktopCreateWindow( + width, height, assets_path.c_str(), icu_data_path_.c_str(), + arg_count > 0 ? &engine_arguments[0] : nullptr, arg_count); + if (!window_) { + std::cerr << "Failed to create window." << std::endl; + return false; + } + return true; +} + +FlutterDesktopPluginRegistrarRef FlutterWindowController::GetRegistrarForPlugin( + const std::string& plugin_name) { + if (!window_) { + std::cerr << "Cannot get plugin registrar without a window; call " + "CreateWindow first." + << std::endl; + return nullptr; + } + return FlutterDesktopGetPluginRegistrar(window_, plugin_name.c_str()); +} + +void FlutterWindowController::SetHoverEnabled(bool enabled) { + FlutterDesktopSetHoverEnabled(window_, enabled); +} + +void FlutterWindowController::RunEventLoop() { + if (window_) { + FlutterDesktopRunWindowLoop(window_); + } +} + +} // namespace flutter diff --git a/shell/platform/glfw/client_wrapper/flutter_window_controller_unittests.cc b/shell/platform/glfw/client_wrapper/flutter_window_controller_unittests.cc new file mode 100644 index 0000000000000..d0e90fcb5056c --- /dev/null +++ b/shell/platform/glfw/client_wrapper/flutter_window_controller_unittests.cc @@ -0,0 +1,54 @@ +// Copyright 2013 The Flutter 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/glfw/client_wrapper/include/flutter/flutter_window_controller.h" + +#include +#include + +#include "flutter/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.h" +#include "gtest/gtest.h" + +namespace flutter { + +namespace { + +// Stub implementation to validate calls to the API. +class TestGlfwApi : public testing::StubFlutterGlfwApi { + public: + // |flutter::testing::StubFlutterGlfwApi| + bool Init() override { + init_called_ = true; + return true; + } + + // |flutter::testing::StubFlutterGlfwApi| + void Terminate() override { terminate_called_ = true; } + + bool init_called() { return init_called_; } + + bool terminate_called() { return terminate_called_; } + + private: + bool init_called_ = false; + bool terminate_called_ = false; +}; + +} // namespace + +TEST(FlutterViewControllerTest, CreateDestroy) { + const std::string icu_data_path = "fake/path/to/icu"; + testing::ScopedStubFlutterGlfwApi scoped_api_stub( + std::make_unique()); + auto test_api = static_cast(scoped_api_stub.stub()); + { + FlutterWindowController controller(icu_data_path); + EXPECT_EQ(test_api->init_called(), true); + EXPECT_EQ(test_api->terminate_called(), false); + } + EXPECT_EQ(test_api->init_called(), true); + EXPECT_EQ(test_api->terminate_called(), true); +} + +} // namespace flutter diff --git a/shell/platform/glfw/client_wrapper/include/flutter/flutter_window_controller.h b/shell/platform/glfw/client_wrapper/include/flutter/flutter_window_controller.h new file mode 100644 index 0000000000000..24496252c887c --- /dev/null +++ b/shell/platform/glfw/client_wrapper/include/flutter/flutter_window_controller.h @@ -0,0 +1,83 @@ +// Copyright 2013 The Flutter 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_GLFW_CLIENT_WRAPPER_INCLUDE_FLUTTER_FLUTTER_WINDOW_CONTROLLER_H_ +#define FLUTTER_SHELL_PLATFORM_GLFW_CLIENT_WRAPPER_INCLUDE_FLUTTER_FLUTTER_WINDOW_CONTROLLER_H_ + +#include +#include + +#include + +#include "plugin_registrar.h" + +namespace flutter { + +// A controller for a window displaying Flutter content. +// +// This is the primary wrapper class for the desktop C API. +// If you use this class, you should not call any of the setup or teardown +// methods in the C API directly, as this class will do that internally. +// +// Note: This is an early implementation (using GLFW internally) which +// requires control of the application's event loop, and is thus useful +// primarily for building a simple one-window shell hosting a Flutter +// application. The final implementation and API will be very different. +class FlutterWindowController { + public: + // There must be only one instance of this class in an application at any + // given time, as Flutter does not support multiple engines in one process, + // or multiple views in one engine. + explicit FlutterWindowController(const std::string& icu_data_path); + + ~FlutterWindowController(); + + // Creates and displays a window for displaying Flutter content. + // + // The |assets_path| is the path to the flutter_assets folder for the Flutter + // application to be run. |icu_data_path| is the path to the icudtl.dat file + // for the version of Flutter you are using. + // + // The |arguments| are passed to the Flutter engine. See: + // https://github.com/flutter/engine/blob/master/shell/common/switches.h for + // for details. Not all arguments will apply to desktop. + // + // Only one Flutter window can exist at a time; see constructor comment. + bool CreateWindow(int width, + int height, + const std::string& assets_path, + const std::vector& arguments); + + // Returns the FlutterDesktopPluginRegistrarRef to register a plugin with the + // given name. + // + // The name must be unique across the application. + FlutterDesktopPluginRegistrarRef GetRegistrarForPlugin( + const std::string& plugin_name); + + // Enables or disables hover tracking. + // + // If hover is enabled, mouse movement will send hover events to the Flutter + // engine, rather than only tracking the mouse while the button is pressed. + // Defaults to off. + void SetHoverEnabled(bool enabled); + + // Loops on Flutter window events until the window closes. + void RunEventLoop(); + + private: + // The path to the ICU data file. Set at creation time since it is the same + // for any window created. + std::string icu_data_path_; + + // Whether or not FlutterDesktopInit succeeded at creation time. + bool init_succeeded_ = false; + + // The curent Flutter window, if any. + FlutterDesktopWindowRef window_ = nullptr; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_GLFW_CLIENT_WRAPPER_INCLUDE_FLUTTER_FLUTTER_WINDOW_CONTROLLER_H_ diff --git a/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.cc b/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.cc new file mode 100644 index 0000000000000..f3a5e9a436469 --- /dev/null +++ b/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.cc @@ -0,0 +1,101 @@ +// Copyright 2013 The Flutter 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/glfw/client_wrapper/testing/stub_flutter_glfw_api.h" + +static flutter::testing::StubFlutterGlfwApi* s_stub_implementation; + +namespace flutter { +namespace testing { + +// static +void StubFlutterGlfwApi::SetTestStub(StubFlutterGlfwApi* stub) { + s_stub_implementation = stub; +} + +// static +StubFlutterGlfwApi* StubFlutterGlfwApi::GetTestStub() { + return s_stub_implementation; +} + +ScopedStubFlutterGlfwApi::ScopedStubFlutterGlfwApi( + std::unique_ptr stub) + : stub_(std::move(stub)) { + previous_stub_ = StubFlutterGlfwApi::GetTestStub(); + StubFlutterGlfwApi::SetTestStub(stub_.get()); +} + +ScopedStubFlutterGlfwApi::~ScopedStubFlutterGlfwApi() { + StubFlutterGlfwApi::SetTestStub(previous_stub_); +} + +} // namespace testing +} // namespace flutter + +// Forwarding dummy implementations of the C API. + +bool FlutterDesktopInit() { + if (s_stub_implementation) { + s_stub_implementation->Init(); + } + return true; +} + +void FlutterDesktopTerminate() { + if (s_stub_implementation) { + s_stub_implementation->Terminate(); + } +} + +FlutterDesktopWindowRef FlutterDesktopCreateWindow(int initial_width, + int initial_height, + const char* assets_path, + const char* icu_data_path, + const char** arguments, + size_t argument_count) { + if (s_stub_implementation) { + return s_stub_implementation->CreateWindow(initial_width, initial_height, + assets_path, icu_data_path, + arguments, argument_count); + } + return nullptr; +} + +void FlutterDesktopSetHoverEnabled(FlutterDesktopWindowRef flutter_window, + bool enabled) { + if (s_stub_implementation) { + s_stub_implementation->SetHoverEnabled(enabled); + } +} + +void FlutterDesktopRunWindowLoop(FlutterDesktopWindowRef flutter_window) { + if (s_stub_implementation) { + s_stub_implementation->RunWindowLoop(); + } +} + +FlutterDesktopEngineRef FlutterDesktopRunEngine(const char* assets_path, + const char* icu_data_path, + const char** arguments, + size_t argument_count) { + if (s_stub_implementation) { + return s_stub_implementation->RunEngine(assets_path, icu_data_path, + arguments, argument_count); + } + return nullptr; +} + +bool FlutterDesktopShutDownEngine(FlutterDesktopEngineRef engine_ref) { + if (s_stub_implementation) { + return s_stub_implementation->ShutDownEngine(); + } + return true; +} + +FlutterDesktopPluginRegistrarRef FlutterDesktopGetPluginRegistrar( + FlutterDesktopWindowRef flutter_window, + const char* plugin_name) { + // The stub ignores this, so just return an arbitrary non-zero value. + return reinterpret_cast(1); +} diff --git a/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.h b/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.h new file mode 100644 index 0000000000000..70f993646d3c0 --- /dev/null +++ b/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.h @@ -0,0 +1,87 @@ +// Copyright 2013 The Flutter 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_GLFW_WRAPPER_TESTING_STUB_FLUTTER_GLFW_API_H_ +#define FLUTTER_SHELL_PLATFORM_GLFW_WRAPPER_TESTING_STUB_FLUTTER_GLFW_API_H_ + +#include + +#include "flutter/shell/platform/glfw/public/flutter_glfw.h" + +namespace flutter { +namespace testing { + +// Base class for a object that provides test implementations of the APIs in +// the headers in platform/glfw/public/. + +// Linking this class into a test binary will provide dummy forwarding +// implementantions of that C API, so that the wrapper can be tested separately +// from the actual library. +class StubFlutterGlfwApi { + public: + // Sets |stub| as the instance to which calls to the Flutter library C APIs + // will be forwarded. + static void SetTestStub(StubFlutterGlfwApi* stub); + + // Returns the current stub, as last set by SetTestFluttterStub. + static StubFlutterGlfwApi* GetTestStub(); + + virtual ~StubFlutterGlfwApi() {} + + // Called for FlutterDesktopInit. + virtual bool Init() { return true; } + + // Called for FlutterDesktopTerminate. + virtual void Terminate() {} + + // Called for FlutterDesktopCreateWindow. + virtual FlutterDesktopWindowRef CreateWindow(int initial_width, + int initial_height, + const char* assets_path, + const char* icu_data_path, + const char** arguments, + size_t argument_count) { + return nullptr; + } + + // Called for FlutterDesktopSetHoverEnabled + virtual void SetHoverEnabled(bool enabled) {} + + // Called for FlutterDesktopRunWindowLoop. + virtual void RunWindowLoop() {} + + // Called for FlutterDesktopRunEngine. + virtual FlutterDesktopEngineRef RunEngine(const char* assets_path, + const char* icu_data_path, + const char** arguments, + size_t argument_count) { + return nullptr; + } + + // Called for FlutterDesktopShutDownEngine. + virtual bool ShutDownEngine() { return true; } +}; + +// A test helper that owns a stub implementation, making it the test stub for +// the lifetime of the object, then restoring the previous value. +class ScopedStubFlutterGlfwApi { + public: + // Calls SetTestFlutterStub with |stub|. + ScopedStubFlutterGlfwApi(std::unique_ptr stub); + + // Restores the previous test stub. + ~ScopedStubFlutterGlfwApi(); + + StubFlutterGlfwApi* stub() { return stub_.get(); } + + private: + std::unique_ptr stub_; + // The previous stub. + StubFlutterGlfwApi* previous_stub_; +}; + +} // namespace testing +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_GLFW_CLIENT_WRAPPER_TESTING_STUB_FLUTTER_GLFW_API_H_ diff --git a/shell/platform/glfw/flutter_glfw.cc b/shell/platform/glfw/flutter_glfw.cc new file mode 100644 index 0000000000000..9b2e6c4871d6c --- /dev/null +++ b/shell/platform/glfw/flutter_glfw.cc @@ -0,0 +1,595 @@ +// Copyright 2013 The Flutter 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/glfw/public/flutter_glfw.h" + +#include +#include +#include +#include +#include + +#ifdef __linux__ +// Epoxy must be included before any graphics-related code. +#include +#endif + +#include + +#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h" +#include "flutter/shell/platform/common/cpp/incoming_message_dispatcher.h" +#include "flutter/shell/platform/embedder/embedder.h" +#include "flutter/shell/platform/glfw/key_event_handler.h" +#include "flutter/shell/platform/glfw/keyboard_hook_handler.h" +#include "flutter/shell/platform/glfw/text_input_plugin.h" + +#ifdef __linux__ +// For plugin-compatible event handling (e.g., modal windows). +#include +#include +#endif + +// GLFW_TRUE & GLFW_FALSE are introduced since libglfw-3.3, +// add definitions here to compile under the old versions. +#ifndef GLFW_TRUE +#define GLFW_TRUE 1 +#endif +#ifndef GLFW_FALSE +#define GLFW_FALSE 0 +#endif + +static_assert(FLUTTER_ENGINE_VERSION == 1, ""); + +static constexpr double kDpPerInch = 160.0; + +// Struct for storing state within an instance of the GLFW Window. +struct FlutterDesktopWindowState { + // The GLFW window that owns this state object. + GLFWwindow* window; + + // The handle to the Flutter engine instance. + FlutterEngine engine; + + // The plugin registrar handle given to API clients. + std::unique_ptr plugin_registrar; + + // Message dispatch manager for messages from the Flutter engine. + std::unique_ptr message_dispatcher; + + // The plugin registrar managing internal plugins. + std::unique_ptr internal_plugin_registrar; + + // Handlers for keyboard events from GLFW. + std::vector> + keyboard_hook_handlers; + + // Whether or not to track mouse movements to send kHover events. + bool hover_tracking_enabled = false; + + // Whether or not the pointer has been added (or if tracking is enabled, has + // been added since it was last removed). + bool pointer_currently_added = false; + + // The screen coordinates per inch on the primary monitor. Defaults to a sane + // value based on pixel_ratio 1.0. + double monitor_screen_coordinates_per_inch = kDpPerInch; + // The ratio of pixels per screen coordinate for the window. + double window_pixels_per_screen_coordinate = 1.0; +}; + +// Struct for storing state of a Flutter engine instance. +struct FlutterDesktopEngineState { + // The handle to the Flutter engine instance. + FlutterEngine engine; +}; + +// State associated with the plugin registrar. +struct FlutterDesktopPluginRegistrar { + // The plugin messenger handle given to API clients. + std::unique_ptr messenger; +}; + +// State associated with the messenger used to communicate with the engine. +struct FlutterDesktopMessenger { + // The Flutter engine this messenger sends outgoing messages to. + FlutterEngine engine; + + // The message dispatcher for handling incoming messages. + shell::IncomingMessageDispatcher* dispatcher; +}; + +static constexpr char kDefaultWindowTitle[] = "Flutter"; + +// Retrieves state bag for the window in question from the GLFWWindow. +static FlutterDesktopWindowState* GetSavedWindowState(GLFWwindow* window) { + return reinterpret_cast( + glfwGetWindowUserPointer(window)); +} + +// Converts a FlutterPlatformMessage to an equivalent FlutterDesktopMessage. +static FlutterDesktopMessage ConvertToDesktopMessage( + const FlutterPlatformMessage& engine_message) { + FlutterDesktopMessage message = {}; + message.struct_size = sizeof(message); + message.channel = engine_message.channel; + message.message = engine_message.message; + message.message_size = engine_message.message_size; + message.response_handle = engine_message.response_handle; + return message; +} + +// Returns the number of screen coordinates per inch for the main monitor. +// If the information is unavailable, returns a default value that assumes +// that a screen coordinate is one dp. +static double GetScreenCoordinatesPerInch() { + auto* primary_monitor = glfwGetPrimaryMonitor(); + auto* primary_monitor_mode = glfwGetVideoMode(primary_monitor); + int primary_monitor_width_mm; + glfwGetMonitorPhysicalSize(primary_monitor, &primary_monitor_width_mm, + nullptr); + if (primary_monitor_width_mm == 0) { + return kDpPerInch; + } + return primary_monitor_mode->width / (primary_monitor_width_mm / 25.4); +} + +// When GLFW calls back to the window with a framebuffer size change, notify +// FlutterEngine about the new window metrics. +// The Flutter pixel_ratio is defined as DPI/dp. +static void GLFWFramebufferSizeCallback(GLFWwindow* window, + int width_px, + int height_px) { + int width; + glfwGetWindowSize(window, &width, nullptr); + + auto state = GetSavedWindowState(window); + state->window_pixels_per_screen_coordinate = width_px / width; + + double dpi = state->window_pixels_per_screen_coordinate * + state->monitor_screen_coordinates_per_inch; + // Limit the ratio to 1 to avoid rendering a smaller UI in standard resolution + // monitors. + double pixel_ratio = std::max(dpi / kDpPerInch, 1.0); + + FlutterWindowMetricsEvent event = {}; + event.struct_size = sizeof(event); + event.width = width_px; + event.height = height_px; + event.pixel_ratio = pixel_ratio; + FlutterEngineSendWindowMetricsEvent(state->engine, &event); +} + +// Sends a pointer event to the Flutter engine with the given phase. +static void SendPointerEventWithPhase(GLFWwindow* window, + FlutterPointerPhase phase, + double x, + double y) { + auto state = GetSavedWindowState(window); + // If sending anything other than an add, and the pointer isn't already added, + // synthesize an add to satisfy Flutter's expectations about events. + if (!state->pointer_currently_added && phase != FlutterPointerPhase::kAdd) { + SendPointerEventWithPhase(window, FlutterPointerPhase::kAdd, x, y); + } + // Don't double-add (e.g., if events are delivered out of order, so an add has + // already been synthesized). + if (state->pointer_currently_added && phase == FlutterPointerPhase::kAdd) { + return; + } + + FlutterPointerEvent event = {}; + event.struct_size = sizeof(event); + event.phase = phase; + event.x = x * state->window_pixels_per_screen_coordinate; + event.y = y * state->window_pixels_per_screen_coordinate; + event.timestamp = + std::chrono::duration_cast( + std::chrono::high_resolution_clock::now().time_since_epoch()) + .count(); + FlutterEngineSendPointerEvent(state->engine, &event, 1); + + if (phase == FlutterPointerPhase::kAdd) { + state->pointer_currently_added = true; + } else if (phase == FlutterPointerPhase::kRemove) { + state->pointer_currently_added = false; + } +} + +// Reports the mouse entering or leaving the Flutter view. +static void GLFWCursorEnterCallback(GLFWwindow* window, int entered) { + double x, y; + glfwGetCursorPos(window, &x, &y); + FlutterPointerPhase phase = + entered ? FlutterPointerPhase::kAdd : FlutterPointerPhase::kRemove; + SendPointerEventWithPhase(window, phase, x, y); +} + +// Reports mouse movement to the Flutter engine. +static void GLFWCursorPositionCallback(GLFWwindow* window, double x, double y) { + bool button_down = + glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS; + FlutterPointerPhase phase = + button_down ? FlutterPointerPhase::kMove : FlutterPointerPhase::kHover; + SendPointerEventWithPhase(window, phase, x, y); +} + +// Reports mouse button press to the Flutter engine. +static void GLFWMouseButtonCallback(GLFWwindow* window, + int key, + int action, + int mods) { + // Flutter currently doesn't understand other buttons, so ignore anything + // other than left. + if (key != GLFW_MOUSE_BUTTON_LEFT) { + return; + } + + double x, y; + glfwGetCursorPos(window, &x, &y); + FlutterPointerPhase phase = (action == GLFW_PRESS) + ? FlutterPointerPhase::kDown + : FlutterPointerPhase::kUp; + SendPointerEventWithPhase(window, phase, x, y); + + // If mouse tracking isn't already enabled, turn it on for the duration of + // the drag to generate kMove events. + bool hover_enabled = GetSavedWindowState(window)->hover_tracking_enabled; + if (!hover_enabled) { + glfwSetCursorPosCallback( + window, (action == GLFW_PRESS) ? GLFWCursorPositionCallback : nullptr); + } + // Disable enter/exit events while the mouse button is down; GLFW will send + // an exit event when the mouse button is released, and the pointer should + // stay valid until then. + if (hover_enabled) { + glfwSetCursorEnterCallback( + window, (action == GLFW_PRESS) ? nullptr : GLFWCursorEnterCallback); + } +} + +// Passes character input events to registered handlers. +static void GLFWCharCallback(GLFWwindow* window, unsigned int code_point) { + for (const auto& handler : + GetSavedWindowState(window)->keyboard_hook_handlers) { + handler->CharHook(window, code_point); + } +} + +// Passes raw key events to registered handlers. +static void GLFWKeyCallback(GLFWwindow* window, + int key, + int scancode, + int action, + int mods) { + for (const auto& handler : + GetSavedWindowState(window)->keyboard_hook_handlers) { + handler->KeyboardHook(window, key, scancode, action, mods); + } +} + +// Enables/disables the callbacks related to mouse tracking. +static void SetHoverCallbacksEnabled(GLFWwindow* window, bool enabled) { + glfwSetCursorEnterCallback(window, + enabled ? GLFWCursorEnterCallback : nullptr); + glfwSetCursorPosCallback(window, + enabled ? GLFWCursorPositionCallback : nullptr); +} + +// Flushes event queue and then assigns default window callbacks. +static void GLFWAssignEventCallbacks(GLFWwindow* window) { + glfwPollEvents(); + glfwSetKeyCallback(window, GLFWKeyCallback); + glfwSetCharCallback(window, GLFWCharCallback); + glfwSetMouseButtonCallback(window, GLFWMouseButtonCallback); + if (GetSavedWindowState(window)->hover_tracking_enabled) { + SetHoverCallbacksEnabled(window, true); + } +} + +// Clears default window events. +static void GLFWClearEventCallbacks(GLFWwindow* window) { + glfwSetKeyCallback(window, nullptr); + glfwSetCharCallback(window, nullptr); + glfwSetMouseButtonCallback(window, nullptr); + SetHoverCallbacksEnabled(window, false); +} + +// The Flutter Engine calls out to this function when new platform messages are +// available +static void GLFWOnFlutterPlatformMessage( + const FlutterPlatformMessage* engine_message, + void* user_data) { + if (engine_message->struct_size != sizeof(FlutterPlatformMessage)) { + std::cerr << "Invalid message size received. Expected: " + << sizeof(FlutterPlatformMessage) << " but received " + << engine_message->struct_size << std::endl; + return; + } + + GLFWwindow* window = reinterpret_cast(user_data); + auto state = GetSavedWindowState(window); + + auto message = ConvertToDesktopMessage(*engine_message); + state->message_dispatcher->HandleMessage( + message, [window] { GLFWClearEventCallbacks(window); }, + [window] { GLFWAssignEventCallbacks(window); }); +} + +static bool GLFWMakeContextCurrent(void* user_data) { + GLFWwindow* window = reinterpret_cast(user_data); + glfwMakeContextCurrent(window); + return true; +} + +static bool GLFWClearContext(void* user_data) { + glfwMakeContextCurrent(nullptr); + return true; +} + +static bool GLFWPresent(void* user_data) { + GLFWwindow* window = reinterpret_cast(user_data); + glfwSwapBuffers(window); + return true; +} + +static uint32_t GLFWGetActiveFbo(void* user_data) { + return 0; +} + +// Clears the GLFW window to Material Blue-Grey. +// +// This function is primarily to fix an issue when the Flutter Engine is +// spinning up, wherein artifacts of existing windows are rendered onto the +// canvas for a few moments. +// +// This function isn't necessary, but makes starting the window much easier on +// the eyes. +static void GLFWClearCanvas(GLFWwindow* window) { + glfwMakeContextCurrent(window); + // This color is Material Blue Grey. + glClearColor(236.0f / 255.0f, 239.0f / 255.0f, 241.0f / 255.0f, 0.0f); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glFlush(); + glfwSwapBuffers(window); + glfwMakeContextCurrent(nullptr); +} + +// Resolves the address of the specified OpenGL or OpenGL ES +// core or extension function, if it is supported by the current context. +static void* GLFWProcResolver(void* user_data, const char* name) { + return reinterpret_cast(glfwGetProcAddress(name)); +} + +static void GLFWErrorCallback(int error_code, const char* description) { + std::cerr << "GLFW error " << error_code << ": " << description << std::endl; +} + +// Spins up an instance of the Flutter Engine. +// +// This function launches the Flutter Engine in a background thread, supplying +// the necessary callbacks for rendering within a GLFWwindow (if one is +// provided). +// +// Returns a caller-owned pointer to the engine. +static FlutterEngine RunFlutterEngine(GLFWwindow* window, + const char* assets_path, + const char* icu_data_path, + const char** arguments, + size_t arguments_count) { + // FlutterProjectArgs is expecting a full argv, so when processing it for + // flags the first item is treated as the executable and ignored. Add a dummy + // value so that all provided arguments are used. + std::vector argv = {"placeholder"}; + if (arguments_count > 0) { + argv.insert(argv.end(), &arguments[0], &arguments[arguments_count]); + } + + FlutterRendererConfig config = {}; + if (window == nullptr) { + config.type = kOpenGL; + config.open_gl.struct_size = sizeof(config.open_gl); + config.open_gl.make_current = [](void* data) -> bool { return false; }; + config.open_gl.clear_current = [](void* data) -> bool { return false; }; + config.open_gl.present = [](void* data) -> bool { return false; }; + config.open_gl.fbo_callback = [](void* data) -> uint32_t { return 0; }; + } else { + // Provide the necessary callbacks for rendering within a GLFWwindow. + config.type = kOpenGL; + config.open_gl.struct_size = sizeof(config.open_gl); + config.open_gl.make_current = GLFWMakeContextCurrent; + config.open_gl.clear_current = GLFWClearContext; + config.open_gl.present = GLFWPresent; + config.open_gl.fbo_callback = GLFWGetActiveFbo; + config.open_gl.gl_proc_resolver = GLFWProcResolver; + } + FlutterProjectArgs args = {}; + args.struct_size = sizeof(FlutterProjectArgs); + args.assets_path = assets_path; + args.icu_data_path = icu_data_path; + args.command_line_argc = static_cast(argv.size()); + args.command_line_argv = &argv[0]; + args.platform_message_callback = GLFWOnFlutterPlatformMessage; + FlutterEngine engine = nullptr; + auto result = + FlutterEngineRun(FLUTTER_ENGINE_VERSION, &config, &args, window, &engine); + if (result != kSuccess || engine == nullptr) { + std::cerr << "Failed to start Flutter engine: error " << result + << std::endl; + return nullptr; + } + return engine; +} + +bool FlutterDesktopInit() { + // Before making any GLFW calls, set up a logging error handler. + glfwSetErrorCallback(GLFWErrorCallback); + return glfwInit(); +} + +void FlutterDesktopTerminate() { + glfwTerminate(); +} + +FlutterDesktopWindowRef FlutterDesktopCreateWindow(int initial_width, + int initial_height, + const char* assets_path, + const char* icu_data_path, + const char** arguments, + size_t argument_count) { +#ifdef __linux__ + gtk_init(0, nullptr); +#endif + // Create the window. + auto window = glfwCreateWindow(initial_width, initial_height, + kDefaultWindowTitle, NULL, NULL); + if (window == nullptr) { + return nullptr; + } + GLFWClearCanvas(window); + + // Start the engine. + auto engine = RunFlutterEngine(window, assets_path, icu_data_path, arguments, + argument_count); + if (engine == nullptr) { + glfwDestroyWindow(window); + return nullptr; + } + + // Create a state object attached to the window. + FlutterDesktopWindowState* state = new FlutterDesktopWindowState(); + state->window = window; + glfwSetWindowUserPointer(window, state); + state->engine = engine; + + // TODO: Restructure the internals to follow the structure of the C++ API, so + // that this isn't a tangle of references. + auto messenger = std::make_unique(); + state->message_dispatcher = + std::make_unique(messenger.get()); + messenger->engine = engine; + messenger->dispatcher = state->message_dispatcher.get(); + + state->plugin_registrar = std::make_unique(); + state->plugin_registrar->messenger = std::move(messenger); + + state->internal_plugin_registrar = + std::make_unique(state->plugin_registrar.get()); + + // Set up the keyboard handlers. + auto internal_plugin_messenger = + state->internal_plugin_registrar->messenger(); + state->keyboard_hook_handlers.push_back( + std::make_unique(internal_plugin_messenger)); + state->keyboard_hook_handlers.push_back( + std::make_unique(internal_plugin_messenger)); + + // Trigger an initial size callback to send size information to Flutter. + state->monitor_screen_coordinates_per_inch = GetScreenCoordinatesPerInch(); + int width_px, height_px; + glfwGetFramebufferSize(window, &width_px, &height_px); + GLFWFramebufferSizeCallback(window, width_px, height_px); + + // Set up GLFW callbacks for the window. + glfwSetFramebufferSizeCallback(window, GLFWFramebufferSizeCallback); + GLFWAssignEventCallbacks(window); + + return state; +} + +void FlutterDesktopSetHoverEnabled(FlutterDesktopWindowRef flutter_window, + bool enabled) { + flutter_window->hover_tracking_enabled = enabled; + SetHoverCallbacksEnabled(flutter_window->window, enabled); +} + +void FlutterDesktopRunWindowLoop(FlutterDesktopWindowRef flutter_window) { + GLFWwindow* window = flutter_window->window; +#ifdef __linux__ + // Necessary for GTK thread safety. + XInitThreads(); +#endif + while (!glfwWindowShouldClose(window)) { + glfwPollEvents(); +#ifdef __linux__ + if (gtk_events_pending()) { + gtk_main_iteration(); + } +#endif + // TODO(awdavies): This will be deprecated soon. + __FlutterEngineFlushPendingTasksNow(); + } + FlutterEngineShutdown(flutter_window->engine); + delete flutter_window; + glfwDestroyWindow(window); +} + +FlutterDesktopEngineRef FlutterDesktopRunEngine(const char* assets_path, + const char* icu_data_path, + const char** arguments, + size_t argument_count) { + auto engine = RunFlutterEngine(nullptr, assets_path, icu_data_path, arguments, + argument_count); + if (engine == nullptr) { + return nullptr; + } + auto engine_state = new FlutterDesktopEngineState(); + engine_state->engine = engine; + return engine_state; +} + +bool FlutterDesktopShutDownEngine(FlutterDesktopEngineRef engine_ref) { + std::cout << "Shutting down flutter engine process." << std::endl; + auto result = FlutterEngineShutdown(engine_ref->engine); + delete engine_ref; + return (result == kSuccess); +} + +FlutterDesktopPluginRegistrarRef FlutterDesktopGetPluginRegistrar( + FlutterDesktopWindowRef flutter_window, + const char* plugin_name) { + // Currently, one registrar acts as the registrar for all plugins, so the + // name is ignored. It is part of the API to reduce churn in the future when + // aligning more closely with the Flutter registrar system. + return flutter_window->plugin_registrar.get(); +} + +void FlutterDesktopRegistrarEnableInputBlocking( + FlutterDesktopPluginRegistrarRef registrar, + const char* channel) { + registrar->messenger->dispatcher->EnableInputBlockingForChannel(channel); +} + +FlutterDesktopMessengerRef FlutterDesktopRegistrarGetMessenger( + FlutterDesktopPluginRegistrarRef registrar) { + return registrar->messenger.get(); +} + +void FlutterDesktopMessengerSend(FlutterDesktopMessengerRef messenger, + const char* channel, + const uint8_t* message, + const size_t message_size) { + FlutterPlatformMessage platform_message = { + sizeof(FlutterPlatformMessage), + channel, + message, + message_size, + }; + + FlutterEngineSendPlatformMessage(messenger->engine, &platform_message); +} + +void FlutterDesktopMessengerSendResponse( + FlutterDesktopMessengerRef messenger, + const FlutterDesktopMessageResponseHandle* handle, + const uint8_t* data, + size_t data_length) { + FlutterEngineSendPlatformMessageResponse(messenger->engine, handle, data, + data_length); +} + +void FlutterDesktopMessengerSetCallback(FlutterDesktopMessengerRef messenger, + const char* channel, + FlutterDesktopMessageCallback callback, + void* user_data) { + messenger->dispatcher->SetMessageCallback(channel, callback, user_data); +} diff --git a/shell/platform/glfw/key_event_handler.cc b/shell/platform/glfw/key_event_handler.cc new file mode 100644 index 0000000000000..7e370d0cdc76e --- /dev/null +++ b/shell/platform/glfw/key_event_handler.cc @@ -0,0 +1,60 @@ +// Copyright 2013 The Flutter 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/glfw/key_event_handler.h" + +#include + +#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/json_message_codec.h" + +static constexpr char kChannelName[] = "flutter/keyevent"; + +static constexpr char kKeyCodeKey[] = "keyCode"; +static constexpr char kKeyMapKey[] = "keymap"; +static constexpr char kTypeKey[] = "type"; + +static constexpr char kAndroidKeyMap[] = "android"; +static constexpr char kKeyUp[] = "keyup"; +static constexpr char kKeyDown[] = "keydown"; + +namespace shell { + +KeyEventHandler::KeyEventHandler(flutter::BinaryMessenger* messenger) + : channel_( + std::make_unique>( + messenger, + kChannelName, + &flutter::JsonMessageCodec::GetInstance())) {} + +KeyEventHandler::~KeyEventHandler() = default; + +void KeyEventHandler::CharHook(GLFWwindow* window, unsigned int code_point) {} + +void KeyEventHandler::KeyboardHook(GLFWwindow* window, + int key, + int scancode, + int action, + int mods) { + // TODO: Translate to a cross-platform key code system rather than passing + // the native key code. + rapidjson::Document event(rapidjson::kObjectType); + auto& allocator = event.GetAllocator(); + event.AddMember(kKeyCodeKey, key, allocator); + event.AddMember(kKeyMapKey, kAndroidKeyMap, allocator); + + switch (action) { + case GLFW_PRESS: + event.AddMember(kTypeKey, kKeyDown, allocator); + break; + case GLFW_RELEASE: + event.AddMember(kTypeKey, kKeyUp, allocator); + break; + default: + std::cerr << "Unknown key event action: " << action << std::endl; + return; + } + channel_->Send(event); +} + +} // namespace shell \ No newline at end of file diff --git a/shell/platform/glfw/key_event_handler.h b/shell/platform/glfw/key_event_handler.h new file mode 100644 index 0000000000000..171a17b6208cc --- /dev/null +++ b/shell/platform/glfw/key_event_handler.h @@ -0,0 +1,44 @@ +// Copyright 2013 The Flutter 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_GLFW_KEY_EVENT_HANDLER_H_ +#define FLUTTER_SHELL_PLATFORM_GLFW_KEY_EVENT_HANDLER_H_ + +#include + +#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/basic_message_channel.h" +#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/binary_messenger.h" +#include "flutter/shell/platform/glfw/keyboard_hook_handler.h" +#include "flutter/shell/platform/glfw/public/flutter_glfw.h" +#include "rapidjson/document.h" + +namespace shell { + +// Implements a KeyboardHookHandler +// +// Handles key events and forwards them to the Flutter engine. +class KeyEventHandler : public KeyboardHookHandler { + public: + explicit KeyEventHandler(flutter::BinaryMessenger* messenger); + + virtual ~KeyEventHandler(); + + // |shell::KeyboardHookHandler| + void KeyboardHook(GLFWwindow* window, + int key, + int scancode, + int action, + int mods) override; + + // |shell::KeyboardHookHandler| + void CharHook(GLFWwindow* window, unsigned int code_point) override; + + private: + // The Flutter system channel for key event messages. + std::unique_ptr> channel_; +}; + +} // namespace shell + +#endif // FLUTTER_SHELL_PLATFORM_GLFW_KEY_EVENT_HANDLER_H_ diff --git a/shell/platform/glfw/keyboard_hook_handler.h b/shell/platform/glfw/keyboard_hook_handler.h new file mode 100644 index 0000000000000..5415105161e14 --- /dev/null +++ b/shell/platform/glfw/keyboard_hook_handler.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 FLUTTER_SHELL_PLATFORM_GLFW_KEYBOARD_HOOK_HANDLER_H_ +#define FLUTTER_SHELL_PLATFORM_GLFW_KEYBOARD_HOOK_HANDLER_H_ + +#include + +#include "flutter/shell/platform/glfw/public/flutter_glfw.h" + +namespace shell { + +// Abstract class for handling keyboard input events. +class KeyboardHookHandler { + public: + virtual ~KeyboardHookHandler() = default; + + // A function for hooking into keyboard input. + virtual void KeyboardHook(GLFWwindow* window, + int key, + int scancode, + int action, + int mods) = 0; + + // A function for hooking into unicode code point input. + virtual void CharHook(GLFWwindow* window, unsigned int code_point) = 0; +}; + +} // namespace shell + +#endif // FLUTTER_SHELL_PLATFORM_GLFW_KEYBOARD_HOOK_HANDLER_H_ diff --git a/shell/platform/glfw/public/flutter_glfw.h b/shell/platform/glfw/public/flutter_glfw.h new file mode 100644 index 0000000000000..c969581e161df --- /dev/null +++ b/shell/platform/glfw/public/flutter_glfw.h @@ -0,0 +1,109 @@ +// Copyright 2013 The Flutter 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_GLFW_PUBLIC_FLUTTER_GLFW_H_ +#define FLUTTER_SHELL_PLATFORM_GLFW_PUBLIC_FLUTTER_GLFW_H_ + +#include +#include + +#include "flutter_export.h" +#include "flutter_messenger.h" +#include "flutter_plugin_registrar.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +// Opaque reference to a Flutter window. +typedef struct FlutterDesktopWindowState* FlutterDesktopWindowRef; + +// Opaque reference to a Flutter engine instance. +typedef struct FlutterDesktopEngineState* FlutterDesktopEngineRef; + +// Sets up the library's graphic context. Must be called before any other +// methods. +// +// Note: Internally, this library uses GLFW, which does not support multiple +// copies within the same process. Internally this calls glfwInit, which will +// fail if you have called glfwInit elsewhere in the process. +FLUTTER_EXPORT bool FlutterDesktopInit(); + +// Tears down library state. Must be called before the process terminates. +FLUTTER_EXPORT void FlutterDesktopTerminate(); + +// Creates a Window running a Flutter Application. +// +// FlutterDesktopInit() must be called prior to this function. +// +// The |assets_path| is the path to the flutter_assets folder for the Flutter +// application to be run. |icu_data_path| is the path to the icudtl.dat file +// for the version of Flutter you are using. +// +// The |arguments| are passed to the Flutter engine. See: +// https://github.com/flutter/engine/blob/master/shell/common/switches.h for +// for details. Not all arguments will apply to desktop. +// +// Returns a null pointer in the event of an error. Otherwise, the pointer is +// valid until FlutterDesktopRunWindowLoop has been called and returned. +// Note that calling FlutterDesktopCreateWindow without later calling +// FlutterDesktopRunWindowLoop on the returned reference is a memory leak. +FLUTTER_EXPORT FlutterDesktopWindowRef +FlutterDesktopCreateWindow(int initial_width, + int initial_height, + const char* assets_path, + const char* icu_data_path, + const char** arguments, + size_t argument_count); + +// Enables or disables hover tracking. +// +// If hover is enabled, mouse movement will send hover events to the Flutter +// engine, rather than only tracking the mouse while the button is pressed. +// Defaults to off. +FLUTTER_EXPORT void FlutterDesktopSetHoverEnabled( + FlutterDesktopWindowRef flutter_window, + bool enabled); + +// Loops on Flutter window events until the window is closed. +// +// Once this function returns, FlutterDesktopWindowRef is no longer valid, and +// must not be used again. +FLUTTER_EXPORT void FlutterDesktopRunWindowLoop( + FlutterDesktopWindowRef flutter_window); + +// Runs an instance of a headless Flutter engine. +// +// The |assets_path| is the path to the flutter_assets folder for the Flutter +// application to be run. |icu_data_path| is the path to the icudtl.dat file +// for the version of Flutter you are using. +// +// The |arguments| are passed to the Flutter engine. See: +// https://github.com/flutter/engine/blob/master/shell/common/switches.h for +// for details. Not all arguments will apply to desktop. +// +// Returns a null pointer in the event of an error. +FLUTTER_EXPORT FlutterDesktopEngineRef +FlutterDesktopRunEngine(const char* assets_path, + const char* icu_data_path, + const char** arguments, + size_t argument_count); + +// Shuts down the given engine instance. Returns true if the shutdown was +// successful. |engine_ref| is no longer valid after this call. +FLUTTER_EXPORT bool FlutterDesktopShutDownEngine( + FlutterDesktopEngineRef engine_ref); + +// Returns the plugin registrar handle for the plugin with the given name. +// +// The name must be unique across the application. +FLUTTER_EXPORT FlutterDesktopPluginRegistrarRef +FlutterDesktopGetPluginRegistrar(FlutterDesktopWindowRef flutter_window, + const char* plugin_name); + +#if defined(__cplusplus) +} // extern "C" +#endif + +#endif // FLUTTER_SHELL_PLATFORM_GLFW_PUBLIC_FLUTTER_GLFW_H_ diff --git a/shell/platform/glfw/text_input_plugin.cc b/shell/platform/glfw/text_input_plugin.cc new file mode 100644 index 0000000000000..76dbf8d118798 --- /dev/null +++ b/shell/platform/glfw/text_input_plugin.cc @@ -0,0 +1,210 @@ +// Copyright 2013 The Flutter 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/glfw/text_input_plugin.h" + +#include +#include + +#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/json_method_codec.h" + +static constexpr char kSetEditingStateMethod[] = "TextInput.setEditingState"; +static constexpr char kClearClientMethod[] = "TextInput.clearClient"; +static constexpr char kSetClientMethod[] = "TextInput.setClient"; +static constexpr char kShowMethod[] = "TextInput.show"; +static constexpr char kHideMethod[] = "TextInput.hide"; + +static constexpr char kMultilineInputType[] = "TextInputType.multiline"; + +static constexpr char kUpdateEditingStateMethod[] = + "TextInputClient.updateEditingState"; +static constexpr char kPerformActionMethod[] = "TextInputClient.performAction"; + +static constexpr char kSelectionBaseKey[] = "selectionBase"; +static constexpr char kSelectionExtentKey[] = "selectionExtent"; + +static constexpr char kTextKey[] = "text"; + +static constexpr char kChannelName[] = "flutter/textinput"; + +static constexpr char kBadArgumentError[] = "Bad Arguments"; +static constexpr char kInternalConsistencyError[] = + "Internal Consistency Error"; + +static constexpr uint32_t kInputModelLimit = 256; + +namespace shell { + +void TextInputPlugin::CharHook(GLFWwindow* window, unsigned int code_point) { + if (active_model_ == nullptr) { + return; + } + // TODO(awdavies): Actually handle potential unicode characters. Probably + // requires some ICU data or something. + active_model_->AddCharacter(static_cast(code_point)); + SendStateUpdate(*active_model_); +} + +void TextInputPlugin::KeyboardHook(GLFWwindow* window, + int key, + int scancode, + int action, + int mods) { + if (active_model_ == nullptr) { + return; + } + if (action == GLFW_PRESS || action == GLFW_REPEAT) { + switch (key) { + case GLFW_KEY_LEFT: + if (active_model_->MoveCursorBack()) { + SendStateUpdate(*active_model_); + } + break; + case GLFW_KEY_RIGHT: + if (active_model_->MoveCursorForward()) { + SendStateUpdate(*active_model_); + } + break; + case GLFW_KEY_END: + active_model_->MoveCursorToEnd(); + SendStateUpdate(*active_model_); + break; + case GLFW_KEY_HOME: + active_model_->MoveCursorToBeginning(); + SendStateUpdate(*active_model_); + break; + case GLFW_KEY_BACKSPACE: + if (active_model_->Backspace()) { + SendStateUpdate(*active_model_); + } + break; + case GLFW_KEY_DELETE: + if (active_model_->Delete()) { + SendStateUpdate(*active_model_); + } + break; + case GLFW_KEY_ENTER: + EnterPressed(active_model_); + default: + break; + } + } +} + +TextInputPlugin::TextInputPlugin(flutter::BinaryMessenger* messenger) + : channel_(std::make_unique>( + messenger, + kChannelName, + &flutter::JsonMethodCodec::GetInstance())), + active_model_(nullptr) { + channel_->SetMethodCallHandler( + [this]( + const flutter::MethodCall& call, + std::unique_ptr> result) { + HandleMethodCall(call, std::move(result)); + }); +} + +TextInputPlugin::~TextInputPlugin() = default; + +void TextInputPlugin::HandleMethodCall( + const flutter::MethodCall& method_call, + std::unique_ptr> result) { + const std::string& method = method_call.method_name(); + + if (method.compare(kShowMethod) == 0 || method.compare(kHideMethod) == 0) { + // These methods are no-ops. + } else if (method.compare(kClearClientMethod) == 0) { + active_model_ = nullptr; + } else { + // Every following method requires args. + if (!method_call.arguments() || method_call.arguments()->IsNull()) { + result->Error(kBadArgumentError, "Method invoked without args"); + return; + } + const rapidjson::Document& args = *method_call.arguments(); + + if (method.compare(kSetClientMethod) == 0) { + // TODO(awdavies): There's quite a wealth of arguments supplied with this + // method, and they should be inspected/used. + const rapidjson::Value& client_id_json = args[0]; + const rapidjson::Value& client_config = args[1]; + if (client_id_json.IsNull()) { + result->Error(kBadArgumentError, "Could not set client, ID is null."); + return; + } + if (client_config.IsNull()) { + result->Error(kBadArgumentError, + "Could not set client, missing arguments."); + } + int client_id = client_id_json.GetInt(); + if (input_models_.find(client_id) == input_models_.end()) { + // Skips out on adding a new input model once over the limit. + if (input_models_.size() > kInputModelLimit) { + result->Error( + kInternalConsistencyError, + "Input models over limit. Aborting creation of new text model."); + return; + } + input_models_.insert(std::make_pair( + client_id, + std::make_unique(client_id, client_config))); + } + active_model_ = input_models_[client_id].get(); + } else if (method.compare(kSetEditingStateMethod) == 0) { + if (active_model_ == nullptr) { + result->Error( + kInternalConsistencyError, + "Set editing state has been invoked, but no client is set."); + return; + } + auto text = args.FindMember(kTextKey); + if (text == args.MemberEnd() || text->value.IsNull()) { + result->Error(kBadArgumentError, + "Set editing state has been invoked, but without text."); + return; + } + auto selection_base = args.FindMember(kSelectionBaseKey); + auto selection_extent = args.FindMember(kSelectionExtentKey); + if (selection_base == args.MemberEnd() || + selection_base->value.IsNull() || + selection_extent == args.MemberEnd() || + selection_extent->value.IsNull()) { + result->Error(kInternalConsistencyError, + "Selection base/extent values invalid."); + return; + } + active_model_->SetEditingState(selection_base->value.GetInt(), + selection_extent->value.GetInt(), + text->value.GetString()); + } else { + // Unhandled method. + result->NotImplemented(); + return; + } + } + // All error conditions return early, so if nothing has gone wrong indicate + // success. + result->Success(); +} + +void TextInputPlugin::SendStateUpdate(const TextInputModel& model) { + channel_->InvokeMethod(kUpdateEditingStateMethod, model.GetState()); +} + +void TextInputPlugin::EnterPressed(TextInputModel* model) { + if (model->input_type() == kMultilineInputType) { + model->AddCharacter('\n'); + SendStateUpdate(*model); + } + auto args = std::make_unique(rapidjson::kArrayType); + auto& allocator = args->GetAllocator(); + args->PushBack(model->client_id(), allocator); + args->PushBack(rapidjson::Value(model->input_action(), allocator).Move(), + allocator); + + channel_->InvokeMethod(kPerformActionMethod, std::move(args)); +} + +} // namespace shell diff --git a/shell/platform/glfw/text_input_plugin.h b/shell/platform/glfw/text_input_plugin.h new file mode 100644 index 0000000000000..a6d8a4ed5686d --- /dev/null +++ b/shell/platform/glfw/text_input_plugin.h @@ -0,0 +1,62 @@ +// Copyright 2013 The Flutter 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_GLFW_TEXT_INPUT_PLUGIN_H_ +#define FLUTTER_SHELL_PLATFORM_GLFW_TEXT_INPUT_PLUGIN_H_ + +#include +#include + +#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/binary_messenger.h" +#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/method_channel.h" +#include "flutter/shell/platform/common/cpp/text_input_model.h" +#include "flutter/shell/platform/glfw/keyboard_hook_handler.h" +#include "flutter/shell/platform/glfw/public/flutter_glfw.h" + +namespace shell { + +// Implements a text input plugin. +// +// Specifically handles window events within GLFW. +class TextInputPlugin : public KeyboardHookHandler { + public: + explicit TextInputPlugin(flutter::BinaryMessenger* messenger); + + virtual ~TextInputPlugin(); + + // |shell::KeyboardHookHandler| + void KeyboardHook(GLFWwindow* window, + int key, + int scancode, + int action, + int mods) override; + + // |shell::KeyboardHookHandler| + void CharHook(GLFWwindow* window, unsigned int code_point) override; + + private: + // Sends the current state of the given model to the Flutter engine. + void SendStateUpdate(const TextInputModel& model); + + // Sends an action triggered by the Enter key to the Flutter engine. + void EnterPressed(TextInputModel* model); + + // Called when a method is called on |channel_|; + void HandleMethodCall( + const flutter::MethodCall& method_call, + std::unique_ptr> result); + + // The MethodChannel used for communication with the Flutter engine. + std::unique_ptr> channel_; + + // Mapping of client IDs to text input models. + std::map> input_models_; + + // The active model. nullptr if not set. + TextInputModel* active_model_; +}; + +} // namespace shell + +#endif // FLUTTER_SHELL_PLATFORM_GLFW_TEXT_INPUT_PLUGIN_H_ diff --git a/shell/platform/linux/BUILD.gn b/shell/platform/linux/BUILD.gn index 03724a9e7354c..3d2c125baa84f 100644 --- a/shell/platform/linux/BUILD.gn +++ b/shell/platform/linux/BUILD.gn @@ -2,10 +2,21 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +assert(is_linux) + group("linux") { - testonly = true + deps = [ + ":flutter_linux", + "$flutter_root/shell/platform/glfw:publish_headers_glfw", + "$flutter_root/shell/platform/common/cpp/client_wrapper:publish_wrapper", + "$flutter_root/shell/platform/glfw/client_wrapper:publish_wrapper_glfw", + ] +} +shared_library("flutter_linux") { deps = [ - "$flutter_root/shell/testing", + "$flutter_root/shell/platform/glfw:flutter_glfw", ] + + public_configs = [ "$flutter_root:config" ] } diff --git a/shell/platform/linux/config/BUILD.gn b/shell/platform/linux/config/BUILD.gn new file mode 100644 index 0000000000000..81043013717b1 --- /dev/null +++ b/shell/platform/linux/config/BUILD.gn @@ -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. + +import("//build/config/linux/pkg_config.gni") + +pkg_config("epoxy") { + packages = [ "epoxy" ] +} + +pkg_config("glfw3") { + packages = [ "glfw3" ] +} + +pkg_config("gtk3") { + packages = [ "gtk+-3.0" ] +} + +pkg_config("x11") { + packages = [ "x11" ] +} From 188adf7e5ec521f7859d5a0a1609fdcb688436b2 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 20 Mar 2019 14:18:34 -0700 Subject: [PATCH 0513/1117] Removed Activity reference from AccessibilityBridge by using a View for insets instead of the Activity (#18115) (#8231) --- .../io/flutter/view/AccessibilityBridge.java | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index 7a94b3303595c..d98b6f0bf01af 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -7,6 +7,7 @@ import android.annotation.TargetApi; import android.app.Activity; import android.content.ContentResolver; +import android.content.Context; import android.database.ContentObserver; import android.graphics.Rect; import android.net.Uri; @@ -21,6 +22,8 @@ import android.util.Log; import android.view.MotionEvent; import android.view.View; +import android.view.WindowInsets; +import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeInfo; @@ -100,19 +103,6 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { @NonNull private final ContentResolver contentResolver; - // The top-level Android View within the containing Window. - // TODO(mattcarroll): Move communication with the decorView out to FlutterView, or even FlutterActivity. - // The reason this is here is because when the device is in reverse-landscape - // orientation, Android has a bug where it assumes the OS nav bar is on the - // right side of the screen, not the left. As a result, accessibility borders - // are drawn too far to the left. The AccessibilityBridge directly adjusts - // for this Android bug. We still need to adjust, but this is the wrong place - // to access a decorView. What if the FlutterView is only part of the UI - // hierarchy, like a list item? We shouldn't touch the decor view. - // https://github.com/flutter/flutter/issues/19967 - @NonNull - private final View decorView; - // The entire Flutter semantics tree of the running Flutter app, stored as a Map // from each SemanticsNode's ID to a Java representation of a Flutter SemanticsNode. // @@ -191,7 +181,9 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { // TODO(mattcarroll): why do we need previouseRouteId if we have flutterNavigationStack private int previousRouteId = ROOT_NODE_ID; - // TODO(mattcarroll): is this for the decor view adjustment? + // Tracks the left system inset of the screen because Flutter needs to manually adjust + // accessibility positioning when in reverse-landscape. This is an Android bug that Flutter + // is solving for itself. @NonNull private Integer lastLeftFrameInset = 0; @@ -323,8 +315,6 @@ public AccessibilityBridge( this.contentResolver = contentResolver; this.platformViewsAccessibilityDelegate = platformViewsAccessibilityDelegate; - decorView = ((Activity) rootAccessibilityView.getContext()).getWindow().getDecorView(); - // Tell Flutter whether accessibility is initially active or not. Then register a listener // to be notified of changes in the future. accessibilityStateChangeListener.onAccessibilityStateChanged(accessibilityManager.isEnabled()); @@ -1177,14 +1167,15 @@ void updateSemantics(@NonNull ByteBuffer buffer, @NonNull String[] strings) { // of the screen in landscape mode. We must handle the translation ourselves for the // a11y nodes. if (Build.VERSION.SDK_INT >= 23) { - Rect visibleFrame = new Rect(); - decorView.getWindowVisibleDisplayFrame(visibleFrame); - if (!lastLeftFrameInset.equals(visibleFrame.left)) { + WindowInsets insets = rootAccessibilityView.getRootWindowInsets(); + if (insets != null) { + if (!lastLeftFrameInset.equals(insets.getSystemWindowInsetLeft())) { rootObject.globalGeometryDirty = true; rootObject.inverseTransformDirty = true; + } + lastLeftFrameInset = insets.getSystemWindowInsetLeft(); + Matrix.translateM(identity, 0, lastLeftFrameInset, 0, 0); } - lastLeftFrameInset = visibleFrame.left; - Matrix.translateM(identity, 0, visibleFrame.left, 0, 0); } rootObject.updateRecursively(identity, visitedObjects, false); rootObject.collectRoutes(newRoutes); From 10e1addd8d71a8778c7a048ea86cd441b6d45e76 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 20 Mar 2019 18:50:12 -0400 Subject: [PATCH 0514/1117] Roll src/third_party/skia 7e2c0614a2fd..4652930a7dfc (5 commits) (#8232) https://skia.googlesource.com/skia.git/%2Blog/7e2c0614a2fd..4652930a7dfc git log 7e2c0614a2fd08e418b789939dfdad9b76e70fa7..4652930a7dfc23d368d96b2ff46305a94172511c --date=short --no-merges --format=%ad %ae %s 2019-03-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 00ba176c0c40..c296806411fb (2 commits) 2019-03-20 mtklein@google.com remove some more SK- in DrawCommand 2019-03-20 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src ca0130108117..b57a03014063 (635 commits) 2019-03-20 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-20 egdaniel@google.com Reduce use of map buffers on ARM vulkan. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 8cb76a7291be3..942d9732157cb 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': '7e2c0614a2fd08e418b789939dfdad9b76e70fa7', + 'skia_revision': '4652930a7dfc23d368d96b2ff46305a94172511c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index f045a7abd0fcd..e97ba67290ca4 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 69cdeba5983041274e6ecad0313aaa0a +Signature: 5f42cdf6490f96a34eedd3043ec9c0eb UNUSED LICENSES: From fa435385b6b9f80080997dd38ad66bbe4bb0a152 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 20 Mar 2019 17:43:53 -0700 Subject: [PATCH 0515/1117] Use the GPU thread for Android surface on-screen context lifecycle operations (#8234) Fixes https://github.com/flutter/flutter/issues/29679 --- .../platform/android/platform_view_android.cc | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/shell/platform/android/platform_view_android.cc b/shell/platform/android/platform_view_android.cc index f31c084565e0a..4817133054071 100644 --- a/shell/platform/android/platform_view_android.cc +++ b/shell/platform/android/platform_view_android.cc @@ -45,15 +45,33 @@ void PlatformViewAndroid::NotifyCreated( fml::RefPtr native_window) { if (android_surface_) { InstallFirstFrameCallback(); - android_surface_->SetNativeWindow(native_window); + + fml::AutoResetWaitableEvent latch; + fml::TaskRunner::RunNowOrPostTask( + task_runners_.GetGPUTaskRunner(), + [&latch, surface = android_surface_.get(), + native_window = std::move(native_window)]() { + surface->SetNativeWindow(native_window); + latch.Signal(); + }); + latch.Wait(); } + PlatformView::NotifyCreated(); } void PlatformViewAndroid::NotifyDestroyed() { PlatformView::NotifyDestroyed(); + if (android_surface_) { - android_surface_->TeardownOnScreenContext(); + fml::AutoResetWaitableEvent latch; + fml::TaskRunner::RunNowOrPostTask( + task_runners_.GetGPUTaskRunner(), + [&latch, surface = android_surface_.get()]() { + surface->TeardownOnScreenContext(); + latch.Signal(); + }); + latch.Wait(); } } From 250b99bd275ad7622f239a8042f6a6d31b5b95f1 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 20 Mar 2019 22:22:11 -0400 Subject: [PATCH 0516/1117] Roll src/third_party/skia 4652930a7dfc..e409441aee0d (1 commits) (#8236) https://skia.googlesource.com/skia.git/%2Blog/4652930a7dfc..e409441aee0d git log 4652930a7dfc23d368d96b2ff46305a94172511c..e409441aee0d52e03046e62d00d139bda8eeba22 --date=short --no-merges --format=%ad %ae %s 2019-03-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader c296806411fb..aff2dd067015 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 942d9732157cb..a902f70803c91 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': '4652930a7dfc23d368d96b2ff46305a94172511c', + 'skia_revision': 'e409441aee0d52e03046e62d00d139bda8eeba22', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index e97ba67290ca4..b64a185499305 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 5f42cdf6490f96a34eedd3043ec9c0eb +Signature: 14500d28d88b48cabb202f50f14dfc34 UNUSED LICENSES: From b05399901040bfc8edbdb06a39603b3ee158ae51 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 21 Mar 2019 01:51:11 -0400 Subject: [PATCH 0517/1117] Roll src/third_party/skia e409441aee0d..2c4ceca62d27 (1 commits) (#8238) https://skia.googlesource.com/skia.git/%2Blog/e409441aee0d..2c4ceca62d27 git log e409441aee0d52e03046e62d00d139bda8eeba22..2c4ceca62d27ebd3617d91b94a0231030927f864 --date=short --no-merges --format=%ad %ae %s 2019-03-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 a532570a09b8..f455f7565a7a (4 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index a902f70803c91..aff85c9b303d5 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': 'e409441aee0d52e03046e62d00d139bda8eeba22', + 'skia_revision': '2c4ceca62d27ebd3617d91b94a0231030927f864', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b64a185499305..0ced667c2ebe6 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 14500d28d88b48cabb202f50f14dfc34 +Signature: cf58986b48977bd842b1a0b26bc9186f UNUSED LICENSES: From 2d5376c0960a62d6fc7caf3b760d13017294c71c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 21 Mar 2019 05:20:12 -0400 Subject: [PATCH 0518/1117] Roll src/third_party/skia 2c4ceca62d27..174a3f61fd5d (1 commits) (#8239) https://skia.googlesource.com/skia.git/%2Blog/2c4ceca62d27..174a3f61fd5d git log 2c4ceca62d27ebd3617d91b94a0231030927f864..174a3f61fd5dd38d4ea8943f68ca6d9267252d68 --date=short --no-merges --format=%ad %ae %s 2019-03-21 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index aff85c9b303d5..a98e695efa05f 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': '2c4ceca62d27ebd3617d91b94a0231030927f864', + 'skia_revision': '174a3f61fd5dd38d4ea8943f68ca6d9267252d68', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 0ced667c2ebe6..d47b7ffb2cd00 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: cf58986b48977bd842b1a0b26bc9186f +Signature: af70bc51420cbbc085215a07c1da3b3c UNUSED LICENSES: From d4d4883216fd1c1dfc17d41418a960c002cfff57 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 21 Mar 2019 08:55:11 -0400 Subject: [PATCH 0519/1117] Roll src/third_party/skia 174a3f61fd5d..a695da930510 (2 commits) (#8242) https://skia.googlesource.com/skia.git/%2Blog/174a3f61fd5d..a695da930510 git log 174a3f61fd5dd38d4ea8943f68ca6d9267252d68..a695da930510831e7d1a7be3ddf98b9f8183b91c --date=short --no-merges --format=%ad %ae %s 2019-03-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 f455f7565a7a..232bfeae6b29 (4 commits) 2019-03-20 benjaminwagner@google.com Add more detail on configuring jobs. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index a98e695efa05f..d945d2d57a89b 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': '174a3f61fd5dd38d4ea8943f68ca6d9267252d68', + 'skia_revision': 'a695da930510831e7d1a7be3ddf98b9f8183b91c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index d47b7ffb2cd00..33ba30d57457c 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: af70bc51420cbbc085215a07c1da3b3c +Signature: 15e7148cf19140d66c66263e01e1c1d3 UNUSED LICENSES: From 13e3b7101fdffe27ab931fbe7bcbedb2a93267d4 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 21 Mar 2019 12:23:47 -0400 Subject: [PATCH 0520/1117] Roll src/third_party/skia a695da930510..d6ab77a2e20f (11 commits) (#8243) https://skia.googlesource.com/skia.git/%2Blog/a695da930510..d6ab77a2e20f git log a695da930510831e7d1a7be3ddf98b9f8183b91c..d6ab77a2e20ff54644ffc247da4dd2ea755c1111 --date=short --no-merges --format=%ad %ae %s 2019-03-21 mtklein@google.com restore .clang-format 2019-03-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 9041bb7c0011..7bc4f45a391f (2 commits) 2019-03-21 ethannicholas@google.com Initial checkin of new SkSL interpreter. 2019-03-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 290908500aed..9041bb7c0011 (1 commits) 2019-03-21 rmistry@google.com Remove auto adding CQ keywords for non-master branches 2019-03-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader aff2dd067015..290908500aed (2 commits) 2019-03-20 bsalomon@google.com Avoid making new image snapshot in GPU->GPU SkSurface::draw() 2019-03-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms 10ed3a8a5eec..99740cdf2835 (1 commits) 2019-03-21 robertphillips@google.com Add support for Y410 (i.e., 1010102) to wacky_yuv_formats 2019-03-21 kjlubick@google.com Add GN args for GL/GLES interface 2019-02-20 tushar.khandelwal@arm.com Store LZW dictionary suffixes in larger chunks The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d945d2d57a89b..8b65732be244b 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': 'a695da930510831e7d1a7be3ddf98b9f8183b91c', + 'skia_revision': 'd6ab77a2e20ff54644ffc247da4dd2ea755c1111', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 33ba30d57457c..8e06779f78366 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 15e7148cf19140d66c66263e01e1c1d3 +Signature: 8b213e55333c31d2af13e99dbb28de7f UNUSED LICENSES: @@ -5877,6 +5877,9 @@ FILE: ../../../third_party/skia/src/core/SkColorFilterPriv.h FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleHelpers.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleInterface_gl.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleInterface_gles.cpp +FILE: ../../../third_party/skia/src/sksl/SkSLByteCode.h +FILE: ../../../third_party/skia/src/sksl/SkSLByteCodeGenerator.cpp +FILE: ../../../third_party/skia/src/sksl/SkSLByteCodeGenerator.h ---------------------------------------------------------------------------------------------------- Copyright 2019 Google LLC From 1addfb5967dc4fc5ed7609f8bf7cea533d940691 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 21 Mar 2019 13:00:28 -0700 Subject: [PATCH 0521/1117] Roll src/third_party/dart 5e9df35a57..cabaa78cc5 (36 commits) (#8244) cabaa78cc5 [VM] Generalize generic bounds check elimination 16eefa4b75 [VM] Infer ranges for truncating divisions with positive divisor & Fix missing deopt env bug 46e0a87008 Add summary support for "for each" elements with declarations. 915b35e463 Add summary support for "for each" elements with identifiers. 3019a8873a Check for completeness of test_all in analysis server and analyzer plugin 9b5a956a0e Remove AstTestFactory.forStatement2 a7ab99dd84 [vm/kernel] Index all source and line starts before using them 1f10174891 [vm/service] Test collecting coverage for a concatenated dill file 0cacd6c28d [CFE] Compile if map entries in map literals 7dd4259d87 Handle ir constants in inferrer 8915407f2c Support computation of NativeData directly from IrAnnotationData eb344e2072 Keep live libraries and uri to source in sync 2805a376b2 Added tests for superinterface variance constraints 34af8b95e5 Revert "[vm] Free readonly header bit so it can be used for other uses." 59931e3340 [vm] Free readonly header bit so it can be used for other uses. cb4b6157a2 fix #36205, static calls in dart:html should directly call the DOM e3d6fc974f [dart/vm] fix off-by-a-lot error in DAG test ecb1bff326 Add summary support for `for` elements with declarations. 7d277c4a32 Introduce methods and classes to replace "2" variants left over from "UI as code" work. 973a4d0b2e [vm] Drop 'testonly = true' from gen_kernel_bytecode_dill GN rule c79927fdd7 Change type of `Expression.precedence` to the Precedence class. b10ac42527 [VM] Parentenvironment for Macos and Android 9f00d1b384 [VM] Ensure Top level class is finalized for loadedscripts in library 24e5f9142a Revise ElementResolver postfix NNBD bang processing 2919b5577f [Analyzer] move usage of mostSpecificTypeArgument in resolver d9371f206d Integration test for AstBinaryWriter and AstBinaryReader. 137171af71 [VM runtime] Disable dual mapping code in AOT runtime (fixes #36260). d14dfc5d8a [vm] Support FFI on ARM64 and Android. b032f1b284 [vm] Support FFI on 32-bit Intel. b78e386bbb Remove ConstantUseKind enum e2c577333c [testing] Mark an uncatchable flaky test as Skip. a2d7227a76 [vm] Never give DBC instructions executable permissions. 6135a81d51 Separate type reference resolution and types building. 8556e97218 Remove ResultProvider and its implementations. 495c319574 Reland "Add hints to check the SDK constraints for both set literals and for the ui-as-code features" 416649250f Rework tracking of variables in scope while summarizing expressions. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 8b65732be244b..d6f84c112eab9 100644 --- a/DEPS +++ b/DEPS @@ -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': '5e9df35a5794413202fbcaf0c41f6d4c5d2e7b81', + 'dart_revision': 'cabaa78cc57d08bcfcd75bfe99a42c19ed497d26', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 6e749b255b82f..42785b9c948c3 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: d8611addc54dd5fe85355e2e888206d4 +Signature: 0f3631374103b2f9512fd6180a904a7e UNUSED LICENSES: @@ -5167,8 +5167,9 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm64.cc FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_dbc.cc FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_ia32.cc FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_x64.cc +FILE: ../../../third_party/dart/runtime/vm/constants_arm64.cc +FILE: ../../../third_party/dart/runtime/vm/constants_ia32.cc FILE: ../../../third_party/dart/runtime/vm/constants_x64.cc -FILE: ../../../third_party/dart/runtime/vm/ffi_trampoline_stubs_x64.cc FILE: ../../../third_party/dart/runtime/vm/frame_layout.h FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist.h FILE: ../../../third_party/dart/runtime/vm/intrusive_dlist_test.cc From 28433c513ce8f9d458276cb729f3efd198e54470 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 21 Mar 2019 13:45:13 -0700 Subject: [PATCH 0522/1117] FlutterJNI no longer asserts it is attached when dispatching platform messages and instead fizzles with a warning if not attached. Not sure what root cause of issue is, but this is necessary to avoid crashes. (#8246) --- .../flutter/embedding/engine/FlutterJNI.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java index 925e2a8d7290f..66e98087c4e5c 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java @@ -461,8 +461,11 @@ private native void nativeRunBundleAndSnapshotFromLibrary( @UiThread public void dispatchEmptyPlatformMessage(String channel, int responseId) { - ensureAttachedToNative(); - nativeDispatchEmptyPlatformMessage(nativePlatformViewId, channel, responseId); + if (isAttached()) { + nativeDispatchEmptyPlatformMessage(nativePlatformViewId, channel, responseId); + } else { + Log.w(TAG, "Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: " + channel + ". Response ID: " + responseId); + } } // Send an empty platform message to Dart. @@ -474,14 +477,17 @@ private native void nativeDispatchEmptyPlatformMessage( @UiThread public void dispatchPlatformMessage(String channel, ByteBuffer message, int position, int responseId) { - ensureAttachedToNative(); - nativeDispatchPlatformMessage( - nativePlatformViewId, - channel, - message, - position, - responseId - ); + if (isAttached()) { + nativeDispatchPlatformMessage( + nativePlatformViewId, + channel, + message, + position, + responseId + ); + } else { + Log.w(TAG, "Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: " + channel + ". Response ID: " + responseId); + } } // Send a data-carrying platform message to Dart. From 06635d38a9f7b4a51cfef7ca0abf12ece977ee1c Mon Sep 17 00:00:00 2001 From: Amir Hardon Date: Thu, 21 Mar 2019 15:26:44 -0700 Subject: [PATCH 0523/1117] Mirror Android platform views a11y tree in the Flutter a11y tree. (#8237) This PR mirrors virtual a11y tree of embedded platform views in the Flutter a11y tree. Non virtual hierarchies are not currently supported. Only works on Android versions earlier than Android P as it relies on reflection access to hidden system APIs which cannot be done starting Android P. A11y is not yet working as we also need to delegate a11y events from the platform view to the FlutterView. This will be done in a following PR to keep the change size a little saner. --- ci/licenses_golden/licenses_flutter | 1 + shell/platform/android/BUILD.gn | 1 + .../PlatformViewsAccessibilityDelegate.java | 9 +- .../platform/PlatformViewsController.java | 4 +- .../io/flutter/view/AccessibilityBridge.java | 26 ++ .../view/AccessibilityViewEmbedder.java | 327 ++++++++++++++++++ 6 files changed, 363 insertions(+), 5 deletions(-) create mode 100644 shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 3867e7226454f..567ad251512b3 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -524,6 +524,7 @@ 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/util/Predicate.java FILE: ../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java +FILE: ../../../flutter/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.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 diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index e26d71a30e38e..4244e7946bb85 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -166,6 +166,7 @@ java_library("flutter_shell_java") { "io/flutter/util/Preconditions.java", "io/flutter/util/Predicate.java", "io/flutter/view/AccessibilityBridge.java", + "io/flutter/view/AccessibilityViewEmbedder.java", "io/flutter/view/FlutterCallbackInformation.java", "io/flutter/view/FlutterMain.java", "io/flutter/view/FlutterNativeView.java", diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java index a48a7d59ff65d..3b81a505552ce 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsAccessibilityDelegate.java @@ -4,14 +4,19 @@ package io.flutter.plugin.platform; +import android.view.View; import io.flutter.view.AccessibilityBridge; /** * Facilitates interaction between the accessibility bridge and embedded platform views. */ public interface PlatformViewsAccessibilityDelegate { - // TODO(amirh): add a View getViewById(int id) here. - // not filing a tracking issue as this is going to be done in the next PR. + + /** + * Returns the root of the view hierarchy for the platform view with the requested id, or null if there is no + * corresponding view. + */ + View getPlatformViewById(Integer id); /** * Attaches an accessibility bridge for this platform views accessibility delegate. diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java index 55a5d10f4732b..f19fabd317e44 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java @@ -120,9 +120,7 @@ public void onPreEngineRestart() { flushAllViews(); } - /** - * Returns the embedded view with id, or null if no view with this id is registered. - */ + @Override public View getPlatformViewById(Integer id) { VirtualDisplayController controller = vdControllers.get(id); if (controller == null) { diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index d98b6f0bf01af..7a798d3b37bd5 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -75,6 +75,16 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { private static final float SCROLL_POSITION_CAP_FOR_INFINITY = 70000.0f; private static final int ROOT_NODE_ID = 0; + // The minimal ID for an engine generated AccessibilityNodeInfo. + // + // The AccessibilityNodeInfo node IDs are generated by the framework for most Flutter semantic nodes. + // When embedding platform views, the framework does not have the accessibility information for the embedded view; + // in this case the engine generates AccessibilityNodeInfo that mirrors the a11y information exposed by the platform + // view. To avoid the need of synchronizing the framework and engine mechanisms for generating the next ID, we split + // the 32bit range of virtual node IDs into 2. The least significant 16 bits are used for framework generated IDs + // and the most significant 16 bits are used for engine generated IDs. + private static final int MIN_ENGINE_GENERATED_NODE_ID = 1<<16; + /// Value is derived from ACTION_TYPE_MASK in AccessibilityNodeInfo.java private static int FIRST_RESOURCE_ID = 267386881; @@ -92,6 +102,9 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { @NonNull private final AccessibilityManager accessibilityManager; + @NonNull + private final AccessibilityViewEmbedder accessibilityViewEmbedder; + // The delegate for interacting with embedded platform views. Used to embed accessibility data for an embedded // view in the accessibility tree. @NonNull @@ -363,6 +376,7 @@ public void onTouchExplorationStateChanged(boolean isTouchExplorationEnabled) { if (platformViewsAccessibilityDelegate != null) { platformViewsAccessibilityDelegate.attachAccessibilityBridge(this); } + accessibilityViewEmbedder = new AccessibilityViewEmbedder(rootAccessibilityView, MIN_ENGINE_GENERATED_NODE_ID); } /** @@ -456,6 +470,11 @@ private boolean shouldSetCollectionInfo(final SemanticsNode semanticsNode) { @Override @SuppressWarnings("deprecation") public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { + if (virtualViewId >= MIN_ENGINE_GENERATED_NODE_ID) { + // The node is in the engine generated range, and is provided by the accessibility view embedder. + return accessibilityViewEmbedder.createAccessibilityNodeInfo(virtualViewId); + } + if (virtualViewId == View.NO_ID) { AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(rootAccessibilityView); rootAccessibilityView.onInitializeAccessibilityNodeInfo(result); @@ -472,6 +491,13 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { return null; } + if (semanticsNode.platformViewId != -1) { + // For platform views we delegate the node creation to the accessibility view embedder. + View embeddedView = platformViewsAccessibilityDelegate.getPlatformViewById(semanticsNode.platformViewId); + Rect bounds = semanticsNode.getGlobalRect(); + return accessibilityViewEmbedder.getRootNode(embeddedView, semanticsNode.id, bounds); + } + AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(rootAccessibilityView, virtualViewId); // Work around for https://github.com/flutter/flutter/issues/2101 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { diff --git a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java new file mode 100644 index 0000000000000..1e5da786321bf --- /dev/null +++ b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java @@ -0,0 +1,327 @@ +// Copyright 2013 The Flutter 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.graphics.Rect; +import android.os.Build; +import android.util.Log; +import android.util.SparseArray; +import android.view.View; +import android.view.accessibility.AccessibilityNodeInfo; +import android.view.accessibility.AccessibilityNodeProvider; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; + +/** + * Facilitates embedding of platform views in the accessibility tree generated by the accessibility bridge. + * + * Embedding is done by mirroring the accessibility tree of the platform view as a subtree of the flutter + * accessibility tree. + * + * This class relies on hidden system APIs to extract the accessibility information and does not work starting + * Android P; If the reflection accessors are not available we fail silently by embedding a null node, the app + * continues working but the accessibility information for the platform view will not be embedded. + * + * We use the term `flutterId` for virtual accessibility node IDs in the FlutterView tree, and the term `originId` + * for the virtual accessibility node IDs in the platform view's tree. Internally this class maintains a bidirectional + * mapping between `flutterId`s and the corresponding platform view and `originId`. + */ +class AccessibilityViewEmbedder { + private static final String TAG = "AccessibilityBridge"; + + private final ReflectionAccessors reflectionAccessors; + + // The view to which the platform view is embedded, this is typically FlutterView. + private final View rootAccessibilityView; + + // Maps a flutterId to the corresponding platform view and originId. + private final SparseArray flutterIdToOrigin; + + // Maps a platform view and originId to a corresponding flutterID. + private final Map originToFlutterId; + + // Maps the flutterId of an accessibility node to the screen bounds of + // the root semantic node for the embedded view. + // This is used to translate the coordinates of the accessibility node subtree to the main display's coordinate + // system. + private final SparseArray flutterIdToDisplayBounds; + + private int nextFlutterId; + + AccessibilityViewEmbedder(View rootAccessibiiltyView, int firstVirtualNodeId) { + reflectionAccessors = new ReflectionAccessors(); + flutterIdToOrigin = new SparseArray<>(); + this.rootAccessibilityView = rootAccessibiiltyView; + nextFlutterId = firstVirtualNodeId; + flutterIdToDisplayBounds = new SparseArray<>(); + originToFlutterId = new HashMap<>(); + } + + /** + * Returns the root accessibility node for an embedded platform view. + * + * @param flutterId the virtual accessibility ID for the node in flutter accessibility tree + * @param displayBounds the display bounds for the node in screen coordinates + */ + public AccessibilityNodeInfo getRootNode(View embeddedView, int flutterId, Rect displayBounds) { + return null; + // TODO(amirh): uncomment this once a11y events and actions are wired. + // AccessibilityNodeInfo originNode = embeddedView.createAccessibilityNodeInfo(); + // Long originPackedId = reflectionAccessors.getSourceNodeId(originNode); + // if (originPackedId == null) { + // return null; + // } + // int originId = ReflectionAccessors.getVirtualNodeId(originPackedId); + // flutterIdToOrigin.put(flutterId, new ViewAndId(embeddedView, originId)); + // flutterIdToDisplayBounds.put(flutterId, displayBounds); + // originToFlutterId.put(new ViewAndId(embeddedView, originId), flutterId); + // return convertToFlutterNode(originNode, flutterId, embeddedView); + } + + /** + * Creates the accessibility node info for the node identified with `flutterId`. + */ + public AccessibilityNodeInfo createAccessibilityNodeInfo(int flutterId) { + ViewAndId origin = flutterIdToOrigin.get(flutterId); + if (origin == null) { + return null; + } + AccessibilityNodeProvider provider = origin.view.getAccessibilityNodeProvider(); + if (provider == null) { + // The provider is null for views that don't have a virtual accessibility tree. + // We currently only support embedding virtual hierarchies in the Flutter tree. + // TODO(amirh): support embedding non virtual hierarchies. + // https://github.com/flutter/flutter/issues/29717 + return null; + } + AccessibilityNodeInfo originNode = + origin.view.getAccessibilityNodeProvider().createAccessibilityNodeInfo(origin.id); + return convertToFlutterNode(originNode, flutterId, origin.view); + } + + /* + * Creates an AccessibilityNodeInfo that can be attached to the Flutter accessibility tree and is equivalent to + * originNode(which belongs to embeddedView). The virtual ID for the created node will be flutterId. + */ + private AccessibilityNodeInfo convertToFlutterNode(AccessibilityNodeInfo originNode, int flutterId, View embeddedView) { + AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(rootAccessibilityView, flutterId); + result.setPackageName(rootAccessibilityView.getContext().getPackageName()); + result.setSource(rootAccessibilityView, flutterId); + result.setClassName(originNode.getClassName()); + + Rect displayBounds = flutterIdToDisplayBounds.get(flutterId); + + copyAccessibilityFields(originNode, result); + setFlutterNodesTranslateBounds(originNode, displayBounds, result); + addChildrenToFlutterNode(originNode, embeddedView, displayBounds, result); + setFlutterNodeParent(originNode, embeddedView, result); + + return result; + } + + private void setFlutterNodeParent(AccessibilityNodeInfo originNode, View embeddedView, AccessibilityNodeInfo result) { + Long parentOriginPackedId = reflectionAccessors.getParentNodeId(originNode); + if (parentOriginPackedId == null) { + return; + } + int parentOriginId = ReflectionAccessors.getVirtualNodeId(parentOriginPackedId); + Integer parentFlutterId = originToFlutterId.get(new ViewAndId(embeddedView, parentOriginId)); + if (parentFlutterId != null) { + result.setParent(rootAccessibilityView, parentFlutterId); + } + } + + + private void addChildrenToFlutterNode(AccessibilityNodeInfo originNode, View embeddedView, Rect displayBounds, AccessibilityNodeInfo resultNode) { + for (int i = 0; i < originNode.getChildCount(); i++) { + Long originPackedId = reflectionAccessors.getChildId(originNode, i); + if (originPackedId == null) { + continue; + } + int originId = ReflectionAccessors.getVirtualNodeId(originPackedId); + ViewAndId origin = new ViewAndId(embeddedView, originId); + int childFlutterId; + if (originToFlutterId.containsKey(origin)) { + childFlutterId = originToFlutterId.get(origin); + } else { + childFlutterId = nextFlutterId++; + originToFlutterId.put(origin, childFlutterId); + flutterIdToOrigin.put(childFlutterId, origin); + flutterIdToDisplayBounds.put(childFlutterId, displayBounds); + } + resultNode.addChild(rootAccessibilityView, childFlutterId); + } + } + + private void setFlutterNodesTranslateBounds(AccessibilityNodeInfo originNode, Rect displayBounds, AccessibilityNodeInfo resultNode) { + Rect boundsInParent = new Rect(); + originNode.getBoundsInParent(boundsInParent); + resultNode.setBoundsInParent(boundsInParent); + + Rect boundsInScreen = new Rect(); + originNode.getBoundsInScreen(boundsInScreen); + boundsInScreen.offset(displayBounds.left, displayBounds.top); + resultNode.setBoundsInScreen(boundsInScreen); + } + + private void copyAccessibilityFields(AccessibilityNodeInfo input, AccessibilityNodeInfo output) { + output.setAccessibilityFocused(input.isAccessibilityFocused()); + output.setCheckable(input.isCheckable()); + output.setChecked(input.isChecked()); + output.setContentDescription(input.getContentDescription()); + output.setEnabled(input.isEnabled()); + output.setClickable(input.isClickable()); + output.setFocusable(input.isFocusable()); + output.setFocused(input.isFocused()); + output.setLongClickable(input.isLongClickable()); + output.setMovementGranularities(input.getMovementGranularities()); + output.setPassword(input.isPassword()); + output.setScrollable(input.isScrollable()); + output.setSelected(input.isSelected()); + output.setText(input.getText()); + output.setVisibleToUser(input.isVisibleToUser()); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { + output.setEditable(input.isEditable()); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + output.setCanOpenPopup(input.canOpenPopup()); + output.setCollectionInfo(input.getCollectionInfo()); + output.setCollectionItemInfo(input.getCollectionItemInfo()); + output.setContentInvalid(input.isContentInvalid()); + output.setDismissable(input.isDismissable()); + output.setInputType(input.getInputType()); + output.setLiveRegion(input.getLiveRegion()); + output.setMultiLine(input.isMultiLine()); + output.setRangeInfo(input.getRangeInfo()); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + output.setError(input.getError()); + output.setMaxTextLength(input.getMaxTextLength()); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + output.setContextClickable(input.isContextClickable()); + // TODO(amirh): copy traversal before and after. + // https://github.com/flutter/flutter/issues/29718 + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + output.setDrawingOrder(input.getDrawingOrder()); + output.setImportantForAccessibility(input.isImportantForAccessibility()); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + output.setAvailableExtraData(input.getAvailableExtraData()); + output.setHintText(input.getHintText()); + output.setShowingHintText(input.isShowingHintText()); + } + } + + private static class ViewAndId { + final View view; + final int id; + + private ViewAndId(View view, int id) { + this.view = view; + this.id = id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ViewAndId viewAndId = (ViewAndId) o; + return id == viewAndId.id && + view.equals(viewAndId.view); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + view.hashCode(); + result = prime * result + id; + return result; + } + } + + private static class ReflectionAccessors { + private final Method getSourceNodeId; + private final Method getParentNodeId; + private final Method getChildId; + + private ReflectionAccessors() { + Method getSourceNodeId = null; + Method getParentNodeId = null; + Method getChildId = null; + try { + getSourceNodeId = AccessibilityNodeInfo.class.getMethod("getSourceNodeId"); + } catch (NoSuchMethodException e) { + Log.w(TAG, "can't invoke getSourceNodeId with reflection"); + } + try { + getParentNodeId = AccessibilityNodeInfo.class.getMethod("getParentNodeId"); + } catch (NoSuchMethodException e) { + Log.w(TAG, "can't invoke getParentNodeId with reflection"); + } + try { + getChildId = AccessibilityNodeInfo.class.getMethod("getChildId", int.class); + } catch (NoSuchMethodException e) { + Log.w(TAG, "can't invoke getChildId with reflection"); + } + this.getSourceNodeId = getSourceNodeId; + this.getParentNodeId = getParentNodeId; + this.getChildId = getChildId; + } + + /** Returns virtual node ID given packed node ID used internally in accessibility API. */ + private static int getVirtualNodeId(long nodeId) { + return (int) (nodeId >> 32); + } + + private Long getSourceNodeId(AccessibilityNodeInfo node) { + if (getSourceNodeId == null) { + return null; + } + try { + return (Long) getSourceNodeId.invoke(node); + } catch (IllegalAccessException e) { + Log.w(TAG, e); + } catch (InvocationTargetException e) { + Log.w(TAG, e); + } + return null; + } + + private Long getChildId(AccessibilityNodeInfo node, int child) { + if (getChildId == null) { + return null; + } + try { + return (Long) getChildId.invoke(node, child); + } catch (IllegalAccessException e) { + Log.w(TAG, e); + } catch (InvocationTargetException e) { + Log.w(TAG, e); + } + return null; + } + + private Long getParentNodeId(AccessibilityNodeInfo node) { + if (getParentNodeId == null) { + return null; + } + try { + return (long) getParentNodeId.invoke(node); + } catch (IllegalAccessException e) { + Log.w(TAG, e); + } catch (InvocationTargetException e) { + Log.w(TAG, e); + } + return null; + } + } +} From 69c4d82f54100a260a7702c22a10e0e2d43cb678 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 21 Mar 2019 18:28:11 -0400 Subject: [PATCH 0524/1117] Roll src/third_party/skia d6ab77a2e20f..19fb3971bca5 (17 commits) (#8245) https://skia.googlesource.com/skia.git/%2Blog/d6ab77a2e20f..19fb3971bca5 git log d6ab77a2e20ff54644ffc247da4dd2ea755c1111..19fb3971bca5dd30c33513697fa082075c07c036 --date=short --no-merges --format=%ad %ae %s 2019-03-21 mtklein@google.com de-common some flags 2019-03-21 jvanverth@google.com Revert "Fix blurry edges on large ovals." 2019-03-21 brianosman@google.com Add maksing to SkSL byte code generator to please MSVC's RTC 2019-03-21 kjlubick@google.com [canvaskit] npm version 0.5.1 2019-03-21 ethannicholas@google.com fix Google3 roll 2019-03-21 bungeman@google.com Add font scale and skew in x to viewer. 2019-03-20 bungeman@google.com Always draw emoji with GPU. 2019-03-21 jvanverth@google.com Check for null parameter to SkOffsetSimplePolygon 2019-03-21 rmistry@google.com Add new AndroidOne SkottieTracing bot 2019-03-21 michaelludwig@google.com Use YUV effect in drawEdgeAAImageSet 2019-03-21 mtklein@google.com DEFINE_int32 + DEFINE_uint32 -> DEFINE_int 2019-03-21 brianosman@google.com Remove SkColorSpaceXformCanvas, and supporting code: 2019-03-21 jvanverth@google.com Fix blurry edges on large ovals. 2019-03-21 mtklein@google.com moar static flags 2019-03-21 rmistry@google.com New perf-skottietrace recipe 2019-03-21 mtklein@google.com refactor for saner constness 2019-03-21 mtklein@google.com update SkShader appendStages() fallback plan The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/DEPS b/DEPS index d6f84c112eab9..df00687c6ac09 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': 'd6ab77a2e20ff54644ffc247da4dd2ea755c1111', + 'skia_revision': '19fb3971bca5dd30c33513697fa082075c07c036', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 8e06779f78366..f6372b56e9c7e 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8b213e55333c31d2af13e99dbb28de7f +Signature: 068fad76a0ce84ce9e64affe66fc39c5 UNUSED LICENSES: @@ -2266,6 +2266,9 @@ FILE: ../../../third_party/skia/infra/bots/recipes/perf_canvaskit.expected/pathk 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/perf_skottietrace.expected/Perf-Android-Clang-AndroidOne-GPU-Mali400MP2-arm-Release-All-Android_SkottieTracing.json +FILE: ../../../third_party/skia/infra/bots/recipes/perf_skottietrace.expected/skottietracing_parse_trace_error.json +FILE: ../../../third_party/skia/infra/bots/recipes/perf_skottietrace.expected/skottietracing_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 @@ -4181,8 +4184,6 @@ ORIGIN: ../../../third_party/skia/bench/ClipMaskBench.cpp + ../../../third_party TYPE: LicenseType.bsd FILE: ../../../third_party/skia/bench/ClipMaskBench.cpp FILE: ../../../third_party/skia/bench/ClipStrategyBench.cpp -FILE: ../../../third_party/skia/bench/ColorCanvasDrawBitmapBench.cpp -FILE: ../../../third_party/skia/bench/ColorSpaceXformBench.cpp FILE: ../../../third_party/skia/bench/CubicKLMBench.cpp FILE: ../../../third_party/skia/bench/PathTextBench.cpp FILE: ../../../third_party/skia/bench/ShadowBench.cpp @@ -4240,7 +4241,6 @@ FILE: ../../../third_party/skia/include/atlastext/SkAtlasTextFont.h FILE: ../../../third_party/skia/include/atlastext/SkAtlasTextRenderer.h FILE: ../../../third_party/skia/include/atlastext/SkAtlasTextTarget.h FILE: ../../../third_party/skia/include/codec/SkEncodedOrigin.h -FILE: ../../../third_party/skia/include/core/SkColorSpaceXformCanvas.h FILE: ../../../third_party/skia/include/core/SkDeferredDisplayListRecorder.h FILE: ../../../third_party/skia/include/core/SkExecutor.h FILE: ../../../third_party/skia/include/core/SkFontArguments.h @@ -4396,9 +4396,6 @@ FILE: ../../../third_party/skia/src/core/SkBlendMode.cpp FILE: ../../../third_party/skia/src/core/SkBlitter_RGB565.cpp FILE: ../../../third_party/skia/src/core/SkClipStackDevice.cpp FILE: ../../../third_party/skia/src/core/SkClipStackDevice.h -FILE: ../../../third_party/skia/src/core/SkColorSpaceXformCanvas.cpp -FILE: ../../../third_party/skia/src/core/SkColorSpaceXformer.cpp -FILE: ../../../third_party/skia/src/core/SkColorSpaceXformer.h FILE: ../../../third_party/skia/src/core/SkCoverageDelta.cpp FILE: ../../../third_party/skia/src/core/SkCoverageDelta.h FILE: ../../../third_party/skia/src/core/SkDeferredDisplayListRecorder.cpp From 3df694300bfb2ef77363a91928a63d6f2f595810 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 21 Mar 2019 15:34:24 -0700 Subject: [PATCH 0525/1117] Roll src/third_party/dart cabaa78cc5..ba0147ac07 (3 commits) (#8248) ba0147ac07 Resynthesize typedef(s) and generic function types. a7a36961bd math: dartfmt -f --fix 1d7dcfff97 Cleanup scanner tests --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index df00687c6ac09..edb3d0f0b88e4 100644 --- a/DEPS +++ b/DEPS @@ -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': 'cabaa78cc57d08bcfcd75bfe99a42c19ed497d26', + 'dart_revision': 'ba0147ac077b3f2e40694791872d610de61ed982', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 42785b9c948c3..050e0164a7b63 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 0f3631374103b2f9512fd6180a904a7e +Signature: b76e84a42f37701a84355e415b774050 UNUSED LICENSES: From b68f7e72aa71eb75969bd674d78a5b40ee5ed89f Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 21 Mar 2019 15:46:29 -0700 Subject: [PATCH 0526/1117] Allow specifying an alternate Mac host SDK. (#8249) --- tools/gn | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/gn b/tools/gn index 083b8c821554f..7dacacf0651a4 100755 --- a/tools/gn +++ b/tools/gn @@ -241,6 +241,9 @@ def to_gn_args(args): gn_args['dart_platform_sdk'] = not args.full_dart_sdk gn_args['full_dart_sdk'] = args.full_dart_sdk + if sys.platform == 'darwin': + gn_args['mac_sdk_path'] = args.mac_sdk_path + return gn_args def parse_args(args): @@ -296,6 +299,9 @@ def parse_args(args): help='include trained dart2js and dartdevc snapshots. Enable only on steps that create an SDK') parser.add_argument('--no-full-dart-sdk', dest='full_dart_sdk', action='store_false') + parser.add_argument('--mac-sdk-path', default='', type=str, + help='On the mac, the SDK is inferred from the Xcode location unless this flag is specified.') + return parser.parse_args(args) def main(argv): From adc6685468bfc416eaab2858dd023e0e7771c7bc Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Thu, 21 Mar 2019 18:01:53 -0700 Subject: [PATCH 0527/1117] Add platformViewId to stub_ui (#8253) --- lib/stub_ui/semantics.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/stub_ui/semantics.dart b/lib/stub_ui/semantics.dart index bc15a4cc285ac..cd2715eddf3db 100644 --- a/lib/stub_ui/semantics.dart +++ b/lib/stub_ui/semantics.dart @@ -590,6 +590,11 @@ class SemanticsUpdateBuilder { /// The fields 'textSelectionBase' and 'textSelectionExtent' describe the /// currently selected text within `value`. /// + /// The field `platformViewId` references the platform view, whose semantics + /// nodes will be added as children to this node. If a platform view is + /// specified, `childrenInHitTestOrder` and `childrenInTraversalOrder` must be + /// empty. + /// /// For scrollable nodes `scrollPosition` describes the current scroll /// position in logical pixel. `scrollExtentMax` and `scrollExtentMin` /// describe the maximum and minimum in-rage values that `scrollPosition` can @@ -618,6 +623,7 @@ class SemanticsUpdateBuilder { int actions, int textSelectionBase, int textSelectionExtent, + int platformViewId, int scrollChildren, int scrollIndex, double scrollPosition, From 68bd4f2c6479c19a4e4af6574db45900fcade346 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 21 Mar 2019 18:08:58 -0700 Subject: [PATCH 0528/1117] Do not drop the DartExecutor's message handler when a FlutterNativeView is detached from the FlutterView (#8254) An activity can use ViewFactory.retainNativeFlutterView to reuse a FlutterNativeView across multiple instances of the activity. In this scenario, the FlutterNativeView should continue to handle incoming messages sent from Dart. --- shell/platform/android/io/flutter/view/FlutterNativeView.java | 3 +-- shell/platform/android/io/flutter/view/FlutterView.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/shell/platform/android/io/flutter/view/FlutterNativeView.java b/shell/platform/android/io/flutter/view/FlutterNativeView.java index 580612a1467bf..2c2b57a5f174a 100644 --- a/shell/platform/android/io/flutter/view/FlutterNativeView.java +++ b/shell/platform/android/io/flutter/view/FlutterNativeView.java @@ -47,9 +47,8 @@ public FlutterNativeView(@NonNull Context context, boolean isBackgroundView) { assertAttached(); } - public void detach() { + public void detachFromFlutterView() { mPluginRegistry.detach(); - dartExecutor.onDetachedFromJNI(); mFlutterView = null; } diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index f8f38abbd48dc..7ba52567572ca 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -346,7 +346,7 @@ public FlutterNativeView detach() { if (!isAttached()) return null; getHolder().removeCallback(mSurfaceCallback); - mNativeView.detach(); + mNativeView.detachFromFlutterView(); FlutterNativeView view = mNativeView; mNativeView = null; From 272957d62b605c401c8376bb692ef86e1061daf8 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 21 Mar 2019 21:57:11 -0400 Subject: [PATCH 0529/1117] Roll src/third_party/skia 19fb3971bca5..d0995493f8f3 (11 commits) (#8255) https://skia.googlesource.com/skia.git/%2Blog/19fb3971bca5..d0995493f8f3 git log 19fb3971bca5dd30c33513697fa082075c07c036..d0995493f8f3d1d4d882c6b5b5dbc327072dd41b --date=short --no-merges --format=%ad %ae %s 2019-03-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 80c796becc43..b55772e6e7dd (2 commits) 2019-03-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 4ecc9d4073ce..80c796becc43 (1 commits) 2019-03-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src b57a03014063..9aca4d1c479e (502 commits) 2019-03-21 bungeman@google.com Make zoom in viewer exponential. 2019-03-21 rmistry@google.com Fix upload collisions in the AndroidOne SkottieTracing bot 2019-03-21 csmartdalton@google.com Rename GrAAFillRRectOp to GrFillRectOp 2019-03-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 232bfeae6b29..2219b18c984e (6 commits) 2019-03-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 603a1b53f72e..4ecc9d4073ce (2 commits) 2019-03-21 bsalomon@google.com Put SkImageInfo on SkImage to avoid cost of reconstructing for queries. 2019-03-21 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 7bc4f45a391f..603a1b53f72e (2 commits) 2019-03-21 egdaniel@google.com In viewer measure and show full frame times. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index edb3d0f0b88e4..8a1b7cd9d55c7 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': '19fb3971bca5dd30c33513697fa082075c07c036', + 'skia_revision': 'd0995493f8f3d1d4d882c6b5b5dbc327072dd41b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index f6372b56e9c7e..1fa2379cad8b6 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 068fad76a0ce84ce9e64affe66fc39c5 +Signature: 133c7e4e6c2e00c64142fb39061417a0 UNUSED LICENSES: @@ -1836,12 +1836,12 @@ 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/GrFillRRectOp.cpp +FILE: ../../../third_party/skia/src/gpu/ops/GrFillRRectOp.h FILE: ../../../third_party/skia/src/gpu/ops/GrFillRectOp.cpp FILE: ../../../third_party/skia/src/gpu/ops/GrFillRectOp.h FILE: ../../../third_party/skia/src/gpu/ops/GrQuadPerEdgeAA.cpp From f226db946c048d619adb7f990568d8551a5bec00 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 22 Mar 2019 01:26:11 -0400 Subject: [PATCH 0530/1117] Roll src/third_party/skia d0995493f8f3..a39bbdad93be (2 commits) (#8257) https://skia.googlesource.com/skia.git/%2Blog/d0995493f8f3..a39bbdad93be git log d0995493f8f3d1d4d882c6b5b5dbc327072dd41b..a39bbdad93be9778642d9f3bca3904f649222d16 --date=short --no-merges --format=%ad %ae %s 2019-03-21 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-21 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 8a1b7cd9d55c7..93452ea493ea6 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': 'd0995493f8f3d1d4d882c6b5b5dbc327072dd41b', + 'skia_revision': 'a39bbdad93be9778642d9f3bca3904f649222d16', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 1fa2379cad8b6..1ba4977f568b6 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 133c7e4e6c2e00c64142fb39061417a0 +Signature: fcae4f094f1b7713447703f889a76685 UNUSED LICENSES: From db9d864d8dadf348d203c9838645eceb5f34de6f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 22 Mar 2019 04:55:11 -0400 Subject: [PATCH 0531/1117] Roll src/third_party/skia a39bbdad93be..f4af3608b95a (2 commits) (#8259) https://skia.googlesource.com/skia.git/%2Blog/a39bbdad93be..f4af3608b95a git log a39bbdad93be9778642d9f3bca3904f649222d16..f4af3608b95a188777441c955d213263d9b1916b --date=short --no-merges --format=%ad %ae %s 2019-03-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 2219b18c984e..9e586a0f8a1c (1 commits) 2019-03-22 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 93452ea493ea6..e461175e40c58 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': 'a39bbdad93be9778642d9f3bca3904f649222d16', + 'skia_revision': 'f4af3608b95a188777441c955d213263d9b1916b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 1ba4977f568b6..b18f975474270 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: fcae4f094f1b7713447703f889a76685 +Signature: e6ee3992d9098bc6dc16f6b577f61248 UNUSED LICENSES: From cb3a9962debe42e3a32e55e1005e17d0b093ca46 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 22 Mar 2019 08:24:20 -0400 Subject: [PATCH 0532/1117] Roll src/third_party/skia f4af3608b95a..bc7402f30ad8 (5 commits) (#8261) https://skia.googlesource.com/skia.git/%2Blog/f4af3608b95a..bc7402f30ad8 git log f4af3608b95a188777441c955d213263d9b1916b..bc7402f30ad83f04a81401cc2b1bcb19d7dec7a9 --date=short --no-merges --format=%ad %ae %s 2019-03-21 benjaminwagner@google.com [infra] Cleanup unused OS mappings in gen_tasks.go 2019-03-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 756b54d7073a..4d3cdbc27b79 (1 commits) 2019-03-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3f9c56c3cd54..756b54d7073a (2 commits) 2019-03-22 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader b55772e6e7dd..3f9c56c3cd54 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index e461175e40c58..474da5adc9b6d 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': 'f4af3608b95a188777441c955d213263d9b1916b', + 'skia_revision': 'bc7402f30ad83f04a81401cc2b1bcb19d7dec7a9', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b18f975474270..7d3b850b0b12a 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: e6ee3992d9098bc6dc16f6b577f61248 +Signature: ef4ed470e23fb09eca765820d10dc8fa UNUSED LICENSES: From 81dbfc12e492efe48de40f7e1132a574f25c81e1 Mon Sep 17 00:00:00 2001 From: Justin McCandless Date: Fri, 22 Mar 2019 06:57:29 -0700 Subject: [PATCH 0533/1117] Fix incorrect vertices colors length check (#8247) A DCHECK was checking incorrect values, and this corrects it. --- lib/ui/painting/vertices.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/painting/vertices.cc b/lib/ui/painting/vertices.cc index 2e23fcd975b11..0f29ad593b65a 100644 --- a/lib/ui/painting/vertices.cc +++ b/lib/ui/painting/vertices.cc @@ -73,7 +73,7 @@ void Vertices::init(SkVertices::VertexMode vertex_mode, } if (colors.data()) { // SkVertices::Builder assumes equal numbers of elements - FML_DCHECK(positions.num_elements() == colors.num_elements()); + FML_DCHECK(positions.num_elements() / 2 == colors.num_elements()); DecodeInts(colors, builder.colors()); } From 663967b574eeeb7d42db825a9363343f59ca3e26 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 21 Mar 2019 19:01:05 -0700 Subject: [PATCH 0534/1117] Roll src/third_party/dart ba0147ac07..266d823f5c (12 commits) 266d823f5c remove unused scanner error list 986fbe34d7 [dartdevc] fix #36275, emit members whose names are from other libraries 602ac1226d Check if element conditions for downcasts 2ffe0c7b7a Report not potential constants in ShortCircuitOperators. 298dacfef5 [vm] Avoid main thread compilation of implicit accessors. 1e405a8226 [ddc] sidestep constant regression in ddk 61e71e785f Prepare to publish analyzer version 0.36.0 c403804d9c [vm/interpreter] Take arg desc into consideration when resolving call method in invoke field dispatchers. 40e77d29d5 Tests for implicit cast properties; add cast for `[...dynamic]`. 9622562482 Make _cancelWakeup a no-op if _sendPort is null 8f827aef4f [vm/bytecode] Recognize identical() in bytecode flow graph builder 02d5d26b83 Fix for 'int' in const List. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 474da5adc9b6d..70b1d34bd7f23 100644 --- a/DEPS +++ b/DEPS @@ -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': 'ba0147ac077b3f2e40694791872d610de61ed982', + 'dart_revision': '266d823f5c5733c1f0a0bb3a4f4f398a15f81e8f', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 050e0164a7b63..d83021c7869ae 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: b76e84a42f37701a84355e415b774050 +Signature: a1b4b559a1f0f48db96b691ff133002c UNUSED LICENSES: From 28846b69d15dc7901c01a824e8b81f2fd963952b Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 21 Mar 2019 21:54:38 -0700 Subject: [PATCH 0535/1117] Roll src/third_party/dart 266d823f5c..8b8a8f7b4e (3 commits) 8b8a8f7b4e Report error for invalid this/super in initializer 74b7890597 Fix a few mistakes and oversights in the control flow collection tests. f5d97104e8 [dartdevc] Fix ForElement downcasts and expected run time errors --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 70b1d34bd7f23..8a91019a9d7df 100644 --- a/DEPS +++ b/DEPS @@ -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': '266d823f5c5733c1f0a0bb3a4f4f398a15f81e8f', + 'dart_revision': '8b8a8f7b4e11ceb0c4c9e504bfd5f3cbc496f74b', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py From 09cb42648fa6aec7d857af178b8d073323ea3c09 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 22 Mar 2019 00:51:58 -0700 Subject: [PATCH 0536/1117] Roll src/third_party/dart 8b8a8f7b4e..fa74184b7a (1 commits) fa74184b7a Verify that constructor initializers use only potentially constant expressions. --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 8a91019a9d7df..1ad93b10d6ae0 100644 --- a/DEPS +++ b/DEPS @@ -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': '8b8a8f7b4e11ceb0c4c9e504bfd5f3cbc496f74b', + 'dart_revision': 'fa74184b7aad2a441a23c4c2f4160c09cc69ec32', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py From d21cca71fd2f624dbe0384d291e9f629783f4983 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 22 Mar 2019 11:51:15 -0400 Subject: [PATCH 0537/1117] Roll src/third_party/skia bc7402f30ad8..f9264bac4e99 (8 commits) (#8264) https://skia.googlesource.com/skia.git/%2Blog/bc7402f30ad8..f9264bac4e99 git log bc7402f30ad83f04a81401cc2b1bcb19d7dec7a9..f9264bac4e995c2ee0fbd127ce10000ceed30945 --date=short --no-merges --format=%ad %ae %s 2019-03-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader cf1866183620..2e96bac879cf (2 commits) 2019-03-22 brianosman@google.com Remove Perf-Valgrind-AbandonGpuContext bot 2019-03-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3dbb77576f93..cf1866183620 (1 commits) 2019-03-22 bsalomon@google.com Revert "Use glTexStorage for non-MIP mapped textures." 2019-03-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader af26cfe3fd74..3dbb77576f93 (1 commits) 2019-03-21 bsalomon@google.com Use glTexStorage for non-MIP mapped textures. 2019-03-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 4d3cdbc27b79..af26cfe3fd74 (1 commits) 2019-03-21 reed@google.com update/add benches to look at colorspace as well as alphatype The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 1ad93b10d6ae0..1f17737582ab8 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': 'bc7402f30ad83f04a81401cc2b1bcb19d7dec7a9', + 'skia_revision': 'f9264bac4e995c2ee0fbd127ce10000ceed30945', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 7d3b850b0b12a..96ff5595913e7 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ef4ed470e23fb09eca765820d10dc8fa +Signature: a11edade867d2a6d79060ca17bb31f94 UNUSED LICENSES: @@ -2255,7 +2255,7 @@ FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Debian9-Cl FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Mac10.13-Clang-MacBook10.1-GPU-IntelHD615-x86_64-Release-All-CommandBuffer.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Mac10.13-Clang-MacBookPro11.5-GPU-RadeonHD8870M-x86_64-Release-All-MoltenVK_Vulkan.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Mac10.13-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-Ubuntu17-GCC-Golo-GPU-QuadroP400-x86_64-Release-All-Valgrind_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-NUC8i5BEK-GPU-IntelIris655-x86_64-Release-All-Vulkan.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Win10-Clang-NUC8i5BEK-GPU-IntelIris655-x86_64-Release-All.json From f4d994951862d0153efabeb98cc0cf5eb842174e Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Fri, 22 Mar 2019 10:23:22 -0700 Subject: [PATCH 0538/1117] check that public API of dart:ui conforms to web implementation (#8256) --- ci/build.sh | 6 ++ web_sdk/pubspec.yaml | 6 ++ web_sdk/test/api_conform_test.dart | 134 +++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+) create mode 100644 web_sdk/pubspec.yaml create mode 100644 web_sdk/test/api_conform_test.dart diff --git a/ci/build.sh b/ci/build.sh index 57699445121c1..cd0024147ba54 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -12,3 +12,9 @@ ninja -C out/host_debug_unopt generate_dart_ui # Analyze the dart UI flutter/ci/analyze.sh flutter/ci/licenses.sh + +# Check that dart libraries conform +cd flutter/web_sdk +pub get +cd .. +dart web_sdk/test/api_conform_test.dart diff --git a/web_sdk/pubspec.yaml b/web_sdk/pubspec.yaml new file mode 100644 index 0000000000000..46234190eea08 --- /dev/null +++ b/web_sdk/pubspec.yaml @@ -0,0 +1,6 @@ +name: web_sdk_tests +author: Flutter Authors + +dev_dependencies: + analyzer: any + test: any diff --git a/web_sdk/test/api_conform_test.dart b/web_sdk/test/api_conform_test.dart new file mode 100644 index 0000000000000..1a7f8c53a7c6d --- /dev/null +++ b/web_sdk/test/api_conform_test.dart @@ -0,0 +1,134 @@ +// Copyright 2013 The Flutter 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 'package:analyzer/analyzer.dart'; + +int main() { + // These files just contain imports to the part files; + final CompilationUnit uiUnit = parseDartFile('lib/ui/ui.dart', + parseFunctionBodies: false, suppressErrors: false); + final CompilationUnit webUnit = parseDartFile('lib/stub_ui/ui.dart', + parseFunctionBodies: false, suppressErrors: false); + final Map uiClasses = {}; + final Map webClasses = {}; + + // Gather all public classes from each library. For now we are skiping + // other top level members. + _collectPublicClasses(uiUnit, uiClasses, 'lib/ui/'); + _collectPublicClasses(webUnit, webClasses, 'lib/stub_ui/'); + + if (uiClasses.isEmpty || webClasses.isEmpty) { + print('Warning: did not resolve any classes.'); + } + + bool failed = false; + print('Checking ${uiClasses.length} public classes.'); + for (String className in uiClasses.keys) { + final ClassDeclaration uiClass = uiClasses[className]; + final ClassDeclaration webClass = webClasses[className]; + // If the web class is missing there isn't much left to do here. Print a + // warning and move along. + if (webClass == null) { + failed = true; + print('Warning: lib/ui/ui.dart contained public class $className, but ' + 'this was missing from lib/stub_ui/ui.dart.'); + continue; + } + // Next will check that the public methods exposed in each library are + // identical. + final Map uiMethods = {}; + final Map webMethods = {}; + _collectPublicMethods(uiClass, uiMethods); + _collectPublicMethods(webClass, webMethods); + + for (String methodName in uiMethods.keys) { + final MethodDeclaration uiMethod = uiMethods[methodName]; + final MethodDeclaration webMethod = webMethods[methodName]; + if (webMethod == null) { + failed = true; + print( + 'Warning: lib/ui/ui.dart $className.$methodName is missing from lib/stub_ui/ui.dart.', + ); + continue; + } + if (uiMethod.parameters == null || webMethod.parameters == null) { + continue; + } + if (uiMethod.parameters.parameters.length != webMethod.parameters.parameters.length) { + failed = true; + print( + 'Warning: lib/ui/ui.dart $className.$methodName has a different parameter ' + 'length than in lib/stub_ui/ui.dart.'); + } + // Technically you could re-order named parameters and still be valid, + // but we enforce that they are identical. + for (int i = 0; i < uiMethod.parameters.parameters.length && i < webMethod.parameters.parameters.length; i++) { + final FormalParameter uiParam = uiMethod.parameters.parameters[i]; + final FormalParameter webParam = webMethod.parameters.parameters[i]; + if (webParam.identifier.name != uiParam.identifier.name) { + failed = true; + print('Warning: lib/ui/ui.dart $className.$methodName parameter $i' + ' ${uiParam.identifier.name} has a different name in lib/stub_ui/ui.dart.'); + } + if (uiParam.isPositional && !webParam.isPositional) { + failed = true; + print('Warning: lib/ui/ui.dart $className.$methodName parameter $i' + '${uiParam.identifier.name} is positional, but not in lib/stub_ui/ui.dart.'); + } + if (uiParam.isNamed && !webParam.isNamed) { + failed = true; + print('Warning: lib/ui/ui.dart $className.$methodName parameter $i' + '${uiParam.identifier.name} is named, but not in lib/stub_ui/ui.dart.'); + } + } + } + } + if (failed) { + print('Failure!'); + return 1; + } + print('Success!'); + return 0; +} + +// Collects all public classes defined by the part files of [unit]. +void _collectPublicClasses(CompilationUnit unit, + Map destination, String root) { + for (Directive directive in unit.directives) { + if (directive is! PartDirective) { + continue; + } + final PartDirective partDirective = directive; + final String literalUri = partDirective.uri.toString(); + final CompilationUnit subUnit = parseDartFile( + '$root${literalUri.substring(1, literalUri.length - 1)}', + parseFunctionBodies: false, + suppressErrors: false, + ); + for (CompilationUnitMember member in subUnit.declarations) { + if (member is! ClassDeclaration) { + continue; + } + final ClassDeclaration classDeclaration = member; + if (classDeclaration.name.name.startsWith('_')) { + continue; + } + destination[classDeclaration.name.name] = classDeclaration; + } + } +} + +void _collectPublicMethods(ClassDeclaration classDeclaration, + Map destination) { + for (ClassMember member in classDeclaration.members) { + if (member is! MethodDeclaration) { + continue; + } + final MethodDeclaration method = member; + if (method.name.name.startsWith('_')) { + continue; + } + destination[method.name.name] = method; + } +} From 5f8ae420c1ac61bbbb26e61251d129c879fc788d Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Fri, 22 Mar 2019 13:43:34 -0700 Subject: [PATCH 0539/1117] Linking Higher & Lower Class Docs (#8265) * Linking lower layer classes to higher layers in API Docs. --- lib/ui/painting.dart | 10 ++++++++++ lib/ui/text.dart | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index a83cf9265d012..42ff490c60f7d 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -1520,6 +1520,11 @@ class _ImageInfo { /// /// To draw an [Image], use one of the methods on the [Canvas] class, such as /// [Canvas.drawImage]. +/// +/// See also: +/// +/// * [Image], the class in the [widgets] library that encapsulates this class. +/// @pragma('vm:entry-point') class Image extends NativeFieldWrapperClass2 { // This class is created by the engine, and should not be instantiated @@ -2678,6 +2683,11 @@ Float32List _encodeTwoPoints(Offset pointA, Offset pointB) { /// /// There are several types of gradients, represented by the various constructors /// on this class. +/// +/// See also: +/// +/// * [Gradient], the class in the [painting] library that encapsulates this class. +/// class Gradient extends Shader { void _constructor() native 'Gradient_constructor'; diff --git a/lib/ui/text.dart b/lib/ui/text.dart index 312b917573d89..f19e734482490 100644 --- a/lib/ui/text.dart +++ b/lib/ui/text.dart @@ -352,6 +352,11 @@ Int32List _encodeTextStyle( } /// An opaque object that determines the size, position, and rendering of text. +/// +/// See also: +/// +/// * [TextStyle], the class in the [painting] library that encapsulates this class. +/// class TextStyle { /// Creates a new TextStyle object. /// @@ -792,6 +797,10 @@ ByteData _encodeStrut( return ByteData.view(data.buffer, 0, byteCount); } +/// See also: +/// +/// * [StrutStyle], the class in the [painting] library that encapsulates this class. +/// class StrutStyle { /// Creates a new StrutStyle object. /// From c12696cc533bde827574c15aad4d6b197c34c51f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 22 Mar 2019 21:53:54 -0400 Subject: [PATCH 0540/1117] Roll src/third_party/skia f9264bac4e99..33332f1e100c (27 commits) (#8275) https://skia.googlesource.com/skia.git/%2Blog/f9264bac4e99..33332f1e100c git log f9264bac4e995c2ee0fbd127ce10000ceed30945..33332f1e100cf8e2c2fca385113f27b1e076bfd8 --date=short --no-merges --format=%ad %ae %s 2019-03-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 9aca4d1c479e..3d76aaf8edee (485 commits) 2019-03-22 enne@chromium.org Prevent overflow in Deserialize::ensureAtLeast 2019-03-22 jvanverth@google.com Revert "Reland "Fix blurry edges on large ovals."" 2019-03-22 mtklein@google.com create a wrapper to manage --nativeFonts and --gdi 2019-03-22 mtklein@google.com de-common another batch of flags 2019-03-22 reed@google.com add bench for drawAtlas 2019-03-22 ethannicholas@google.com fixed constructing matrices in SPIR-V when arguments cross column boundaries 2019-03-22 brianosman@google.com Simplify two more clients of proxy provider (mipped vs. non-mipped) 2019-03-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 89c13815df2f..e276f52bb4c9 (2 commits) 2019-03-22 mtklein@google.com de-common --veryVerbose 2019-03-22 jvanverth@google.com Reland "Fix blurry edges on large ovals." 2019-03-22 rmistry@google.com [Recipe_Modules] read_file_on_device was in all flavors except the DefaultFlavor 2019-03-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 86509d9074c0..89c13815df2f (1 commits) 2019-03-22 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-22 brianosman@google.com Fold together mippped and non-mippped bitmap to proxy functions 2019-03-22 mtklein@google.com factor out SetAnalyticAAFromCommonFlags() 2019-03-22 rmistry@google.com Update all page sets for the RecreateSKPs bot 2019-03-22 mtklein@google.com Fold CommonFlagsGpu into CommonFlags 2019-03-22 rmistry@google.com Add support for automated credentials login in webpages_playback.py 2019-03-22 rmistry@google.com Fix --record in webpages_playback.py 2019-03-22 rmistry@google.com Script to help create new page sets for the RecreateSKPs bot 2019-03-22 bsalomon@google.com Revert "Revert "Use glTexStorage for non-MIP mapped textures."" 2019-03-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 4c1b8c87c9aa..86509d9074c0 (3 commits) 2019-03-22 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 2e96bac879cf..4c1b8c87c9aa (1 commits) 2019-03-22 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 9e586a0f8a1c..896e7811184e (1 commits) 2019-03-22 mtklein@google.com delete DAA The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/DEPS b/DEPS index 1f17737582ab8..f4d1840e67ec9 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': 'f9264bac4e995c2ee0fbd127ce10000ceed30945', + 'skia_revision': '33332f1e100cf8e2c2fca385113f27b1e076bfd8', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 96ff5595913e7..9810129f30565 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: a11edade867d2a6d79060ca17bb31f94 +Signature: 767d8408bc1bafe38e80364099165750 UNUSED LICENSES: @@ -2325,7 +2325,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-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 FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win2016-Clang-GCE-CPU-AVX2-x86_64-Debug-All-FAAA.json -FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win2016-Clang-GCE-CPU-AVX2-x86_64-Debug-All-FDAA.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win2016-Clang-GCE-CPU-AVX2-x86_64-Debug-All-FSAA.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win2016-MSVC-GCE-CPU-AVX2-x86_64-Debug-All-MSRTC.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-iOS-Clang-iPadPro-GPU-PowerVRGT7800-arm64-Release-All.json @@ -4396,8 +4395,6 @@ FILE: ../../../third_party/skia/src/core/SkBlendMode.cpp FILE: ../../../third_party/skia/src/core/SkBlitter_RGB565.cpp FILE: ../../../third_party/skia/src/core/SkClipStackDevice.cpp FILE: ../../../third_party/skia/src/core/SkClipStackDevice.h -FILE: ../../../third_party/skia/src/core/SkCoverageDelta.cpp -FILE: ../../../third_party/skia/src/core/SkCoverageDelta.h FILE: ../../../third_party/skia/src/core/SkDeferredDisplayListRecorder.cpp FILE: ../../../third_party/skia/src/core/SkDrawShadowInfo.cpp FILE: ../../../third_party/skia/src/core/SkDrawShadowInfo.h @@ -6831,7 +6828,6 @@ ORIGIN: ../../../third_party/skia/src/compute/sk/SkDevice_Compute.h + ../../../t TYPE: LicenseType.bsd FILE: ../../../third_party/skia/src/compute/sk/SkDevice_Compute.h FILE: ../../../third_party/skia/src/core/SkScan_AAAPath.cpp -FILE: ../../../third_party/skia/src/core/SkScan_DAAPath.cpp ---------------------------------------------------------------------------------------------------- Copyright 2016 The Android Open Source Project From f8e3a40f9ba701120724b5d6e8ff790d50f18083 Mon Sep 17 00:00:00 2001 From: KyleWong Date: Sat, 23 Mar 2019 10:21:07 +0800 Subject: [PATCH 0541/1117] Roll buildroot to 9c7b023ff266ee58b00fe60326fa1db910a087f3 (#8277) --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index f4d1840e67ec9..1d04073f8bca0 100644 --- a/DEPS +++ b/DEPS @@ -121,7 +121,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '3f54d4f03112098e164ee62f015fcc54b19d1eda', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '9c7b023ff266ee58b00fe60326fa1db910a087f3', # Fuchsia compatibility # From 62c88d690272f0b78047758bb9d8ffa8bbb870cc Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 23 Mar 2019 01:22:55 -0400 Subject: [PATCH 0542/1117] Roll src/third_party/skia 33332f1e100c..e86cc5039026 (1 commits) (#8278) https://skia.googlesource.com/skia.git/%2Blog/33332f1e100c..e86cc5039026 git log 33332f1e100cf8e2c2fca385113f27b1e076bfd8..e86cc50390268c54faffaa5a7929c5cf11a7b31e --date=short --no-merges --format=%ad %ae %s 2019-03-23 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 896e7811184e..a8ff88143af6 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 1d04073f8bca0..f3cc1aa259ab2 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': '33332f1e100cf8e2c2fca385113f27b1e076bfd8', + 'skia_revision': 'e86cc50390268c54faffaa5a7929c5cf11a7b31e', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 9810129f30565..3d3df0c9f24aa 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 767d8408bc1bafe38e80364099165750 +Signature: 926700fd3fd884d5cf2c01a64c43cad6 UNUSED LICENSES: From 9f878fcb3ecdcc2c6ba0c6d958282c176f008183 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 23 Mar 2019 04:56:54 -0400 Subject: [PATCH 0543/1117] Roll src/third_party/skia e86cc5039026..ec1c6fdfdd11 (1 commits) (#8279) https://skia.googlesource.com/skia.git/%2Blog/e86cc5039026..ec1c6fdfdd11 git log e86cc50390268c54faffaa5a7929c5cf11a7b31e..ec1c6fdfdd11c41b4a6f3c80bb9c7157cf092cc7 --date=short --no-merges --format=%ad %ae %s 2019-03-23 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f3cc1aa259ab2..34efd976530d7 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': 'e86cc50390268c54faffaa5a7929c5cf11a7b31e', + 'skia_revision': 'ec1c6fdfdd11c41b4a6f3c80bb9c7157cf092cc7', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3d3df0c9f24aa..91383cb0f3112 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 926700fd3fd884d5cf2c01a64c43cad6 +Signature: 47f250b71c23d2debbf6e70aa5375d18 UNUSED LICENSES: From 61838cab6dd468120ef76b77aa78a0963aa9a8ad Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 23 Mar 2019 08:25:54 -0400 Subject: [PATCH 0544/1117] Roll src/third_party/skia ec1c6fdfdd11..61bd91237778 (1 commits) (#8280) https://skia.googlesource.com/skia.git/%2Blog/ec1c6fdfdd11..61bd91237778 git log ec1c6fdfdd11c41b4a6f3c80bb9c7157cf092cc7..61bd9123777867edc772d57c3cfccaf207e4507f --date=short --no-merges --format=%ad %ae %s 2019-03-23 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 a8ff88143af6..2660b5031f11 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 34efd976530d7..f4e944baa259d 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': 'ec1c6fdfdd11c41b4a6f3c80bb9c7157cf092cc7', + 'skia_revision': '61bd9123777867edc772d57c3cfccaf207e4507f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 91383cb0f3112..6d24af662aefd 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 47f250b71c23d2debbf6e70aa5375d18 +Signature: f8df17e4c0d818b74fb88c23d291e0a6 UNUSED LICENSES: From 8d23b21d1480042f832cb40044093cae770f0987 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 23 Mar 2019 12:44:54 -0400 Subject: [PATCH 0545/1117] Roll src/third_party/skia 61bd91237778..b1dbbc8509c6 (2 commits) (#8282) https://skia.googlesource.com/skia.git/%2Blog/61bd91237778..b1dbbc8509c6 git log 61bd9123777867edc772d57c3cfccaf207e4507f..b1dbbc8509c67b6db5561fa52dc96edae54f8c4c --date=short --no-merges --format=%ad %ae %s 2019-03-22 herb@google.com Fix fallback problems for emoji 2019-03-22 bungeman@google.com Move fontmgr_bounds label setting to checkbox. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f4e944baa259d..cd7fcf23bfead 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': '61bd9123777867edc772d57c3cfccaf207e4507f', + 'skia_revision': 'b1dbbc8509c67b6db5561fa52dc96edae54f8c4c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6d24af662aefd..99bf35df50054 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f8df17e4c0d818b74fb88c23d291e0a6 +Signature: 025a0970375165e70c82931c7f396b9b UNUSED LICENSES: From bd4f6d7260b6f32b1e2ea2ca6be403cddcf3bdbd Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 23 Mar 2019 16:13:55 -0400 Subject: [PATCH 0546/1117] Roll src/third_party/skia b1dbbc8509c6..4c0b5c4b79dd (2 commits) (#8283) https://skia.googlesource.com/skia.git/%2Blog/b1dbbc8509c6..4c0b5c4b79dd git log b1dbbc8509c67b6db5561fa52dc96edae54f8c4c..4c0b5c4b79dd14bee32d8a527aeaa3c26c72d3a1 --date=short --no-merges --format=%ad %ae %s 2019-03-23 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 2660b5031f11..a88c1f9c8b34 (1 commits) 2019-03-22 halcanary@google.com SkPDF: runtime switch between subsetters The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index cd7fcf23bfead..fe3950b4632a1 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': 'b1dbbc8509c67b6db5561fa52dc96edae54f8c4c', + 'skia_revision': '4c0b5c4b79dd14bee32d8a527aeaa3c26c72d3a1', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 99bf35df50054..d458249d4b263 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 025a0970375165e70c82931c7f396b9b +Signature: 773b8566db32d423f48fcab290b8b52c UNUSED LICENSES: From ef3cbe8acccdcd18d36a2955952fdc7177ac6c21 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 23 Mar 2019 19:49:49 -0400 Subject: [PATCH 0547/1117] Roll src/third_party/skia 4c0b5c4b79dd..97d957d1db65 (1 commits) (#8284) https://skia.googlesource.com/skia.git/%2Blog/4c0b5c4b79dd..97d957d1db65 git log 4c0b5c4b79dd14bee32d8a527aeaa3c26c72d3a1..97d957d1db657f8bbcec3db5fdddd5868ab9512e --date=short --no-merges --format=%ad %ae %s 2019-03-22 brianosman@google.com Remove GrDrawAtlasOp The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (brianosman@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index fe3950b4632a1..afd78ca3015e8 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': '4c0b5c4b79dd14bee32d8a527aeaa3c26c72d3a1', + 'skia_revision': '97d957d1db657f8bbcec3db5fdddd5868ab9512e', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index d458249d4b263..a8d52dc9f41af 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 773b8566db32d423f48fcab290b8b52c +Signature: f2606196c58bd731894bfe690e9bd95f UNUSED LICENSES: @@ -3805,8 +3805,6 @@ FILE: ../../../third_party/skia/src/gpu/ops/GrCopySurfaceOp.cpp FILE: ../../../third_party/skia/src/gpu/ops/GrCopySurfaceOp.h FILE: ../../../third_party/skia/src/gpu/ops/GrDashLinePathRenderer.cpp FILE: ../../../third_party/skia/src/gpu/ops/GrDashLinePathRenderer.h -FILE: ../../../third_party/skia/src/gpu/ops/GrDrawAtlasOp.cpp -FILE: ../../../third_party/skia/src/gpu/ops/GrDrawAtlasOp.h FILE: ../../../third_party/skia/src/gpu/ops/GrDrawOp.h FILE: ../../../third_party/skia/src/gpu/ops/GrDrawPathOp.cpp FILE: ../../../third_party/skia/src/gpu/ops/GrDrawPathOp.h From cee2bd73295ddd464ae7d555fae744d85f698224 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 23 Mar 2019 23:19:28 -0400 Subject: [PATCH 0548/1117] Roll src/third_party/skia 97d957d1db65..ab4c138c0ef3 (3 commits) (#8285) https://skia.googlesource.com/skia.git/%2Blog/97d957d1db65..ab4c138c0ef3 git log 97d957d1db657f8bbcec3db5fdddd5868ab9512e..ab4c138c0ef38ba1451698defb9b2b9518b96525 --date=short --no-merges --format=%ad %ae %s 2019-03-24 brianosman@google.com Revert "Simplify two more clients of proxy provider (mipped vs. non-mipped)" 2019-03-24 brianosman@google.com Revert "Remove GrDrawAtlasOp" 2019-03-23 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 3d76aaf8edee..0a4f8d5b63f5 (139 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index afd78ca3015e8..a53bdc2d4108c 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': '97d957d1db657f8bbcec3db5fdddd5868ab9512e', + 'skia_revision': 'ab4c138c0ef38ba1451698defb9b2b9518b96525', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a8d52dc9f41af..db449945914b7 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f2606196c58bd731894bfe690e9bd95f +Signature: 096e6f6942d9d327f4648d588e7923ad UNUSED LICENSES: @@ -3805,6 +3805,8 @@ FILE: ../../../third_party/skia/src/gpu/ops/GrCopySurfaceOp.cpp FILE: ../../../third_party/skia/src/gpu/ops/GrCopySurfaceOp.h FILE: ../../../third_party/skia/src/gpu/ops/GrDashLinePathRenderer.cpp FILE: ../../../third_party/skia/src/gpu/ops/GrDashLinePathRenderer.h +FILE: ../../../third_party/skia/src/gpu/ops/GrDrawAtlasOp.cpp +FILE: ../../../third_party/skia/src/gpu/ops/GrDrawAtlasOp.h FILE: ../../../third_party/skia/src/gpu/ops/GrDrawOp.h FILE: ../../../third_party/skia/src/gpu/ops/GrDrawPathOp.cpp FILE: ../../../third_party/skia/src/gpu/ops/GrDrawPathOp.h From d2bba21af27a8d3f30c66aa014f324c786f3fb4e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 24 Mar 2019 02:48:41 -0400 Subject: [PATCH 0549/1117] Roll src/third_party/skia ab4c138c0ef3..d79c95e8bcf2 (2 commits) (#8286) https://skia.googlesource.com/skia.git/%2Blog/ab4c138c0ef3..d79c95e8bcf2 git log ab4c138c0ef38ba1451698defb9b2b9518b96525..d79c95e8bcf26ea406d0403e7ff460a5dd55b60d --date=short --no-merges --format=%ad %ae %s 2019-03-24 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-03-24 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 a88c1f9c8b34..eae464dd3092 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index a53bdc2d4108c..4d2e6c60b185f 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': 'ab4c138c0ef38ba1451698defb9b2b9518b96525', + 'skia_revision': 'd79c95e8bcf26ea406d0403e7ff460a5dd55b60d', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index db449945914b7..08daf3b5abd89 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 096e6f6942d9d327f4648d588e7923ad +Signature: c7e6219f52249aeda54aea32b7118d13 UNUSED LICENSES: From dcc72c7176bcaa9fc9fa3798542f764ca6fe4ebc Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 24 Mar 2019 06:16:54 -0400 Subject: [PATCH 0550/1117] Roll src/third_party/skia d79c95e8bcf2..e9a53fe3526a (1 commits) (#8287) https://skia.googlesource.com/skia.git/%2Blog/d79c95e8bcf2..e9a53fe3526a git log d79c95e8bcf26ea406d0403e7ff460a5dd55b60d..e9a53fe3526ab3e485d54f7fc27c48c69e68ca9b --date=short --no-merges --format=%ad %ae %s 2019-03-23 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4d2e6c60b185f..0f1232912ecf4 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': 'd79c95e8bcf26ea406d0403e7ff460a5dd55b60d', + 'skia_revision': 'e9a53fe3526ab3e485d54f7fc27c48c69e68ca9b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 08daf3b5abd89..ddce2b73d48b8 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c7e6219f52249aeda54aea32b7118d13 +Signature: ce468a556e8599c1aa26f169b0bb015a UNUSED LICENSES: From b5813917fa17b2dbd94f933a280529d0c746c203 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 24 Mar 2019 21:31:54 -0400 Subject: [PATCH 0551/1117] Roll src/third_party/skia e9a53fe3526a..c9f746cfb9f4 (1 commits) (#8288) https://skia.googlesource.com/skia.git/%2Blog/e9a53fe3526a..c9f746cfb9f4 git log e9a53fe3526ab3e485d54f7fc27c48c69e68ca9b..c9f746cfb9f4d9257c35b2162724a99f378692cf --date=short --no-merges --format=%ad %ae %s 2019-03-25 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 0a4f8d5b63f5..40ce19f3a56f (30 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 0f1232912ecf4..4dd7e4464853c 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': 'e9a53fe3526ab3e485d54f7fc27c48c69e68ca9b', + 'skia_revision': 'c9f746cfb9f4d9257c35b2162724a99f378692cf', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index ddce2b73d48b8..de3257685e253 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ce468a556e8599c1aa26f169b0bb015a +Signature: 28931841d4d5f61bf72dfb6edaed4891 UNUSED LICENSES: From 1b1209881044db2242e765787b903d513a6d67e7 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 25 Mar 2019 05:23:55 -0400 Subject: [PATCH 0552/1117] Roll src/third_party/skia c9f746cfb9f4..2e2fa9e3a06b (1 commits) (#8290) https://skia.googlesource.com/skia.git/%2Blog/c9f746cfb9f4..2e2fa9e3a06b git log c9f746cfb9f4d9257c35b2162724a99f378692cf..2e2fa9e3a06b679026d206ef5ebd2f195f331da9 --date=short --no-merges --format=%ad %ae %s 2019-03-25 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader e276f52bb4c9..62f62a6efa2c (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4dd7e4464853c..1541f64108298 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': 'c9f746cfb9f4d9257c35b2162724a99f378692cf', + 'skia_revision': '2e2fa9e3a06b679026d206ef5ebd2f195f331da9', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index de3257685e253..472a2d4bd8c49 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 28931841d4d5f61bf72dfb6edaed4891 +Signature: 2a4db29d3e2278e6c8a9f5d472093655 UNUSED LICENSES: From fcc63e7d0d90c968cd330738389b3da58ab45c75 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 25 Mar 2019 08:53:58 -0400 Subject: [PATCH 0553/1117] Roll src/third_party/skia 2e2fa9e3a06b..cd54466473fe (2 commits) (#8291) https://skia.googlesource.com/skia.git/%2Blog/2e2fa9e3a06b..cd54466473fe git log 2e2fa9e3a06b679026d206ef5ebd2f195f331da9..cd54466473fe5fdc462c6dac6def8b327ad58263 --date=short --no-merges --format=%ad %ae %s 2019-03-22 kjlubick@google.com Expose gpu cache knobs 2019-03-25 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 1541f64108298..f4b1e81997c52 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': '2e2fa9e3a06b679026d206ef5ebd2f195f331da9', + 'skia_revision': 'cd54466473fe5fdc462c6dac6def8b327ad58263', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 472a2d4bd8c49..7571c83ddd371 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2a4db29d3e2278e6c8a9f5d472093655 +Signature: 9c4e8e1b5530f5f42dced2baba4f1461 UNUSED LICENSES: From 3a445cec8a51056e5903c12659b6fc97138e57db Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 25 Mar 2019 12:23:01 -0400 Subject: [PATCH 0554/1117] Roll src/third_party/skia cd54466473fe..42197c0bc68e (10 commits) (#8292) https://skia.googlesource.com/skia.git/%2Blog/cd54466473fe..42197c0bc68e git log cd54466473fe5fdc462c6dac6def8b327ad58263..42197c0bc68e4c109fad2f3665bf05ac0556ab0e --date=short --no-merges --format=%ad %ae %s 2019-03-25 brianosman@google.com Add support for 1010102 on ES2 devices with EXT_texture_type_2_10_10_10_REV 2019-03-25 rmistry@google.com Add new Intel x86_64 CPU SkottieTracing bot 2019-03-25 michaelludwig@google.com Respect stroke width in Android rrect clip optimization 2019-03-25 rmistry@google.com [Recipe] Add CPU bot capability to perf_skottietrace.py 2019-03-25 kjlubick@google.com Generate GrGLInterface and GrGlAssembleInterface* from table 2019-03-25 brianosman@google.com Reland "Simplify two more clients of proxy provider (mipped vs. non-mipped)" 2019-03-25 brianosman@google.com SkBaseDevice::drawAtlas doesn't antialias either, so remove fallback 2019-03-25 rmistry@google.com [Recipe Modules] Make DefaultFlavor.step signature match the other step funcs 2019-03-25 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 62f62a6efa2c..e24bc66dcda3 (1 commits) 2019-03-25 rmistry@google.com [Recipe Modules] remove_file_on_device was in all flavors except DefaultFlavor The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f4b1e81997c52..dafee40bce8ff 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': 'cd54466473fe5fdc462c6dac6def8b327ad58263', + 'skia_revision': '42197c0bc68e4c109fad2f3665bf05ac0556ab0e', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 7571c83ddd371..1501dbc822359 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 9c4e8e1b5530f5f42dced2baba4f1461 +Signature: f368701a4592543393e79f177469fc95 UNUSED LICENSES: @@ -2267,6 +2267,7 @@ FILE: ../../../third_party/skia/infra/bots/recipes/perf_pathkit.expected/Perf-De 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/perf_skottietrace.expected/Perf-Android-Clang-AndroidOne-GPU-Mali400MP2-arm-Release-All-Android_SkottieTracing.json +FILE: ../../../third_party/skia/infra/bots/recipes/perf_skottietrace.expected/Perf-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-SkottieTracing.json FILE: ../../../third_party/skia/infra/bots/recipes/perf_skottietrace.expected/skottietracing_parse_trace_error.json FILE: ../../../third_party/skia/infra/bots/recipes/perf_skottietrace.expected/skottietracing_trybot.json FILE: ../../../third_party/skia/infra/bots/recipes/recreate_skps.expected/Housekeeper-Nightly-RecreateSKPs_Canary.json @@ -2967,6 +2968,7 @@ FILE: ../../../third_party/skia/src/gpu/gl/GrGLGpu.h FILE: ../../../third_party/skia/src/gpu/gl/GrGLGpuProgramCache.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLIRect.h FILE: ../../../third_party/skia/src/gpu/gl/GrGLInterface.cpp +FILE: ../../../third_party/skia/src/gpu/gl/GrGLInterfaceAutogen.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLMakeNativeInterface_none.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLProgram.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLProgram.h @@ -5868,6 +5870,8 @@ FILE: ../../../third_party/skia/modules/particles/src/SkParticleDrawable.cpp FILE: ../../../third_party/skia/modules/particles/src/SkParticleEffect.cpp FILE: ../../../third_party/skia/modules/particles/src/SkReflected.cpp FILE: ../../../third_party/skia/src/core/SkColorFilterPriv.h +FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleGLESInterfaceAutogen.cpp +FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleGLInterfaceAutogen.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleHelpers.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleInterface_gl.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleInterface_gles.cpp From d6ead18f436fe439063190093ac2184559f30bb3 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 25 Mar 2019 11:58:38 -0700 Subject: [PATCH 0555/1117] Make it easy to write embedder unit tests by creating a fixture and config builder. (#8276) All embedder unit-tests have to setup the Flutter project arguments from scratch before launching the engine. The boilerplate and having to deal with the low level C API during each engine launch is a hinderance to writing tests. This patch introduces an EmbedderTest fixture that sets up all the embedder side snapshots before allowing the unit test to create a FlutterConfigBuilder` that the test can use to incrementally build and edit the Flutter project configuration. From the given state state of a configuration, multiple engines can be launched with their lifecylces managed by appropriate RAII wrappers. This allows the a fully configured Flutter engine to be launched using 4 lines of code in a fixture. ``` EmbedderConfigBuilder builder; builder.SetSoftwareRendererConfig(); builder.SetAssetsPathFromFixture(this); builder.SetSnapshotsFromFixture(this); auto engine = builder.LaunchEngine(); ``` --- shell/platform/embedder/BUILD.gn | 4 + .../embedder/tests/embedder_config_builder.cc | 67 +++++++++++++++ .../embedder/tests/embedder_config_builder.h | 55 ++++++++++++ .../platform/embedder/tests/embedder_test.cc | 86 +++++++++++++++++++ shell/platform/embedder/tests/embedder_test.h | 54 ++++++++++++ .../embedder/tests/embedder_unittests.cc | 53 +++++++++--- 6 files changed, 308 insertions(+), 11 deletions(-) create mode 100644 shell/platform/embedder/tests/embedder_config_builder.cc create mode 100644 shell/platform/embedder/tests/embedder_config_builder.h create mode 100644 shell/platform/embedder/tests/embedder_test.cc create mode 100644 shell/platform/embedder/tests/embedder_test.h diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index 94aa7affabae8..1b7a81b844551 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -68,6 +68,10 @@ executable("embedder_unittests") { include_dirs = [ "." ] sources = [ + "tests/embedder_config_builder.cc", + "tests/embedder_config_builder.h", + "tests/embedder_test.cc", + "tests/embedder_test.h", "tests/embedder_unittests.cc", ] diff --git a/shell/platform/embedder/tests/embedder_config_builder.cc b/shell/platform/embedder/tests/embedder_config_builder.cc new file mode 100644 index 0000000000000..108535ea8b619 --- /dev/null +++ b/shell/platform/embedder/tests/embedder_config_builder.cc @@ -0,0 +1,67 @@ +// Copyright 2013 The Flutter 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/tests/embedder_config_builder.h" + +namespace shell { +namespace testing { + +EmbedderConfigBuilder::EmbedderConfigBuilder() { + project_args_.struct_size = sizeof(project_args_); + + software_renderer_config_.struct_size = sizeof(FlutterSoftwareRendererConfig); + software_renderer_config_.surface_present_callback = + [](void*, const void*, size_t, size_t) { return true; }; +} + +EmbedderConfigBuilder::~EmbedderConfigBuilder() = default; + +void EmbedderConfigBuilder::SetSoftwareRendererConfig() { + renderer_config_.type = FlutterRendererType::kSoftware; + renderer_config_.software = software_renderer_config_; +} + +void EmbedderConfigBuilder::SetAssetsPathFromFixture( + const EmbedderTest* fixture) { + assets_path_ = fixture->GetAssetsPath(); + project_args_.assets_path = assets_path_.c_str(); +} + +void EmbedderConfigBuilder::SetSnapshotsFromFixture( + const EmbedderTest* fixture) { + if (auto mapping = fixture->GetVMSnapshotData()) { + project_args_.vm_snapshot_data = mapping->GetMapping(); + project_args_.vm_snapshot_data_size = mapping->GetSize(); + } + + if (auto mapping = fixture->GetVMSnapshotInstructions()) { + project_args_.vm_snapshot_instructions = mapping->GetMapping(); + project_args_.vm_snapshot_instructions_size = mapping->GetSize(); + } + + if (auto mapping = fixture->GetIsolateSnapshotData()) { + project_args_.isolate_snapshot_data = mapping->GetMapping(); + project_args_.isolate_snapshot_data_size = mapping->GetSize(); + } + + if (auto mapping = fixture->GetIsolateSnapshotInstructions()) { + project_args_.isolate_snapshot_instructions = mapping->GetMapping(); + project_args_.isolate_snapshot_instructions_size = mapping->GetSize(); + } +} + +UniqueEngine EmbedderConfigBuilder::LaunchEngine(void* user_data) const { + FlutterEngine engine = nullptr; + auto result = FlutterEngineRun(FLUTTER_ENGINE_VERSION, &renderer_config_, + &project_args_, user_data, &engine); + + if (result != kSuccess) { + return {}; + } + + return UniqueEngine{engine}; +} + +} // namespace testing +} // namespace shell diff --git a/shell/platform/embedder/tests/embedder_config_builder.h b/shell/platform/embedder/tests/embedder_config_builder.h new file mode 100644 index 0000000000000..a474f3e3bc81c --- /dev/null +++ b/shell/platform/embedder/tests/embedder_config_builder.h @@ -0,0 +1,55 @@ +// Copyright 2013 The Flutter 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_EMBEDDER_TESTS_EMBEDDER_CONFIG_BUILDER_H_ +#define FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_CONFIG_BUILDER_H_ + +#include "flutter/fml/macros.h" +#include "flutter/fml/unique_object.h" +#include "flutter/shell/platform/embedder/embedder.h" +#include "flutter/shell/platform/embedder/tests/embedder_test.h" + +namespace shell { +namespace testing { + +struct UniqueEngineTraits { + static FlutterEngine InvalidValue() { return nullptr; } + + static bool IsValid(const FlutterEngine& value) { return value != nullptr; } + + static void Free(FlutterEngine engine) { + auto result = FlutterEngineShutdown(engine); + FML_CHECK(result == kSuccess); + } +}; + +using UniqueEngine = fml::UniqueObject; + +class EmbedderConfigBuilder { + public: + EmbedderConfigBuilder(); + + ~EmbedderConfigBuilder(); + + void SetSoftwareRendererConfig(); + + void SetAssetsPathFromFixture(const EmbedderTest* fixture); + + void SetSnapshotsFromFixture(const EmbedderTest* fixture); + + UniqueEngine LaunchEngine(void* user_data = nullptr) const; + + private: + FlutterProjectArgs project_args_ = {}; + FlutterRendererConfig renderer_config_ = {}; + FlutterSoftwareRendererConfig software_renderer_config_ = {}; + std::string assets_path_; + + FML_DISALLOW_COPY_AND_ASSIGN(EmbedderConfigBuilder); +}; + +} // namespace testing +} // namespace shell + +#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_CONFIG_BUILDER_H_ diff --git a/shell/platform/embedder/tests/embedder_test.cc b/shell/platform/embedder/tests/embedder_test.cc new file mode 100644 index 0000000000000..044aacc4dfc70 --- /dev/null +++ b/shell/platform/embedder/tests/embedder_test.cc @@ -0,0 +1,86 @@ +// Copyright 2013 The Flutter 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/tests/embedder_test.h" + +namespace shell { +namespace testing { + +static std::unique_ptr GetMapping(const fml::UniqueFD& directory, + const char* path, + bool executable) { + fml::UniqueFD file = fml::OpenFile(directory, path, false /* create */, + fml::FilePermission::kRead); + if (!file.is_valid()) { + return nullptr; + } + + using Prot = fml::FileMapping::Protection; + std::unique_ptr mapping; + if (executable) { + mapping = std::make_unique( + file, std::initializer_list{Prot::kRead, Prot::kExecute}); + } else { + mapping = std::make_unique( + file, std::initializer_list{Prot::kRead}); + } + + if (mapping->GetSize() == 0 || mapping->GetMapping() == nullptr) { + return nullptr; + } + + return mapping; +} + +EmbedderTest::EmbedderTest() = default; + +EmbedderTest::~EmbedderTest() = default; + +std::string EmbedderTest::GetFixturesDirectory() const { + return ::testing::GetFixturesPath(); +} + +std::string EmbedderTest::GetAssetsPath() const { + return GetFixturesDirectory(); +} + +const fml::Mapping* EmbedderTest::GetVMSnapshotData() const { + return vm_snapshot_data_.get(); +} + +const fml::Mapping* EmbedderTest::GetVMSnapshotInstructions() const { + return vm_snapshot_instructions_.get(); +} + +const fml::Mapping* EmbedderTest::GetIsolateSnapshotData() const { + return isolate_snapshot_data_.get(); +} + +const fml::Mapping* EmbedderTest::GetIsolateSnapshotInstructions() const { + return isolate_snapshot_instructions_.get(); +} + +// |testing::Test| +void EmbedderTest::SetUp() { + auto fixures_dir = fml::OpenDirectory(GetFixturesDirectory().c_str(), false, + fml::FilePermission::kRead); + vm_snapshot_data_ = GetMapping(fixures_dir, "vm_snapshot_data", false); + vm_snapshot_instructions_ = + GetMapping(fixures_dir, "vm_snapshot_instr", true); + isolate_snapshot_data_ = + GetMapping(fixures_dir, "isolate_snapshot_data", false); + isolate_snapshot_instructions_ = + GetMapping(fixures_dir, "isolate_snapshot_instr", true); +} + +// |testing::Test| +void EmbedderTest::TearDown() { + vm_snapshot_data_.reset(); + vm_snapshot_instructions_.reset(); + isolate_snapshot_data_.reset(); + isolate_snapshot_instructions_.reset(); +} + +} // namespace testing +} // namespace shell diff --git a/shell/platform/embedder/tests/embedder_test.h b/shell/platform/embedder/tests/embedder_test.h new file mode 100644 index 0000000000000..f861e3b7267fc --- /dev/null +++ b/shell/platform/embedder/tests/embedder_test.h @@ -0,0 +1,54 @@ +// Copyright 2013 The Flutter 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_EMBEDDER_TESTS_EMBEDDER_TEST_H_ +#define FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_H_ + +#include + +#include "flutter/fml/file.h" +#include "flutter/fml/macros.h" +#include "flutter/fml/mapping.h" +#include "flutter/testing/testing.h" + +namespace shell { +namespace testing { + +class EmbedderTest : public ::testing::Test { + public: + EmbedderTest(); + + ~EmbedderTest() override; + + std::string GetFixturesDirectory() const; + + std::string GetAssetsPath() const; + + const fml::Mapping* GetVMSnapshotData() const; + + const fml::Mapping* GetVMSnapshotInstructions() const; + + const fml::Mapping* GetIsolateSnapshotData() const; + + const fml::Mapping* GetIsolateSnapshotInstructions() const; + + private: + std::unique_ptr vm_snapshot_data_; + std::unique_ptr vm_snapshot_instructions_; + std::unique_ptr isolate_snapshot_data_; + std::unique_ptr isolate_snapshot_instructions_; + + // |testing::Test| + void SetUp() override; + + // |testing::Test| + void TearDown() override; + + FML_DISALLOW_COPY_AND_ASSIGN(EmbedderTest); +}; + +} // namespace testing +} // namespace shell + +#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_H_ diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc index f1345227c3aa8..7415183eb6792 100644 --- a/shell/platform/embedder/tests/embedder_unittests.cc +++ b/shell/platform/embedder/tests/embedder_unittests.cc @@ -6,16 +6,20 @@ #include "embedder.h" #include "flutter/fml/file.h" #include "flutter/fml/mapping.h" +#include "flutter/shell/platform/embedder/tests/embedder_config_builder.h" +#include "flutter/shell/platform/embedder/tests/embedder_test.h" #include "flutter/testing/testing.h" -namespace { +namespace shell { +namespace testing { -void MapAOTAsset(std::vector>& aot_mappings, - const fml::UniqueFD& fixtures_dir, - const char* path, - bool executable, - const uint8_t** data, - size_t* size) { +static void MapAOTAsset( + std::vector>& aot_mappings, + const fml::UniqueFD& fixtures_dir, + const char* path, + bool executable, + const uint8_t** data, + size_t* size) { fml::UniqueFD file = fml::OpenFile(fixtures_dir, path, false, fml::FilePermission::kRead); std::unique_ptr mapping; @@ -34,8 +38,6 @@ void MapAOTAsset(std::vector>& aot_mappings, aot_mappings.emplace_back(std::move(mapping)); } -} // anonymous namespace - TEST(EmbedderTest, MustNotRunWithInvalidArgs) { FlutterEngine engine = nullptr; FlutterRendererConfig config = {}; @@ -58,14 +60,14 @@ TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) { FlutterProjectArgs args = {}; args.struct_size = sizeof(FlutterProjectArgs); - args.assets_path = testing::GetFixturesPath(); + args.assets_path = ::testing::GetFixturesPath(); args.root_isolate_create_callback = [](void* data) { std::string str_data = reinterpret_cast(data); ASSERT_EQ(str_data, "Data"); }; fml::UniqueFD fixtures_dir = fml::OpenDirectory( - testing::GetFixturesPath(), false, fml::FilePermission::kRead); + ::testing::GetFixturesPath(), false, fml::FilePermission::kRead); std::vector> aot_mappings; if (fml::FileExists(fixtures_dir, "vm_snapshot_data")) { MapAOTAsset(aot_mappings, fixtures_dir, "vm_snapshot_data", false, @@ -90,3 +92,32 @@ TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) { result = FlutterEngineShutdown(engine); ASSERT_EQ(result, FlutterEngineResult::kSuccess); } + +using EmbedderFixture = testing::EmbedderTest; + +TEST_F(EmbedderFixture, CanLaunchAndShutdownWithFixture) { + EmbedderConfigBuilder builder; + + builder.SetSoftwareRendererConfig(); + builder.SetAssetsPathFromFixture(this); + builder.SetSnapshotsFromFixture(this); + + auto engine = builder.LaunchEngine(); + ASSERT_TRUE(engine.is_valid()); +} + +TEST_F(EmbedderFixture, CanLaunchAndShutdownWithFixtureMultipleTimes) { + EmbedderConfigBuilder builder; + + builder.SetSoftwareRendererConfig(); + builder.SetAssetsPathFromFixture(this); + builder.SetSnapshotsFromFixture(this); + for (size_t i = 0; i < 100; ++i) { + auto engine = builder.LaunchEngine(); + ASSERT_TRUE(engine.is_valid()); + FML_LOG(INFO) << "Engine launch count: " << i + 1; + } +} + +} // namespace testing +} // namespace shell \ No newline at end of file From dd6be2fd83710de8392fb554927a5d495684a13e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 25 Mar 2019 15:53:55 -0400 Subject: [PATCH 0556/1117] Roll src/third_party/skia 42197c0bc68e..15dc59e65cfa (19 commits) (#8294) https://skia.googlesource.com/skia.git/%2Blog/42197c0bc68e..15dc59e65cfa git log 42197c0bc68e4c109fad2f3665bf05ac0556ab0e..15dc59e65cfa9b06f1505d6e44e6dbb0e52ecf6a --date=short --no-merges --format=%ad %ae %s 2019-03-25 brianosman@google.com Stop supporting VC8 (Visual Studio 2005) in GrConfig 2019-03-22 ericrk@chromium.org Ensure we don't skip image memory barriers when queue change needed 2019-03-25 mtklein@google.com spin off :trace target 2019-03-25 brianosman@google.com Fix doc comment error for allocN32Pixels 2019-03-22 scroggo@google.com Only dereference imgcfg if non-null 2019-03-25 kjlubick@google.com Revert "Generate GrGLInterface and GrGlAssembleInterface* from table" 2019-03-25 brianosman@google.com Remove bookmaker sources and data files 2019-03-25 mtklein@google.com clean up stray libpng deps 2019-03-25 egdaniel@google.com Add option to disable vsync on viewer unix. 2019-03-25 brianosman@google.com Clean up texture domain effect GM, wrt proxy creation 2019-03-25 brianosman@google.com Stop flooding perf with uninteresting GPU stats 2019-03-25 egdaniel@google.com Fix up readPixels, writePixels, and copies when dealing with ycbcr textures in vulkan. 2019-03-25 mtklein@google.com de-common the rest of the flags 2019-03-25 kjlubick@google.com Delete in favor of autogenerated file 2019-03-25 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 eae464dd3092..9078c6a7199b (1 commits) 2019-03-25 brianosman@google.com Fix GM that was trying to create mip-mapped proxies without checking caps 2019-03-25 bsalomon@google.com Avoid special shader for opaque alpha when drawing simple rectangles. 2019-03-25 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader e24bc66dcda3..221459f4ecc9 (1 commits) 2019-03-25 kjlubick@google.com Delete old assembleInterface code The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 42 +------------------------------- 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/DEPS b/DEPS index dafee40bce8ff..5cfda524794a5 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': '42197c0bc68e4c109fad2f3665bf05ac0556ab0e', + 'skia_revision': '15dc59e65cfa9b06f1505d6e44e6dbb0e52ecf6a', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 1501dbc822359..9c875da408749 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f368701a4592543393e79f177469fc95 +Signature: 3d12a6d1a684e5f3b41c4b66c54bc5e7 UNUSED LICENSES: @@ -2025,43 +2025,6 @@ 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 -FILE: ../../../third_party/skia/docs/SkColor_Reference.bmh -FILE: ../../../third_party/skia/docs/SkDynamicMemoryWStream_Reference.bmh -FILE: ../../../third_party/skia/docs/SkFILEStream_Reference.bmh -FILE: ../../../third_party/skia/docs/SkFILEWStream_Reference.bmh -FILE: ../../../third_party/skia/docs/SkFont_Reference.bmh -FILE: ../../../third_party/skia/docs/SkIPoint_Reference.bmh -FILE: ../../../third_party/skia/docs/SkIRect_Reference.bmh -FILE: ../../../third_party/skia/docs/SkImageInfo_Reference.bmh -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 -FILE: ../../../third_party/skia/docs/SkPoint_Reference.bmh -FILE: ../../../third_party/skia/docs/SkRRect_Reference.bmh -FILE: ../../../third_party/skia/docs/SkRect_Reference.bmh -FILE: ../../../third_party/skia/docs/SkRegion_Reference.bmh -FILE: ../../../third_party/skia/docs/SkStream_Reference.bmh -FILE: ../../../third_party/skia/docs/SkSurface_Reference.bmh -FILE: ../../../third_party/skia/docs/SkTextBlobBuilder_Reference.bmh -FILE: ../../../third_party/skia/docs/SkTextBlob_Reference.bmh -FILE: ../../../third_party/skia/docs/SkWStream_Reference.bmh -FILE: ../../../third_party/skia/docs/illustrations.bmh -FILE: ../../../third_party/skia/docs/markup.bmh -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/docs/animationCommon.js FILE: ../../../third_party/skia/experimental/docs/backend.js FILE: ../../../third_party/skia/experimental/docs/canvasBackend.js @@ -2968,7 +2931,6 @@ FILE: ../../../third_party/skia/src/gpu/gl/GrGLGpu.h FILE: ../../../third_party/skia/src/gpu/gl/GrGLGpuProgramCache.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLIRect.h FILE: ../../../third_party/skia/src/gpu/gl/GrGLInterface.cpp -FILE: ../../../third_party/skia/src/gpu/gl/GrGLInterfaceAutogen.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLMakeNativeInterface_none.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLProgram.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLProgram.h @@ -5870,8 +5832,6 @@ FILE: ../../../third_party/skia/modules/particles/src/SkParticleDrawable.cpp FILE: ../../../third_party/skia/modules/particles/src/SkParticleEffect.cpp FILE: ../../../third_party/skia/modules/particles/src/SkReflected.cpp FILE: ../../../third_party/skia/src/core/SkColorFilterPriv.h -FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleGLESInterfaceAutogen.cpp -FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleGLInterfaceAutogen.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleHelpers.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleInterface_gl.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleInterface_gles.cpp From 345ae7d3732511572a7b93b30459128445366754 Mon Sep 17 00:00:00 2001 From: Amir Hardon Date: Mon, 25 Mar 2019 14:26:49 -0700 Subject: [PATCH 0557/1117] Delegate a11y events and action to/from embedded Android platform views. (#8250) Delegate a11y events and action to/from embedded Android platfrom views. This handles delegation of: * AccessibilityNodeProvider#performAction * ViewGroup#requestSendAccessibilityEvent * View#onHoverEvent Additionally updates the currently input accessibility focused node state that is tracked by the a11y bridge when an embedded view's node is focused. --- ci/licenses_golden/licenses_flutter | 1 + shell/platform/android/BUILD.gn | 1 + .../platform/AccessibilityEventsDelegate.java | 49 ++++ .../platform/PlatformViewsController.java | 8 +- .../platform/SingleViewPresentation.java | 44 +++- .../platform/VirtualDisplayController.java | 12 +- .../io/flutter/view/AccessibilityBridge.java | 79 ++++++- .../view/AccessibilityViewEmbedder.java | 220 ++++++++++++++++-- 8 files changed, 376 insertions(+), 38 deletions(-) create mode 100644 shell/platform/android/io/flutter/plugin/platform/AccessibilityEventsDelegate.java diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 567ad251512b3..0a30b3ca65123 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -511,6 +511,7 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/common/StandardM 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/AccessibilityEventsDelegate.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 diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index 4244e7946bb85..090fdb28ff694 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -153,6 +153,7 @@ java_library("flutter_shell_java") { "io/flutter/plugin/common/StringCodec.java", "io/flutter/plugin/editing/InputConnectionAdaptor.java", "io/flutter/plugin/editing/TextInputPlugin.java", + "io/flutter/plugin/platform/AccessibilityEventsDelegate.java", "io/flutter/plugin/platform/PlatformPlugin.java", "io/flutter/plugin/platform/PlatformView.java", "io/flutter/plugin/platform/PlatformViewFactory.java", diff --git a/shell/platform/android/io/flutter/plugin/platform/AccessibilityEventsDelegate.java b/shell/platform/android/io/flutter/plugin/platform/AccessibilityEventsDelegate.java new file mode 100644 index 0000000000000..1a3022cfc9c42 --- /dev/null +++ b/shell/platform/android/io/flutter/plugin/platform/AccessibilityEventsDelegate.java @@ -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. + +package io.flutter.plugin.platform; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.view.View; +import android.view.accessibility.AccessibilityEvent; +import io.flutter.view.AccessibilityBridge; + +/** + * Delegates accessibility events to the currently attached accessibility bridge if one is attached. + */ +class AccessibilityEventsDelegate { + private AccessibilityBridge accessibilityBridge; + + /** + * Delegates handling of {@link android.view.ViewParent#requestSendAccessibilityEvent} to the accessibility bridge. + * + * This is a no-op if there is no accessibility delegate set. + * + * This is used by embedded platform views to propagate accessibility events from their view hierarchy to the + * accessibility bridge. + * + * As the embedded view doesn't have to be the only View in the embedded hierarchy (it can have child views) and the + * event might have been originated from any view in this hierarchy, this method gets both a reference to the + * embedded platform view, and a reference to the view from its hierarchy that sent the event. + * + * @param embeddedView the embedded platform view for which the event is delegated + * @param eventOrigin the view in the embedded view's hierarchy that sent the event. + * @return True if the event was sent. + */ + public boolean requestSendAccessibilityEvent(@NonNull View embeddedView, @NonNull View eventOrigin, @NonNull AccessibilityEvent event) { + if (accessibilityBridge == null) { + return false; + } + return accessibilityBridge.externalViewRequestSendAccessibilityEvent(embeddedView, eventOrigin, event); + } + + /* + * This setter should only be used directly in PlatformViewsController when attached/detached to an accessibility + * bridge. + */ + void setAccessibilityBridge(@Nullable AccessibilityBridge accessibilityBridge) { + this.accessibilityBridge = accessibilityBridge; + } +} diff --git a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java index f19fabd317e44..5470e03a9f2da 100644 --- a/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java +++ b/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java @@ -52,13 +52,14 @@ public class PlatformViewsController implements MethodChannel.MethodCallHandler, private BinaryMessenger mMessenger; // The accessibility bridge to which accessibility events form the platform views will be dispatched. - private AccessibilityBridge accessibilityBridge; + private final AccessibilityEventsDelegate mAccessibilityEventsDelegate; private final HashMap vdControllers; public PlatformViewsController() { mRegistry = new PlatformViewRegistryImpl(); vdControllers = new HashMap<>(); + mAccessibilityEventsDelegate = new AccessibilityEventsDelegate(); } /** @@ -100,12 +101,12 @@ public void detach() { @Override public void attachAccessibilityBridge(AccessibilityBridge accessibilityBridge) { - this.accessibilityBridge = accessibilityBridge; + mAccessibilityEventsDelegate.setAccessibilityBridge(accessibilityBridge); } @Override public void detachAccessibiltyBridge() { - this.accessibilityBridge = null; + mAccessibilityEventsDelegate.setAccessibilityBridge(null); } public PlatformViewRegistry getRegistry() { @@ -201,6 +202,7 @@ private void createPlatformView(MethodCall call, MethodChannel.Result result) { TextureRegistry.SurfaceTextureEntry textureEntry = mTextureRegistry.createSurfaceTexture(); VirtualDisplayController vdController = VirtualDisplayController.create( mContext, + mAccessibilityEventsDelegate, viewFactory, textureEntry, toPhysicalPixels(logicalWidth), diff --git a/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java b/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java index 24675bbbf8a28..a0cbde42b5494 100644 --- a/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java +++ b/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java @@ -13,6 +13,7 @@ import android.os.Bundle; import android.util.Log; import android.view.*; +import android.view.accessibility.AccessibilityEvent; import android.widget.FrameLayout; import java.lang.reflect.*; @@ -57,6 +58,9 @@ static class PresentationState { private final PlatformViewFactory mViewFactory; + // A reference to the current accessibility bridge to which accessibility events will be delegated. + private final AccessibilityEventsDelegate mAccessibilityEventsDelegate; + // This is the view id assigned by the Flutter framework to the embedded view, we keep it here // so when we create the platform view we can tell it its view id. private int mViewId; @@ -67,7 +71,7 @@ static class PresentationState { // The root view for the presentation, it has 2 childs: mContainer which contains the embedded view, and // mFakeWindowRootView which contains views that were added directly to the presentation's window manager. - private FrameLayout mRootView; + private AccessibilityDelegatingFrameLayout mRootView; // Contains the embedded platform view (mView.getView()) when it is attached to the presentation. private FrameLayout mContainer; @@ -82,10 +86,13 @@ public SingleViewPresentation( Context outerContext, Display display, PlatformViewFactory viewFactory, + AccessibilityEventsDelegate accessibilityEventsDelegate, int viewId, - Object createParams) { + Object createParams + ) { super(outerContext, display); mViewFactory = viewFactory; + mAccessibilityEventsDelegate = accessibilityEventsDelegate; mViewId = viewId; mCreateParams = createParams; mState = new PresentationState(); @@ -102,8 +109,14 @@ public SingleViewPresentation( *

    The display's density must match the density of the context used * when the view was created. */ - public SingleViewPresentation(Context outerContext, Display display, PresentationState state) { + public SingleViewPresentation( + Context outerContext, + Display display, + AccessibilityEventsDelegate accessibilityEventsDelegate, + PresentationState state + ) { super(outerContext, display); + mAccessibilityEventsDelegate = accessibilityEventsDelegate; mViewFactory = null; mState = state; getWindow().setFlags( @@ -130,8 +143,9 @@ protected void onCreate(Bundle savedInstanceState) { mState.mView = mViewFactory.create(context, mViewId, mCreateParams); } - mContainer.addView(mState.mView.getView()); - mRootView = new FrameLayout(getContext()); + View embeddedView = mState.mView.getView(); + mContainer.addView(embeddedView); + mRootView = new AccessibilityDelegatingFrameLayout(getContext(), mAccessibilityEventsDelegate, embeddedView); mRootView.addView(mContainer); mRootView.addView(mState.mFakeWindowRootView); setContentView(mRootView); @@ -320,4 +334,24 @@ private void updateViewLayout(Object[] args) { mFakeWindowRootView.updateViewLayout(view, layoutParams); } } + + private static class AccessibilityDelegatingFrameLayout extends FrameLayout { + private final AccessibilityEventsDelegate mAccessibilityEventsDelegate; + private final View mEmbeddedView; + + public AccessibilityDelegatingFrameLayout( + Context context, + AccessibilityEventsDelegate accessibilityEventsDelegate, + View ebeddedView + ) { + super(context); + mAccessibilityEventsDelegate = accessibilityEventsDelegate; + mEmbeddedView = ebeddedView; + } + + @Override + public boolean requestSendAccessibilityEvent(View child, AccessibilityEvent event) { + return mAccessibilityEventsDelegate.requestSendAccessibilityEvent(mEmbeddedView, child, event); + } + } } diff --git a/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java b/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java index 9985361762bcd..876e6be5cedc7 100644 --- a/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java +++ b/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java @@ -19,6 +19,7 @@ class VirtualDisplayController { public static VirtualDisplayController create( Context context, + AccessibilityEventsDelegate accessibilityEventsDelegate, PlatformViewFactory viewFactory, TextureRegistry.SurfaceTextureEntry textureEntry, int width, @@ -45,10 +46,11 @@ public static VirtualDisplayController create( } return new VirtualDisplayController( - context, virtualDisplay, viewFactory, surface, textureEntry, viewId, createParams); + context, accessibilityEventsDelegate, virtualDisplay, viewFactory, surface, textureEntry, viewId, createParams); } private final Context mContext; + private final AccessibilityEventsDelegate mAccessibilityEventsDelegate; private final int mDensityDpi; private final TextureRegistry.SurfaceTextureEntry mTextureEntry; private VirtualDisplay mVirtualDisplay; @@ -58,6 +60,7 @@ public static VirtualDisplayController create( private VirtualDisplayController( Context context, + AccessibilityEventsDelegate accessibilityEventsDelegate, VirtualDisplay virtualDisplay, PlatformViewFactory viewFactory, Surface surface, @@ -65,13 +68,14 @@ private VirtualDisplayController( int viewId, Object createParams ) { + mContext = context; + mAccessibilityEventsDelegate = accessibilityEventsDelegate; mTextureEntry = textureEntry; mSurface = surface; - mContext = context; mVirtualDisplay = virtualDisplay; mDensityDpi = context.getResources().getDisplayMetrics().densityDpi; mPresentation = new SingleViewPresentation( - context, mVirtualDisplay.getDisplay(), viewFactory, viewId, createParams); + context, mVirtualDisplay.getDisplay(), viewFactory, accessibilityEventsDelegate, viewId, createParams); mPresentation.show(); } @@ -121,7 +125,7 @@ public void run() { public void onViewDetachedFromWindow(View v) {} }); - mPresentation = new SingleViewPresentation(mContext, mVirtualDisplay.getDisplay(), presentationState); + mPresentation = new SingleViewPresentation(mContext, mVirtualDisplay.getDisplay(), mAccessibilityEventsDelegate, presentationState); mPresentation.show(); } diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index 7a798d3b37bd5..a589f54d4ca5d 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -5,9 +5,7 @@ package io.flutter.view; import android.annotation.TargetApi; -import android.app.Activity; import android.content.ContentResolver; -import android.content.Context; import android.database.ContentObserver; import android.graphics.Rect; import android.net.Uri; @@ -23,7 +21,6 @@ import android.view.MotionEvent; import android.view.View; import android.view.WindowInsets; -import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeInfo; @@ -158,9 +155,23 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { // The {@code SemanticsNode} within Flutter that currently has the focus of Android's // accessibility system. + // + // This is null when a node embedded by the AccessibilityViewEmbedder has the focus. @Nullable private SemanticsNode accessibilityFocusedSemanticsNode; + // The virtual ID of the currently embedded node with accessibility focus. + // + // This is the ID of a node generated by the AccessibilityViewEmbedder if an embedded node is focused, + // null otherwise. + private Integer embeddedAccessibilityFocusedNodeId; + + // The virtual ID of the currently embedded node with input focus. + // + // This is the ID of a node generated by the AccessibilityViewEmbedder if an embedded node is focused, + // null otherwise. + private Integer embeddedInputFocusedNodeId; + // The accessibility features that should currently be active within Flutter, represented as // a bitmask whose values comes from {@link AccessibilityFeature}. private int accessibilityFeatureFlags = 0; @@ -762,6 +773,14 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { */ @Override public boolean performAction(int virtualViewId, int accessibilityAction, @Nullable Bundle arguments) { + if (virtualViewId >= MIN_ENGINE_GENERATED_NODE_ID) { + // The node is in the engine generated range, and is handled by the accessibility view embedder. + boolean didPerform = accessibilityViewEmbedder.performAction(virtualViewId, accessibilityAction, arguments); + if (didPerform && accessibilityAction == AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS) { + embeddedAccessibilityFocusedNodeId = null; + } + return didPerform; + } SemanticsNode semanticsNode = flutterSemanticsTree.get(virtualViewId); if (semanticsNode == null) { return false; @@ -841,6 +860,7 @@ public boolean performAction(int virtualViewId, int accessibilityAction, @Nullab AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED ); accessibilityFocusedSemanticsNode = null; + embeddedAccessibilityFocusedNodeId = null; return true; } case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: { @@ -1014,12 +1034,18 @@ public AccessibilityNodeInfo findFocus(int focus) { if (inputFocusedSemanticsNode != null) { return createAccessibilityNodeInfo(inputFocusedSemanticsNode.id); } + if (embeddedInputFocusedNodeId != null) { + return createAccessibilityNodeInfo(embeddedInputFocusedNodeId); + } } // Fall through to check FOCUS_ACCESSIBILITY case AccessibilityNodeInfo.FOCUS_ACCESSIBILITY: { if (accessibilityFocusedSemanticsNode != null) { return createAccessibilityNodeInfo(accessibilityFocusedSemanticsNode.id); } + if (embeddedAccessibilityFocusedNodeId != null) { + return createAccessibilityNodeInfo(embeddedAccessibilityFocusedNodeId); + } } } return null; @@ -1090,6 +1116,11 @@ public boolean onAccessibilityHoverEvent(MotionEvent event) { return false; } + SemanticsNode semanticsNodeUnderCursor = getRootSemanticsNode().hitTest(new float[] {event.getX(), event.getY(), 0, 1}); + if (semanticsNodeUnderCursor.platformViewId != -1) { + return accessibilityViewEmbedder.onAccessibilityHoverEvent(semanticsNodeUnderCursor.id, event); + } + if (event.getAction() == MotionEvent.ACTION_HOVER_ENTER || event.getAction() == MotionEvent.ACTION_HOVER_MOVE) { handleTouchExploration(event.getX(), event.getY()); } else if (event.getAction() == MotionEvent.ACTION_HOVER_EXIT) { @@ -2061,4 +2092,46 @@ private String getValueLabelHint() { return sb.length() > 0 ? sb.toString() : null; } } + + /** + * Delegates handling of {@link android.view.ViewParent#requestSendAccessibilityEvent} to the accessibility bridge. + * + * This is used by embedded platform views to propagate accessibility events from their view hierarchy to the + * accessibility bridge. + * + * As the embedded view doesn't have to be the only View in the embedded hierarchy (it can have child views) and the + * event might have been originated from any view in this hierarchy, this method gets both a reference to the + * embedded platform view, and a reference to the view from its hierarchy that sent the event. + * + * @param embeddedView the embedded platform view for which the event is delegated + * @param eventOrigin the view in the embedded view's hierarchy that sent the event. + * @return True if the event was sent. + */ + public boolean externalViewRequestSendAccessibilityEvent(View embeddedView, View eventOrigin, AccessibilityEvent event) { + if (!accessibilityViewEmbedder.requestSendAccessibilityEvent(embeddedView, eventOrigin, event)){ + return false; + } + Integer virtualNodeId = accessibilityViewEmbedder.getRecordFlutterId(embeddedView, event); + if (virtualNodeId == null) { + return false; + } + switch(event.getEventType()) { + case AccessibilityEvent.TYPE_VIEW_HOVER_ENTER: + hoveredObject = null; + break; + case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED: + embeddedAccessibilityFocusedNodeId = virtualNodeId; + accessibilityFocusedSemanticsNode = null; + break; + case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED: + embeddedInputFocusedNodeId = null; + embeddedAccessibilityFocusedNodeId = null; + break; + case AccessibilityEvent.TYPE_VIEW_FOCUSED: + embeddedInputFocusedNodeId = virtualNodeId; + inputFocusedSemanticsNode = null; + break; + } + return true; + } } diff --git a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java index 1e5da786321bf..330ded624ddc0 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java +++ b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java @@ -6,11 +6,17 @@ import android.graphics.Rect; import android.os.Build; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.util.Log; import android.util.SparseArray; +import android.view.MotionEvent; import android.view.View; +import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeProvider; +import android.view.accessibility.AccessibilityRecord; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -53,7 +59,7 @@ class AccessibilityViewEmbedder { private int nextFlutterId; - AccessibilityViewEmbedder(View rootAccessibiiltyView, int firstVirtualNodeId) { + AccessibilityViewEmbedder(@NonNull View rootAccessibiiltyView, int firstVirtualNodeId) { reflectionAccessors = new ReflectionAccessors(); flutterIdToOrigin = new SparseArray<>(); this.rootAccessibilityView = rootAccessibiiltyView; @@ -68,24 +74,23 @@ class AccessibilityViewEmbedder { * @param flutterId the virtual accessibility ID for the node in flutter accessibility tree * @param displayBounds the display bounds for the node in screen coordinates */ - public AccessibilityNodeInfo getRootNode(View embeddedView, int flutterId, Rect displayBounds) { - return null; - // TODO(amirh): uncomment this once a11y events and actions are wired. - // AccessibilityNodeInfo originNode = embeddedView.createAccessibilityNodeInfo(); - // Long originPackedId = reflectionAccessors.getSourceNodeId(originNode); - // if (originPackedId == null) { - // return null; - // } - // int originId = ReflectionAccessors.getVirtualNodeId(originPackedId); - // flutterIdToOrigin.put(flutterId, new ViewAndId(embeddedView, originId)); - // flutterIdToDisplayBounds.put(flutterId, displayBounds); - // originToFlutterId.put(new ViewAndId(embeddedView, originId), flutterId); - // return convertToFlutterNode(originNode, flutterId, embeddedView); + public AccessibilityNodeInfo getRootNode(@NonNull View embeddedView, int flutterId, @NonNull Rect displayBounds) { + AccessibilityNodeInfo originNode = embeddedView.createAccessibilityNodeInfo(); + Long originPackedId = reflectionAccessors.getSourceNodeId(originNode); + if (originPackedId == null) { + return null; + } + int originId = ReflectionAccessors.getVirtualNodeId(originPackedId); + flutterIdToOrigin.put(flutterId, new ViewAndId(embeddedView, originId)); + flutterIdToDisplayBounds.put(flutterId, displayBounds); + originToFlutterId.put(new ViewAndId(embeddedView, originId), flutterId); + return convertToFlutterNode(originNode, flutterId, embeddedView); } /** * Creates the accessibility node info for the node identified with `flutterId`. */ + @Nullable public AccessibilityNodeInfo createAccessibilityNodeInfo(int flutterId) { ViewAndId origin = flutterIdToOrigin.get(flutterId); if (origin == null) { @@ -101,6 +106,9 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int flutterId) { } AccessibilityNodeInfo originNode = origin.view.getAccessibilityNodeProvider().createAccessibilityNodeInfo(origin.id); + if (originNode == null) { + return null; + } return convertToFlutterNode(originNode, flutterId, origin.view); } @@ -108,7 +116,12 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int flutterId) { * Creates an AccessibilityNodeInfo that can be attached to the Flutter accessibility tree and is equivalent to * originNode(which belongs to embeddedView). The virtual ID for the created node will be flutterId. */ - private AccessibilityNodeInfo convertToFlutterNode(AccessibilityNodeInfo originNode, int flutterId, View embeddedView) { + @NonNull + private AccessibilityNodeInfo convertToFlutterNode( + @NonNull AccessibilityNodeInfo originNode, + int flutterId, + @NonNull View embeddedView + ) { AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(rootAccessibilityView, flutterId); result.setPackageName(rootAccessibilityView.getContext().getPackageName()); result.setSource(rootAccessibilityView, flutterId); @@ -124,7 +137,11 @@ private AccessibilityNodeInfo convertToFlutterNode(AccessibilityNodeInfo originN return result; } - private void setFlutterNodeParent(AccessibilityNodeInfo originNode, View embeddedView, AccessibilityNodeInfo result) { + private void setFlutterNodeParent( + @NonNull AccessibilityNodeInfo originNode, + @NonNull View embeddedView, + @NonNull AccessibilityNodeInfo result + ) { Long parentOriginPackedId = reflectionAccessors.getParentNodeId(originNode); if (parentOriginPackedId == null) { return; @@ -137,7 +154,12 @@ private void setFlutterNodeParent(AccessibilityNodeInfo originNode, View embedde } - private void addChildrenToFlutterNode(AccessibilityNodeInfo originNode, View embeddedView, Rect displayBounds, AccessibilityNodeInfo resultNode) { + private void addChildrenToFlutterNode( + @NonNull AccessibilityNodeInfo originNode, + @NonNull View embeddedView, + @NonNull Rect displayBounds, + @NonNull AccessibilityNodeInfo resultNode + ) { for (int i = 0; i < originNode.getChildCount(); i++) { Long originPackedId = reflectionAccessors.getChildId(originNode, i); if (originPackedId == null) { @@ -158,7 +180,11 @@ private void addChildrenToFlutterNode(AccessibilityNodeInfo originNode, View emb } } - private void setFlutterNodesTranslateBounds(AccessibilityNodeInfo originNode, Rect displayBounds, AccessibilityNodeInfo resultNode) { + private void setFlutterNodesTranslateBounds( + @NonNull AccessibilityNodeInfo originNode, + @NonNull Rect displayBounds, + @NonNull AccessibilityNodeInfo resultNode + ) { Rect boundsInParent = new Rect(); originNode.getBoundsInParent(boundsInParent); resultNode.setBoundsInParent(boundsInParent); @@ -169,7 +195,7 @@ private void setFlutterNodesTranslateBounds(AccessibilityNodeInfo originNode, Re resultNode.setBoundsInScreen(boundsInScreen); } - private void copyAccessibilityFields(AccessibilityNodeInfo input, AccessibilityNodeInfo output) { + private void copyAccessibilityFields(@NonNull AccessibilityNodeInfo input, @NonNull AccessibilityNodeInfo output) { output.setAccessibilityFocused(input.isAccessibilityFocused()); output.setCheckable(input.isCheckable()); output.setChecked(input.isChecked()); @@ -220,6 +246,128 @@ private void copyAccessibilityFields(AccessibilityNodeInfo input, AccessibilityN } } + /** + * Delegates an AccessibilityNodeProvider#requestSendAccessibilityEvent from the AccessibilityBridge to the embedded + * view. + * + * @return True if the event was sent. + */ + public boolean requestSendAccessibilityEvent( + @NonNull View embeddedView, + @NonNull View eventOrigin, + @NonNull AccessibilityEvent event + ) { + AccessibilityEvent translatedEvent = AccessibilityEvent.obtain(event); + Long originPackedId = reflectionAccessors.getRecordSourceNodeId(event); + if (originPackedId == null) { + return false; + } + int originVirtualId = ReflectionAccessors.getVirtualNodeId(originPackedId); + Integer flutterId = originToFlutterId.get(new ViewAndId(embeddedView, originVirtualId)); + if (flutterId == null) { + return false; + } + translatedEvent.setSource(rootAccessibilityView, flutterId); + translatedEvent.setClassName(event.getClassName()); + translatedEvent.setPackageName(event.getPackageName()); + + for (int i = 0; i < translatedEvent.getRecordCount(); i++) { + AccessibilityRecord record = translatedEvent.getRecord(i); + Long recordOriginPackedId = reflectionAccessors.getRecordSourceNodeId(record); + if (recordOriginPackedId == null) { + return false; + } + int recordOriginVirtualID = ReflectionAccessors.getVirtualNodeId(recordOriginPackedId); + ViewAndId originViewAndId = new ViewAndId(embeddedView, recordOriginVirtualID); + if (!originToFlutterId.containsKey(originViewAndId)) { + return false; + } + int recordFlutterId = originToFlutterId.get(originViewAndId); + record.setSource(rootAccessibilityView, recordFlutterId); + } + + return rootAccessibilityView.getParent().requestSendAccessibilityEvent(eventOrigin, translatedEvent); + } + + /** + * Delegates an @{link AccessibilityNodeProvider#performAction} from the AccessibilityBridge to the embedded view's + * accessibility node provider. + * + * @return True if the action was performed. + */ + public boolean performAction(int flutterId, int accessibilityAction, @Nullable Bundle arguments) { + ViewAndId origin = flutterIdToOrigin.get(flutterId); + if (origin == null) { + return false; + } + View embeddedView = origin.view; + AccessibilityNodeProvider provider = embeddedView.getAccessibilityNodeProvider(); + if (provider == null) { + return false; + } + return provider.performAction(origin.id, accessibilityAction, arguments); + } + + /** + * Returns a flutterID for an accessibility record, or null if no mapping exists. + * + * @param embeddedView the embedded view that the record is associated with. + */ + @Nullable + public Integer getRecordFlutterId(@NonNull View embeddedView, @NonNull AccessibilityRecord record) { + Long originPackedId = reflectionAccessors.getRecordSourceNodeId(record); + if (originPackedId == null) { + return null; + } + int originVirtualId = ReflectionAccessors.getVirtualNodeId(originPackedId); + return originToFlutterId.get(new ViewAndId(embeddedView, originVirtualId)); + } + + /** + * Delegates a View#onHoverEvent event from the AccessibilityBridge to an embedded view. + * + * The pointer coordinates are translated to the embedded view's coordinate system. + */ + public boolean onAccessibilityHoverEvent(int rootFlutterId, @NonNull MotionEvent event) { + ViewAndId origin = flutterIdToOrigin.get(rootFlutterId); + if (origin == null) { + return false; + } + Rect displayBounds = flutterIdToDisplayBounds.get(rootFlutterId); + int pointerCount = event.getPointerCount(); + MotionEvent.PointerProperties[] pointerProperties = new MotionEvent.PointerProperties[pointerCount]; + MotionEvent.PointerCoords[] pointerCoords = new MotionEvent.PointerCoords[pointerCount]; + for(int i = 0; i < event.getPointerCount(); i++) { + pointerProperties[i] = new MotionEvent.PointerProperties(); + event.getPointerProperties(i, pointerProperties[i]); + + MotionEvent.PointerCoords originCoords = new MotionEvent.PointerCoords(); + event.getPointerCoords(i, originCoords); + + pointerCoords[i] = new MotionEvent.PointerCoords((originCoords)); + pointerCoords[i].x -= displayBounds.left; + pointerCoords[i].y -= displayBounds.top; + + } + MotionEvent translatedEvent = MotionEvent.obtain( + event.getDownTime(), + event.getEventTime(), + event.getAction(), + event.getPointerCount(), + pointerProperties, + pointerCoords, + event.getMetaState(), + event.getButtonState(), + event.getXPrecision(), + event.getYPrecision(), + event.getDeviceId(), + event.getEdgeFlags(), + event.getSource(), + event.getFlags() + ); + return origin.view.dispatchGenericMotionEvent(translatedEvent); + } + private static class ViewAndId { final View view; final int id; @@ -251,22 +399,29 @@ public int hashCode() { private static class ReflectionAccessors { private final Method getSourceNodeId; private final Method getParentNodeId; + private final Method getRecordSourceNodeId; private final Method getChildId; private ReflectionAccessors() { Method getSourceNodeId = null; Method getParentNodeId = null; + Method getRecordSourceNodeId = null; Method getChildId = null; try { getSourceNodeId = AccessibilityNodeInfo.class.getMethod("getSourceNodeId"); } catch (NoSuchMethodException e) { - Log.w(TAG, "can't invoke getSourceNodeId with reflection"); + Log.w(TAG, "can't invoke AccessibilityNodeInfo#getSourceNodeId with reflection"); } try { getParentNodeId = AccessibilityNodeInfo.class.getMethod("getParentNodeId"); } catch (NoSuchMethodException e) { Log.w(TAG, "can't invoke getParentNodeId with reflection"); } + try { + getRecordSourceNodeId = AccessibilityRecord.class.getMethod("getSourceNodeId"); + } catch (NoSuchMethodException e) { + Log.w(TAG, "can't invoke AccessibiiltyRecord#getSourceNodeId with reflection"); + } try { getChildId = AccessibilityNodeInfo.class.getMethod("getChildId", int.class); } catch (NoSuchMethodException e) { @@ -274,6 +429,7 @@ private ReflectionAccessors() { } this.getSourceNodeId = getSourceNodeId; this.getParentNodeId = getParentNodeId; + this.getRecordSourceNodeId = getRecordSourceNodeId; this.getChildId = getChildId; } @@ -282,7 +438,8 @@ private static int getVirtualNodeId(long nodeId) { return (int) (nodeId >> 32); } - private Long getSourceNodeId(AccessibilityNodeInfo node) { + @Nullable + private Long getSourceNodeId(@NonNull AccessibilityNodeInfo node) { if (getSourceNodeId == null) { return null; } @@ -296,7 +453,8 @@ private Long getSourceNodeId(AccessibilityNodeInfo node) { return null; } - private Long getChildId(AccessibilityNodeInfo node, int child) { + @Nullable + private Long getChildId(@NonNull AccessibilityNodeInfo node, int child) { if (getChildId == null) { return null; } @@ -310,7 +468,8 @@ private Long getChildId(AccessibilityNodeInfo node, int child) { return null; } - private Long getParentNodeId(AccessibilityNodeInfo node) { + @Nullable + private Long getParentNodeId(@NonNull AccessibilityNodeInfo node) { if (getParentNodeId == null) { return null; } @@ -323,5 +482,20 @@ private Long getParentNodeId(AccessibilityNodeInfo node) { } return null; } + + @Nullable + private Long getRecordSourceNodeId(@NonNull AccessibilityRecord node) { + if (getRecordSourceNodeId == null) { + return null; + } + try { + return (Long) getRecordSourceNodeId.invoke(node); + } catch (IllegalAccessException e) { + Log.w(TAG, e); + } catch (InvocationTargetException e) { + Log.w(TAG, e); + } + return null; + } } } From 22ee8ee08f6a25a32270813e28442e3a3ec00127 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 25 Mar 2019 15:10:24 -0700 Subject: [PATCH 0558/1117] Migrate existing embedder unit tests to use the fixture. (#8296) Also allows tests to specify their own embedder contexts. --- shell/platform/embedder/BUILD.gn | 5 + shell/platform/embedder/embedder.cc | 9 +- .../embedder/tests/embedder_config_builder.cc | 39 ++++--- .../embedder/tests/embedder_config_builder.h | 20 +++- .../embedder/tests/embedder_context.cc | 95 +++++++++++++++ .../embedder/tests/embedder_context.h | 59 ++++++++++ .../platform/embedder/tests/embedder_test.cc | 67 ++--------- shell/platform/embedder/tests/embedder_test.h | 18 +-- .../embedder/tests/embedder_unittests.cc | 110 +++--------------- 9 files changed, 236 insertions(+), 186 deletions(-) create mode 100644 shell/platform/embedder/tests/embedder_context.cc create mode 100644 shell/platform/embedder/tests/embedder_context.h diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index 1b7a81b844551..5df39518c8b62 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -70,6 +70,8 @@ executable("embedder_unittests") { sources = [ "tests/embedder_config_builder.cc", "tests/embedder_config_builder.h", + "tests/embedder_context.cc", + "tests/embedder_context.h", "tests/embedder_test.cc", "tests/embedder_test.h", "tests/embedder_unittests.cc", @@ -78,7 +80,10 @@ executable("embedder_unittests") { deps = [ ":embedder", ":fixtures", + "$flutter_root/runtime", "$flutter_root/testing", + "//third_party/skia", + "//third_party/tonic", ] if (is_linux) { diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 65aa88808f875..003f40113c419 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -52,14 +52,17 @@ extern const intptr_t kPlatformStrongDillSize; static FlutterEngineResult LogEmbedderError(FlutterEngineResult code, const char* name, - const char* function) { + const char* function, + const char* file, + int line) { FML_LOG(ERROR) << "Returning error '" << name << "' (" << code << ") from Flutter Embedder API call to '" << __FUNCTION__ - << "'."; + << "'. Origin: " << file << ":" << line; return code; } -#define LOG_EMBEDDER_ERROR(code) LogEmbedderError(code, #code, __FUNCTION__) +#define LOG_EMBEDDER_ERROR(code) \ + LogEmbedderError(code, #code, __FUNCTION__, __FILE__, __LINE__) static bool IsOpenGLRendererConfigValid(const FlutterRendererConfig* config) { if (config->type != kOpenGL) { diff --git a/shell/platform/embedder/tests/embedder_config_builder.cc b/shell/platform/embedder/tests/embedder_config_builder.cc index 108535ea8b619..c93886b1133c6 100644 --- a/shell/platform/embedder/tests/embedder_config_builder.cc +++ b/shell/platform/embedder/tests/embedder_config_builder.cc @@ -7,12 +7,21 @@ namespace shell { namespace testing { -EmbedderConfigBuilder::EmbedderConfigBuilder() { +EmbedderConfigBuilder::EmbedderConfigBuilder( + EmbedderContext& context, + InitializationPreference preference) + : context_(context) { project_args_.struct_size = sizeof(project_args_); - software_renderer_config_.struct_size = sizeof(FlutterSoftwareRendererConfig); software_renderer_config_.surface_present_callback = [](void*, const void*, size_t, size_t) { return true; }; + + if (preference == InitializationPreference::kInitialize) { + SetSoftwareRendererConfig(); + SetAssetsPath(); + SetSnapshots(); + SetIsolateCreateCallbackHook(); + } } EmbedderConfigBuilder::~EmbedderConfigBuilder() = default; @@ -22,39 +31,41 @@ void EmbedderConfigBuilder::SetSoftwareRendererConfig() { renderer_config_.software = software_renderer_config_; } -void EmbedderConfigBuilder::SetAssetsPathFromFixture( - const EmbedderTest* fixture) { - assets_path_ = fixture->GetAssetsPath(); - project_args_.assets_path = assets_path_.c_str(); +void EmbedderConfigBuilder::SetAssetsPath() { + project_args_.assets_path = context_.GetAssetsPath().c_str(); } -void EmbedderConfigBuilder::SetSnapshotsFromFixture( - const EmbedderTest* fixture) { - if (auto mapping = fixture->GetVMSnapshotData()) { +void EmbedderConfigBuilder::SetSnapshots() { + if (auto mapping = context_.GetVMSnapshotData()) { project_args_.vm_snapshot_data = mapping->GetMapping(); project_args_.vm_snapshot_data_size = mapping->GetSize(); } - if (auto mapping = fixture->GetVMSnapshotInstructions()) { + if (auto mapping = context_.GetVMSnapshotInstructions()) { project_args_.vm_snapshot_instructions = mapping->GetMapping(); project_args_.vm_snapshot_instructions_size = mapping->GetSize(); } - if (auto mapping = fixture->GetIsolateSnapshotData()) { + if (auto mapping = context_.GetIsolateSnapshotData()) { project_args_.isolate_snapshot_data = mapping->GetMapping(); project_args_.isolate_snapshot_data_size = mapping->GetSize(); } - if (auto mapping = fixture->GetIsolateSnapshotInstructions()) { + if (auto mapping = context_.GetIsolateSnapshotInstructions()) { project_args_.isolate_snapshot_instructions = mapping->GetMapping(); project_args_.isolate_snapshot_instructions_size = mapping->GetSize(); } } -UniqueEngine EmbedderConfigBuilder::LaunchEngine(void* user_data) const { +void EmbedderConfigBuilder::SetIsolateCreateCallbackHook() { + project_args_.root_isolate_create_callback = + EmbedderContext::GetIsolateCreateCallbackHook(); +} + +UniqueEngine EmbedderConfigBuilder::LaunchEngine() const { FlutterEngine engine = nullptr; auto result = FlutterEngineRun(FLUTTER_ENGINE_VERSION, &renderer_config_, - &project_args_, user_data, &engine); + &project_args_, &context_, &engine); if (result != kSuccess) { return {}; diff --git a/shell/platform/embedder/tests/embedder_config_builder.h b/shell/platform/embedder/tests/embedder_config_builder.h index a474f3e3bc81c..34dca1aed9f44 100644 --- a/shell/platform/embedder/tests/embedder_config_builder.h +++ b/shell/platform/embedder/tests/embedder_config_builder.h @@ -8,6 +8,7 @@ #include "flutter/fml/macros.h" #include "flutter/fml/unique_object.h" #include "flutter/shell/platform/embedder/embedder.h" +#include "flutter/shell/platform/embedder/tests/embedder_context.h" #include "flutter/shell/platform/embedder/tests/embedder_test.h" namespace shell { @@ -28,23 +29,32 @@ using UniqueEngine = fml::UniqueObject; class EmbedderConfigBuilder { public: - EmbedderConfigBuilder(); + enum class InitializationPreference { + kInitialize, + kNoInitialize, + }; + + EmbedderConfigBuilder(EmbedderContext& context, + InitializationPreference preference = + InitializationPreference::kInitialize); ~EmbedderConfigBuilder(); void SetSoftwareRendererConfig(); - void SetAssetsPathFromFixture(const EmbedderTest* fixture); + void SetAssetsPath(); + + void SetSnapshots(); - void SetSnapshotsFromFixture(const EmbedderTest* fixture); + void SetIsolateCreateCallbackHook(); - UniqueEngine LaunchEngine(void* user_data = nullptr) const; + UniqueEngine LaunchEngine() const; private: + EmbedderContext& context_; FlutterProjectArgs project_args_ = {}; FlutterRendererConfig renderer_config_ = {}; FlutterSoftwareRendererConfig software_renderer_config_ = {}; - std::string assets_path_; FML_DISALLOW_COPY_AND_ASSIGN(EmbedderConfigBuilder); }; diff --git a/shell/platform/embedder/tests/embedder_context.cc b/shell/platform/embedder/tests/embedder_context.cc new file mode 100644 index 0000000000000..57b4335e661ac --- /dev/null +++ b/shell/platform/embedder/tests/embedder_context.cc @@ -0,0 +1,95 @@ +// Copyright 2013 The Flutter 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/tests/embedder_context.h" + +#include "flutter/runtime/dart_vm.h" + +namespace shell { +namespace testing { + +static std::unique_ptr GetMapping(const fml::UniqueFD& directory, + const char* path, + bool executable) { + fml::UniqueFD file = fml::OpenFile(directory, path, false /* create */, + fml::FilePermission::kRead); + if (!file.is_valid()) { + return nullptr; + } + + using Prot = fml::FileMapping::Protection; + std::unique_ptr mapping; + if (executable) { + mapping = std::make_unique( + file, std::initializer_list{Prot::kRead, Prot::kExecute}); + } else { + mapping = std::make_unique( + file, std::initializer_list{Prot::kRead}); + } + + if (mapping->GetSize() == 0 || mapping->GetMapping() == nullptr) { + return nullptr; + } + + return mapping; +} + +EmbedderContext::EmbedderContext(std::string assets_path) + : assets_path_(std::move(assets_path)) { + auto assets_dir = fml::OpenDirectory(assets_path_.c_str(), false, + fml::FilePermission::kRead); + vm_snapshot_data_ = GetMapping(assets_dir, "vm_snapshot_data", false); + isolate_snapshot_data_ = + GetMapping(assets_dir, "isolate_snapshot_data", false); + + if (blink::DartVM::IsRunningPrecompiledCode()) { + vm_snapshot_instructions_ = + GetMapping(assets_dir, "vm_snapshot_instr", true); + isolate_snapshot_instructions_ = + GetMapping(assets_dir, "isolate_snapshot_instr", true); + } +} + +EmbedderContext::~EmbedderContext() = default; + +const std::string& EmbedderContext::GetAssetsPath() const { + return assets_path_; +} + +const fml::Mapping* EmbedderContext::GetVMSnapshotData() const { + return vm_snapshot_data_.get(); +} + +const fml::Mapping* EmbedderContext::GetVMSnapshotInstructions() const { + return vm_snapshot_instructions_.get(); +} + +const fml::Mapping* EmbedderContext::GetIsolateSnapshotData() const { + return isolate_snapshot_data_.get(); +} + +const fml::Mapping* EmbedderContext::GetIsolateSnapshotInstructions() const { + return isolate_snapshot_instructions_.get(); +} + +void EmbedderContext::AddIsolateCreateCallback(fml::closure closure) { + if (closure) { + isolate_create_callbacks_.push_back(closure); + } +} + +VoidCallback EmbedderContext::GetIsolateCreateCallbackHook() { + return [](void* user_data) { + reinterpret_cast(user_data)->FireIsolateCreateCallbacks(); + }; +} + +void EmbedderContext::FireIsolateCreateCallbacks() { + for (auto closure : isolate_create_callbacks_) { + closure(); + } +} + +} // namespace testing +} // namespace shell diff --git a/shell/platform/embedder/tests/embedder_context.h b/shell/platform/embedder/tests/embedder_context.h new file mode 100644 index 0000000000000..63aec332b2a0e --- /dev/null +++ b/shell/platform/embedder/tests/embedder_context.h @@ -0,0 +1,59 @@ +// Copyright 2013 The Flutter 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_EMBEDDER_TESTS_EMBEDDER_CONTEXT_H_ +#define FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_CONTEXT_H_ + +#include +#include +#include + +#include "flutter/fml/closure.h" +#include "flutter/fml/macros.h" +#include "flutter/fml/mapping.h" +#include "flutter/shell/platform/embedder/embedder.h" + +namespace shell { +namespace testing { + +class EmbedderContext { + public: + EmbedderContext(std::string assets_path = ""); + + ~EmbedderContext(); + + const std::string& GetAssetsPath() const; + + const fml::Mapping* GetVMSnapshotData() const; + + const fml::Mapping* GetVMSnapshotInstructions() const; + + const fml::Mapping* GetIsolateSnapshotData() const; + + const fml::Mapping* GetIsolateSnapshotInstructions() const; + + void AddIsolateCreateCallback(fml::closure closure); + + private: + // This allows the builder to access the hooks. + friend class EmbedderConfigBuilder; + + std::string assets_path_; + std::unique_ptr vm_snapshot_data_; + std::unique_ptr vm_snapshot_instructions_; + std::unique_ptr isolate_snapshot_data_; + std::unique_ptr isolate_snapshot_instructions_; + std::vector isolate_create_callbacks_; + + static VoidCallback GetIsolateCreateCallbackHook(); + + void FireIsolateCreateCallbacks(); + + FML_DISALLOW_COPY_AND_ASSIGN(EmbedderContext); +}; + +} // namespace testing +} // namespace shell + +#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_CONTEXT_H_ diff --git a/shell/platform/embedder/tests/embedder_test.cc b/shell/platform/embedder/tests/embedder_test.cc index 044aacc4dfc70..b23e79596745f 100644 --- a/shell/platform/embedder/tests/embedder_test.cc +++ b/shell/platform/embedder/tests/embedder_test.cc @@ -7,32 +7,6 @@ namespace shell { namespace testing { -static std::unique_ptr GetMapping(const fml::UniqueFD& directory, - const char* path, - bool executable) { - fml::UniqueFD file = fml::OpenFile(directory, path, false /* create */, - fml::FilePermission::kRead); - if (!file.is_valid()) { - return nullptr; - } - - using Prot = fml::FileMapping::Protection; - std::unique_ptr mapping; - if (executable) { - mapping = std::make_unique( - file, std::initializer_list{Prot::kRead, Prot::kExecute}); - } else { - mapping = std::make_unique( - file, std::initializer_list{Prot::kRead}); - } - - if (mapping->GetSize() == 0 || mapping->GetMapping() == nullptr) { - return nullptr; - } - - return mapping; -} - EmbedderTest::EmbedderTest() = default; EmbedderTest::~EmbedderTest() = default; @@ -41,45 +15,24 @@ std::string EmbedderTest::GetFixturesDirectory() const { return ::testing::GetFixturesPath(); } -std::string EmbedderTest::GetAssetsPath() const { - return GetFixturesDirectory(); -} - -const fml::Mapping* EmbedderTest::GetVMSnapshotData() const { - return vm_snapshot_data_.get(); -} - -const fml::Mapping* EmbedderTest::GetVMSnapshotInstructions() const { - return vm_snapshot_instructions_.get(); -} - -const fml::Mapping* EmbedderTest::GetIsolateSnapshotData() const { - return isolate_snapshot_data_.get(); -} - -const fml::Mapping* EmbedderTest::GetIsolateSnapshotInstructions() const { - return isolate_snapshot_instructions_.get(); +EmbedderContext& EmbedderTest::GetEmbedderContext() { + // Setup the embedder context lazily instead of in the SetUp method because we + // don't to do all the work if the test won't end up using context. + if (!embedder_context_) { + embedder_context_ = + std::make_unique(GetFixturesDirectory()); + } + return *embedder_context_; } // |testing::Test| void EmbedderTest::SetUp() { - auto fixures_dir = fml::OpenDirectory(GetFixturesDirectory().c_str(), false, - fml::FilePermission::kRead); - vm_snapshot_data_ = GetMapping(fixures_dir, "vm_snapshot_data", false); - vm_snapshot_instructions_ = - GetMapping(fixures_dir, "vm_snapshot_instr", true); - isolate_snapshot_data_ = - GetMapping(fixures_dir, "isolate_snapshot_data", false); - isolate_snapshot_instructions_ = - GetMapping(fixures_dir, "isolate_snapshot_instr", true); + // Nothing to do here since we will lazily setup the context when asked. } // |testing::Test| void EmbedderTest::TearDown() { - vm_snapshot_data_.reset(); - vm_snapshot_instructions_.reset(); - isolate_snapshot_data_.reset(); - isolate_snapshot_instructions_.reset(); + embedder_context_.reset(); } } // namespace testing diff --git a/shell/platform/embedder/tests/embedder_test.h b/shell/platform/embedder/tests/embedder_test.h index f861e3b7267fc..f0850bf6f8a7d 100644 --- a/shell/platform/embedder/tests/embedder_test.h +++ b/shell/platform/embedder/tests/embedder_test.h @@ -7,9 +7,8 @@ #include -#include "flutter/fml/file.h" #include "flutter/fml/macros.h" -#include "flutter/fml/mapping.h" +#include "flutter/shell/platform/embedder/tests/embedder_context.h" #include "flutter/testing/testing.h" namespace shell { @@ -23,21 +22,10 @@ class EmbedderTest : public ::testing::Test { std::string GetFixturesDirectory() const; - std::string GetAssetsPath() const; - - const fml::Mapping* GetVMSnapshotData() const; - - const fml::Mapping* GetVMSnapshotInstructions() const; - - const fml::Mapping* GetIsolateSnapshotData() const; - - const fml::Mapping* GetIsolateSnapshotInstructions() const; + EmbedderContext& GetEmbedderContext(); private: - std::unique_ptr vm_snapshot_data_; - std::unique_ptr vm_snapshot_instructions_; - std::unique_ptr isolate_snapshot_data_; - std::unique_ptr isolate_snapshot_instructions_; + std::unique_ptr embedder_context_; // |testing::Test| void SetUp() override; diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc index 7415183eb6792..eda64316a016b 100644 --- a/shell/platform/embedder/tests/embedder_unittests.cc +++ b/shell/platform/embedder/tests/embedder_unittests.cc @@ -6,6 +6,7 @@ #include "embedder.h" #include "flutter/fml/file.h" #include "flutter/fml/mapping.h" +#include "flutter/fml/synchronization/waitable_event.h" #include "flutter/shell/platform/embedder/tests/embedder_config_builder.h" #include "flutter/shell/platform/embedder/tests/embedder_test.h" #include "flutter/testing/testing.h" @@ -13,105 +14,30 @@ namespace shell { namespace testing { -static void MapAOTAsset( - std::vector>& aot_mappings, - const fml::UniqueFD& fixtures_dir, - const char* path, - bool executable, - const uint8_t** data, - size_t* size) { - fml::UniqueFD file = - fml::OpenFile(fixtures_dir, path, false, fml::FilePermission::kRead); - std::unique_ptr mapping; - if (executable) { - mapping = std::make_unique( - file, std::initializer_list{ - fml::FileMapping::Protection::kRead, - fml::FileMapping::Protection::kExecute}); - } else { - mapping = std::make_unique( - file, std::initializer_list{ - fml::FileMapping::Protection::kRead}); - } - *data = mapping->GetMapping(); - *size = mapping->GetSize(); - aot_mappings.emplace_back(std::move(mapping)); -} - -TEST(EmbedderTest, MustNotRunWithInvalidArgs) { - FlutterEngine engine = nullptr; - FlutterRendererConfig config = {}; - FlutterProjectArgs args = {}; - FlutterEngineResult result = FlutterEngineRun(FLUTTER_ENGINE_VERSION + 1, - &config, &args, NULL, &engine); - ASSERT_NE(result, FlutterEngineResult::kSuccess); -} +using EmbedderTest = testing::EmbedderTest; -TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) { - FlutterSoftwareRendererConfig renderer; - renderer.struct_size = sizeof(FlutterSoftwareRendererConfig); - renderer.surface_present_callback = [](void*, const void*, size_t, size_t) { - return false; - }; - - FlutterRendererConfig config = {}; - config.type = FlutterRendererType::kSoftware; - config.software = renderer; - - FlutterProjectArgs args = {}; - args.struct_size = sizeof(FlutterProjectArgs); - args.assets_path = ::testing::GetFixturesPath(); - args.root_isolate_create_callback = [](void* data) { - std::string str_data = reinterpret_cast(data); - ASSERT_EQ(str_data, "Data"); - }; - - fml::UniqueFD fixtures_dir = fml::OpenDirectory( - ::testing::GetFixturesPath(), false, fml::FilePermission::kRead); - std::vector> aot_mappings; - if (fml::FileExists(fixtures_dir, "vm_snapshot_data")) { - MapAOTAsset(aot_mappings, fixtures_dir, "vm_snapshot_data", false, - &args.vm_snapshot_data, &args.vm_snapshot_data_size); - MapAOTAsset(aot_mappings, fixtures_dir, "vm_snapshot_instr", true, - &args.vm_snapshot_instructions, - &args.vm_snapshot_instructions_size); - MapAOTAsset(aot_mappings, fixtures_dir, "isolate_snapshot_data", false, - &args.isolate_snapshot_data, &args.isolate_snapshot_data_size); - MapAOTAsset(aot_mappings, fixtures_dir, "isolate_snapshot_instr", true, - &args.isolate_snapshot_instructions, - &args.isolate_snapshot_instructions_size); - } - - std::string str_data = "Data"; - void* user_data = const_cast(str_data.c_str()); - FlutterEngine engine = nullptr; - FlutterEngineResult result = FlutterEngineRun(FLUTTER_ENGINE_VERSION, &config, - &args, user_data, &engine); - ASSERT_EQ(result, FlutterEngineResult::kSuccess); - - result = FlutterEngineShutdown(engine); - ASSERT_EQ(result, FlutterEngineResult::kSuccess); +TEST(EmbedderTestNoFixture, MustNotRunWithInvalidArgs) { + EmbedderContext context; + EmbedderConfigBuilder builder( + context, EmbedderConfigBuilder::InitializationPreference::kNoInitialize); + auto engine = builder.LaunchEngine(); + ASSERT_FALSE(engine.is_valid()); } -using EmbedderFixture = testing::EmbedderTest; - -TEST_F(EmbedderFixture, CanLaunchAndShutdownWithFixture) { - EmbedderConfigBuilder builder; - - builder.SetSoftwareRendererConfig(); - builder.SetAssetsPathFromFixture(this); - builder.SetSnapshotsFromFixture(this); - +TEST_F(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) { + auto& context = GetEmbedderContext(); + fml::AutoResetWaitableEvent latch; + context.AddIsolateCreateCallback([&latch]() { latch.Signal(); }); + EmbedderConfigBuilder builder(context); auto engine = builder.LaunchEngine(); ASSERT_TRUE(engine.is_valid()); + // Wait for the root isolate to launch. + latch.Wait(); + engine.reset(); } -TEST_F(EmbedderFixture, CanLaunchAndShutdownWithFixtureMultipleTimes) { - EmbedderConfigBuilder builder; - - builder.SetSoftwareRendererConfig(); - builder.SetAssetsPathFromFixture(this); - builder.SetSnapshotsFromFixture(this); +TEST_F(EmbedderTest, CanLaunchAndShutdownMultipleTimes) { + EmbedderConfigBuilder builder(GetEmbedderContext()); for (size_t i = 0; i < 100; ++i) { auto engine = builder.LaunchEngine(); ASSERT_TRUE(engine.is_valid()); From af64f725f6c74f5d1287a8be8511691119354088 Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Mon, 25 Mar 2019 15:44:14 -0700 Subject: [PATCH 0559/1117] Fixing links between higher and lower classes. (#8295) --- lib/ui/painting.dart | 4 ++-- lib/ui/text.dart | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index 42ff490c60f7d..e7b0e01c9ea70 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -1523,7 +1523,7 @@ class _ImageInfo { /// /// See also: /// -/// * [Image], the class in the [widgets] library that encapsulates this class. +/// * [Image](https://api.flutter.dev/flutter/widgets/Image-class.html), the class in the [widgets] library. /// @pragma('vm:entry-point') class Image extends NativeFieldWrapperClass2 { @@ -2686,7 +2686,7 @@ Float32List _encodeTwoPoints(Offset pointA, Offset pointB) { /// /// See also: /// -/// * [Gradient], the class in the [painting] library that encapsulates this class. +/// * [Gradient](https://api.flutter.dev/flutter/painting/Gradient-class.html), the class in the [painting] library. /// class Gradient extends Shader { diff --git a/lib/ui/text.dart b/lib/ui/text.dart index f19e734482490..d198d2b19c1ae 100644 --- a/lib/ui/text.dart +++ b/lib/ui/text.dart @@ -355,7 +355,7 @@ Int32List _encodeTextStyle( /// /// See also: /// -/// * [TextStyle], the class in the [painting] library that encapsulates this class. +/// * [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html), the class in the [painting] library. /// class TextStyle { /// Creates a new TextStyle object. @@ -799,7 +799,7 @@ ByteData _encodeStrut( /// See also: /// -/// * [StrutStyle], the class in the [painting] library that encapsulates this class. +/// * [StrutStyle](https://api.flutter.dev/flutter/painting/StrutStyle-class.html), the class in the [painting] library. /// class StrutStyle { /// Creates a new StrutStyle object. From 42d062f95ebfee22dacfafc14b4c3a0474c18aab Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Mon, 25 Mar 2019 16:03:41 -0700 Subject: [PATCH 0560/1117] [fuchsia] Add missing trace macros (#8297) --- fml/trace_event.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fml/trace_event.h b/fml/trace_event.h index b3a58a04d6ef9..979d430f6be65 100644 --- a/fml/trace_event.h +++ b/fml/trace_event.h @@ -13,6 +13,9 @@ #include +#define FML_TRACE_COUNTER(a, b, c, d, args...) TRACE_COUNTER(a, b, c, d) +#define FML_TRACE_EVENT(a, b, args...) TRACE_DURATION(a, b) + #define TRACE_EVENT0(a, b) TRACE_DURATION(a, b) #define TRACE_EVENT1(a, b, c, d) TRACE_DURATION(a, b, c, d) #define TRACE_EVENT2(a, b, c, d, e, f) TRACE_DURATION(a, b, c, d, e, f) @@ -20,6 +23,7 @@ #define TRACE_EVENT_ASYNC_END0(a, b, c) TRACE_ASYNC_END(a, b, c) #define TRACE_EVENT_ASYNC_BEGIN1(a, b, c, d, e) TRACE_ASYNC_BEGIN(a, b, c, d, e) #define TRACE_EVENT_ASYNC_END1(a, b, c, d, e) TRACE_ASYNC_END(a, b, c, d, e) +#define TRACE_EVENT_INSTANT0(a, b) TRACE_INSTANT(a, b, TRACE_SCOPE_THREAD) #endif // defined(OS_FUCHSIA) From 0d83a2ecd1bb78f8e1f0ed9719ff3751cdfdd064 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 25 Mar 2019 19:20:25 -0400 Subject: [PATCH 0561/1117] Roll src/third_party/skia 15dc59e65cfa..c5ee499f2c59 (2 commits) (#8298) https://skia.googlesource.com/skia.git/%2Blog/15dc59e65cfa..c5ee499f2c59 git log 15dc59e65cfa9b06f1505d6e44e6dbb0e52ecf6a..c5ee499f2c5913d0d330bfc76944d2c36dfc8e34 --date=short --no-merges --format=%ad %ae %s 2019-03-25 bungeman@google.com Enable fontconfig fontmgr in public.bzl. 2019-03-25 bungeman@google.com Replace SkSpan with Range in shaper reporting. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 5cfda524794a5..7abd1e2c6a22f 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': '15dc59e65cfa9b06f1505d6e44e6dbb0e52ecf6a', + 'skia_revision': 'c5ee499f2c5913d0d330bfc76944d2c36dfc8e34', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 9c875da408749..8efbd4911880d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 3d12a6d1a684e5f3b41c4b66c54bc5e7 +Signature: 0cd6dc53f5ebd38ca3d8943d785b787c UNUSED LICENSES: From d88037dc074f0a91542f7eb67245522e3f05671a Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 25 Mar 2019 18:56:30 -0700 Subject: [PATCH 0562/1117] Roll src/third_party/dart fa74184b7a..093c2909fe (71 commits) 093c2909fe [dartdevc] Add implicit casts for SpreadElement nodes f09097bab8 Add tests for "await for" in collection literals. 510d6f7789 Fix a bug in SDK constraint detection db8dca4fbf dart:core: optional-new/const, named-default-separator, function-typedefs c9ecdabe5d Revert "Combine override checks and override-based inference in one phase" 93e4ae4fdf [vm] Add flags to gen_kernel script to support old ABIs 8e0bb64bd1 [gardening] Mark reloaded files as other resources. 461d965d82 Reduce the priority of convertToAsync (issue 36327) ab8510a0a5 [gardening] Fix arguments test for app_jit(k). 580f44aa83 [vm] Enable running FFI tests on Android in JIT-mode. 18a346c4e2 [infra] Protect against buggy approve_results versions causing an outage. 7ddeed1ba9 [gardening] Fix test harness handling of DartOptions a13ac1b44f [infra] Fix approve_results not inserting primary keys for pre-approvals. 775dd08ae9 add some fixes to the widget transformer so it can find the flutter libs and assume the location arg exists on widget constructors 51da94da76 [fasta] Don't create forwarding stub if there's already a member 8d22c26c64 [CFE] Simplify tracking of unevaluated status. 2ce1af9cbe [CFE] Constant evaluation of newly added operators 0b3af295c0 [CFE] >>>= in fasta b1e14cbe5f Change default of 'keepFields' in constant transformation to true 133d1b5afe [CFE] Allow 'as' and 'is' expressions as constants. 5f0de26d48 Clean up the remaining copyright notices 09ee45b4e2 Support for import prefixes. c89642280c Infer types of fields from initializers. 9f864100aa Write / read codeOffset and codeLength for elements. b0823ca558 Add a quick fix for the MISSING_ENUM_CONSTANT_IN_SWITCH diagnostic (issue 36290) baa5628875 [infra] fix approve_results crashing on bad preapproval entry 9d7a0113cc Add test parts, fix for indexing enums. 26d707041a Resolve metadata on directives. 2f22932149 Use dynamic type arguments for TypeName without explicit type arguments. 36e6eb36c5 rename and reword invalid initializer error messages 290ab228b7 Resynthesize DefaultFieldFormalParameterElementImpl. a0e0a7a150 [vm] Delete disallowed constructors/operators bbe8adc827 [dartdevc] Support await within all CollectionElement nodes 59b8a9c4bb [vm] Free readonly header bit so it can be used for other uses. 466b6884dc add scanner/parser support for >>>= 9d616fe839 Add support for >>> in summaries 19a817e785 [analyzer] Fix utility classes ignoring await in for statement/element dfae23d205 [dartdevc] fix #36293, call nSM on callable objects if the lookup fails 65b92e9579 [dartdevc] fix #36253, kernel backend now emits trackLibraries call 96a078ce76 Add quick fixes for new SDK constraint checks 0b4fdc46fe Compute export scopes for source libraries. ee79ca9a74 dart2js support for loading .dill files built modularly 9c6a882af0 Add SDK constraint checks for the constant update 2018 features a8d0a33360 Build elements for local FunctionExpression(s) and parameters while reading AST. 98dddc9daa [tests] Ensure that --enable-asserts is used whereever checked was used previously a8831e7481 Handle _FROM_DEFERRED_LIBRARY codes for ui as code 14fcc352cd [gardening] Try troubleshoot flutter hhh buildbot. ddcc63e1ad [Analyzer] move usage of mostSpecificTypeArgument in strong checker c22c2b7645 Test that set/list if elements/else elements get implicit casts c8c5eff08f [infra] Deflake tests that are both multitests and have multiple VMOptions lines 1bab46b06f [vm] Remove support for '-c', '--checked' flags and '--enable-checked-mode' c614b99ae1 [vm] Load kernel service from ABI versioned dill file 7e170b351d [vm] Add whitespace before parenthesis. b60eae48e5 Test that VM interpreter, bytecode, and unoptimized benchmarks can run. 2631fdf8cf [vm] Reclaim GraphMarked bit. a447b36280 convert: remove private typedefs 485640df2e update scanner tests to use scanString f3ac707aea report error for invalid super/this initializer 4cd410d6ac add parser listener handleErrorToken event 11a148c85e Add the ability to associate a URL with a diagnostic 87c553bf3c Ascribe constants to the member world impacts f141914e65 Cleanup warnings in the analyzer code base ecf5a46c96 [infra] Fix approve_results crashing on approvals for deleted tests. 849e914cb4 [infra] Fix per-CL approval not setting the expires field. 2aed6c0311 [CFE] >>> in fasta 94e214bacc [infra] Fix auto-approval breaking as of per-CL approval. 065910f0c1 [infra] Add support for pre-approvals in approved_results.json. 81b984d735 [gardening] Fix up name detection in isolate tests. 3de6276ad6 Handle deferred constants in the ssa builder 9db4119b67 Combine override checks and override-based inference in one phase 3678efae60 Test that map if elements/else elements keys/values get implicit casts --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 7abd1e2c6a22f..911dd348139c3 100644 --- a/DEPS +++ b/DEPS @@ -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': 'fa74184b7aad2a441a23c4c2f4160c09cc69ec32', + 'dart_revision': '093c2909fedaaa4c1cbe21887bfbe97c59be21d2', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index d83021c7869ae..1ec8baf2c6bce 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: a1b4b559a1f0f48db96b691ff133002c +Signature: 191c43b2cc3260647a4ea7da4169f97e UNUSED LICENSES: From a673bbf6f29294bdd0d05c750f7639d43c0fcaa9 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 25 Mar 2019 22:48:45 -0400 Subject: [PATCH 0563/1117] Roll src/third_party/skia c5ee499f2c59..80dd599e91d0 (5 commits) (#8301) https://skia.googlesource.com/skia.git/%2Blog/c5ee499f2c59..80dd599e91d0 git log c5ee499f2c5913d0d330bfc76944d2c36dfc8e34..80dd599e91d057009461fd221f29ac56f79dc6c3 --date=short --no-merges --format=%ad %ae %s 2019-03-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 40ce19f3a56f..4035f6c897d0 (377 commits) 2019-03-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 9078c6a7199b..da37e7f6759d (5 commits) 2019-03-25 fmalita@chromium.org Make SkShaper available in Fiddle 2019-03-25 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-25 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 911dd348139c3..715e890b733f4 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': 'c5ee499f2c5913d0d330bfc76944d2c36dfc8e34', + 'skia_revision': '80dd599e91d057009461fd221f29ac56f79dc6c3', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 8efbd4911880d..b7e299c3b616a 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 0cd6dc53f5ebd38ca3d8943d785b787c +Signature: 31970da31da48bc6885c38d3033f04e3 UNUSED LICENSES: From 2804057bf58b0658c5b4909ffbea335400a71be6 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 26 Mar 2019 02:20:38 -0400 Subject: [PATCH 0564/1117] Roll src/third_party/skia 80dd599e91d0..33211b2c7a02 (1 commits) (#8303) https://skia.googlesource.com/skia.git/%2Blog/80dd599e91d0..33211b2c7a02 git log 80dd599e91d057009461fd221f29ac56f79dc6c3..33211b2c7a0260d8a1c1a11ef4a11a31d01473a8 --date=short --no-merges --format=%ad %ae %s 2019-03-26 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 715e890b733f4..cec0d52bca799 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': '80dd599e91d057009461fd221f29ac56f79dc6c3', + 'skia_revision': '33211b2c7a0260d8a1c1a11ef4a11a31d01473a8', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b7e299c3b616a..1adf6aaa4fee2 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 31970da31da48bc6885c38d3033f04e3 +Signature: 8d5e01b5d1b50755ad7bec8a6fcba3d3 UNUSED LICENSES: From 358273bd27d517255d05239ee6dae1c679bd93e0 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 26 Mar 2019 05:50:24 -0400 Subject: [PATCH 0565/1117] Roll src/third_party/skia 33211b2c7a02..d90004516a63 (1 commits) (#8305) https://skia.googlesource.com/skia.git/%2Blog/33211b2c7a02..d90004516a63 git log 33211b2c7a0260d8a1c1a11ef4a11a31d01473a8..d90004516a63e302ca50dfe9c1c8dddf21e50e1c --date=short --no-merges --format=%ad %ae %s 2019-03-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 221459f4ecc9..e1cf863e65c6 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index cec0d52bca799..5600ddc65f337 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': '33211b2c7a0260d8a1c1a11ef4a11a31d01473a8', + 'skia_revision': 'd90004516a63e302ca50dfe9c1c8dddf21e50e1c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 1adf6aaa4fee2..d626d4bf4c167 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8d5e01b5d1b50755ad7bec8a6fcba3d3 +Signature: a0b058f2600dce325fcae2092d2eb91f UNUSED LICENSES: From 95f9134e9affdebff024f651cb8107fd3bb47e26 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 26 Mar 2019 09:19:37 -0400 Subject: [PATCH 0566/1117] Roll src/third_party/skia d90004516a63..62fd6c411622 (4 commits) (#8306) https://skia.googlesource.com/skia.git/%2Blog/d90004516a63..62fd6c411622 git log d90004516a63e302ca50dfe9c1c8dddf21e50e1c..62fd6c4116226f5bb9c4d06c85fb9e549b7b3d5b --date=short --no-merges --format=%ad %ae %s 2019-03-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader c0cf68ba0ed6..54ec759a7405 (2 commits) 2019-03-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 7af926603c2d..c0cf68ba0ed6 (3 commits) 2019-03-25 kjlubick@google.com Reland "Generate GrGLInterface and GrGlAssembleInterface* from table" 2019-03-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader e1cf863e65c6..7af926603c2d (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DEPS b/DEPS index 5600ddc65f337..a3f29a6d8bc73 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': 'd90004516a63e302ca50dfe9c1c8dddf21e50e1c', + 'skia_revision': '62fd6c4116226f5bb9c4d06c85fb9e549b7b3d5b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index d626d4bf4c167..a190fd3969bde 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: a0b058f2600dce325fcae2092d2eb91f +Signature: e3c353b752055b863f6edc51fba4dbed UNUSED LICENSES: @@ -2930,7 +2930,7 @@ FILE: ../../../third_party/skia/src/gpu/gl/GrGLGpu.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLGpu.h FILE: ../../../third_party/skia/src/gpu/gl/GrGLGpuProgramCache.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLIRect.h -FILE: ../../../third_party/skia/src/gpu/gl/GrGLInterface.cpp +FILE: ../../../third_party/skia/src/gpu/gl/GrGLInterfaceAutogen.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLMakeNativeInterface_none.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLProgram.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLProgram.h @@ -5832,9 +5832,9 @@ FILE: ../../../third_party/skia/modules/particles/src/SkParticleDrawable.cpp FILE: ../../../third_party/skia/modules/particles/src/SkParticleEffect.cpp FILE: ../../../third_party/skia/modules/particles/src/SkReflected.cpp FILE: ../../../third_party/skia/src/core/SkColorFilterPriv.h +FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleGLESInterfaceAutogen.cpp +FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleGLInterfaceAutogen.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleHelpers.cpp -FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleInterface_gl.cpp -FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleInterface_gles.cpp FILE: ../../../third_party/skia/src/sksl/SkSLByteCode.h FILE: ../../../third_party/skia/src/sksl/SkSLByteCodeGenerator.cpp FILE: ../../../third_party/skia/src/sksl/SkSLByteCodeGenerator.h From 2812c7db4a97508f2b3bfab2a4db3f8c397bb8b5 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 26 Mar 2019 13:20:39 -0400 Subject: [PATCH 0567/1117] Roll src/third_party/skia 62fd6c411622..d2ca31218bc4 (9 commits) (#8307) https://skia.googlesource.com/skia.git/%2Blog/62fd6c411622..d2ca31218bc4 git log 62fd6c4116226f5bb9c4d06c85fb9e549b7b3d5b..d2ca31218bc4d06fd3337fb1951ea1800a915f56 --date=short --no-merges --format=%ad %ae %s 2019-03-26 brianosman@google.com Convert GrPorterDuff test from NullGL to Mock context 2019-03-26 brianosman@google.com Run GrTextureMipMapInvalidationTest on rendering contexts 2019-03-26 brianosman@google.com Convert some unit tests from NullGL to Mock context 2019-03-26 rmistry@google.com Detect and fail when invalid SKPs are created by RecreateSKPs bot 2019-03-26 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-26 rmistry@google.com Fix RecreateSKPs bot page sets 2019-03-26 mtklein@google.com move gpu_tool_utils to public_deps 2019-03-26 nigeltao@google.com Remove unused setAlphaAndRequiredFrame condition 2019-03-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 54ec759a7405..213a8ce6d5c2 (2 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index a3f29a6d8bc73..37798eea81185 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': '62fd6c4116226f5bb9c4d06c85fb9e549b7b3d5b', + 'skia_revision': 'd2ca31218bc4d06fd3337fb1951ea1800a915f56', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a190fd3969bde..a34e50dfd6345 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: e3c353b752055b863f6edc51fba4dbed +Signature: 11cd0788531075042d9be33f624cf021 UNUSED LICENSES: From 78de8dcb42a445f54c5fa2c55feee8b8db0ba493 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 26 Mar 2019 11:29:08 -0700 Subject: [PATCH 0568/1117] Enable lambda like native callbacks in tests and add support for custom entrypoints. (#8299) --- shell/platform/embedder/BUILD.gn | 2 + shell/platform/embedder/embedder.cc | 7 ++ shell/platform/embedder/embedder.h | 9 ++ .../embedder/fixtures/simple_main.dart | 7 ++ .../embedder/tests/embedder_config_builder.cc | 9 ++ .../embedder/tests/embedder_config_builder.h | 3 + .../embedder/tests/embedder_context.cc | 16 +++- .../embedder/tests/embedder_context.h | 7 ++ .../embedder/tests/embedder_test_resolver.cc | 90 +++++++++++++++++++ .../embedder/tests/embedder_test_resolver.h | 47 ++++++++++ .../embedder/tests/embedder_unittests.cc | 18 +++- 11 files changed, 212 insertions(+), 3 deletions(-) create mode 100644 shell/platform/embedder/tests/embedder_test_resolver.cc create mode 100644 shell/platform/embedder/tests/embedder_test_resolver.h diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index 5df39518c8b62..f9659a3b5c5fb 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -74,6 +74,8 @@ executable("embedder_unittests") { "tests/embedder_context.h", "tests/embedder_test.cc", "tests/embedder_test.h", + "tests/embedder_test_resolver.cc", + "tests/embedder_test_resolver.h", "tests/embedder_unittests.cc", ] diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 003f40113c419..c15970de70775 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -624,6 +624,13 @@ FlutterEngineResult FlutterEngineRun(size_t version, // Step 3: Run the engine. auto run_configuration = shell::RunConfiguration::InferFromSettings(settings); + if (SAFE_ACCESS(args, custom_dart_entrypoint, nullptr) != nullptr) { + auto dart_entrypoint = std::string{args->custom_dart_entrypoint}; + if (dart_entrypoint.size() != 0) { + run_configuration.SetEntrypoint(std::move(dart_entrypoint)); + } + } + run_configuration.AddAssetResolver( std::make_unique( fml::Duplicate(settings.assets_dir))); diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 6127681c55774..442716a50114b 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -563,6 +563,15 @@ typedef struct { // internal engine-managed thread. If the components accessed on the embedder // are not thread safe, the appropriate re-threading must be done. VsyncCallback vsync_callback; + + // The name of a custom Dart entrypoint. This is optional and specifying a + // null or empty entrypoint makes the engine look for a method named "main" in + // the root library of the application. + // + // Care must be taken to ensure that the custom entrypoint is not tree-shaken + // away. Usually, this is done using the `@pragma('vm:entry-point')` + // decoration. + const char* custom_dart_entrypoint; } FlutterProjectArgs; FLUTTER_EXPORT diff --git a/shell/platform/embedder/fixtures/simple_main.dart b/shell/platform/embedder/fixtures/simple_main.dart index ab73b3a234abf..b1124b508b7e3 100644 --- a/shell/platform/embedder/fixtures/simple_main.dart +++ b/shell/platform/embedder/fixtures/simple_main.dart @@ -1 +1,8 @@ void main() {} + +@pragma('vm:entry-point') +void customEntrypoint() { + sayHiFromCustomEntrypoint(); +} + +void sayHiFromCustomEntrypoint() native "SayHiFromCustomEntrypoint"; diff --git a/shell/platform/embedder/tests/embedder_config_builder.cc b/shell/platform/embedder/tests/embedder_config_builder.cc index c93886b1133c6..23ef27cd3c954 100644 --- a/shell/platform/embedder/tests/embedder_config_builder.cc +++ b/shell/platform/embedder/tests/embedder_config_builder.cc @@ -62,6 +62,15 @@ void EmbedderConfigBuilder::SetIsolateCreateCallbackHook() { EmbedderContext::GetIsolateCreateCallbackHook(); } +void EmbedderConfigBuilder::SetDartEntrypoint(std::string entrypoint) { + if (entrypoint.size() == 0) { + return; + } + + dart_entrypoint_ = std::move(entrypoint); + project_args_.custom_dart_entrypoint = dart_entrypoint_.c_str(); +} + UniqueEngine EmbedderConfigBuilder::LaunchEngine() const { FlutterEngine engine = nullptr; auto result = FlutterEngineRun(FLUTTER_ENGINE_VERSION, &renderer_config_, diff --git a/shell/platform/embedder/tests/embedder_config_builder.h b/shell/platform/embedder/tests/embedder_config_builder.h index 34dca1aed9f44..b76edb98734b9 100644 --- a/shell/platform/embedder/tests/embedder_config_builder.h +++ b/shell/platform/embedder/tests/embedder_config_builder.h @@ -48,6 +48,8 @@ class EmbedderConfigBuilder { void SetIsolateCreateCallbackHook(); + void SetDartEntrypoint(std::string entrypoint); + UniqueEngine LaunchEngine() const; private: @@ -55,6 +57,7 @@ class EmbedderConfigBuilder { FlutterProjectArgs project_args_ = {}; FlutterRendererConfig renderer_config_ = {}; FlutterSoftwareRendererConfig software_renderer_config_ = {}; + std::string dart_entrypoint_; FML_DISALLOW_COPY_AND_ASSIGN(EmbedderConfigBuilder); }; diff --git a/shell/platform/embedder/tests/embedder_context.cc b/shell/platform/embedder/tests/embedder_context.cc index 57b4335e661ac..edb72ff4c2f24 100644 --- a/shell/platform/embedder/tests/embedder_context.cc +++ b/shell/platform/embedder/tests/embedder_context.cc @@ -36,7 +36,8 @@ static std::unique_ptr GetMapping(const fml::UniqueFD& directory, } EmbedderContext::EmbedderContext(std::string assets_path) - : assets_path_(std::move(assets_path)) { + : assets_path_(std::move(assets_path)), + native_resolver_(std::make_shared()) { auto assets_dir = fml::OpenDirectory(assets_path_.c_str(), false, fml::FilePermission::kRead); vm_snapshot_data_ = GetMapping(assets_dir, "vm_snapshot_data", false); @@ -49,6 +50,14 @@ EmbedderContext::EmbedderContext(std::string assets_path) isolate_snapshot_instructions_ = GetMapping(assets_dir, "isolate_snapshot_instr", true); } + + isolate_create_callbacks_.push_back( + [weak_resolver = + std::weak_ptr{native_resolver_}]() { + if (auto resolver = weak_resolver.lock()) { + resolver->SetNativeResolverForIsolate(); + } + }); } EmbedderContext::~EmbedderContext() = default; @@ -91,5 +100,10 @@ void EmbedderContext::FireIsolateCreateCallbacks() { } } +void EmbedderContext::AddNativeCallback(const char* name, + Dart_NativeFunction function) { + native_resolver_->AddNativeCallback({name}, function); +} + } // namespace testing } // namespace shell diff --git a/shell/platform/embedder/tests/embedder_context.h b/shell/platform/embedder/tests/embedder_context.h index 63aec332b2a0e..6405163d9cd6a 100644 --- a/shell/platform/embedder/tests/embedder_context.h +++ b/shell/platform/embedder/tests/embedder_context.h @@ -5,6 +5,7 @@ #ifndef FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_CONTEXT_H_ #define FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_CONTEXT_H_ +#include #include #include #include @@ -13,6 +14,7 @@ #include "flutter/fml/macros.h" #include "flutter/fml/mapping.h" #include "flutter/shell/platform/embedder/embedder.h" +#include "flutter/shell/platform/embedder/tests/embedder_test_resolver.h" namespace shell { namespace testing { @@ -35,6 +37,8 @@ class EmbedderContext { void AddIsolateCreateCallback(fml::closure closure); + void AddNativeCallback(const char* name, Dart_NativeFunction function); + private: // This allows the builder to access the hooks. friend class EmbedderConfigBuilder; @@ -45,11 +49,14 @@ class EmbedderContext { std::unique_ptr isolate_snapshot_data_; std::unique_ptr isolate_snapshot_instructions_; std::vector isolate_create_callbacks_; + std::shared_ptr native_resolver_; static VoidCallback GetIsolateCreateCallbackHook(); void FireIsolateCreateCallbacks(); + void SetNativeResolver(); + FML_DISALLOW_COPY_AND_ASSIGN(EmbedderContext); }; diff --git a/shell/platform/embedder/tests/embedder_test_resolver.cc b/shell/platform/embedder/tests/embedder_test_resolver.cc new file mode 100644 index 0000000000000..49171a91df23c --- /dev/null +++ b/shell/platform/embedder/tests/embedder_test_resolver.cc @@ -0,0 +1,90 @@ +// Copyright 2013 The Flutter 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/tests/embedder_test_resolver.h" + +#include +#include + +#include "flutter/fml/synchronization/thread_annotations.h" +#include "tonic/converter/dart_converter.h" + +namespace shell { +namespace testing { + +EmbedderTestResolver::EmbedderTestResolver() = default; + +EmbedderTestResolver::~EmbedderTestResolver() = default; + +void EmbedderTestResolver::AddNativeCallback(std::string name, + Dart_NativeFunction callback) { + native_callbacks_[name] = callback; +} + +Dart_NativeFunction EmbedderTestResolver::ResolveCallback( + std::string name) const { + auto found = native_callbacks_.find(name); + if (found == native_callbacks_.end()) { + return nullptr; + } + + return found->second; +} + +static std::mutex gIsolateResolversMutex; +static std::map> + gIsolateResolvers FML_GUARDED_BY(gIsolateResolversMutex); + +Dart_NativeFunction EmbedderTestResolver::DartNativeEntryResolverCallback( + Dart_Handle dart_name, + int num_of_arguments, + bool* auto_setup_scope) { + auto name = tonic::StdStringFromDart(dart_name); + + std::lock_guard lock(gIsolateResolversMutex); + auto found = gIsolateResolvers.find(Dart_CurrentIsolate()); + if (found == gIsolateResolvers.end()) { + return nullptr; + } + + if (auto resolver = found->second.lock()) { + return resolver->ResolveCallback(std::move(name)); + } else { + gIsolateResolvers.erase(found); + } + + return nullptr; +} + +static const uint8_t* DartNativeEntrySymbolCallback( + Dart_NativeFunction function) { + return reinterpret_cast("¯\\_(ツ)_/¯"); +} + +void EmbedderTestResolver::SetNativeResolverForIsolate() { + auto result = Dart_SetNativeResolver(Dart_RootLibrary(), + DartNativeEntryResolverCallback, + DartNativeEntrySymbolCallback); + + if (Dart_IsError(result)) { + return; + } + + std::lock_guard lock(gIsolateResolversMutex); + gIsolateResolvers[Dart_CurrentIsolate()] = shared_from_this(); + + std::vector isolates_with_dead_resolvers; + for (const auto& entry : gIsolateResolvers) { + if (!entry.second.lock()) { + isolates_with_dead_resolvers.push_back(entry.first); + } + } + + for (const auto& dead_isolate : isolates_with_dead_resolvers) { + gIsolateResolvers.erase(dead_isolate); + } +} + +} // namespace testing +} // namespace shell diff --git a/shell/platform/embedder/tests/embedder_test_resolver.h b/shell/platform/embedder/tests/embedder_test_resolver.h new file mode 100644 index 0000000000000..69d08efe1042d --- /dev/null +++ b/shell/platform/embedder/tests/embedder_test_resolver.h @@ -0,0 +1,47 @@ +// Copyright 2013 The Flutter 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_EMBEDDER_TESTS_EMBEDDER_TEST_RESOLVER_H_ +#define FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_RESOLVER_H_ + +#include +#include + +#include "flutter/fml/macros.h" +#include "third_party/dart/runtime/include/dart_api.h" + +namespace shell { +namespace testing { + +class EmbedderTestResolver + : public std::enable_shared_from_this { + public: + EmbedderTestResolver(); + + ~EmbedderTestResolver(); + + void AddNativeCallback(std::string name, Dart_NativeFunction callback); + + private: + // Friend so that the context can set the native resolver. + friend class EmbedderContext; + + std::map native_callbacks_; + + void SetNativeResolverForIsolate(); + + Dart_NativeFunction ResolveCallback(std::string name) const; + + static Dart_NativeFunction DartNativeEntryResolverCallback( + Dart_Handle dart_name, + int num_of_arguments, + bool* auto_setup_scope); + + FML_DISALLOW_COPY_AND_ASSIGN(EmbedderTestResolver); +}; + +} // namespace testing +} // namespace shell + +#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_RESOLVER_H_ diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc index eda64316a016b..01d23ff0d885f 100644 --- a/shell/platform/embedder/tests/embedder_unittests.cc +++ b/shell/platform/embedder/tests/embedder_unittests.cc @@ -38,12 +38,26 @@ TEST_F(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) { TEST_F(EmbedderTest, CanLaunchAndShutdownMultipleTimes) { EmbedderConfigBuilder builder(GetEmbedderContext()); - for (size_t i = 0; i < 100; ++i) { + for (size_t i = 0; i < 3; ++i) { auto engine = builder.LaunchEngine(); ASSERT_TRUE(engine.is_valid()); FML_LOG(INFO) << "Engine launch count: " << i + 1; } } +TEST_F(EmbedderTest, CanInvokeCustomEntrypoint) { + auto& context = GetEmbedderContext(); + static fml::AutoResetWaitableEvent latch; + Dart_NativeFunction entrypoint = [](Dart_NativeArguments args) { + latch.Signal(); + }; + context.AddNativeCallback("SayHiFromCustomEntrypoint", entrypoint); + EmbedderConfigBuilder builder(context); + builder.SetDartEntrypoint("customEntrypoint"); + auto engine = builder.LaunchEngine(); + latch.Wait(); + ASSERT_TRUE(engine.is_valid()); +} + } // namespace testing -} // namespace shell \ No newline at end of file +} // namespace shell From 51f23fedf2437f830a00aacfadd84a0808185df7 Mon Sep 17 00:00:00 2001 From: Craig Stout Date: Mon, 25 Mar 2019 10:25:32 -0700 Subject: [PATCH 0569/1117] [vulkan] Add FUCHSIA external sem/mem extensions The KHR versions will be renamed once references are removed. MA-510 #comment --- vulkan/vulkan_device.cc | 2 ++ vulkan/vulkan_proc_table.cc | 2 ++ vulkan/vulkan_proc_table.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/vulkan/vulkan_device.cc b/vulkan/vulkan_device.cc index 772b1909225af..3be8c340cdaaa 100644 --- a/vulkan/vulkan_device.cc +++ b/vulkan/vulkan_device.cc @@ -64,8 +64,10 @@ VulkanDevice::VulkanDevice(VulkanProcTable& p_vk, #if OS_FUCHSIA VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_FUCHSIA_EXTENSION_NAME, + VK_FUCHSIA_EXTERNAL_MEMORY_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_FUCHSIA_EXTENSION_NAME, + VK_FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME, #endif }; diff --git a/vulkan/vulkan_proc_table.cc b/vulkan/vulkan_proc_table.cc index b94e1ab4b23db..7b551f3d55003 100644 --- a/vulkan/vulkan_proc_table.cc +++ b/vulkan/vulkan_proc_table.cc @@ -139,6 +139,8 @@ bool VulkanProcTable::SetupDeviceProcAddresses( #if OS_FUCHSIA ACQUIRE_PROC(GetMemoryFuchsiaHandleKHR, handle); ACQUIRE_PROC(ImportSemaphoreFuchsiaHandleKHR, handle); + ACQUIRE_PROC(GetMemoryZirconHandleFUCHSIA, handle); + ACQUIRE_PROC(ImportSemaphoreZirconHandleFUCHSIA, handle); #endif // OS_FUCHSIA device_ = {handle, nullptr}; return true; diff --git a/vulkan/vulkan_proc_table.h b/vulkan/vulkan_proc_table.h index d145150bcf84c..9f06402e3dd30 100644 --- a/vulkan/vulkan_proc_table.h +++ b/vulkan/vulkan_proc_table.h @@ -117,6 +117,8 @@ class VulkanProcTable : public fml::RefCountedThreadSafe { #if OS_FUCHSIA DEFINE_PROC(GetMemoryFuchsiaHandleKHR); DEFINE_PROC(ImportSemaphoreFuchsiaHandleKHR); + DEFINE_PROC(GetMemoryZirconHandleFUCHSIA); + DEFINE_PROC(ImportSemaphoreZirconHandleFUCHSIA); #endif // OS_FUCHSIA #undef DEFINE_PROC From 400a86a62efd3c8504672b8a63323cc837282135 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 26 Mar 2019 12:56:23 -0700 Subject: [PATCH 0570/1117] Allow specification of std::functions as native entrypoints from Dart code. (#8309) This allows for the specification of std::functions (using EmbedderContext::NativeEntry) with their captures as native entrypoints. Earlier, only C functions we allowed which meant that there were no captures and assertions had to use globals which could introduce bugs when used with gtest_repeat. --- .../embedder/fixtures/simple_main.dart | 12 ++++++ .../embedder/tests/embedder_context.h | 12 ++++++ .../embedder/tests/embedder_unittests.cc | 40 +++++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/shell/platform/embedder/fixtures/simple_main.dart b/shell/platform/embedder/fixtures/simple_main.dart index b1124b508b7e3..bd3999563e031 100644 --- a/shell/platform/embedder/fixtures/simple_main.dart +++ b/shell/platform/embedder/fixtures/simple_main.dart @@ -6,3 +6,15 @@ void customEntrypoint() { } void sayHiFromCustomEntrypoint() native "SayHiFromCustomEntrypoint"; + + +@pragma('vm:entry-point') +void customEntrypoint1() { + sayHiFromCustomEntrypoint1(); + sayHiFromCustomEntrypoint2(); + sayHiFromCustomEntrypoint3(); +} + +void sayHiFromCustomEntrypoint1() native "SayHiFromCustomEntrypoint1"; +void sayHiFromCustomEntrypoint2() native "SayHiFromCustomEntrypoint2"; +void sayHiFromCustomEntrypoint3() native "SayHiFromCustomEntrypoint3"; diff --git a/shell/platform/embedder/tests/embedder_context.h b/shell/platform/embedder/tests/embedder_context.h index 6405163d9cd6a..9c83c3935397b 100644 --- a/shell/platform/embedder/tests/embedder_context.h +++ b/shell/platform/embedder/tests/embedder_context.h @@ -16,11 +16,23 @@ #include "flutter/shell/platform/embedder/embedder.h" #include "flutter/shell/platform/embedder/tests/embedder_test_resolver.h" +#define CREATE_NATIVE_ENTRY(native_entry) \ + ({ \ + static ::shell::testing::EmbedderContext::NativeEntry closure; \ + static Dart_NativeFunction entrypoint = [](Dart_NativeArguments args) { \ + closure(args); \ + }; \ + closure = (native_entry); \ + entrypoint; \ + }) + namespace shell { namespace testing { class EmbedderContext { public: + using NativeEntry = std::function; + EmbedderContext(std::string assets_path = ""); ~EmbedderContext(); diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc index 01d23ff0d885f..6bad99a39dd0c 100644 --- a/shell/platform/embedder/tests/embedder_unittests.cc +++ b/shell/platform/embedder/tests/embedder_unittests.cc @@ -59,5 +59,45 @@ TEST_F(EmbedderTest, CanInvokeCustomEntrypoint) { ASSERT_TRUE(engine.is_valid()); } +TEST_F(EmbedderTest, CanInvokeCustomEntrypointMacro) { + auto& context = GetEmbedderContext(); + + fml::AutoResetWaitableEvent latch1; + fml::AutoResetWaitableEvent latch2; + fml::AutoResetWaitableEvent latch3; + + // Can be defined separately. + auto entry1 = [&latch1](Dart_NativeArguments args) { + FML_LOG(ERROR) << "In Callback 1"; + latch1.Signal(); + }; + auto native_entry1 = CREATE_NATIVE_ENTRY(entry1); + context.AddNativeCallback("SayHiFromCustomEntrypoint1", native_entry1); + + // Can be wrapped in in the args. + auto entry2 = [&latch2](Dart_NativeArguments args) { + FML_LOG(ERROR) << "In Callback 2"; + latch2.Signal(); + }; + context.AddNativeCallback("SayHiFromCustomEntrypoint2", + CREATE_NATIVE_ENTRY(entry2)); + + // Everything can be inline. + context.AddNativeCallback( + "SayHiFromCustomEntrypoint3", + CREATE_NATIVE_ENTRY([&latch3](Dart_NativeArguments args) { + FML_LOG(ERROR) << "In Callback 3"; + latch3.Signal(); + })); + + EmbedderConfigBuilder builder(context); + builder.SetDartEntrypoint("customEntrypoint1"); + auto engine = builder.LaunchEngine(); + latch1.Wait(); + latch2.Wait(); + latch3.Wait(); + ASSERT_TRUE(engine.is_valid()); +} + } // namespace testing } // namespace shell From 7e77d5c484a08cc1c189619e80ae71a7f1df62fb Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 26 Mar 2019 13:49:41 -0700 Subject: [PATCH 0571/1117] Revert "Allow specification of std::functions as native entrypoints from Dart code. (#8309)" (#8312) This reverts commit 400a86a62efd3c8504672b8a63323cc837282135. --- .../embedder/fixtures/simple_main.dart | 12 ------ .../embedder/tests/embedder_context.h | 12 ------ .../embedder/tests/embedder_unittests.cc | 40 ------------------- 3 files changed, 64 deletions(-) diff --git a/shell/platform/embedder/fixtures/simple_main.dart b/shell/platform/embedder/fixtures/simple_main.dart index bd3999563e031..b1124b508b7e3 100644 --- a/shell/platform/embedder/fixtures/simple_main.dart +++ b/shell/platform/embedder/fixtures/simple_main.dart @@ -6,15 +6,3 @@ void customEntrypoint() { } void sayHiFromCustomEntrypoint() native "SayHiFromCustomEntrypoint"; - - -@pragma('vm:entry-point') -void customEntrypoint1() { - sayHiFromCustomEntrypoint1(); - sayHiFromCustomEntrypoint2(); - sayHiFromCustomEntrypoint3(); -} - -void sayHiFromCustomEntrypoint1() native "SayHiFromCustomEntrypoint1"; -void sayHiFromCustomEntrypoint2() native "SayHiFromCustomEntrypoint2"; -void sayHiFromCustomEntrypoint3() native "SayHiFromCustomEntrypoint3"; diff --git a/shell/platform/embedder/tests/embedder_context.h b/shell/platform/embedder/tests/embedder_context.h index 9c83c3935397b..6405163d9cd6a 100644 --- a/shell/platform/embedder/tests/embedder_context.h +++ b/shell/platform/embedder/tests/embedder_context.h @@ -16,23 +16,11 @@ #include "flutter/shell/platform/embedder/embedder.h" #include "flutter/shell/platform/embedder/tests/embedder_test_resolver.h" -#define CREATE_NATIVE_ENTRY(native_entry) \ - ({ \ - static ::shell::testing::EmbedderContext::NativeEntry closure; \ - static Dart_NativeFunction entrypoint = [](Dart_NativeArguments args) { \ - closure(args); \ - }; \ - closure = (native_entry); \ - entrypoint; \ - }) - namespace shell { namespace testing { class EmbedderContext { public: - using NativeEntry = std::function; - EmbedderContext(std::string assets_path = ""); ~EmbedderContext(); diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc index 6bad99a39dd0c..01d23ff0d885f 100644 --- a/shell/platform/embedder/tests/embedder_unittests.cc +++ b/shell/platform/embedder/tests/embedder_unittests.cc @@ -59,45 +59,5 @@ TEST_F(EmbedderTest, CanInvokeCustomEntrypoint) { ASSERT_TRUE(engine.is_valid()); } -TEST_F(EmbedderTest, CanInvokeCustomEntrypointMacro) { - auto& context = GetEmbedderContext(); - - fml::AutoResetWaitableEvent latch1; - fml::AutoResetWaitableEvent latch2; - fml::AutoResetWaitableEvent latch3; - - // Can be defined separately. - auto entry1 = [&latch1](Dart_NativeArguments args) { - FML_LOG(ERROR) << "In Callback 1"; - latch1.Signal(); - }; - auto native_entry1 = CREATE_NATIVE_ENTRY(entry1); - context.AddNativeCallback("SayHiFromCustomEntrypoint1", native_entry1); - - // Can be wrapped in in the args. - auto entry2 = [&latch2](Dart_NativeArguments args) { - FML_LOG(ERROR) << "In Callback 2"; - latch2.Signal(); - }; - context.AddNativeCallback("SayHiFromCustomEntrypoint2", - CREATE_NATIVE_ENTRY(entry2)); - - // Everything can be inline. - context.AddNativeCallback( - "SayHiFromCustomEntrypoint3", - CREATE_NATIVE_ENTRY([&latch3](Dart_NativeArguments args) { - FML_LOG(ERROR) << "In Callback 3"; - latch3.Signal(); - })); - - EmbedderConfigBuilder builder(context); - builder.SetDartEntrypoint("customEntrypoint1"); - auto engine = builder.LaunchEngine(); - latch1.Wait(); - latch2.Wait(); - latch3.Wait(); - ASSERT_TRUE(engine.is_valid()); -} - } // namespace testing } // namespace shell From 80b825ce80267889afac96d5d3eb1d8d0b0ccea4 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 26 Mar 2019 14:36:25 -0700 Subject: [PATCH 0572/1117] Roll src/third_party/dart 093c2909fe..f3fd1943fc (13 commits) (#8310) f3fd1943fc [vm/ffi] Update status file for FFI sqlite sample. 28a2416320 Fix sqlite sample import. f135a49861 [doc] dart:ffi SQLite sample 69079303cf [infra] Add a shard to the FFI builders. 1af9f99a5f [cfe] Compile loops in map literals 4c48062955 [CFE] Fail silently on invalid constructs during constant evaluation. a8e51c5868 Bypass use of dart2js_platform.dill when experimental flags are non-default b2a2c088d3 [infra] Add --apply-changelist option to apply_preapprovals. ac21076110 [cfe] Implement compilation of loops in lists and sets 0a3cd80d41 Reland "Change default of 'keepFields' in constant transformation to true" 12d789fa52 [cfe] Update test status files e5374a688c [cfe] Add front-end support for for and for-in 432e5faeda [VM / Service] Update core library source loading to use resolved_url --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 37798eea81185..c6117dda55ec5 100644 --- a/DEPS +++ b/DEPS @@ -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': '093c2909fedaaa4c1cbe21887bfbe97c59be21d2', + 'dart_revision': 'f3fd1943fcbc7821859dcbcd8973944478c3e902', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 1ec8baf2c6bce..460a46d6fd37c 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 191c43b2cc3260647a4ea7da4169f97e +Signature: f161b2aef0c1e3da3efbff25e2c31298 UNUSED LICENSES: @@ -4609,6 +4609,17 @@ FILE: ../../../third_party/dart/runtime/observatory/web/index.html FILE: ../../../third_party/dart/runtime/observatory/web/third_party/trace_viewer_full.html FILE: ../../../third_party/dart/runtime/observatory/web/timeline.html FILE: ../../../third_party/dart/runtime/vm/snapshot_test_in.dat +FILE: ../../../third_party/dart/samples/ffi/sqlite/docs/lib/scenario-default.svg +FILE: ../../../third_party/dart/samples/ffi/sqlite/docs/lib/scenario-full.svg +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/sqlite.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/bindings/bindings.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/bindings/constants.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/bindings/signatures.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/bindings/types.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/collections/closable_iterator.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/database.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/ffi/arena.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/ffi/cstring.dart FILE: ../../../third_party/dart/sdk/lib/html/html_common/conversions_dart2js.dart FILE: ../../../third_party/dart/sdk/lib/html/html_common/html_common.dart FILE: ../../../third_party/dart/sdk/lib/libraries.json @@ -5192,6 +5203,7 @@ FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions.dart FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions_callbacks.dart FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions_structs.dart FILE: ../../../third_party/dart/samples/ffi/sample_ffi_structs.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/ffi/dylib_utils.dart FILE: ../../../third_party/dart/sdk/lib/ffi/annotations.dart FILE: ../../../third_party/dart/sdk/lib/ffi/dynamic_library.dart FILE: ../../../third_party/dart/sdk/lib/ffi/ffi.dart From f521df383909cf2a3011f552fc574184c96d92dc Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 26 Mar 2019 14:36:51 -0700 Subject: [PATCH 0573/1117] Fixed service isolate not being initialized correctly due to bad name (#8251) * Fixed service isolate not being initialized correctly due to bad name The name for the service isolate was being set to the empty string, causing the microtask loop to not be run on the service isolate leading to the service hanging on the first 'await'. See https://dart-review.googlesource.com/c/sdk/+/97107 for revert due to this issue. * Removed unnecessary params from DartCreateAndStartServiceIsolate --- runtime/dart_isolate.cc | 35 ++++++++++++++--------------------- runtime/dart_isolate.h | 2 -- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 4340ccdc3918c..8d53f3b13ea62 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -487,8 +487,6 @@ bool DartIsolate::Shutdown() { } Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( - const char* advisory_script_uri, - const char* advisory_script_entrypoint, const char* package_root, const char* package_config, Dart_IsolateFlags* flags, @@ -517,19 +515,16 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( std::weak_ptr weak_service_isolate = DartIsolate::CreateRootIsolate( - vm.get(), // vm - vm->GetIsolateSnapshot(), // isolate snapshot - vm->GetSharedSnapshot(), // shared snapshot - null_task_runners, // task runners - nullptr, // window - {}, // snapshot delegate - {}, // IO Manager - advisory_script_uri == nullptr ? "" - : advisory_script_uri, // script uri - advisory_script_entrypoint == nullptr - ? "" - : advisory_script_entrypoint, // script entrypoint - flags // flags + vm.get(), // vm + vm->GetIsolateSnapshot(), // isolate snapshot + vm->GetSharedSnapshot(), // shared snapshot + null_task_runners, // task runners + nullptr, // window + {}, // snapshot delegate + {}, // IO Manager + DART_VM_SERVICE_ISOLATE_NAME, // script uri + DART_VM_SERVICE_ISOLATE_NAME, // script entrypoint + flags // flags ); std::shared_ptr service_isolate = weak_service_isolate.lock(); @@ -573,12 +568,10 @@ Dart_Isolate DartIsolate::DartIsolateCreateCallback( // DART_VM_SERVICE_ISOLATE_NAME. In such cases, we just create the service // isolate like normal but dont hold a reference to it at all. We also start // this isolate since we will never again reference it from the engine. - return DartCreateAndStartServiceIsolate(advisory_script_uri, // - advisory_script_entrypoint, // - package_root, // - package_config, // - flags, // - error // + return DartCreateAndStartServiceIsolate(package_root, // + package_config, // + flags, // + error // ); } diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index bcd90a80d112a..d720deafed142 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -138,8 +138,6 @@ class DartIsolate : public UIDartState { char** error); static Dart_Isolate DartCreateAndStartServiceIsolate( - const char* advisory_script_uri, - const char* advisory_script_entrypoint, const char* package_root, const char* package_config, Dart_IsolateFlags* flags, From f64ee01e185d4e1f9a1c6569c64466333def6980 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 26 Mar 2019 17:47:49 -0400 Subject: [PATCH 0574/1117] Roll src/third_party/skia d2ca31218bc4..45d5f702133e (11 commits) (#8315) https://skia.googlesource.com/skia.git/%2Blog/d2ca31218bc4..45d5f702133e git log d2ca31218bc4d06fd3337fb1951ea1800a915f56..45d5f702133e8c122e46ab14863a3f3df481c974 --date=short --no-merges --format=%ad %ae %s 2019-03-26 rmistry@google.com Fix RecreateSKPs bot page sets II 2019-03-26 csmartdalton@google.com Add MSAA and non-aa modes to GrFillRRect Op 2019-03-26 fmalita@chromium.org [skottie] Relocate text shaping utils to separate compilation unit 2019-03-26 mtklein@google.com quiet down SkFontHost_FreeType debug logs 2019-03-26 jvanverth@google.com Fix BGRA GL texture format on iOS 2019-03-22 michaelludwig@google.com Remove old experimental SkiaRenderer APIs 2019-03-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 213a8ce6d5c2..cc6473f7d80d (4 commits) 2019-03-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 da37e7f6759d..a47e2a23ab4c (2 commits) 2019-03-26 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-03-26 robertphillips@google.com Revert "Fix bug in GrResourceAllocator's intermediate flushing" 2019-03-26 robertphillips@google.com Fix bug in GrResourceAllocator's intermediate flushing The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c6117dda55ec5..497e7246d3ac9 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': 'd2ca31218bc4d06fd3337fb1951ea1800a915f56', + 'skia_revision': '45d5f702133e8c122e46ab14863a3f3df481c974', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a34e50dfd6345..dd7b404db5130 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 11cd0788531075042d9be33f624cf021 +Signature: 3f67afb6ad8082e084c9cf85aa354b97 UNUSED LICENSES: @@ -4572,6 +4572,8 @@ FILE: ../../../third_party/skia/include/private/GrContext_Base.h FILE: ../../../third_party/skia/include/private/GrImageContext.h FILE: ../../../third_party/skia/include/private/GrRecordingContext.h FILE: ../../../third_party/skia/include/private/SkVx.h +FILE: ../../../third_party/skia/modules/skottie/src/SkottieShaper.cpp +FILE: ../../../third_party/skia/modules/skottie/src/SkottieShaper.h FILE: ../../../third_party/skia/modules/sksg/include/SkSGRenderEffect.h FILE: ../../../third_party/skia/modules/sksg/src/SkSGRenderEffect.cpp FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h From fd7d7fa5a057aa40c1e26af461117723bfe19566 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Tue, 26 Mar 2019 16:04:42 -0700 Subject: [PATCH 0575/1117] Add a11y support for embedded iOS platform view (#8156) Follow up the framework change in flutter/flutter#29304. Inject the accessibility element tree in the semantic node if the node is for platform views. flutter/flutter#29302 --- lib/ui/semantics/semantics_node.cc | 6 ++ lib/ui/semantics/semantics_node.h | 3 + .../framework/Source/FlutterPlatformViews.mm | 7 ++ .../Source/FlutterPlatformViews_Internal.h | 7 ++ .../framework/Source/accessibility_bridge.h | 33 ++++++++- .../framework/Source/accessibility_bridge.mm | 68 ++++++++++++++++++- .../platform/darwin/ios/platform_view_ios.mm | 6 +- 7 files changed, 124 insertions(+), 6 deletions(-) diff --git a/lib/ui/semantics/semantics_node.cc b/lib/ui/semantics/semantics_node.cc index cb655bdde8831..fd44758aa31a9 100644 --- a/lib/ui/semantics/semantics_node.cc +++ b/lib/ui/semantics/semantics_node.cc @@ -8,6 +8,8 @@ namespace blink { +constexpr int32_t kMinPlatfromViewId = -1; + SemanticsNode::SemanticsNode() = default; SemanticsNode::SemanticsNode(const SemanticsNode& other) = default; @@ -22,4 +24,8 @@ bool SemanticsNode::HasFlag(SemanticsFlags flag) { return (flags & static_cast(flag)) != 0; } +bool SemanticsNode::IsPlatformViewNode() const { + return platformViewId > kMinPlatfromViewId; +} + } // namespace blink diff --git a/lib/ui/semantics/semantics_node.h b/lib/ui/semantics/semantics_node.h index 16a87a32d9c07..6d570b42c75a9 100644 --- a/lib/ui/semantics/semantics_node.h +++ b/lib/ui/semantics/semantics_node.h @@ -81,6 +81,9 @@ struct SemanticsNode { bool HasAction(SemanticsAction action); bool HasFlag(SemanticsFlags flag); + // Whether this node is for embeded platform views. + bool IsPlatformViewNode() const; + int32_t id = 0; int32_t flags = 0; int32_t actions = 0; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm index 4eb773532a183..d3c42ed446b07 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm @@ -165,6 +165,13 @@ composition_order_.push_back(view_id); } +NSObject* FlutterPlatformViewsController::GetPlatformViewByID(int view_id) { + if (views_.empty()) { + return nil; + } + return views_[view_id].get(); +} + std::vector FlutterPlatformViewsController::GetCurrentCanvases() { std::vector canvases; for (size_t i = 0; i < composition_order_.size(); i++) { diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h index 118822c3b7962..a0ebbac98b302 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h @@ -58,6 +58,13 @@ class FlutterPlatformViewsController { void PrerollCompositeEmbeddedView(int view_id); + // Returns the `FlutterPlatformView` object associated with the view_id. + // + // If the `FlutterPlatformViewsController` does not contain any `FlutterPlatformView` object or + // a `FlutterPlatformView` object asscociated with the view_id cannot be found, the method returns + // nil. + NSObject* GetPlatformViewByID(int view_id); + std::vector GetCurrentCanvases(); SkCanvas* CompositeEmbeddedView(int view_id, const flow::EmbeddedViewParams& params); diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h index 465abc5035191..f48064a258afd 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h +++ b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h @@ -27,6 +27,8 @@ namespace shell { class AccessibilityBridge; } // namespace shell +@class FlutterPlatformViewSemanticsContainer; + /** * A node in the iOS semantics tree. */ @@ -71,6 +73,11 @@ class AccessibilityBridge; */ @property(nonatomic, strong) NSMutableArray* children; +/** + * Used if this SemanticsObject is for a platform view. + */ +@property(strong, nonatomic) FlutterPlatformViewSemanticsContainer* platformViewSemanticsContainer; + - (BOOL)nodeWillCauseLayoutChange:(const blink::SemanticsNode*)node; #pragma mark - Designated initializers @@ -108,12 +115,31 @@ class AccessibilityBridge; @interface FlutterSemanticsObject : SemanticsObject @end +/** + * Designated to act as an accessibility container of a platform view. + * + * This object does not take any accessibility actions on its own, nor has any accessibility + * label/value/trait/hint... on its own. The accessibility data will be handled by the platform + * view. + * + * See also: + * * `SemanticsObject` for the other type of semantics objects. + * * `FlutterSemanticsObject` for default implementation of `SemanticsObject`. + */ +@interface FlutterPlatformViewSemanticsContainer : UIAccessibilityElement + +- (instancetype)init __attribute__((unavailable("Use initWithAccessibilityContainer: instead"))); + +@end + namespace shell { class PlatformViewIOS; class AccessibilityBridge final { public: - AccessibilityBridge(UIView* view, PlatformViewIOS* platform_view); + AccessibilityBridge(UIView* view, + PlatformViewIOS* platform_view, + FlutterPlatformViewsController* platform_views_controller); ~AccessibilityBridge(); void UpdateSemantics(blink::SemanticsNodeUpdates nodes, @@ -129,6 +155,10 @@ class AccessibilityBridge final { fml::WeakPtr GetWeakPtr(); + FlutterPlatformViewsController* GetPlatformViewsController() const { + return platform_views_controller_; + }; + void clearState(); private: @@ -139,6 +169,7 @@ class AccessibilityBridge final { UIView* view_; PlatformViewIOS* platform_view_; + FlutterPlatformViewsController* platform_views_controller_; fml::scoped_nsobject> objects_; fml::scoped_nsprotocol accessibility_channel_; fml::WeakPtrFactory weak_factory_; diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm index 7fe516ac8097e..39bfce29fb702 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm +++ b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm @@ -11,6 +11,7 @@ #import #include "flutter/fml/logging.h" +#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h" #include "flutter/shell/platform/darwin/ios/platform_view_ios.h" namespace { @@ -127,6 +128,7 @@ - (void)dealloc { [_children release]; _parent = nil; _container.get().semanticsObject = nil; + [_platformViewSemanticsContainer release]; [super dealloc]; } @@ -152,6 +154,9 @@ - (BOOL)nodeWillCauseScroll:(const blink::SemanticsNode*)node { } - (BOOL)hasChildren { + if (_node.IsPlatformViewNode()) { + return YES; + } return [self.children count] != 0; } @@ -165,6 +170,7 @@ - (BOOL)isAccessibilityElement { // We enforce in the framework that no other useful semantics are merged with these nodes. if ([self node].HasFlag(blink::SemanticsFlags::kScopesRoute)) return false; + return ([self node].flags != 0 && [self node].flags != static_cast(blink::SemanticsFlags::kIsHidden)) || ![self node].label.empty() || ![self node].value.empty() || ![self node].hint.empty() || @@ -396,6 +402,25 @@ - (UIAccessibilityTraits)accessibilityTraits { @end +@implementation FlutterPlatformViewSemanticsContainer + +// Method declared as unavailable in the interface +- (instancetype)init { + [self release]; + [super doesNotRecognizeSelector:_cmd]; + return nil; +} + +- (instancetype)initWithAccessibilityContainer:(id)container { + FML_CHECK(container); + if (self = [super initWithAccessibilityContainer:container]) { + self.isAccessibilityElement = NO; + } + return self; +} + +@end + @implementation SemanticsObjectContainer { SemanticsObject* _semanticsObject; fml::WeakPtr _bridge; @@ -426,7 +451,12 @@ - (instancetype)initWithSemanticsObject:(SemanticsObject*)semanticsObject #pragma mark - UIAccessibilityContainer overrides - (NSInteger)accessibilityElementCount { - return [[_semanticsObject children] count] + 1; + NSInteger count = [[_semanticsObject children] count] + 1; + // Need to create an additional child that acts as accessibility container for the platform view. + if (_semanticsObject.node.IsPlatformViewNode()) { + count++; + } + return count; } - (nullable id)accessibilityElementAtIndex:(NSInteger)index { @@ -435,7 +465,16 @@ - (nullable id)accessibilityElementAtIndex:(NSInteger)index { if (index == 0) { return _semanticsObject; } + + // Return the additional child acts as a container of platform view. The + // platformViewSemanticsContainer was created and cached in the updateSemantics path. + if (_semanticsObject.node.IsPlatformViewNode() && index == [self accessibilityElementCount] - 1) { + FML_CHECK(_semanticsObject.platformViewSemanticsContainer != nil); + return _semanticsObject.platformViewSemanticsContainer; + } + SemanticsObject* child = [_semanticsObject children][index - 1]; + if ([child hasChildren]) return [child accessibilityContainer]; return child; @@ -444,6 +483,12 @@ - (nullable id)accessibilityElementAtIndex:(NSInteger)index { - (NSInteger)indexOfAccessibilityElement:(id)element { if (element == _semanticsObject) return 0; + + // FlutterPlatformViewSemanticsContainer is always the last element of its parent. + if ([element isKindOfClass:[FlutterPlatformViewSemanticsContainer class]]) { + return [self accessibilityElementCount] - 1; + } + NSMutableArray* children = [_semanticsObject children]; for (size_t i = 0; i < [children count]; i++) { SemanticsObject* child = children[i]; @@ -485,9 +530,12 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { namespace shell { -AccessibilityBridge::AccessibilityBridge(UIView* view, PlatformViewIOS* platform_view) +AccessibilityBridge::AccessibilityBridge(UIView* view, + PlatformViewIOS* platform_view, + FlutterPlatformViewsController* platform_views_controller) : view_(view), platform_view_(platform_view), + platform_views_controller_(platform_views_controller), objects_([[NSMutableDictionary alloc] init]), weak_factory_(this), previous_route_id_(0), @@ -525,7 +573,7 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { layoutChanged = layoutChanged || [object nodeWillCauseLayoutChange:&node]; scrollOccured = scrollOccured || [object nodeWillCauseScroll:&node]; [object setSemanticsNode:&node]; - const NSUInteger newChildCount = node.childrenInTraversalOrder.size(); + NSUInteger newChildCount = node.childrenInTraversalOrder.size(); NSMutableArray* newChildren = [[[NSMutableArray alloc] initWithCapacity:newChildCount] autorelease]; for (NSUInteger i = 0; i < newChildCount; ++i) { @@ -555,6 +603,20 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { } object.accessibilityCustomActions = accessibilityCustomActions; } + + if (object.node.IsPlatformViewNode()) { + shell::FlutterPlatformViewsController* controller = GetPlatformViewsController(); + if (controller) { + object.platformViewSemanticsContainer = [[FlutterPlatformViewSemanticsContainer alloc] + initWithAccessibilityContainer:[object accessibilityContainer]]; + UIView* platformView = [controller->GetPlatformViewByID(object.node.platformViewId) view]; + if (platformView) { + object.platformViewSemanticsContainer.accessibilityElements = @[ platformView ]; + } + } + } else if (object.platformViewSemanticsContainer) { + [object.platformViewSemanticsContainer release]; + } } SemanticsObject* root = objects_.get()[@(kRootNodeId)]; diff --git a/shell/platform/darwin/ios/platform_view_ios.mm b/shell/platform/darwin/ios/platform_view_ios.mm index 6f138edcfdd11..c0b988be882ea 100644 --- a/shell/platform/darwin/ios/platform_view_ios.mm +++ b/shell/platform/darwin/ios/platform_view_ios.mm @@ -50,7 +50,8 @@ if (accessibility_bridge_) { accessibility_bridge_.reset( - new AccessibilityBridge(static_cast(owner_controller_.get().view), this)); + new AccessibilityBridge(static_cast(owner_controller_.get().view), this, + [owner_controller.get() platformViewsController])); } // Do not call `NotifyCreated()` here - let FlutterViewController take care // of that when its Viewport is sized. If `NotifyCreated()` is called here, @@ -96,7 +97,8 @@ } if (enabled && !accessibility_bridge_) { accessibility_bridge_ = std::make_unique( - static_cast(owner_controller_.get().view), this); + static_cast(owner_controller_.get().view), this, + [owner_controller_.get() platformViewsController]); } else if (!enabled && accessibility_bridge_) { accessibility_bridge_.reset(); } From 87db585ade76f06c5ec0523c7b384b10e86f4551 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 26 Mar 2019 21:18:49 -0400 Subject: [PATCH 0576/1117] Roll src/third_party/skia 45d5f702133e..bf341ae88c83 (2 commits) (#8316) https://skia.googlesource.com/skia.git/%2Blog/45d5f702133e..bf341ae88c83 git log 45d5f702133e8c122e46ab14863a3f3df481c974..bf341ae88c83155752e3a2080bb40cefbbbaf32b --date=short --no-merges --format=%ad %ae %s 2019-03-27 csmartdalton@google.com Revert "Add MSAA and non-aa modes to GrFillRRect Op" 2019-03-26 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader cc6473f7d80d..e747b3c3c9d9 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 497e7246d3ac9..d7ba8cf44a383 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': '45d5f702133e8c122e46ab14863a3f3df481c974', + 'skia_revision': 'bf341ae88c83155752e3a2080bb40cefbbbaf32b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index dd7b404db5130..2754292e64710 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 3f67afb6ad8082e084c9cf85aa354b97 +Signature: 1a4cc863926e17f6e4ee31d49a84954b UNUSED LICENSES: From 1daff5ce15b719aa39c6c98179baaf13f0491c61 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 27 Mar 2019 00:47:49 -0400 Subject: [PATCH 0577/1117] Roll src/third_party/skia bf341ae88c83..cec20280b3fb (3 commits) (#8320) https://skia.googlesource.com/skia.git/%2Blog/bf341ae88c83..cec20280b3fb git log bf341ae88c83155752e3a2080bb40cefbbbaf32b..cec20280b3fb818e3be9a07ef585983c17329a2a --date=short --no-merges --format=%ad %ae %s 2019-03-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 a47e2a23ab4c..518c679da109 (3 commits) 2019-03-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 4035f6c897d0..83d44af5c208 (535 commits) 2019-03-26 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d7ba8cf44a383..6bfce85299f62 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': 'bf341ae88c83155752e3a2080bb40cefbbbaf32b', + 'skia_revision': 'cec20280b3fb818e3be9a07ef585983c17329a2a', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2754292e64710..e0080b421d613 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 1a4cc863926e17f6e4ee31d49a84954b +Signature: 4483f2de15dffb85d88bd33110514876 UNUSED LICENSES: From e5b31cdd982d32b593a03b6f40b80a3f9c4770d5 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 27 Mar 2019 04:17:49 -0400 Subject: [PATCH 0578/1117] Roll src/third_party/skia cec20280b3fb..d1c271bd39f0 (3 commits) (#8321) https://skia.googlesource.com/skia.git/%2Blog/cec20280b3fb..d1c271bd39f0 git log cec20280b3fb818e3be9a07ef585983c17329a2a..d1c271bd39f037ad08958f913194474e763af288 --date=short --no-merges --format=%ad %ae %s 2019-03-27 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-03-27 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update SKP version 2019-03-27 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update SKP version The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 6bfce85299f62..3697fd27bb15d 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': 'cec20280b3fb818e3be9a07ef585983c17329a2a', + 'skia_revision': 'd1c271bd39f037ad08958f913194474e763af288', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index e0080b421d613..a7af142d77bcc 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 4483f2de15dffb85d88bd33110514876 +Signature: 69da492a82515d5c30b77a1cff3fd5db UNUSED LICENSES: From 66141eb8e891861f1919ae844a14729154e95e18 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 27 Mar 2019 07:47:50 -0400 Subject: [PATCH 0579/1117] Roll src/third_party/skia d1c271bd39f0..c476e5da4fef (2 commits) (#8322) https://skia.googlesource.com/skia.git/%2Blog/d1c271bd39f0..c476e5da4fef git log d1c271bd39f037ad08958f913194474e763af288..c476e5da4fef336e5071e5a93b1beacda8ad92f0 --date=short --no-merges --format=%ad %ae %s 2019-03-26 robertphillips@google.com Fix bug in GrResourceAllocator's intermediate flushing (take 2) 2019-03-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader e747b3c3c9d9..df5b28fdb45c (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 3697fd27bb15d..3fc9c8c1dddb7 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': 'd1c271bd39f037ad08958f913194474e763af288', + 'skia_revision': 'c476e5da4fef336e5071e5a93b1beacda8ad92f0', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a7af142d77bcc..1d842a84e3e51 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 69da492a82515d5c30b77a1cff3fd5db +Signature: 7d66ee2bd2b68f3fa7c207bb28d06a35 UNUSED LICENSES: From cadcf1c5841b5f97d04b85b9b4f327bffaf16713 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 27 Mar 2019 07:04:11 -0700 Subject: [PATCH 0580/1117] Roll src/third_party/dart f3fd1943fc..8a92d2a8d9 (16 commits) 8a92d2a8d9 Collect types deeply for deferred loading bd99509601 [infra] Fix approve_results race condition checking failing on new builders. 440d287fa8 [infra] Run pkg/(front_end|kernel) tests only on front-end builders 4256a97a3d [co19] DEPS file updated b7a5e478bb [vm, service] Allow choice of tags and code-verus-function when getting profile samples as timeline events. 0e485045d4 Deflake socket reads on Fuchsia 45c367d8e8 Add plugin performance data to the server status pages 57321c1590 Revert "[vm/kernel] Index all source and line starts before using them" 419243fc4e Add support for BlockExpression. 61f0f5bc43 [vm/bytecode] Declare members in bytecode e1a689310b [dartdevc] Generating nested functions that invoke super as arrow functions (e.g., mixins) 3a3731665f Initial implementation of server support for training data fbc70da0d3 [cfe] Add inference and type checks in for-elements in lists and sets 49a7fa1c11 [cfe] Add inference and type checks for if-elements in lists and sets 73d5c6bab0 Make the collection await for test actually return a stream. e8fc260e93 [gardening] Clean up outdated flutter hhh patches --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 39 +++++++++++++++++++++++-- sky/packages/sky_engine/LICENSE | 29 ++++++++++++++++++ 3 files changed, 67 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 3fc9c8c1dddb7..87d1339f2b9c7 100644 --- a/DEPS +++ b/DEPS @@ -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': 'f3fd1943fcbc7821859dcbcd8973944478c3e902', + 'dart_revision': '8a92d2a8d943768db75a7e4bc58ba818581a7899', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 460a46d6fd37c..f43d1056d56ba 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: f161b2aef0c1e3da3efbff25e2c31298 +Signature: 7556d1d49a22dc670aa6ac43db2d04c2 UNUSED LICENSES: @@ -5474,6 +5474,7 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/bytecode_flow_graph FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/bytecode_flow_graph_builder.h FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/bytecode_reader.cc FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/bytecode_reader.h +FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/bytecode_scope_builder.cc FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/constant_evaluator.cc FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/constant_evaluator.h FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/kernel_fingerprints.cc @@ -6566,6 +6567,40 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== +==================================================================================================== +LIBRARY: dart +ORIGIN: ../../../third_party/dart/runtime/vm/compiler/frontend/bytecode_scope_builder.h + ../../../third_party/dart/LICENSE +TYPE: LicenseType.bsd +FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/bytecode_scope_builder.h +---------------------------------------------------------------------------------------------------- +Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file +for details. 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: double-conversion LIBRARY: icu @@ -18833,4 +18868,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: 310 +Total license count: 311 diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index 658e1e8c7cd99..7bd31a5c5c917 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -3398,6 +3398,35 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- dart +Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file +for details. 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. +-------------------------------------------------------------------------------- +dart + Copyright 2009 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file From 20c241ac32cd8571c31431671d131772e7ee78a2 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 27 Mar 2019 11:17:49 -0400 Subject: [PATCH 0581/1117] Roll src/third_party/skia c476e5da4fef..576eb87a2d2d (7 commits) (#8324) https://skia.googlesource.com/skia.git/%2Blog/c476e5da4fef..576eb87a2d2d git log c476e5da4fef336e5071e5a93b1beacda8ad92f0..576eb87a2d2d58d169a2bf52cc99ab077c91a8a7 --date=short --no-merges --format=%ad %ae %s 2019-03-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader df5b28fdb45c..e43cda5f76de (1 commits) 2019-03-26 michaelludwig@google.com Fix paint filter quality in draw_image_set GM 2019-03-26 enne@chromium.org Add a function to compute texture sizes 2019-03-25 mtklein@google.com FM, a dumber new testing tool 2019-03-27 rmistry@google.com Fix RecreateSKPs bot page sets III 2019-03-27 robertphillips@google.com Minor cleanup of GrResourceAllocator 2019-03-27 fmalita@chromium.org [skottie] Fix handling of hidden shapes and layers The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 87d1339f2b9c7..95bd7eeff4865 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': 'c476e5da4fef336e5071e5a93b1beacda8ad92f0', + 'skia_revision': '576eb87a2d2d58d169a2bf52cc99ab077c91a8a7', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 1d842a84e3e51..a28368735ad2a 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 7d66ee2bd2b68f3fa7c207bb28d06a35 +Signature: e0cb03599ce070b93c6fb67f4215d634 UNUSED LICENSES: From 48496588c6aea03fd102e590d775093ddb1059ca Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 27 Mar 2019 09:58:26 -0700 Subject: [PATCH 0582/1117] Roll src/third_party/dart 8a92d2a8d9..991c9da720 (2 commits) 991c9da720 [vm/ffi] Add copyright headers to sqlite example and incorporate Michael's feedback. 7a15b02935 [vm/ffi] Add demo docs for using FFI on Android. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/DEPS b/DEPS index 95bd7eeff4865..b5b12652e2c6a 100644 --- a/DEPS +++ b/DEPS @@ -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': '8a92d2a8d943768db75a7e4bc58ba818581a7899', + 'dart_revision': '991c9da7205b512e479283419bcbdc19f1f1f6c2', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index f43d1056d56ba..0577e5e15c372 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 7556d1d49a22dc670aa6ac43db2d04c2 +Signature: 6eb19e0e7f8dc1c24ff6d11400c5b80c UNUSED LICENSES: @@ -4611,15 +4611,6 @@ FILE: ../../../third_party/dart/runtime/observatory/web/timeline.html FILE: ../../../third_party/dart/runtime/vm/snapshot_test_in.dat FILE: ../../../third_party/dart/samples/ffi/sqlite/docs/lib/scenario-default.svg FILE: ../../../third_party/dart/samples/ffi/sqlite/docs/lib/scenario-full.svg -FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/sqlite.dart -FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/bindings/bindings.dart -FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/bindings/constants.dart -FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/bindings/signatures.dart -FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/bindings/types.dart -FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/collections/closable_iterator.dart -FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/database.dart -FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/ffi/arena.dart -FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/ffi/cstring.dart FILE: ../../../third_party/dart/sdk/lib/html/html_common/conversions_dart2js.dart FILE: ../../../third_party/dart/sdk/lib/html/html_common/html_common.dart FILE: ../../../third_party/dart/sdk/lib/libraries.json @@ -5203,6 +5194,16 @@ FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions.dart FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions_callbacks.dart FILE: ../../../third_party/dart/samples/ffi/sample_ffi_functions_structs.dart FILE: ../../../third_party/dart/samples/ffi/sample_ffi_structs.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/example/main.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/sqlite.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/bindings/bindings.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/bindings/constants.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/bindings/signatures.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/bindings/types.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/collections/closable_iterator.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/database.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/ffi/arena.dart +FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/ffi/cstring.dart FILE: ../../../third_party/dart/samples/ffi/sqlite/lib/src/ffi/dylib_utils.dart FILE: ../../../third_party/dart/sdk/lib/ffi/annotations.dart FILE: ../../../third_party/dart/sdk/lib/ffi/dynamic_library.dart From ce9ea5869456592779cb70ca17895f288a328049 Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Wed, 27 Mar 2019 10:36:34 -0700 Subject: [PATCH 0583/1117] [fuchsia] Disable FML_TRACE_COUNTER events to unblock roll (#8325) --- fml/trace_event.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fml/trace_event.h b/fml/trace_event.h index 979d430f6be65..a036292a01d9a 100644 --- a/fml/trace_event.h +++ b/fml/trace_event.h @@ -13,7 +13,9 @@ #include -#define FML_TRACE_COUNTER(a, b, c, d, args...) TRACE_COUNTER(a, b, c, d) +// TODO(DNO-448): This is disabled because the Fuchsia counter id json parsing +// only handles ints whereas this can produce ints or strings. +#define FML_TRACE_COUNTER(a, b, c, args...) #define FML_TRACE_EVENT(a, b, args...) TRACE_DURATION(a, b) #define TRACE_EVENT0(a, b) TRACE_DURATION(a, b) From 3a415c4f1e3ef277d401e826c503e7c09e794ee7 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 27 Mar 2019 14:08:22 -0400 Subject: [PATCH 0584/1117] Map glfw into third_party, and roll buildroot (#8308) Adds glfw to //third_party/, and rolls the buildroot to ee817fb84542865e253bcce1866bc13e4065ca4d to pick up the build rules for it. --- DEPS | 5 +- ci/licenses_golden/licenses_third_party | 302 +++++++++++++++++++++++- ci/licenses_golden/tool_signature | 2 +- sky/packages/sky_engine/LICENSE | 188 +++++++++++++++ tools/licenses/lib/filesystem.dart | 1 + tools/licenses/lib/main.dart | 14 ++ 6 files changed, 508 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index b5b12652e2c6a..2d1c81deb87f9 100644 --- a/DEPS +++ b/DEPS @@ -121,7 +121,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '9c7b023ff266ee58b00fe60326fa1db910a087f3', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'ee817fb84542865e253bcce1866bc13e4065ca4d', # Fuchsia compatibility # @@ -150,6 +150,9 @@ deps = { 'src/third_party/libcxxabi': Var('fuchsia_git') + '/third_party/libcxxabi' + '@' + '1a9753522f1ae8d72848d365902f39e0d3d59a39', + 'src/third_party/glfw': + Var('fuchsia_git') + '/third_party/glfw' + '@' + '999f3556fdd80983b10051746264489f2cb1ef16', + # Chromium-style # # As part of integrating with Fuchsia, we should eventually remove all these diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 0577e5e15c372..bc2bb1adbb6d9 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 6eb19e0e7f8dc1c24ff6d11400c5b80c +Signature: 7836db551ccf7833d0c865f0d2a3cfad UNUSED LICENSES: @@ -8014,6 +8014,304 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ==================================================================================================== +==================================================================================================== +LIBRARY: glfw +ORIGIN: ../../../third_party/glfw/COPYING.txt +TYPE: LicenseType.zlib +FILE: ../../../third_party/glfw/.appveyor.yml +FILE: ../../../third_party/glfw/CMake/MacOSXBundleInfo.plist.in +FILE: ../../../third_party/glfw/cmake_uninstall.cmake.in +FILE: ../../../third_party/glfw/docs/Doxyfile.in +FILE: ../../../third_party/glfw/docs/DoxygenLayout.xml +FILE: ../../../third_party/glfw/docs/build.dox +FILE: ../../../third_party/glfw/docs/compat.dox +FILE: ../../../third_party/glfw/docs/compile.dox +FILE: ../../../third_party/glfw/docs/context.dox +FILE: ../../../third_party/glfw/docs/extra.less +FILE: ../../../third_party/glfw/docs/footer.html +FILE: ../../../third_party/glfw/docs/header.html +FILE: ../../../third_party/glfw/docs/input.dox +FILE: ../../../third_party/glfw/docs/internal.dox +FILE: ../../../third_party/glfw/docs/intro.dox +FILE: ../../../third_party/glfw/docs/main.dox +FILE: ../../../third_party/glfw/docs/monitor.dox +FILE: ../../../third_party/glfw/docs/moving.dox +FILE: ../../../third_party/glfw/docs/news.dox +FILE: ../../../third_party/glfw/docs/quick.dox +FILE: ../../../third_party/glfw/docs/spaces.svg +FILE: ../../../third_party/glfw/docs/vulkan.dox +FILE: ../../../third_party/glfw/docs/window.dox +FILE: ../../../third_party/glfw/include/GLFW/glfw3.h +FILE: ../../../third_party/glfw/include/GLFW/glfw3native.h +FILE: ../../../third_party/glfw/src/cocoa_monitor.m +FILE: ../../../third_party/glfw/src/context.c +FILE: ../../../third_party/glfw/src/egl_context.c +FILE: ../../../third_party/glfw/src/egl_context.h +FILE: ../../../third_party/glfw/src/glfw3.pc.in +FILE: ../../../third_party/glfw/src/glfw3Config.cmake.in +FILE: ../../../third_party/glfw/src/glx_context.c +FILE: ../../../third_party/glfw/src/glx_context.h +FILE: ../../../third_party/glfw/src/init.c +FILE: ../../../third_party/glfw/src/input.c +FILE: ../../../third_party/glfw/src/internal.h +FILE: ../../../third_party/glfw/src/linux_joystick.c +FILE: ../../../third_party/glfw/src/monitor.c +FILE: ../../../third_party/glfw/src/posix_time.c +FILE: ../../../third_party/glfw/src/posix_time.h +FILE: ../../../third_party/glfw/src/posix_tls.c +FILE: ../../../third_party/glfw/src/posix_tls.h +FILE: ../../../third_party/glfw/src/vulkan.c +FILE: ../../../third_party/glfw/src/wgl_context.c +FILE: ../../../third_party/glfw/src/wgl_context.h +FILE: ../../../third_party/glfw/src/win32_init.c +FILE: ../../../third_party/glfw/src/win32_joystick.c +FILE: ../../../third_party/glfw/src/win32_monitor.c +FILE: ../../../third_party/glfw/src/win32_platform.h +FILE: ../../../third_party/glfw/src/win32_time.c +FILE: ../../../third_party/glfw/src/win32_tls.c +FILE: ../../../third_party/glfw/src/win32_window.c +FILE: ../../../third_party/glfw/src/x11_init.c +FILE: ../../../third_party/glfw/src/x11_monitor.c +FILE: ../../../third_party/glfw/src/x11_platform.h +FILE: ../../../third_party/glfw/src/x11_window.c +FILE: ../../../third_party/glfw/src/xkb_unicode.c +---------------------------------------------------------------------------------------------------- +Copyright (c) 2002-2006 Marcus Geelnard +Copyright (c) 2006-2016 Camilla Berglund + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +==================================================================================================== + +==================================================================================================== +LIBRARY: glfw +ORIGIN: ../../../third_party/glfw/src/cocoa_init.m +TYPE: LicenseType.zlib +FILE: ../../../third_party/glfw/src/cocoa_init.m +FILE: ../../../third_party/glfw/src/cocoa_platform.h +FILE: ../../../third_party/glfw/src/cocoa_time.c +FILE: ../../../third_party/glfw/src/cocoa_window.m +FILE: ../../../third_party/glfw/src/nsgl_context.h +FILE: ../../../third_party/glfw/src/nsgl_context.m +---------------------------------------------------------------------------------------------------- +Copyright (c) 2009-2016 Camilla Berglund + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +==================================================================================================== + +==================================================================================================== +LIBRARY: glfw +ORIGIN: ../../../third_party/glfw/src/cocoa_joystick.h +TYPE: LicenseType.zlib +FILE: ../../../third_party/glfw/src/cocoa_joystick.h +FILE: ../../../third_party/glfw/src/win32_joystick.h +---------------------------------------------------------------------------------------------------- +Copyright (c) 2006-2016 Camilla Berglund + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +==================================================================================================== + +==================================================================================================== +LIBRARY: glfw +ORIGIN: ../../../third_party/glfw/src/cocoa_joystick.m +TYPE: LicenseType.zlib +FILE: ../../../third_party/glfw/src/cocoa_joystick.m +---------------------------------------------------------------------------------------------------- +Copyright (c) 2009-2016 Camilla Berglund +Copyright (c) 2012 Torsten Walluhn + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +==================================================================================================== + +==================================================================================================== +LIBRARY: glfw +ORIGIN: ../../../third_party/glfw/src/glfw_config.h.in +TYPE: LicenseType.zlib +FILE: ../../../third_party/glfw/src/glfw_config.h.in +---------------------------------------------------------------------------------------------------- +Copyright (c) 2010-2016 Camilla Berglund + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +==================================================================================================== + +==================================================================================================== +LIBRARY: glfw +ORIGIN: ../../../third_party/glfw/src/linux_joystick.h +TYPE: LicenseType.zlib +FILE: ../../../third_party/glfw/src/linux_joystick.h +FILE: ../../../third_party/glfw/src/wl_init.c +FILE: ../../../third_party/glfw/src/wl_monitor.c +FILE: ../../../third_party/glfw/src/wl_platform.h +FILE: ../../../third_party/glfw/src/wl_window.c +FILE: ../../../third_party/glfw/src/xkb_unicode.h +---------------------------------------------------------------------------------------------------- +Copyright (c) 2014 Jonas Ådahl + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +==================================================================================================== + +==================================================================================================== +LIBRARY: glfw +ORIGIN: ../../../third_party/glfw/src/mir_init.c +TYPE: LicenseType.zlib +FILE: ../../../third_party/glfw/src/mir_init.c +FILE: ../../../third_party/glfw/src/mir_monitor.c +FILE: ../../../third_party/glfw/src/mir_platform.h +FILE: ../../../third_party/glfw/src/mir_window.c +---------------------------------------------------------------------------------------------------- +Copyright (c) 2014-2015 Brandon Schaefer + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +==================================================================================================== + +==================================================================================================== +LIBRARY: glfw +ORIGIN: ../../../third_party/glfw/src/window.c +TYPE: LicenseType.zlib +FILE: ../../../third_party/glfw/src/window.c +---------------------------------------------------------------------------------------------------- +Copyright (c) 2002-2006 Marcus Geelnard +Copyright (c) 2006-2016 Camilla Berglund +Copyright (c) 2012 Torsten Walluhn + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +==================================================================================================== + ==================================================================================================== LIBRARY: harfbuzz ORIGIN: ../../../third_party/harfbuzz/COPYING @@ -18869,4 +19167,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: 311 +Total license count: 319 diff --git a/ci/licenses_golden/tool_signature b/ci/licenses_golden/tool_signature index e6f18498d5dbb..8356ed4f258b8 100644 --- a/ci/licenses_golden/tool_signature +++ b/ci/licenses_golden/tool_signature @@ -1,2 +1,2 @@ -Signature: e7b89482e4ea9fef22a33ad9fcc34961 +Signature: f2113ac67466eb24d34e9f41c3c59e17 diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index 7bd31a5c5c917..9316937d70e08 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -4730,6 +4730,194 @@ may be used: CompuServe Incorporated. GIF(sm) is a Service Mark property of CompuServe Incorporated." -------------------------------------------------------------------------------- +glfw + +Copyright (c) 2002-2006 Marcus Geelnard +Copyright (c) 2006-2016 Camilla Berglund + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +-------------------------------------------------------------------------------- +glfw + +Copyright (c) 2002-2006 Marcus Geelnard +Copyright (c) 2006-2016 Camilla Berglund +Copyright (c) 2012 Torsten Walluhn + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +-------------------------------------------------------------------------------- +glfw + +Copyright (c) 2006-2016 Camilla Berglund + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +-------------------------------------------------------------------------------- +glfw + +Copyright (c) 2009-2016 Camilla Berglund + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +-------------------------------------------------------------------------------- +glfw + +Copyright (c) 2009-2016 Camilla Berglund +Copyright (c) 2012 Torsten Walluhn + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +-------------------------------------------------------------------------------- +glfw + +Copyright (c) 2010-2016 Camilla Berglund + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +-------------------------------------------------------------------------------- +glfw + +Copyright (c) 2014 Jonas Ådahl + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +-------------------------------------------------------------------------------- +glfw + +Copyright (c) 2014-2015 Brandon Schaefer + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would + be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source + distribution. +-------------------------------------------------------------------------------- harfbuzz Copyright (C) 2012 Grigori Goronzy diff --git a/tools/licenses/lib/filesystem.dart b/tools/licenses/lib/filesystem.dart index dc5cd9d1be122..808c95f1f3876 100644 --- a/tools/licenses/lib/filesystem.dart +++ b/tools/licenses/lib/filesystem.dart @@ -195,6 +195,7 @@ FileType identifyFile(String name, Reader reader) { case '.jpg': case '.jpeg': return FileType.binary; // JPEG case '.ico': return FileType.binary; // Windows icon format + case '.icns': return FileType.binary; // macOS icon format case '.bmp': return FileType.binary; // Windows bitmap format case '.wbmp': return FileType.binary; // Wireless bitmap format case '.webp': return FileType.binary; // WEBP diff --git a/tools/licenses/lib/main.dart b/tools/licenses/lib/main.dart index 9f0cadc87081a..3e36704d16c6d 100644 --- a/tools/licenses/lib/main.dart +++ b/tools/licenses/lib/main.dart @@ -1432,6 +1432,18 @@ class _RepositoryFreetypeDirectory extends _RepositoryDirectory { } } +class _RepositoryGlfwDirectory extends _RepositoryDirectory { + _RepositoryGlfwDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); + + @override + bool shouldRecurse(fs.IoNode entry) { + return entry.name != 'examples' // Not linked in build. + && entry.name != 'tests' // Not linked in build. + && entry.name != 'deps' // Only used by examples and tests; not linked in build. + && super.shouldRecurse(entry); + } +} + class _RepositoryIcuDirectory extends _RepositoryDirectory { _RepositoryIcuDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @@ -1759,6 +1771,8 @@ class _RepositoryRootThirdPartyDirectory extends _RepositoryGenericThirdPartyDir throw '//third_party/freetype-android is no longer part of this client: remove it'; if (entry.name == 'freetype2') return _RepositoryFreetypeDirectory(this, entry); + if (entry.name == 'glfw') + return _RepositoryGlfwDirectory(this, entry); if (entry.name == 'harfbuzz') return _RepositoryHarfbuzzDirectory(this, entry); if (entry.name == 'icu') From d4275d9ee1904760b25da446e64e1fd6337f884a Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 27 Mar 2019 14:41:30 -0400 Subject: [PATCH 0585/1117] Roll src/third_party/skia 576eb87a2d2d..99ccc0ca87e6 (5 commits) (#8328) https://skia.googlesource.com/skia.git/%2Blog/576eb87a2d2d..99ccc0ca87e6 git log 576eb87a2d2d58d169a2bf52cc99ab077c91a8a7..99ccc0ca87e6d255d1477923cec3a2b9732959ec --date=short --no-merges --format=%ad %ae %s 2019-03-27 mtklein@google.com lazy svg parsing in TestSVGTypeface 2019-03-27 mtklein@google.com split up skia_srcs() in public.bzl 2019-03-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 518c679da109..c240abe4ef2c (1 commits) 2019-03-27 bsalomon@google.com Disable texture storage on Android over command buffer. 2019-03-27 mtklein@google.com update DM_SRCS to build tools/HashAndEncode The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 2d1c81deb87f9..9ecbe2f97d965 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': '576eb87a2d2d58d169a2bf52cc99ab077c91a8a7', + 'skia_revision': '99ccc0ca87e6d255d1477923cec3a2b9732959ec', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a28368735ad2a..290d634046755 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: e0cb03599ce070b93c6fb67f4215d634 +Signature: 34a282f02f7fb9a128e84ed0217e8743 UNUSED LICENSES: From 3a3f707d5a9b17388b60ff10b9f65b0c6a3c4134 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 27 Mar 2019 12:22:48 -0700 Subject: [PATCH 0586/1117] Reland "Allow specification of std::functions as native entrypoints from Dart code." (#8329) This reverts commit 7e77d5c484a08cc1c189619e80ae71a7f1df62fb after fixing Windows issues. --- .../embedder/fixtures/simple_main.dart | 12 ++++++ .../embedder/tests/embedder_context.h | 12 ++++++ .../embedder/tests/embedder_unittests.cc | 40 +++++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/shell/platform/embedder/fixtures/simple_main.dart b/shell/platform/embedder/fixtures/simple_main.dart index b1124b508b7e3..bd3999563e031 100644 --- a/shell/platform/embedder/fixtures/simple_main.dart +++ b/shell/platform/embedder/fixtures/simple_main.dart @@ -6,3 +6,15 @@ void customEntrypoint() { } void sayHiFromCustomEntrypoint() native "SayHiFromCustomEntrypoint"; + + +@pragma('vm:entry-point') +void customEntrypoint1() { + sayHiFromCustomEntrypoint1(); + sayHiFromCustomEntrypoint2(); + sayHiFromCustomEntrypoint3(); +} + +void sayHiFromCustomEntrypoint1() native "SayHiFromCustomEntrypoint1"; +void sayHiFromCustomEntrypoint2() native "SayHiFromCustomEntrypoint2"; +void sayHiFromCustomEntrypoint3() native "SayHiFromCustomEntrypoint3"; diff --git a/shell/platform/embedder/tests/embedder_context.h b/shell/platform/embedder/tests/embedder_context.h index 6405163d9cd6a..cf31140d40029 100644 --- a/shell/platform/embedder/tests/embedder_context.h +++ b/shell/platform/embedder/tests/embedder_context.h @@ -16,11 +16,23 @@ #include "flutter/shell/platform/embedder/embedder.h" #include "flutter/shell/platform/embedder/tests/embedder_test_resolver.h" +#define CREATE_NATIVE_ENTRY(native_entry) \ + ([&]() { \ + static ::shell::testing::EmbedderContext::NativeEntry closure; \ + static Dart_NativeFunction entrypoint = [](Dart_NativeArguments args) { \ + closure(args); \ + }; \ + closure = (native_entry); \ + return entrypoint; \ + })() + namespace shell { namespace testing { class EmbedderContext { public: + using NativeEntry = std::function; + EmbedderContext(std::string assets_path = ""); ~EmbedderContext(); diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc index 01d23ff0d885f..6bad99a39dd0c 100644 --- a/shell/platform/embedder/tests/embedder_unittests.cc +++ b/shell/platform/embedder/tests/embedder_unittests.cc @@ -59,5 +59,45 @@ TEST_F(EmbedderTest, CanInvokeCustomEntrypoint) { ASSERT_TRUE(engine.is_valid()); } +TEST_F(EmbedderTest, CanInvokeCustomEntrypointMacro) { + auto& context = GetEmbedderContext(); + + fml::AutoResetWaitableEvent latch1; + fml::AutoResetWaitableEvent latch2; + fml::AutoResetWaitableEvent latch3; + + // Can be defined separately. + auto entry1 = [&latch1](Dart_NativeArguments args) { + FML_LOG(ERROR) << "In Callback 1"; + latch1.Signal(); + }; + auto native_entry1 = CREATE_NATIVE_ENTRY(entry1); + context.AddNativeCallback("SayHiFromCustomEntrypoint1", native_entry1); + + // Can be wrapped in in the args. + auto entry2 = [&latch2](Dart_NativeArguments args) { + FML_LOG(ERROR) << "In Callback 2"; + latch2.Signal(); + }; + context.AddNativeCallback("SayHiFromCustomEntrypoint2", + CREATE_NATIVE_ENTRY(entry2)); + + // Everything can be inline. + context.AddNativeCallback( + "SayHiFromCustomEntrypoint3", + CREATE_NATIVE_ENTRY([&latch3](Dart_NativeArguments args) { + FML_LOG(ERROR) << "In Callback 3"; + latch3.Signal(); + })); + + EmbedderConfigBuilder builder(context); + builder.SetDartEntrypoint("customEntrypoint1"); + auto engine = builder.LaunchEngine(); + latch1.Wait(); + latch2.Wait(); + latch3.Wait(); + ASSERT_TRUE(engine.is_valid()); +} + } // namespace testing } // namespace shell From 6bd697dd4c02e88fcfa4accf8d2e9a434a8a2c37 Mon Sep 17 00:00:00 2001 From: nathanrogersgoogle Date: Wed, 27 Mar 2019 14:34:01 -0700 Subject: [PATCH 0587/1117] Fix "PointerEvent" flow end event (#8319) "DispatchPointerDataPacket" should have been "PointerEvent". --- shell/common/animator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/common/animator.cc b/shell/common/animator.cc index 78fdd98b3206f..622b86c238c92 100644 --- a/shell/common/animator.cc +++ b/shell/common/animator.cc @@ -92,7 +92,7 @@ void Animator::BeginFrame(fml::TimePoint frame_start_time, TRACE_EVENT0("flutter", "Animator::BeginFrame"); while (!trace_flow_ids_.empty()) { uint64_t trace_flow_id = trace_flow_ids_.front(); - TRACE_FLOW_END("flutter", "DispatchPointerDataPacket", trace_flow_id); + TRACE_FLOW_END("flutter", "PointerEvent", trace_flow_id); trace_flow_ids_.pop_front(); } From 76200562779e49d34e62056b66800ac870197092 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 27 Mar 2019 14:57:23 -0700 Subject: [PATCH 0588/1117] Android Embedding PR22: Polish - FlutterActivity Intent factories, FlutterFragment control of render modes, FlutterSurfaceView transparent until rendering is ready. (#8317) --- .../embedding/android/FlutterActivity.java | 88 ++++++++-- .../embedding/android/FlutterFragment.java | 153 ++++++++++++------ .../embedding/android/FlutterSurfaceView.java | 9 ++ 3 files changed, 187 insertions(+), 63 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java b/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java index 0b75d129c6cf6..2ce499870053c 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java @@ -9,6 +9,7 @@ import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; +import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -16,10 +17,13 @@ import android.support.v4.app.FragmentManager; import android.view.View; import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; import android.widget.FrameLayout; import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.FlutterShellArgs; +import io.flutter.plugin.platform.PlatformPlugin; import io.flutter.view.FlutterMain; /** @@ -60,12 +64,16 @@ public class FlutterActivity extends FragmentActivity { private static final String TAG = "FlutterActivity"; // Meta-data arguments, processed from manifest XML. - private static final String DART_ENTRYPOINT_META_DATA_KEY = "io.flutter.Entrypoint"; - private static final String INITIAL_ROUTE_META_DATA_KEY = "io.flutter.InitialRoute"; + protected static final String DART_ENTRYPOINT_META_DATA_KEY = "io.flutter.Entrypoint"; + protected static final String INITIAL_ROUTE_META_DATA_KEY = "io.flutter.InitialRoute"; // Intent extra arguments. - public static final String EXTRA_DART_ENTRYPOINT = "dart_entrypoint"; - public static final String EXTRA_INITIAL_ROUTE = "initial_route"; + protected static final String EXTRA_DART_ENTRYPOINT = "dart_entrypoint"; + protected static final String EXTRA_INITIAL_ROUTE = "initial_route"; + + // Default configuration. + protected static final String DEFAULT_DART_ENTRYPOINT = "main"; + protected static final String DEFAULT_INITIAL_ROUTE = "/"; // FlutterFragment management. private static final String TAG_FLUTTER_FRAGMENT = "flutter_fragment"; @@ -73,13 +81,58 @@ public class FlutterActivity extends FragmentActivity { private static final int FRAGMENT_CONTAINER_ID = 609893468; // random number private FlutterFragment flutterFragment; + /** + * Builder to create an {@code Intent} that launches a {@code FlutterActivity} with the + * desired configuration. + */ + public static class IntentBuilder { + private String dartEntrypoint = DEFAULT_DART_ENTRYPOINT; + private String initialRoute = DEFAULT_INITIAL_ROUTE; + + /** + * The name of the initial Dart method to invoke, defaults to "main". + */ + @NonNull + public IntentBuilder dartEntrypoint(@NonNull String dartEntrypoint) { + this.dartEntrypoint = dartEntrypoint; + return this; + } + + /** + * The initial route that a Flutter app will render in this {@link FlutterFragment}, + * defaults to "/". + */ + @NonNull + public IntentBuilder initialRoute(@NonNull String initialRoute) { + this.initialRoute = initialRoute; + return this; + } + + @NonNull + public Intent build(@NonNull Context context) { + return new Intent(context, FlutterActivity.class) + .putExtra(EXTRA_DART_ENTRYPOINT, dartEntrypoint) + .putExtra(EXTRA_INITIAL_ROUTE, initialRoute); + } + } + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(createFragmentContainer()); + configureStatusBarForFullscreenFlutterExperience(); ensureFlutterFragmentCreated(); } + private void configureStatusBarForFullscreenFlutterExperience() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + window.setStatusBarColor(0x40000000); + window.getDecorView().setSystemUiVisibility(PlatformPlugin.DEFAULT_SYSTEM_UI); + } + } + /** * Creates a {@link FrameLayout} with an ID of {@code #FRAGMENT_CONTAINER_ID} that will contain * the {@link FlutterFragment} displayed by this {@code FlutterActivity}. @@ -125,12 +178,13 @@ private void ensureFlutterFragmentCreated() { */ @NonNull protected FlutterFragment createFlutterFragment() { - return FlutterFragment.newInstance( - getDartEntrypoint(), - getInitialRoute(), - getAppBundlePath(), - FlutterShellArgs.fromIntent(getIntent()) - ); + return new FlutterFragment.Builder() + .dartEntrypoint(getDartEntrypoint()) + .initialRoute(getInitialRoute()) + .appBundlePath(getAppBundlePath()) + .flutterShellArgs(FlutterShellArgs.fromIntent(getIntent())) + .renderMode(FlutterView.RenderMode.surface) + .build(); } @Override @@ -216,7 +270,7 @@ protected String getAppBundlePath() { *

    * Subclasses may override this method to directly control the Dart entrypoint. */ - @Nullable + @NonNull protected String getDartEntrypoint() { if (getIntent().hasExtra(EXTRA_DART_ENTRYPOINT)) { return getIntent().getStringExtra(EXTRA_DART_ENTRYPOINT); @@ -228,9 +282,10 @@ protected String getDartEntrypoint() { PackageManager.GET_META_DATA|PackageManager.GET_ACTIVITIES ); Bundle metadata = activityInfo.metaData; - return metadata != null ? metadata.getString(DART_ENTRYPOINT_META_DATA_KEY) : null; + String desiredDartEntrypoint = metadata != null ? metadata.getString(DART_ENTRYPOINT_META_DATA_KEY) : null; + return desiredDartEntrypoint != null ? desiredDartEntrypoint : DEFAULT_DART_ENTRYPOINT; } catch (PackageManager.NameNotFoundException e) { - return null; + return DEFAULT_DART_ENTRYPOINT; } } @@ -251,7 +306,7 @@ protected String getDartEntrypoint() { *

    * Subclasses may override this method to directly control the initial route. */ - @Nullable + @NonNull protected String getInitialRoute() { if (getIntent().hasExtra(EXTRA_INITIAL_ROUTE)) { return getIntent().getStringExtra(EXTRA_INITIAL_ROUTE); @@ -263,9 +318,10 @@ protected String getInitialRoute() { PackageManager.GET_META_DATA|PackageManager.GET_ACTIVITIES ); Bundle metadata = activityInfo.metaData; - return metadata != null ? metadata.getString(INITIAL_ROUTE_META_DATA_KEY) : null; + String desiredInitialRoute = metadata != null ? metadata.getString(INITIAL_ROUTE_META_DATA_KEY) : null; + return desiredInitialRoute != null ? desiredInitialRoute : DEFAULT_INITIAL_ROUTE; } catch (PackageManager.NameNotFoundException e) { - return null; + return DEFAULT_INITIAL_ROUTE; } } diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java index 53c283d934c1a..771928f866ed7 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java @@ -61,53 +61,92 @@ public class FlutterFragment extends Fragment { private static final String ARG_INITIAL_ROUTE = "initial_route"; private static final String ARG_APP_BUNDLE_PATH = "app_bundle_path"; private static final String ARG_FLUTTER_INITIALIZATION_ARGS = "initialization_args"; + private static final String ARG_FLUTTERVIEW_RENDER_MODE = "flutterview_render_mode"; /** - * Factory method that creates a new {@link FlutterFragment} with a default configuration. - *

      - *
    • default Dart entrypoint of "main"
    • - *
    • initial route of "/"
    • - *
    • default app bundle location
    • - *
    • no special engine arguments
    • - *
    - * @return new {@link FlutterFragment} - */ - public static FlutterFragment newInstance() { - return newInstance( - null, - null, - null, - null - ); - } - - /** - * Factory method that creates a new {@link FlutterFragment} with the given configuration. + * Builder that creates a new {@code FlutterFragment} with {@code arguments} that correspond + * to the values set on this {@code Builder}. *

    - * @param dartEntrypoint the name of the initial Dart method to invoke, defaults to "main" - * @param initialRoute the first route that a Flutter app will render in this {@link FlutterFragment}, - * defaults to "/" - * @param appBundlePath the path to the app bundle which contains the Dart app to execute, defaults - * to {@link FlutterMain#findAppBundlePath(Context)} - * @param flutterShellArgs any special configuration arguments for the Flutter engine - * - * @return a new {@link FlutterFragment} + * To create a {@code FlutterFragment} with default {@code arguments}, invoke {@code build()} + * immeidately: + * {@code + * FlutterFragment fragment = new FlutterFragment.Builder().build(); + * } */ - public static FlutterFragment newInstance(@Nullable String dartEntrypoint, - @Nullable String initialRoute, - @Nullable String appBundlePath, - @Nullable FlutterShellArgs flutterShellArgs) { - FlutterFragment frag = new FlutterFragment(); - - Bundle args = createArgsBundle( - dartEntrypoint, - initialRoute, - appBundlePath, - flutterShellArgs - ); - frag.setArguments(args); + public static class Builder { + private String dartEntrypoint = "main"; + private String initialRoute = "/"; + private String appBundlePath = null; + private FlutterShellArgs shellArgs = null; + private FlutterView.RenderMode renderMode = FlutterView.RenderMode.surface; + + /** + * The name of the initial Dart method to invoke, defaults to "main". + */ + @NonNull + public Builder dartEntrypoint(@NonNull String dartEntrypoint) { + this.dartEntrypoint = dartEntrypoint; + return this; + } + + /** + * The initial route that a Flutter app will render in this {@link FlutterFragment}, + * defaults to "/". + */ + @NonNull + public Builder initialRoute(@NonNull String initialRoute) { + this.initialRoute = initialRoute; + return this; + } + + /** + * The path to the app bundle which contains the Dart app to execute, defaults + * to {@link FlutterMain#findAppBundlePath(Context)} + */ + @NonNull + public Builder appBundlePath(@NonNull String appBundlePath) { + this.appBundlePath = appBundlePath; + return this; + } + + /** + * Any special configuration arguments for the Flutter engine + */ + @NonNull + public Builder flutterShellArgs(@NonNull FlutterShellArgs shellArgs) { + this.shellArgs = shellArgs; + return this; + } + + /** + * Render Flutter either as a {@link FlutterView.RenderMode#surface} or a + * {@link FlutterView.RenderMode#texture}. You should use {@code surface} unless + * you have a specific reason to use {@code texture}. {@code texture} comes with + * a significant performance impact, but {@code texture} can be displayed + * beneath other Android {@code View}s and animated, whereas {@code surface} + * cannot. + */ + @NonNull + public Builder renderMode(@NonNull FlutterView.RenderMode renderMode) { + this.renderMode = renderMode; + return this; + } + + @NonNull + public FlutterFragment build() { + FlutterFragment frag = new FlutterFragment(); + + Bundle args = createArgsBundle( + dartEntrypoint, + initialRoute, + appBundlePath, + shellArgs, + renderMode + ); + frag.setArguments(args); - return frag; + return frag; + } } /** @@ -118,16 +157,16 @@ public static FlutterFragment newInstance(@Nullable String dartEntrypoint, * wants to this {@link Bundle}. Example: *

    {@code
        * public static MyFlutterFragment newInstance(String myNewArg) {
    -   *   // Create an instance of our subclass Fragment.
    +   *   // Create an instance of your subclass Fragment.
        *   MyFlutterFragment myFrag = new MyFlutterFragment();
        *
        *   // Create the Bundle or args that FlutterFragment understands.
        *   Bundle args = FlutterFragment.createArgsBundle(...);
        *
    -   *   // Add our new args to the bundle.
    +   *   // Add your new args to the bundle.
        *   args.putString(ARG_MY_NEW_ARG, myNewArg);
        *
    -   *   // Give the args to our subclass Fragment.
    +   *   // Give the args to your subclass Fragment.
        *   myFrag.setArguments(args);
        *
        *   // Return the newly created subclass Fragment.
    @@ -139,13 +178,20 @@ public static FlutterFragment newInstance(@Nullable String dartEntrypoint,
        * @param initialRoute the first route that a Flutter app will render in this {@link FlutterFragment}, defaults to "/"
        * @param appBundlePath the path to the app bundle which contains the Dart app to execute
        * @param flutterShellArgs any special configuration arguments for the Flutter engine
    +   * @param renderMode render Flutter either as a {@link FlutterView.RenderMode#surface} or a
    +   *                   {@link FlutterView.RenderMode#texture}. You should use {@code surface} unless
    +   *                   you have a specific reason to use {@code texture}. {@code texture} comes with
    +   *                   a significant performance impact, but {@code texture} can be displayed
    +   *                   beneath other Android {@code View}s and animated, whereas {@code surface}
    +   *                   cannot.
        *
        * @return Bundle of arguments that configure a {@link FlutterFragment}
        */
       protected static Bundle createArgsBundle(@Nullable String dartEntrypoint,
                                                @Nullable String initialRoute,
                                                @Nullable String appBundlePath,
    -                                           @Nullable FlutterShellArgs flutterShellArgs) {
    +                                           @Nullable FlutterShellArgs flutterShellArgs,
    +                                           @Nullable FlutterView.RenderMode renderMode) {
         Bundle args = new Bundle();
         args.putString(ARG_INITIAL_ROUTE, initialRoute);
         args.putString(ARG_APP_BUNDLE_PATH, appBundlePath);
    @@ -154,6 +200,7 @@ protected static Bundle createArgsBundle(@Nullable String dartEntrypoint,
         if (null != flutterShellArgs) {
           args.putStringArray(ARG_FLUTTER_INITIALIZATION_ARGS, flutterShellArgs.toArray());
         }
    +    args.putString(ARG_FLUTTERVIEW_RENDER_MODE, renderMode != null ? renderMode.name() : FlutterView.RenderMode.surface.name());
         return args;
       }
     
    @@ -252,7 +299,7 @@ protected void onFlutterEngineCreated(@NonNull FlutterEngine flutterEngine) {
       @Nullable
       @Override
       public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    -    flutterView = new FlutterView(getContext());
    +    flutterView = new FlutterView(getContext(), getRenderMode());
         flutterView.attachToFlutterEngine(flutterEngine);
     
         // TODO(mattcarroll): the following call should exist here, but the plugin system needs to be revamped.
    @@ -326,6 +373,18 @@ protected String getDartEntrypointFunctionName() {
         return getArguments().getString(ARG_DART_ENTRYPOINT, "main");
       }
     
    +  /**
    +   * Returns the desired {@link FlutterView.RenderMode} for the {@link FlutterView} displayed in
    +   * this {@code FlutterFragment}.
    +   *
    +   * Defaults to {@link FlutterView.RenderMode#surface}.
    +   */
    +  @NonNull
    +  protected FlutterView.RenderMode getRenderMode() {
    +    String renderModeName = getArguments().getString(ARG_FLUTTERVIEW_RENDER_MODE, FlutterView.RenderMode.surface.name());
    +    return FlutterView.RenderMode.valueOf(renderModeName);
    +  }
    +
       // TODO(mattcarroll): determine why this can't be in onResume(). Comment reason, or move if possible.
       public void onPostResume() {
         Log.d(TAG, "onPostResume()");
    diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java b/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java
    index c28eac9c5d1a1..ac19c5ae15798 100644
    --- a/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java
    +++ b/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java
    @@ -90,6 +90,10 @@ private void init() {
         // Grab a reference to our underlying Surface and register callbacks with that Surface so we
         // can monitor changes and forward those changes on to native Flutter code.
         getHolder().addCallback(surfaceCallback);
    +
    +    // Keep this SurfaceView transparent until Flutter has a frame ready to render. This avoids
    +    // displaying a black rectangle in our place.
    +    setAlpha(0.0f);
       }
     
       /**
    @@ -136,6 +140,9 @@ public void detachFromRenderer() {
             disconnectSurfaceFromRenderer();
           }
     
    +      // Make the SurfaceView invisible to avoid showing a black rectangle.
    +      setAlpha(0.0f);
    +
           flutterRenderer = null;
           isAttachedToFlutterRenderer = false;
         } else {
    @@ -174,5 +181,7 @@ private void disconnectSurfaceFromRenderer() {
       public void onFirstFrameRendered() {
         // TODO(mattcarroll): decide where this method should live and what it needs to do.
         Log.d(TAG, "onFirstFrameRendered()");
    +    // Now that a frame is ready to display, take this SurfaceView from transparent to opaque.
    +    setAlpha(1.0f);
       }
     }
    
    From deeb7a747f5593cf99282e3f94148132bf6f9f21 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Wed, 27 Mar 2019 18:04:49 -0400
    Subject: [PATCH 0589/1117] Roll src/third_party/skia
     99ccc0ca87e6..8d2c19554e4a (11 commits) (#8332)
    
    https://skia.googlesource.com/skia.git/%2Blog/99ccc0ca87e6..8d2c19554e4a
    
    git log 99ccc0ca87e6d255d1477923cec3a2b9732959ec..8d2c19554e4a1f9f75abaf1093558f9fc712ddf4 --date=short --no-merges --format=%ad %ae %s
    2019-03-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 4c9f4a97ffe3..179c932426b3 (1 commits)
    2019-03-27 csmartdalton@google.com Add MSAA and non-aa modes to GrFillRRect Op
    2019-03-27 egdaniel@google.com Add support for vsync on android viewer.
    2019-03-21 reed@google.com add bgra8 bgra8s and 8888s to explicitly control swizzle and srgb-ness in gpu[] configs
    2019-03-27 mtklein@google.com add .svg sources to fm
    2019-03-27 brianosman@google.com Allow Mock GrBackendTextures to masquerade as GL
    2019-03-27 mtklein@google.com add --backend pdf to fm
    2019-03-27 egdaniel@google.com Add vsync toggle for windows viewer.
    2019-03-27 mtklein@google.com add --backend skp to fm
    2019-03-27 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader e43cda5f76de..4c9f4a97ffe3 (1 commits)
    2019-03-27 mtklein@google.com buildifier public.bzl
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 9ecbe2f97d965..ac42e3fa0a2fa 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': '99ccc0ca87e6d255d1477923cec3a2b9732959ec',
    +  'skia_revision': '8d2c19554e4a1f9f75abaf1093558f9fc712ddf4',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 290d634046755..631043f15f904 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 34a282f02f7fb9a128e84ed0217e8743
    +Signature: de6d3f4aa462810f8b52a646cac334d6
     
     UNUSED LICENSES:
     
    
    From 37947f961a6242d2efc05a55a4319b120764a403 Mon Sep 17 00:00:00 2001
    From: Amir Hardon 
    Date: Wed, 27 Mar 2019 15:49:15 -0700
    Subject: [PATCH 0590/1117] Allow delegation of a11y events from nodes that
     were not yet traversed (#8333)
    
    The AccessibilityViewEmbedder was not delegating a11y events coming virtual nodes(of the embedded view) that were not previously traversed by the a11y framework.
    
    It turns out the a11y framework might leave parts of the tree untraversed in some circumstances, changed the behavior to create an originId<-->flutterId mapping on the fly when an event is delegated from a not previously traversed node.
    
    Fixes flutter/flutter#30010.
    ---
     .../view/AccessibilityViewEmbedder.java       | 39 ++++++++++++-------
     1 file changed, 26 insertions(+), 13 deletions(-)
    
    diff --git a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java
    index 330ded624ddc0..fbc2260d260e0 100644
    --- a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java
    +++ b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java
    @@ -51,11 +51,10 @@ class AccessibilityViewEmbedder {
         // Maps a platform view and originId to a corresponding flutterID.
         private final Map originToFlutterId;
     
    -    // Maps the flutterId of an accessibility node to the screen bounds of
    -    // the root semantic node for the embedded view.
    +    // Maps an embedded view to it's screen bounds.
         // This is used to translate the coordinates of the accessibility node subtree to the main display's coordinate
         // system.
    -    private final SparseArray flutterIdToDisplayBounds;
    +    private final Map embeddedViewToDisplayBounds;
     
         private int nextFlutterId;
     
    @@ -64,8 +63,8 @@ class AccessibilityViewEmbedder {
             flutterIdToOrigin = new SparseArray<>();
             this.rootAccessibilityView = rootAccessibiiltyView;
             nextFlutterId = firstVirtualNodeId;
    -        flutterIdToDisplayBounds = new SparseArray<>();
             originToFlutterId = new HashMap<>();
    +        embeddedViewToDisplayBounds = new HashMap<>();
         }
     
         /**
    @@ -80,10 +79,9 @@ public AccessibilityNodeInfo getRootNode(@NonNull View embeddedView, int flutter
             if (originPackedId == null) {
                 return null;
             }
    +        embeddedViewToDisplayBounds.put(embeddedView, displayBounds);
             int originId = ReflectionAccessors.getVirtualNodeId(originPackedId);
    -        flutterIdToOrigin.put(flutterId, new ViewAndId(embeddedView, originId));
    -        flutterIdToDisplayBounds.put(flutterId, displayBounds);
    -        originToFlutterId.put(new ViewAndId(embeddedView, originId), flutterId);
    +        cacheVirtualIdMappings(embeddedView, originId, flutterId);
             return convertToFlutterNode(originNode, flutterId, embeddedView);
         }
     
    @@ -96,6 +94,13 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int flutterId) {
             if (origin == null) {
                 return null;
             }
    +        if (!embeddedViewToDisplayBounds.containsKey(origin.view)) {
    +            // This might happen if the embedded view is sending accessibility event before the first Flutter semantics
    +            // tree was sent to the accessibility bridge. In this case we don't return a node as we do not know the
    +            // bounds yet.
    +            // https://github.com/flutter/flutter/issues/30068
    +            return null;
    +        }
             AccessibilityNodeProvider provider = origin.view.getAccessibilityNodeProvider();
             if (provider == null) {
                 // The provider is null for views that don't have a virtual accessibility tree.
    @@ -127,7 +132,7 @@ private AccessibilityNodeInfo convertToFlutterNode(
             result.setSource(rootAccessibilityView, flutterId);
             result.setClassName(originNode.getClassName());
     
    -        Rect displayBounds = flutterIdToDisplayBounds.get(flutterId);
    +        Rect displayBounds = embeddedViewToDisplayBounds.get(embeddedView);
     
             copyAccessibilityFields(originNode, result);
             setFlutterNodesTranslateBounds(originNode, displayBounds, result);
    @@ -172,14 +177,21 @@ private void addChildrenToFlutterNode(
                     childFlutterId = originToFlutterId.get(origin);
                 } else {
                     childFlutterId = nextFlutterId++;
    -                originToFlutterId.put(origin, childFlutterId);
    -                flutterIdToOrigin.put(childFlutterId, origin);
    -                flutterIdToDisplayBounds.put(childFlutterId, displayBounds);
    +                cacheVirtualIdMappings(embeddedView, originId, childFlutterId);
                 }
                 resultNode.addChild(rootAccessibilityView, childFlutterId);
             }
         }
     
    +    // Caches a bidirectional mapping of (embeddedView, originId)<-->flutterId.
    +    // Where originId is a virtual node ID in the embeddedView's tree, and flutterId is the ID
    +    // of the corresponding node in the Flutter virtual accessibility nodes tree.
    +    private void cacheVirtualIdMappings(@NonNull View embeddedView, int originId, int flutterId) {
    +        ViewAndId origin = new ViewAndId(embeddedView, originId);
    +        originToFlutterId.put(origin, flutterId);
    +        flutterIdToOrigin.put(flutterId, origin);
    +    }
    +
         private void setFlutterNodesTranslateBounds(
                 @NonNull AccessibilityNodeInfo originNode,
                 @NonNull Rect displayBounds,
    @@ -265,7 +277,8 @@ public boolean requestSendAccessibilityEvent(
             int originVirtualId = ReflectionAccessors.getVirtualNodeId(originPackedId);
             Integer flutterId = originToFlutterId.get(new ViewAndId(embeddedView, originVirtualId));
             if (flutterId == null) {
    -            return false;
    +            flutterId = nextFlutterId++;
    +            cacheVirtualIdMappings(embeddedView, originVirtualId, flutterId);
             }
             translatedEvent.setSource(rootAccessibilityView, flutterId);
             translatedEvent.setClassName(event.getClassName());
    @@ -333,7 +346,7 @@ public boolean onAccessibilityHoverEvent(int rootFlutterId, @NonNull MotionEvent
             if (origin == null) {
                 return false;
             }
    -        Rect displayBounds = flutterIdToDisplayBounds.get(rootFlutterId);
    +        Rect displayBounds = embeddedViewToDisplayBounds.get(origin.view);
             int pointerCount = event.getPointerCount();
             MotionEvent.PointerProperties[] pointerProperties = new MotionEvent.PointerProperties[pointerCount];
             MotionEvent.PointerCoords[] pointerCoords = new MotionEvent.PointerCoords[pointerCount];
    
    From cb8eb801a4a905bfa24bc9ba081def174472d806 Mon Sep 17 00:00:00 2001
    From: Chinmay Garde 
    Date: Wed, 27 Mar 2019 16:16:59 -0700
    Subject: [PATCH 0591/1117] Allow embedders to specify their own task runner
     interfaces. (#8273)
    
    Currently, all Flutter threads are managed by the engine itself. This works for
    all threads except the platform thread. On this thread, the engine cannot see
    the underlying event multiplexing mechanism. Using the new task runner
    interfaces, the engine can relinquish the task of setting up the event
    multiplexing mechanism and instead have the embedder provide one for it during
    setup.
    
    This scheme is only wired up for the platform thread. But, the eventual goal
    is to expose this message loop interoperability for all threads.
    ---
     ci/licenses_golden/licenses_flutter           |   5 +
     fml/task_runner.h                             |   4 +-
     shell/platform/embedder/BUILD.gn              |   5 +
     shell/platform/embedder/embedder.cc           |  63 +++---
     shell/platform/embedder/embedder.h            |  64 ++++++
     shell/platform/embedder/embedder_engine.cc    |  16 +-
     shell/platform/embedder/embedder_engine.h     |   8 +-
     .../platform/embedder/embedder_safe_access.h  |  20 ++
     .../platform/embedder/embedder_task_runner.cc |  72 +++++++
     .../platform/embedder/embedder_task_runner.h  |  57 +++++
     .../platform/embedder/embedder_thread_host.cc | 204 ++++++++++++++++++
     .../platform/embedder/embedder_thread_host.h  |  54 +++++
     .../embedder/fixtures/simple_main.dart        |   8 +
     .../embedder/tests/embedder_config_builder.cc |  38 +++-
     .../embedder/tests/embedder_config_builder.h  |  10 +-
     .../embedder/tests/embedder_unittests.cc      | 117 +++++++++-
     16 files changed, 705 insertions(+), 40 deletions(-)
     create mode 100644 shell/platform/embedder/embedder_safe_access.h
     create mode 100644 shell/platform/embedder/embedder_task_runner.cc
     create mode 100644 shell/platform/embedder/embedder_task_runner.h
     create mode 100644 shell/platform/embedder/embedder_thread_host.cc
     create mode 100644 shell/platform/embedder/embedder_thread_host.h
    
    diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter
    index 0a30b3ca65123..f5259b505f734 100644
    --- a/ci/licenses_golden/licenses_flutter
    +++ b/ci/licenses_golden/licenses_flutter
    @@ -675,12 +675,17 @@ FILE: ../../../flutter/shell/platform/embedder/embedder_engine.h
     FILE: ../../../flutter/shell/platform/embedder/embedder_external_texture_gl.cc
     FILE: ../../../flutter/shell/platform/embedder/embedder_external_texture_gl.h
     FILE: ../../../flutter/shell/platform/embedder/embedder_include.c
    +FILE: ../../../flutter/shell/platform/embedder/embedder_safe_access.h
     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/embedder_task_runner.cc
    +FILE: ../../../flutter/shell/platform/embedder/embedder_task_runner.h
    +FILE: ../../../flutter/shell/platform/embedder/embedder_thread_host.cc
    +FILE: ../../../flutter/shell/platform/embedder/embedder_thread_host.h
     FILE: ../../../flutter/shell/platform/embedder/fixtures/a11y_main.dart
     FILE: ../../../flutter/shell/platform/embedder/fixtures/simple_main.dart
     FILE: ../../../flutter/shell/platform/embedder/platform_view_embedder.cc
    diff --git a/fml/task_runner.h b/fml/task_runner.h
    index 04696752c95e3..72c4219029f34 100644
    --- a/fml/task_runner.h
    +++ b/fml/task_runner.h
    @@ -17,6 +17,8 @@ class MessageLoopImpl;
     
     class TaskRunner : public fml::RefCountedThreadSafe {
      public:
    +  virtual ~TaskRunner();
    +
       virtual void PostTask(fml::closure task);
     
       virtual void PostTaskForTime(fml::closure task, fml::TimePoint target_time);
    @@ -25,8 +27,6 @@ class TaskRunner : public fml::RefCountedThreadSafe {
     
       virtual bool RunsTasksOnCurrentThread();
     
    -  virtual ~TaskRunner();
    -
       static void RunNowOrPostTask(fml::RefPtr runner,
                                    fml::closure task);
     
    diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn
    index f9659a3b5c5fb..5632f5f0fd5dd 100644
    --- a/shell/platform/embedder/BUILD.gn
    +++ b/shell/platform/embedder/BUILD.gn
    @@ -22,12 +22,17 @@ source_set("embedder") {
         "embedder_external_texture_gl.cc",
         "embedder_external_texture_gl.h",
         "embedder_include.c",
    +    "embedder_safe_access.h",
         "embedder_surface.cc",
         "embedder_surface.h",
         "embedder_surface_gl.cc",
         "embedder_surface_gl.h",
         "embedder_surface_software.cc",
         "embedder_surface_software.h",
    +    "embedder_task_runner.cc",
    +    "embedder_task_runner.h",
    +    "embedder_thread_host.cc",
    +    "embedder_thread_host.h",
         "platform_view_embedder.cc",
         "platform_view_embedder.h",
         "vsync_waiter_embedder.cc",
    diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc
    index c15970de70775..93c23b12207e1 100644
    --- a/shell/platform/embedder/embedder.cc
    +++ b/shell/platform/embedder/embedder.cc
    @@ -21,10 +21,6 @@ extern const intptr_t kPlatformStrongDillSize;
     #endif  // FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG
     }
     
    -#include "flutter/shell/platform/embedder/embedder.h"
    -
    -#include 
    -
     #include "flutter/assets/directory_asset_bundle.h"
     #include "flutter/common/task_runners.h"
     #include "flutter/fml/command_line.h"
    @@ -38,18 +34,11 @@ extern const intptr_t kPlatformStrongDillSize;
     #include "flutter/shell/common/switches.h"
     #include "flutter/shell/platform/embedder/embedder.h"
     #include "flutter/shell/platform/embedder/embedder_engine.h"
    +#include "flutter/shell/platform/embedder/embedder_safe_access.h"
    +#include "flutter/shell/platform/embedder/embedder_task_runner.h"
    +#include "flutter/shell/platform/embedder/embedder_thread_host.h"
     #include "flutter/shell/platform/embedder/platform_view_embedder.h"
     
    -#define SAFE_ACCESS(pointer, member, default_value)                      \
    -  ([=]() {                                                               \
    -    if (offsetof(std::remove_pointer::type, member) + \
    -            sizeof(pointer->member) <=                                   \
    -        pointer->struct_size) {                                          \
    -      return pointer->member;                                            \
    -    }                                                                    \
    -    return static_castmember)>((default_value));      \
    -  })()
    -
     static FlutterEngineResult LogEmbedderError(FlutterEngineResult code,
                                                 const char* name,
                                                 const char* function,
    @@ -408,20 +397,6 @@ FlutterEngineResult FlutterEngineRun(size_t version,
         };
       }
     
    -  // Create a thread host with the current thread as the platform thread and all
    -  // other threads managed.
    -  shell::ThreadHost thread_host("io.flutter", shell::ThreadHost::Type::GPU |
    -                                                  shell::ThreadHost::Type::IO |
    -                                                  shell::ThreadHost::Type::UI);
    -  fml::MessageLoop::EnsureInitializedForCurrentThread();
    -  blink::TaskRunners task_runners(
    -      "io.flutter",
    -      fml::MessageLoop::GetCurrent().GetTaskRunner(),  // platform
    -      thread_host.gpu_thread->GetTaskRunner(),         // gpu
    -      thread_host.ui_thread->GetTaskRunner(),          // ui
    -      thread_host.io_thread->GetTaskRunner()           // io
    -  );
    -
       shell::PlatformViewEmbedder::UpdateSemanticsNodesCallback
           update_semantics_nodes_callback = nullptr;
       if (SAFE_ACCESS(args, update_semantics_node_callback, nullptr) != nullptr) {
    @@ -602,6 +577,23 @@ FlutterEngineResult FlutterEngineRun(size_t version,
         }
       }
     
    +  auto thread_host =
    +      shell::EmbedderThreadHost::CreateEmbedderOrEngineManagedThreadHost(
    +          SAFE_ACCESS(args, custom_task_runners, nullptr));
    +
    +  if (!thread_host || !thread_host->IsValid()) {
    +    FML_LOG(ERROR) << "Could not setup or infer thread configuration to run "
    +                      "the Flutter engine on.";
    +    return LOG_EMBEDDER_ERROR(kInvalidArguments);
    +  }
    +
    +  auto task_runners = thread_host->GetTaskRunners();
    +
    +  if (!task_runners.IsValid()) {
    +    FML_LOG(ERROR) << "Task runner configuration specified is invalid.";
    +    return LOG_EMBEDDER_ERROR(kInvalidArguments);
    +  }
    +
       // Step 1: Create the engine.
       auto embedder_engine =
           std::make_unique(std::move(thread_host),    //
    @@ -940,3 +932,18 @@ FlutterEngineResult FlutterEnginePostRenderThreadTask(FlutterEngine engine,
                  ? kSuccess
                  : LOG_EMBEDDER_ERROR(kInternalInconsistency);
     }
    +
    +uint64_t FlutterEngineGetCurrentTime() {
    +  return fml::TimePoint::Now().ToEpochDelta().ToNanoseconds();
    +}
    +
    +FlutterEngineResult FlutterEngineRunTask(FlutterEngine engine,
    +                                         const FlutterTask* task) {
    +  if (engine == nullptr) {
    +    return LOG_EMBEDDER_ERROR(kInvalidArguments);
    +  }
    +
    +  return reinterpret_cast(engine)->RunTask(task)
    +             ? kSuccess
    +             : LOG_EMBEDDER_ERROR(kInvalidArguments);
    +}
    diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h
    index 442716a50114b..ae0348e7e0e19 100644
    --- a/shell/platform/embedder/embedder.h
    +++ b/shell/platform/embedder/embedder.h
    @@ -447,6 +447,52 @@ typedef void (*FlutterUpdateSemanticsCustomActionCallback)(
         const FlutterSemanticsCustomAction* /* semantics custom action */,
         void* /* user data */);
     
    +typedef struct _FlutterTaskRunner* FlutterTaskRunner;
    +
    +typedef struct {
    +  FlutterTaskRunner runner;
    +  uint64_t task;
    +} FlutterTask;
    +
    +typedef void (*FlutterTaskRunnerPostTaskCallback)(
    +    FlutterTask /* task */,
    +    uint64_t /* target time nanos */,
    +    void* /* user data */);
    +
    +// An interface used by the Flutter engine to execute tasks at the target time
    +// on a specified thread. There should be a 1-1 relationship between a thread
    +// and a task runner. It is undefined behavior to run a task on a thread that is
    +// not associated with its task runner.
    +typedef struct {
    +  // The size of this struct. Must be sizeof(FlutterTaskRunnerDescription).
    +  size_t struct_size;
    +  void* user_data;
    +  // May be called from any thread. Should return true if tasks posted on the
    +  // calling thread will be run on that same thread.
    +  //
    +  // This field is required.
    +  BoolCallback runs_task_on_current_thread_callback;
    +  // May be called from any thread. The given task should be executed by the
    +  // embedder on the thread associated with that task runner by calling
    +  // |FlutterEngineRunTask| at the given target time. The system monotonic clock
    +  // should be used for the target time. The target time is the absolute time
    +  // from epoch (NOT a delta) at which the task must be returned back to the
    +  // engine on the correct thread. If the embedder needs to calculate a delta,
    +  // |FlutterEngineGetCurrentTime| may be called and the difference used as the
    +  // delta.
    +  //
    +  // This field is required.
    +  FlutterTaskRunnerPostTaskCallback post_task_callback;
    +} FlutterTaskRunnerDescription;
    +
    +typedef struct {
    +  // The size of this struct. Must be sizeof(FlutterCustomTaskRunners).
    +  size_t struct_size;
    +  // Specify the task runner for the thread on which the |FlutterEngineRun| call
    +  // is made.
    +  const FlutterTaskRunnerDescription* platform_task_runner;
    +} FlutterCustomTaskRunners;
    +
     typedef struct {
       // The size of this struct. Must be sizeof(FlutterProjectArgs).
       size_t struct_size;
    @@ -572,6 +618,11 @@ typedef struct {
       // away. Usually, this is done using the `@pragma('vm:entry-point')`
       // decoration.
       const char* custom_dart_entrypoint;
    +
    +  // Typically the Flutter engine create and manages its internal threads. This
    +  // optional argument allows for the specification of task runner interfaces to
    +  // event loops managed by the embedder on threads it creates.
    +  const FlutterCustomTaskRunners* custom_task_runners;
     } FlutterProjectArgs;
     
     FLUTTER_EXPORT
    @@ -715,6 +766,19 @@ FlutterEngineResult FlutterEnginePostRenderThreadTask(FlutterEngine engine,
                                                           VoidCallback callback,
                                                           void* callback_data);
     
    +// Get the current time in nanoseconds from the clock used by the flutter
    +// engine. This is the system monotonic clock.
    +FLUTTER_EXPORT
    +uint64_t FlutterEngineGetCurrentTime();
    +
    +// Inform the engine to run the specified task. This task has been given to
    +// the engine via the |FlutterTaskRunnerDescription.post_task_callback|. This
    +// call must only be made at the target time specified in that callback. Running
    +// the task before that time is undefined behavior.
    +FLUTTER_EXPORT
    +FlutterEngineResult FlutterEngineRunTask(FlutterEngine engine,
    +                                         const FlutterTask* task);
    +
     #if defined(__cplusplus)
     }  // extern "C"
     #endif
    diff --git a/shell/platform/embedder/embedder_engine.cc b/shell/platform/embedder/embedder_engine.cc
    index 63083bcef1b4d..836dfc645c1a7 100644
    --- a/shell/platform/embedder/embedder_engine.cc
    +++ b/shell/platform/embedder/embedder_engine.cc
    @@ -10,7 +10,7 @@
     namespace shell {
     
     EmbedderEngine::EmbedderEngine(
    -    ThreadHost thread_host,
    +    std::unique_ptr thread_host,
         blink::TaskRunners task_runners,
         blink::Settings settings,
         Shell::CreateCallback on_create_platform_view,
    @@ -23,7 +23,11 @@ EmbedderEngine::EmbedderEngine(
                                on_create_platform_view,
                                on_create_rasterizer)),
           external_texture_callback_(external_texture_callback) {
    -  is_valid_ = shell_ != nullptr;
    +  if (!shell_) {
    +    return;
    +  }
    +
    +  is_valid_ = true;
     }
     
     EmbedderEngine::~EmbedderEngine() = default;
    @@ -212,4 +216,12 @@ bool EmbedderEngine::PostRenderThreadTask(fml::closure task) {
       return true;
     }
     
    +bool EmbedderEngine::RunTask(const FlutterTask* task) {
    +  if (!IsValid() || task == nullptr) {
    +    return false;
    +  }
    +  return thread_host_->PostTask(reinterpret_cast(task->runner),
    +                                task->task);
    +}
    +
     }  // namespace shell
    diff --git a/shell/platform/embedder/embedder_engine.h b/shell/platform/embedder/embedder_engine.h
    index 52b528e3a2ec3..bd2ff92d16d8b 100644
    --- a/shell/platform/embedder/embedder_engine.h
    +++ b/shell/platform/embedder/embedder_engine.h
    @@ -6,6 +6,7 @@
     #define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_ENGINE_H_
     
     #include 
    +#include 
     
     #include "flutter/fml/macros.h"
     #include "flutter/shell/common/shell.h"
    @@ -13,6 +14,7 @@
     #include "flutter/shell/platform/embedder/embedder.h"
     #include "flutter/shell/platform/embedder/embedder_engine.h"
     #include "flutter/shell/platform/embedder/embedder_external_texture_gl.h"
    +#include "flutter/shell/platform/embedder/embedder_thread_host.h"
     
     namespace shell {
     
    @@ -20,7 +22,7 @@ namespace shell {
     // instance of the Flutter engine.
     class EmbedderEngine {
      public:
    -  EmbedderEngine(ThreadHost thread_host,
    +  EmbedderEngine(std::unique_ptr thread_host,
                      blink::TaskRunners task_runners,
                      blink::Settings settings,
                      Shell::CreateCallback on_create_platform_view,
    @@ -65,8 +67,10 @@ class EmbedderEngine {
     
       bool PostRenderThreadTask(fml::closure task);
     
    +  bool RunTask(const FlutterTask* task);
    +
      private:
    -  const ThreadHost thread_host_;
    +  const std::unique_ptr thread_host_;
       std::unique_ptr shell_;
       const EmbedderExternalTextureGL::ExternalTextureCallback
           external_texture_callback_;
    diff --git a/shell/platform/embedder/embedder_safe_access.h b/shell/platform/embedder/embedder_safe_access.h
    new file mode 100644
    index 0000000000000..783eb44a88bd2
    --- /dev/null
    +++ b/shell/platform/embedder/embedder_safe_access.h
    @@ -0,0 +1,20 @@
    +// Copyright 2013 The Flutter 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_EMBEDDER_EMBEDDER_SAFE_ACCESS_H_
    +#define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SAFE_ACCESS_H_
    +
    +#include 
    +
    +#define SAFE_ACCESS(pointer, member, default_value)                      \
    +  ([=]() {                                                               \
    +    if (offsetof(std::remove_pointer::type, member) + \
    +            sizeof(pointer->member) <=                                   \
    +        pointer->struct_size) {                                          \
    +      return pointer->member;                                            \
    +    }                                                                    \
    +    return static_castmember)>((default_value));      \
    +  })()
    +
    +#endif  // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SAFE_ACCESS_H_
    diff --git a/shell/platform/embedder/embedder_task_runner.cc b/shell/platform/embedder/embedder_task_runner.cc
    new file mode 100644
    index 0000000000000..c0b5ab862bdf4
    --- /dev/null
    +++ b/shell/platform/embedder/embedder_task_runner.cc
    @@ -0,0 +1,72 @@
    +// Copyright 2013 The Flutter 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/embedder_task_runner.h"
    +
    +#include "flutter/fml/message_loop_impl.h"
    +
    +namespace shell {
    +
    +EmbedderTaskRunner::EmbedderTaskRunner(DispatchTable table)
    +    : TaskRunner(nullptr /* loop implemenation*/),
    +      dispatch_table_(std::move(table)) {
    +  FML_DCHECK(dispatch_table_.post_task_callback);
    +  FML_DCHECK(dispatch_table_.runs_task_on_current_thread_callback);
    +}
    +
    +EmbedderTaskRunner::~EmbedderTaskRunner() = default;
    +
    +void EmbedderTaskRunner::PostTask(fml::closure task) {
    +  PostTaskForTime(task, fml::TimePoint::Now());
    +}
    +
    +void EmbedderTaskRunner::PostTaskForTime(fml::closure task,
    +                                         fml::TimePoint target_time) {
    +  if (!task) {
    +    return;
    +  }
    +
    +  uint64_t baton = 0;
    +
    +  {
    +    // Release the lock before the jump via the dispatch table.
    +    std::lock_guard lock(tasks_mutex_);
    +    baton = ++last_baton_;
    +    pending_tasks_[baton] = task;
    +  }
    +
    +  dispatch_table_.post_task_callback(this, baton, target_time);
    +}
    +
    +void EmbedderTaskRunner::PostDelayedTask(fml::closure task,
    +                                         fml::TimeDelta delay) {
    +  PostTaskForTime(task, fml::TimePoint::Now() + delay);
    +}
    +
    +bool EmbedderTaskRunner::RunsTasksOnCurrentThread() {
    +  return dispatch_table_.runs_task_on_current_thread_callback();
    +}
    +
    +bool EmbedderTaskRunner::PostTask(uint64_t baton) {
    +  fml::closure task;
    +
    +  {
    +    std::lock_guard lock(tasks_mutex_);
    +    auto found = pending_tasks_.find(baton);
    +    if (found == pending_tasks_.end()) {
    +      FML_LOG(ERROR) << "Embedder attempted to post an unknown task.";
    +      return false;
    +    }
    +    task = found->second;
    +    pending_tasks_.erase(found);
    +
    +    // Let go of the tasks mutex befor executing the task.
    +  }
    +
    +  FML_DCHECK(task);
    +  task();
    +  return true;
    +}
    +
    +}  // namespace shell
    diff --git a/shell/platform/embedder/embedder_task_runner.h b/shell/platform/embedder/embedder_task_runner.h
    new file mode 100644
    index 0000000000000..084efbf148a45
    --- /dev/null
    +++ b/shell/platform/embedder/embedder_task_runner.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_EMBEDDER_EMBEDDER_TASK_RUNNER_H_
    +#define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_TASK_RUNNER_H_
    +
    +#include 
    +#include 
    +
    +#include "flutter/fml/macros.h"
    +#include "flutter/fml/synchronization/thread_annotations.h"
    +#include "flutter/fml/task_runner.h"
    +
    +namespace shell {
    +
    +class EmbedderTaskRunner final : public fml::TaskRunner {
    + public:
    +  struct DispatchTable {
    +    std::function
    +        post_task_callback;
    +    std::function runs_task_on_current_thread_callback;
    +  };
    +
    +  EmbedderTaskRunner(DispatchTable table);
    +
    +  ~EmbedderTaskRunner() override;
    +
    +  bool PostTask(uint64_t baton);
    +
    +  // |fml::TaskRunner|
    +  void PostTask(fml::closure task) override;
    +
    +  // |fml::TaskRunner|
    +  void PostTaskForTime(fml::closure task, fml::TimePoint target_time) override;
    +
    +  // |fml::TaskRunner|
    +  void PostDelayedTask(fml::closure task, fml::TimeDelta delay) override;
    +
    +  // |fml::TaskRunner|
    +  bool RunsTasksOnCurrentThread() override;
    +
    + private:
    +  DispatchTable dispatch_table_;
    +  std::mutex tasks_mutex_;
    +  uint64_t last_baton_ FML_GUARDED_BY(tasks_mutex_);
    +  std::unordered_map pending_tasks_
    +      FML_GUARDED_BY(tasks_mutex_);
    +
    +  FML_DISALLOW_COPY_AND_ASSIGN(EmbedderTaskRunner);
    +};
    +
    +}  // namespace shell
    +
    +#endif  // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_TASK_RUNNER_H_
    diff --git a/shell/platform/embedder/embedder_thread_host.cc b/shell/platform/embedder/embedder_thread_host.cc
    new file mode 100644
    index 0000000000000..648025ea5a317
    --- /dev/null
    +++ b/shell/platform/embedder/embedder_thread_host.cc
    @@ -0,0 +1,204 @@
    +// Copyright 2013 The Flutter 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 is why we can't yet export the UI thread to embedders.
    +#define FML_USED_ON_EMBEDDER
    +
    +#include "flutter/shell/platform/embedder/embedder_thread_host.h"
    +
    +#include "flutter/fml/message_loop.h"
    +#include "flutter/shell/platform/embedder/embedder_safe_access.h"
    +
    +namespace shell {
    +
    +static fml::RefPtr CreateEmbedderTaskRunner(
    +    const FlutterTaskRunnerDescription* description) {
    +  if (description == nullptr) {
    +    return {};
    +  }
    +
    +  if (SAFE_ACCESS(description, runs_task_on_current_thread_callback, nullptr) ==
    +      nullptr) {
    +    FML_LOG(ERROR) << "FlutterTaskRunnerDescription.runs_task_on_current_"
    +                      "thread_callback was nullptr.";
    +    return {};
    +  }
    +
    +  if (SAFE_ACCESS(description, post_task_callback, nullptr) == nullptr) {
    +    FML_LOG(ERROR)
    +        << "FlutterTaskRunnerDescription.post_task_callback was nullptr.";
    +    return {};
    +  }
    +
    +  auto user_data = SAFE_ACCESS(description, user_data, nullptr);
    +
    +  // ABI safety checks have been completed.
    +  auto post_task_callback_c = description->post_task_callback;
    +  auto runs_task_on_current_thread_callback_c =
    +      description->runs_task_on_current_thread_callback;
    +
    +  EmbedderTaskRunner::DispatchTable task_runner_dispatch_table = {
    +      .post_task_callback = [post_task_callback_c, user_data](
    +                                EmbedderTaskRunner* task_runner,
    +                                uint64_t task_baton,
    +                                fml::TimePoint target_time) -> void {
    +        FlutterTask task = {
    +            .runner = reinterpret_cast(task_runner),
    +            .task = task_baton,
    +        };
    +        post_task_callback_c(task, target_time.ToEpochDelta().ToNanoseconds(),
    +                             user_data);
    +      },
    +      .runs_task_on_current_thread_callback =
    +          [runs_task_on_current_thread_callback_c, user_data]() -> bool {
    +        return runs_task_on_current_thread_callback_c(user_data);
    +      }};
    +
    +  return fml::MakeRefCounted(task_runner_dispatch_table);
    +}
    +
    +std::unique_ptr
    +EmbedderThreadHost::CreateEmbedderOrEngineManagedThreadHost(
    +    const FlutterCustomTaskRunners* custom_task_runners) {
    +  {
    +    auto host = CreateEmbedderManagedThreadHost(custom_task_runners);
    +    if (host && host->IsValid()) {
    +      return host;
    +    }
    +  }
    +
    +  // Only attempt to create the engine managed host if the embedder did not
    +  // specify a custom configuration. We don't want to fallback to the engine
    +  // managed configuration if the embedder attempted to specify a configuration
    +  // but messed up with an incorrect configuration.
    +  if (custom_task_runners == nullptr) {
    +    auto host = CreateEngineManagedThreadHost();
    +    if (host && host->IsValid()) {
    +      return host;
    +    }
    +  }
    +
    +  return nullptr;
    +}
    +
    +constexpr const char* kFlutterThreadName = "io.flutter";
    +
    +// static
    +std::unique_ptr
    +EmbedderThreadHost::CreateEmbedderManagedThreadHost(
    +    const FlutterCustomTaskRunners* custom_task_runners) {
    +  if (custom_task_runners == nullptr) {
    +    return nullptr;
    +  }
    +
    +  const auto platform_task_runner = CreateEmbedderTaskRunner(
    +      SAFE_ACCESS(custom_task_runners, platform_task_runner, nullptr));
    +
    +  // TODO(chinmaygarde): Add more here as we allow more threads to be controlled
    +  // by the embedder. Create fallbacks as necessary.
    +
    +  if (!platform_task_runner) {
    +    return nullptr;
    +  }
    +
    +  ThreadHost thread_host(kFlutterThreadName, ThreadHost::Type::GPU |
    +                                                 ThreadHost::Type::IO |
    +                                                 ThreadHost::Type::UI);
    +
    +  blink::TaskRunners task_runners(
    +      kFlutterThreadName,
    +      platform_task_runner,                     // platform
    +      thread_host.gpu_thread->GetTaskRunner(),  // gpu
    +      thread_host.ui_thread->GetTaskRunner(),   // ui
    +      thread_host.io_thread->GetTaskRunner()    // io
    +  );
    +
    +  if (!task_runners.IsValid()) {
    +    return nullptr;
    +  }
    +
    +  std::set> embedder_task_runners;
    +  embedder_task_runners.insert(platform_task_runner);
    +
    +  auto embedder_host = std::make_unique(
    +      std::move(thread_host), std::move(task_runners),
    +      std::move(embedder_task_runners));
    +
    +  if (embedder_host->IsValid()) {
    +    return embedder_host;
    +  }
    +
    +  return nullptr;
    +}
    +
    +// static
    +std::unique_ptr
    +EmbedderThreadHost::CreateEngineManagedThreadHost() {
    +  // Create a thread host with the current thread as the platform thread and all
    +  // other threads managed.
    +  ThreadHost thread_host(kFlutterThreadName, ThreadHost::Type::GPU |
    +                                                 ThreadHost::Type::IO |
    +                                                 ThreadHost::Type::UI);
    +
    +  fml::MessageLoop::EnsureInitializedForCurrentThread();
    +
    +  // For embedder platforms that don't have native message loop interop, this
    +  // will reference a task runner that points to a null message loop
    +  // implementation.
    +  auto platform_task_runner = fml::MessageLoop::GetCurrent().GetTaskRunner();
    +
    +  blink::TaskRunners task_runners(
    +      kFlutterThreadName,
    +      platform_task_runner,                     // platform
    +      thread_host.gpu_thread->GetTaskRunner(),  // gpu
    +      thread_host.ui_thread->GetTaskRunner(),   // ui
    +      thread_host.io_thread->GetTaskRunner()    // io
    +  );
    +
    +  if (!task_runners.IsValid()) {
    +    return nullptr;
    +  }
    +
    +  std::set> empty_embedder_task_runners;
    +
    +  auto embedder_host = std::make_unique(
    +      std::move(thread_host), std::move(task_runners),
    +      empty_embedder_task_runners);
    +
    +  if (embedder_host->IsValid()) {
    +    return embedder_host;
    +  }
    +
    +  return nullptr;
    +}
    +
    +EmbedderThreadHost::EmbedderThreadHost(
    +    ThreadHost host,
    +    blink::TaskRunners runners,
    +    std::set> embedder_task_runners)
    +    : host_(std::move(host)), runners_(std::move(runners)) {
    +  for (const auto& runner : embedder_task_runners) {
    +    runners_map_[reinterpret_cast(runner.get())] = runner;
    +  }
    +}
    +
    +EmbedderThreadHost::~EmbedderThreadHost() = default;
    +
    +bool EmbedderThreadHost::IsValid() const {
    +  return runners_.IsValid();
    +}
    +
    +const blink::TaskRunners& EmbedderThreadHost::GetTaskRunners() const {
    +  return runners_;
    +}
    +
    +bool EmbedderThreadHost::PostTask(int64_t runner, uint64_t task) const {
    +  auto found = runners_map_.find(runner);
    +  if (found == runners_map_.end()) {
    +    return false;
    +  }
    +  return found->second->PostTask(task);
    +}
    +
    +}  // namespace shell
    diff --git a/shell/platform/embedder/embedder_thread_host.h b/shell/platform/embedder/embedder_thread_host.h
    new file mode 100644
    index 0000000000000..1ae9c309ed72f
    --- /dev/null
    +++ b/shell/platform/embedder/embedder_thread_host.h
    @@ -0,0 +1,54 @@
    +// Copyright 2013 The Flutter 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_EMBEDDER_EMBEDDER_THREAD_HOST_H_
    +#define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_THREAD_HOST_H_
    +
    +#include 
    +#include 
    +#include 
    +
    +#include "flutter/common/task_runners.h"
    +#include "flutter/fml/macros.h"
    +#include "flutter/shell/common/thread_host.h"
    +#include "flutter/shell/platform/embedder/embedder.h"
    +#include "flutter/shell/platform/embedder/embedder_task_runner.h"
    +
    +namespace shell {
    +
    +class EmbedderThreadHost {
    + public:
    +  static std::unique_ptr
    +  CreateEmbedderOrEngineManagedThreadHost(
    +      const FlutterCustomTaskRunners* custom_task_runners);
    +
    +  EmbedderThreadHost(
    +      ThreadHost host,
    +      blink::TaskRunners runners,
    +      std::set> embedder_task_runners);
    +
    +  ~EmbedderThreadHost();
    +
    +  bool IsValid() const;
    +
    +  const blink::TaskRunners& GetTaskRunners() const;
    +
    +  bool PostTask(int64_t runner, uint64_t task) const;
    +
    + private:
    +  ThreadHost host_;
    +  blink::TaskRunners runners_;
    +  std::map> runners_map_;
    +
    +  static std::unique_ptr CreateEmbedderManagedThreadHost(
    +      const FlutterCustomTaskRunners* custom_task_runners);
    +
    +  static std::unique_ptr CreateEngineManagedThreadHost();
    +
    +  FML_DISALLOW_COPY_AND_ASSIGN(EmbedderThreadHost);
    +};
    +
    +}  // namespace shell
    +
    +#endif  // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_THREAD_HOST_H_
    diff --git a/shell/platform/embedder/fixtures/simple_main.dart b/shell/platform/embedder/fixtures/simple_main.dart
    index bd3999563e031..853e136f96ed8 100644
    --- a/shell/platform/embedder/fixtures/simple_main.dart
    +++ b/shell/platform/embedder/fixtures/simple_main.dart
    @@ -1,3 +1,5 @@
    +import 'dart:ui';
    +
     void main() {}
     
     @pragma('vm:entry-point')
    @@ -18,3 +20,9 @@ void customEntrypoint1() {
     void sayHiFromCustomEntrypoint1() native "SayHiFromCustomEntrypoint1";
     void sayHiFromCustomEntrypoint2() native "SayHiFromCustomEntrypoint2";
     void sayHiFromCustomEntrypoint3() native "SayHiFromCustomEntrypoint3";
    +
    +
    +@pragma('vm:entry-point')
    +void invokePlatformTaskRunner() {
    +  window.sendPlatformMessage('OhHi', null, null);
    +}
    diff --git a/shell/platform/embedder/tests/embedder_config_builder.cc b/shell/platform/embedder/tests/embedder_config_builder.cc
    index 23ef27cd3c954..546f95a78ea1a 100644
    --- a/shell/platform/embedder/tests/embedder_config_builder.cc
    +++ b/shell/platform/embedder/tests/embedder_config_builder.cc
    @@ -13,6 +13,7 @@ EmbedderConfigBuilder::EmbedderConfigBuilder(
         : context_(context) {
       project_args_.struct_size = sizeof(project_args_);
       software_renderer_config_.struct_size = sizeof(FlutterSoftwareRendererConfig);
    +  custom_task_runners_.struct_size = sizeof(FlutterCustomTaskRunners);
       software_renderer_config_.surface_present_callback =
           [](void*, const void*, size_t, size_t) { return true; };
     
    @@ -71,8 +72,43 @@ void EmbedderConfigBuilder::SetDartEntrypoint(std::string entrypoint) {
       project_args_.custom_dart_entrypoint = dart_entrypoint_.c_str();
     }
     
    -UniqueEngine EmbedderConfigBuilder::LaunchEngine() const {
    +void EmbedderConfigBuilder::AddCommandLineArgument(std::string arg) {
    +  if (arg.size() == 0) {
    +    return;
    +  }
    +
    +  command_line_arguments_.emplace_back(std::move(arg));
    +}
    +
    +void EmbedderConfigBuilder::SetPlatformTaskRunner(
    +    const FlutterTaskRunnerDescription* runner) {
    +  if (runner == nullptr) {
    +    return;
    +  }
    +  custom_task_runners_.platform_task_runner = runner;
    +  project_args_.custom_task_runners = &custom_task_runners_;
    +}
    +
    +UniqueEngine EmbedderConfigBuilder::LaunchEngine() {
       FlutterEngine engine = nullptr;
    +
    +  std::vector args;
    +  args.reserve(command_line_arguments_.size());
    +
    +  for (const auto& arg : command_line_arguments_) {
    +    args.push_back(arg.c_str());
    +  }
    +
    +  if (args.size() > 0) {
    +    project_args_.command_line_argv = args.data();
    +    project_args_.command_line_argc = args.size();
    +  } else {
    +    // Clear it out in case this is not the first engine launch from the
    +    // embedder config builder.
    +    project_args_.command_line_argv = nullptr;
    +    project_args_.command_line_argc = 0;
    +  }
    +
       auto result = FlutterEngineRun(FLUTTER_ENGINE_VERSION, &renderer_config_,
                                      &project_args_, &context_, &engine);
     
    diff --git a/shell/platform/embedder/tests/embedder_config_builder.h b/shell/platform/embedder/tests/embedder_config_builder.h
    index b76edb98734b9..28c057d11441b 100644
    --- a/shell/platform/embedder/tests/embedder_config_builder.h
    +++ b/shell/platform/embedder/tests/embedder_config_builder.h
    @@ -19,7 +19,7 @@ struct UniqueEngineTraits {
     
       static bool IsValid(const FlutterEngine& value) { return value != nullptr; }
     
    -  static void Free(FlutterEngine engine) {
    +  static void Free(FlutterEngine& engine) {
         auto result = FlutterEngineShutdown(engine);
         FML_CHECK(result == kSuccess);
       }
    @@ -50,7 +50,11 @@ class EmbedderConfigBuilder {
     
       void SetDartEntrypoint(std::string entrypoint);
     
    -  UniqueEngine LaunchEngine() const;
    +  void AddCommandLineArgument(std::string arg);
    +
    +  void SetPlatformTaskRunner(const FlutterTaskRunnerDescription* runner);
    +
    +  UniqueEngine LaunchEngine();
     
      private:
       EmbedderContext& context_;
    @@ -58,6 +62,8 @@ class EmbedderConfigBuilder {
       FlutterRendererConfig renderer_config_ = {};
       FlutterSoftwareRendererConfig software_renderer_config_ = {};
       std::string dart_entrypoint_;
    +  FlutterCustomTaskRunners custom_task_runners_ = {};
    +  std::vector command_line_arguments_;
     
       FML_DISALLOW_COPY_AND_ASSIGN(EmbedderConfigBuilder);
     };
    diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc
    index 6bad99a39dd0c..357a4e71114ab 100644
    --- a/shell/platform/embedder/tests/embedder_unittests.cc
    +++ b/shell/platform/embedder/tests/embedder_unittests.cc
    @@ -2,11 +2,17 @@
     // 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 
    +
     #include "embedder.h"
     #include "flutter/fml/file.h"
    +#include "flutter/fml/make_copyable.h"
     #include "flutter/fml/mapping.h"
    +#include "flutter/fml/message_loop.h"
     #include "flutter/fml/synchronization/waitable_event.h"
    +#include "flutter/fml/thread.h"
     #include "flutter/shell/platform/embedder/tests/embedder_config_builder.h"
     #include "flutter/shell/platform/embedder/tests/embedder_test.h"
     #include "flutter/testing/testing.h"
    @@ -68,7 +74,7 @@ TEST_F(EmbedderTest, CanInvokeCustomEntrypointMacro) {
     
       // Can be defined separately.
       auto entry1 = [&latch1](Dart_NativeArguments args) {
    -    FML_LOG(ERROR) << "In Callback 1";
    +    FML_LOG(INFO) << "In Callback 1";
         latch1.Signal();
       };
       auto native_entry1 = CREATE_NATIVE_ENTRY(entry1);
    @@ -76,7 +82,7 @@ TEST_F(EmbedderTest, CanInvokeCustomEntrypointMacro) {
     
       // Can be wrapped in in the args.
       auto entry2 = [&latch2](Dart_NativeArguments args) {
    -    FML_LOG(ERROR) << "In Callback 2";
    +    FML_LOG(INFO) << "In Callback 2";
         latch2.Signal();
       };
       context.AddNativeCallback("SayHiFromCustomEntrypoint2",
    @@ -86,7 +92,7 @@ TEST_F(EmbedderTest, CanInvokeCustomEntrypointMacro) {
       context.AddNativeCallback(
           "SayHiFromCustomEntrypoint3",
           CREATE_NATIVE_ENTRY([&latch3](Dart_NativeArguments args) {
    -        FML_LOG(ERROR) << "In Callback 3";
    +        FML_LOG(INFO) << "In Callback 3";
             latch3.Signal();
           }));
     
    @@ -99,5 +105,110 @@ TEST_F(EmbedderTest, CanInvokeCustomEntrypointMacro) {
       ASSERT_TRUE(engine.is_valid());
     }
     
    +class EmbedderTestTaskRunner {
    + public:
    +  EmbedderTestTaskRunner(std::function on_forward_task)
    +      : on_forward_task_(on_forward_task) {}
    +
    +  void SetForwardingTaskRunner(fml::RefPtr runner) {
    +    forwarding_target_ = std::move(runner);
    +  }
    +
    +  FlutterTaskRunnerDescription GetEmbedderDescription() {
    +    FlutterTaskRunnerDescription desc;
    +    desc.struct_size = sizeof(desc);
    +    desc.user_data = this;
    +    desc.runs_task_on_current_thread_callback = [](void* user_data) -> bool {
    +      return reinterpret_cast(user_data)
    +          ->forwarding_target_->RunsTasksOnCurrentThread();
    +    };
    +    desc.post_task_callback = [](FlutterTask task, uint64_t target_time_nanos,
    +                                 void* user_data) -> void {
    +      auto runner = reinterpret_cast(user_data);
    +
    +      auto target_time = fml::TimePoint::FromEpochDelta(
    +          fml::TimeDelta::FromNanoseconds(target_time_nanos));
    +
    +      runner->forwarding_target_->PostTaskForTime(
    +          [task, forwarder = runner->on_forward_task_]() { forwarder(task); },
    +          target_time);
    +    };
    +    return desc;
    +  }
    +
    + private:
    +  fml::RefPtr forwarding_target_;
    +  std::function on_forward_task_;
    +
    +  FML_DISALLOW_COPY_AND_ASSIGN(EmbedderTestTaskRunner);
    +};
    +
    +TEST_F(EmbedderTest, CanSpecifyCustomTaskRunner) {
    +  auto& context = GetEmbedderContext();
    +  fml::AutoResetWaitableEvent latch;
    +
    +  // Run the test on its own thread with a message loop so that it san safely
    +  // pump its event loop while we wait for all the conditions to be checked.
    +  fml::Thread thread;
    +  UniqueEngine engine;
    +  bool signalled = false;
    +
    +  EmbedderTestTaskRunner runner([&](FlutterTask task) {
    +    // There may be multiple tasks posted but we only need to check assertions
    +    // once.
    +    if (signalled) {
    +      // Since we have the baton, return it back to the engine. We don't care
    +      // about the return value because the engine could be shutting down an it
    +      // may not actually be able to accept the same.
    +      FlutterEngineRunTask(engine.get(), &task);
    +      return;
    +    }
    +
    +    signalled = true;
    +    FML_LOG(INFO) << "Checking assertions.";
    +    ASSERT_TRUE(engine.is_valid());
    +    ASSERT_EQ(FlutterEngineRunTask(engine.get(), &task), kSuccess);
    +    latch.Signal();
    +  });
    +
    +  thread.GetTaskRunner()->PostTask([&]() {
    +    EmbedderConfigBuilder builder(context);
    +    builder.AddCommandLineArgument("--verbose-logging");
    +    const auto task_runner_description = runner.GetEmbedderDescription();
    +    runner.SetForwardingTaskRunner(
    +        fml::MessageLoop::GetCurrent().GetTaskRunner());
    +    builder.SetPlatformTaskRunner(&task_runner_description);
    +    builder.SetDartEntrypoint("invokePlatformTaskRunner");
    +    engine = builder.LaunchEngine();
    +    ASSERT_TRUE(engine.is_valid());
    +  });
    +
    +  // Signalled when all the assertions are checked.
    +  latch.Wait();
    +  FML_LOG(INFO) << "Assertions checked. Killing engine.";
    +  ASSERT_TRUE(engine.is_valid());
    +
    +  // Since the engine was started on its own thread, it must be killed there as
    +  // well.
    +  fml::AutoResetWaitableEvent kill_latch;
    +  thread.GetTaskRunner()->PostTask(
    +      fml::MakeCopyable([&engine, &kill_latch]() mutable {
    +        engine.reset();
    +        FML_LOG(INFO) << "Engine killed.";
    +        kill_latch.Signal();
    +      }));
    +  kill_latch.Wait();
    +
    +  ASSERT_TRUE(signalled);
    +}
    +
    +TEST(EmbedderTestNoFixture, CanGetCurrentTimeInNanoseconds) {
    +  auto point1 = fml::TimePoint::FromEpochDelta(
    +      fml::TimeDelta::FromNanoseconds(FlutterEngineGetCurrentTime()));
    +  auto point2 = fml::TimePoint::Now();
    +
    +  ASSERT_LT((point2 - point1), fml::TimeDelta::FromMilliseconds(1));
    +}
    +
     }  // namespace testing
     }  // namespace shell
    
    From 4efc32163c7433a469f149c2eb05a2f88780ab2d Mon Sep 17 00:00:00 2001
    From: Chris Bracken 
    Date: Wed, 27 Mar 2019 16:22:12 -0700
    Subject: [PATCH 0592/1117] Add super call in FLEView reshape (#8335)
    
    NSOpenGLView reshape is annotated with NS_REQUIRES_SUPER. This avoids
    build failures when building with `-Wobjc-missing-super-calls`.
    ---
     shell/platform/darwin/macos/framework/Source/FLEView.mm | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/shell/platform/darwin/macos/framework/Source/FLEView.mm b/shell/platform/darwin/macos/framework/Source/FLEView.mm
    index 5ce7ddb8ffc78..7d67fc33c0abc 100644
    --- a/shell/platform/darwin/macos/framework/Source/FLEView.mm
    +++ b/shell/platform/darwin/macos/framework/Source/FLEView.mm
    @@ -32,6 +32,7 @@ - (BOOL)isOpaque {
     }
     
     - (void)reshape {
    +  [super reshape];
       [_reshapeListener viewDidReshape:self];
     }
     
    
    From 6d8b836777f1e8eec3fd568de19e25236807bbfa Mon Sep 17 00:00:00 2001
    From: stuartmorgan 
    Date: Wed, 27 Mar 2019 19:24:03 -0400
    Subject: [PATCH 0593/1117] Remove use of epoxy from Linux shell (#8334)
    
    Simplifies the build and runtime requirements for the Linux shell.
    Since the engine does GL extension lookup manually anway, an extension
    loader library isn't necessary.
    ---
     build/install-build-deps-linux-desktop.sh | 2 +-
     shell/platform/glfw/BUILD.gn              | 1 -
     shell/platform/glfw/flutter_glfw.cc       | 5 -----
     shell/platform/linux/config/BUILD.gn      | 4 ----
     4 files changed, 1 insertion(+), 11 deletions(-)
    
    diff --git a/build/install-build-deps-linux-desktop.sh b/build/install-build-deps-linux-desktop.sh
    index e3c47a69a3375..6048470aa43de 100755
    --- a/build/install-build-deps-linux-desktop.sh
    +++ b/build/install-build-deps-linux-desktop.sh
    @@ -8,4 +8,4 @@
     
     set -e
     
    -sudo apt-get -y install libglfw3-dev libepoxy-dev libgtk-3-dev libx11-dev
    +sudo apt-get -y install libglfw3-dev libgtk-3-dev libx11-dev
    diff --git a/shell/platform/glfw/BUILD.gn b/shell/platform/glfw/BUILD.gn
    index 5fa29fc02c717..00b1aec1bccd9 100644
    --- a/shell/platform/glfw/BUILD.gn
    +++ b/shell/platform/glfw/BUILD.gn
    @@ -59,7 +59,6 @@ source_set("flutter_glfw") {
         libs = [ "GL" ]
     
         configs += [
    -      "$flutter_root/shell/platform/linux/config:epoxy",
           "$flutter_root/shell/platform/linux/config:glfw3",
           "$flutter_root/shell/platform/linux/config:gtk3",
           "$flutter_root/shell/platform/linux/config:x11",
    diff --git a/shell/platform/glfw/flutter_glfw.cc b/shell/platform/glfw/flutter_glfw.cc
    index 9b2e6c4871d6c..ab03cac69f9c5 100644
    --- a/shell/platform/glfw/flutter_glfw.cc
    +++ b/shell/platform/glfw/flutter_glfw.cc
    @@ -10,11 +10,6 @@
     #include 
     #include 
     
    -#ifdef __linux__
    -// Epoxy must be included before any graphics-related code.
    -#include 
    -#endif
    -
     #include 
     
     #include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h"
    diff --git a/shell/platform/linux/config/BUILD.gn b/shell/platform/linux/config/BUILD.gn
    index 81043013717b1..8eeeaf687b258 100644
    --- a/shell/platform/linux/config/BUILD.gn
    +++ b/shell/platform/linux/config/BUILD.gn
    @@ -4,10 +4,6 @@
     
     import("//build/config/linux/pkg_config.gni")
     
    -pkg_config("epoxy") {
    -  packages = [ "epoxy" ]
    -}
    -
     pkg_config("glfw3") {
       packages = [ "glfw3" ]
     }
    
    From 68002458f4762f14f99778a517e9665229c10dfb Mon Sep 17 00:00:00 2001
    From: Chinmay Garde 
    Date: Wed, 27 Mar 2019 16:43:08 -0700
    Subject: [PATCH 0594/1117] Fix Windows build. (#8336)
    
    ---
     .../platform/embedder/embedder_thread_host.cc  | 18 ++++++++++--------
     1 file changed, 10 insertions(+), 8 deletions(-)
    
    diff --git a/shell/platform/embedder/embedder_thread_host.cc b/shell/platform/embedder/embedder_thread_host.cc
    index 648025ea5a317..925b596d8a18d 100644
    --- a/shell/platform/embedder/embedder_thread_host.cc
    +++ b/shell/platform/embedder/embedder_thread_host.cc
    @@ -39,19 +39,21 @@ static fml::RefPtr CreateEmbedderTaskRunner(
           description->runs_task_on_current_thread_callback;
     
       EmbedderTaskRunner::DispatchTable task_runner_dispatch_table = {
    -      .post_task_callback = [post_task_callback_c, user_data](
    -                                EmbedderTaskRunner* task_runner,
    -                                uint64_t task_baton,
    -                                fml::TimePoint target_time) -> void {
    +      // .post_task_callback
    +      [post_task_callback_c, user_data](EmbedderTaskRunner* task_runner,
    +                                        uint64_t task_baton,
    +                                        fml::TimePoint target_time) -> void {
             FlutterTask task = {
    -            .runner = reinterpret_cast(task_runner),
    -            .task = task_baton,
    +            // runner
    +            reinterpret_cast(task_runner),
    +            // task
    +            task_baton,
             };
             post_task_callback_c(task, target_time.ToEpochDelta().ToNanoseconds(),
                                  user_data);
           },
    -      .runs_task_on_current_thread_callback =
    -          [runs_task_on_current_thread_callback_c, user_data]() -> bool {
    +      // runs_task_on_current_thread_callback
    +      [runs_task_on_current_thread_callback_c, user_data]() -> bool {
             return runs_task_on_current_thread_callback_c(user_data);
           }};
     
    
    From 5c99138fa8e9f65d307e84b92a08adeff0bc26ef Mon Sep 17 00:00:00 2001
    From: stuartmorgan 
    Date: Wed, 27 Mar 2019 20:22:50 -0400
    Subject: [PATCH 0595/1117] Build GLFW from source for Linux shell (#8327)
    
    Instead of requiring a system-level GLFW, build it from source and
    statically link it into the Linux shell.
    ---
     DEPS                                      | 2 +-
     build/install-build-deps-linux-desktop.sh | 2 +-
     shell/platform/glfw/BUILD.gn              | 2 +-
     shell/platform/linux/config/BUILD.gn      | 4 ----
     4 files changed, 3 insertions(+), 7 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index ac42e3fa0a2fa..8fa0aeff133ba 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -121,7 +121,7 @@ allowed_hosts = [
     ]
     
     deps = {
    -  'src': 'https://github.com/flutter/buildroot.git' + '@' + 'ee817fb84542865e253bcce1866bc13e4065ca4d',
    +  'src': 'https://github.com/flutter/buildroot.git' + '@' + 'ad098fcdb1b41fcf57c22e46e898d0dc04d3a178',
     
        # Fuchsia compatibility
        #
    diff --git a/build/install-build-deps-linux-desktop.sh b/build/install-build-deps-linux-desktop.sh
    index 6048470aa43de..ef24ad5d95cf5 100755
    --- a/build/install-build-deps-linux-desktop.sh
    +++ b/build/install-build-deps-linux-desktop.sh
    @@ -8,4 +8,4 @@
     
     set -e
     
    -sudo apt-get -y install libglfw3-dev libgtk-3-dev libx11-dev
    +sudo apt-get -y install libgtk-3-dev libx11-dev
    diff --git a/shell/platform/glfw/BUILD.gn b/shell/platform/glfw/BUILD.gn
    index 00b1aec1bccd9..478d2e80e3255 100644
    --- a/shell/platform/glfw/BUILD.gn
    +++ b/shell/platform/glfw/BUILD.gn
    @@ -52,6 +52,7 @@ source_set("flutter_glfw") {
         "$flutter_root/shell/platform/common/cpp/client_wrapper:client_wrapper",
         "$flutter_root/shell/platform/embedder:embedder",
         "$flutter_root/shell/platform/glfw/client_wrapper:client_wrapper_glfw",
    +    "//build/secondary/third_party/glfw",
         "//third_party/rapidjson",
       ]
     
    @@ -59,7 +60,6 @@ source_set("flutter_glfw") {
         libs = [ "GL" ]
     
         configs += [
    -      "$flutter_root/shell/platform/linux/config:glfw3",
           "$flutter_root/shell/platform/linux/config:gtk3",
           "$flutter_root/shell/platform/linux/config:x11",
         ]
    diff --git a/shell/platform/linux/config/BUILD.gn b/shell/platform/linux/config/BUILD.gn
    index 8eeeaf687b258..f501bac61096e 100644
    --- a/shell/platform/linux/config/BUILD.gn
    +++ b/shell/platform/linux/config/BUILD.gn
    @@ -4,10 +4,6 @@
     
     import("//build/config/linux/pkg_config.gni")
     
    -pkg_config("glfw3") {
    -  packages = [ "glfw3" ]
    -}
    -
     pkg_config("gtk3") {
       packages = [ "gtk+-3.0" ]
     }
    
    From 2098398e10facafbca6d257735c96075b283c454 Mon Sep 17 00:00:00 2001
    From: Chris Bracken 
    Date: Wed, 27 Mar 2019 18:09:08 -0700
    Subject: [PATCH 0596/1117] Cleanups to run_tests.sh script (#8337)
    
    Bugfix:
    * Use the `pub` from within the built Dart SDK (not whatever's on
      `$PATH`, if anything).
    
    A few minor improvements:
    * Allow running from below the src/ buildroot dir, as it's often
      convenient to work from within the flutter/engine git dir.
    * Echo test name before running, for slightly better debuggability.
    * Minor line-wrapping for readability.
    ---
     testing/run_tests.sh | 86 +++++++++++++++++++++++++++++++++-----------
     1 file changed, 66 insertions(+), 20 deletions(-)
    
    diff --git a/testing/run_tests.sh b/testing/run_tests.sh
    index e3f54cd02842d..ea491b4bb720a 100755
    --- a/testing/run_tests.sh
    +++ b/testing/run_tests.sh
    @@ -2,35 +2,81 @@
     
     set -o pipefail -e;
     
    -HOST_DIR=${1:-host_debug_unopt}
    +BUILDROOT_DIR="$(pwd)"
    +if [[ "$BUILDROOT_DIR" != */src ]]; then
    +  if [[ "$BUILDROOT_DIR" != */src/* ]]; then
    +    echo "Unable to determine build root. Exiting."
    +    exit 1
    +  fi
    +  BUILDROOT_DIR="${BUILDROOT_DIR%/src/*}/src"
    +fi
    +echo "Using build root: $BUILDROOT_DIR"
    +
    +OUT_DIR="$BUILDROOT_DIR/out"
    +HOST_DIR="$OUT_DIR/${1:-host_debug_unopt}"
    +
    +# Check a Dart SDK has been built.
    +if [[ ! -d "$HOST_DIR/dart-sdk" ]]; then
    +  echo "Built Dart SDK not found at $HOST_DIR/dart-sdk. Exiting."
    +  exit 1
    +fi
    +
    +# Switch to buildroot dir. Some tests assume paths relative to buildroot.
    +cd "$BUILDROOT_DIR"
     
     # TODO(dnfield): Re-enable this when the upstream Dart changes that make it not be flaky land.
    -# out/$HOST_DIR/embedder_unittests
    -out/$HOST_DIR/flow_unittests
    -out/$HOST_DIR/fml_unittests --gtest_filter="-*TimeSensitiveTest*"
    -out/$HOST_DIR/runtime_unittests
    -out/$HOST_DIR/shell_unittests
    -out/$HOST_DIR/synchronization_unittests
    -out/$HOST_DIR/txt_unittests  --font-directory=flutter/third_party/txt/third_party/fonts
    -
    -# pubspec.yaml points to these files
    -./flutter/tools/gn --unoptimized
    -ninja -C out/host_debug_unopt flutter/sky/packages
    -
    -pushd flutter/testing/dart
    -pub get
    +# $HOST_DIR/embedder_unittests
    +echo "Running flow_unittests..."
    +"$HOST_DIR/flow_unittests"
    +
    +echo "Running fml_unittests..."
    +"$HOST_DIR/fml_unittests" --gtest_filter="-*TimeSensitiveTest*"
    +
    +echo "Running runtime_unittests..."
    +"$HOST_DIR/runtime_unittests"
    +
    +echo "Running shell_unittests..."
    +"$HOST_DIR/shell_unittests"
    +
    +echo "Running synchronization_unittests..."
    +"$HOST_DIR/synchronization_unittests"
    +
    +echo "Running txt_unittests..."
    +"$HOST_DIR/txt_unittests" --font-directory="$BUILDROOT_DIR/flutter/third_party/txt/third_party/fonts"
    +
    +# Build flutter/sky/packages.
    +#
    +# flutter/testing/dart/pubspec.yaml contains harcoded path deps to
    +# host_debug_unopt packages.
    +"$BUILDROOT_DIR/flutter/tools/gn" --unoptimized
    +ninja -C $OUT_DIR/host_debug_unopt flutter/sky/packages
    +
    +# Fetch Dart test dependencies.
    +pushd "$BUILDROOT_DIR/flutter/testing/dart"
    +"$HOST_DIR/dart-sdk/bin/pub" get
     popd
     
     run_test () {
    -  out/$HOST_DIR/dart out/$HOST_DIR/gen/frontend_server.dart.snapshot --sdk-root out/$HOST_DIR/flutter_patched_sdk --incremental --strong --target=flutter --packages flutter/testing/dart/.packages --output-dill out/$HOST_DIR/engine_test.dill $1
    -  out/$HOST_DIR/flutter_tester --disable-observatory --use-test-fonts out/$HOST_DIR/engine_test.dill
    +  "$HOST_DIR/dart" $HOST_DIR/gen/frontend_server.dart.snapshot \
    +      --sdk-root $HOST_DIR/flutter_patched_sdk \
    +      --incremental \
    +      --strong \
    +      --target=flutter \
    +      --packages flutter/testing/dart/.packages \
    +      --output-dill $HOST_DIR/engine_test.dill \
    +      $1
    +
    +  "$HOST_DIR/flutter_tester" \
    +      --disable-observatory \
    +      --use-test-fonts \
    +      "$HOST_DIR/engine_test.dill"
     }
     
     # Verify that a failing test returns a failure code.
    -! run_test flutter/testing/smoke_test_failure/fail_test.dart
    +! run_test "$BUILDROOT_DIR/flutter/testing/smoke_test_failure/fail_test.dart"
     
    -for TEST_SCRIPT in flutter/testing/dart/*.dart; do
    -  run_test $TEST_SCRIPT
    +for TEST_SCRIPT in "$BUILDROOT_DIR"/flutter/testing/dart/*.dart; do
    +  run_test "$TEST_SCRIPT"
     done
     
     pushd flutter
    
    From a0110107ee2de5ee8e921bfc2446d2a84c5660be Mon Sep 17 00:00:00 2001
    From: Ben Konyi 
    Date: Wed, 27 Mar 2019 18:58:04 -0700
    Subject: [PATCH 0597/1117] Roll src/third_party/dart 991c9da720..ffee99d79b (7
     commits)
    
    ffee99d79b Add asyncExpectThrows() to async_helper.
    994f535e03 [vm/bytecode/compiler] Remove excessive stack overflow checks when inlining
    9ea9612ce8 Object can be used in for-in and await for elements.
    4555cf788d Convert one more set of tests
    a9ee08051d [dartdevc] Remove redundant parameters from helper methods
    1bbd282d65 Make analyzer/tool/summary/generate.dart take an IDL path
    f12715354a [co19] DEPS updated
    ---
     DEPS                                    | 2 +-
     ci/licenses_golden/licenses_third_party | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 8fa0aeff133ba..51ff603bdf802 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -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': '991c9da7205b512e479283419bcbdc19f1f1f6c2',
    +  'dart_revision': 'ffee99d79b1c3d57c24c6b06384d7e14208302af',
     
       # WARNING: DO NOT EDIT MANUALLY
       # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
    diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party
    index bc2bb1adbb6d9..20fa6f01f11dd 100644
    --- a/ci/licenses_golden/licenses_third_party
    +++ b/ci/licenses_golden/licenses_third_party
    @@ -1,4 +1,4 @@
    -Signature: 7836db551ccf7833d0c865f0d2a3cfad
    +Signature: 6961e56f8b4a164c0bc30ffadf5292ba
     
     UNUSED LICENSES:
     
    
    From 6415277d023ff43d9fd7a7ed39a2416d6cb93a0c Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Wed, 27 Mar 2019 22:29:49 -0400
    Subject: [PATCH 0598/1117] Roll src/third_party/skia
     8d2c19554e4a..e4c67058ddb1 (1 commits) (#8341)
    
    https://skia.googlesource.com/skia.git/%2Blog/8d2c19554e4a..e4c67058ddb1
    
    git log 8d2c19554e4a1f9f75abaf1093558f9fc712ddf4..e4c67058ddb14564c0a28cb32a5d878b13fd9f98 --date=short --no-merges --format=%ad %ae %s
    2019-03-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 c240abe4ef2c..208af3ebda25 (3 commits)
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 51ff603bdf802..5af7c8b1b546d 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': '8d2c19554e4a1f9f75abaf1093558f9fc712ddf4',
    +  'skia_revision': 'e4c67058ddb14564c0a28cb32a5d878b13fd9f98',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 631043f15f904..788c734598fe9 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: de6d3f4aa462810f8b52a646cac334d6
    +Signature: 027ae28920b252dbcb5370cc65bef8cb
     
     UNUSED LICENSES:
     
    
    From 84c62b4c7d254762c53f33bc881edd0358861798 Mon Sep 17 00:00:00 2001
    From: stuartmorgan 
    Date: Wed, 27 Mar 2019 23:38:44 -0400
    Subject: [PATCH 0599/1117] Build Windows shell (#8331)
    
    Enables the build of the Windows shell, based on the same GLFW code used
    by the current Linux shell.
    ---
     shell/platform/BUILD.gn                       |  9 +++++---
     .../common/cpp/client_wrapper/publish.gni     | 12 +++++++++-
     shell/platform/windows/BUILD.gn               | 22 +++++++++++++++++++
     3 files changed, 39 insertions(+), 4 deletions(-)
     create mode 100644 shell/platform/windows/BUILD.gn
    
    diff --git a/shell/platform/BUILD.gn b/shell/platform/BUILD.gn
    index 206f997d9d04b..89b1bbabe6f4d 100644
    --- a/shell/platform/BUILD.gn
    +++ b/shell/platform/BUILD.gn
    @@ -13,9 +13,12 @@ group("platform") {
         ]
       } else if (is_linux) {
         deps = []
    -  } else if (is_win || is_fuchsia) {
    -    # There is no platform target on Windows. Fuchsia has its own runner
    -    # implementation.
    +  } else if (is_win) {
    +    deps = [
    +      "windows",
    +    ]
    +  } else if ( is_fuchsia) {
    +    # Fuchsia has its own runner implementation.
         deps = []
       } else {
         assert(false, "Unknown/Unsupported platform.")
    diff --git a/shell/platform/common/cpp/client_wrapper/publish.gni b/shell/platform/common/cpp/client_wrapper/publish.gni
    index 8913062ced2f4..5483ab56a6a7c 100644
    --- a/shell/platform/common/cpp/client_wrapper/publish.gni
    +++ b/shell/platform/common/cpp/client_wrapper/publish.gni
    @@ -23,7 +23,10 @@ template("publish_client_wrapper") {
       }
     
       copy("${template_target_name}_publish_includes") {
    -    visibility = [ ":$template_target_name" ]
    +    visibility = [
    +      ":$template_target_name",
    +      ":${template_target_name}_publish_sources",
    +    ]
     
         sources = invoker.public
         outputs = [
    @@ -38,5 +41,12 @@ template("publish_client_wrapper") {
         outputs = [
           "$publish_dir_root/{{source_file_part}}",
         ]
    +
    +    # GN on Windows appears to do #include checks even for copy
    +    # targets, so add the dependency to the headers to satisfy
    +    # the check.
    +    deps = [
    +      ":${template_target_name}_publish_includes",
    +    ]
       }
     }
    diff --git a/shell/platform/windows/BUILD.gn b/shell/platform/windows/BUILD.gn
    new file mode 100644
    index 0000000000000..26fe53036b49a
    --- /dev/null
    +++ b/shell/platform/windows/BUILD.gn
    @@ -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.
    +
    +assert(is_win)
    +
    +group("windows") {
    +  deps = [
    +    ":flutter_windows",
    +    "$flutter_root/shell/platform/glfw:publish_headers_glfw",
    +    "$flutter_root/shell/platform/common/cpp/client_wrapper:publish_wrapper",
    +    "$flutter_root/shell/platform/glfw/client_wrapper:publish_wrapper_glfw",
    +  ]
    +}
    +
    +shared_library("flutter_windows") {
    +  deps = [
    +    "$flutter_root/shell/platform/glfw:flutter_glfw",
    +  ]
    +
    +  public_configs = [ "$flutter_root:config" ]
    +}
    
    From 5983b7adf85c476100745954b59a2c6d12bf5496 Mon Sep 17 00:00:00 2001
    From: Ben Konyi 
    Date: Wed, 27 Mar 2019 22:00:26 -0700
    Subject: [PATCH 0600/1117] Roll src/third_party/dart ffee99d79b..cf32584870 (6
     commits)
    
    cf32584870 [vm] Support compiling static field initializers and dynamic invocation forwarders from a compilation trace.
    3364df5050 Fix a bug that led to a divide-by-zero exception
    f226f4ff24 Improve type of typed-array load
    e5bc8c2d39 [ VM / Service ] Remove Platform.pathSeparator from test and replace with / to fix Windows failure
    0d93a85916 [vm/bytecode] Clean component metadata except bytecode when dropping AST
    ca2f03c5f8 [ VM / Service ] Allow for breakpoints to be set using either file: or package: URIs for packages.
    ---
     DEPS                                    | 2 +-
     ci/licenses_golden/licenses_third_party | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 5af7c8b1b546d..2769e4b0c0f10 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -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': 'ffee99d79b1c3d57c24c6b06384d7e14208302af',
    +  'dart_revision': 'cf32584870c752f0f00927edb40eec0adda29fd8',
     
       # WARNING: DO NOT EDIT MANUALLY
       # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
    diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party
    index 20fa6f01f11dd..f74ac768d3574 100644
    --- a/ci/licenses_golden/licenses_third_party
    +++ b/ci/licenses_golden/licenses_third_party
    @@ -1,4 +1,4 @@
    -Signature: 6961e56f8b4a164c0bc30ffadf5292ba
    +Signature: 5da60d3bb0b6e344cc2d9cf63016123e
     
     UNUSED LICENSES:
     
    
    From c4d14a00716fa616b69d51bab957aee483bdc9c2 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Thu, 28 Mar 2019 01:58:49 -0400
    Subject: [PATCH 0601/1117] Roll src/third_party/skia
     e4c67058ddb1..01a065884b7d (1 commits) (#8344)
    
    https://skia.googlesource.com/skia.git/%2Blog/e4c67058ddb1..01a065884b7d
    
    git log e4c67058ddb14564c0a28cb32a5d878b13fd9f98..01a065884b7d0a1fe563007e72bbf2793727c5f4 --date=short --no-merges --format=%ad %ae %s
    2019-03-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 83d44af5c208..eb8d3bc0b607 (520 commits)
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 2769e4b0c0f10..e57750c19b22a 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': 'e4c67058ddb14564c0a28cb32a5d878b13fd9f98',
    +  'skia_revision': '01a065884b7d0a1fe563007e72bbf2793727c5f4',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 788c734598fe9..f4f5990a31af1 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 027ae28920b252dbcb5370cc65bef8cb
    +Signature: 94546a1a89029e670c7d59ef446bab01
     
     UNUSED LICENSES:
     
    
    From 80ea029d9b26d2f5de57f81a703b125fc4836993 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Thu, 28 Mar 2019 05:28:50 -0400
    Subject: [PATCH 0602/1117] Roll src/third_party/skia
     01a065884b7d..3240800a9487 (2 commits) (#8347)
    
    https://skia.googlesource.com/skia.git/%2Blog/01a065884b7d..3240800a9487
    
    git log 01a065884b7d0a1fe563007e72bbf2793727c5f4..3240800a9487b736fa268f10c3f5dc0612dbc39d --date=short --no-merges --format=%ad %ae %s
    2019-03-28 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset
    2019-03-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 179c932426b3..57e05b8be2d9 (1 commits)
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index e57750c19b22a..121477fbd9f6b 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': '01a065884b7d0a1fe563007e72bbf2793727c5f4',
    +  'skia_revision': '3240800a9487b736fa268f10c3f5dc0612dbc39d',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index f4f5990a31af1..7b030e75488f5 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 94546a1a89029e670c7d59ef446bab01
    +Signature: 4d61eccd0693e0b870ccb46afabc6905
     
     UNUSED LICENSES:
     
    
    From 2aa3c3ef291867b8654987e38497d690308d2ab7 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Thu, 28 Mar 2019 08:57:50 -0400
    Subject: [PATCH 0603/1117] Roll src/third_party/skia
     3240800a9487..e51181387f76 (2 commits) (#8349)
    
    https://skia.googlesource.com/skia.git/%2Blog/3240800a9487..e51181387f76
    
    git log 3240800a9487b736fa268f10c3f5dc0612dbc39d..e51181387f763864acf5be828831b2d7c2b29065 --date=short --no-merges --format=%ad %ae %s
    2019-03-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 208af3ebda25..e810ad90799c (10 commits)
    2019-03-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 57e05b8be2d9..94f195b18776 (1 commits)
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 121477fbd9f6b..6f0cc80f5b8ee 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': '3240800a9487b736fa268f10c3f5dc0612dbc39d',
    +  'skia_revision': 'e51181387f763864acf5be828831b2d7c2b29065',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 7b030e75488f5..9c936362aadc5 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 4d61eccd0693e0b870ccb46afabc6905
    +Signature: 030f180c2ea7f19ce2d731d1d314400b
     
     UNUSED LICENSES:
     
    
    From 90ad1e1abff67c2498f3a87a50692d488b4283e3 Mon Sep 17 00:00:00 2001
    From: Ben Konyi 
    Date: Thu, 28 Mar 2019 06:59:44 -0700
    Subject: [PATCH 0604/1117] Roll src/third_party/dart cf32584870..05f3b12960
     (11 commits)
    
    05f3b12960 Add test for native declarations
    b978fdd142 Move experimental flag defaults to CFE
    cc00203310 Update pub client version
    3e4a1de6e9 Use dart:foo-patch import uri for patches; remove VM workaround for sdk uris
    cf768254fd Temporarily disable 'Allow the incremental compiler to load modules'
    7baae76480 Always use ir constants in annotations when constant-update-2018 is enabled
    10abacba10 Use hasOnlyNonDeferredImportPathsToConstant to add deferred constants
    32a5fa0a83 Allow incremental compiler to just create outline
    83e6e9f8e6 Allow the incremental compiler to load modules
    ef168de000 [vm/kernel] Index all source and line starts before using them (2nd try)
    add5a27120 [infra] Add `constant-update-2018` flag to v2.3 lang features tests
    ---
     DEPS                                    | 4 ++--
     ci/licenses_golden/licenses_third_party | 2 +-
     2 files changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 6f0cc80f5b8ee..213da9773e38f 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -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': 'cf32584870c752f0f00927edb40eec0adda29fd8',
    +  'dart_revision': '05f3b12960fbe1808d367df18b86095b1baed369',
     
       # WARNING: DO NOT EDIT MANUALLY
       # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
    @@ -74,7 +74,7 @@ vars = {
       'dart_path_tag': '1.6.2',
       'dart_pool_tag': '1.3.6',
       'dart_protobuf_rev': '0c77167b16d00b561a6055bfe26690af7f26ae88',
    -  'dart_pub_rev': '3c060aae47985e9a248b850f1d0450304a5c97e3',
    +  'dart_pub_rev': '8c363fe26f059c3063f1129adbb3c4e22a8ce954',
       'dart_pub_semver_tag': '1.4.2',
       'dart_quiver_tag': '2.0.0+1',
       'dart_resource_rev': '2.1.5',
    diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party
    index f74ac768d3574..c1da59b9aaf3e 100644
    --- a/ci/licenses_golden/licenses_third_party
    +++ b/ci/licenses_golden/licenses_third_party
    @@ -1,4 +1,4 @@
    -Signature: 5da60d3bb0b6e344cc2d9cf63016123e
    +Signature: 7fd62bb67d412c7e900c9f47816f1440
     
     UNUSED LICENSES:
     
    
    From a3774be74d9aefacccf73ca0252b8dd6443fd4fa Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Thu, 28 Mar 2019 12:29:52 -0400
    Subject: [PATCH 0605/1117] Roll src/third_party/skia
     e51181387f76..05be23dbd3c4 (8 commits) (#8351)
    
    https://skia.googlesource.com/skia.git/%2Blog/e51181387f76..05be23dbd3c4
    
    git log e51181387f763864acf5be828831b2d7c2b29065..05be23dbd3c4565cb23744c154df80b0ebc0208a --date=short --no-merges --format=%ad %ae %s
    2019-03-28 reed@google.com use mixer to combine two filters
    2019-03-28 kjlubick@google.com Add GrCap for initializing textures
    2019-03-28 bsalomon@google.com Don't limit glTexStorage performance workaround on Android to command buffer.
    2019-03-28 mtklein@google.com try purging between benches
    2019-03-28 mtklein@google.com bool SkColorSpaceXformSteps::Required()
    2019-03-28 egdaniel@google.com Add support to disable vsync on mac viewer.
    2019-03-27 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (nontrivial).
    2019-03-28 bratell@opera.com Add an include guard to SkottieShaper.h
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 5 ++++-
     2 files changed, 5 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 213da9773e38f..165eeb6ac282d 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': 'e51181387f763864acf5be828831b2d7c2b29065',
    +  'skia_revision': '05be23dbd3c4565cb23744c154df80b0ebc0208a',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 9c936362aadc5..40e1a0213648d 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 030f180c2ea7f19ce2d731d1d314400b
    +Signature: 0a9088015e0d2542676c0da7061ae844
     
     UNUSED LICENSES:
     
    @@ -2207,6 +2207,7 @@ FILE: ../../../third_party/skia/infra/bots/recipes/housekeeper.expected/Housekee
     FILE: ../../../third_party/skia/infra/bots/recipes/infra.expected/infra_tests.json
     FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus5-GPU-Adreno330-arm-Debug-All-Android.json
     FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Release-All-Android_NoGPUThreads.json
    +FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus7-CPU-Tegra3-arm-Debug-All-Android.json
     FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-ChromeOS-Clang-ASUSChromebookFlipC100-GPU-MaliT764-arm-Release-All.json
     FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Chromecast-Clang-Chorizo-CPU-Cortex_A7-arm-Debug-All.json
     FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Chromecast-Clang-Chorizo-GPU-Cortex_A7-arm-Release-All.json
    @@ -4580,6 +4581,8 @@ FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h
     FILE: ../../../third_party/skia/samplecode/SampleDegenerateQuads.cpp
     FILE: ../../../third_party/skia/samplecode/SampleSG.cpp
     FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp
    +FILE: ../../../third_party/skia/src/core/SkColorFilter_Mixer.cpp
    +FILE: ../../../third_party/skia/src/core/SkColorFilter_Mixer.h
     FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp
     FILE: ../../../third_party/skia/src/core/SkEffectPriv.h
     FILE: ../../../third_party/skia/src/core/SkMixer.cpp
    
    From 84fefc4c33c1e5ce114bfd573c414c87634dd1a7 Mon Sep 17 00:00:00 2001
    From: Ben Konyi 
    Date: Thu, 28 Mar 2019 09:56:03 -0700
    Subject: [PATCH 0606/1117] Roll src/third_party/dart 05f3b12960..a977273262 (3
     commits)
    
    a977273262 Re-allow the incremental compiler to load modules
    7b33a8fdc4 [cfe] Fix type inference in map literals with spreads
    864b22d3ce [cfe] Add inference and type checks to if-elements in maps
    ---
     DEPS | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/DEPS b/DEPS
    index 165eeb6ac282d..c0d835e8ce03f 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -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': '05f3b12960fbe1808d367df18b86095b1baed369',
    +  'dart_revision': 'a977273262343d8fa2f8c5ae268be391f6087e30',
     
       # WARNING: DO NOT EDIT MANUALLY
       # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
    
    From 38702d3cd02aee028dff9ee3bfd11b993dcdb16a Mon Sep 17 00:00:00 2001
    From: Jonah Williams 
    Date: Thu, 28 Mar 2019 10:16:33 -0700
    Subject: [PATCH 0607/1117] Build precompiled sdk and analyzer summary for
     dartdevc (#8345)
    
    ---
     ci/licenses_golden/licenses_flutter |   2 +
     web_sdk/BUILD.gn                    |  27 ++-
     web_sdk/flutter_kernel_sdk.dart     |  10 +-
     web_sdk/libraries.dart              | 313 ++++++++++++++++++++++++++++
     web_sdk/make_combined_sdk.dart      | 120 +++++++++++
     web_sdk/make_combined_sdk.sh        |  16 --
     6 files changed, 465 insertions(+), 23 deletions(-)
     create mode 100644 web_sdk/libraries.dart
     create mode 100755 web_sdk/make_combined_sdk.dart
     delete mode 100755 web_sdk/make_combined_sdk.sh
    
    diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter
    index f5259b505f734..42b501b39285b 100644
    --- a/ci/licenses_golden/licenses_flutter
    +++ b/ci/licenses_golden/licenses_flutter
    @@ -748,7 +748,9 @@ FILE: ../../../flutter/vulkan/vulkan_utilities.h
     FILE: ../../../flutter/vulkan/vulkan_window.cc
     FILE: ../../../flutter/vulkan/vulkan_window.h
     FILE: ../../../flutter/web_sdk/flutter_kernel_sdk.dart
    +FILE: ../../../flutter/web_sdk/libraries.dart
     FILE: ../../../flutter/web_sdk/libraries.json
    +FILE: ../../../flutter/web_sdk/make_combined_sdk.dart
     ----------------------------------------------------------------------------------------------------
     Copyright 2013 The Flutter Authors. All rights reserved.
     
    diff --git a/web_sdk/BUILD.gn b/web_sdk/BUILD.gn
    index 925f6000499b5..fde716de43e3f 100644
    --- a/web_sdk/BUILD.gn
    +++ b/web_sdk/BUILD.gn
    @@ -28,8 +28,7 @@ web_ui_sources = [
     
     group("web_sdk") {
       deps = [
    -    ":web_ui_sources",
    -    ":web_ui_library",
    +    ":generate_web_summary_sdk",
         ":flutter_dartdevc_kernel_sdk",
       ]
     }
    @@ -52,6 +51,30 @@ copy("web_ui_library") {
       ]
     }
     
    +prebuilt_dart_action("generate_web_summary_sdk") {
    +  script = "$flutter_root/web_sdk/make_combined_sdk.dart"
    +
    +  inputs = [
    +    "$flutter_root/web_sdk/make_combined_sdk.dart",
    +    "$flutter_root/web_sdk/libraries.dart",
    +  ]
    +
    +  packages = "//third_party/dart/.packages"
    +
    +  args = []
    +
    +  outputs = [
    +    "$root_out_dir/flutter_web_sdk/js/amd/sdk.js",
    +    "$root_out_dir/flutter_web_sdk/js/amd/dart_sdk.js.map",
    +    "$root_out_dir/flutter_web_sdk/lib/_internal/ddc_sdk.sum",
    +  ]
    +
    +  deps = [
    +    ":web_ui_sources",
    +    ":web_ui_library",
    +  ]
    +}
    +
     prebuilt_dart_action("flutter_dartdevc_kernel_sdk") {
       deps = [
         "//third_party/dart/pkg:pkg_files_stamp",
    diff --git a/web_sdk/flutter_kernel_sdk.dart b/web_sdk/flutter_kernel_sdk.dart
    index dea21c2de8ae5..96e181977b694 100644
    --- a/web_sdk/flutter_kernel_sdk.dart
    +++ b/web_sdk/flutter_kernel_sdk.dart
    @@ -6,11 +6,11 @@ import 'dart:async';
     import 'dart:convert' show json;
     import 'dart:io';
     import 'package:args/args.dart' show ArgParser;
    -import 'package:dev_compiler/src/compiler/module_builder.dart';
    -import 'package:dev_compiler/src/compiler/shared_command.dart' show SharedCompilerOptions;
    -import 'package:dev_compiler/src/kernel/target.dart';
    -import 'package:dev_compiler/src/kernel/command.dart';
    -import 'package:dev_compiler/src/kernel/compiler.dart';
    +import 'package:dev_compiler/src/compiler/module_builder.dart'; // ignore: uri_does_not_exist
    +import 'package:dev_compiler/src/compiler/shared_command.dart' show SharedCompilerOptions; // ignore: uri_does_not_exist
    +import 'package:dev_compiler/src/kernel/target.dart'; // ignore: uri_does_not_exist
    +import 'package:dev_compiler/src/kernel/command.dart'; // ignore: uri_does_not_exist
    +import 'package:dev_compiler/src/kernel/compiler.dart'; // ignore: uri_does_not_exist
     import 'package:front_end/src/api_unstable/ddc.dart' show CompilerOptions, kernelForComponent;
     import 'package:kernel/kernel.dart';
     import 'package:path/path.dart' as path;
    diff --git a/web_sdk/libraries.dart b/web_sdk/libraries.dart
    new file mode 100644
    index 0000000000000..318bedf092f57
    --- /dev/null
    +++ b/web_sdk/libraries.dart
    @@ -0,0 +1,313 @@
    +// Copyright 2013 The Flutter Authors. All rights reserved.
    +// Use of this source code is governed by a BSD-style license that can be
    +// found in the LICENSE file.
    +library libraries;
    +
    +// Branched from https://github.com/dart-lang/sdk/blob/master/pkg/dev_compiler/tool/input_sdk/libraries.dart
    +// with handling for dart:ui added.
    +
    +/**
    + * A bit flag used by [LibraryInfo] indicating that a library is used by dart2js
    + */
    +const int DART2JS_PLATFORM = 1;
    +
    +/**
    + * A bit flag used by [LibraryInfo] indicating that a library is used by the VM
    + */
    +const int VM_PLATFORM = 2;
    +
    +/// The contexts that a library can be used from.
    +enum Category {
    +  /// Indicates that a library can be used in a browser context.
    +  client,
    +
    +  /// Indicates that a library can be used in a command line context.
    +  server,
    +
    +  /// Indicates that a library can be used from embedded devices.
    +  embedded
    +}
    +
    +Category parseCategory(String name) {
    +  switch (name) {
    +    case "Client":
    +      return Category.client;
    +    case "Server":
    +      return Category.server;
    +    case "Embedded":
    +      return Category.embedded;
    +  }
    +  return null;
    +}
    +
    +/// Mapping of "dart:" library name (e.g. "core") to information about that
    +/// library.
    +const Map libraries = const {
    +  "async": const LibraryInfo("async/async.dart",
    +      categories: "Client,Server",
    +      maturity: Maturity.STABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/async_patch.dart"),
    +  "collection": const LibraryInfo("collection/collection.dart",
    +      categories: "Client,Server,Embedded",
    +      maturity: Maturity.STABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/collection_patch.dart"),
    +  "convert": const LibraryInfo("convert/convert.dart",
    +      categories: "Client,Server",
    +      maturity: Maturity.STABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/convert_patch.dart"),
    +  "core": const LibraryInfo("core/core.dart",
    +      categories: "Client,Server,Embedded",
    +      maturity: Maturity.STABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/core_patch.dart"),
    +  "developer": const LibraryInfo("developer/developer.dart",
    +      categories: "Client,Server,Embedded",
    +      maturity: Maturity.UNSTABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/developer_patch.dart"),
    +  "html": const LibraryInfo("html/dart2js/html_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.WEB_STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "html_common": const LibraryInfo("html/html_common/html_common.dart",
    +      categories: "Client",
    +      maturity: Maturity.WEB_STABLE,
    +      dart2jsPath: "html/html_common/html_common_dart2js.dart",
    +      documented: false,
    +      implementation: true),
    +  "indexed_db": const LibraryInfo("indexed_db/dart2js/indexed_db_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.WEB_STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "_http":
    +      const LibraryInfo("_http/http.dart", categories: "", documented: false),
    +  "io": const LibraryInfo("io/io.dart",
    +      categories: "Server",
    +      dart2jsPatchPath: "_internal/js_runtime/lib/io_patch.dart"),
    +  "isolate": const LibraryInfo("isolate/isolate.dart",
    +      categories: "Client,Server",
    +      maturity: Maturity.STABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/isolate_patch.dart"),
    +  "js": const LibraryInfo("js/dart2js/js_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "js_util": const LibraryInfo("js_util/dart2js/js_util_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "math": const LibraryInfo("math/math.dart",
    +      categories: "Client,Server,Embedded",
    +      maturity: Maturity.STABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/math_patch.dart"),
    +  "mirrors": const LibraryInfo("mirrors/mirrors.dart",
    +      categories: "Client,Server",
    +      maturity: Maturity.UNSTABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/mirrors_patch.dart"),
    +  "nativewrappers": const LibraryInfo("html/dartium/nativewrappers.dart",
    +      categories: "Client",
    +      implementation: true,
    +      documented: false,
    +      platforms: DART2JS_PLATFORM),
    +  "typed_data": const LibraryInfo("typed_data/typed_data.dart",
    +      categories: "Client,Server,Embedded",
    +      maturity: Maturity.STABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/typed_data_patch.dart"),
    +  "_native_typed_data": const LibraryInfo(
    +      "_internal/js_runtime/lib/native_typed_data.dart",
    +      categories: "",
    +      implementation: true,
    +      documented: false,
    +      platforms: DART2JS_PLATFORM),
    +  "cli": const LibraryInfo("cli/cli.dart",
    +      categories: "Server",
    +      dart2jsPatchPath: "_internal/js_runtime/lib/cli_patch.dart"),
    +  "svg": const LibraryInfo("svg/dart2js/svg_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.WEB_STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "web_audio": const LibraryInfo("web_audio/dart2js/web_audio_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.WEB_STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "web_gl": const LibraryInfo("web_gl/dart2js/web_gl_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.WEB_STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "web_sql": const LibraryInfo("web_sql/dart2js/web_sql_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.WEB_STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "_internal": const LibraryInfo("internal/internal.dart",
    +      categories: "",
    +      documented: false,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/internal_patch.dart"),
    +  "_js_helper": const LibraryInfo("_internal/js_runtime/lib/js_helper.dart",
    +      categories: "", documented: false, platforms: DART2JS_PLATFORM),
    +  "_interceptors": const LibraryInfo(
    +      "_internal/js_runtime/lib/interceptors.dart",
    +      categories: "",
    +      documented: false,
    +      platforms: DART2JS_PLATFORM),
    +  "_foreign_helper": const LibraryInfo(
    +      "_internal/js_runtime/lib/foreign_helper.dart",
    +      categories: "",
    +      documented: false,
    +      platforms: DART2JS_PLATFORM),
    +  "_isolate_helper": const LibraryInfo(
    +      "_internal/js_runtime/lib/isolate_helper.dart",
    +      categories: "",
    +      documented: false,
    +      platforms: DART2JS_PLATFORM),
    +  "_js_mirrors": const LibraryInfo("_internal/js_runtime/lib/js_mirrors.dart",
    +      categories: "", documented: false, platforms: DART2JS_PLATFORM),
    +  "_js_primitives": const LibraryInfo(
    +      "_internal/js_runtime/lib/js_primitives.dart",
    +      categories: "",
    +      documented: false,
    +      platforms: DART2JS_PLATFORM),
    +  "_metadata": const LibraryInfo("html/html_common/metadata.dart",
    +      categories: "", documented: false, platforms: DART2JS_PLATFORM),
    +  "_debugger": const LibraryInfo("_internal/js_runtime/lib/debugger.dart",
    +      category: "", documented: false, platforms: DART2JS_PLATFORM),
    +  "_runtime": const LibraryInfo(
    +      "_internal/js_runtime/lib/ddc_runtime/runtime.dart",
    +      category: "",
    +      documented: false,
    +      platforms: DART2JS_PLATFORM),
    +  "ui": const LibraryInfo("ui/ui.dart", documented: true, platforms:DART2JS_PLATFORM),
    +};
    +
    +/**
    + * Information about a "dart:" library.
    + */
    +class LibraryInfo {
    +  /**
    +   * Path to the library's *.dart file relative to this file.
    +   */
    +  final String path;
    +
    +  /**
    +   * The categories in which the library can be used encoded as a
    +   * comma-separated String.
    +   */
    +  final String _categories;
    +
    +  /**
    +   * Path to the dart2js library's *.dart file relative to this file
    +   * or null if dart2js uses the common library path defined above.
    +   * Access using the [#getDart2JsPath()] method.
    +   */
    +  final String dart2jsPath;
    +
    +  /**
    +   * Path to the dart2js library's patch file relative to this file
    +   * or null if no dart2js patch file associated with this library.
    +   * Access using the [#getDart2JsPatchPath()] method.
    +   */
    +  final String dart2jsPatchPath;
    +
    +  /**
    +   * True if this library is documented and should be shown to the user.
    +   */
    +  final bool documented;
    +
    +  /**
    +   * Bit flags indicating which platforms consume this library.
    +   * See [DART2JS_LIBRARY] and [VM_LIBRARY].
    +   */
    +  final int platforms;
    +
    +  /**
    +   * True if the library contains implementation details for another library.
    +   * The implication is that these libraries are less commonly used
    +   * and that tools like Dart Editor should not show these libraries
    +   * in a list of all libraries unless the user specifically asks the tool to
    +   * do so.
    +   */
    +  final bool implementation;
    +
    +  /**
    +   * States the current maturity of this library.
    +   */
    +  final Maturity maturity;
    +
    +  const LibraryInfo(this.path,
    +      {String categories: "",
    +      this.dart2jsPath,
    +      this.dart2jsPatchPath,
    +      this.implementation: false,
    +      this.documented: true,
    +      this.maturity: Maturity.UNSPECIFIED,
    +      this.platforms: DART2JS_PLATFORM | VM_PLATFORM})
    +      : _categories = categories;
    +
    +  bool get isDart2jsLibrary => (platforms & DART2JS_PLATFORM) != 0;
    +  bool get isVmLibrary => (platforms & VM_PLATFORM) != 0;
    +
    +  /**
    +   * The categories in which the library can be used.
    +   *
    +   * If no categories are specified, the library is internal and can not be
    +   * loaded by user code.
    +   */
    +  List get categories {
    +    // `"".split(,)` returns [""] not [], so we handle that case separately.
    +    if (_categories == "") return const [];
    +    return _categories.split(",").map(parseCategory).toList();
    +  }
    +
    +  bool get isInternal => categories.isEmpty;
    +
    +  /// The original "categories" String that was passed to the constructor.
    +  ///
    +  /// Can be used to construct a slightly modified copy of this LibraryInfo.
    +  String get categoriesString {
    +    return _categories;
    +  }
    +}
    +
    +/**
    + * Abstraction to capture the maturity of a library.
    + */
    +class Maturity {
    +  final int level;
    +  final String name;
    +  final String description;
    +
    +  const Maturity(this.level, this.name, this.description);
    +
    +  String toString() => "$name: $level\n$description\n";
    +
    +  static const Maturity DEPRECATED = const Maturity(0, "Deprecated",
    +      "This library will be remove before next major release.");
    +
    +  static const Maturity EXPERIMENTAL = const Maturity(
    +      1,
    +      "Experimental",
    +      "This library is experimental and will likely change or be removed\n"
    +      "in future versions.");
    +
    +  static const Maturity UNSTABLE = const Maturity(
    +      2,
    +      "Unstable",
    +      "This library is in still changing and have not yet endured\n"
    +      "sufficient real-world testing.\n"
    +      "Backwards-compatibility is NOT guaranteed.");
    +
    +  static const Maturity WEB_STABLE = const Maturity(
    +      3,
    +      "Web Stable",
    +      "This library is tracking the DOM evolution as defined by WC3.\n"
    +      "Backwards-compatibility is NOT guaranteed.");
    +
    +  static const Maturity STABLE = const Maturity(
    +      4,
    +      "Stable",
    +      "The library is stable. API backwards-compatibility is guaranteed.\n"
    +      "However implementation details might change.");
    +
    +  static const Maturity LOCKED = const Maturity(5, "Locked",
    +      "This library will not change except when serious bugs are encountered.");
    +
    +  static const Maturity UNSPECIFIED = const Maturity(-1, "Unspecified",
    +      "The maturity for this library has not been specified.");
    +}
    diff --git a/web_sdk/make_combined_sdk.dart b/web_sdk/make_combined_sdk.dart
    new file mode 100755
    index 0000000000000..435fb22174424
    --- /dev/null
    +++ b/web_sdk/make_combined_sdk.dart
    @@ -0,0 +1,120 @@
    +// Copyright 2013 The Flutter 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 'dart:io';
    +
    +import 'package:path/path.dart' as path;
    +import 'package:dev_compiler/src/analyzer/command.dart' as command; // ignore: uri_does_not_exist
    +
    +// Creates flutter precompiled web sdk and analyzer summary.
    +Future main() async {
    +  // create a temporary dart-sdk directory.
    +  final Directory tempDartSdk = Directory(path.join('temp_dart_sdk', 'lib'))
    +    ..createSync(recursive: true);
    +  final Directory patchedDartSdk = Directory(path.join(
    +      'gen', 'third_party', 'dart', 'utils', 'dartdevc', 'patched_sdk', 'lib'));
    +  final Directory flutterWebUi = Directory(path.join(
    +    'flutter_web_sdk',
    +    'lib',
    +    'ui',
    +  ));
    +
    +  // Copy this patched dart sdk into the temporary directory.
    +  for (FileSystemEntity entity in patchedDartSdk.listSync(recursive: true)) {
    +    if (entity is File) {
    +      final String targetPath = path.join(tempDartSdk.path,
    +          path.relative(entity.path, from: patchedDartSdk.path));
    +      File(targetPath).createSync(recursive: true);
    +      entity.copySync(path.join(tempDartSdk.path,
    +          path.relative(entity.path, from: patchedDartSdk.path)));
    +    }
    +  }
    +  // Copy the dart:ui sources into the temporary directory.
    +  for (FileSystemEntity entity in flutterWebUi.listSync(recursive: true)) {
    +    if (entity is File) {
    +      final String targetPath = path.join(tempDartSdk.path, 'ui',
    +          path.relative(entity.path, from: flutterWebUi.path));
    +      File(targetPath).createSync(recursive: true);
    +      entity.copySync(targetPath);
    +    }
    +  }
    +  // Copy the libraries.dart file into the temporary directory.
    +  final File libraries = File(path.join('..', '..', 'flutter', 'web_sdk', 'libraries.dart'));
    +  libraries.copySync(path.join(tempDartSdk.path, '_internal', 'libraries.dart'));
    +  libraries.copySync(path.join(tempDartSdk.path, '_internal', 'sdk_library_metadata', 'lib', 'libraries.dart'));
    +
    +  // Prevent regular compilation from leaking into flutter
    +  final File ddcSummary =
    +      File(path.join(tempDartSdk.path, '_internal', 'ddc_sdk.sum'));
    +  final File jsSdk =
    +      File(path.join(tempDartSdk.parent.path, 'js', 'amd', 'dart_sdk.js'));
    +  final File jsSdkMap =
    +      File(path.join(tempDartSdk.parent.path, 'js', 'amd', 'dart_sdk.js.map'));
    +  if (ddcSummary.existsSync()) {
    +    ddcSummary.deleteSync();
    +  }
    +  if (jsSdk.existsSync()) {
    +    jsSdk.deleteSync();
    +  }
    +  if (jsSdkMap.existsSync()) {
    +    jsSdkMap.deleteSync();
    +  }
    +
    +  // Execute the analyzer summary and sdk generation.
    +  final List args = ['--no-source-map', '--no-emit-metadata'];
    +  args.addAll([
    +    '--dart-sdk=temp_dart_sdk',
    +    '--dart-sdk-summary=build',
    +    '--summary-out=temp_dart_sdk/lib/_internal/ddc_sdk.sum',
    +    '--source-map',
    +    '--source-map-comment',
    +    '--modules=amd',
    +    '-o',
    +    'temp_dart_sdk/js/amd/dart_sdk.js'
    +  ]);
    +  args.addAll([
    +    'dart:_runtime',
    +    'dart:_debugger',
    +    'dart:_foreign_helper',
    +    'dart:_interceptors',
    +    'dart:_internal',
    +    'dart:_isolate_helper',
    +    'dart:_js_helper',
    +    'dart:_js_mirrors',
    +    'dart:_js_primitives',
    +    'dart:_metadata',
    +    'dart:_native_typed_data',
    +    'dart:async',
    +    'dart:collection',
    +    'dart:convert',
    +    'dart:core',
    +    'dart:developer',
    +    'dart:io',
    +    'dart:isolate',
    +    'dart:js',
    +    'dart:js_util',
    +    'dart:math',
    +    'dart:mirrors',
    +    'dart:typed_data',
    +    'dart:indexed_db',
    +    'dart:html',
    +    'dart:html_common',
    +    'dart:svg',
    +    'dart:web_audio',
    +    'dart:web_gl',
    +    'dart:web_sql',
    +    'dart:ui',
    +  ]);
    +  final int result = (await command.compile(args)).exitCode;
    +  if (result != 0) {
    +    throw 'SDK generation failed with exit code $result';
    +  }
    +
    +  // Copy generated sdk and summary back to flutter web sdk.
    +  ddcSummary.copySync(
    +      path.join('flutter_web_sdk', 'lib', '_internal', 'ddc_sdk.sum'));
    +  jsSdk.copySync(path.join('flutter_web_sdk', 'js', 'amd', 'dart_sdk.js'));
    +  jsSdkMap
    +      .copySync(path.join('flutter_web_sdk', 'js', 'amd', 'dart_sdk.js.map'));
    +}
    diff --git a/web_sdk/make_combined_sdk.sh b/web_sdk/make_combined_sdk.sh
    deleted file mode 100755
    index 06b673baba8a2..0000000000000
    --- a/web_sdk/make_combined_sdk.sh
    +++ /dev/null
    @@ -1,16 +0,0 @@
    -#!/bin/bash
    -
    -# Reference script for creating patched sdk locally.
    -# Copy normal dart sources into flutter_patched sdk
    -mkdir -p out/host_debug_unopt/flutter_patched_sdk/lib
    -cp -RL out/host_debug_unopt/dart-sdk/lib/ out/host_debug_unopt/flutter_patched_sdk/lib
    -
    -# Copy stub ui dart sources into flutter_patched sdk
    -mkdir -p out/host_debug_unopt/flutter_patched_sdk/lib/ui
    -cp -RL flutter/lib/stub_ui/ out/host_debug_unopt/flutter_patched_sdk/lib/ui
    -
    -# Copy libraries.json into flutter patched sdk.
    -cp -RL flutter/flutter_web/libraries.json out/host_debug_unopt/flutter_patched_sdk/lib/libraries.json
    -
    -# Copy libraries.dart into flutter patched sdk
    -cp -RL flutter/flutter_web/libraries.dart out/host_debug_unopt/flutter_patched_sdk/lib/_internal/libraries.dart
    
    From 579eba5bb12a4a4a4f24e38f9bf94daa9d0064fc Mon Sep 17 00:00:00 2001
    From: Jonah Williams 
    Date: Thu, 28 Mar 2019 10:40:51 -0700
    Subject: [PATCH 0608/1117] Revert "Build precompiled sdk and analyzer summary
     for dartdevc (#8345)" (#8353)
    
    ---
     ci/licenses_golden/licenses_flutter |   2 -
     web_sdk/BUILD.gn                    |  27 +--
     web_sdk/flutter_kernel_sdk.dart     |  10 +-
     web_sdk/libraries.dart              | 313 ----------------------------
     web_sdk/make_combined_sdk.dart      | 120 -----------
     web_sdk/make_combined_sdk.sh        |  16 ++
     6 files changed, 23 insertions(+), 465 deletions(-)
     delete mode 100644 web_sdk/libraries.dart
     delete mode 100755 web_sdk/make_combined_sdk.dart
     create mode 100755 web_sdk/make_combined_sdk.sh
    
    diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter
    index 42b501b39285b..f5259b505f734 100644
    --- a/ci/licenses_golden/licenses_flutter
    +++ b/ci/licenses_golden/licenses_flutter
    @@ -748,9 +748,7 @@ FILE: ../../../flutter/vulkan/vulkan_utilities.h
     FILE: ../../../flutter/vulkan/vulkan_window.cc
     FILE: ../../../flutter/vulkan/vulkan_window.h
     FILE: ../../../flutter/web_sdk/flutter_kernel_sdk.dart
    -FILE: ../../../flutter/web_sdk/libraries.dart
     FILE: ../../../flutter/web_sdk/libraries.json
    -FILE: ../../../flutter/web_sdk/make_combined_sdk.dart
     ----------------------------------------------------------------------------------------------------
     Copyright 2013 The Flutter Authors. All rights reserved.
     
    diff --git a/web_sdk/BUILD.gn b/web_sdk/BUILD.gn
    index fde716de43e3f..925f6000499b5 100644
    --- a/web_sdk/BUILD.gn
    +++ b/web_sdk/BUILD.gn
    @@ -28,7 +28,8 @@ web_ui_sources = [
     
     group("web_sdk") {
       deps = [
    -    ":generate_web_summary_sdk",
    +    ":web_ui_sources",
    +    ":web_ui_library",
         ":flutter_dartdevc_kernel_sdk",
       ]
     }
    @@ -51,30 +52,6 @@ copy("web_ui_library") {
       ]
     }
     
    -prebuilt_dart_action("generate_web_summary_sdk") {
    -  script = "$flutter_root/web_sdk/make_combined_sdk.dart"
    -
    -  inputs = [
    -    "$flutter_root/web_sdk/make_combined_sdk.dart",
    -    "$flutter_root/web_sdk/libraries.dart",
    -  ]
    -
    -  packages = "//third_party/dart/.packages"
    -
    -  args = []
    -
    -  outputs = [
    -    "$root_out_dir/flutter_web_sdk/js/amd/sdk.js",
    -    "$root_out_dir/flutter_web_sdk/js/amd/dart_sdk.js.map",
    -    "$root_out_dir/flutter_web_sdk/lib/_internal/ddc_sdk.sum",
    -  ]
    -
    -  deps = [
    -    ":web_ui_sources",
    -    ":web_ui_library",
    -  ]
    -}
    -
     prebuilt_dart_action("flutter_dartdevc_kernel_sdk") {
       deps = [
         "//third_party/dart/pkg:pkg_files_stamp",
    diff --git a/web_sdk/flutter_kernel_sdk.dart b/web_sdk/flutter_kernel_sdk.dart
    index 96e181977b694..dea21c2de8ae5 100644
    --- a/web_sdk/flutter_kernel_sdk.dart
    +++ b/web_sdk/flutter_kernel_sdk.dart
    @@ -6,11 +6,11 @@ import 'dart:async';
     import 'dart:convert' show json;
     import 'dart:io';
     import 'package:args/args.dart' show ArgParser;
    -import 'package:dev_compiler/src/compiler/module_builder.dart'; // ignore: uri_does_not_exist
    -import 'package:dev_compiler/src/compiler/shared_command.dart' show SharedCompilerOptions; // ignore: uri_does_not_exist
    -import 'package:dev_compiler/src/kernel/target.dart'; // ignore: uri_does_not_exist
    -import 'package:dev_compiler/src/kernel/command.dart'; // ignore: uri_does_not_exist
    -import 'package:dev_compiler/src/kernel/compiler.dart'; // ignore: uri_does_not_exist
    +import 'package:dev_compiler/src/compiler/module_builder.dart';
    +import 'package:dev_compiler/src/compiler/shared_command.dart' show SharedCompilerOptions;
    +import 'package:dev_compiler/src/kernel/target.dart';
    +import 'package:dev_compiler/src/kernel/command.dart';
    +import 'package:dev_compiler/src/kernel/compiler.dart';
     import 'package:front_end/src/api_unstable/ddc.dart' show CompilerOptions, kernelForComponent;
     import 'package:kernel/kernel.dart';
     import 'package:path/path.dart' as path;
    diff --git a/web_sdk/libraries.dart b/web_sdk/libraries.dart
    deleted file mode 100644
    index 318bedf092f57..0000000000000
    --- a/web_sdk/libraries.dart
    +++ /dev/null
    @@ -1,313 +0,0 @@
    -// Copyright 2013 The Flutter Authors. All rights reserved.
    -// Use of this source code is governed by a BSD-style license that can be
    -// found in the LICENSE file.
    -library libraries;
    -
    -// Branched from https://github.com/dart-lang/sdk/blob/master/pkg/dev_compiler/tool/input_sdk/libraries.dart
    -// with handling for dart:ui added.
    -
    -/**
    - * A bit flag used by [LibraryInfo] indicating that a library is used by dart2js
    - */
    -const int DART2JS_PLATFORM = 1;
    -
    -/**
    - * A bit flag used by [LibraryInfo] indicating that a library is used by the VM
    - */
    -const int VM_PLATFORM = 2;
    -
    -/// The contexts that a library can be used from.
    -enum Category {
    -  /// Indicates that a library can be used in a browser context.
    -  client,
    -
    -  /// Indicates that a library can be used in a command line context.
    -  server,
    -
    -  /// Indicates that a library can be used from embedded devices.
    -  embedded
    -}
    -
    -Category parseCategory(String name) {
    -  switch (name) {
    -    case "Client":
    -      return Category.client;
    -    case "Server":
    -      return Category.server;
    -    case "Embedded":
    -      return Category.embedded;
    -  }
    -  return null;
    -}
    -
    -/// Mapping of "dart:" library name (e.g. "core") to information about that
    -/// library.
    -const Map libraries = const {
    -  "async": const LibraryInfo("async/async.dart",
    -      categories: "Client,Server",
    -      maturity: Maturity.STABLE,
    -      dart2jsPatchPath: "_internal/js_runtime/lib/async_patch.dart"),
    -  "collection": const LibraryInfo("collection/collection.dart",
    -      categories: "Client,Server,Embedded",
    -      maturity: Maturity.STABLE,
    -      dart2jsPatchPath: "_internal/js_runtime/lib/collection_patch.dart"),
    -  "convert": const LibraryInfo("convert/convert.dart",
    -      categories: "Client,Server",
    -      maturity: Maturity.STABLE,
    -      dart2jsPatchPath: "_internal/js_runtime/lib/convert_patch.dart"),
    -  "core": const LibraryInfo("core/core.dart",
    -      categories: "Client,Server,Embedded",
    -      maturity: Maturity.STABLE,
    -      dart2jsPatchPath: "_internal/js_runtime/lib/core_patch.dart"),
    -  "developer": const LibraryInfo("developer/developer.dart",
    -      categories: "Client,Server,Embedded",
    -      maturity: Maturity.UNSTABLE,
    -      dart2jsPatchPath: "_internal/js_runtime/lib/developer_patch.dart"),
    -  "html": const LibraryInfo("html/dart2js/html_dart2js.dart",
    -      categories: "Client",
    -      maturity: Maturity.WEB_STABLE,
    -      platforms: DART2JS_PLATFORM),
    -  "html_common": const LibraryInfo("html/html_common/html_common.dart",
    -      categories: "Client",
    -      maturity: Maturity.WEB_STABLE,
    -      dart2jsPath: "html/html_common/html_common_dart2js.dart",
    -      documented: false,
    -      implementation: true),
    -  "indexed_db": const LibraryInfo("indexed_db/dart2js/indexed_db_dart2js.dart",
    -      categories: "Client",
    -      maturity: Maturity.WEB_STABLE,
    -      platforms: DART2JS_PLATFORM),
    -  "_http":
    -      const LibraryInfo("_http/http.dart", categories: "", documented: false),
    -  "io": const LibraryInfo("io/io.dart",
    -      categories: "Server",
    -      dart2jsPatchPath: "_internal/js_runtime/lib/io_patch.dart"),
    -  "isolate": const LibraryInfo("isolate/isolate.dart",
    -      categories: "Client,Server",
    -      maturity: Maturity.STABLE,
    -      dart2jsPatchPath: "_internal/js_runtime/lib/isolate_patch.dart"),
    -  "js": const LibraryInfo("js/dart2js/js_dart2js.dart",
    -      categories: "Client",
    -      maturity: Maturity.STABLE,
    -      platforms: DART2JS_PLATFORM),
    -  "js_util": const LibraryInfo("js_util/dart2js/js_util_dart2js.dart",
    -      categories: "Client",
    -      maturity: Maturity.STABLE,
    -      platforms: DART2JS_PLATFORM),
    -  "math": const LibraryInfo("math/math.dart",
    -      categories: "Client,Server,Embedded",
    -      maturity: Maturity.STABLE,
    -      dart2jsPatchPath: "_internal/js_runtime/lib/math_patch.dart"),
    -  "mirrors": const LibraryInfo("mirrors/mirrors.dart",
    -      categories: "Client,Server",
    -      maturity: Maturity.UNSTABLE,
    -      dart2jsPatchPath: "_internal/js_runtime/lib/mirrors_patch.dart"),
    -  "nativewrappers": const LibraryInfo("html/dartium/nativewrappers.dart",
    -      categories: "Client",
    -      implementation: true,
    -      documented: false,
    -      platforms: DART2JS_PLATFORM),
    -  "typed_data": const LibraryInfo("typed_data/typed_data.dart",
    -      categories: "Client,Server,Embedded",
    -      maturity: Maturity.STABLE,
    -      dart2jsPatchPath: "_internal/js_runtime/lib/typed_data_patch.dart"),
    -  "_native_typed_data": const LibraryInfo(
    -      "_internal/js_runtime/lib/native_typed_data.dart",
    -      categories: "",
    -      implementation: true,
    -      documented: false,
    -      platforms: DART2JS_PLATFORM),
    -  "cli": const LibraryInfo("cli/cli.dart",
    -      categories: "Server",
    -      dart2jsPatchPath: "_internal/js_runtime/lib/cli_patch.dart"),
    -  "svg": const LibraryInfo("svg/dart2js/svg_dart2js.dart",
    -      categories: "Client",
    -      maturity: Maturity.WEB_STABLE,
    -      platforms: DART2JS_PLATFORM),
    -  "web_audio": const LibraryInfo("web_audio/dart2js/web_audio_dart2js.dart",
    -      categories: "Client",
    -      maturity: Maturity.WEB_STABLE,
    -      platforms: DART2JS_PLATFORM),
    -  "web_gl": const LibraryInfo("web_gl/dart2js/web_gl_dart2js.dart",
    -      categories: "Client",
    -      maturity: Maturity.WEB_STABLE,
    -      platforms: DART2JS_PLATFORM),
    -  "web_sql": const LibraryInfo("web_sql/dart2js/web_sql_dart2js.dart",
    -      categories: "Client",
    -      maturity: Maturity.WEB_STABLE,
    -      platforms: DART2JS_PLATFORM),
    -  "_internal": const LibraryInfo("internal/internal.dart",
    -      categories: "",
    -      documented: false,
    -      dart2jsPatchPath: "_internal/js_runtime/lib/internal_patch.dart"),
    -  "_js_helper": const LibraryInfo("_internal/js_runtime/lib/js_helper.dart",
    -      categories: "", documented: false, platforms: DART2JS_PLATFORM),
    -  "_interceptors": const LibraryInfo(
    -      "_internal/js_runtime/lib/interceptors.dart",
    -      categories: "",
    -      documented: false,
    -      platforms: DART2JS_PLATFORM),
    -  "_foreign_helper": const LibraryInfo(
    -      "_internal/js_runtime/lib/foreign_helper.dart",
    -      categories: "",
    -      documented: false,
    -      platforms: DART2JS_PLATFORM),
    -  "_isolate_helper": const LibraryInfo(
    -      "_internal/js_runtime/lib/isolate_helper.dart",
    -      categories: "",
    -      documented: false,
    -      platforms: DART2JS_PLATFORM),
    -  "_js_mirrors": const LibraryInfo("_internal/js_runtime/lib/js_mirrors.dart",
    -      categories: "", documented: false, platforms: DART2JS_PLATFORM),
    -  "_js_primitives": const LibraryInfo(
    -      "_internal/js_runtime/lib/js_primitives.dart",
    -      categories: "",
    -      documented: false,
    -      platforms: DART2JS_PLATFORM),
    -  "_metadata": const LibraryInfo("html/html_common/metadata.dart",
    -      categories: "", documented: false, platforms: DART2JS_PLATFORM),
    -  "_debugger": const LibraryInfo("_internal/js_runtime/lib/debugger.dart",
    -      category: "", documented: false, platforms: DART2JS_PLATFORM),
    -  "_runtime": const LibraryInfo(
    -      "_internal/js_runtime/lib/ddc_runtime/runtime.dart",
    -      category: "",
    -      documented: false,
    -      platforms: DART2JS_PLATFORM),
    -  "ui": const LibraryInfo("ui/ui.dart", documented: true, platforms:DART2JS_PLATFORM),
    -};
    -
    -/**
    - * Information about a "dart:" library.
    - */
    -class LibraryInfo {
    -  /**
    -   * Path to the library's *.dart file relative to this file.
    -   */
    -  final String path;
    -
    -  /**
    -   * The categories in which the library can be used encoded as a
    -   * comma-separated String.
    -   */
    -  final String _categories;
    -
    -  /**
    -   * Path to the dart2js library's *.dart file relative to this file
    -   * or null if dart2js uses the common library path defined above.
    -   * Access using the [#getDart2JsPath()] method.
    -   */
    -  final String dart2jsPath;
    -
    -  /**
    -   * Path to the dart2js library's patch file relative to this file
    -   * or null if no dart2js patch file associated with this library.
    -   * Access using the [#getDart2JsPatchPath()] method.
    -   */
    -  final String dart2jsPatchPath;
    -
    -  /**
    -   * True if this library is documented and should be shown to the user.
    -   */
    -  final bool documented;
    -
    -  /**
    -   * Bit flags indicating which platforms consume this library.
    -   * See [DART2JS_LIBRARY] and [VM_LIBRARY].
    -   */
    -  final int platforms;
    -
    -  /**
    -   * True if the library contains implementation details for another library.
    -   * The implication is that these libraries are less commonly used
    -   * and that tools like Dart Editor should not show these libraries
    -   * in a list of all libraries unless the user specifically asks the tool to
    -   * do so.
    -   */
    -  final bool implementation;
    -
    -  /**
    -   * States the current maturity of this library.
    -   */
    -  final Maturity maturity;
    -
    -  const LibraryInfo(this.path,
    -      {String categories: "",
    -      this.dart2jsPath,
    -      this.dart2jsPatchPath,
    -      this.implementation: false,
    -      this.documented: true,
    -      this.maturity: Maturity.UNSPECIFIED,
    -      this.platforms: DART2JS_PLATFORM | VM_PLATFORM})
    -      : _categories = categories;
    -
    -  bool get isDart2jsLibrary => (platforms & DART2JS_PLATFORM) != 0;
    -  bool get isVmLibrary => (platforms & VM_PLATFORM) != 0;
    -
    -  /**
    -   * The categories in which the library can be used.
    -   *
    -   * If no categories are specified, the library is internal and can not be
    -   * loaded by user code.
    -   */
    -  List get categories {
    -    // `"".split(,)` returns [""] not [], so we handle that case separately.
    -    if (_categories == "") return const [];
    -    return _categories.split(",").map(parseCategory).toList();
    -  }
    -
    -  bool get isInternal => categories.isEmpty;
    -
    -  /// The original "categories" String that was passed to the constructor.
    -  ///
    -  /// Can be used to construct a slightly modified copy of this LibraryInfo.
    -  String get categoriesString {
    -    return _categories;
    -  }
    -}
    -
    -/**
    - * Abstraction to capture the maturity of a library.
    - */
    -class Maturity {
    -  final int level;
    -  final String name;
    -  final String description;
    -
    -  const Maturity(this.level, this.name, this.description);
    -
    -  String toString() => "$name: $level\n$description\n";
    -
    -  static const Maturity DEPRECATED = const Maturity(0, "Deprecated",
    -      "This library will be remove before next major release.");
    -
    -  static const Maturity EXPERIMENTAL = const Maturity(
    -      1,
    -      "Experimental",
    -      "This library is experimental and will likely change or be removed\n"
    -      "in future versions.");
    -
    -  static const Maturity UNSTABLE = const Maturity(
    -      2,
    -      "Unstable",
    -      "This library is in still changing and have not yet endured\n"
    -      "sufficient real-world testing.\n"
    -      "Backwards-compatibility is NOT guaranteed.");
    -
    -  static const Maturity WEB_STABLE = const Maturity(
    -      3,
    -      "Web Stable",
    -      "This library is tracking the DOM evolution as defined by WC3.\n"
    -      "Backwards-compatibility is NOT guaranteed.");
    -
    -  static const Maturity STABLE = const Maturity(
    -      4,
    -      "Stable",
    -      "The library is stable. API backwards-compatibility is guaranteed.\n"
    -      "However implementation details might change.");
    -
    -  static const Maturity LOCKED = const Maturity(5, "Locked",
    -      "This library will not change except when serious bugs are encountered.");
    -
    -  static const Maturity UNSPECIFIED = const Maturity(-1, "Unspecified",
    -      "The maturity for this library has not been specified.");
    -}
    diff --git a/web_sdk/make_combined_sdk.dart b/web_sdk/make_combined_sdk.dart
    deleted file mode 100755
    index 435fb22174424..0000000000000
    --- a/web_sdk/make_combined_sdk.dart
    +++ /dev/null
    @@ -1,120 +0,0 @@
    -// Copyright 2013 The Flutter 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 'dart:io';
    -
    -import 'package:path/path.dart' as path;
    -import 'package:dev_compiler/src/analyzer/command.dart' as command; // ignore: uri_does_not_exist
    -
    -// Creates flutter precompiled web sdk and analyzer summary.
    -Future main() async {
    -  // create a temporary dart-sdk directory.
    -  final Directory tempDartSdk = Directory(path.join('temp_dart_sdk', 'lib'))
    -    ..createSync(recursive: true);
    -  final Directory patchedDartSdk = Directory(path.join(
    -      'gen', 'third_party', 'dart', 'utils', 'dartdevc', 'patched_sdk', 'lib'));
    -  final Directory flutterWebUi = Directory(path.join(
    -    'flutter_web_sdk',
    -    'lib',
    -    'ui',
    -  ));
    -
    -  // Copy this patched dart sdk into the temporary directory.
    -  for (FileSystemEntity entity in patchedDartSdk.listSync(recursive: true)) {
    -    if (entity is File) {
    -      final String targetPath = path.join(tempDartSdk.path,
    -          path.relative(entity.path, from: patchedDartSdk.path));
    -      File(targetPath).createSync(recursive: true);
    -      entity.copySync(path.join(tempDartSdk.path,
    -          path.relative(entity.path, from: patchedDartSdk.path)));
    -    }
    -  }
    -  // Copy the dart:ui sources into the temporary directory.
    -  for (FileSystemEntity entity in flutterWebUi.listSync(recursive: true)) {
    -    if (entity is File) {
    -      final String targetPath = path.join(tempDartSdk.path, 'ui',
    -          path.relative(entity.path, from: flutterWebUi.path));
    -      File(targetPath).createSync(recursive: true);
    -      entity.copySync(targetPath);
    -    }
    -  }
    -  // Copy the libraries.dart file into the temporary directory.
    -  final File libraries = File(path.join('..', '..', 'flutter', 'web_sdk', 'libraries.dart'));
    -  libraries.copySync(path.join(tempDartSdk.path, '_internal', 'libraries.dart'));
    -  libraries.copySync(path.join(tempDartSdk.path, '_internal', 'sdk_library_metadata', 'lib', 'libraries.dart'));
    -
    -  // Prevent regular compilation from leaking into flutter
    -  final File ddcSummary =
    -      File(path.join(tempDartSdk.path, '_internal', 'ddc_sdk.sum'));
    -  final File jsSdk =
    -      File(path.join(tempDartSdk.parent.path, 'js', 'amd', 'dart_sdk.js'));
    -  final File jsSdkMap =
    -      File(path.join(tempDartSdk.parent.path, 'js', 'amd', 'dart_sdk.js.map'));
    -  if (ddcSummary.existsSync()) {
    -    ddcSummary.deleteSync();
    -  }
    -  if (jsSdk.existsSync()) {
    -    jsSdk.deleteSync();
    -  }
    -  if (jsSdkMap.existsSync()) {
    -    jsSdkMap.deleteSync();
    -  }
    -
    -  // Execute the analyzer summary and sdk generation.
    -  final List args = ['--no-source-map', '--no-emit-metadata'];
    -  args.addAll([
    -    '--dart-sdk=temp_dart_sdk',
    -    '--dart-sdk-summary=build',
    -    '--summary-out=temp_dart_sdk/lib/_internal/ddc_sdk.sum',
    -    '--source-map',
    -    '--source-map-comment',
    -    '--modules=amd',
    -    '-o',
    -    'temp_dart_sdk/js/amd/dart_sdk.js'
    -  ]);
    -  args.addAll([
    -    'dart:_runtime',
    -    'dart:_debugger',
    -    'dart:_foreign_helper',
    -    'dart:_interceptors',
    -    'dart:_internal',
    -    'dart:_isolate_helper',
    -    'dart:_js_helper',
    -    'dart:_js_mirrors',
    -    'dart:_js_primitives',
    -    'dart:_metadata',
    -    'dart:_native_typed_data',
    -    'dart:async',
    -    'dart:collection',
    -    'dart:convert',
    -    'dart:core',
    -    'dart:developer',
    -    'dart:io',
    -    'dart:isolate',
    -    'dart:js',
    -    'dart:js_util',
    -    'dart:math',
    -    'dart:mirrors',
    -    'dart:typed_data',
    -    'dart:indexed_db',
    -    'dart:html',
    -    'dart:html_common',
    -    'dart:svg',
    -    'dart:web_audio',
    -    'dart:web_gl',
    -    'dart:web_sql',
    -    'dart:ui',
    -  ]);
    -  final int result = (await command.compile(args)).exitCode;
    -  if (result != 0) {
    -    throw 'SDK generation failed with exit code $result';
    -  }
    -
    -  // Copy generated sdk and summary back to flutter web sdk.
    -  ddcSummary.copySync(
    -      path.join('flutter_web_sdk', 'lib', '_internal', 'ddc_sdk.sum'));
    -  jsSdk.copySync(path.join('flutter_web_sdk', 'js', 'amd', 'dart_sdk.js'));
    -  jsSdkMap
    -      .copySync(path.join('flutter_web_sdk', 'js', 'amd', 'dart_sdk.js.map'));
    -}
    diff --git a/web_sdk/make_combined_sdk.sh b/web_sdk/make_combined_sdk.sh
    new file mode 100755
    index 0000000000000..06b673baba8a2
    --- /dev/null
    +++ b/web_sdk/make_combined_sdk.sh
    @@ -0,0 +1,16 @@
    +#!/bin/bash
    +
    +# Reference script for creating patched sdk locally.
    +# Copy normal dart sources into flutter_patched sdk
    +mkdir -p out/host_debug_unopt/flutter_patched_sdk/lib
    +cp -RL out/host_debug_unopt/dart-sdk/lib/ out/host_debug_unopt/flutter_patched_sdk/lib
    +
    +# Copy stub ui dart sources into flutter_patched sdk
    +mkdir -p out/host_debug_unopt/flutter_patched_sdk/lib/ui
    +cp -RL flutter/lib/stub_ui/ out/host_debug_unopt/flutter_patched_sdk/lib/ui
    +
    +# Copy libraries.json into flutter patched sdk.
    +cp -RL flutter/flutter_web/libraries.json out/host_debug_unopt/flutter_patched_sdk/lib/libraries.json
    +
    +# Copy libraries.dart into flutter patched sdk
    +cp -RL flutter/flutter_web/libraries.dart out/host_debug_unopt/flutter_patched_sdk/lib/_internal/libraries.dart
    
    From 975fe8776c6cc8651331ab3d1af098eecc38f5ab Mon Sep 17 00:00:00 2001
    From: Chinmay Garde 
    Date: Thu, 28 Mar 2019 11:21:25 -0700
    Subject: [PATCH 0609/1117] Reset min log levels on each engine launch. (#8343)
    
    ---
     shell/common/shell.cc                              | 14 +++++++-------
     .../platform/embedder/tests/embedder_unittests.cc  |  1 -
     2 files changed, 7 insertions(+), 8 deletions(-)
    
    diff --git a/shell/common/shell.cc b/shell/common/shell.cc
    index 6ba709e879f19..4d2dcc0d137a6 100644
    --- a/shell/common/shell.cc
    +++ b/shell/common/shell.cc
    @@ -163,17 +163,17 @@ static void RecordStartupTimestamp() {
     // that cause shell initialization failures will still lead to some of their
     // settings being applied.
     static void PerformInitializationTasks(const blink::Settings& settings) {
    +  {
    +    fml::LogSettings log_settings;
    +    log_settings.min_log_level =
    +        settings.verbose_logging ? fml::LOG_INFO : fml::LOG_ERROR;
    +    fml::SetLogSettings(log_settings);
    +  }
    +
       static std::once_flag gShellSettingsInitialization = {};
       std::call_once(gShellSettingsInitialization, [&settings] {
         RecordStartupTimestamp();
     
    -    {
    -      fml::LogSettings log_settings;
    -      log_settings.min_log_level =
    -          settings.verbose_logging ? fml::LOG_INFO : fml::LOG_ERROR;
    -      fml::SetLogSettings(log_settings);
    -    }
    -
         tonic::SetLogHandler(
             [](const char* message) { FML_LOG(ERROR) << message; });
     
    diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc
    index 357a4e71114ab..25f4ed95a9c8d 100644
    --- a/shell/platform/embedder/tests/embedder_unittests.cc
    +++ b/shell/platform/embedder/tests/embedder_unittests.cc
    @@ -173,7 +173,6 @@ TEST_F(EmbedderTest, CanSpecifyCustomTaskRunner) {
     
       thread.GetTaskRunner()->PostTask([&]() {
         EmbedderConfigBuilder builder(context);
    -    builder.AddCommandLineArgument("--verbose-logging");
         const auto task_runner_description = runner.GetEmbedderDescription();
         runner.SetForwardingTaskRunner(
             fml::MessageLoop::GetCurrent().GetTaskRunner());
    
    From 8d56284cdadc3c04b9acd3603e2d693db90ef808 Mon Sep 17 00:00:00 2001
    From: Chinmay Garde 
    Date: Thu, 28 Mar 2019 11:22:06 -0700
    Subject: [PATCH 0610/1117] Remove the standalone a11y test runners and merge
     its tests into embedder_unittests. (#8338)
    
    Also cleans up the a11y unittests to use the new builder API and avoids polluting the global namespace with state for assertions.
    ---
     BUILD.gn                                      |   7 +-
     ci/licenses_golden/licenses_flutter           |   3 +-
     shell/platform/embedder/BUILD.gn              |  32 +--
     .../fixtures/{a11y_main.dart => main.dart}    |  37 +++-
     .../embedder/fixtures/simple_main.dart        |  28 ---
     .../embedder/tests/embedder_a11y_unittests.cc | 188 ++++++------------
     .../embedder/tests/embedder_config_builder.cc |   8 +
     .../embedder/tests/embedder_config_builder.h  |   2 +
     .../embedder/tests/embedder_context.cc        |  31 +++
     .../embedder/tests/embedder_context.h         |  22 +-
     10 files changed, 164 insertions(+), 194 deletions(-)
     rename shell/platform/embedder/fixtures/{a11y_main.dart => main.dart} (83%)
     delete mode 100644 shell/platform/embedder/fixtures/simple_main.dart
    
    diff --git a/BUILD.gn b/BUILD.gn
    index b57d63f91fde2..39edfcdc720bf 100644
    --- a/BUILD.gn
    +++ b/BUILD.gn
    @@ -7,7 +7,7 @@ import("$flutter_root/common/config.gni")
     # Whether to build the dartdevc sdk, libraries, and source files
     # required for the flutter web sdk.
     declare_args() {
    -  full_dart_sdk = false  
    +  full_dart_sdk = false
     }
     
     group("flutter") {
    @@ -32,9 +32,7 @@ group("flutter") {
           ]
     
           if (full_dart_sdk) {
    -        public_deps += [
    -          "$flutter_root/web_sdk",
    -        ]
    +        public_deps += [ "$flutter_root/web_sdk" ]
           }
         }
       }
    @@ -52,7 +50,6 @@ group("flutter") {
           "$flutter_root/runtime:runtime_unittests",
           "$flutter_root/shell/common:shell_unittests",
           "$flutter_root/shell/platform/embedder:embedder_unittests",
    -      "$flutter_root/shell/platform/embedder:embedder_a11y_unittests", # TODO(cbracken) build these into a different kernel blob in the embedder tests and load that in a test in embedder_unittests
           "$flutter_root/synchronization:synchronization_unittests",
           "$flutter_root/third_party/txt:txt_unittests",
         ]
    diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter
    index f5259b505f734..c4e3fd171004a 100644
    --- a/ci/licenses_golden/licenses_flutter
    +++ b/ci/licenses_golden/licenses_flutter
    @@ -686,8 +686,7 @@ FILE: ../../../flutter/shell/platform/embedder/embedder_task_runner.cc
     FILE: ../../../flutter/shell/platform/embedder/embedder_task_runner.h
     FILE: ../../../flutter/shell/platform/embedder/embedder_thread_host.cc
     FILE: ../../../flutter/shell/platform/embedder/embedder_thread_host.h
    -FILE: ../../../flutter/shell/platform/embedder/fixtures/a11y_main.dart
    -FILE: ../../../flutter/shell/platform/embedder/fixtures/simple_main.dart
    +FILE: ../../../flutter/shell/platform/embedder/fixtures/main.dart
     FILE: ../../../flutter/shell/platform/embedder/platform_view_embedder.cc
     FILE: ../../../flutter/shell/platform/embedder/platform_view_embedder.h
     FILE: ../../../flutter/shell/platform/embedder/vsync_waiter_embedder.cc
    diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn
    index 5632f5f0fd5dd..9fa9c2995655f 100644
    --- a/shell/platform/embedder/BUILD.gn
    +++ b/shell/platform/embedder/BUILD.gn
    @@ -64,7 +64,7 @@ source_set("embedder") {
     }
     
     test_fixtures("fixtures") {
    -  fixtures = [ "fixtures/simple_main.dart" ]
    +  fixtures = [ "fixtures/main.dart" ]
     }
     
     executable("embedder_unittests") {
    @@ -73,6 +73,7 @@ executable("embedder_unittests") {
       include_dirs = [ "." ]
     
       sources = [
    +    "tests/embedder_a11y_unittests.cc",
         "tests/embedder_config_builder.cc",
         "tests/embedder_config_builder.h",
         "tests/embedder_context.cc",
    @@ -87,6 +88,7 @@ executable("embedder_unittests") {
       deps = [
         ":embedder",
         ":fixtures",
    +    "$flutter_root/lib/ui",
         "$flutter_root/runtime",
         "$flutter_root/testing",
         "//third_party/skia",
    @@ -98,34 +100,6 @@ executable("embedder_unittests") {
       }
     }
     
    -test_fixtures("fixtures_a11y") {
    -  fixtures = [ "fixtures/a11y_main.dart" ]
    -}
    -
    -executable("embedder_a11y_unittests") {
    -  testonly = true
    -
    -  include_dirs = [ "." ]
    -
    -  sources = [
    -    "tests/embedder_a11y_unittests.cc",
    -  ]
    -
    -  deps = [
    -    ":embedder",
    -    ":fixtures_a11y",
    -    "$flutter_root/lib/ui:ui",
    -    "$flutter_root/shell/common",
    -    "$flutter_root/testing",
    -    "//third_party/skia",
    -    "//third_party/tonic",
    -  ]
    -
    -  if (is_linux) {
    -    ldflags = [ "-rdynamic" ]
    -  }
    -}
    -
     shared_library("flutter_engine_library") {
       visibility = [ ":*" ]
     
    diff --git a/shell/platform/embedder/fixtures/a11y_main.dart b/shell/platform/embedder/fixtures/main.dart
    similarity index 83%
    rename from shell/platform/embedder/fixtures/a11y_main.dart
    rename to shell/platform/embedder/fixtures/main.dart
    index 578bd471c0d0a..73374e9e5e20e 100644
    --- a/shell/platform/embedder/fixtures/a11y_main.dart
    +++ b/shell/platform/embedder/fixtures/main.dart
    @@ -2,6 +2,34 @@ import 'dart:async';
     import 'dart:typed_data';
     import 'dart:ui';
     
    +void main() {}
    +
    +@pragma('vm:entry-point')
    +void customEntrypoint() {
    +  sayHiFromCustomEntrypoint();
    +}
    +
    +void sayHiFromCustomEntrypoint() native "SayHiFromCustomEntrypoint";
    +
    +
    +@pragma('vm:entry-point')
    +void customEntrypoint1() {
    +  sayHiFromCustomEntrypoint1();
    +  sayHiFromCustomEntrypoint2();
    +  sayHiFromCustomEntrypoint3();
    +}
    +
    +void sayHiFromCustomEntrypoint1() native "SayHiFromCustomEntrypoint1";
    +void sayHiFromCustomEntrypoint2() native "SayHiFromCustomEntrypoint2";
    +void sayHiFromCustomEntrypoint3() native "SayHiFromCustomEntrypoint3";
    +
    +
    +@pragma('vm:entry-point')
    +void invokePlatformTaskRunner() {
    +  window.sendPlatformMessage('OhHi', null, null);
    +}
    +
    +
     Float64List kTestTransform = () {
       final Float64List values = Float64List(16);
       values[0] = 1.0;  // scaleX
    @@ -17,9 +45,9 @@ Float64List kTestTransform = () {
     }();
     
     void signalNativeTest() native 'SignalNativeTest';
    -void notifySemanticsEnabled(bool enabled) native 'NotifyTestData1';
    -void notifyAccessibilityFeatures(bool reduceMotion) native 'NotifyTestData1';
    -void notifySemanticsAction(int nodeId, int action, List data) native 'NotifyTestData3';
    +void notifySemanticsEnabled(bool enabled) native 'NotifyTestData';
    +void notifyAccessibilityFeatures(bool reduceMotion) native 'NotifyTestData';
    +void notifySemanticsAction(int nodeId, int action, List data) native 'NotifyTestData';
     
     /// Returns a future that completes when `window.onSemanticsEnabledChanged`
     /// fires.
    @@ -52,7 +80,8 @@ Future get semanticsAction {
       return actionReceived.future;
     }
     
    -main() async {
    +@pragma('vm:entry-point')
    +void a11y_main() async {
       // Return initial state (semantics disabled).
       notifySemanticsEnabled(window.semanticsEnabled);
     
    diff --git a/shell/platform/embedder/fixtures/simple_main.dart b/shell/platform/embedder/fixtures/simple_main.dart
    deleted file mode 100644
    index 853e136f96ed8..0000000000000
    --- a/shell/platform/embedder/fixtures/simple_main.dart
    +++ /dev/null
    @@ -1,28 +0,0 @@
    -import 'dart:ui';
    -
    -void main() {}
    -
    -@pragma('vm:entry-point')
    -void customEntrypoint() {
    -  sayHiFromCustomEntrypoint();
    -}
    -
    -void sayHiFromCustomEntrypoint() native "SayHiFromCustomEntrypoint";
    -
    -
    -@pragma('vm:entry-point')
    -void customEntrypoint1() {
    -  sayHiFromCustomEntrypoint1();
    -  sayHiFromCustomEntrypoint2();
    -  sayHiFromCustomEntrypoint3();
    -}
    -
    -void sayHiFromCustomEntrypoint1() native "SayHiFromCustomEntrypoint1";
    -void sayHiFromCustomEntrypoint2() native "SayHiFromCustomEntrypoint2";
    -void sayHiFromCustomEntrypoint3() native "SayHiFromCustomEntrypoint3";
    -
    -
    -@pragma('vm:entry-point')
    -void invokePlatformTaskRunner() {
    -  window.sendPlatformMessage('OhHi', null, null);
    -}
    diff --git a/shell/platform/embedder/tests/embedder_a11y_unittests.cc b/shell/platform/embedder/tests/embedder_a11y_unittests.cc
    index cfb15db76dc68..58728e524f3e6 100644
    --- a/shell/platform/embedder/tests/embedder_a11y_unittests.cc
    +++ b/shell/platform/embedder/tests/embedder_a11y_unittests.cc
    @@ -7,152 +7,92 @@
     #define FML_USED_ON_EMBEDDER
     
     #include 
    -#include "embedder.h"
    +
     #include "flutter/fml/macros.h"
     #include "flutter/fml/message_loop.h"
     #include "flutter/fml/synchronization/waitable_event.h"
     #include "flutter/lib/ui/semantics/semantics_node.h"
    -#include "flutter/shell/platform/embedder/embedder_engine.h"
    +#include "flutter/shell/platform/embedder/embedder.h"
    +#include "flutter/shell/platform/embedder/tests/embedder_config_builder.h"
     #include "flutter/testing/testing.h"
    -#include "third_party/dart/runtime/include/dart_api.h"
    -#include "third_party/tonic/converter/dart_converter.h"
    -#include "third_party/tonic/dart_library_natives.h"
    -
    -#define REGISTER_FUNCTION(name, count) {"" #name, name, count, true},
    -#define DECLARE_FUNCTION(name, count) \
    -  extern void name(Dart_NativeArguments args);
    -#define BUILTIN_NATIVE_LIST(V) \
    -  V(SignalNativeTest, 0)       \
    -  V(NotifyTestData1, 1)        \
    -  V(NotifyTestData3, 3)
    -
    -BUILTIN_NATIVE_LIST(DECLARE_FUNCTION);
    -
    -static tonic::DartLibraryNatives* g_natives;
    -
    -Dart_NativeFunction GetNativeFunction(Dart_Handle name,
    -                                      int argument_count,
    -                                      bool* auto_setup_scope) {
    -  return g_natives->GetNativeFunction(name, argument_count, auto_setup_scope);
    -}
     
    -const uint8_t* GetSymbol(Dart_NativeFunction native_function) {
    -  return g_natives->GetSymbol(native_function);
    -}
    +namespace shell {
    +namespace testing {
     
    -using OnTestDataCallback = std::function;
    +using Embedder11yTest = testing::EmbedderTest;
     
    -fml::AutoResetWaitableEvent g_latch;
    -OnTestDataCallback g_test_data_callback = [](Dart_NativeArguments) {};
    -
    -// Called by the Dart text fixture on the UI thread to signal that the C++
    -// unittest should resume.
    -void SignalNativeTest(Dart_NativeArguments args) {
    -  g_latch.Signal();
    -}
    -
    -// Called by test fixture on UI thread to pass data back to this test.
    -// 1 parameter version.
    -void NotifyTestData1(Dart_NativeArguments args) {
    -  g_test_data_callback(args);
    -}
    -
    -// Called by test fixture on UI thread to pass data back to this test.
    -// 3 parameter version.
    -void NotifyTestData3(Dart_NativeArguments args) {
    -  g_test_data_callback(args);
    -}
    +TEST_F(Embedder11yTest, A11yTreeIsConsistent) {
    +  auto& context = GetEmbedderContext();
     
    -TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) {
    -  FlutterSoftwareRendererConfig renderer;
    -  renderer.struct_size = sizeof(FlutterSoftwareRendererConfig);
    -  renderer.surface_present_callback = [](void*, const void*, size_t, size_t) {
    -    return false;
    -  };
    +  fml::AutoResetWaitableEvent latch;
     
    -  FlutterRendererConfig config = {};
    -  config.type = FlutterRendererType::kSoftware;
    -  config.software = renderer;
    +  // Called by the Dart text fixture on the UI thread to signal that the C++
    +  // unittest should resume.
    +  context.AddNativeCallback(
    +      "SignalNativeTest", CREATE_NATIVE_ENTRY(([&latch](Dart_NativeArguments) {
    +        latch.Signal();
    +      })));
     
    -  FlutterProjectArgs args = {};
    -  args.struct_size = sizeof(FlutterProjectArgs);
    -  args.assets_path = testing::GetFixturesPath();
    +  // Called by test fixture on UI thread to pass data back to this test.
    +  NativeEntry callback;
    +  context.AddNativeCallback(
    +      "NotifyTestData",
    +      CREATE_NATIVE_ENTRY(([&callback](Dart_NativeArguments args) {
    +        ASSERT_NE(callback, nullptr);
    +        callback(args);
    +      })));
     
    -  // Register native functions to be called from test fixture.
    -  g_natives = new tonic::DartLibraryNatives();
    -  g_natives->Register({BUILTIN_NATIVE_LIST(REGISTER_FUNCTION)});
    -  args.root_isolate_create_callback = [](void*) {
    -    Dart_SetNativeResolver(Dart_RootLibrary(), GetNativeFunction, GetSymbol);
    -  };
    +  EmbedderConfigBuilder builder(context);
    +  builder.SetDartEntrypoint("a11y_main");
     
    -  typedef struct {
    -    std::function on_semantics_update;
    -    std::function
    -        on_custom_action_update;
    -  } TestData;
    -  auto test_data = TestData{};
    -  args.update_semantics_node_callback = [](const FlutterSemanticsNode* node,
    -                                           void* data) {
    -    auto test_data = reinterpret_cast(data);
    -    test_data->on_semantics_update(node);
    -  };
    -  args.update_semantics_custom_action_callback =
    -      [](const FlutterSemanticsCustomAction* action, void* data) {
    -        auto test_data = reinterpret_cast(data);
    -        test_data->on_custom_action_update(action);
    -      };
    -
    -  // Start the engine, run text fixture.
    -  FlutterEngine engine = nullptr;
    -  FlutterEngineResult result = FlutterEngineRun(FLUTTER_ENGINE_VERSION, &config,
    -                                                &args, &test_data, &engine);
    -  ASSERT_EQ(result, FlutterEngineResult::kSuccess);
    +  auto engine = builder.LaunchEngine();
    +  ASSERT_TRUE(engine.is_valid());
     
       // Wait for initial NotifySemanticsEnabled(false).
    -  g_test_data_callback = [](Dart_NativeArguments args) {
    -    bool enabled;
    +  callback = [&](Dart_NativeArguments args) {
    +    bool enabled = true;
         Dart_GetNativeBooleanArgument(args, 0, &enabled);
         ASSERT_FALSE(enabled);
    -    g_latch.Signal();
    +    latch.Signal();
       };
    -  g_latch.Wait();
    +  latch.Wait();
     
       // Enable semantics. Wait for NotifySemanticsEnabled(true).
    -  g_test_data_callback = [](Dart_NativeArguments args) {
    -    bool enabled;
    +  callback = [&](Dart_NativeArguments args) {
    +    bool enabled = false;
         Dart_GetNativeBooleanArgument(args, 0, &enabled);
         ASSERT_TRUE(enabled);
    -    g_latch.Signal();
    +    latch.Signal();
       };
    -  result = FlutterEngineUpdateSemanticsEnabled(engine, true);
    +  auto result = FlutterEngineUpdateSemanticsEnabled(engine.get(), true);
       ASSERT_EQ(result, FlutterEngineResult::kSuccess);
    -  g_latch.Wait();
    +  latch.Wait();
     
       // Wait for initial accessibility features (reduce_motion == false)
    -  g_test_data_callback = [](Dart_NativeArguments args) {
    -    bool enabled;
    +  callback = [&](Dart_NativeArguments args) {
    +    bool enabled = true;
         Dart_GetNativeBooleanArgument(args, 0, &enabled);
         ASSERT_FALSE(enabled);
    -    g_latch.Signal();
    +    latch.Signal();
       };
    -  g_latch.Wait();
    +  latch.Wait();
     
       // Set accessibility features: (reduce_motion == true)
    -  g_test_data_callback = [](Dart_NativeArguments args) {
    -    bool enabled;
    +  callback = [&](Dart_NativeArguments args) {
    +    bool enabled = false;
         Dart_GetNativeBooleanArgument(args, 0, &enabled);
         ASSERT_TRUE(enabled);
    -    g_latch.Signal();
    +    latch.Signal();
       };
       result = FlutterEngineUpdateAccessibilityFeatures(
    -      engine, kFlutterAccessibilityFeatureReduceMotion);
    +      engine.get(), kFlutterAccessibilityFeatureReduceMotion);
       ASSERT_EQ(result, FlutterEngineResult::kSuccess);
    -  g_latch.Wait();
    +  latch.Wait();
     
       // Wait for UpdateSemantics callback on platform (current) thread.
       int node_count = 0;
       int node_batch_end_count = 0;
    -  test_data.on_semantics_update =
    +  context.SetSemanticsNodeCallback(
           [&node_count, &node_batch_end_count](const FlutterSemanticsNode* node) {
             if (node->id == kFlutterSemanticsNodeIdBatchEnd) {
               ++node_batch_end_count;
    @@ -168,10 +108,11 @@ TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) {
               ASSERT_EQ(8.0, node->transform.pers1);
               ASSERT_EQ(9.0, node->transform.pers2);
             }
    -      };
    +      });
    +
       int action_count = 0;
       int action_batch_end_count = 0;
    -  test_data.on_custom_action_update =
    +  context.SetSemanticsCustomActionCallback(
           [&action_count,
            &action_batch_end_count](const FlutterSemanticsCustomAction* action) {
             if (action->id == kFlutterSemanticsCustomActionIdBatchEnd) {
    @@ -179,8 +120,9 @@ TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) {
             } else {
               ++action_count;
             }
    -      };
    -  g_latch.Wait();
    +      });
    +
    +  latch.Wait();
       fml::MessageLoop::GetCurrent().RunExpiredTasksNow();
       ASSERT_EQ(4, node_count);
       ASSERT_EQ(1, node_batch_end_count);
    @@ -188,8 +130,8 @@ TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) {
       ASSERT_EQ(1, action_batch_end_count);
     
       // Dispatch a tap to semantics node 42. Wait for NotifySemanticsAction.
    -  g_test_data_callback = [](Dart_NativeArguments args) {
    -    int64_t node_id;
    +  callback = [&](Dart_NativeArguments args) {
    +    int64_t node_id = 0;
         Dart_GetNativeIntegerArgument(args, 0, &node_id);
         ASSERT_EQ(42, node_id);
     
    @@ -206,24 +148,24 @@ TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) {
         dart_int = Dart_ListGetAt(semantic_args, 1);
         Dart_IntegerToInt64(dart_int, &data);
         ASSERT_EQ(1, data);
    -    g_latch.Signal();
    +    latch.Signal();
       };
       std::vector bytes({2, 1});
       result = FlutterEngineDispatchSemanticsAction(
    -      engine, 42, kFlutterSemanticsActionTap, &bytes[0], bytes.size());
    -  g_latch.Wait();
    +      engine.get(), 42, kFlutterSemanticsActionTap, &bytes[0], bytes.size());
    +  latch.Wait();
     
       // Disable semantics. Wait for NotifySemanticsEnabled(false).
    -  g_test_data_callback = [](Dart_NativeArguments args) {
    -    bool enabled;
    +  callback = [&](Dart_NativeArguments args) {
    +    bool enabled = true;
         Dart_GetNativeBooleanArgument(args, 0, &enabled);
         ASSERT_FALSE(enabled);
    -    g_latch.Signal();
    +    latch.Signal();
       };
    -  result = FlutterEngineUpdateSemanticsEnabled(engine, false);
    -  ASSERT_EQ(result, FlutterEngineResult::kSuccess);
    -  g_latch.Wait();
    -
    -  result = FlutterEngineShutdown(engine);
    +  result = FlutterEngineUpdateSemanticsEnabled(engine.get(), false);
       ASSERT_EQ(result, FlutterEngineResult::kSuccess);
    +  latch.Wait();
     }
    +
    +}  // namespace testing
    +}  // namespace shell
    diff --git a/shell/platform/embedder/tests/embedder_config_builder.cc b/shell/platform/embedder/tests/embedder_config_builder.cc
    index 546f95a78ea1a..7a43162770d50 100644
    --- a/shell/platform/embedder/tests/embedder_config_builder.cc
    +++ b/shell/platform/embedder/tests/embedder_config_builder.cc
    @@ -22,6 +22,7 @@ EmbedderConfigBuilder::EmbedderConfigBuilder(
         SetAssetsPath();
         SetSnapshots();
         SetIsolateCreateCallbackHook();
    +    SetSemanticsCallbackHooks();
       }
     }
     
    @@ -63,6 +64,13 @@ void EmbedderConfigBuilder::SetIsolateCreateCallbackHook() {
           EmbedderContext::GetIsolateCreateCallbackHook();
     }
     
    +void EmbedderConfigBuilder::SetSemanticsCallbackHooks() {
    +  project_args_.update_semantics_node_callback =
    +      EmbedderContext::GetUpdateSemanticsNodeCallbackHook();
    +  project_args_.update_semantics_custom_action_callback =
    +      EmbedderContext::GetUpdateSemanticsCustomActionCallbackHook();
    +}
    +
     void EmbedderConfigBuilder::SetDartEntrypoint(std::string entrypoint) {
       if (entrypoint.size() == 0) {
         return;
    diff --git a/shell/platform/embedder/tests/embedder_config_builder.h b/shell/platform/embedder/tests/embedder_config_builder.h
    index 28c057d11441b..9e0f3fcf62af4 100644
    --- a/shell/platform/embedder/tests/embedder_config_builder.h
    +++ b/shell/platform/embedder/tests/embedder_config_builder.h
    @@ -48,6 +48,8 @@ class EmbedderConfigBuilder {
     
       void SetIsolateCreateCallbackHook();
     
    +  void SetSemanticsCallbackHooks();
    +
       void SetDartEntrypoint(std::string entrypoint);
     
       void AddCommandLineArgument(std::string arg);
    diff --git a/shell/platform/embedder/tests/embedder_context.cc b/shell/platform/embedder/tests/embedder_context.cc
    index edb72ff4c2f24..5a21ebeed8b00 100644
    --- a/shell/platform/embedder/tests/embedder_context.cc
    +++ b/shell/platform/embedder/tests/embedder_context.cc
    @@ -105,5 +105,36 @@ void EmbedderContext::AddNativeCallback(const char* name,
       native_resolver_->AddNativeCallback({name}, function);
     }
     
    +void EmbedderContext::SetSemanticsNodeCallback(
    +    SemanticsNodeCallback update_semantics_node_callback) {
    +  update_semantics_node_callback_ = update_semantics_node_callback;
    +}
    +
    +void EmbedderContext::SetSemanticsCustomActionCallback(
    +    SemanticsActionCallback update_semantics_custom_action_callback) {
    +  update_semantics_custom_action_callback_ =
    +      update_semantics_custom_action_callback;
    +}
    +
    +FlutterUpdateSemanticsNodeCallback
    +EmbedderContext::GetUpdateSemanticsNodeCallbackHook() {
    +  return [](const FlutterSemanticsNode* semantics_node, void* user_data) {
    +    auto context = reinterpret_cast(user_data);
    +    if (auto callback = context->update_semantics_node_callback_) {
    +      callback(semantics_node);
    +    }
    +  };
    +}
    +
    +FlutterUpdateSemanticsCustomActionCallback
    +EmbedderContext::GetUpdateSemanticsCustomActionCallbackHook() {
    +  return [](const FlutterSemanticsCustomAction* action, void* user_data) {
    +    auto context = reinterpret_cast(user_data);
    +    if (auto callback = context->update_semantics_custom_action_callback_) {
    +      callback(action);
    +    }
    +  };
    +}
    +
     }  // namespace testing
     }  // namespace shell
    diff --git a/shell/platform/embedder/tests/embedder_context.h b/shell/platform/embedder/tests/embedder_context.h
    index cf31140d40029..564262a859ef8 100644
    --- a/shell/platform/embedder/tests/embedder_context.h
    +++ b/shell/platform/embedder/tests/embedder_context.h
    @@ -18,7 +18,7 @@
     
     #define CREATE_NATIVE_ENTRY(native_entry)                                   \
       ([&]() {                                                                  \
    -    static ::shell::testing::EmbedderContext::NativeEntry closure;          \
    +    static ::shell::testing::NativeEntry closure;                           \
         static Dart_NativeFunction entrypoint = [](Dart_NativeArguments args) { \
           closure(args);                                                        \
         };                                                                      \
    @@ -29,10 +29,13 @@
     namespace shell {
     namespace testing {
     
    +using NativeEntry = std::function;
    +using SemanticsNodeCallback = std::function;
    +using SemanticsActionCallback =
    +    std::function;
    +
     class EmbedderContext {
      public:
    -  using NativeEntry = std::function;
    -
       EmbedderContext(std::string assets_path = "");
     
       ~EmbedderContext();
    @@ -51,6 +54,11 @@ class EmbedderContext {
     
       void AddNativeCallback(const char* name, Dart_NativeFunction function);
     
    +  void SetSemanticsNodeCallback(SemanticsNodeCallback update_semantics_node);
    +
    +  void SetSemanticsCustomActionCallback(
    +      SemanticsActionCallback semantics_custom_action);
    +
      private:
       // This allows the builder to access the hooks.
       friend class EmbedderConfigBuilder;
    @@ -62,9 +70,17 @@ class EmbedderContext {
       std::unique_ptr isolate_snapshot_instructions_;
       std::vector isolate_create_callbacks_;
       std::shared_ptr native_resolver_;
    +  SemanticsNodeCallback update_semantics_node_callback_;
    +  SemanticsActionCallback update_semantics_custom_action_callback_;
     
       static VoidCallback GetIsolateCreateCallbackHook();
     
    +  static FlutterUpdateSemanticsNodeCallback
    +  GetUpdateSemanticsNodeCallbackHook();
    +
    +  static FlutterUpdateSemanticsCustomActionCallback
    +  GetUpdateSemanticsCustomActionCallbackHook();
    +
       void FireIsolateCreateCallbacks();
     
       void SetNativeResolver();
    
    From 930033d95c8f43e17020d651db5f5997fc8fcb6c Mon Sep 17 00:00:00 2001
    From: Jason Simmons 
    Date: Thu, 28 Mar 2019 11:33:56 -0700
    Subject: [PATCH 0611/1117] Create a new resource loading EGL context for each
     PlatformView instance on Android (#8330)
    
    Using one global resource loading context will fail if two PlatformViews are
    running concurrently with two different IO threads.
    ---
     shell/platform/android/android_surface_gl.cc | 18 +++---------------
     1 file changed, 3 insertions(+), 15 deletions(-)
    
    diff --git a/shell/platform/android/android_surface_gl.cc b/shell/platform/android/android_surface_gl.cc
    index 4e1ff9f41cd6f..83586b4030593 100644
    --- a/shell/platform/android/android_surface_gl.cc
    +++ b/shell/platform/android/android_surface_gl.cc
    @@ -11,35 +11,23 @@
     
     namespace shell {
     
    -static fml::RefPtr GlobalResourceLoadingContext() {
    -  // AndroidSurfaceGL instances are only ever created on the platform thread. So
    -  // there is no need to lock here.
    -
    -  static fml::RefPtr global_context;
    -
    -  if (global_context) {
    -    return global_context;
    -  }
    -
    +static fml::RefPtr CreateResourceLoadingContext() {
       auto environment = fml::MakeRefCounted();
    -
       if (!environment->IsValid()) {
         return nullptr;
       }
     
       auto context = fml::MakeRefCounted(environment);
    -
       if (!context->IsValid()) {
         return nullptr;
       }
     
    -  global_context = context;
    -  return global_context;
    +  return context;
     }
     
     AndroidSurfaceGL::AndroidSurfaceGL() {
       // Acquire the offscreen context.
    -  offscreen_context_ = GlobalResourceLoadingContext();
    +  offscreen_context_ = CreateResourceLoadingContext();
     
       if (!offscreen_context_ || !offscreen_context_->IsValid()) {
         offscreen_context_ = nullptr;
    
    From 6c948ba2485ea2c812b5e01414118508d8df1bc1 Mon Sep 17 00:00:00 2001
    From: Jason Simmons 
    Date: Thu, 28 Mar 2019 12:37:18 -0700
    Subject: [PATCH 0612/1117] Ensure that Picture::RasterizeToImage destroys Dart
     persistent values on the UI thread (#8182)
    
    The DartPersistentValue used to hold the image callback is tied to a
    Dart isolate.  Destructing the DartPersistentValue requires entering
    the isolate and must be done on the UI thread.
    
    Fixes https://github.com/flutter/flutter/issues/29379
    ---
     lib/ui/painting/picture.cc | 81 +++++++++++++++++---------------------
     1 file changed, 36 insertions(+), 45 deletions(-)
    
    diff --git a/lib/ui/painting/picture.cc b/lib/ui/painting/picture.cc
    index ac132d05a96e0..f7cdd78ca1301 100644
    --- a/lib/ui/painting/picture.cc
    +++ b/lib/ui/painting/picture.cc
    @@ -70,8 +70,8 @@ Dart_Handle Picture::RasterizeToImage(sk_sp picture,
       }
     
       auto* dart_state = UIDartState::Current();
    -  auto image_callback = std::make_unique(
    -      dart_state, raw_image_callback);
    +  tonic::DartPersistentValue* image_callback =
    +      new tonic::DartPersistentValue(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();
    @@ -84,52 +84,43 @@ Dart_Handle Picture::RasterizeToImage(sk_sp picture,
     
       auto picture_bounds = SkISize::Make(width, height);
     
    -  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.
    -        fml::TaskRunner::RunNowOrPostTask(
    -            ui_task_runner,
    -            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]() {
    -    fml::TaskRunner::RunNowOrPostTask(gpu_task_runner, [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));
    -    });
    +  auto ui_task = fml::MakeCopyable([image_callback, unref_queue](
    +                                       sk_sp raster_image) 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});
    +
    +    // image_callback is associated with the Dart isolate and must be deleted
    +    // on the UI thread
    +    delete image_callback;
       });
     
       // Kick things off on the GPU.
    -  gpu_task();
    +  fml::TaskRunner::RunNowOrPostTask(
    +      gpu_task_runner,
    +      [ui_task_runner, snapshot_delegate, picture, picture_bounds, ui_task] {
    +        sk_sp raster_image =
    +            snapshot_delegate->MakeRasterSnapshot(picture, picture_bounds);
    +
    +        fml::TaskRunner::RunNowOrPostTask(
    +            ui_task_runner,
    +            [ui_task, raster_image]() { ui_task(raster_image); });
    +      });
     
       return Dart_Null();
     }
    
    From 9040422fdd7c9fe7f44b075a7e62867446dbe878 Mon Sep 17 00:00:00 2001
    From: Jonah Williams 
    Date: Thu, 28 Mar 2019 12:58:15 -0700
    Subject: [PATCH 0613/1117] Create ddc summary file and precompiled sdk (#8355)
    
    ---
     ci/licenses_golden/licenses_flutter |   2 +
     web_sdk/BUILD.gn                    |  28 ++-
     web_sdk/flutter_kernel_sdk.dart     |  10 +-
     web_sdk/libraries.dart              | 313 ++++++++++++++++++++++++++++
     web_sdk/make_combined_sdk.dart      | 120 +++++++++++
     web_sdk/make_combined_sdk.sh        |  16 --
     6 files changed, 466 insertions(+), 23 deletions(-)
     create mode 100644 web_sdk/libraries.dart
     create mode 100755 web_sdk/make_combined_sdk.dart
     delete mode 100755 web_sdk/make_combined_sdk.sh
    
    diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter
    index c4e3fd171004a..3965f74fb967e 100644
    --- a/ci/licenses_golden/licenses_flutter
    +++ b/ci/licenses_golden/licenses_flutter
    @@ -747,7 +747,9 @@ FILE: ../../../flutter/vulkan/vulkan_utilities.h
     FILE: ../../../flutter/vulkan/vulkan_window.cc
     FILE: ../../../flutter/vulkan/vulkan_window.h
     FILE: ../../../flutter/web_sdk/flutter_kernel_sdk.dart
    +FILE: ../../../flutter/web_sdk/libraries.dart
     FILE: ../../../flutter/web_sdk/libraries.json
    +FILE: ../../../flutter/web_sdk/make_combined_sdk.dart
     ----------------------------------------------------------------------------------------------------
     Copyright 2013 The Flutter Authors. All rights reserved.
     
    diff --git a/web_sdk/BUILD.gn b/web_sdk/BUILD.gn
    index 925f6000499b5..57f8e4296666f 100644
    --- a/web_sdk/BUILD.gn
    +++ b/web_sdk/BUILD.gn
    @@ -28,8 +28,7 @@ web_ui_sources = [
     
     group("web_sdk") {
       deps = [
    -    ":web_ui_sources",
    -    ":web_ui_library",
    +    ":generate_web_summary_sdk",
         ":flutter_dartdevc_kernel_sdk",
       ]
     }
    @@ -52,6 +51,31 @@ copy("web_ui_library") {
       ]
     }
     
    +prebuilt_dart_action("generate_web_summary_sdk") {
    +  script = "$flutter_root/web_sdk/make_combined_sdk.dart"
    +
    +  inputs = [
    +    "$flutter_root/web_sdk/make_combined_sdk.dart",
    +    "$flutter_root/web_sdk/libraries.dart",
    +  ]
    +
    +  packages = "//third_party/dart/.packages"
    +
    +  args = []
    +
    +  outputs = [
    +    "$root_out_dir/flutter_web_sdk/js/amd/sdk.js",
    +    "$root_out_dir/flutter_web_sdk/js/amd/dart_sdk.js.map",
    +    "$root_out_dir/flutter_web_sdk/lib/_internal/ddc_sdk.sum",
    +  ]
    +
    +  deps = [
    +    ":web_ui_sources",
    +    ":web_ui_library",
    +    "//third_party/dart:create_sdk",
    +  ]
    +}
    +
     prebuilt_dart_action("flutter_dartdevc_kernel_sdk") {
       deps = [
         "//third_party/dart/pkg:pkg_files_stamp",
    diff --git a/web_sdk/flutter_kernel_sdk.dart b/web_sdk/flutter_kernel_sdk.dart
    index dea21c2de8ae5..96e181977b694 100644
    --- a/web_sdk/flutter_kernel_sdk.dart
    +++ b/web_sdk/flutter_kernel_sdk.dart
    @@ -6,11 +6,11 @@ import 'dart:async';
     import 'dart:convert' show json;
     import 'dart:io';
     import 'package:args/args.dart' show ArgParser;
    -import 'package:dev_compiler/src/compiler/module_builder.dart';
    -import 'package:dev_compiler/src/compiler/shared_command.dart' show SharedCompilerOptions;
    -import 'package:dev_compiler/src/kernel/target.dart';
    -import 'package:dev_compiler/src/kernel/command.dart';
    -import 'package:dev_compiler/src/kernel/compiler.dart';
    +import 'package:dev_compiler/src/compiler/module_builder.dart'; // ignore: uri_does_not_exist
    +import 'package:dev_compiler/src/compiler/shared_command.dart' show SharedCompilerOptions; // ignore: uri_does_not_exist
    +import 'package:dev_compiler/src/kernel/target.dart'; // ignore: uri_does_not_exist
    +import 'package:dev_compiler/src/kernel/command.dart'; // ignore: uri_does_not_exist
    +import 'package:dev_compiler/src/kernel/compiler.dart'; // ignore: uri_does_not_exist
     import 'package:front_end/src/api_unstable/ddc.dart' show CompilerOptions, kernelForComponent;
     import 'package:kernel/kernel.dart';
     import 'package:path/path.dart' as path;
    diff --git a/web_sdk/libraries.dart b/web_sdk/libraries.dart
    new file mode 100644
    index 0000000000000..318bedf092f57
    --- /dev/null
    +++ b/web_sdk/libraries.dart
    @@ -0,0 +1,313 @@
    +// Copyright 2013 The Flutter Authors. All rights reserved.
    +// Use of this source code is governed by a BSD-style license that can be
    +// found in the LICENSE file.
    +library libraries;
    +
    +// Branched from https://github.com/dart-lang/sdk/blob/master/pkg/dev_compiler/tool/input_sdk/libraries.dart
    +// with handling for dart:ui added.
    +
    +/**
    + * A bit flag used by [LibraryInfo] indicating that a library is used by dart2js
    + */
    +const int DART2JS_PLATFORM = 1;
    +
    +/**
    + * A bit flag used by [LibraryInfo] indicating that a library is used by the VM
    + */
    +const int VM_PLATFORM = 2;
    +
    +/// The contexts that a library can be used from.
    +enum Category {
    +  /// Indicates that a library can be used in a browser context.
    +  client,
    +
    +  /// Indicates that a library can be used in a command line context.
    +  server,
    +
    +  /// Indicates that a library can be used from embedded devices.
    +  embedded
    +}
    +
    +Category parseCategory(String name) {
    +  switch (name) {
    +    case "Client":
    +      return Category.client;
    +    case "Server":
    +      return Category.server;
    +    case "Embedded":
    +      return Category.embedded;
    +  }
    +  return null;
    +}
    +
    +/// Mapping of "dart:" library name (e.g. "core") to information about that
    +/// library.
    +const Map libraries = const {
    +  "async": const LibraryInfo("async/async.dart",
    +      categories: "Client,Server",
    +      maturity: Maturity.STABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/async_patch.dart"),
    +  "collection": const LibraryInfo("collection/collection.dart",
    +      categories: "Client,Server,Embedded",
    +      maturity: Maturity.STABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/collection_patch.dart"),
    +  "convert": const LibraryInfo("convert/convert.dart",
    +      categories: "Client,Server",
    +      maturity: Maturity.STABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/convert_patch.dart"),
    +  "core": const LibraryInfo("core/core.dart",
    +      categories: "Client,Server,Embedded",
    +      maturity: Maturity.STABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/core_patch.dart"),
    +  "developer": const LibraryInfo("developer/developer.dart",
    +      categories: "Client,Server,Embedded",
    +      maturity: Maturity.UNSTABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/developer_patch.dart"),
    +  "html": const LibraryInfo("html/dart2js/html_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.WEB_STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "html_common": const LibraryInfo("html/html_common/html_common.dart",
    +      categories: "Client",
    +      maturity: Maturity.WEB_STABLE,
    +      dart2jsPath: "html/html_common/html_common_dart2js.dart",
    +      documented: false,
    +      implementation: true),
    +  "indexed_db": const LibraryInfo("indexed_db/dart2js/indexed_db_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.WEB_STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "_http":
    +      const LibraryInfo("_http/http.dart", categories: "", documented: false),
    +  "io": const LibraryInfo("io/io.dart",
    +      categories: "Server",
    +      dart2jsPatchPath: "_internal/js_runtime/lib/io_patch.dart"),
    +  "isolate": const LibraryInfo("isolate/isolate.dart",
    +      categories: "Client,Server",
    +      maturity: Maturity.STABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/isolate_patch.dart"),
    +  "js": const LibraryInfo("js/dart2js/js_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "js_util": const LibraryInfo("js_util/dart2js/js_util_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "math": const LibraryInfo("math/math.dart",
    +      categories: "Client,Server,Embedded",
    +      maturity: Maturity.STABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/math_patch.dart"),
    +  "mirrors": const LibraryInfo("mirrors/mirrors.dart",
    +      categories: "Client,Server",
    +      maturity: Maturity.UNSTABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/mirrors_patch.dart"),
    +  "nativewrappers": const LibraryInfo("html/dartium/nativewrappers.dart",
    +      categories: "Client",
    +      implementation: true,
    +      documented: false,
    +      platforms: DART2JS_PLATFORM),
    +  "typed_data": const LibraryInfo("typed_data/typed_data.dart",
    +      categories: "Client,Server,Embedded",
    +      maturity: Maturity.STABLE,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/typed_data_patch.dart"),
    +  "_native_typed_data": const LibraryInfo(
    +      "_internal/js_runtime/lib/native_typed_data.dart",
    +      categories: "",
    +      implementation: true,
    +      documented: false,
    +      platforms: DART2JS_PLATFORM),
    +  "cli": const LibraryInfo("cli/cli.dart",
    +      categories: "Server",
    +      dart2jsPatchPath: "_internal/js_runtime/lib/cli_patch.dart"),
    +  "svg": const LibraryInfo("svg/dart2js/svg_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.WEB_STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "web_audio": const LibraryInfo("web_audio/dart2js/web_audio_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.WEB_STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "web_gl": const LibraryInfo("web_gl/dart2js/web_gl_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.WEB_STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "web_sql": const LibraryInfo("web_sql/dart2js/web_sql_dart2js.dart",
    +      categories: "Client",
    +      maturity: Maturity.WEB_STABLE,
    +      platforms: DART2JS_PLATFORM),
    +  "_internal": const LibraryInfo("internal/internal.dart",
    +      categories: "",
    +      documented: false,
    +      dart2jsPatchPath: "_internal/js_runtime/lib/internal_patch.dart"),
    +  "_js_helper": const LibraryInfo("_internal/js_runtime/lib/js_helper.dart",
    +      categories: "", documented: false, platforms: DART2JS_PLATFORM),
    +  "_interceptors": const LibraryInfo(
    +      "_internal/js_runtime/lib/interceptors.dart",
    +      categories: "",
    +      documented: false,
    +      platforms: DART2JS_PLATFORM),
    +  "_foreign_helper": const LibraryInfo(
    +      "_internal/js_runtime/lib/foreign_helper.dart",
    +      categories: "",
    +      documented: false,
    +      platforms: DART2JS_PLATFORM),
    +  "_isolate_helper": const LibraryInfo(
    +      "_internal/js_runtime/lib/isolate_helper.dart",
    +      categories: "",
    +      documented: false,
    +      platforms: DART2JS_PLATFORM),
    +  "_js_mirrors": const LibraryInfo("_internal/js_runtime/lib/js_mirrors.dart",
    +      categories: "", documented: false, platforms: DART2JS_PLATFORM),
    +  "_js_primitives": const LibraryInfo(
    +      "_internal/js_runtime/lib/js_primitives.dart",
    +      categories: "",
    +      documented: false,
    +      platforms: DART2JS_PLATFORM),
    +  "_metadata": const LibraryInfo("html/html_common/metadata.dart",
    +      categories: "", documented: false, platforms: DART2JS_PLATFORM),
    +  "_debugger": const LibraryInfo("_internal/js_runtime/lib/debugger.dart",
    +      category: "", documented: false, platforms: DART2JS_PLATFORM),
    +  "_runtime": const LibraryInfo(
    +      "_internal/js_runtime/lib/ddc_runtime/runtime.dart",
    +      category: "",
    +      documented: false,
    +      platforms: DART2JS_PLATFORM),
    +  "ui": const LibraryInfo("ui/ui.dart", documented: true, platforms:DART2JS_PLATFORM),
    +};
    +
    +/**
    + * Information about a "dart:" library.
    + */
    +class LibraryInfo {
    +  /**
    +   * Path to the library's *.dart file relative to this file.
    +   */
    +  final String path;
    +
    +  /**
    +   * The categories in which the library can be used encoded as a
    +   * comma-separated String.
    +   */
    +  final String _categories;
    +
    +  /**
    +   * Path to the dart2js library's *.dart file relative to this file
    +   * or null if dart2js uses the common library path defined above.
    +   * Access using the [#getDart2JsPath()] method.
    +   */
    +  final String dart2jsPath;
    +
    +  /**
    +   * Path to the dart2js library's patch file relative to this file
    +   * or null if no dart2js patch file associated with this library.
    +   * Access using the [#getDart2JsPatchPath()] method.
    +   */
    +  final String dart2jsPatchPath;
    +
    +  /**
    +   * True if this library is documented and should be shown to the user.
    +   */
    +  final bool documented;
    +
    +  /**
    +   * Bit flags indicating which platforms consume this library.
    +   * See [DART2JS_LIBRARY] and [VM_LIBRARY].
    +   */
    +  final int platforms;
    +
    +  /**
    +   * True if the library contains implementation details for another library.
    +   * The implication is that these libraries are less commonly used
    +   * and that tools like Dart Editor should not show these libraries
    +   * in a list of all libraries unless the user specifically asks the tool to
    +   * do so.
    +   */
    +  final bool implementation;
    +
    +  /**
    +   * States the current maturity of this library.
    +   */
    +  final Maturity maturity;
    +
    +  const LibraryInfo(this.path,
    +      {String categories: "",
    +      this.dart2jsPath,
    +      this.dart2jsPatchPath,
    +      this.implementation: false,
    +      this.documented: true,
    +      this.maturity: Maturity.UNSPECIFIED,
    +      this.platforms: DART2JS_PLATFORM | VM_PLATFORM})
    +      : _categories = categories;
    +
    +  bool get isDart2jsLibrary => (platforms & DART2JS_PLATFORM) != 0;
    +  bool get isVmLibrary => (platforms & VM_PLATFORM) != 0;
    +
    +  /**
    +   * The categories in which the library can be used.
    +   *
    +   * If no categories are specified, the library is internal and can not be
    +   * loaded by user code.
    +   */
    +  List get categories {
    +    // `"".split(,)` returns [""] not [], so we handle that case separately.
    +    if (_categories == "") return const [];
    +    return _categories.split(",").map(parseCategory).toList();
    +  }
    +
    +  bool get isInternal => categories.isEmpty;
    +
    +  /// The original "categories" String that was passed to the constructor.
    +  ///
    +  /// Can be used to construct a slightly modified copy of this LibraryInfo.
    +  String get categoriesString {
    +    return _categories;
    +  }
    +}
    +
    +/**
    + * Abstraction to capture the maturity of a library.
    + */
    +class Maturity {
    +  final int level;
    +  final String name;
    +  final String description;
    +
    +  const Maturity(this.level, this.name, this.description);
    +
    +  String toString() => "$name: $level\n$description\n";
    +
    +  static const Maturity DEPRECATED = const Maturity(0, "Deprecated",
    +      "This library will be remove before next major release.");
    +
    +  static const Maturity EXPERIMENTAL = const Maturity(
    +      1,
    +      "Experimental",
    +      "This library is experimental and will likely change or be removed\n"
    +      "in future versions.");
    +
    +  static const Maturity UNSTABLE = const Maturity(
    +      2,
    +      "Unstable",
    +      "This library is in still changing and have not yet endured\n"
    +      "sufficient real-world testing.\n"
    +      "Backwards-compatibility is NOT guaranteed.");
    +
    +  static const Maturity WEB_STABLE = const Maturity(
    +      3,
    +      "Web Stable",
    +      "This library is tracking the DOM evolution as defined by WC3.\n"
    +      "Backwards-compatibility is NOT guaranteed.");
    +
    +  static const Maturity STABLE = const Maturity(
    +      4,
    +      "Stable",
    +      "The library is stable. API backwards-compatibility is guaranteed.\n"
    +      "However implementation details might change.");
    +
    +  static const Maturity LOCKED = const Maturity(5, "Locked",
    +      "This library will not change except when serious bugs are encountered.");
    +
    +  static const Maturity UNSPECIFIED = const Maturity(-1, "Unspecified",
    +      "The maturity for this library has not been specified.");
    +}
    diff --git a/web_sdk/make_combined_sdk.dart b/web_sdk/make_combined_sdk.dart
    new file mode 100755
    index 0000000000000..435fb22174424
    --- /dev/null
    +++ b/web_sdk/make_combined_sdk.dart
    @@ -0,0 +1,120 @@
    +// Copyright 2013 The Flutter 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 'dart:io';
    +
    +import 'package:path/path.dart' as path;
    +import 'package:dev_compiler/src/analyzer/command.dart' as command; // ignore: uri_does_not_exist
    +
    +// Creates flutter precompiled web sdk and analyzer summary.
    +Future main() async {
    +  // create a temporary dart-sdk directory.
    +  final Directory tempDartSdk = Directory(path.join('temp_dart_sdk', 'lib'))
    +    ..createSync(recursive: true);
    +  final Directory patchedDartSdk = Directory(path.join(
    +      'gen', 'third_party', 'dart', 'utils', 'dartdevc', 'patched_sdk', 'lib'));
    +  final Directory flutterWebUi = Directory(path.join(
    +    'flutter_web_sdk',
    +    'lib',
    +    'ui',
    +  ));
    +
    +  // Copy this patched dart sdk into the temporary directory.
    +  for (FileSystemEntity entity in patchedDartSdk.listSync(recursive: true)) {
    +    if (entity is File) {
    +      final String targetPath = path.join(tempDartSdk.path,
    +          path.relative(entity.path, from: patchedDartSdk.path));
    +      File(targetPath).createSync(recursive: true);
    +      entity.copySync(path.join(tempDartSdk.path,
    +          path.relative(entity.path, from: patchedDartSdk.path)));
    +    }
    +  }
    +  // Copy the dart:ui sources into the temporary directory.
    +  for (FileSystemEntity entity in flutterWebUi.listSync(recursive: true)) {
    +    if (entity is File) {
    +      final String targetPath = path.join(tempDartSdk.path, 'ui',
    +          path.relative(entity.path, from: flutterWebUi.path));
    +      File(targetPath).createSync(recursive: true);
    +      entity.copySync(targetPath);
    +    }
    +  }
    +  // Copy the libraries.dart file into the temporary directory.
    +  final File libraries = File(path.join('..', '..', 'flutter', 'web_sdk', 'libraries.dart'));
    +  libraries.copySync(path.join(tempDartSdk.path, '_internal', 'libraries.dart'));
    +  libraries.copySync(path.join(tempDartSdk.path, '_internal', 'sdk_library_metadata', 'lib', 'libraries.dart'));
    +
    +  // Prevent regular compilation from leaking into flutter
    +  final File ddcSummary =
    +      File(path.join(tempDartSdk.path, '_internal', 'ddc_sdk.sum'));
    +  final File jsSdk =
    +      File(path.join(tempDartSdk.parent.path, 'js', 'amd', 'dart_sdk.js'));
    +  final File jsSdkMap =
    +      File(path.join(tempDartSdk.parent.path, 'js', 'amd', 'dart_sdk.js.map'));
    +  if (ddcSummary.existsSync()) {
    +    ddcSummary.deleteSync();
    +  }
    +  if (jsSdk.existsSync()) {
    +    jsSdk.deleteSync();
    +  }
    +  if (jsSdkMap.existsSync()) {
    +    jsSdkMap.deleteSync();
    +  }
    +
    +  // Execute the analyzer summary and sdk generation.
    +  final List args = ['--no-source-map', '--no-emit-metadata'];
    +  args.addAll([
    +    '--dart-sdk=temp_dart_sdk',
    +    '--dart-sdk-summary=build',
    +    '--summary-out=temp_dart_sdk/lib/_internal/ddc_sdk.sum',
    +    '--source-map',
    +    '--source-map-comment',
    +    '--modules=amd',
    +    '-o',
    +    'temp_dart_sdk/js/amd/dart_sdk.js'
    +  ]);
    +  args.addAll([
    +    'dart:_runtime',
    +    'dart:_debugger',
    +    'dart:_foreign_helper',
    +    'dart:_interceptors',
    +    'dart:_internal',
    +    'dart:_isolate_helper',
    +    'dart:_js_helper',
    +    'dart:_js_mirrors',
    +    'dart:_js_primitives',
    +    'dart:_metadata',
    +    'dart:_native_typed_data',
    +    'dart:async',
    +    'dart:collection',
    +    'dart:convert',
    +    'dart:core',
    +    'dart:developer',
    +    'dart:io',
    +    'dart:isolate',
    +    'dart:js',
    +    'dart:js_util',
    +    'dart:math',
    +    'dart:mirrors',
    +    'dart:typed_data',
    +    'dart:indexed_db',
    +    'dart:html',
    +    'dart:html_common',
    +    'dart:svg',
    +    'dart:web_audio',
    +    'dart:web_gl',
    +    'dart:web_sql',
    +    'dart:ui',
    +  ]);
    +  final int result = (await command.compile(args)).exitCode;
    +  if (result != 0) {
    +    throw 'SDK generation failed with exit code $result';
    +  }
    +
    +  // Copy generated sdk and summary back to flutter web sdk.
    +  ddcSummary.copySync(
    +      path.join('flutter_web_sdk', 'lib', '_internal', 'ddc_sdk.sum'));
    +  jsSdk.copySync(path.join('flutter_web_sdk', 'js', 'amd', 'dart_sdk.js'));
    +  jsSdkMap
    +      .copySync(path.join('flutter_web_sdk', 'js', 'amd', 'dart_sdk.js.map'));
    +}
    diff --git a/web_sdk/make_combined_sdk.sh b/web_sdk/make_combined_sdk.sh
    deleted file mode 100755
    index 06b673baba8a2..0000000000000
    --- a/web_sdk/make_combined_sdk.sh
    +++ /dev/null
    @@ -1,16 +0,0 @@
    -#!/bin/bash
    -
    -# Reference script for creating patched sdk locally.
    -# Copy normal dart sources into flutter_patched sdk
    -mkdir -p out/host_debug_unopt/flutter_patched_sdk/lib
    -cp -RL out/host_debug_unopt/dart-sdk/lib/ out/host_debug_unopt/flutter_patched_sdk/lib
    -
    -# Copy stub ui dart sources into flutter_patched sdk
    -mkdir -p out/host_debug_unopt/flutter_patched_sdk/lib/ui
    -cp -RL flutter/lib/stub_ui/ out/host_debug_unopt/flutter_patched_sdk/lib/ui
    -
    -# Copy libraries.json into flutter patched sdk.
    -cp -RL flutter/flutter_web/libraries.json out/host_debug_unopt/flutter_patched_sdk/lib/libraries.json
    -
    -# Copy libraries.dart into flutter patched sdk
    -cp -RL flutter/flutter_web/libraries.dart out/host_debug_unopt/flutter_patched_sdk/lib/_internal/libraries.dart
    
    From 82765aa77db9621dfbc50801ee2709aa0a00e04d Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Thu, 28 Mar 2019 15:59:49 -0400
    Subject: [PATCH 0614/1117] Roll src/third_party/skia
     05be23dbd3c4..cc8c7bee7925 (11 commits) (#8356)
    
    https://skia.googlesource.com/skia.git/%2Blog/05be23dbd3c4..cc8c7bee7925
    
    git log 05be23dbd3c4565cb23744c154df80b0ebc0208a..cc8c7bee792573f8e9dc108236d3af7621ad4f49 --date=short --no-merges --format=%ad %ae %s
    2019-03-28 reed@google.com add bench for colorfilter-mixer
    2019-03-28 fmalita@chromium.org [skottie] Compute tight bounds in skottie::Shaper
    2019-03-21 martin@mainframe.co.uk fix metal build errors with preprocessor definitions
    2019-03-28 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    2019-03-28 nifong@google.com changes to wasm debugger for UI integration
    2019-03-28 kjlubick@google.com Support WebGL 1.0 with caps
    2019-03-28 kjlubick@google.com Add gen_interface to CheckGeneratedFiles check
    2019-03-28 bungeman@google.com SkTLazy constructors to require constructable.
    2019-03-28 brianosman@google.com Improve color space logic in read/writeSurfacePixels
    2019-03-28 kjlubick@google.com Add test_only option to gen_interface
    2019-03-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 94f195b18776..0839cbda698f (2 commits)
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 3 ++-
     2 files changed, 3 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index c0d835e8ce03f..411a7b3789b68 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': '05be23dbd3c4565cb23744c154df80b0ebc0208a',
    +  'skia_revision': 'cc8c7bee792573f8e9dc108236d3af7621ad4f49',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 40e1a0213648d..32d58b05cf7cf 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 0a9088015e0d2542676c0da7061ae844
    +Signature: 9594aaa1f315c34c2f81231b4e21e6b8
     
     UNUSED LICENSES:
     
    @@ -5840,6 +5840,7 @@ FILE: ../../../third_party/skia/src/core/SkColorFilterPriv.h
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleGLESInterfaceAutogen.cpp
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleGLInterfaceAutogen.cpp
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleHelpers.cpp
    +FILE: ../../../third_party/skia/src/gpu/gl/GrGLAssembleWebGLInterfaceAutogen.cpp
     FILE: ../../../third_party/skia/src/sksl/SkSLByteCode.h
     FILE: ../../../third_party/skia/src/sksl/SkSLByteCodeGenerator.cpp
     FILE: ../../../third_party/skia/src/sksl/SkSLByteCodeGenerator.h
    
    From b53e436f914fb0200fec962362995ebcc1c2984b Mon Sep 17 00:00:00 2001
    From: Ben Konyi 
    Date: Thu, 28 Mar 2019 13:00:20 -0700
    Subject: [PATCH 0615/1117] Roll src/third_party/dart a977273262..f29e100f42 (8
     commits)
    
    f29e100f42 [dart/fuzzer] Generate DartFuzz API tables automatically
    f0027dfea3 [CFE] JS number semantics for constant subtype checks.
    018fd36557 [CFE] Handle spread and if in const map literals.
    b5be157e09 [CFE] Handle spread and if in const set literals.
    0b57b67ecb [CFE] Move const set desugaring to constant evaluator.
    102b1fa39e [CFE] Handle spread and if in const list literals.
    8611cbf7df [CFE] Add constant update flag to collection tests.
    665d2d0003 [CFE] Leave const collections to the constant evaluator.
    ---
     DEPS                                    | 2 +-
     ci/licenses_golden/licenses_third_party | 4 +++-
     2 files changed, 4 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 411a7b3789b68..14f13d0ba4c86 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -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': 'a977273262343d8fa2f8c5ae268be391f6087e30',
    +  'dart_revision': 'f29e100f42f49cae1cb535d807955fc1503b0d80',
     
       # WARNING: DO NOT EDIT MANUALLY
       # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
    diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party
    index c1da59b9aaf3e..5174e693ccd46 100644
    --- a/ci/licenses_golden/licenses_third_party
    +++ b/ci/licenses_golden/licenses_third_party
    @@ -1,4 +1,4 @@
    -Signature: 7fd62bb67d412c7e900c9f47816f1440
    +Signature: 94e50e38cee32854b41f95fc588edc59
     
     UNUSED LICENSES:
     
    @@ -5137,6 +5137,8 @@ FILE: ../../../third_party/dart/runtime/lib/ffi_dynamic_library.cc
     FILE: ../../../third_party/dart/runtime/lib/ffi_dynamic_library_patch.dart
     FILE: ../../../third_party/dart/runtime/lib/ffi_native_type_patch.dart
     FILE: ../../../third_party/dart/runtime/lib/ffi_patch.dart
    +FILE: ../../../third_party/dart/runtime/tools/dartfuzz/dartfuzz_api_table.dart
    +FILE: ../../../third_party/dart/runtime/tools/dartfuzz/gen_api_table.dart
     FILE: ../../../third_party/dart/runtime/tools/graphexplorer/graphexplorer.html
     FILE: ../../../third_party/dart/runtime/tools/graphexplorer/graphexplorer.js
     FILE: ../../../third_party/dart/runtime/vm/catch_entry_moves_test.cc
    
    From 602b6121358b507193f2d13f62aa91e71b03c296 Mon Sep 17 00:00:00 2001
    From: Michael Klimushyn 
    Date: Thu, 28 Mar 2019 14:05:37 -0700
    Subject: [PATCH 0616/1117] Reduce z-fighting on Scenic (#8318)
    
    Previously the engine was creating multiple `ShapeNode`s all underneath
    the same root `EntityNode` at local space z=0. This caused frequent
    z-fighting within Flutter layers.
    
    This patch updates the engine to only create one ShapeNode per
    EntityNode, which fixes the z-fighting independent of layer elevation.
    Z-fighting is still possible from actually setting multiple layers to
    the same z in world space using Flutter elevation.
    
    flutter/flutter#25226
    ---
     flow/scene_update_context.cc | 55 +++++++++++-------------------------
     flow/scene_update_context.h  |  7 +++++
     2 files changed, 23 insertions(+), 39 deletions(-)
    
    diff --git a/flow/scene_update_context.cc b/flow/scene_update_context.cc
    index d0e9f5b930b69..c663d5633e17c 100644
    --- a/flow/scene_update_context.cc
    +++ b/flow/scene_update_context.cc
    @@ -81,6 +81,7 @@ static void SetEntityNodeClipPlanes(scenic::EntityNode* entity_node,
     
     void SceneUpdateContext::CreateFrame(
         std::unique_ptr entity_node,
    +    std::unique_ptr shape_node,
         const SkRRect& rrect,
         SkColor color,
         const SkRect& paint_bounds,
    @@ -108,13 +109,10 @@ void SceneUpdateContext::CreateFrame(
           rrect.radii(SkRRect::kLowerRight_Corner).x(),  // bottom_right_radius
           rrect.radii(SkRRect::kLowerLeft_Corner).x()    // bottom_left_radius
       );
    -  scenic::ShapeNode shape_node(session_);
    -  shape_node.SetShape(shape);
    -  shape_node.SetTranslation(shape_bounds.width() * 0.5f + shape_bounds.left(),
    -                            shape_bounds.height() * 0.5f + shape_bounds.top(),
    -                            0.f);
    -  // TODO(SCN-1274): AddPart() and SetClip() will be deleted.
    -  entity_node->AddPart(shape_node);
    +  shape_node->SetShape(shape);
    +  shape_node->SetTranslationRH(
    +      shape_bounds.width() * 0.5f + shape_bounds.left(),
    +      shape_bounds.height() * 0.5f + shape_bounds.top(), 0.f);
     
       // Check whether the painted layers will be visible.
       if (paint_bounds.isEmpty() || !paint_bounds.intersects(shape_bounds))
    @@ -122,7 +120,7 @@ void SceneUpdateContext::CreateFrame(
     
       // Check whether a solid color will suffice.
       if (paint_layers.empty()) {
    -    SetShapeColor(shape_node, color);
    +    SetShapeColor(*shape_node, color);
         return;
       }
     
    @@ -130,29 +128,8 @@ void SceneUpdateContext::CreateFrame(
       const float scale_x = ScaleX();
       const float scale_y = ScaleY();
     
    -  // If the painted area only covers a portion of the frame then we can
    -  // reduce the texture size by drawing just that smaller area.
    -  SkRect inner_bounds = shape_bounds;
    -  inner_bounds.intersect(paint_bounds);
    -  if (inner_bounds != shape_bounds && rrect.contains(inner_bounds)) {
    -    SetShapeColor(shape_node, color);
    -
    -    scenic::Rectangle inner_shape(session_, inner_bounds.width(),
    -                                  inner_bounds.height());
    -    scenic::ShapeNode inner_node(session_);
    -    inner_node.SetShape(inner_shape);
    -    inner_node.SetTranslation(inner_bounds.width() * 0.5f + inner_bounds.left(),
    -                              inner_bounds.height() * 0.5f + inner_bounds.top(),
    -                              0.f);
    -    entity_node->AddPart(inner_node);
    -    SetShapeTextureOrColor(inner_node, color, scale_x, scale_y, inner_bounds,
    -                           std::move(paint_layers), layer,
    -                           std::move(entity_node));
    -    return;
    -  }
    -
       // Apply a texture to the whole shape.
    -  SetShapeTextureOrColor(shape_node, color, scale_x, scale_y, shape_bounds,
    +  SetShapeTextureOrColor(*shape_node, color, scale_x, scale_y, shape_bounds,
                              std::move(paint_layers), layer,
                              std::move(entity_node));
     }
    @@ -266,6 +243,9 @@ SceneUpdateContext::ExecutePaintTasks(CompositorContext::ScopedFrame& frame) {
     SceneUpdateContext::Entity::Entity(SceneUpdateContext& context)
         : context_(context), previous_entity_(context.top_entity_) {
       entity_node_ptr_ = std::make_unique(context.session());
    +  shape_node_ptr_ = std::make_unique(context.session());
    +  // TODO(SCN-1274): AddPart() and SetClip() will be deleted.
    +  entity_node_ptr_->AddPart(*shape_node_ptr_);
       if (previous_entity_)
         previous_entity_->entity_node_ptr_->AddChild(*entity_node_ptr_);
       context.top_entity_ = this;
    @@ -280,14 +260,10 @@ SceneUpdateContext::Clip::Clip(SceneUpdateContext& context,
                                    scenic::Shape& shape,
                                    const SkRect& shape_bounds)
         : Entity(context) {
    -  scenic::ShapeNode shape_node(context.session());
    -  shape_node.SetShape(shape);
    -  shape_node.SetTranslation(shape_bounds.width() * 0.5f + shape_bounds.left(),
    -                            shape_bounds.height() * 0.5f + shape_bounds.top(),
    -                            0.f);
    -
    -  // TODO(SCN-1274): AddPart() and SetClip() will be deleted.
    -  entity_node().AddPart(shape_node);
    +  shape_node().SetShape(shape);
    +  shape_node().SetTranslationRH(
    +      shape_bounds.width() * 0.5f + shape_bounds.left(),
    +      shape_bounds.height() * 0.5f + shape_bounds.top(), 0.f);
       entity_node().SetClip(0u, true /* clip to self */);
     
       SetEntityNodeClipPlanes(&entity_node(), shape_bounds);
    @@ -360,7 +336,8 @@ SceneUpdateContext::Frame::Frame(SceneUpdateContext& context,
     }
     
     SceneUpdateContext::Frame::~Frame() {
    -  context().CreateFrame(std::move(entity_node_ptr()), rrect_, color_,
    +  context().CreateFrame(std::move(entity_node_ptr()),
    +                        std::move(shape_node_ptr()), rrect_, color_,
                             paint_bounds_, std::move(paint_layers_), layer_);
     }
     
    diff --git a/flow/scene_update_context.h b/flow/scene_update_context.h
    index 378af4211d507..def6d441547b5 100644
    --- a/flow/scene_update_context.h
    +++ b/flow/scene_update_context.h
    @@ -80,11 +80,17 @@ class SceneUpdateContext {
           return entity_node_ptr_;
         }
     
    +    scenic::ShapeNode& shape_node() { return *shape_node_ptr_; }
    +    std::unique_ptr& shape_node_ptr() {
    +      return shape_node_ptr_;
    +    }
    +
        private:
         SceneUpdateContext& context_;
         Entity* const previous_entity_;
     
         std::unique_ptr entity_node_ptr_;
    +    std::unique_ptr shape_node_ptr_;
       };
     
       class Clip : public Entity {
    @@ -202,6 +208,7 @@ class SceneUpdateContext {
       // surface (and thus the entity_node) will be retained for that layer to
       // improve the performance.
       void CreateFrame(std::unique_ptr entity_node,
    +                   std::unique_ptr shape_node,
                        const SkRRect& rrect,
                        SkColor color,
                        const SkRect& paint_bounds,
    
    From 09a67fe6035cc04ad77173f0c7b59ec16fc6943f Mon Sep 17 00:00:00 2001
    From: Christopher Fujino 
    Date: Thu, 28 Mar 2019 14:24:42 -0700
    Subject: [PATCH 0617/1117] update buildroot dep for
     https://github.com/flutter/buildroot/commit/e2ca4571fa39be20ab1bf67c65d4700612756af2
     (#8359)
    
    ---
     DEPS | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/DEPS b/DEPS
    index 14f13d0ba4c86..6a4dc07df587d 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -121,7 +121,7 @@ allowed_hosts = [
     ]
     
     deps = {
    -  'src': 'https://github.com/flutter/buildroot.git' + '@' + 'ad098fcdb1b41fcf57c22e46e898d0dc04d3a178',
    +  'src': 'https://github.com/flutter/buildroot.git' + '@' + 'e2ca4571fa39be20ab1bf67c65d4700612756af2',
     
        # Fuchsia compatibility
        #
    
    From 96c9751638aebe02be03272a95960f51897ccc63 Mon Sep 17 00:00:00 2001
    From: liyuqian 
    Date: Thu, 28 Mar 2019 14:37:00 -0700
    Subject: [PATCH 0618/1117] Rename threshold to access_threshold (#8354)
    
    ---
     flow/raster_cache.cc | 11 ++++++-----
     flow/raster_cache.h  |  4 ++--
     2 files changed, 8 insertions(+), 7 deletions(-)
    
    diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc
    index 9f10e47de250c..73271ea6bafc0 100644
    --- a/flow/raster_cache.cc
    +++ b/flow/raster_cache.cc
    @@ -36,8 +36,9 @@ void RasterCacheResult::draw(SkCanvas& canvas, const SkPaint* paint) const {
       canvas.drawImage(image_, bounds.fLeft, bounds.fTop, paint);
     }
     
    -RasterCache::RasterCache(size_t threshold, size_t picture_cache_limit_per_frame)
    -    : threshold_(threshold),
    +RasterCache::RasterCache(size_t access_threshold,
    +                         size_t picture_cache_limit_per_frame)
    +    : access_threshold_(access_threshold),
           picture_cache_limit_per_frame_(picture_cache_limit_per_frame),
           checkerboard_images_(false),
           weak_factory_(this) {}
    @@ -152,7 +153,7 @@ void RasterCache::Prepare(PrerollContext* context,
                               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.access_count = ClampSize(entry.access_count + 1, 0, access_threshold_);
       entry.used_this_frame = true;
       if (!entry.image.is_valid()) {
         entry.image = Rasterize(context->gr_context, ctm, context->dst_color_space,
    @@ -204,10 +205,10 @@ bool RasterCache::Prepare(GrContext* context,
       PictureRasterCacheKey cache_key(picture->uniqueID(), transformation_matrix);
     
       Entry& entry = picture_cache_[cache_key];
    -  entry.access_count = ClampSize(entry.access_count + 1, 0, threshold_);
    +  entry.access_count = ClampSize(entry.access_count + 1, 0, access_threshold_);
       entry.used_this_frame = true;
     
    -  if (entry.access_count < threshold_ || threshold_ == 0) {
    +  if (entry.access_count < access_threshold_ || access_threshold_ == 0) {
         // Frame threshold has not yet been reached.
         return false;
       }
    diff --git a/flow/raster_cache.h b/flow/raster_cache.h
    index f0382c9c92872..1042e2cd7d464 100644
    --- a/flow/raster_cache.h
    +++ b/flow/raster_cache.h
    @@ -53,7 +53,7 @@ class RasterCache {
       static constexpr int kDefaultPictureCacheLimitPerFrame = 3;
     
       explicit RasterCache(
    -      size_t threshold = 3,
    +      size_t access_threshold = 3,
           size_t picture_cache_limit_per_frame = kDefaultPictureCacheLimitPerFrame);
     
       ~RasterCache();
    @@ -124,7 +124,7 @@ class RasterCache {
         }
       }
     
    -  const size_t threshold_;
    +  const size_t access_threshold_;
       const size_t picture_cache_limit_per_frame_;
       size_t picture_cached_this_frame_ = 0;
       PictureRasterCacheKey::Map picture_cache_;
    
    From fd0b4404500373a9eb6723033d236fc2b7009938 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Thu, 28 Mar 2019 19:30:49 -0400
    Subject: [PATCH 0619/1117] Roll src/third_party/skia
     cc8c7bee7925..01fe26360660 (10 commits) (#8361)
    
    https://skia.googlesource.com/skia.git/%2Blog/cc8c7bee7925..01fe26360660
    
    git log cc8c7bee792573f8e9dc108236d3af7621ad4f49..01fe263606601d5a95272e3bdf086cb2b85e2d74 --date=short --no-merges --format=%ad %ae %s
    2019-03-28 fmalita@chromium.org [skottie] Add support for BodyMovin 5.5.0 keyframes
    2019-03-28 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    2019-03-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 4aa9bf12f7e0..48b3587f8ea4 (1 commits)
    2019-03-28 stani@google.com Add API to get canvas wrapped by SkPaintFilterCanvas
    2019-03-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader a563dd8c5734..4aa9bf12f7e0 (1 commits)
    2019-03-28 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    2019-03-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 0839cbda698f..a563dd8c5734 (2 commits)
    2019-03-28 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    2019-03-28 robertphillips@google.com Remove unused PixelOpsFlags values
    2019-03-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 e810ad90799c..8116d646b3f8 (6 commits)
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 6a4dc07df587d..e898a6c73af8c 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': 'cc8c7bee792573f8e9dc108236d3af7621ad4f49',
    +  'skia_revision': '01fe263606601d5a95272e3bdf086cb2b85e2d74',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 32d58b05cf7cf..d1aad87913d25 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 9594aaa1f315c34c2f81231b4e21e6b8
    +Signature: 77ab967c8382fbcd87c6ff26b71567f4
     
     UNUSED LICENSES:
     
    
    From 23e0c3758fcfb1b1ee731d29d0e869106b7c4e0a Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Thu, 28 Mar 2019 22:57:49 -0400
    Subject: [PATCH 0620/1117] Roll src/third_party/skia
     01fe26360660..bf4229cc10a1 (6 commits) (#8363)
    
    https://skia.googlesource.com/skia.git/%2Blog/01fe26360660..bf4229cc10a1
    
    git log 01fe263606601d5a95272e3bdf086cb2b85e2d74..bf4229cc10a10db751284d8d8d067287cfe8b542 --date=short --no-merges --format=%ad %ae %s
    2019-03-28 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    2019-03-29 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 37628f09a4c5..c9d98716d2e7 (1 commits)
    2019-03-28 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    2019-03-28 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    2019-03-28 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 48b3587f8ea4..37628f09a4c5 (1 commits)
    2019-03-28 fmalita@chromium.org [skottie] Tweak Shaper test tolerances to fix NativeFonts bots
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index e898a6c73af8c..b6eb95c791d7c 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': '01fe263606601d5a95272e3bdf086cb2b85e2d74',
    +  'skia_revision': 'bf4229cc10a10db751284d8d8d067287cfe8b542',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index d1aad87913d25..5654fbb782d5e 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 77ab967c8382fbcd87c6ff26b71567f4
    +Signature: 2f5bdb6506c007179d610c6ec328c379
     
     UNUSED LICENSES:
     
    
    From 9729f1ae3e3c99569c33f367a79314a6fce1fb45 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Fri, 29 Mar 2019 02:21:40 -0400
    Subject: [PATCH 0621/1117] Roll src/third_party/skia
     bf4229cc10a1..57b7a792bb6f (5 commits) (#8364)
    
    https://skia.googlesource.com/skia.git/%2Blog/bf4229cc10a1..57b7a792bb6f
    
    git log bf4229cc10a10db751284d8d8d067287cfe8b542..57b7a792bb6f098690243be62f851384c6a9a179 --date=short --no-merges --format=%ad %ae %s
    2019-03-29 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset
    2019-03-29 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src eb8d3bc0b607..871828938944 (487 commits)
    2019-03-29 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 8116d646b3f8..6446c8882fa3 (3 commits)
    2019-03-29 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader fc8a46d0af96..51562f15f4ad (1 commits)
    2019-03-29 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader c9d98716d2e7..fc8a46d0af96 (1 commits)
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index b6eb95c791d7c..c663aaf1633a0 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': 'bf4229cc10a10db751284d8d8d067287cfe8b542',
    +  'skia_revision': '57b7a792bb6f098690243be62f851384c6a9a179',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 5654fbb782d5e..6549b21a3c3da 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 2f5bdb6506c007179d610c6ec328c379
    +Signature: e3f89d5caceec6b6a3ac58eb0e18b301
     
     UNUSED LICENSES:
     
    
    From ada0a8e2b1b0a9fda888df47926c07d36433489f Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Fri, 29 Mar 2019 05:49:49 -0400
    Subject: [PATCH 0622/1117] Roll src/third_party/skia
     57b7a792bb6f..a2cec203eea8 (1 commits) (#8365)
    
    https://skia.googlesource.com/skia.git/%2Blog/57b7a792bb6f..a2cec203eea8
    
    git log 57b7a792bb6f098690243be62f851384c6a9a179..a2cec203eea8d866ccd4e3d71f060f36210e3e1b --date=short --no-merges --format=%ad %ae %s
    2019-03-28 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index c663aaf1633a0..f709fd355eeb4 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': '57b7a792bb6f098690243be62f851384c6a9a179',
    +  'skia_revision': 'a2cec203eea8d866ccd4e3d71f060f36210e3e1b',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 6549b21a3c3da..c9cb1ff28f8d5 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: e3f89d5caceec6b6a3ac58eb0e18b301
    +Signature: 3edf6264970224873aac77187e0c78ce
     
     UNUSED LICENSES:
     
    
    From 65837ab32cf777b05bba2cd23fac44bdc0bb726f Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Fri, 29 Mar 2019 09:19:49 -0400
    Subject: [PATCH 0623/1117] Roll src/third_party/skia
     a2cec203eea8..84a53268af92 (1 commits) (#8366)
    
    https://skia.googlesource.com/skia.git/%2Blog/a2cec203eea8..84a53268af92
    
    git log a2cec203eea8d866ccd4e3d71f060f36210e3e1b..84a53268af92ca5a620c000a6199513350fdde36 --date=short --no-merges --format=%ad %ae %s
    2019-03-29 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 51562f15f4ad..5bb034db6243 (1 commits)
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index f709fd355eeb4..f776fb915383c 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': 'a2cec203eea8d866ccd4e3d71f060f36210e3e1b',
    +  'skia_revision': '84a53268af92ca5a620c000a6199513350fdde36',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index c9cb1ff28f8d5..f442a870d002e 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 3edf6264970224873aac77187e0c78ce
    +Signature: ea28935b3eb5f75f692aab54be3e904b
     
     UNUSED LICENSES:
     
    
    From 3de50b8d2e4a37344617a294a37ddebc5408c965 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Fri, 29 Mar 2019 12:48:59 -0400
    Subject: [PATCH 0624/1117] Roll src/third_party/skia
     84a53268af92..7eeb74fdfd84 (3 commits) (#8367)
    
    https://skia.googlesource.com/skia.git/%2Blog/84a53268af92..7eeb74fdfd84
    
    git log 84a53268af92ca5a620c000a6199513350fdde36..7eeb74fdfd8453b4fc0f0460ade48d4097444043 --date=short --no-merges --format=%ad %ae %s
    2019-03-29 robertphillips@google.com Add checks that the GrResourceAllocator is operating as expected
    2019-03-29 bungeman@google.com Update SkTLazy includes.
    2019-03-29 jvanverth@google.com Reland "Reland "Fix blurry edges on large ovals.""
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index f776fb915383c..73285325cb380 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': '84a53268af92ca5a620c000a6199513350fdde36',
    +  'skia_revision': '7eeb74fdfd8453b4fc0f0460ade48d4097444043',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index f442a870d002e..c56a9f826c842 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: ea28935b3eb5f75f692aab54be3e904b
    +Signature: cfb7f9511f3794178134f66e60c0510e
     
     UNUSED LICENSES:
     
    
    From 6d1a6a4f470f762b5e56670b2f7d2c4836904314 Mon Sep 17 00:00:00 2001
    From: Jason Simmons 
    Date: Fri, 29 Mar 2019 09:52:29 -0700
    Subject: [PATCH 0625/1117] Allow per-platform customization of the default
     Skia font manager (#8358)
    
    The font manager returned by SkFontMgr::RefDefault is determined by Skia's
    build configuration flags.  Embedders may want to use a default font manager
    other than the one selected by their build of Skia.
    ---
     ci/licenses_golden/licenses_flutter         |  1 +
     lib/ui/text/font_collection.cc              |  2 +-
     third_party/txt/BUILD.gn                    |  2 ++
     third_party/txt/src/txt/font_collection.cc  |  4 ++--
     third_party/txt/src/txt/font_collection.h   |  2 +-
     third_party/txt/src/txt/platform.cc         |  4 ++++
     third_party/txt/src/txt/platform.h          |  4 ++++
     third_party/txt/src/txt/platform_android.cc |  4 ++++
     third_party/txt/src/txt/platform_linux.cc   | 19 +++++++++++++++++++
     third_party/txt/src/txt/platform_mac.mm     |  4 ++++
     10 files changed, 42 insertions(+), 4 deletions(-)
     create mode 100644 third_party/txt/src/txt/platform_linux.cc
    
    diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter
    index 3965f74fb967e..09b0fa1005509 100644
    --- a/ci/licenses_golden/licenses_flutter
    +++ b/ci/licenses_golden/licenses_flutter
    @@ -711,6 +711,7 @@ 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_linux.cc
     FILE: ../../../flutter/third_party/txt/src/txt/platform_mac.mm
     FILE: ../../../flutter/vulkan/skia_vulkan_header.h
     FILE: ../../../flutter/vulkan/vulkan_application.cc
    diff --git a/lib/ui/text/font_collection.cc b/lib/ui/text/font_collection.cc
    index 3f41f6457c83e..55e95df96740b 100644
    --- a/lib/ui/text/font_collection.cc
    +++ b/lib/ui/text/font_collection.cc
    @@ -46,7 +46,7 @@ void _LoadFontFromList(Dart_NativeArguments args) {
     
     FontCollection::FontCollection()
         : collection_(std::make_shared()) {
    -  collection_->SetDefaultFontManager(SkFontMgr::RefDefault());
    +  collection_->SetupDefaultFontManager();
     
       dynamic_font_manager_ = sk_make_sp();
       collection_->SetDynamicFontManager(dynamic_font_manager_);
    diff --git a/third_party/txt/BUILD.gn b/third_party/txt/BUILD.gn
    index a6a4bd82d170d..af05631f7d137 100644
    --- a/third_party/txt/BUILD.gn
    +++ b/third_party/txt/BUILD.gn
    @@ -123,6 +123,8 @@ source_set("txt") {
         deps += [ "$flutter_root/fml" ]
       } else if (is_android) {
         sources += [ "src/txt/platform_android.cc" ]
    +  } else if (is_linux) {
    +    sources += [ "src/txt/platform_linux.cc" ]
       } else {
         sources += [ "src/txt/platform.cc" ]
       }
    diff --git a/third_party/txt/src/txt/font_collection.cc b/third_party/txt/src/txt/font_collection.cc
    index ff687726ebed9..d1bd02ed748d8 100644
    --- a/third_party/txt/src/txt/font_collection.cc
    +++ b/third_party/txt/src/txt/font_collection.cc
    @@ -87,8 +87,8 @@ size_t FontCollection::GetFontManagersCount() const {
       return GetFontManagerOrder().size();
     }
     
    -void FontCollection::SetDefaultFontManager(sk_sp font_manager) {
    -  default_font_manager_ = font_manager;
    +void FontCollection::SetupDefaultFontManager() {
    +  default_font_manager_ = GetDefaultFontManager();
     }
     
     void FontCollection::SetAssetFontManager(sk_sp font_manager) {
    diff --git a/third_party/txt/src/txt/font_collection.h b/third_party/txt/src/txt/font_collection.h
    index c98b4d29ca05d..e7fb842933d66 100644
    --- a/third_party/txt/src/txt/font_collection.h
    +++ b/third_party/txt/src/txt/font_collection.h
    @@ -40,7 +40,7 @@ class FontCollection : public std::enable_shared_from_this {
     
       size_t GetFontManagersCount() const;
     
    -  void SetDefaultFontManager(sk_sp font_manager);
    +  void SetupDefaultFontManager();
       void SetAssetFontManager(sk_sp font_manager);
       void SetDynamicFontManager(sk_sp font_manager);
       void SetTestFontManager(sk_sp font_manager);
    diff --git a/third_party/txt/src/txt/platform.cc b/third_party/txt/src/txt/platform.cc
    index 411e96f0f4b9c..41831870d5335 100644
    --- a/third_party/txt/src/txt/platform.cc
    +++ b/third_party/txt/src/txt/platform.cc
    @@ -10,4 +10,8 @@ std::string GetDefaultFontFamily() {
       return "Arial";
     }
     
    +sk_sp GetDefaultFontManager() {
    +  return SkFontMgr::RefDefault();
    +}
    +
     }  // namespace txt
    diff --git a/third_party/txt/src/txt/platform.h b/third_party/txt/src/txt/platform.h
    index d45be43b0392a..3df3433011ea2 100644
    --- a/third_party/txt/src/txt/platform.h
    +++ b/third_party/txt/src/txt/platform.h
    @@ -8,10 +8,14 @@
     #include 
     #include "flutter/fml/macros.h"
     
    +#include "third_party/skia/include/core/SkFontMgr.h"
    +
     namespace txt {
     
     std::string GetDefaultFontFamily();
     
    +sk_sp GetDefaultFontManager();
    +
     }  // namespace txt
     
     #endif  // TXT_PLATFORM_H_
    diff --git a/third_party/txt/src/txt/platform_android.cc b/third_party/txt/src/txt/platform_android.cc
    index 600d3d5ccfd9e..ae7fa2c77ec2c 100644
    --- a/third_party/txt/src/txt/platform_android.cc
    +++ b/third_party/txt/src/txt/platform_android.cc
    @@ -10,4 +10,8 @@ std::string GetDefaultFontFamily() {
       return "sans-serif";
     }
     
    +sk_sp GetDefaultFontManager() {
    +  return SkFontMgr::RefDefault();
    +}
    +
     }  // namespace txt
    diff --git a/third_party/txt/src/txt/platform_linux.cc b/third_party/txt/src/txt/platform_linux.cc
    new file mode 100644
    index 0000000000000..b95d00a597c7d
    --- /dev/null
    +++ b/third_party/txt/src/txt/platform_linux.cc
    @@ -0,0 +1,19 @@
    +// Copyright 2013 The Flutter 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 "txt/platform.h"
    +
    +#include "third_party/skia/include/ports/SkFontMgr_directory.h"
    +
    +namespace txt {
    +
    +std::string GetDefaultFontFamily() {
    +  return "Arial";
    +}
    +
    +sk_sp GetDefaultFontManager() {
    +  return SkFontMgr_New_Custom_Directory("/usr/share/fonts/");
    +}
    +
    +}  // namespace txt
    diff --git a/third_party/txt/src/txt/platform_mac.mm b/third_party/txt/src/txt/platform_mac.mm
    index 423edddd97c07..3dce7b6ca3954 100644
    --- a/third_party/txt/src/txt/platform_mac.mm
    +++ b/third_party/txt/src/txt/platform_mac.mm
    @@ -24,4 +24,8 @@
       }
     }
     
    +sk_sp GetDefaultFontManager() {
    +  return SkFontMgr::RefDefault();
    +}
    +
     }  // namespace txt
    
    From 82c9104143d8c73c7c91468653ca3e41601b2259 Mon Sep 17 00:00:00 2001
    From: Craig Stout 
    Date: Thu, 28 Mar 2019 14:28:37 -0700
    Subject: [PATCH 0626/1117] Remove old Fuchsia external mem,sem extensions
    
    ---
     vulkan/vulkan_device.cc     | 2 --
     vulkan/vulkan_proc_table.cc | 2 --
     vulkan/vulkan_proc_table.h  | 2 --
     3 files changed, 6 deletions(-)
    
    diff --git a/vulkan/vulkan_device.cc b/vulkan/vulkan_device.cc
    index 3be8c340cdaaa..a69e4712b0652 100644
    --- a/vulkan/vulkan_device.cc
    +++ b/vulkan/vulkan_device.cc
    @@ -63,10 +63,8 @@ VulkanDevice::VulkanDevice(VulkanProcTable& p_vk,
     #endif
     #if OS_FUCHSIA
         VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME,
    -    VK_KHR_EXTERNAL_MEMORY_FUCHSIA_EXTENSION_NAME,
         VK_FUCHSIA_EXTERNAL_MEMORY_EXTENSION_NAME,
         VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME,
    -    VK_KHR_EXTERNAL_SEMAPHORE_FUCHSIA_EXTENSION_NAME,
         VK_FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME,
     #endif
       };
    diff --git a/vulkan/vulkan_proc_table.cc b/vulkan/vulkan_proc_table.cc
    index 7b551f3d55003..4b106fb370833 100644
    --- a/vulkan/vulkan_proc_table.cc
    +++ b/vulkan/vulkan_proc_table.cc
    @@ -137,8 +137,6 @@ bool VulkanProcTable::SetupDeviceProcAddresses(
       ACQUIRE_PROC(QueuePresentKHR, handle);
     #endif  // OS_ANDROID
     #if OS_FUCHSIA
    -  ACQUIRE_PROC(GetMemoryFuchsiaHandleKHR, handle);
    -  ACQUIRE_PROC(ImportSemaphoreFuchsiaHandleKHR, handle);
       ACQUIRE_PROC(GetMemoryZirconHandleFUCHSIA, handle);
       ACQUIRE_PROC(ImportSemaphoreZirconHandleFUCHSIA, handle);
     #endif  // OS_FUCHSIA
    diff --git a/vulkan/vulkan_proc_table.h b/vulkan/vulkan_proc_table.h
    index 9f06402e3dd30..8164fb785ca64 100644
    --- a/vulkan/vulkan_proc_table.h
    +++ b/vulkan/vulkan_proc_table.h
    @@ -115,8 +115,6 @@ class VulkanProcTable : public fml::RefCountedThreadSafe {
       DEFINE_PROC(CreateAndroidSurfaceKHR);
     #endif  // OS_ANDROID
     #if OS_FUCHSIA
    -  DEFINE_PROC(GetMemoryFuchsiaHandleKHR);
    -  DEFINE_PROC(ImportSemaphoreFuchsiaHandleKHR);
       DEFINE_PROC(GetMemoryZirconHandleFUCHSIA);
       DEFINE_PROC(ImportSemaphoreZirconHandleFUCHSIA);
     #endif  // OS_FUCHSIA
    
    From a1a2129bc4696e66510be984fd7908eae51eb98f Mon Sep 17 00:00:00 2001
    From: Chinmay Garde 
    Date: Fri, 29 Mar 2019 12:44:57 -0700
    Subject: [PATCH 0627/1117] GN Format all files in the engine. (#8369)
    
    ---
     build/dart/rules.gni                       | 10 ++--
     flow/BUILD.gn                              |  8 ++--
     flutter_kernel_transformers/BUILD.gn       |  2 +-
     frontend_server/BUILD.gn                   | 40 +++++++++++-----
     lib/snapshot/BUILD.gn                      | 27 ++++++-----
     runtime/BUILD.gn                           |  4 +-
     shell/common/BUILD.gn                      |  2 +-
     shell/platform/BUILD.gn                    |  2 +-
     shell/platform/android/BUILD.gn            | 34 +++++++------
     shell/platform/darwin/framework_shared.gni |  3 +-
     shell/platform/darwin/ios/BUILD.gn         |  4 +-
     shell/platform/linux/BUILD.gn              |  2 +-
     shell/platform/windows/BUILD.gn            |  2 +-
     sky/packages/sky_engine/BUILD.gn           | 47 ++++++++++++------
     testing/testing.gni                        | 56 +++++++++++++---------
     web_sdk/BUILD.gn                           |  8 ++--
     16 files changed, 156 insertions(+), 95 deletions(-)
    
    diff --git a/build/dart/rules.gni b/build/dart/rules.gni
    index d1b66255e987d..9ce67a449b208 100644
    --- a/build/dart/rules.gni
    +++ b/build/dart/rules.gni
    @@ -44,7 +44,8 @@ template("dart_pkg_helper") {
           sdk_ext_mappings += invoker.sdk_ext_mappings
         }
     
    -    script = rebase_path("$flutter_root/build/dart/tools/dart_pkg.py", ".", "//")
    +    script =
    +        rebase_path("$flutter_root/build/dart/tools/dart_pkg.py", ".", "//")
     
         entrypoints = []
         if (defined(invoker.apps)) {
    @@ -61,7 +62,8 @@ template("dart_pkg_helper") {
         if (defined(invoker.sources)) {
           sources += invoker.sources
         } else if (defined(invoker.pkg_dir)) {
    -      list_script = rebase_path("$flutter_root/build/dart/tools/ls.py", ".", "//")
    +      list_script =
    +          rebase_path("$flutter_root/build/dart/tools/ls.py", ".", "//")
           extra_flags += [ "--read_only" ]
           ls_sources = exec_script(list_script,
                                    [
    @@ -113,7 +115,9 @@ template("dart_pkg") {
         pubspec_yaml_path = rebase_path("pubspec.yaml")
       }
       dart_package_name_script =
    -      rebase_path("$flutter_root/build/dart/tools/dart_package_name.py", ".", "//")
    +      rebase_path("$flutter_root/build/dart/tools/dart_package_name.py",
    +                  ".",
    +                  "//")
       dart_package_name = exec_script(dart_package_name_script,
                                       [
                                         "--pubspec",
    diff --git a/flow/BUILD.gn b/flow/BUILD.gn
    index fbbf0e49db095..7f7fb87ef7958 100644
    --- a/flow/BUILD.gn
    +++ b/flow/BUILD.gn
    @@ -80,8 +80,8 @@ source_set("flow") {
         ]
     
         public_deps += [
    -      "//sdk/fidl/fuchsia.ui.scenic",
           "//garnet/public/lib/ui/scenic/cpp",
    +      "//sdk/fidl/fuchsia.ui.scenic",
           "//topaz/public/dart-pkg/zircon",
         ]
     
    @@ -94,18 +94,18 @@ executable("flow_unittests") {
     
       sources = [
         "flow_run_all_unittests.cc",
    -    "flow_test_utils.h",
         "flow_test_utils.cc",
    +    "flow_test_utils.h",
    +    "layers/performance_overlay_layer_unittests.cc",
         "matrix_decomposition_unittests.cc",
         "raster_cache_unittests.cc",
    -    "layers/performance_overlay_layer_unittests.cc",
       ]
     
       deps = [
         ":flow",
         "$flutter_root/fml",
    -    "//third_party/googletest:gtest",
         "//third_party/dart/runtime:libdart_jit",  # for tracing
    +    "//third_party/googletest:gtest",
         "//third_party/skia",
       ]
     }
    diff --git a/flutter_kernel_transformers/BUILD.gn b/flutter_kernel_transformers/BUILD.gn
    index 0411b4b9976c2..bde059f34990f 100644
    --- a/flutter_kernel_transformers/BUILD.gn
    +++ b/flutter_kernel_transformers/BUILD.gn
    @@ -15,9 +15,9 @@ dart_library("flutter_kernel_transformers") {
       ]
     
       deps = [
    +    "//third_party/dart-pkg/pub/meta",
         "//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/frontend_server/BUILD.gn b/frontend_server/BUILD.gn
    index 96a92ed0a04fa..21660d2976c76 100644
    --- a/frontend_server/BUILD.gn
    +++ b/frontend_server/BUILD.gn
    @@ -15,14 +15,14 @@ if (is_fuchsia_host || is_fuchsia) {
         ]
     
         deps = [
    +      "//third_party/dart-pkg/pub/args",
    +      "//third_party/dart-pkg/pub/path",
    +      "//third_party/dart-pkg/pub/usage",
           "//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"
    +      "//third_party/flutter/flutter_kernel_transformers",
         ]
       }
     
    @@ -48,16 +48,34 @@ if (is_fuchsia_host || is_fuchsia) {
         ]
         dot_packages = rebase_path(".packages")
         flutter_patched_sdk = rebase_path("$root_out_dir/flutter_patched_sdk")
    -    training_args = [ "--train", "--sdk-root=$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("."),
    +                    ],
    +                    "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("../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")
    +    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/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn
    index 595f73994f3fd..9f05eb5c997b6 100644
    --- a/lib/snapshot/BUILD.gn
    +++ b/lib/snapshot/BUILD.gn
    @@ -20,7 +20,8 @@ compiled_action("generate_snapshot_bin") {
       tool = "//third_party/dart/runtime/bin:gen_snapshot"
     
       if (is_fuchsia || is_fuchsia_host) {
    -    platform_kernel = "$root_out_dir/flutter_runner_patched_sdk/platform_strong.dill"
    +    platform_kernel =
    +        "$root_out_dir/flutter_runner_patched_sdk/platform_strong.dill"
       } else {
         platform_kernel = "$root_out_dir/flutter_patched_sdk/platform_strong.dill"
       }
    @@ -55,12 +56,10 @@ compiled_action("generate_snapshot_bin") {
       ]
     
       if (is_debug) {
    -    args += [
    -      "--enable_asserts",
    -    ]
    +    args += [ "--enable_asserts" ]
       }
     
    -  args += [rebase_path(platform_kernel)]
    +  args += [ rebase_path(platform_kernel) ]
     }
     
     # Generates an assembly file defining a given symbol with the bytes from a
    @@ -219,21 +218,22 @@ source_set("snapshot") {
       deps = [
         ":isolate_snapshot_data_linkable",
         ":isolate_snapshot_instructions_linkable",
    +    ":platform_strong_dill_linkable",
         ":vm_snapshot_data_linkable",
         ":vm_snapshot_instructions_linkable",
    -    ":platform_strong_dill_linkable",
       ]
       sources = get_target_outputs(":isolate_snapshot_data_linkable") +
    -    get_target_outputs(":isolate_snapshot_instructions_linkable") +
    -    get_target_outputs(":vm_snapshot_data_linkable") +
    -    get_target_outputs(":vm_snapshot_instructions_linkable") +
    -    get_target_outputs(":platform_strong_dill_linkable")
    +            get_target_outputs(":isolate_snapshot_instructions_linkable") +
    +            get_target_outputs(":vm_snapshot_data_linkable") +
    +            get_target_outputs(":vm_snapshot_instructions_linkable") +
    +            get_target_outputs(":platform_strong_dill_linkable")
     }
     
     compile_platform("non_strong_platform") {
       single_root_scheme = "org-dartlang-sdk"
       single_root_base = rebase_path("../../../")
    -  libraries_specification_uri = "org-dartlang-sdk:///flutter/lib/snapshot/libraries.json"
    +  libraries_specification_uri =
    +      "org-dartlang-sdk:///flutter/lib/snapshot/libraries.json"
     
       outputs = [
         "$root_out_dir/flutter_patched_sdk/platform.dill",
    @@ -249,7 +249,8 @@ compile_platform("non_strong_platform") {
     compile_platform("strong_platform") {
       single_root_scheme = "org-dartlang-sdk"
       single_root_base = rebase_path("../../../")
    -  libraries_specification_uri = "org-dartlang-sdk:///flutter/lib/snapshot/libraries.json"
    +  libraries_specification_uri =
    +      "org-dartlang-sdk:///flutter/lib/snapshot/libraries.json"
     
       outputs = [
         "$root_out_dir/flutter_patched_sdk/platform_strong.dill",
    @@ -266,7 +267,7 @@ compile_platform("strong_platform") {
     if (is_fuchsia || is_fuchsia_host) {
       group("kernel_platform_files") {
         public_deps = [
    -      "//topaz/runtime/flutter_runner/kernel:kernel_platform_files"
    +      "//topaz/runtime/flutter_runner/kernel:kernel_platform_files",
         ]
       }
     } else {
    diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
    index 401b107ad2adf..97db3cb3cd1de 100644
    --- a/runtime/BUILD.gn
    +++ b/runtime/BUILD.gn
    @@ -73,7 +73,9 @@ source_set("runtime") {
           flutter_runtime_mode != "dynamic_release" && !is_fuchsia) {
         # Only link in Observatory in non-release modes on non-Fuchsia. Fuchsia
         # instead puts Observatory into the runner's package.
    -    deps += [ "//third_party/dart/runtime/observatory:embedded_observatory_archive" ]
    +    deps += [
    +      "//third_party/dart/runtime/observatory:embedded_observatory_archive",
    +    ]
       }
     }
     
    diff --git a/shell/common/BUILD.gn b/shell/common/BUILD.gn
    index aa22968662c3b..c678388a108c6 100644
    --- a/shell/common/BUILD.gn
    +++ b/shell/common/BUILD.gn
    @@ -2,8 +2,8 @@
     # 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")
    +import("$flutter_root/testing/testing.gni")
     
     # Template to generate a dart embedder resource.cc file.
     # Required invoker inputs:
    diff --git a/shell/platform/BUILD.gn b/shell/platform/BUILD.gn
    index 89b1bbabe6f4d..e8b1ba7d0e1d3 100644
    --- a/shell/platform/BUILD.gn
    +++ b/shell/platform/BUILD.gn
    @@ -17,7 +17,7 @@ group("platform") {
         deps = [
           "windows",
         ]
    -  } else if ( is_fuchsia) {
    +  } else if (is_fuchsia) {
         # Fuchsia has its own runner implementation.
         deps = []
       } else {
    diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn
    index 090fdb28ff694..fb86273840bc5 100644
    --- a/shell/platform/android/BUILD.gn
    +++ b/shell/platform/android/BUILD.gn
    @@ -2,10 +2,10 @@
     # Use of this source code is governed by a BSD-style license that can be
     # found in the LICENSE file.
     
    -import("$flutter_root/common/config.gni")
    -import("$flutter_root/shell/config.gni")
     import("//build/config/android/config.gni")
     import("//build/config/android/rules.gni")
    +import("$flutter_root/common/config.gni")
    +import("$flutter_root/shell/config.gni")
     import("$flutter_root/shell/gpu/gpu.gni")
     
     shell_gpu_configuration("android_gpu_configuration") {
    @@ -20,6 +20,7 @@ shared_library("flutter_shell_native") {
       output_name = "flutter"
     
       sources = [
    +    "$root_build_dir/flutter_icu/icudtl.o",
         "android_context_gl.cc",
         "android_context_gl.h",
         "android_environment_gl.cc",
    @@ -49,7 +50,6 @@ shared_library("flutter_shell_native") {
         "platform_view_android_jni.h",
         "vsync_waiter_android.cc",
         "vsync_waiter_android.h",
    -    "$root_build_dir/flutter_icu/icudtl.o",
       ]
     
       deps = [
    @@ -96,7 +96,7 @@ shared_library("flutter_shell_native") {
         "GLESv2",
       ]
     
    -  ldflags = ["-Wl,--version-script=" + rebase_path("android_exports.lst")]
    +  ldflags = [ "-Wl,--version-script=" + rebase_path("android_exports.lst") ]
     }
     
     java_library("flutter_shell_java") {
    @@ -181,17 +181,16 @@ java_library("flutter_shell_java") {
         "io/flutter/view/VsyncWaiter.java",
       ]
     
    -  java_files += [
    -    "$flutter_root/third_party/bsdiff/io/flutter/util/BSDiff.java",
    -  ]
    +  java_files +=
    +      [ "$flutter_root/third_party/bsdiff/io/flutter/util/BSDiff.java" ]
     
       deps = [
    -    ":android_support_v13",
    +    ":android_arch_lifecycle_common",
    +    ":android_arch_lifecycle_viewmodel",
         ":android_support_annotations",
         ":android_support_compat",
         ":android_support_fragment",
    -    ":android_arch_lifecycle_common",
    -    ":android_arch_lifecycle_viewmodel",
    +    ":android_support_v13",
       ]
     
       jar_path = "$root_out_dir/flutter_java.jar"
    @@ -230,7 +229,8 @@ java_prebuilt("android_arch_lifecycle_common") {
     java_prebuilt("android_arch_lifecycle_viewmodel") {
       supports_android = true
     
    -  jar_path = "//third_party/android_support/android_arch_lifecycle_viewmodel.jar"
    +  jar_path =
    +      "//third_party/android_support/android_arch_lifecycle_viewmodel.jar"
     }
     
     action("icudtl_object") {
    @@ -248,10 +248,14 @@ action("icudtl_object") {
       ]
     
       args = [
    -    "--objcopy", rebase_path(android_objcopy),
    -    "--input", rebase_path(icudtl_input),
    -    "--output", rebase_path(icudtl_output),
    -    "--arch", current_cpu,
    +    "--objcopy",
    +    rebase_path(android_objcopy),
    +    "--input",
    +    rebase_path(icudtl_input),
    +    "--output",
    +    rebase_path(icudtl_output),
    +    "--arch",
    +    current_cpu,
       ]
     }
     
    diff --git a/shell/platform/darwin/framework_shared.gni b/shell/platform/darwin/framework_shared.gni
    index 7ca4b2d068017..76604322372ae 100644
    --- a/shell/platform/darwin/framework_shared.gni
    +++ b/shell/platform/darwin/framework_shared.gni
    @@ -2,7 +2,8 @@
     # Use of this source code is governed by a BSD-style license that can be
     # found in the LICENSE file.
     
    -framework_shared_headers = get_path_info(
    +framework_shared_headers =
    +    get_path_info(
             [
               # TODO: Move these files, and their implementations, to a shared
               # location.
    diff --git a/shell/platform/darwin/ios/BUILD.gn b/shell/platform/darwin/ios/BUILD.gn
    index 8adbfc627970e..e881cd429ce73 100644
    --- a/shell/platform/darwin/ios/BUILD.gn
    +++ b/shell/platform/darwin/ios/BUILD.gn
    @@ -4,8 +4,8 @@
     
     assert(is_ios)
     
    -import("$flutter_root/common/config.gni")
     import("//build/config/ios/ios_sdk.gni")
    +import("$flutter_root/common/config.gni")
     import("$flutter_root/shell/gpu/gpu.gni")
     
     _flutter_framework_dir = "$root_out_dir/Flutter.framework"
    @@ -61,9 +61,9 @@ shared_library("create_flutter_framework_dylib") {
         "framework/Source/FlutterOverlayView.mm",
         "framework/Source/FlutterPlatformPlugin.h",
         "framework/Source/FlutterPlatformPlugin.mm",
    +    "framework/Source/FlutterPlatformViews.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",
    diff --git a/shell/platform/linux/BUILD.gn b/shell/platform/linux/BUILD.gn
    index 3d2c125baa84f..28c95e80b2690 100644
    --- a/shell/platform/linux/BUILD.gn
    +++ b/shell/platform/linux/BUILD.gn
    @@ -7,8 +7,8 @@ assert(is_linux)
     group("linux") {
       deps = [
         ":flutter_linux",
    -    "$flutter_root/shell/platform/glfw:publish_headers_glfw",
         "$flutter_root/shell/platform/common/cpp/client_wrapper:publish_wrapper",
    +    "$flutter_root/shell/platform/glfw:publish_headers_glfw",
         "$flutter_root/shell/platform/glfw/client_wrapper:publish_wrapper_glfw",
       ]
     }
    diff --git a/shell/platform/windows/BUILD.gn b/shell/platform/windows/BUILD.gn
    index 26fe53036b49a..723b66f90dd75 100644
    --- a/shell/platform/windows/BUILD.gn
    +++ b/shell/platform/windows/BUILD.gn
    @@ -7,8 +7,8 @@ assert(is_win)
     group("windows") {
       deps = [
         ":flutter_windows",
    -    "$flutter_root/shell/platform/glfw:publish_headers_glfw",
         "$flutter_root/shell/platform/common/cpp/client_wrapper:publish_wrapper",
    +    "$flutter_root/shell/platform/glfw:publish_headers_glfw",
         "$flutter_root/shell/platform/glfw/client_wrapper:publish_wrapper_glfw",
       ]
     }
    diff --git a/sky/packages/sky_engine/BUILD.gn b/sky/packages/sky_engine/BUILD.gn
    index 9556957954b31..707982b45ec12 100644
    --- a/sky/packages/sky_engine/BUILD.gn
    +++ b/sky/packages/sky_engine/BUILD.gn
    @@ -2,12 +2,12 @@
     # Use of this source code is governed by a BSD-style license that can be
     # found in the LICENSE file.
     
    +import("//third_party/dart/sdk/lib/_http/http_sources.gni")
     import("//third_party/dart/sdk/lib/async/async_sources.gni")
     import("//third_party/dart/sdk/lib/collection/collection_sources.gni")
     import("//third_party/dart/sdk/lib/convert/convert_sources.gni")
     import("//third_party/dart/sdk/lib/core/core_sources.gni")
     import("//third_party/dart/sdk/lib/developer/developer_sources.gni")
    -import("//third_party/dart/sdk/lib/_http/http_sources.gni")
     import("//third_party/dart/sdk/lib/internal/internal_sources.gni")
     import("//third_party/dart/sdk/lib/io/io_sources.gni")
     import("//third_party/dart/sdk/lib/isolate/isolate_sources.gni")
    @@ -29,75 +29,94 @@ if (!is_fuchsia) {
       }
     }
     
    -
     dart_sdk_lib_path = rebase_path("//third_party/dart/sdk/lib")
     
     copy("async") {
       lib_path = rebase_path("async", "", dart_sdk_lib_path)
       sources = rebase_path(async_sdk_sources, "", lib_path)
       outputs = [
    -    "$root_gen_dir/dart-pkg/sky_engine/lib/async/{{source_file_part}}"
    +    "$root_gen_dir/dart-pkg/sky_engine/lib/async/{{source_file_part}}",
       ]
     }
     
     copy("collection") {
       lib_path = rebase_path("collection", "", dart_sdk_lib_path)
       sources = rebase_path(collection_sdk_sources, "", lib_path)
    -  outputs = [ "$root_gen_dir/dart-pkg/sky_engine/lib/collection/{{source_file_part}}" ]
    +  outputs = [
    +    "$root_gen_dir/dart-pkg/sky_engine/lib/collection/{{source_file_part}}",
    +  ]
     }
     
     copy("convert") {
       lib_path = rebase_path("convert", "", dart_sdk_lib_path)
       sources = rebase_path(convert_sdk_sources, "", lib_path)
    -  outputs = [ "$root_gen_dir/dart-pkg/sky_engine/lib/convert/{{source_file_part}}" ]
    +  outputs = [
    +    "$root_gen_dir/dart-pkg/sky_engine/lib/convert/{{source_file_part}}",
    +  ]
     }
     
     copy("core") {
       lib_path = rebase_path("core", "", dart_sdk_lib_path)
       sources = rebase_path(core_sdk_sources, "", lib_path)
    -  outputs = [ "$root_gen_dir/dart-pkg/sky_engine/lib/core/{{source_file_part}}" ]
    +  outputs = [
    +    "$root_gen_dir/dart-pkg/sky_engine/lib/core/{{source_file_part}}",
    +  ]
     }
     
     copy("developer") {
       lib_path = rebase_path("developer", "", dart_sdk_lib_path)
       sources = rebase_path(developer_sdk_sources, "", lib_path)
    -  outputs = [ "$root_gen_dir/dart-pkg/sky_engine/lib/developer/{{source_file_part}}" ]
    +  outputs = [
    +    "$root_gen_dir/dart-pkg/sky_engine/lib/developer/{{source_file_part}}",
    +  ]
     }
     
     copy("_http") {
       lib_path = rebase_path("_http", "", dart_sdk_lib_path)
       sources = rebase_path(http_sdk_sources, "", lib_path)
    -  outputs = [ "$root_gen_dir/dart-pkg/sky_engine/lib/_http/{{source_file_part}}" ]
    +  outputs = [
    +    "$root_gen_dir/dart-pkg/sky_engine/lib/_http/{{source_file_part}}",
    +  ]
     }
     
     copy("internal") {
       lib_path = rebase_path("internal", "", dart_sdk_lib_path)
       sources = rebase_path(internal_sdk_sources, "", lib_path)
    -  outputs = [ "$root_gen_dir/dart-pkg/sky_engine/lib/internal/{{source_file_part}}" ]
    +  outputs = [
    +    "$root_gen_dir/dart-pkg/sky_engine/lib/internal/{{source_file_part}}",
    +  ]
     }
     
     copy("io") {
       lib_path = rebase_path("io", "", dart_sdk_lib_path)
       sources = rebase_path(io_sdk_sources, "", lib_path)
    -  outputs = [ "$root_gen_dir/dart-pkg/sky_engine/lib/io/{{source_file_part}}" ]
    +  outputs = [
    +    "$root_gen_dir/dart-pkg/sky_engine/lib/io/{{source_file_part}}",
    +  ]
     }
     
     copy("isolate") {
       lib_path = rebase_path("isolate", "", dart_sdk_lib_path)
       sources = rebase_path(isolate_sdk_sources, "", lib_path)
    -  outputs = [ "$root_gen_dir/dart-pkg/sky_engine/lib/isolate/{{source_file_part}}" ]
    +  outputs = [
    +    "$root_gen_dir/dart-pkg/sky_engine/lib/isolate/{{source_file_part}}",
    +  ]
     }
     
     copy("math") {
       lib_path = rebase_path("math", "", dart_sdk_lib_path)
       sources = rebase_path(math_sdk_sources, "", lib_path)
    -  outputs = [ "$root_gen_dir/dart-pkg/sky_engine/lib/math/{{source_file_part}}" ]
    +  outputs = [
    +    "$root_gen_dir/dart-pkg/sky_engine/lib/math/{{source_file_part}}",
    +  ]
     }
     
     copy("typed_data") {
       lib_path = rebase_path("typed_data", "", dart_sdk_lib_path)
       sources = rebase_path(typed_data_sdk_sources, "", lib_path)
    -  outputs = [ "$root_gen_dir/dart-pkg/sky_engine/lib/typed_data/{{source_file_part}}" ]
    +  outputs = [
    +    "$root_gen_dir/dart-pkg/sky_engine/lib/typed_data/{{source_file_part}}",
    +  ]
     }
     
     copy("copy_dart_ui") {
    @@ -110,12 +129,12 @@ copy("copy_dart_ui") {
     
     group("copy_dart_sdk") {
       deps = [
    +    ":_http",
         ":async",
         ":collection",
         ":convert",
         ":core",
         ":developer",
    -    ":_http",
         ":internal",
         ":io",
         ":isolate",
    diff --git a/testing/testing.gni b/testing/testing.gni
    index 8d01b6810c044..1488a77782725 100644
    --- a/testing/testing.gni
    +++ b/testing/testing.gni
    @@ -2,9 +2,9 @@
     # Use of this source code is governed by a BSD-style license that can be
     # found in the LICENSE file.
     
    -import("$flutter_root/common/config.gni")
     import("//build/compiled_action.gni")
     import("//third_party/dart/build/dart/dart_action.gni")
    +import("$flutter_root/common/config.gni")
     
     # Builds test fixtures for a unit test.
     #
    @@ -33,7 +33,8 @@ template("test_fixtures") {
       }
     
       fixtures_location = "$target_gen_dir/$target_name/assets"
    -  fixtures_location_file = "$target_gen_dir/$target_name/test_fixtures_location.cc"
    +  fixtures_location_file =
    +      "$target_gen_dir/$target_name/test_fixtures_location.cc"
     
       fixtures_name_target_name = target_name + "_gen_fixtures_name"
       action(fixtures_name_target_name) {
    @@ -73,30 +74,37 @@ template("test_fixtures") {
           fixture_paths += [ rebase_path(fixture) ]
         }
         inputs = fixture_paths
    -    outputs = ["$fixtures_location/$kernel_out"]
    +    outputs = [
    +      "$fixtures_location/$kernel_out",
    +    ]
     
         deps = [
    -      "//third_party/dart/utils/kernel-service:frontend_server"
    +      "//third_party/dart/utils/kernel-service:frontend_server",
         ]
     
         if (flutter_runtime_mode == "profile" || flutter_runtime_mode == "release") {
           args = [
    -        "--sdk-root", rebase_path("$root_out_dir/flutter_patched_sdk"),
    -        "--strong",
    -        "--target=flutter",
    -        "--aot",
    -        "--tfa",
    -        "-Ddart.vm.product=true",
    -        "--output-dill", rebase_path("$fixtures_location/$kernel_out"),
    -      ] + fixture_paths
    +               "--sdk-root",
    +               rebase_path("$root_out_dir/flutter_patched_sdk"),
    +               "--strong",
    +               "--target=flutter",
    +               "--aot",
    +               "--tfa",
    +               "-Ddart.vm.product=true",
    +               "--output-dill",
    +               rebase_path("$fixtures_location/$kernel_out"),
    +             ] + fixture_paths
     
           deps += [ "//flutter/lib/snapshot:strong_platform" ]
         } else {
           args = [
    -        "--sdk-root", rebase_path("$root_out_dir/flutter_patched_sdk"),
    -        "--target", "flutter",
    -        "--output-dill", rebase_path("$fixtures_location/$kernel_out"),
    -      ] + fixture_paths
    +               "--sdk-root",
    +               rebase_path("$root_out_dir/flutter_patched_sdk"),
    +               "--target",
    +               "flutter",
    +               "--output-dill",
    +               rebase_path("$fixtures_location/$kernel_out"),
    +             ] + fixture_paths
         }
       }
     
    @@ -106,7 +114,7 @@ template("test_fixtures") {
         tool = "//third_party/dart/runtime/bin:gen_snapshot"
     
         inputs = [
    -      "$fixtures_location/$kernel_out"
    +      "$fixtures_location/$kernel_out",
         ]
     
         outputs = [
    @@ -120,11 +128,15 @@ template("test_fixtures") {
           "--causal_async_stacks",
           "--deterministic",
           "--snapshot_kind=app-aot-blobs",
    -      "--vm_snapshot_data=" + rebase_path("$fixtures_location/vm_snapshot_data"),
    -      "--vm_snapshot_instructions=" + rebase_path("$fixtures_location/vm_snapshot_instr"),
    -      "--isolate_snapshot_data=" + rebase_path("$fixtures_location/isolate_snapshot_data"),
    -      "--isolate_snapshot_instructions=" + rebase_path("$fixtures_location/isolate_snapshot_instr"),
    -      rebase_path("$fixtures_location/$kernel_out")
    +      "--vm_snapshot_data=" +
    +          rebase_path("$fixtures_location/vm_snapshot_data"),
    +      "--vm_snapshot_instructions=" +
    +          rebase_path("$fixtures_location/vm_snapshot_instr"),
    +      "--isolate_snapshot_data=" +
    +          rebase_path("$fixtures_location/isolate_snapshot_data"),
    +      "--isolate_snapshot_instructions=" +
    +          rebase_path("$fixtures_location/isolate_snapshot_instr"),
    +      rebase_path("$fixtures_location/$kernel_out"),
         ]
     
         deps = [
    diff --git a/web_sdk/BUILD.gn b/web_sdk/BUILD.gn
    index 57f8e4296666f..7382b8a6b6d5f 100644
    --- a/web_sdk/BUILD.gn
    +++ b/web_sdk/BUILD.gn
    @@ -28,8 +28,8 @@ web_ui_sources = [
     
     group("web_sdk") {
       deps = [
    -    ":generate_web_summary_sdk",
         ":flutter_dartdevc_kernel_sdk",
    +    ":generate_web_summary_sdk",
       ]
     }
     
    @@ -37,7 +37,7 @@ copy("web_ui_sources") {
       sources = web_ui_sources
     
       outputs = [
    -    "$root_out_dir/flutter_web_sdk/lib/ui/{{source_file_part}}"
    +    "$root_out_dir/flutter_web_sdk/lib/ui/{{source_file_part}}",
       ]
     }
     
    @@ -47,7 +47,7 @@ copy("web_ui_library") {
       ]
     
       outputs = [
    -    "$root_out_dir/flutter_web_sdk/{{source_file_part}}"
    +    "$root_out_dir/flutter_web_sdk/{{source_file_part}}",
       ]
     }
     
    @@ -70,8 +70,8 @@ prebuilt_dart_action("generate_web_summary_sdk") {
       ]
     
       deps = [
    -    ":web_ui_sources",
         ":web_ui_library",
    +    ":web_ui_sources",
         "//third_party/dart:create_sdk",
       ]
     }
    
    From 13390119916881579e8daed58f62fe9c0707fcdf Mon Sep 17 00:00:00 2001
    From: Jason Simmons 
    Date: Fri, 29 Mar 2019 13:01:37 -0700
    Subject: [PATCH 0628/1117] libtxt: track the start and end x positions of
     glyph blobs for more accurate rendering of text decorations (#8368)
    
    Fixes https://github.com/flutter/flutter/issues/30041
    Fixes https://github.com/flutter/flutter/issues/24337
    ---
     third_party/txt/src/txt/paint_record.cc      | 19 +++++++++++++------
     third_party/txt/src/txt/paint_record.h       | 13 +++++++++----
     third_party/txt/src/txt/paragraph.cc         | 13 ++++++++-----
     third_party/txt/tests/paragraph_unittests.cc |  8 ++++----
     4 files changed, 34 insertions(+), 19 deletions(-)
    
    diff --git a/third_party/txt/src/txt/paint_record.cc b/third_party/txt/src/txt/paint_record.cc
    index 0ee43f847808f..e5cc56ae974c0 100644
    --- a/third_party/txt/src/txt/paint_record.cc
    +++ b/third_party/txt/src/txt/paint_record.cc
    @@ -26,27 +26,31 @@ PaintRecord::PaintRecord(TextStyle style,
                              sk_sp text,
                              SkFontMetrics metrics,
                              size_t line,
    -                         double run_width,
    +                         double x_start,
    +                         double x_end,
                              bool is_ghost)
         : style_(style),
           offset_(offset),
           text_(std::move(text)),
           metrics_(metrics),
           line_(line),
    -      run_width_(run_width),
    +      x_start_(x_start),
    +      x_end_(x_end),
           is_ghost_(is_ghost) {}
     
     PaintRecord::PaintRecord(TextStyle style,
                              sk_sp text,
                              SkFontMetrics metrics,
                              size_t line,
    -                         double run_width,
    +                         double x_start,
    +                         double x_end,
                              bool is_ghost)
         : style_(style),
           text_(std::move(text)),
           metrics_(metrics),
           line_(line),
    -      run_width_(run_width),
    +      x_start_(x_start),
    +      x_end_(x_end),
           is_ghost_(is_ghost) {}
     
     PaintRecord::PaintRecord(PaintRecord&& other) {
    @@ -55,7 +59,9 @@ PaintRecord::PaintRecord(PaintRecord&& other) {
       text_ = std::move(other.text_);
       metrics_ = other.metrics_;
       line_ = other.line_;
    -  run_width_ = other.run_width_, is_ghost_ = other.is_ghost_;
    +  x_start_ = other.x_start_;
    +  x_end_ = other.x_end_;
    +  is_ghost_ = other.is_ghost_;
     }
     
     PaintRecord& PaintRecord::operator=(PaintRecord&& other) {
    @@ -64,7 +70,8 @@ PaintRecord& PaintRecord::operator=(PaintRecord&& other) {
       text_ = std::move(other.text_);
       metrics_ = other.metrics_;
       line_ = other.line_;
    -  run_width_ = other.run_width_;
    +  x_start_ = other.x_start_;
    +  x_end_ = other.x_end_;
       is_ghost_ = other.is_ghost_;
       return *this;
     }
    diff --git a/third_party/txt/src/txt/paint_record.h b/third_party/txt/src/txt/paint_record.h
    index c07ab6827c350..e0623d1e89790 100644
    --- a/third_party/txt/src/txt/paint_record.h
    +++ b/third_party/txt/src/txt/paint_record.h
    @@ -39,14 +39,16 @@ class PaintRecord {
                   sk_sp text,
                   SkFontMetrics metrics,
                   size_t line,
    -              double run_width,
    +              double x_start,
    +              double x_end,
                   bool is_ghost);
     
       PaintRecord(TextStyle style,
                   sk_sp text,
                   SkFontMetrics metrics,
                   size_t line,
    -              double run_width,
    +              double x_start,
    +              double x_end,
                   bool is_ghost);
     
       PaintRecord(PaintRecord&& other);
    @@ -65,7 +67,9 @@ class PaintRecord {
     
       size_t line() const { return line_; }
     
    -  double GetRunWidth() const { return run_width_; }
    +  double x_start() const { return x_start_; }
    +  double x_end() const { return x_end_; }
    +  double GetRunWidth() const { return x_end_ - x_start_; }
     
       bool isGhost() const { return is_ghost_; }
     
    @@ -78,7 +82,8 @@ class PaintRecord {
       // FontMetrics stores the measurements of the font used.
       SkFontMetrics metrics_;
       size_t line_;
    -  double run_width_ = 0.0f;
    +  double x_start_ = 0.0f;
    +  double x_end_ = 0.0f;
       // 'Ghost' runs represent trailing whitespace. 'Ghost' runs should not have
       // decorations painted on them and do not impact layout of visible glyphs.
       bool is_ghost_ = false;
    diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc
    index cba46048d7b9e..2e84f6fe49a6a 100644
    --- a/third_party/txt/src/txt/paragraph.cc
    +++ b/third_party/txt/src/txt/paragraph.cc
    @@ -789,10 +789,13 @@ void Paragraph::Layout(double width, bool force) {
               continue;
             SkFontMetrics metrics;
             font.getMetrics(&metrics);
    +        Range record_x_pos(
    +            glyph_positions.front().x_pos.start - run_x_offset,
    +            glyph_positions.back().x_pos.end - run_x_offset);
             paint_records.emplace_back(
                 run.style(), SkPoint::Make(run_x_offset + justify_x_offset, 0),
    -            builder.make(), metrics, line_number,
    -            layout.getAdvance() + justify_x_offset_delta, run.is_ghost());
    +            builder.make(), metrics, line_number, record_x_pos.start,
    +            record_x_pos.end, run.is_ghost());
             justify_x_offset += justify_x_offset_delta;
     
             line_glyph_positions.insert(line_glyph_positions.end(),
    @@ -1070,7 +1073,7 @@ void Paragraph::PaintDecorations(SkCanvas* canvas,
                            record.style().decoration_thickness_multiplier);
     
       SkPoint record_offset = base_offset + record.offset();
    -  SkScalar x = record_offset.x();
    +  SkScalar x = record_offset.x() + record.x_start();
       SkScalar y = record_offset.y();
     
       // Setup the decorations.
    @@ -1196,8 +1199,8 @@ void Paragraph::PaintBackground(SkCanvas* canvas,
         return;
     
       const SkFontMetrics& metrics = record.metrics();
    -  SkRect rect(SkRect::MakeLTRB(0, metrics.fAscent, record.GetRunWidth(),
    -                               metrics.fDescent));
    +  SkRect rect(SkRect::MakeLTRB(record.x_start(), metrics.fAscent,
    +                               record.x_end(), metrics.fDescent));
       rect.offset(base_offset + record.offset());
       canvas->drawRect(rect, record.style().background);
     }
    diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc
    index 7d09928f44f90..62f984af8c6b3 100644
    --- a/third_party/txt/tests/paragraph_unittests.cc
    +++ b/third_party/txt/tests/paragraph_unittests.cc
    @@ -2914,10 +2914,10 @@ TEST_F(ParagraphTest, FontFallbackParagraph) {
     
       ASSERT_EQ(paragraph->records_.size(), 5ull);
       ASSERT_DOUBLE_EQ(paragraph->records_[0].GetRunWidth(), 64.19921875);
    -  ASSERT_DOUBLE_EQ(paragraph->records_[1].GetRunWidth(), 167.1171875);
    -  ASSERT_DOUBLE_EQ(paragraph->records_[2].GetRunWidth(), 167.1171875);
    -  ASSERT_DOUBLE_EQ(paragraph->records_[3].GetRunWidth(), 90.24609375);
    -  ASSERT_DOUBLE_EQ(paragraph->records_[4].GetRunWidth(), 90.24609375);
    +  ASSERT_DOUBLE_EQ(paragraph->records_[1].GetRunWidth(), 139.1171875);
    +  ASSERT_DOUBLE_EQ(paragraph->records_[2].GetRunWidth(), 28);
    +  ASSERT_DOUBLE_EQ(paragraph->records_[3].GetRunWidth(), 62.24609375);
    +  ASSERT_DOUBLE_EQ(paragraph->records_[4].GetRunWidth(), 28);
       // When a different font is resolved, then the metrics are different.
       ASSERT_TRUE(paragraph->records_[2].metrics().fTop -
                       paragraph->records_[4].metrics().fTop !=
    
    From 8412c199a5fa7fe39c4717d67a47f41b91606579 Mon Sep 17 00:00:00 2001
    From: stuartmorgan 
    Date: Fri, 29 Mar 2019 16:34:02 -0400
    Subject: [PATCH 0629/1117] Enable Linux shell build (#8233)
    
    Enables building of the GLFW shell and the related unit tests.
    ---
     BUILD.gn                      |  7 +++++++
     shell/platform/BUILD.gn       |  4 +++-
     shell/platform/linux/BUILD.gn | 12 ++++++++++++
     3 files changed, 22 insertions(+), 1 deletion(-)
    
    diff --git a/BUILD.gn b/BUILD.gn
    index 39edfcdc720bf..2766d1b986f44 100644
    --- a/BUILD.gn
    +++ b/BUILD.gn
    @@ -57,6 +57,13 @@ group("flutter") {
         if (!is_win) {
           public_deps += [ "$flutter_root/shell/common:shell_benchmarks" ]
         }
    +
    +    if (is_linux) {
    +      public_deps += [
    +        "$flutter_root/shell/platform/common/cpp/client_wrapper:client_wrapper_unittests",
    +        "$flutter_root/shell/platform/glfw/client_wrapper:client_wrapper_glfw_unittests",
    +      ]
    +    }
       }
     }
     
    diff --git a/shell/platform/BUILD.gn b/shell/platform/BUILD.gn
    index e8b1ba7d0e1d3..c3bd7569c22d9 100644
    --- a/shell/platform/BUILD.gn
    +++ b/shell/platform/BUILD.gn
    @@ -12,7 +12,9 @@ group("platform") {
           "android",
         ]
       } else if (is_linux) {
    -    deps = []
    +    deps = [
    +      "linux",
    +    ]
       } else if (is_win) {
         deps = [
           "windows",
    diff --git a/shell/platform/linux/BUILD.gn b/shell/platform/linux/BUILD.gn
    index 28c95e80b2690..a86fe7927e16c 100644
    --- a/shell/platform/linux/BUILD.gn
    +++ b/shell/platform/linux/BUILD.gn
    @@ -13,10 +13,22 @@ group("linux") {
       ]
     }
     
    +# Temporary workraround for the issue describe in
    +# https://github.com/flutter/flutter/issues/14509 and
    +# https://github.com/flutter/flutter/issues/14438
    +# Remove once the build infrastructure moves to Ubuntu 18.04 or newer, where
    +# the underlying issue is fixed.
    +config("disable_fatal_link_warnings") {
    +  visibility = [ ":*" ]
    +  ldflags = [ "-Wl,--no-fatal-warnings" ]
    +}
    +
     shared_library("flutter_linux") {
       deps = [
         "$flutter_root/shell/platform/glfw:flutter_glfw",
       ]
     
    +  configs += [ ":disable_fatal_link_warnings" ]
    +
       public_configs = [ "$flutter_root:config" ]
     }
    
    From d6e2d852776bf1e2de805a1ffb2ca69e9b9b46c1 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Fri, 29 Mar 2019 16:43:49 -0400
    Subject: [PATCH 0630/1117] Roll src/third_party/skia
     7eeb74fdfd84..73c6c9d26870 (8 commits) (#8372)
    
    https://skia.googlesource.com/skia.git/%2Blog/7eeb74fdfd84..73c6c9d26870
    
    git log 7eeb74fdfd8453b4fc0f0460ade48d4097444043..73c6c9d268708f75e2fcdea6b2f7b7e2bf6eacae --date=short --no-merges --format=%ad %ae %s
    2019-03-29 bsalomon@google.com Move new convex path towards the end of the path array in GM convexpaths.
    2019-03-29 michaelludwig@google.com Interpolate coverage in screen space for perspective quads
    2019-03-29 csmartdalton@google.com Split GrCCCoverageProcessor into subclasses
    2019-03-29 ethannicholas@google.com fix SkSL lexer's handling of invalid characters
    2019-03-29 bsalomon@google.com In GrAAConvexPathRenderer check whether middle quadtric control point is close to line segment between first and last control points and if so draw as a line.
    2019-03-29 michaelludwig@google.com Add reproduction test case for crbug/947055
    2019-03-29 fmalita@chromium.org [skottie] Allow extra-normal Bezier interpolation
    2019-03-29 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 9 ++++++---
     2 files changed, 7 insertions(+), 4 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 73285325cb380..4701326c94bb2 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': '7eeb74fdfd8453b4fc0f0460ade48d4097444043',
    +  'skia_revision': '73c6c9d268708f75e2fcdea6b2f7b7e2bf6eacae',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index c56a9f826c842..431cee7027215 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: cfb7f9511f3794178134f66e60c0510e
    +Signature: 4f9684ee6c85476f7ecbcb317adeb5b5
     
     UNUSED LICENSES:
     
    @@ -4407,8 +4407,6 @@ FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCClipProcessor.cpp
     FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCClipProcessor.h
     FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCCoverageProcessor.cpp
     FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCCoverageProcessor.h
    -FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCCoverageProcessor_GSImpl.cpp
    -FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCCoverageProcessor_VSImpl.cpp
     FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCCubicShader.cpp
     FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCCubicShader.h
     FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCFillGeometry.cpp
    @@ -4421,6 +4419,8 @@ FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCQuadraticShader.cpp
     FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCQuadraticShader.h
     FILE: ../../../third_party/skia/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
     FILE: ../../../third_party/skia/src/gpu/ccpr/GrCoverageCountingPathRenderer.h
    +FILE: ../../../third_party/skia/src/gpu/ccpr/GrGSCoverageProcessor.cpp
    +FILE: ../../../third_party/skia/src/gpu/ccpr/GrVSCoverageProcessor.cpp
     FILE: ../../../third_party/skia/src/gpu/effects/GrAtlasedShaderHelpers.h
     FILE: ../../../third_party/skia/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp
     FILE: ../../../third_party/skia/src/gpu/effects/GrBlurredEdgeFragmentProcessor.fp
    @@ -4563,6 +4563,7 @@ FILE: ../../../third_party/skia/bench/MixerBench.cpp
     FILE: ../../../third_party/skia/gm/backdrop.cpp
     FILE: ../../../third_party/skia/gm/compositor_quads.cpp
     FILE: ../../../third_party/skia/gm/crbug_938592.cpp
    +FILE: ../../../third_party/skia/gm/crbug_947055.cpp
     FILE: ../../../third_party/skia/gm/mac_aa_explorer.cpp
     FILE: ../../../third_party/skia/gm/mixercolorfilter.cpp
     FILE: ../../../third_party/skia/gm/samplelocations.cpp
    @@ -4604,6 +4605,8 @@ FILE: ../../../third_party/skia/src/gpu/GrRecordingContext.cpp
     FILE: ../../../third_party/skia/src/gpu/GrRecordingContextPriv.h
     FILE: ../../../third_party/skia/src/gpu/GrSamplePatternDictionary.cpp
     FILE: ../../../third_party/skia/src/gpu/GrSamplePatternDictionary.h
    +FILE: ../../../third_party/skia/src/gpu/ccpr/GrGSCoverageProcessor.h
    +FILE: ../../../third_party/skia/src/gpu/ccpr/GrVSCoverageProcessor.h
     FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.cpp
     FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.fp
     FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.h
    
    From f39cf3774d5cff386a209be2398eafe754f521f0 Mon Sep 17 00:00:00 2001
    From: Chinmay Garde 
    Date: Fri, 29 Mar 2019 13:56:55 -0700
    Subject: [PATCH 0631/1117] Add a GN format presubmit. (#8371)
    
    ---
     ci/check_gn_format.py | 52 +++++++++++++++++++++++++++++++++++++++++++
     ci/format.sh          |  3 +++
     2 files changed, 55 insertions(+)
     create mode 100755 ci/check_gn_format.py
    
    diff --git a/ci/check_gn_format.py b/ci/check_gn_format.py
    new file mode 100755
    index 0000000000000..528287452cd66
    --- /dev/null
    +++ b/ci/check_gn_format.py
    @@ -0,0 +1,52 @@
    +#!/usr/bin/env python
    +#
    +# Copyright 2013 The Flutter 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 sys
    +import subprocess
    +import os
    +import argparse
    +import errno
    +import shutil
    +
    +def GetGNFiles(directory):
    +  directory = os.path.abspath(directory)
    +  gn_files = []
    +  assert os.path.exists(directory), "Directory must exist %s" % directory
    +  for root, dirs, files in os.walk(directory):
    +    for file in files:
    +        if file.endswith(".gn") or file.endswith(".gni"):
    +          gn_files.append(os.path.join(root, file))
    +  return gn_files
    +
    +def main():
    +  parser = argparse.ArgumentParser();
    +
    +  parser.add_argument('--gn-binary', dest='gn_binary', required=True, type=str)
    +  parser.add_argument('--dry-run', dest='dry_run', required=True, type=bool)
    +  parser.add_argument('--root-directory', dest='root_directory', required=True, type=str)
    +
    +  args = parser.parse_args()
    +
    +  gn_binary = os.path.abspath(args.gn_binary)
    +  assert os.path.exists(gn_binary), "GN Binary must exist %s" % gn_binary
    +
    +  gn_command = [ gn_binary, 'format']
    +
    +  if args.dry_run:
    +    gn_command.append('--dry-run')
    +
    +
    +  for gn_file in GetGNFiles(args.root_directory):
    +    if subprocess.call(gn_command + [ gn_file ]) != 0:
    +      print "ERROR: '%s' is incorrectly formatted." % os.path.relpath(gn_file, args.root_directory)
    +      print "Format the same with 'gn format' using the 'gn' binary in //buildtools."
    +      print "Or, run ./ci/check_gn_format.py with '--dry-run false'" 
    +      return -1
    +
    +  return 0
    +
    +if __name__ == '__main__':
    +  sys.exit(main())
    diff --git a/ci/format.sh b/ci/format.sh
    index 93f0be6c47618..e3c8533afd55c 100755
    --- a/ci/format.sh
    +++ b/ci/format.sh
    @@ -73,3 +73,6 @@ if [[ ! -z "$TRAILING_SPACES" ]]; then
       echo "ERROR: Some files have trailing spaces. To fix, try something like \`find . -name "*.dart" -exec sed -i -e 's/\s\+$//' {} \;\`."
       exit 1
     fi
    +
    +# Check GN format consistency
    +./ci/check_gn_format.py --dry-run true --root-directory . --gn-binary "../buildtools/$OS/gn"
    
    From 86f4b741b863aef5586f03f4d250f1d789fde2be Mon Sep 17 00:00:00 2001
    From: Chinmay Garde 
    Date: Fri, 29 Mar 2019 14:29:09 -0700
    Subject: [PATCH 0632/1117] Move libdart selection into its own target in
     //flutter/runtime. (#8373)
    
    Cleanup repeated rules.
    ---
     lib/snapshot/BUILD.gn              |  4 +++-
     runtime/BUILD.gn                   | 14 ++++++++++++++
     shell/platform/android/BUILD.gn    | 11 +----------
     shell/platform/darwin/ios/BUILD.gn | 11 +----------
     shell/platform/embedder/BUILD.gn   | 10 +---------
     5 files changed, 20 insertions(+), 30 deletions(-)
    
    diff --git a/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn
    index 9f05eb5c997b6..f82c5e81f07af 100644
    --- a/lib/snapshot/BUILD.gn
    +++ b/lib/snapshot/BUILD.gn
    @@ -4,6 +4,7 @@
     
     import("//build/compiled_action.gni")
     import("//third_party/dart/utils/compile_platform.gni")
    +import("$flutter_root/common/config.gni")
     import("$flutter_root/lib/ui/dart_ui.gni")
     
     bindings_output_dir = "$root_gen_dir/sky/bindings"
    @@ -55,7 +56,8 @@ compiled_action("generate_snapshot_bin") {
             rebase_path(isolate_snapshot_instructions),
       ]
     
    -  if (is_debug) {
    +  if (is_debug && flutter_runtime_mode != "profile" &&
    +      flutter_runtime_mode != "release") {
         args += [ "--enable_asserts" ]
       }
     
    diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
    index 97db3cb3cd1de..e01cf5d8f20db 100644
    --- a/runtime/BUILD.gn
    +++ b/runtime/BUILD.gn
    @@ -24,6 +24,20 @@ source_set("test_font") {
       }
     }
     
    +# Picks the libdart implementation based on the Flutter runtime mode.
    +group("libdart") {
    +  deps = []
    +
    +  if (flutter_runtime_mode == "profile" || flutter_runtime_mode == "release") {
    +    deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ]
    +  } else {
    +    deps += [
    +      "$flutter_root/lib/snapshot",
    +      "//third_party/dart/runtime:libdart_jit",
    +    ]
    +  }
    +}
    +
     source_set("runtime") {
       sources = [
         "dart_isolate.cc",
    diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn
    index fb86273840bc5..2eddf97c1a56c 100644
    --- a/shell/platform/android/BUILD.gn
    +++ b/shell/platform/android/BUILD.gn
    @@ -61,19 +61,10 @@ shared_library("flutter_shell_native") {
         "$flutter_root/fml",
         "$flutter_root/lib/ui",
         "$flutter_root/runtime",
    +    "$flutter_root/runtime:libdart",
         "$flutter_root/shell/common",
         "//third_party/skia",
       ]
    -  if (flutter_runtime_mode == "debug" ||
    -      flutter_runtime_mode == "dynamic_profile" ||
    -      flutter_runtime_mode == "dynamic_release") {
    -    deps += [ "//third_party/dart/runtime:libdart_jit" ]
    -  } else {
    -    deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ]
    -  }
    -  if (flutter_runtime_mode == "debug") {
    -    deps += [ "$flutter_root/lib/snapshot" ]
    -  }
     
       public_configs = [ "$flutter_root:config" ]
     
    diff --git a/shell/platform/darwin/ios/BUILD.gn b/shell/platform/darwin/ios/BUILD.gn
    index e881cd429ce73..ae426f5b92b82 100644
    --- a/shell/platform/darwin/ios/BUILD.gn
    +++ b/shell/platform/darwin/ios/BUILD.gn
    @@ -109,20 +109,11 @@ shared_library("create_flutter_framework_dylib") {
         "$flutter_root/fml",
         "$flutter_root/lib/ui",
         "$flutter_root/runtime",
    +    "$flutter_root/runtime:libdart",
         "$flutter_root/shell/common",
         "$flutter_root/shell/platform/darwin/common",
         "//third_party/skia",
       ]
    -  if (flutter_runtime_mode == "debug" ||
    -      flutter_runtime_mode == "dynamic_profile" ||
    -      flutter_runtime_mode == "dynamic_release") {
    -    deps += [
    -      "$flutter_root/lib/snapshot",
    -      "//third_party/dart/runtime:libdart_jit",
    -    ]
    -  } else {
    -    deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ]
    -  }
     
       public_configs = [ "$flutter_root:config" ]
     
    diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn
    index 9fa9c2995655f..6b54826cfa132 100644
    --- a/shell/platform/embedder/BUILD.gn
    +++ b/shell/platform/embedder/BUILD.gn
    @@ -45,21 +45,13 @@ source_set("embedder") {
         "$flutter_root/common",
         "$flutter_root/flow",
         "$flutter_root/fml",
    +    "$flutter_root/runtime:libdart",
         "$flutter_root/shell/common",
         "//third_party/dart/runtime/bin:dart_io_api",
         "//third_party/skia",
         "//third_party/tonic",
       ]
     
    -  if (flutter_runtime_mode == "profile" || flutter_runtime_mode == "release") {
    -    deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ]
    -  } else {
    -    deps += [
    -      "$flutter_root/lib/snapshot",
    -      "//third_party/dart/runtime:libdart_jit",
    -    ]
    -  }
    -
       public_configs = [ "$flutter_root:config" ]
     }
     
    
    From e633b26c5cc334a6172924e1a7c5d901f900191e Mon Sep 17 00:00:00 2001
    From: Jonah Williams 
    Date: Fri, 29 Mar 2019 14:54:53 -0700
    Subject: [PATCH 0633/1117] Introduce unit tests and refactor web dart:ui into
     "package" (#8346)
    
    ---
     ci/licenses_golden/licenses_flutter           |  31 ++--
     lib/stub_ui/{ => lib}/compositing.dart        |   2 +-
     lib/stub_ui/{ => lib}/geometry.dart           |   2 +-
     lib/stub_ui/{ => lib}/hash_codes.dart         |   2 +-
     lib/stub_ui/{ => lib}/hooks.dart              |   2 +-
     .../{ => lib}/isolate_name_server.dart        |   2 +-
     lib/stub_ui/{ => lib}/lerp.dart               |   2 +-
     lib/stub_ui/{ => lib}/natives.dart            |   2 +-
     lib/stub_ui/{ => lib}/painting.dart           |   2 +-
     lib/stub_ui/{ => lib}/plugins.dart            |   2 +-
     lib/stub_ui/{ => lib}/pointer.dart            |   2 +-
     lib/stub_ui/{ => lib}/semantics.dart          |   2 +-
     lib/stub_ui/{ => lib}/text.dart               |   2 +-
     lib/stub_ui/{ => lib}/ui.dart                 |   5 +-
     lib/stub_ui/{ => lib}/versions.dart           |   2 +-
     lib/stub_ui/{ => lib}/window.dart             |   2 +-
     lib/stub_ui/pubspec.yaml                      |  13 ++
     lib/stub_ui/test/colors_test.dart             | 140 ++++++++++++++++++
     web_sdk/BUILD.gn                              |  47 +++---
     web_sdk/sdk_rewriter.dart                     |  41 +++++
     web_sdk/test/api_conform_test.dart            |   4 +-
     21 files changed, 258 insertions(+), 51 deletions(-)
     rename lib/stub_ui/{ => lib}/compositing.dart (99%)
     rename lib/stub_ui/{ => lib}/geometry.dart (99%)
     rename lib/stub_ui/{ => lib}/hash_codes.dart (99%)
     rename lib/stub_ui/{ => lib}/hooks.dart (99%)
     rename lib/stub_ui/{ => lib}/isolate_name_server.dart (99%)
     rename lib/stub_ui/{ => lib}/lerp.dart (95%)
     rename lib/stub_ui/{ => lib}/natives.dart (99%)
     rename lib/stub_ui/{ => lib}/painting.dart (99%)
     rename lib/stub_ui/{ => lib}/plugins.dart (99%)
     rename lib/stub_ui/{ => lib}/pointer.dart (99%)
     rename lib/stub_ui/{ => lib}/semantics.dart (99%)
     rename lib/stub_ui/{ => lib}/text.dart (99%)
     rename lib/stub_ui/{ => lib}/ui.dart (87%)
     rename lib/stub_ui/{ => lib}/versions.dart (97%)
     rename lib/stub_ui/{ => lib}/window.dart (99%)
     create mode 100644 lib/stub_ui/pubspec.yaml
     create mode 100644 lib/stub_ui/test/colors_test.dart
     create mode 100644 web_sdk/sdk_rewriter.dart
    
    diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter
    index 09b0fa1005509..eb96631316d45 100644
    --- a/ci/licenses_golden/licenses_flutter
    +++ b/ci/licenses_golden/licenses_flutter
    @@ -246,21 +246,21 @@ 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.h
    -FILE: ../../../flutter/lib/stub_ui/compositing.dart
    -FILE: ../../../flutter/lib/stub_ui/geometry.dart
    -FILE: ../../../flutter/lib/stub_ui/hash_codes.dart
    -FILE: ../../../flutter/lib/stub_ui/hooks.dart
    -FILE: ../../../flutter/lib/stub_ui/isolate_name_server.dart
    -FILE: ../../../flutter/lib/stub_ui/lerp.dart
    -FILE: ../../../flutter/lib/stub_ui/natives.dart
    -FILE: ../../../flutter/lib/stub_ui/painting.dart
    -FILE: ../../../flutter/lib/stub_ui/plugins.dart
    -FILE: ../../../flutter/lib/stub_ui/pointer.dart
    -FILE: ../../../flutter/lib/stub_ui/semantics.dart
    -FILE: ../../../flutter/lib/stub_ui/text.dart
    -FILE: ../../../flutter/lib/stub_ui/ui.dart
    -FILE: ../../../flutter/lib/stub_ui/versions.dart
    -FILE: ../../../flutter/lib/stub_ui/window.dart
    +FILE: ../../../flutter/lib/stub_ui/lib/compositing.dart
    +FILE: ../../../flutter/lib/stub_ui/lib/geometry.dart
    +FILE: ../../../flutter/lib/stub_ui/lib/hash_codes.dart
    +FILE: ../../../flutter/lib/stub_ui/lib/hooks.dart
    +FILE: ../../../flutter/lib/stub_ui/lib/isolate_name_server.dart
    +FILE: ../../../flutter/lib/stub_ui/lib/lerp.dart
    +FILE: ../../../flutter/lib/stub_ui/lib/natives.dart
    +FILE: ../../../flutter/lib/stub_ui/lib/painting.dart
    +FILE: ../../../flutter/lib/stub_ui/lib/plugins.dart
    +FILE: ../../../flutter/lib/stub_ui/lib/pointer.dart
    +FILE: ../../../flutter/lib/stub_ui/lib/semantics.dart
    +FILE: ../../../flutter/lib/stub_ui/lib/text.dart
    +FILE: ../../../flutter/lib/stub_ui/lib/ui.dart
    +FILE: ../../../flutter/lib/stub_ui/lib/versions.dart
    +FILE: ../../../flutter/lib/stub_ui/lib/window.dart
     FILE: ../../../flutter/lib/ui/compositing.dart
     FILE: ../../../flutter/lib/ui/compositing/scene.cc
     FILE: ../../../flutter/lib/ui/compositing/scene.h
    @@ -751,6 +751,7 @@ FILE: ../../../flutter/web_sdk/flutter_kernel_sdk.dart
     FILE: ../../../flutter/web_sdk/libraries.dart
     FILE: ../../../flutter/web_sdk/libraries.json
     FILE: ../../../flutter/web_sdk/make_combined_sdk.dart
    +FILE: ../../../flutter/web_sdk/sdk_rewriter.dart
     ----------------------------------------------------------------------------------------------------
     Copyright 2013 The Flutter Authors. All rights reserved.
     
    diff --git a/lib/stub_ui/compositing.dart b/lib/stub_ui/lib/compositing.dart
    similarity index 99%
    rename from lib/stub_ui/compositing.dart
    rename to lib/stub_ui/lib/compositing.dart
    index 1575db3a06a51..021977a761f29 100644
    --- a/lib/stub_ui/compositing.dart
    +++ b/lib/stub_ui/lib/compositing.dart
    @@ -2,7 +2,7 @@
     // Use of this source code is governed by a BSD-style license that can be
     // found in the LICENSE file.
     
    -part of dart.ui;
    +part of ui;
     
     /// An opaque object representing a composited scene.
     ///
    diff --git a/lib/stub_ui/geometry.dart b/lib/stub_ui/lib/geometry.dart
    similarity index 99%
    rename from lib/stub_ui/geometry.dart
    rename to lib/stub_ui/lib/geometry.dart
    index 0bc96c2b1eb3a..e112ef2389a8c 100644
    --- a/lib/stub_ui/geometry.dart
    +++ b/lib/stub_ui/lib/geometry.dart
    @@ -2,7 +2,7 @@
     // Use of this source code is governed by a BSD-style license that can be
     // found in the LICENSE file.
     
    -part of dart.ui;
    +part of ui;
     
     /// Base class for [Size] and [Offset], which are both ways to describe
     /// a distance as a two-dimensional axis-aligned vector.
    diff --git a/lib/stub_ui/hash_codes.dart b/lib/stub_ui/lib/hash_codes.dart
    similarity index 99%
    rename from lib/stub_ui/hash_codes.dart
    rename to lib/stub_ui/lib/hash_codes.dart
    index a3a24d7b7dd54..60194ff1487a2 100644
    --- a/lib/stub_ui/hash_codes.dart
    +++ b/lib/stub_ui/lib/hash_codes.dart
    @@ -2,7 +2,7 @@
     // Use of this source code is governed by a BSD-style license that can be
     // found in the LICENSE file.
     
    -part of dart.ui;
    +part of ui;
     
     class _HashEnd { const _HashEnd(); }
     const _HashEnd _hashEnd = const _HashEnd();
    diff --git a/lib/stub_ui/hooks.dart b/lib/stub_ui/lib/hooks.dart
    similarity index 99%
    rename from lib/stub_ui/hooks.dart
    rename to lib/stub_ui/lib/hooks.dart
    index 4ea381bfb8d34..8770c3fac010a 100644
    --- a/lib/stub_ui/hooks.dart
    +++ b/lib/stub_ui/lib/hooks.dart
    @@ -4,7 +4,7 @@
     
     // TODO(dnfield): Remove unused_import ignores when https://github.com/dart-lang/sdk/issues/35164 is resolved.
     
    -part of dart.ui;
    +part of ui;
     
     // ignore: unused_element
     String _decodeUTF8(ByteData message) {
    diff --git a/lib/stub_ui/isolate_name_server.dart b/lib/stub_ui/lib/isolate_name_server.dart
    similarity index 99%
    rename from lib/stub_ui/isolate_name_server.dart
    rename to lib/stub_ui/lib/isolate_name_server.dart
    index b346dc8f32aa9..77aec762369fa 100644
    --- a/lib/stub_ui/isolate_name_server.dart
    +++ b/lib/stub_ui/lib/isolate_name_server.dart
    @@ -2,7 +2,7 @@
     // Use of this source code is governed by a BSD-style license that can be
     // found in the LICENSE file.
     
    -part of dart.ui;
    +part of ui;
     
     /// Static methods to allow for simple sharing of [SendPort]s across [Isolate]s.
     ///
    diff --git a/lib/stub_ui/lerp.dart b/lib/stub_ui/lib/lerp.dart
    similarity index 95%
    rename from lib/stub_ui/lerp.dart
    rename to lib/stub_ui/lib/lerp.dart
    index 0c69476779b73..b1af1c043491f 100644
    --- a/lib/stub_ui/lerp.dart
    +++ b/lib/stub_ui/lib/lerp.dart
    @@ -2,7 +2,7 @@
     // Use of this source code is governed by a BSD-style license that can be
     // found in the LICENSE file.
     
    -part of dart.ui;
    +part of ui;
     
     /// Linearly interpolate between two numbers.
     double lerpDouble(num a, num b, double t) {
    diff --git a/lib/stub_ui/natives.dart b/lib/stub_ui/lib/natives.dart
    similarity index 99%
    rename from lib/stub_ui/natives.dart
    rename to lib/stub_ui/lib/natives.dart
    index 9e46816e5f5b5..f40ef975a77dc 100644
    --- a/lib/stub_ui/natives.dart
    +++ b/lib/stub_ui/lib/natives.dart
    @@ -4,7 +4,7 @@
     
     // TODO(dnfield): remove unused_element ignores when https://github.com/dart-lang/sdk/issues/35164 is resolved.
     
    -part of dart.ui;
    +part of ui;
     
     // A service protocol extension to schedule a frame to be rendered into the
     // window.
    diff --git a/lib/stub_ui/painting.dart b/lib/stub_ui/lib/painting.dart
    similarity index 99%
    rename from lib/stub_ui/painting.dart
    rename to lib/stub_ui/lib/painting.dart
    index ce60d7bb130df..881d2010d2ee6 100644
    --- a/lib/stub_ui/painting.dart
    +++ b/lib/stub_ui/lib/painting.dart
    @@ -2,7 +2,7 @@
     // Use of this source code is governed by a BSD-style license that can be
     // found in the LICENSE file.
     
    -part of dart.ui;
    +part of ui;
     
     // Some methods in this file assert that their arguments are not null. These
     // asserts are just to improve the error messages; they should only cover
    diff --git a/lib/stub_ui/plugins.dart b/lib/stub_ui/lib/plugins.dart
    similarity index 99%
    rename from lib/stub_ui/plugins.dart
    rename to lib/stub_ui/lib/plugins.dart
    index 12dbbf2d3c98f..83784f39ab2a8 100644
    --- a/lib/stub_ui/plugins.dart
    +++ b/lib/stub_ui/lib/plugins.dart
    @@ -2,7 +2,7 @@
     // Use of this source code is governed by a BSD-style license that can be
     // found in the LICENSE file.
     
    -part of dart.ui;
    +part of ui;
     
     /// A wrapper for a raw callback handle.
     ///
    diff --git a/lib/stub_ui/pointer.dart b/lib/stub_ui/lib/pointer.dart
    similarity index 99%
    rename from lib/stub_ui/pointer.dart
    rename to lib/stub_ui/lib/pointer.dart
    index fd5f3a13e25aa..4ab9c3a005a8e 100644
    --- a/lib/stub_ui/pointer.dart
    +++ b/lib/stub_ui/lib/pointer.dart
    @@ -2,7 +2,7 @@
     // Use of this source code is governed by a BSD-style license that can be
     // found in the LICENSE file.
     
    -part of dart.ui;
    +part of ui;
     
     /// How the pointer has changed since the last report.
     enum PointerChange {
    diff --git a/lib/stub_ui/semantics.dart b/lib/stub_ui/lib/semantics.dart
    similarity index 99%
    rename from lib/stub_ui/semantics.dart
    rename to lib/stub_ui/lib/semantics.dart
    index cd2715eddf3db..fa1bd09b9d611 100644
    --- a/lib/stub_ui/semantics.dart
    +++ b/lib/stub_ui/lib/semantics.dart
    @@ -2,7 +2,7 @@
     // Use of this source code is governed by a BSD-style license that can be
     // found in the LICENSE file.
     
    -part of dart.ui;
    +part of ui;
     
     /// The possible actions that can be conveyed from the operating system
     /// accessibility APIs to a semantics node.
    diff --git a/lib/stub_ui/text.dart b/lib/stub_ui/lib/text.dart
    similarity index 99%
    rename from lib/stub_ui/text.dart
    rename to lib/stub_ui/lib/text.dart
    index dd07b232980ca..f6e1bd92fd1b8 100644
    --- a/lib/stub_ui/text.dart
    +++ b/lib/stub_ui/lib/text.dart
    @@ -2,7 +2,7 @@
     // Use of this source code is governed by a BSD-style license that can be
     // found in the LICENSE file.
     
    -part of dart.ui;
    +part of ui;
     
     /// Whether to slant the glyphs in the font
     enum FontStyle {
    diff --git a/lib/stub_ui/ui.dart b/lib/stub_ui/lib/ui.dart
    similarity index 87%
    rename from lib/stub_ui/ui.dart
    rename to lib/stub_ui/lib/ui.dart
    index f87f1ec6f2d58..5ee9308271884 100644
    --- a/lib/stub_ui/ui.dart
    +++ b/lib/stub_ui/lib/ui.dart
    @@ -9,13 +9,14 @@
     /// This library exposes the lowest-level services that Flutter frameworks use
     /// to bootstrap applications, such as classes for driving the input, graphics
     /// text, layout, and rendering subsystems.
    -library dart.ui;
    +library ui;
     
    -import 'dart:_internal' hide Symbol; // ignore: import_internal_library, unused_import
    +//import 'dart:_internal' hide Symbol; // ignore: import_internal_library, unused_import
     import 'dart:async';
     import 'dart:collection' as collection;
     import 'dart:convert';
     import 'dart:developer' as developer;
    +import 'dart:html'; // ignore: unused_import
     import 'dart:io'; // ignore: unused_import
     import 'dart:isolate' show SendPort;
     import 'dart:math' as math;
    diff --git a/lib/stub_ui/versions.dart b/lib/stub_ui/lib/versions.dart
    similarity index 97%
    rename from lib/stub_ui/versions.dart
    rename to lib/stub_ui/lib/versions.dart
    index 3f555262b8f9a..d7a61a4363d11 100644
    --- a/lib/stub_ui/versions.dart
    +++ b/lib/stub_ui/lib/versions.dart
    @@ -2,7 +2,7 @@
     // Use of this source code is governed by a BSD-style license that can be
     // found in the LICENSE file.
     
    -part of dart.ui;
    +part of ui;
     
     /// Wraps version information for Dart, Skia and Flutter.
     class Versions {
    diff --git a/lib/stub_ui/window.dart b/lib/stub_ui/lib/window.dart
    similarity index 99%
    rename from lib/stub_ui/window.dart
    rename to lib/stub_ui/lib/window.dart
    index f3dedc642887e..d874f7b5a9677 100644
    --- a/lib/stub_ui/window.dart
    +++ b/lib/stub_ui/lib/window.dart
    @@ -2,7 +2,7 @@
     // Use of this source code is governed by a BSD-style license that can be
     // found in the LICENSE file.
     
    -part of dart.ui;
    +part of ui;
     
     /// Signature of callbacks that have no arguments and return no data.
     typedef VoidCallback = void Function();
    diff --git a/lib/stub_ui/pubspec.yaml b/lib/stub_ui/pubspec.yaml
    new file mode 100644
    index 0000000000000..ccda5d6d80ce3
    --- /dev/null
    +++ b/lib/stub_ui/pubspec.yaml
    @@ -0,0 +1,13 @@
    +name: ui
    +
    +environment:
    +  # The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite.
    +  sdk: ">=2.2.0 <3.0.0"
    +
    +dev_dependencies:
    +  test: ^1.6.0
    +  build: ^1.1.2
    +  build_runner: ^1.3.1
    +  build_test: ^0.10.6
    +  build_web_compilers: ^1.2.0
    +  
    diff --git a/lib/stub_ui/test/colors_test.dart b/lib/stub_ui/test/colors_test.dart
    new file mode 100644
    index 0000000000000..63115d34cd20d
    --- /dev/null
    +++ b/lib/stub_ui/test/colors_test.dart
    @@ -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.
    +
    +import 'package:ui/ui.dart';
    +
    +import 'package:test/test.dart';
    +
    +class NotAColor extends Color {
    +  const NotAColor(int value) : super(value);
    +}
    +
    +void main() {
    +  test('color accessors should work', () {
    +    const Color foo = Color(0x12345678);
    +    expect(foo.alpha, equals(0x12));
    +    expect(foo.red, equals(0x34));
    +    expect(foo.green, equals(0x56));
    +    expect(foo.blue, equals(0x78));
    +  });
    +
    +  test('paint set to black', () {
    +    const Color c = Color(0x00000000);
    +    final Paint p = new Paint();
    +    p.color = c;
    +    expect(c.toString(), equals('Color(0x00000000)'));
    +  });
    +
    +  test('color created with out of bounds value', () {
    +    try {
    +      const Color c = Color(0x100 << 24);
    +      final Paint p = new Paint();
    +      p.color = c;
    +    } catch (e) {
    +      expect(e != null, equals(true));
    +    }
    +  });
    +
    +  test('color created with wildly out of bounds value', () {
    +    try {
    +      const Color c = Color(1 << 1000000);
    +      final Paint p = new Paint();
    +      p.color = c;
    +    } catch (e) {
    +      expect(e != null, equals(true));
    +    }
    +  });
    +
    +  test('two colors are only == if they have the same runtime type', () {
    +    expect(const Color(123), equals(const Color(123)));
    +    expect(const Color(123),
    +        equals(Color(123))); // ignore: prefer_const_constructors
    +    expect(const Color(123), isNot(equals(const Color(321))));
    +    expect(const Color(123), isNot(equals(const NotAColor(123))));
    +    expect(const NotAColor(123), isNot(equals(const Color(123))));
    +    expect(const NotAColor(123), equals(const NotAColor(123)));
    +  });
    +
    +  test('Color.lerp', () {
    +    expect(
    +      Color.lerp(const Color(0x00000000), const Color(0xFFFFFFFF), 0.0),
    +      const Color(0x00000000),
    +    );
    +    expect(
    +      Color.lerp(const Color(0x00000000), const Color(0xFFFFFFFF), 0.5),
    +      const Color(0x7F7F7F7F),
    +    );
    +    expect(
    +      Color.lerp(const Color(0x00000000), const Color(0xFFFFFFFF), 1.0),
    +      const Color(0xFFFFFFFF),
    +    );
    +    expect(
    +      Color.lerp(const Color(0x00000000), const Color(0xFFFFFFFF), -0.1),
    +      const Color(0x00000000),
    +    );
    +    expect(
    +      Color.lerp(const Color(0x00000000), const Color(0xFFFFFFFF), 1.1),
    +      const Color(0xFFFFFFFF),
    +    );
    +  });
    +
    +  test('Color.alphaBlend', () {
    +    expect(
    +      Color.alphaBlend(const Color(0x00000000), const Color(0x00000000)),
    +      const Color(0x00000000),
    +    );
    +    expect(
    +      Color.alphaBlend(const Color(0x00000000), const Color(0xFFFFFFFF)),
    +      const Color(0xFFFFFFFF),
    +    );
    +    expect(
    +      Color.alphaBlend(const Color(0xFFFFFFFF), const Color(0x00000000)),
    +      const Color(0xFFFFFFFF),
    +    );
    +    expect(
    +      Color.alphaBlend(const Color(0xFFFFFFFF), const Color(0xFFFFFFFF)),
    +      const Color(0xFFFFFFFF),
    +    );
    +    expect(
    +      Color.alphaBlend(const Color(0x80FFFFFF), const Color(0xFF000000)),
    +      const Color(0xFF808080),
    +    );
    +    expect(
    +      Color.alphaBlend(const Color(0x80808080), const Color(0xFFFFFFFF)),
    +      const Color(0xFFBFBFBF),
    +    );
    +    expect(
    +      Color.alphaBlend(const Color(0x80808080), const Color(0xFF000000)),
    +      const Color(0xFF404040),
    +    );
    +    expect(
    +      Color.alphaBlend(const Color(0x01020304), const Color(0xFF000000)),
    +      const Color(0xFF000000),
    +    );
    +    expect(
    +      Color.alphaBlend(const Color(0x11223344), const Color(0xFF000000)),
    +      const Color(0xFF020304),
    +    );
    +    expect(
    +      Color.alphaBlend(const Color(0x11223344), const Color(0x80000000)),
    +      const Color(0x88040608),
    +    );
    +  });
    +
    +  test('compute gray luminance', () {
    +    // Each color component is at 20%.
    +    const Color lightGray = Color(0xFF333333);
    +    // Relative luminance's formula is just the linearized color value for gray.
    +    // ((0.2 + 0.055) / 1.055) ^ 2.4.
    +    expect(lightGray.computeLuminance(), equals(0.033104766570885055));
    +  });
    +
    +  test('compute color luminance', () {
    +    const Color brightRed = Color(0xFFFF3B30);
    +    // 0.2126 * ((1.0 + 0.055) / 1.055) ^ 2.4 +
    +    // 0.7152 * ((0.23137254902 +0.055) / 1.055) ^ 2.4 +
    +    // 0.0722 * ((0.18823529411 + 0.055) / 1.055) ^ 2.4
    +    expect(brightRed.computeLuminance(), equals(0.24601329637099723));
    +  });
    +}
    diff --git a/web_sdk/BUILD.gn b/web_sdk/BUILD.gn
    index 7382b8a6b6d5f..82b502a5cf651 100644
    --- a/web_sdk/BUILD.gn
    +++ b/web_sdk/BUILD.gn
    @@ -9,21 +9,21 @@ sdk_dill = "$root_out_dir/flutter_web_sdk/kernel/flutter_ddc_sdk.dill"
     sdk_libraries_json = "$flutter_root/web_sdk/libraries.json"
     
     web_ui_sources = [
    -  "$flutter_root/lib/stub_ui/compositing.dart",
    -  "$flutter_root/lib/stub_ui/geometry.dart",
    -  "$flutter_root/lib/stub_ui/hash_codes.dart",
    -  "$flutter_root/lib/stub_ui/hooks.dart",
    -  "$flutter_root/lib/stub_ui/isolate_name_server.dart",
    -  "$flutter_root/lib/stub_ui/lerp.dart",
    -  "$flutter_root/lib/stub_ui/natives.dart",
    -  "$flutter_root/lib/stub_ui/painting.dart",
    -  "$flutter_root/lib/stub_ui/plugins.dart",
    -  "$flutter_root/lib/stub_ui/pointer.dart",
    -  "$flutter_root/lib/stub_ui/semantics.dart",
    -  "$flutter_root/lib/stub_ui/text.dart",
    -  "$flutter_root/lib/stub_ui/ui.dart",
    -  "$flutter_root/lib/stub_ui/versions.dart",
    -  "$flutter_root/lib/stub_ui/window.dart",
    +  "$flutter_root/lib/stub_ui/lib/compositing.dart",
    +  "$flutter_root/lib/stub_ui/lib/geometry.dart",
    +  "$flutter_root/lib/stub_ui/lib/hash_codes.dart",
    +  "$flutter_root/lib/stub_ui/lib/hooks.dart",
    +  "$flutter_root/lib/stub_ui/lib/isolate_name_server.dart",
    +  "$flutter_root/lib/stub_ui/lib/lerp.dart",
    +  "$flutter_root/lib/stub_ui/lib/natives.dart",
    +  "$flutter_root/lib/stub_ui/lib/painting.dart",
    +  "$flutter_root/lib/stub_ui/lib/plugins.dart",
    +  "$flutter_root/lib/stub_ui/lib/pointer.dart",
    +  "$flutter_root/lib/stub_ui/lib/semantics.dart",
    +  "$flutter_root/lib/stub_ui/lib/text.dart",
    +  "$flutter_root/lib/stub_ui/lib/ui.dart",
    +  "$flutter_root/lib/stub_ui/lib/versions.dart",
    +  "$flutter_root/lib/stub_ui/lib/window.dart",
     ]
     
     group("web_sdk") {
    @@ -33,12 +33,23 @@ group("web_sdk") {
       ]
     }
     
    -copy("web_ui_sources") {
    -  sources = web_ui_sources
    +prebuilt_dart_action("web_ui_sources") {
    +  inputs = web_ui_sources + [ "sdk_rewriter.dart" ]
    +
    +  packages = "//third_party/dart/.packages"
    +  script = "sdk_rewriter.dart"
    +  output_dir = rebase_path("$root_out_dir/flutter_web_sdk/lib/ui/")
    +
    +  args = [ "--output-dir=$output_dir" ]
     
       outputs = [
    -    "$root_out_dir/flutter_web_sdk/lib/ui/{{source_file_part}}",
    +    "$root_out_dir/flutter_web_sdk_stamp",
       ]
    +
    +  foreach(source_file, web_ui_sources) {
    +    path = rebase_path(source_file)
    +    args += [ "--input=$path" ]
    +  }
     }
     
     copy("web_ui_library") {
    diff --git a/web_sdk/sdk_rewriter.dart b/web_sdk/sdk_rewriter.dart
    new file mode 100644
    index 0000000000000..e44350e76aa58
    --- /dev/null
    +++ b/web_sdk/sdk_rewriter.dart
    @@ -0,0 +1,41 @@
    +// Copyright 2013 The Flutter 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 'dart:io';
    +
    +import 'package:args/args.dart';
    +import 'package:path/path.dart' as path;
    +
    +final ArgParser argParser = ArgParser()
    +  ..addOption('output-dir')
    +  ..addMultiOption('input');
    +
    +const Pattern packageLibraryName = 'library ui;';
    +const Pattern packagePartName = 'part of ui;';
    +const Pattern coreLibraryName = 'library dart.ui;';
    +const Pattern corePartName = 'part of dart.ui;';
    +
    +// Rewrites the "package"-style web ui library into a dart:ui implementation.
    +// So far this only requires a replace of the library declarations.
    +void main(List arguments) {
    +  final ArgResults results = argParser.parse(arguments);
    +  final Directory directory = Directory(results['output-dir']);
    +  if (!directory.existsSync()) {
    +    directory.createSync(recursive: true);
    +  }
    +  for (String inputFilePath in results['input']) {
    +    final File inputFile = File(inputFilePath);
    +    final String fileName = path.split(inputFilePath).last;
    +    final File outputFile = File(path.join(directory.path, fileName))
    +      ..createSync();
    +    String source;
    +    if (fileName == 'ui.dart') {
    +      source = inputFile.readAsStringSync().replaceFirst(packageLibraryName, coreLibraryName);
    +      outputFile.writeAsStringSync(source);
    +    } else {
    +      source = inputFile.readAsStringSync().replaceFirst(packagePartName, corePartName);
    +    }
    +    outputFile.writeAsStringSync(source);
    +  }
    +}
    diff --git a/web_sdk/test/api_conform_test.dart b/web_sdk/test/api_conform_test.dart
    index 1a7f8c53a7c6d..bf4b6283038f1 100644
    --- a/web_sdk/test/api_conform_test.dart
    +++ b/web_sdk/test/api_conform_test.dart
    @@ -8,7 +8,7 @@ int main() {
       // These files just contain imports to the part files;
       final CompilationUnit uiUnit = parseDartFile('lib/ui/ui.dart',
           parseFunctionBodies: false, suppressErrors: false);
    -  final CompilationUnit webUnit = parseDartFile('lib/stub_ui/ui.dart',
    +  final CompilationUnit webUnit = parseDartFile('lib/stub_ui/lib/ui.dart',
           parseFunctionBodies: false, suppressErrors: false);
       final Map uiClasses = {};
       final Map webClasses = {};
    @@ -16,7 +16,7 @@ int main() {
       // Gather all public classes from each library. For now we are skiping
       // other top level members.
       _collectPublicClasses(uiUnit, uiClasses, 'lib/ui/');
    -  _collectPublicClasses(webUnit, webClasses, 'lib/stub_ui/');
    +  _collectPublicClasses(webUnit, webClasses, 'lib/stub_ui/lib/');
     
       if (uiClasses.isEmpty || webClasses.isEmpty) {
         print('Warning: did not resolve any classes.');
    
    From fdcbb40fe9afded7e150fb6bf53cc4212af0245b Mon Sep 17 00:00:00 2001
    From: Zachary Anderson 
    Date: Fri, 29 Mar 2019 14:57:40 -0700
    Subject: [PATCH 0634/1117] [flutter_tester] Accept --icu-data-file-path
     (#8374)
    
    ---
     shell/testing/tester_main.cc | 4 +++-
     1 file changed, 3 insertions(+), 1 deletion(-)
    
    diff --git a/shell/testing/tester_main.cc b/shell/testing/tester_main.cc
    index 7aa9dee3c0794..75cd8fe79657b 100644
    --- a/shell/testing/tester_main.cc
    +++ b/shell/testing/tester_main.cc
    @@ -251,7 +251,9 @@ int main(int argc, char* argv[]) {
         return EXIT_FAILURE;
       }
     
    -  settings.icu_data_path = "icudtl.dat";
    +  if (settings.icu_data_path.size() == 0) {
    +    settings.icu_data_path = "icudtl.dat";
    +  }
     
       // The tools that read logs get confused if there is a log tag specified.
       settings.log_tag = "";
    
    From 71d59cde9e5b4e77a28534ae56e25d6382f45190 Mon Sep 17 00:00:00 2001
    From: Jason Simmons 
    Date: Fri, 29 Mar 2019 15:42:11 -0700
    Subject: [PATCH 0635/1117] Check for hover motion events in
     AndroidTouchProcessor (#8376)
    
    Fixes https://github.com/flutter/flutter/issues/30122
    ---
     .../io/flutter/embedding/android/AndroidTouchProcessor.java    | 3 +++
     1 file changed, 3 insertions(+)
    
    diff --git a/shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java b/shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java
    index ce69702143551..611b1003d2297 100644
    --- a/shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java
    +++ b/shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java
    @@ -277,6 +277,9 @@ private int getPointerChangeForAction(int maskedAction) {
         if (maskedAction == MotionEvent.ACTION_MOVE) {
           return PointerChange.MOVE;
         }
    +    if (maskedAction == MotionEvent.ACTION_HOVER_MOVE) {
    +      return PointerChange.HOVER;
    +    }
         if (maskedAction == MotionEvent.ACTION_CANCEL) {
           return PointerChange.CANCEL;
         }
    
    From d0239bd83496662b4418b7caeea6a496b8df2031 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Fri, 29 Mar 2019 20:13:51 -0400
    Subject: [PATCH 0636/1117] Roll src/third_party/skia
     73c6c9d26870..59b733715141 (3 commits) (#8378)
    
    https://skia.googlesource.com/skia.git/%2Blog/73c6c9d26870..59b733715141
    
    git log 73c6c9d268708f75e2fcdea6b2f7b7e2bf6eacae..59b733715141b732ce3fb73b8870851f616c3163 --date=short --no-merges --format=%ad %ae %s
    2019-03-29 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    2019-03-29 ethannicholas@google.com Revert "GPU support for SkMixers"
    2019-03-29 ethannicholas@google.com GPU support for SkMixers
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 4701326c94bb2..48665f920bdfa 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': '73c6c9d268708f75e2fcdea6b2f7b7e2bf6eacae',
    +  'skia_revision': '59b733715141b732ce3fb73b8870851f616c3163',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 431cee7027215..388631f660dc8 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 4f9684ee6c85476f7ecbcb317adeb5b5
    +Signature: 1e5ba4503f09d4f957b11079c2449a6c
     
     UNUSED LICENSES:
     
    
    From ca7623eb39d74a8cbdd095fcc7db398267b6928f Mon Sep 17 00:00:00 2001
    From: Jason Simmons 
    Date: Fri, 29 Mar 2019 17:15:04 -0700
    Subject: [PATCH 0637/1117] Handle null values in
     TextInputConfiguration.actionLabel JSON (#8377)
    
    Fixes https://github.com/flutter/flutter/issues/29798
    ---
     .../embedding/engine/systemchannels/TextInputChannel.java       | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java b/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java
    index b23d33fd00996..728ae40797775 100644
    --- a/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java
    +++ b/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java
    @@ -242,7 +242,7 @@ public static Configuration fromJson(@NonNull JSONObject json) throws JSONExcept
               TextCapitalization.fromValue(json.getString("textCapitalization")),
               InputType.fromJson(json.getJSONObject("inputType")),
               inputAction,
    -          json.optString("actionLabel")
    +          json.isNull("actionLabel") ? null : json.getString("actionLabel")
           );
         }
     
    
    From 972afdc92b6aee09304f1fa78e390e7756c44e82 Mon Sep 17 00:00:00 2001
    From: Chinmay Garde 
    Date: Fri, 29 Mar 2019 17:15:38 -0700
    Subject: [PATCH 0638/1117] Allow running runtime_unittests in AOT mode.
     (#8375)
    
    Previously, only the most basic tests were run in AOT mode.
    ---
     ci/licenses_golden/licenses_flutter |  2 +
     runtime/BUILD.gn                    |  4 +-
     runtime/dart_isolate_unittests.cc   | 69 ++++++++++++-----------
     runtime/dart_vm_unittests.cc        |  1 -
     runtime/fixtures/simple_main.dart   |  2 +
     runtime/runtime_test.cc             | 87 +++++++++++++++++++++++++++++
     runtime/runtime_test.h              | 37 ++++++++++++
     testing/thread_test.cc              |  2 +
     testing/thread_test.h               |  2 +
     9 files changed, 171 insertions(+), 35 deletions(-)
     create mode 100644 runtime/runtime_test.cc
     create mode 100644 runtime/runtime_test.h
    
    diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter
    index eb96631316d45..c9914e4c2156f 100644
    --- a/ci/licenses_golden/licenses_flutter
    +++ b/ci/licenses_golden/licenses_flutter
    @@ -391,6 +391,8 @@ 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/runtime_test.cc
    +FILE: ../../../flutter/runtime/runtime_test.h
     FILE: ../../../flutter/runtime/service_protocol.cc
     FILE: ../../../flutter/runtime/service_protocol.h
     FILE: ../../../flutter/runtime/start_up.cc
    diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
    index e01cf5d8f20db..9aeba8e6e3cbb 100644
    --- a/runtime/BUILD.gn
    +++ b/runtime/BUILD.gn
    @@ -104,16 +104,18 @@ executable("runtime_unittests") {
         "dart_isolate_unittests.cc",
         "dart_service_isolate_unittests.cc",
         "dart_vm_unittests.cc",
    +    "runtime_test.cc",
    +    "runtime_test.h",
       ]
     
       deps = [
    +    ":libdart",
         ":runtime",
         ":runtime_fixtures",
         "$flutter_root/common",
         "$flutter_root/fml",
         "$flutter_root/lib/snapshot",
         "$flutter_root/testing",
    -    "//third_party/dart/runtime:libdart_jit",
         "//third_party/skia",
         "//third_party/tonic",
       ]
    diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc
    index 76de89deb061e..59bd9d61bb1aa 100644
    --- a/runtime/dart_isolate_unittests.cc
    +++ b/runtime/dart_isolate_unittests.cc
    @@ -7,27 +7,24 @@
     #include "flutter/fml/thread.h"
     #include "flutter/runtime/dart_isolate.h"
     #include "flutter/runtime/dart_vm.h"
    +#include "flutter/runtime/runtime_test.h"
     #include "flutter/testing/testing.h"
     #include "flutter/testing/thread_test.h"
     #include "third_party/tonic/scopes/dart_isolate_scope.h"
     
    -#if FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_DEBUG
    -#define SKIP_IF_AOT() GTEST_SKIP()
    -#else
    -#define SKIP_IF_AOT() (void)0
    -#endif
    -
     #define CURRENT_TEST_NAME                                           \
       std::string {                                                     \
         ::testing::UnitTest::GetInstance()->current_test_info()->name() \
       }
     
     namespace blink {
    +namespace testing {
     
    -using DartIsolateTest = ::testing::ThreadTest;
    +using DartIsolateTest = RuntimeTest;
     
     TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) {
       Settings settings = {};
    +  SetSnapshotsAndAssets(settings);
       settings.task_observer_add = [](intptr_t, fml::closure) {};
       settings.task_observer_remove = [](intptr_t) {};
       auto vm = DartVM::ForProcess(settings);
    @@ -130,7 +127,7 @@ class AutoIsolateShutdown {
       FML_DISALLOW_COPY_AND_ASSIGN(AutoIsolateShutdown);
     };
     
    -std::unique_ptr RunDartCodeInIsolate(
    +static std::unique_ptr RunDartCodeInIsolate(
         fml::RefPtr task_runner,
         std::string entrypoint) {
       Settings settings = {};
    @@ -174,34 +171,42 @@ std::unique_ptr RunDartCodeInIsolate(
         return {};
       }
     
    -  auto kernel_file_path =
    -      fml::paths::JoinPaths({testing::GetFixturesPath(), "kernel_blob.bin"});
    +  if (!DartVM::IsRunningPrecompiledCode()) {
    +    auto kernel_file_path = fml::paths::JoinPaths(
    +        {::testing::GetFixturesPath(), "kernel_blob.bin"});
     
    -  if (!fml::IsFile(kernel_file_path)) {
    -    FML_LOG(ERROR) << "Could not locate kernel file.";
    -    return {};
    -  }
    +    if (!fml::IsFile(kernel_file_path)) {
    +      FML_LOG(ERROR) << "Could not locate kernel file.";
    +      return {};
    +    }
     
    -  auto kernel_file = fml::OpenFile(kernel_file_path.c_str(), false,
    -                                   fml::FilePermission::kRead);
    +    auto kernel_file = fml::OpenFile(kernel_file_path.c_str(), false,
    +                                     fml::FilePermission::kRead);
     
    -  if (!kernel_file.is_valid()) {
    -    FML_LOG(ERROR) << "Kernel file descriptor was invalid.";
    -    return {};
    -  }
    +    if (!kernel_file.is_valid()) {
    +      FML_LOG(ERROR) << "Kernel file descriptor was invalid.";
    +      return {};
    +    }
     
    -  auto kernel_mapping = std::make_unique(kernel_file);
    +    auto kernel_mapping = std::make_unique(kernel_file);
     
    -  if (kernel_mapping->GetMapping() == nullptr) {
    -    FML_LOG(ERROR) << "Could not setup kernel mapping.";
    -    return {};
    -  }
    +    if (kernel_mapping->GetMapping() == nullptr) {
    +      FML_LOG(ERROR) << "Could not setup kernel mapping.";
    +      return {};
    +    }
     
    -  if (!root_isolate->get()->PrepareForRunningFromKernel(
    -          std::move(kernel_mapping))) {
    -    FML_LOG(ERROR)
    -        << "Could not prepare to run the isolate from the kernel file.";
    -    return {};
    +    if (!root_isolate->get()->PrepareForRunningFromKernel(
    +            std::move(kernel_mapping))) {
    +      FML_LOG(ERROR)
    +          << "Could not prepare to run the isolate from the kernel file.";
    +      return {};
    +    }
    +  } else {
    +    if (!root_isolate->get()->PrepareForRunningFromPrecompiledCode()) {
    +      FML_LOG(ERROR)
    +          << "Could not prepare to run the isolate from precompiled code.";
    +      return {};
    +    }
       }
     
       if (root_isolate->get()->GetPhase() != DartIsolate::Phase::Ready) {
    @@ -219,21 +224,18 @@ std::unique_ptr RunDartCodeInIsolate(
     }
     
     TEST_F(DartIsolateTest, IsolateCanLoadAndRunDartCode) {
    -  SKIP_IF_AOT();
       auto isolate = RunDartCodeInIsolate(GetCurrentTaskRunner(), "main");
       ASSERT_TRUE(isolate);
       ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running);
     }
     
     TEST_F(DartIsolateTest, IsolateCannotLoadAndRunUnknownDartEntrypoint) {
    -  SKIP_IF_AOT();
       auto isolate =
           RunDartCodeInIsolate(GetCurrentTaskRunner(), "thisShouldNotExist");
       ASSERT_FALSE(isolate);
     }
     
     TEST_F(DartIsolateTest, CanRunDartCodeCodeSynchronously) {
    -  SKIP_IF_AOT();
       auto isolate = RunDartCodeInIsolate(GetCurrentTaskRunner(), "main");
     
       ASSERT_TRUE(isolate);
    @@ -247,4 +249,5 @@ TEST_F(DartIsolateTest, CanRunDartCodeCodeSynchronously) {
       }));
     }
     
    +}  // namespace testing
     }  // namespace blink
    diff --git a/runtime/dart_vm_unittests.cc b/runtime/dart_vm_unittests.cc
    index 21e3d3d3fa58f..a0cfdfbbc5f71 100644
    --- a/runtime/dart_vm_unittests.cc
    +++ b/runtime/dart_vm_unittests.cc
    @@ -14,7 +14,6 @@ TEST(DartVM, SimpleInitialization) {
       auto vm = DartVM::ForProcess(settings);
       ASSERT_TRUE(vm);
       ASSERT_EQ(vm, DartVM::ForProcess(settings));
    -  ASSERT_FALSE(DartVM::IsRunningPrecompiledCode());
     }
     
     TEST(DartVM, SimpleIsolateNameServer) {
    diff --git a/runtime/fixtures/simple_main.dart b/runtime/fixtures/simple_main.dart
    index 5d6a46eb7f1cf..308e033efb1e3 100644
    --- a/runtime/fixtures/simple_main.dart
    +++ b/runtime/fixtures/simple_main.dart
    @@ -5,10 +5,12 @@
     void main() {
     }
     
    +@pragma('vm:entry-point')
     void sayHi() {
       print("Hi");
     }
     
    +@pragma('vm:entry-point')
     void throwExceptionNow() {
       throw("Hello");
     }
    diff --git a/runtime/runtime_test.cc b/runtime/runtime_test.cc
    new file mode 100644
    index 0000000000000..002971e8853e0
    --- /dev/null
    +++ b/runtime/runtime_test.cc
    @@ -0,0 +1,87 @@
    +// Copyright 2013 The Flutter 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/runtime_test.h"
    +
    +#include "flutter/runtime/dart_vm.h"
    +#include "flutter/testing/testing.h"
    +
    +namespace blink {
    +namespace testing {
    +
    +RuntimeTest::RuntimeTest() = default;
    +
    +RuntimeTest::~RuntimeTest() = default;
    +
    +static std::unique_ptr GetMapping(const fml::UniqueFD& directory,
    +                                                const char* path,
    +                                                bool executable) {
    +  fml::UniqueFD file = fml::OpenFile(directory, path, false /* create */,
    +                                     fml::FilePermission::kRead);
    +  if (!file.is_valid()) {
    +    return nullptr;
    +  }
    +
    +  using Prot = fml::FileMapping::Protection;
    +  std::unique_ptr mapping;
    +  if (executable) {
    +    mapping = std::make_unique(
    +        file, std::initializer_list{Prot::kRead, Prot::kExecute});
    +  } else {
    +    mapping = std::make_unique(
    +        file, std::initializer_list{Prot::kRead});
    +  }
    +
    +  if (mapping->GetSize() == 0 || mapping->GetMapping() == nullptr) {
    +    return nullptr;
    +  }
    +
    +  return mapping;
    +}
    +
    +void RuntimeTest::SetSnapshotsAndAssets(Settings& settings) {
    +  if (!assets_dir_.is_valid()) {
    +    return;
    +  }
    +
    +  settings.assets_dir = assets_dir_.get();
    +
    +  // In JIT execution, all snapshots are present within the binary itself and
    +  // don't need to be explicitly suppiled by the embedder.
    +  if (DartVM::IsRunningPrecompiledCode()) {
    +    settings.vm_snapshot_data = [this]() {
    +      return GetMapping(assets_dir_, "vm_snapshot_data", false);
    +    };
    +
    +    settings.isolate_snapshot_data = [this]() {
    +      return GetMapping(assets_dir_, "isolate_snapshot_data", false);
    +    };
    +
    +    if (DartVM::IsRunningPrecompiledCode()) {
    +      settings.vm_snapshot_instr = [this]() {
    +        return GetMapping(assets_dir_, "vm_snapshot_instr", true);
    +      };
    +
    +      settings.isolate_snapshot_instr = [this]() {
    +        return GetMapping(assets_dir_, "isolate_snapshot_instr", true);
    +      };
    +    }
    +  }
    +}
    +
    +// |testing::ThreadTest|
    +void RuntimeTest::SetUp() {
    +  assets_dir_ = fml::OpenDirectory(::testing::GetFixturesPath(), false,
    +                                   fml::FilePermission::kRead);
    +  ThreadTest::SetUp();
    +}
    +
    +// |testing::ThreadTest|
    +void RuntimeTest::TearDown() {
    +  ThreadTest::TearDown();
    +  assets_dir_.reset();
    +}
    +
    +}  // namespace testing
    +}  // namespace blink
    diff --git a/runtime/runtime_test.h b/runtime/runtime_test.h
    new file mode 100644
    index 0000000000000..86dfc5174c444
    --- /dev/null
    +++ b/runtime/runtime_test.h
    @@ -0,0 +1,37 @@
    +// Copyright 2013 The Flutter 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_RUNTIME_TEST_H_
    +#define FLUTTER_RUNTIME_RUNTIME_TEST_H_
    +
    +#include "flutter/common/settings.h"
    +#include "flutter/fml/macros.h"
    +#include "flutter/testing/thread_test.h"
    +
    +namespace blink {
    +namespace testing {
    +
    +class RuntimeTest : public ::testing::ThreadTest {
    + public:
    +  RuntimeTest();
    +
    +  ~RuntimeTest();
    +
    +  void SetSnapshotsAndAssets(Settings& settings);
    +
    + protected:
    +  // |testing::ThreadTest|
    +  void SetUp() override;
    +
    +  // |testing::ThreadTest|
    +  void TearDown() override;
    +
    + private:
    +  fml::UniqueFD assets_dir_;
    +};
    +
    +}  // namespace testing
    +}  // namespace blink
    +
    +#endif  // FLUTTER_RUNTIME_RUNTIME_TEST_H_
    diff --git a/testing/thread_test.cc b/testing/thread_test.cc
    index 513dbfd1a7eef..978d9af532bb6 100644
    --- a/testing/thread_test.cc
    +++ b/testing/thread_test.cc
    @@ -8,6 +8,7 @@
     
     namespace testing {
     
    +// |testing::Test|
     void ThreadTest::SetUp() {
       thread_ = std::make_unique();
       thread_task_runner_ = thread_->GetTaskRunner();
    @@ -16,6 +17,7 @@ void ThreadTest::SetUp() {
       current_task_runner_ = fml::MessageLoop::GetCurrent().GetTaskRunner();
     }
     
    +// |testing::Test|
     void ThreadTest::TearDown() {
       thread_task_runner_ = nullptr;
       thread_ = nullptr;
    diff --git a/testing/thread_test.h b/testing/thread_test.h
    index 8b4487c1b791f..e4af5e1241b87 100644
    --- a/testing/thread_test.h
    +++ b/testing/thread_test.h
    @@ -22,8 +22,10 @@ class ThreadTest : public Test {
       fml::RefPtr GetThreadTaskRunner();
     
      protected:
    +  // |testing::Test|
       void SetUp() override;
     
    +  // |testing::Test|
       void TearDown() override;
     
      private:
    
    From 5e124ffc139873d621e03d77eafa3290a9034f8b Mon Sep 17 00:00:00 2001
    From: Michael Goderbauer 
    Date: Fri, 29 Mar 2019 17:47:55 -0700
    Subject: [PATCH 0639/1117] Fix typos (#8339)
    
    Courtesy of google's "CommonTypos" analysis.
    ---
     lib/ui/semantics/semantics_node.cc | 4 ++--
     lib/ui/semantics/semantics_node.h  | 2 +-
     2 files changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/lib/ui/semantics/semantics_node.cc b/lib/ui/semantics/semantics_node.cc
    index fd44758aa31a9..7b591d8f6d4f7 100644
    --- a/lib/ui/semantics/semantics_node.cc
    +++ b/lib/ui/semantics/semantics_node.cc
    @@ -8,7 +8,7 @@
     
     namespace blink {
     
    -constexpr int32_t kMinPlatfromViewId = -1;
    +constexpr int32_t kMinPlatformViewId = -1;
     
     SemanticsNode::SemanticsNode() = default;
     
    @@ -25,7 +25,7 @@ bool SemanticsNode::HasFlag(SemanticsFlags flag) {
     }
     
     bool SemanticsNode::IsPlatformViewNode() const {
    -  return platformViewId > kMinPlatfromViewId;
    +  return platformViewId > kMinPlatformViewId;
     }
     
     }  // namespace blink
    diff --git a/lib/ui/semantics/semantics_node.h b/lib/ui/semantics/semantics_node.h
    index 6d570b42c75a9..e45a8ef4cac5d 100644
    --- a/lib/ui/semantics/semantics_node.h
    +++ b/lib/ui/semantics/semantics_node.h
    @@ -81,7 +81,7 @@ struct SemanticsNode {
       bool HasAction(SemanticsAction action);
       bool HasFlag(SemanticsFlags flag);
     
    -  // Whether this node is for embeded platform views.
    +  // Whether this node is for embedded platform views.
       bool IsPlatformViewNode() const;
     
       int32_t id = 0;
    
    From 131cc625a1f2fd3445cbc6c90e5c9cd57918d6e8 Mon Sep 17 00:00:00 2001
    From: Chinmay Garde 
    Date: Fri, 29 Mar 2019 17:53:49 -0700
    Subject: [PATCH 0640/1117] Allow native entrypoint registration for runtime
     unittests. (#8379)
    
    ---
     runtime/BUILD.gn                              |   8 +-
     runtime/dart_isolate.cc                       |  13 +-
     runtime/dart_isolate.h                        |   5 +-
     runtime/dart_isolate_unittests.cc             | 138 ++++++++++++------
     runtime/fixtures/simple_main.dart             |  11 ++
     runtime/runtime_test.cc                       |  19 ++-
     runtime/runtime_test.h                        |  10 +-
     shell/platform/embedder/BUILD.gn              |   4 +-
     .../embedder/tests/embedder_a11y_unittests.cc |   2 +-
     .../embedder/tests/embedder_context.cc        |   6 +-
     .../embedder/tests/embedder_context.h         |  15 +-
     .../embedder/tests/embedder_test_resolver.h   |  47 ------
     testing/BUILD.gn                              |  15 ++
     .../test_dart_native_resolver.cc              |  20 ++-
     testing/test_dart_native_resolver.h           |  54 +++++++
     15 files changed, 235 insertions(+), 132 deletions(-)
     delete mode 100644 shell/platform/embedder/tests/embedder_test_resolver.h
     rename shell/platform/embedder/tests/embedder_test_resolver.cc => testing/test_dart_native_resolver.cc (76%)
     create mode 100644 testing/test_dart_native_resolver.h
    
    diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
    index 9aeba8e6e3cbb..3d0e807585fcd 100644
    --- a/runtime/BUILD.gn
    +++ b/runtime/BUILD.gn
    @@ -26,12 +26,12 @@ source_set("test_font") {
     
     # Picks the libdart implementation based on the Flutter runtime mode.
     group("libdart") {
    -  deps = []
    +  public_deps = []
     
       if (flutter_runtime_mode == "profile" || flutter_runtime_mode == "release") {
    -    deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ]
    +    public_deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ]
       } else {
    -    deps += [
    +    public_deps += [
           "$flutter_root/lib/snapshot",
           "//third_party/dart/runtime:libdart_jit",
         ]
    @@ -115,7 +115,7 @@ executable("runtime_unittests") {
         "$flutter_root/common",
         "$flutter_root/fml",
         "$flutter_root/lib/snapshot",
    -    "$flutter_root/testing",
    +    "$flutter_root/testing:dart",
         "//third_party/skia",
         "//third_party/tonic",
       ]
    diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc
    index 8d53f3b13ea62..7cae71c36e3fd 100644
    --- a/runtime/dart_isolate.cc
    +++ b/runtime/dart_isolate.cc
    @@ -419,7 +419,7 @@ static bool InvokeMainEntrypoint(Dart_Handle user_entrypoint_function) {
     }
     
     FML_WARN_UNUSED_RESULT
    -bool DartIsolate::Run(const std::string& entrypoint_name) {
    +bool DartIsolate::Run(const std::string& entrypoint_name, fml::closure on_run) {
       TRACE_EVENT0("flutter", "DartIsolate::Run");
       if (phase_ != Phase::Ready) {
         return false;
    @@ -436,12 +436,17 @@ bool DartIsolate::Run(const std::string& entrypoint_name) {
     
       phase_ = Phase::Running;
       FML_DLOG(INFO) << "New isolate is in the running state.";
    +
    +  if (on_run) {
    +    on_run();
    +  }
       return true;
     }
     
     FML_WARN_UNUSED_RESULT
     bool DartIsolate::RunFromLibrary(const std::string& library_name,
    -                                 const std::string& entrypoint_name) {
    +                                 const std::string& entrypoint_name,
    +                                 fml::closure on_run) {
       TRACE_EVENT0("flutter", "DartIsolate::RunFromLibrary");
       if (phase_ != Phase::Ready) {
         return false;
    @@ -459,6 +464,10 @@ bool DartIsolate::RunFromLibrary(const std::string& library_name,
     
       phase_ = Phase::Running;
       FML_DLOG(INFO) << "New isolate is in the running state.";
    +
    +  if (on_run) {
    +    on_run();
    +  }
       return true;
     }
     
    diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h
    index d720deafed142..6b92875e1dc0e 100644
    --- a/runtime/dart_isolate.h
    +++ b/runtime/dart_isolate.h
    @@ -74,11 +74,12 @@ class DartIsolate : public UIDartState {
                                        bool last_piece = true);
     
       FML_WARN_UNUSED_RESULT
    -  bool Run(const std::string& entrypoint);
    +  bool Run(const std::string& entrypoint, fml::closure on_run = nullptr);
     
       FML_WARN_UNUSED_RESULT
       bool RunFromLibrary(const std::string& library_name,
    -                      const std::string& entrypoint);
    +                      const std::string& entrypoint,
    +                      fml::closure on_run = nullptr);
     
       FML_WARN_UNUSED_RESULT
       bool Shutdown();
    diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc
    index 59bd9d61bb1aa..d35766f58f81f 100644
    --- a/runtime/dart_isolate_unittests.cc
    +++ b/runtime/dart_isolate_unittests.cc
    @@ -2,8 +2,10 @@
     // Use of this source code is governed by a BSD-style license that can be
     // found in the LICENSE file.
     
    +#include "flutter/fml/make_copyable.h"
     #include "flutter/fml/mapping.h"
     #include "flutter/fml/paths.h"
    +#include "flutter/fml/synchronization/waitable_event.h"
     #include "flutter/fml/thread.h"
     #include "flutter/runtime/dart_isolate.h"
     #include "flutter/runtime/dart_vm.h"
    @@ -23,10 +25,7 @@ namespace testing {
     using DartIsolateTest = RuntimeTest;
     
     TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) {
    -  Settings settings = {};
    -  SetSnapshotsAndAssets(settings);
    -  settings.task_observer_add = [](intptr_t, fml::closure) {};
    -  settings.task_observer_remove = [](intptr_t) {};
    +  auto settings = CreateSettingsForFixture();
       auto vm = DartVM::ForProcess(settings);
       ASSERT_TRUE(vm);
       TaskRunners task_runners(CURRENT_TEST_NAME,       //
    @@ -53,9 +52,7 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) {
     }
     
     TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) {
    -  Settings settings = {};
    -  settings.task_observer_add = [](intptr_t, fml::closure) {};
    -  settings.task_observer_remove = [](intptr_t) {};
    +  auto settings = CreateSettingsForFixture();
       auto vm = DartVM::ForProcess(settings);
       ASSERT_TRUE(vm);
       TaskRunners task_runners(CURRENT_TEST_NAME,       //
    @@ -89,30 +86,48 @@ TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) {
     
     class AutoIsolateShutdown {
      public:
    -  AutoIsolateShutdown(std::shared_ptr isolate)
    -      : isolate_(std::move(isolate)) {}
    +  AutoIsolateShutdown() = default;
    +
    +  AutoIsolateShutdown(std::shared_ptr isolate,
    +                      fml::RefPtr runner)
    +      : isolate_(std::move(isolate)), runner_(std::move(runner)) {}
     
       ~AutoIsolateShutdown() {
    -    if (isolate_) {
    +    if (!IsValid()) {
    +      return;
    +    }
    +    fml::AutoResetWaitableEvent latch;
    +    fml::TaskRunner::RunNowOrPostTask(runner_, [isolate = isolate_, &latch]() {
           FML_LOG(INFO) << "Shutting down isolate.";
    -      if (!isolate_->Shutdown()) {
    +      if (!isolate->Shutdown()) {
             FML_LOG(ERROR) << "Could not shutdown isolate.";
    +        FML_CHECK(false);
           }
    -    }
    +      latch.Signal();
    +    });
    +    latch.Wait();
       }
     
    -  bool IsValid() const { return isolate_ != nullptr; }
    +  bool IsValid() const { return isolate_ != nullptr && runner_; }
     
       FML_WARN_UNUSED_RESULT
       bool RunInIsolateScope(std::function closure) {
    -    if (!isolate_) {
    +    if (!IsValid()) {
           return false;
         }
    -    tonic::DartIsolateScope scope(isolate_->isolate());
    -    tonic::DartApiScope api_scope;
    -    if (closure) {
    -      return closure();
    -    }
    +
    +    bool result = false;
    +    fml::AutoResetWaitableEvent latch;
    +    fml::TaskRunner::RunNowOrPostTask(
    +        runner_, [this, &result, &latch, closure]() {
    +          tonic::DartIsolateScope scope(isolate_->isolate());
    +          tonic::DartApiScope api_scope;
    +          if (closure) {
    +            result = closure();
    +          }
    +          latch.Signal();
    +        });
    +    latch.Wait();
         return true;
       }
     
    @@ -123,21 +138,20 @@ class AutoIsolateShutdown {
     
      private:
       std::shared_ptr isolate_;
    +  fml::RefPtr runner_;
     
       FML_DISALLOW_COPY_AND_ASSIGN(AutoIsolateShutdown);
     };
     
    -static std::unique_ptr RunDartCodeInIsolate(
    -    fml::RefPtr task_runner,
    -    std::string entrypoint) {
    -  Settings settings = {};
    -  settings.task_observer_add = [](intptr_t, fml::closure) {};
    -  settings.task_observer_remove = [](intptr_t) {};
    -
    +static void RunDartCodeInIsolate(std::unique_ptr& result,
    +                                 const Settings& settings,
    +                                 fml::RefPtr task_runner,
    +                                 std::string entrypoint) {
    +  FML_CHECK(task_runner->RunsTasksOnCurrentThread());
       auto vm = DartVM::ForProcess(settings);
     
       if (!vm) {
    -    return {};
    +    return;
       }
       TaskRunners task_runners(CURRENT_TEST_NAME,  //
                                task_runner,        //
    @@ -159,16 +173,16 @@ static std::unique_ptr RunDartCodeInIsolate(
       );
     
       auto root_isolate =
    -      std::make_unique(weak_isolate.lock());
    +      std::make_unique(weak_isolate.lock(), task_runner);
     
       if (!root_isolate->IsValid()) {
         FML_LOG(ERROR) << "Could not create isolate.";
    -    return {};
    +    return;
       }
     
       if (root_isolate->get()->GetPhase() != DartIsolate::Phase::LibrariesSetup) {
         FML_LOG(ERROR) << "Created isolate is in unexpected phase.";
    -    return {};
    +    return;
       }
     
       if (!DartVM::IsRunningPrecompiledCode()) {
    @@ -177,7 +191,7 @@ static std::unique_ptr RunDartCodeInIsolate(
     
         if (!fml::IsFile(kernel_file_path)) {
           FML_LOG(ERROR) << "Could not locate kernel file.";
    -      return {};
    +      return;
         }
     
         auto kernel_file = fml::OpenFile(kernel_file_path.c_str(), false,
    @@ -185,61 +199,82 @@ static std::unique_ptr RunDartCodeInIsolate(
     
         if (!kernel_file.is_valid()) {
           FML_LOG(ERROR) << "Kernel file descriptor was invalid.";
    -      return {};
    +      return;
         }
     
         auto kernel_mapping = std::make_unique(kernel_file);
     
         if (kernel_mapping->GetMapping() == nullptr) {
           FML_LOG(ERROR) << "Could not setup kernel mapping.";
    -      return {};
    +      return;
         }
     
         if (!root_isolate->get()->PrepareForRunningFromKernel(
                 std::move(kernel_mapping))) {
           FML_LOG(ERROR)
               << "Could not prepare to run the isolate from the kernel file.";
    -      return {};
    +      return;
         }
       } else {
         if (!root_isolate->get()->PrepareForRunningFromPrecompiledCode()) {
           FML_LOG(ERROR)
               << "Could not prepare to run the isolate from precompiled code.";
    -      return {};
    +      return;
         }
       }
     
       if (root_isolate->get()->GetPhase() != DartIsolate::Phase::Ready) {
         FML_LOG(ERROR) << "Isolate is in unexpected phase.";
    -    return {};
    +    return;
       }
     
    -  if (!root_isolate->get()->Run(entrypoint)) {
    +  if (!root_isolate->get()->Run(entrypoint,
    +                                settings.root_isolate_create_callback)) {
         FML_LOG(ERROR) << "Could not run the method \"" << entrypoint
                        << "\" in the isolate.";
    -    return {};
    +    return;
       }
     
    -  return root_isolate;
    +  root_isolate->get()->AddIsolateShutdownCallback(
    +      settings.root_isolate_shutdown_callback);
    +
    +  result = std::move(root_isolate);
    +}
    +
    +static std::unique_ptr RunDartCodeInIsolate(
    +    const Settings& settings,
    +    fml::RefPtr task_runner,
    +    std::string entrypoint) {
    +  std::unique_ptr result;
    +  fml::AutoResetWaitableEvent latch;
    +  fml::TaskRunner::RunNowOrPostTask(
    +      task_runner, fml::MakeCopyable([&]() mutable {
    +        RunDartCodeInIsolate(result, settings, task_runner, entrypoint);
    +        latch.Signal();
    +      }));
    +  latch.Wait();
    +  return result;
     }
     
     TEST_F(DartIsolateTest, IsolateCanLoadAndRunDartCode) {
    -  auto isolate = RunDartCodeInIsolate(GetCurrentTaskRunner(), "main");
    +  auto isolate = RunDartCodeInIsolate(CreateSettingsForFixture(),
    +                                      GetCurrentTaskRunner(), "main");
       ASSERT_TRUE(isolate);
       ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running);
     }
     
     TEST_F(DartIsolateTest, IsolateCannotLoadAndRunUnknownDartEntrypoint) {
    -  auto isolate =
    -      RunDartCodeInIsolate(GetCurrentTaskRunner(), "thisShouldNotExist");
    +  auto isolate = RunDartCodeInIsolate(
    +      CreateSettingsForFixture(), GetCurrentTaskRunner(), "thisShouldNotExist");
       ASSERT_FALSE(isolate);
     }
     
     TEST_F(DartIsolateTest, CanRunDartCodeCodeSynchronously) {
    -  auto isolate = RunDartCodeInIsolate(GetCurrentTaskRunner(), "main");
    +  auto isolate = RunDartCodeInIsolate(CreateSettingsForFixture(),
    +                                      GetCurrentTaskRunner(), "main");
     
       ASSERT_TRUE(isolate);
    -
    +  ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running);
       ASSERT_TRUE(isolate->RunInIsolateScope([]() -> bool {
         if (tonic::LogIfError(::Dart_Invoke(Dart_RootLibrary(),
                                             tonic::ToDart("sayHi"), 0, nullptr))) {
    @@ -249,5 +284,20 @@ TEST_F(DartIsolateTest, CanRunDartCodeCodeSynchronously) {
       }));
     }
     
    +TEST_F(DartIsolateTest, CanRegisterNativeCallback) {
    +  fml::AutoResetWaitableEvent latch;
    +  AddNativeCallback("NotifyNative",
    +                    CREATE_NATIVE_ENTRY(([&latch](Dart_NativeArguments args) {
    +                      FML_LOG(ERROR) << "Hello from Dart!";
    +                      latch.Signal();
    +                    })));
    +  auto isolate =
    +      RunDartCodeInIsolate(CreateSettingsForFixture(), GetThreadTaskRunner(),
    +                           "canRegisterNativeCallback");
    +  ASSERT_TRUE(isolate);
    +  ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running);
    +  latch.Wait();
    +}
    +
     }  // namespace testing
     }  // namespace blink
    diff --git a/runtime/fixtures/simple_main.dart b/runtime/fixtures/simple_main.dart
    index 308e033efb1e3..594f69470bc2f 100644
    --- a/runtime/fixtures/simple_main.dart
    +++ b/runtime/fixtures/simple_main.dart
    @@ -2,6 +2,8 @@
     // Use of this source code is governed by a BSD-style license that can be
     // found in the LICENSE file.
     
    +import 'dart:isolate';
    +
     void main() {
     }
     
    @@ -14,3 +16,12 @@ void sayHi() {
     void throwExceptionNow() {
       throw("Hello");
     }
    +
    +@pragma('vm:entry-point')
    +void canRegisterNativeCallback() async {
    +  print("In function canRegisterNativeCallback");
    +  NotifyNative();
    +  print("Called native method from canRegisterNativeCallback");
    +}
    +
    +void NotifyNative() native "NotifyNative";
    diff --git a/runtime/runtime_test.cc b/runtime/runtime_test.cc
    index 002971e8853e0..2613b133d241b 100644
    --- a/runtime/runtime_test.cc
    +++ b/runtime/runtime_test.cc
    @@ -10,7 +10,8 @@
     namespace blink {
     namespace testing {
     
    -RuntimeTest::RuntimeTest() = default;
    +RuntimeTest::RuntimeTest()
    +    : native_resolver_(std::make_shared<::testing::TestDartNativeResolver>()) {}
     
     RuntimeTest::~RuntimeTest() = default;
     
    @@ -70,6 +71,17 @@ void RuntimeTest::SetSnapshotsAndAssets(Settings& settings) {
       }
     }
     
    +Settings RuntimeTest::CreateSettingsForFixture() {
    +  Settings settings;
    +  settings.task_observer_add = [](intptr_t, fml::closure) {};
    +  settings.task_observer_remove = [](intptr_t) {};
    +  settings.root_isolate_create_callback = [this]() {
    +    native_resolver_->SetNativeResolverForIsolate();
    +  };
    +  SetSnapshotsAndAssets(settings);
    +  return settings;
    +}
    +
     // |testing::ThreadTest|
     void RuntimeTest::SetUp() {
       assets_dir_ = fml::OpenDirectory(::testing::GetFixturesPath(), false,
    @@ -83,5 +95,10 @@ void RuntimeTest::TearDown() {
       assets_dir_.reset();
     }
     
    +void RuntimeTest::AddNativeCallback(std::string name,
    +                                    Dart_NativeFunction callback) {
    +  native_resolver_->AddNativeCallback(std::move(name), callback);
    +}
    +
     }  // namespace testing
     }  // namespace blink
    diff --git a/runtime/runtime_test.h b/runtime/runtime_test.h
    index 86dfc5174c444..142a5d3937d5b 100644
    --- a/runtime/runtime_test.h
    +++ b/runtime/runtime_test.h
    @@ -5,8 +5,11 @@
     #ifndef FLUTTER_RUNTIME_RUNTIME_TEST_H_
     #define FLUTTER_RUNTIME_RUNTIME_TEST_H_
     
    +#include 
    +
     #include "flutter/common/settings.h"
     #include "flutter/fml/macros.h"
    +#include "flutter/testing/test_dart_native_resolver.h"
     #include "flutter/testing/thread_test.h"
     
     namespace blink {
    @@ -18,7 +21,9 @@ class RuntimeTest : public ::testing::ThreadTest {
     
       ~RuntimeTest();
     
    -  void SetSnapshotsAndAssets(Settings& settings);
    +  Settings CreateSettingsForFixture();
    +
    +  void AddNativeCallback(std::string name, Dart_NativeFunction callback);
     
      protected:
       // |testing::ThreadTest|
    @@ -29,6 +34,9 @@ class RuntimeTest : public ::testing::ThreadTest {
     
      private:
       fml::UniqueFD assets_dir_;
    +  std::shared_ptr<::testing::TestDartNativeResolver> native_resolver_;
    +
    +  void SetSnapshotsAndAssets(Settings& settings);
     };
     
     }  // namespace testing
    diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn
    index 6b54826cfa132..b856328855e05 100644
    --- a/shell/platform/embedder/BUILD.gn
    +++ b/shell/platform/embedder/BUILD.gn
    @@ -72,8 +72,6 @@ executable("embedder_unittests") {
         "tests/embedder_context.h",
         "tests/embedder_test.cc",
         "tests/embedder_test.h",
    -    "tests/embedder_test_resolver.cc",
    -    "tests/embedder_test_resolver.h",
         "tests/embedder_unittests.cc",
       ]
     
    @@ -82,7 +80,7 @@ executable("embedder_unittests") {
         ":fixtures",
         "$flutter_root/lib/ui",
         "$flutter_root/runtime",
    -    "$flutter_root/testing",
    +    "$flutter_root/testing:dart",
         "//third_party/skia",
         "//third_party/tonic",
       ]
    diff --git a/shell/platform/embedder/tests/embedder_a11y_unittests.cc b/shell/platform/embedder/tests/embedder_a11y_unittests.cc
    index 58728e524f3e6..bfabfd491f13e 100644
    --- a/shell/platform/embedder/tests/embedder_a11y_unittests.cc
    +++ b/shell/platform/embedder/tests/embedder_a11y_unittests.cc
    @@ -34,7 +34,7 @@ TEST_F(Embedder11yTest, A11yTreeIsConsistent) {
           })));
     
       // Called by test fixture on UI thread to pass data back to this test.
    -  NativeEntry callback;
    +  ::testing::NativeEntry callback;
       context.AddNativeCallback(
           "NotifyTestData",
           CREATE_NATIVE_ENTRY(([&callback](Dart_NativeArguments args) {
    diff --git a/shell/platform/embedder/tests/embedder_context.cc b/shell/platform/embedder/tests/embedder_context.cc
    index 5a21ebeed8b00..00faf97413d51 100644
    --- a/shell/platform/embedder/tests/embedder_context.cc
    +++ b/shell/platform/embedder/tests/embedder_context.cc
    @@ -37,7 +37,7 @@ static std::unique_ptr GetMapping(const fml::UniqueFD& directory,
     
     EmbedderContext::EmbedderContext(std::string assets_path)
         : assets_path_(std::move(assets_path)),
    -      native_resolver_(std::make_shared()) {
    +      native_resolver_(std::make_shared<::testing::TestDartNativeResolver>()) {
       auto assets_dir = fml::OpenDirectory(assets_path_.c_str(), false,
                                            fml::FilePermission::kRead);
       vm_snapshot_data_ = GetMapping(assets_dir, "vm_snapshot_data", false);
    @@ -52,8 +52,8 @@ EmbedderContext::EmbedderContext(std::string assets_path)
       }
     
       isolate_create_callbacks_.push_back(
    -      [weak_resolver =
    -           std::weak_ptr{native_resolver_}]() {
    +      [weak_resolver = std::weak_ptr<::testing::TestDartNativeResolver>{
    +           native_resolver_}]() {
             if (auto resolver = weak_resolver.lock()) {
               resolver->SetNativeResolverForIsolate();
             }
    diff --git a/shell/platform/embedder/tests/embedder_context.h b/shell/platform/embedder/tests/embedder_context.h
    index 564262a859ef8..c1b65a38650da 100644
    --- a/shell/platform/embedder/tests/embedder_context.h
    +++ b/shell/platform/embedder/tests/embedder_context.h
    @@ -14,22 +14,11 @@
     #include "flutter/fml/macros.h"
     #include "flutter/fml/mapping.h"
     #include "flutter/shell/platform/embedder/embedder.h"
    -#include "flutter/shell/platform/embedder/tests/embedder_test_resolver.h"
    -
    -#define CREATE_NATIVE_ENTRY(native_entry)                                   \
    -  ([&]() {                                                                  \
    -    static ::shell::testing::NativeEntry closure;                           \
    -    static Dart_NativeFunction entrypoint = [](Dart_NativeArguments args) { \
    -      closure(args);                                                        \
    -    };                                                                      \
    -    closure = (native_entry);                                               \
    -    return entrypoint;                                                      \
    -  })()
    +#include "flutter/testing/test_dart_native_resolver.h"
     
     namespace shell {
     namespace testing {
     
    -using NativeEntry = std::function;
     using SemanticsNodeCallback = std::function;
     using SemanticsActionCallback =
         std::function;
    @@ -69,7 +58,7 @@ class EmbedderContext {
       std::unique_ptr isolate_snapshot_data_;
       std::unique_ptr isolate_snapshot_instructions_;
       std::vector isolate_create_callbacks_;
    -  std::shared_ptr native_resolver_;
    +  std::shared_ptr<::testing::TestDartNativeResolver> native_resolver_;
       SemanticsNodeCallback update_semantics_node_callback_;
       SemanticsActionCallback update_semantics_custom_action_callback_;
     
    diff --git a/shell/platform/embedder/tests/embedder_test_resolver.h b/shell/platform/embedder/tests/embedder_test_resolver.h
    deleted file mode 100644
    index 69d08efe1042d..0000000000000
    --- a/shell/platform/embedder/tests/embedder_test_resolver.h
    +++ /dev/null
    @@ -1,47 +0,0 @@
    -// Copyright 2013 The Flutter 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_EMBEDDER_TESTS_EMBEDDER_TEST_RESOLVER_H_
    -#define FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_RESOLVER_H_
    -
    -#include 
    -#include 
    -
    -#include "flutter/fml/macros.h"
    -#include "third_party/dart/runtime/include/dart_api.h"
    -
    -namespace shell {
    -namespace testing {
    -
    -class EmbedderTestResolver
    -    : public std::enable_shared_from_this {
    - public:
    -  EmbedderTestResolver();
    -
    -  ~EmbedderTestResolver();
    -
    -  void AddNativeCallback(std::string name, Dart_NativeFunction callback);
    -
    - private:
    -  // Friend so that the context can set the native resolver.
    -  friend class EmbedderContext;
    -
    -  std::map native_callbacks_;
    -
    -  void SetNativeResolverForIsolate();
    -
    -  Dart_NativeFunction ResolveCallback(std::string name) const;
    -
    -  static Dart_NativeFunction DartNativeEntryResolverCallback(
    -      Dart_Handle dart_name,
    -      int num_of_arguments,
    -      bool* auto_setup_scope);
    -
    -  FML_DISALLOW_COPY_AND_ASSIGN(EmbedderTestResolver);
    -};
    -
    -}  // namespace testing
    -}  // namespace shell
    -
    -#endif  // FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_RESOLVER_H_
    diff --git a/testing/BUILD.gn b/testing/BUILD.gn
    index 424d978f81570..54c4cf4aad2e5 100644
    --- a/testing/BUILD.gn
    +++ b/testing/BUILD.gn
    @@ -20,3 +20,18 @@ source_set("testing") {
     
       public_configs = [ "$flutter_root:config" ]
     }
    +
    +source_set("dart") {
    +  testonly = true
    +
    +  sources = [
    +    "$flutter_root/testing/test_dart_native_resolver.cc",
    +    "$flutter_root/testing/test_dart_native_resolver.h",
    +  ]
    +
    +  public_deps = [
    +    ":testing",
    +    "$flutter_root/runtime:libdart",
    +    "//third_party/tonic",
    +  ]
    +}
    diff --git a/shell/platform/embedder/tests/embedder_test_resolver.cc b/testing/test_dart_native_resolver.cc
    similarity index 76%
    rename from shell/platform/embedder/tests/embedder_test_resolver.cc
    rename to testing/test_dart_native_resolver.cc
    index 49171a91df23c..62fb2a4944d96 100644
    --- a/shell/platform/embedder/tests/embedder_test_resolver.cc
    +++ b/testing/test_dart_native_resolver.cc
    @@ -2,7 +2,7 @@
     // 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/tests/embedder_test_resolver.h"
    +#include "flutter/testing/test_dart_native_resolver.h"
     
     #include 
     #include 
    @@ -10,19 +10,18 @@
     #include "flutter/fml/synchronization/thread_annotations.h"
     #include "tonic/converter/dart_converter.h"
     
    -namespace shell {
     namespace testing {
     
    -EmbedderTestResolver::EmbedderTestResolver() = default;
    +TestDartNativeResolver::TestDartNativeResolver() = default;
     
    -EmbedderTestResolver::~EmbedderTestResolver() = default;
    +TestDartNativeResolver::~TestDartNativeResolver() = default;
     
    -void EmbedderTestResolver::AddNativeCallback(std::string name,
    -                                             Dart_NativeFunction callback) {
    +void TestDartNativeResolver::AddNativeCallback(std::string name,
    +                                               Dart_NativeFunction callback) {
       native_callbacks_[name] = callback;
     }
     
    -Dart_NativeFunction EmbedderTestResolver::ResolveCallback(
    +Dart_NativeFunction TestDartNativeResolver::ResolveCallback(
         std::string name) const {
       auto found = native_callbacks_.find(name);
       if (found == native_callbacks_.end()) {
    @@ -33,10 +32,10 @@ Dart_NativeFunction EmbedderTestResolver::ResolveCallback(
     }
     
     static std::mutex gIsolateResolversMutex;
    -static std::map>
    +static std::map>
         gIsolateResolvers FML_GUARDED_BY(gIsolateResolversMutex);
     
    -Dart_NativeFunction EmbedderTestResolver::DartNativeEntryResolverCallback(
    +Dart_NativeFunction TestDartNativeResolver::DartNativeEntryResolverCallback(
         Dart_Handle dart_name,
         int num_of_arguments,
         bool* auto_setup_scope) {
    @@ -62,7 +61,7 @@ static const uint8_t* DartNativeEntrySymbolCallback(
       return reinterpret_cast("¯\\_(ツ)_/¯");
     }
     
    -void EmbedderTestResolver::SetNativeResolverForIsolate() {
    +void TestDartNativeResolver::SetNativeResolverForIsolate() {
       auto result = Dart_SetNativeResolver(Dart_RootLibrary(),
                                            DartNativeEntryResolverCallback,
                                            DartNativeEntrySymbolCallback);
    @@ -87,4 +86,3 @@ void EmbedderTestResolver::SetNativeResolverForIsolate() {
     }
     
     }  // namespace testing
    -}  // namespace shell
    diff --git a/testing/test_dart_native_resolver.h b/testing/test_dart_native_resolver.h
    new file mode 100644
    index 0000000000000..8b928170d4f80
    --- /dev/null
    +++ b/testing/test_dart_native_resolver.h
    @@ -0,0 +1,54 @@
    +// Copyright 2013 The Flutter 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_TESTING_TEST_DART_NATIVE_RESOLVER_H_
    +#define FLUTTER_TESTING_TEST_DART_NATIVE_RESOLVER_H_
    +
    +#include 
    +#include 
    +
    +#include "flutter/fml/macros.h"
    +#include "third_party/dart/runtime/include/dart_api.h"
    +
    +#define CREATE_NATIVE_ENTRY(native_entry)                                   \
    +  ([&]() {                                                                  \
    +    static ::testing::NativeEntry closure;                                  \
    +    static Dart_NativeFunction entrypoint = [](Dart_NativeArguments args) { \
    +      closure(args);                                                        \
    +    };                                                                      \
    +    closure = (native_entry);                                               \
    +    return entrypoint;                                                      \
    +  })()
    +
    +namespace testing {
    +
    +using NativeEntry = std::function;
    +
    +class TestDartNativeResolver
    +    : public std::enable_shared_from_this {
    + public:
    +  TestDartNativeResolver();
    +
    +  ~TestDartNativeResolver();
    +
    +  void AddNativeCallback(std::string name, Dart_NativeFunction callback);
    +
    +  void SetNativeResolverForIsolate();
    +
    + private:
    +  std::map native_callbacks_;
    +
    +  Dart_NativeFunction ResolveCallback(std::string name) const;
    +
    +  static Dart_NativeFunction DartNativeEntryResolverCallback(
    +      Dart_Handle dart_name,
    +      int num_of_arguments,
    +      bool* auto_setup_scope);
    +
    +  FML_DISALLOW_COPY_AND_ASSIGN(TestDartNativeResolver);
    +};
    +
    +}  // namespace testing
    +
    +#endif  // FLUTTER_TESTING_TEST_DART_NATIVE_RESOLVER_H_
    
    From 9d7167516ece129c8299e95caf18756a671e6ccc Mon Sep 17 00:00:00 2001
    From: liyuqian 
    Date: Fri, 29 Mar 2019 17:58:30 -0700
    Subject: [PATCH 0641/1117] Ensure OpacityLayer to have a single child (#8362)
    
    It ensures that every OpacityLayer can be optimized by retained
    rendering.
    
    Tested with `flutter test --local-engine=host_debug_unopt` in
    flutter/flutter/packages/flutter.
    
    Related issues: #21756 #23535
    ---
     flow/layers/container_layer.h |  3 +++
     flow/layers/opacity_layer.cc  | 28 +++++++++++++++++++++++++---
     flow/layers/opacity_layer.h   | 10 ++++++++++
     3 files changed, 38 insertions(+), 3 deletions(-)
    
    diff --git a/flow/layers/container_layer.h b/flow/layers/container_layer.h
    index 780fd64b46a94..9bac25d9633cf 100644
    --- a/flow/layers/container_layer.h
    +++ b/flow/layers/container_layer.h
    @@ -35,6 +35,9 @@ class ContainerLayer : public Layer {
       void UpdateSceneChildren(SceneUpdateContext& context);
     #endif  // defined(OS_FUCHSIA)
     
    +  // For OpacityLayer to restructure to have a single child.
    +  void ClearChildren() { layers_.clear(); }
    +
      private:
       std::vector> layers_;
     
    diff --git a/flow/layers/opacity_layer.cc b/flow/layers/opacity_layer.cc
    index c774ab9fb3d94..436a88594a807 100644
    --- a/flow/layers/opacity_layer.cc
    +++ b/flow/layers/opacity_layer.cc
    @@ -4,18 +4,38 @@
     
     #include "flutter/flow/layers/opacity_layer.h"
     
    +#include "flutter/flow/layers/transform_layer.h"
    +
     namespace flow {
     
     OpacityLayer::OpacityLayer() = default;
     
     OpacityLayer::~OpacityLayer() = default;
     
    +void OpacityLayer::EnsureSingleChild() {
    +  FML_DCHECK(layers().size() > 0);  // OpacityLayer should never be a leaf
    +
    +  if (layers().size() == 1) {
    +    return;
    +  }
    +
    +  auto new_child = std::make_shared();
    +  for (auto& child : layers()) {
    +    new_child->Add(child);
    +  }
    +  ClearChildren();
    +  Add(new_child);
    +}
    +
     void OpacityLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
    +  EnsureSingleChild();
       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 &&
    +  // See |EnsureSingleChild|.
    +  FML_DCHECK(layers().size() == 1);
    +  if (context->raster_cache &&
           SkRect::Intersects(context->cull_rect, paint_bounds())) {
         Layer* child = layers()[0].get();
         SkMatrix ctm = child_matrix;
    @@ -41,12 +61,14 @@ void OpacityLayer::Paint(PaintContext& context) const {
           context.leaf_nodes_canvas->getTotalMatrix()));
     #endif
     
    +  // See |EnsureSingleChild|.
    +  FML_DCHECK(layers().size() == 1);
    +
       // 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) {
    +  if (context.view_embedder == nullptr && context.raster_cache) {
         const SkMatrix& ctm = context.leaf_nodes_canvas->getTotalMatrix();
         RasterCacheResult child_cache =
             context.raster_cache->Get(layers()[0].get(), ctm);
    diff --git a/flow/layers/opacity_layer.h b/flow/layers/opacity_layer.h
    index 5662f85a64980..d33240f48786f 100644
    --- a/flow/layers/opacity_layer.h
    +++ b/flow/layers/opacity_layer.h
    @@ -28,6 +28,16 @@ class OpacityLayer : public ContainerLayer {
       int alpha_;
       SkPoint offset_;
     
    +  // Restructure (if necessary) OpacityLayer to have only one child.
    +  //
    +  // This is needed to ensure that retained rendering can always be applied to
    +  // save the costly saveLayer.
    +  //
    +  // If there are multiple children, this creates a new identity TransformLayer,
    +  // sets all children to be the TransformLayer's children, and sets that
    +  // TransformLayer as the single child of this OpacityLayer.
    +  void EnsureSingleChild();
    +
       FML_DISALLOW_COPY_AND_ASSIGN(OpacityLayer);
     };
     
    
    From b75472c106d0cd0aab45de6bc16e0d6aa6d418cf Mon Sep 17 00:00:00 2001
    From: Chinmay Garde 
    Date: Fri, 29 Mar 2019 18:14:06 -0700
    Subject: [PATCH 0642/1117] Add missing import to functional for Windows.
     (#8382)
    
    ---
     testing/test_dart_native_resolver.h | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/testing/test_dart_native_resolver.h b/testing/test_dart_native_resolver.h
    index 8b928170d4f80..632824142d930 100644
    --- a/testing/test_dart_native_resolver.h
    +++ b/testing/test_dart_native_resolver.h
    @@ -5,6 +5,7 @@
     #ifndef FLUTTER_TESTING_TEST_DART_NATIVE_RESOLVER_H_
     #define FLUTTER_TESTING_TEST_DART_NATIVE_RESOLVER_H_
     
    +#include 
     #include 
     #include 
     
    
    From 63b9d257cbf069bc1fc2c76c0829da71c14e0d7a Mon Sep 17 00:00:00 2001
    From: Ben Konyi 
    Date: Fri, 29 Mar 2019 19:02:18 -0700
    Subject: [PATCH 0643/1117] Roll src/third_party/dart f29e100f42..1e82544b07
     (41 commits)
    
    1e82544b07 [gardening] Attempt to paper over failing flutter test affected by https://dart-review.googlesource.com/c/sdk/+/97311.
    dfbdf0a187 Support for function typed formal parameters.
    e46fa1cf1d Revert "[VM] Ensure Top level class is finalized for loadedscripts in library"
    e0a2651ce0 [cfe] Fix downcasts added during set/map disambiguation
    f21d521d0e [cfe] Fix pre-inference set/map disambiguation
    6b19aa821b [cfe] Do type checks on spreads during inference
    1a5ed8247f [fasta] Fix typos and copy-paste errors in a test case
    584affcffa [cfe] Add initial support for 'for' and for-in elements in maps
    fa7e0c7531 [cfe] Add element type checks in spreads
    1b2a4b8eb1 Convert some tests to DriverResolutionTest
    fb58826aa3 [CFE] Compensate for lowering and desugaring in spread.
    7ef28f0b03 Handle constant field init registration correctly.
    da0de0a867 Handle native field impact correctly from ir constants
    00d65e2d84 Roll co19 to revision c3b33ee
    0560014c79 Remove unused error codes
    e8b56268ef Resolve constructor initializers and redirections.
    c185945507 [vm/aot] Ensure global object pool is relocated by compactor and reloaded when returning from natives
    d23909802e [vm/compiler] Eliminate dead CatchBlockEntry Parameter-s
    69790e7eb4 Updated Dart.g, tests & status files to support ui-as-code collections
    1bf1ca1933 Revert "Update dart_style to 1.2.5."
    4fe2f6f349 Add more tests to the incremental compiler
    611a53ee5e Update dart_style to 1.2.5.
    b7f69e24a2 dartdevc and bazel worker can use incremental compiler
    a506c708f2 [co19] DEPS updated
    9b77e4c507 Include constructors into available suggestions.
    0eb76a5b5a Move await for of null tests to a different file.
    8d699db9af Update spread_collections/inference_test to use Type.== instead of identical
    edf470bf83 Initial sketch of dartdoc support
    1b643e5c1f Support for mixins.
    bc0148cf87 [ddc] Skip unsupported co19 tests on ddc/ddk
    15b4e57510 [ VM / Service ] Fixed failing isolate_lifecycle_test
    4c50d06ac5 Handle inconsistent analysis exception during a refactoring (issue 36149)
    ae62f7fefe [vm, gc] Make incremental write-barrier elimination safe.
    d07e33e11f Convert more comments from block to line style
    926a6c0958 Convert more comments
    dfcc52f909 [vm/dart:io/fuchsia] Improve fdio_pipe_half signature, step 2.
    1926f69e4d Include available classes when includeConstructorSuggestions is true.
    d0fda82493 Clean up some of the unused task model support in test code
    2bc81be75a [infra] Some missing interpreter bot configurations.
    ac2c934563 Reland "[ VM / dart:isolate ] Added ability to set names for spawned isolates."
    380ae2ce55 [ Observatory ] Fixed links for 'part's in dart:* scripts not being created.
    ---
     DEPS                                    | 2 +-
     ci/licenses_golden/licenses_third_party | 3 ++-
     2 files changed, 3 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 48665f920bdfa..712126a24bcec 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -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': 'f29e100f42f49cae1cb535d807955fc1503b0d80',
    +  'dart_revision': '1e82544b07f13394da8da305858de5ab7caae7ad',
     
       # WARNING: DO NOT EDIT MANUALLY
       # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
    diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party
    index 5174e693ccd46..033db69532a3e 100644
    --- a/ci/licenses_golden/licenses_third_party
    +++ b/ci/licenses_golden/licenses_third_party
    @@ -1,4 +1,4 @@
    -Signature: 94e50e38cee32854b41f95fc588edc59
    +Signature: 4fbe06d52d386154c027097dac450ce8
     
     UNUSED LICENSES:
     
    @@ -5465,6 +5465,7 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/backend/compile_type.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/backend/loops_test.cc
    +FILE: ../../../third_party/dart/runtime/vm/compiler/backend/redundancy_elimination_test.cc
     FILE: ../../../third_party/dart/runtime/vm/compiler/backend/slot.cc
     FILE: ../../../third_party/dart/runtime/vm/compiler/backend/slot.h
     FILE: ../../../third_party/dart/runtime/vm/compiler/compiler_pass.cc
    
    From 8dabd60a30d048bf90b4bc0b29914ea00bda182c Mon Sep 17 00:00:00 2001
    From: Chinmay Garde 
    Date: Fri, 29 Mar 2019 20:53:40 -0700
    Subject: [PATCH 0644/1117] Remove unused DartVM::IsKernelMapping (#8381)
    
    ---
     runtime/dart_vm.cc | 20 --------------------
     runtime/dart_vm.h  |  2 --
     2 files changed, 22 deletions(-)
    
    diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc
    index b907db41bd0f5..4c6054f7be25f 100644
    --- a/runtime/dart_vm.cc
    +++ b/runtime/dart_vm.cc
    @@ -183,26 +183,6 @@ bool DartVM::IsRunningPrecompiledCode() {
       return Dart_IsPrecompiledRuntime();
     }
     
    -bool DartVM::IsKernelMapping(const fml::FileMapping* mapping) {
    -  if (mapping == nullptr) {
    -    return false;
    -  }
    -
    -  const uint8_t kKernelHeaderMagic[] = {0x90, 0xAB, 0xCD, 0xEF};
    -  const size_t kKernelHeaderMagicSize = sizeof(kKernelHeaderMagic);
    -
    -  if (mapping->GetSize() < kKernelHeaderMagicSize) {
    -    return false;
    -  }
    -
    -  if (memcmp(kKernelHeaderMagic, mapping->GetMapping(),
    -             kKernelHeaderMagicSize) != 0) {
    -    return false;
    -  }
    -
    -  return true;
    -}
    -
     static std::vector ProfilingFlags(bool enable_profiling) {
     // Disable Dart's built in profiler when building a debug build. This
     // works around a race condition that would sometimes stop a crash's
    diff --git a/runtime/dart_vm.h b/runtime/dart_vm.h
    index 9a1bde888dd86..2c3ac0e30381e 100644
    --- a/runtime/dart_vm.h
    +++ b/runtime/dart_vm.h
    @@ -38,8 +38,6 @@ class DartVM : public fml::RefCountedThreadSafe {
     
       static bool IsRunningPrecompiledCode();
     
    -  static bool IsKernelMapping(const fml::FileMapping* mapping);
    -
       const Settings& GetSettings() const;
     
       const DartSnapshot& GetVMSnapshot() const;
    
    From b466aba58c1daabfda843d5094e64ede2f17fdde Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Sat, 30 Mar 2019 02:16:49 -0400
    Subject: [PATCH 0645/1117] Roll src/third_party/skia
     59b733715141..265fd3de3527 (1 commits) (#8384)
    
    https://skia.googlesource.com/skia.git/%2Blog/59b733715141..265fd3de3527
    
    git log 59b733715141b732ce3fb73b8870851f616c3163..265fd3de352790725f6c87cce3e5f3dd396e20e7 --date=short --no-merges --format=%ad %ae %s
    2019-03-30 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 712126a24bcec..01889592cf62a 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': '59b733715141b732ce3fb73b8870851f616c3163',
    +  'skia_revision': '265fd3de352790725f6c87cce3e5f3dd396e20e7',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 388631f660dc8..9eb1a3a7275f9 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 1e5ba4503f09d4f957b11079c2449a6c
    +Signature: eef826a3d929e33a925836a09f8e5734
     
     UNUSED LICENSES:
     
    
    From 2e1f491ba00ba0b0c4c008b5a355a595e63dd4c7 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Sat, 30 Mar 2019 11:24:10 -0400
    Subject: [PATCH 0646/1117] Roll src/third_party/skia
     265fd3de3527..c9822a1818ba (1 commits) (#8386)
    
    https://skia.googlesource.com/skia.git/%2Blog/265fd3de3527..c9822a1818ba
    
    git log 265fd3de352790725f6c87cce3e5f3dd396e20e7..c9822a1818ba8fe91dbea28e592fd18034899e3e --date=short --no-merges --format=%ad %ae %s
    2019-03-30 reed@google.com Reland "GPU support for SkMixers"
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 3 ++-
     2 files changed, 3 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 01889592cf62a..397af7fbaf462 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': '265fd3de352790725f6c87cce3e5f3dd396e20e7',
    +  'skia_revision': 'c9822a1818ba8fe91dbea28e592fd18034899e3e',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 9eb1a3a7275f9..47152046ea406 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: eef826a3d929e33a925836a09f8e5734
    +Signature: 3d02b659485d82f620c663c834fc65a1
     
     UNUSED LICENSES:
     
    @@ -2684,6 +2684,7 @@ FILE: ../../../third_party/skia/src/sksl/sksl.inc
     FILE: ../../../third_party/skia/src/sksl/sksl_fp.inc
     FILE: ../../../third_party/skia/src/sksl/sksl_frag.inc
     FILE: ../../../third_party/skia/src/sksl/sksl_geom.inc
    +FILE: ../../../third_party/skia/src/sksl/sksl_mixer.inc
     FILE: ../../../third_party/skia/src/sksl/sksl_pipeline.inc
     FILE: ../../../third_party/skia/src/sksl/sksl_vert.inc
     ----------------------------------------------------------------------------------------------------
    
    From 28f8453629f951d41437aa16bb09957643f1e850 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Sat, 30 Mar 2019 14:54:13 -0400
    Subject: [PATCH 0647/1117] Roll src/third_party/skia
     c9822a1818ba..a6dd1ebd42cf (1 commits) (#8388)
    
    https://skia.googlesource.com/skia.git/%2Blog/c9822a1818ba..a6dd1ebd42cf
    
    git log c9822a1818ba8fe91dbea28e592fd18034899e3e..a6dd1ebd42cf647b34e002ddf4f676b96ceda708 --date=short --no-merges --format=%ad %ae %s
    2019-03-30 reed@google.com Revert "Reland "GPU support for SkMixers""
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 3 +--
     2 files changed, 2 insertions(+), 3 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 397af7fbaf462..3db748513ed8f 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': 'c9822a1818ba8fe91dbea28e592fd18034899e3e',
    +  'skia_revision': 'a6dd1ebd42cf647b34e002ddf4f676b96ceda708',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 47152046ea406..9eb1a3a7275f9 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 3d02b659485d82f620c663c834fc65a1
    +Signature: eef826a3d929e33a925836a09f8e5734
     
     UNUSED LICENSES:
     
    @@ -2684,7 +2684,6 @@ FILE: ../../../third_party/skia/src/sksl/sksl.inc
     FILE: ../../../third_party/skia/src/sksl/sksl_fp.inc
     FILE: ../../../third_party/skia/src/sksl/sksl_frag.inc
     FILE: ../../../third_party/skia/src/sksl/sksl_geom.inc
    -FILE: ../../../third_party/skia/src/sksl/sksl_mixer.inc
     FILE: ../../../third_party/skia/src/sksl/sksl_pipeline.inc
     FILE: ../../../third_party/skia/src/sksl/sksl_vert.inc
     ----------------------------------------------------------------------------------------------------
    
    From ae024d755518019f3618931fbc47d3f27e84fad5 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Sat, 30 Mar 2019 18:22:30 -0400
    Subject: [PATCH 0648/1117] Roll src/third_party/skia
     a6dd1ebd42cf..2fdbeae32785 (1 commits) (#8389)
    
    https://skia.googlesource.com/skia.git/%2Blog/a6dd1ebd42cf..2fdbeae32785
    
    git log a6dd1ebd42cf647b34e002ddf4f676b96ceda708..2fdbeae3278592857f02a7eb2f5199f419dfa28e --date=short --no-merges --format=%ad %ae %s
    2019-03-30 reed@google.com Start to unify signatures: return bool
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (stani@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 3db748513ed8f..85d9ebcc85ca2 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': 'a6dd1ebd42cf647b34e002ddf4f676b96ceda708',
    +  'skia_revision': '2fdbeae3278592857f02a7eb2f5199f419dfa28e',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 9eb1a3a7275f9..e33d240cd3a7b 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: eef826a3d929e33a925836a09f8e5734
    +Signature: b44482187b14d70ee2eadf6cf2b21aa3
     
     UNUSED LICENSES:
     
    
    From be6313d87545874a6108edb2a311f30d9a027472 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Sun, 31 Mar 2019 02:18:49 -0400
    Subject: [PATCH 0649/1117] Roll src/third_party/skia
     2fdbeae32785..83edfbe736fd (1 commits) (#8390)
    
    https://skia.googlesource.com/skia.git/%2Blog/2fdbeae32785..83edfbe736fd
    
    git log 2fdbeae3278592857f02a7eb2f5199f419dfa28e..83edfbe736fdaad67ad8ca6c88227b0e6c8df853 --date=short --no-merges --format=%ad %ae %s
    2019-03-31 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 85d9ebcc85ca2..3433f3adc8557 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': '2fdbeae3278592857f02a7eb2f5199f419dfa28e',
    +  'skia_revision': '83edfbe736fdaad67ad8ca6c88227b0e6c8df853',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index e33d240cd3a7b..e73b0b4340079 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: b44482187b14d70ee2eadf6cf2b21aa3
    +Signature: 3dcb7db8d3f3938c79af3893d49b9893
     
     UNUSED LICENSES:
     
    
    From f3ec767458f12bb3099248fdc57d6c0d1051f042 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Sun, 31 Mar 2019 05:48:49 -0400
    Subject: [PATCH 0650/1117] Roll src/third_party/skia
     83edfbe736fd..acb4829c1be4 (1 commits) (#8391)
    
    https://skia.googlesource.com/skia.git/%2Blog/83edfbe736fd..acb4829c1be4
    
    git log 83edfbe736fdaad67ad8ca6c88227b0e6c8df853..acb4829c1be4bd6be53ea750effd94c07da95632 --date=short --no-merges --format=%ad %ae %s
    2019-03-31 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update SKP version
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 3433f3adc8557..79e2cebf9828d 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': '83edfbe736fdaad67ad8ca6c88227b0e6c8df853',
    +  'skia_revision': 'acb4829c1be4bd6be53ea750effd94c07da95632',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index e73b0b4340079..2869ce6e0e4e7 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 3dcb7db8d3f3938c79af3893d49b9893
    +Signature: 0b8bb37950011e610d32e616f18f5c0a
     
     UNUSED LICENSES:
     
    
    From d9f16111ab6ab3150498e4def86e2babcf236594 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Sun, 31 Mar 2019 23:41:16 -0400
    Subject: [PATCH 0651/1117] Roll src/third_party/skia
     acb4829c1be4..5ee611b26f23 (1 commits) (#8392)
    
    https://skia.googlesource.com/skia.git/%2Blog/acb4829c1be4..5ee611b26f23
    
    git log acb4829c1be4bd6be53ea750effd94c07da95632..5ee611b26f23cda16972209a56ccc38d964f6a20 --date=short --no-merges --format=%ad %ae %s
    2019-03-31 reed@google.com Add sample to show strokeandfill and better alternatives
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 79e2cebf9828d..c338df4be86c0 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': 'acb4829c1be4bd6be53ea750effd94c07da95632',
    +  'skia_revision': '5ee611b26f23cda16972209a56ccc38d964f6a20',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 2869ce6e0e4e7..0a22e645347ac 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 0b8bb37950011e610d32e616f18f5c0a
    +Signature: 5c312fca547c1e89bb4238cc4963b15a
     
     UNUSED LICENSES:
     
    
    From 82071e9161ecd2056eb030e83d67127e2eb9c278 Mon Sep 17 00:00:00 2001
    From: Amir Hardon 
    Date: Sun, 31 Mar 2019 23:21:51 -0700
    Subject: [PATCH 0652/1117] Don't access a11y APIs with reflection starting
     Android P. (#8393)
    
    ---
     .../view/AccessibilityViewEmbedder.java       | 41 ++++++++++---------
     1 file changed, 22 insertions(+), 19 deletions(-)
    
    diff --git a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java
    index fbc2260d260e0..e1065143d843a 100644
    --- a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java
    +++ b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java
    @@ -420,25 +420,28 @@ private ReflectionAccessors() {
                 Method getParentNodeId = null;
                 Method getRecordSourceNodeId = null;
                 Method getChildId = null;
    -            try {
    -                getSourceNodeId = AccessibilityNodeInfo.class.getMethod("getSourceNodeId");
    -            } catch (NoSuchMethodException e) {
    -                Log.w(TAG, "can't invoke AccessibilityNodeInfo#getSourceNodeId with reflection");
    -            }
    -            try {
    -                getParentNodeId = AccessibilityNodeInfo.class.getMethod("getParentNodeId");
    -            } catch (NoSuchMethodException e) {
    -                Log.w(TAG, "can't invoke getParentNodeId with reflection");
    -            }
    -            try {
    -                getRecordSourceNodeId = AccessibilityRecord.class.getMethod("getSourceNodeId");
    -            } catch (NoSuchMethodException e) {
    -                Log.w(TAG, "can't invoke AccessibiiltyRecord#getSourceNodeId with reflection");
    -            }
    -            try {
    -                getChildId = AccessibilityNodeInfo.class.getMethod("getChildId", int.class);
    -            } catch (NoSuchMethodException e) {
    -                Log.w(TAG, "can't invoke getChildId with reflection");
    +            // Reflection access is not allowed starting Android P.
    +            if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.O) {
    +                try {
    +                    getSourceNodeId = AccessibilityNodeInfo.class.getMethod("getSourceNodeId");
    +                } catch (NoSuchMethodException e) {
    +                    Log.w(TAG, "can't invoke AccessibilityNodeInfo#getSourceNodeId with reflection");
    +                }
    +                try {
    +                    getParentNodeId = AccessibilityNodeInfo.class.getMethod("getParentNodeId");
    +                } catch (NoSuchMethodException e) {
    +                    Log.w(TAG, "can't invoke getParentNodeId with reflection");
    +                }
    +                try {
    +                    getRecordSourceNodeId = AccessibilityRecord.class.getMethod("getSourceNodeId");
    +                } catch (NoSuchMethodException e) {
    +                    Log.w(TAG, "can't invoke AccessibiiltyRecord#getSourceNodeId with reflection");
    +                }
    +                try {
    +                    getChildId = AccessibilityNodeInfo.class.getMethod("getChildId", int.class);
    +                } catch (NoSuchMethodException e) {
    +                    Log.w(TAG, "can't invoke getChildId with reflection");
    +                }
                 }
                 this.getSourceNodeId = getSourceNodeId;
                 this.getParentNodeId = getParentNodeId;
    
    From aba61e8fb0448637a8750a9216c31e023a5bf9e4 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Mon, 1 Apr 2019 03:10:05 -0400
    Subject: [PATCH 0653/1117] Roll src/third_party/skia
     5ee611b26f23..bb482ab871a2 (4 commits) (#8394)
    
    https://skia.googlesource.com/skia.git/%2Blog/5ee611b26f23..bb482ab871a2
    
    git log 5ee611b26f23cda16972209a56ccc38d964f6a20..bb482ab871a29fad004f318210e0e01d44110a37 --date=short --no-merges --format=%ad %ae %s
    2019-04-01 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset
    2019-04-01 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 6446c8882fa3..3115a0fc17fa (2 commits)
    2019-04-01 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 871828938944..e01c3e081ff3 (525 commits)
    2019-04-01 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 5bb034db6243..52a67b6495ce (9 commits)
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index c338df4be86c0..7e754c834aff5 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': '5ee611b26f23cda16972209a56ccc38d964f6a20',
    +  'skia_revision': 'bb482ab871a29fad004f318210e0e01d44110a37',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 0a22e645347ac..f16475bb26cff 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 5c312fca547c1e89bb4238cc4963b15a
    +Signature: f8f59b48f51339d247105ed67f8c3dcd
     
     UNUSED LICENSES:
     
    
    From a850016454f6d33da64d03dbd1ea71fd0fac299f Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Mon, 1 Apr 2019 10:08:24 -0400
    Subject: [PATCH 0654/1117] Roll src/third_party/skia
     bb482ab871a2..73cc4e8d5fcf (1 commits) (#8395)
    
    https://skia.googlesource.com/skia.git/%2Blog/bb482ab871a2..73cc4e8d5fcf
    
    git log bb482ab871a29fad004f318210e0e01d44110a37..73cc4e8d5fcfdad5a09bf324bb21479a16e8e54e --date=short --no-merges --format=%ad %ae %s
    2019-04-01 robertphillips@google.com Temporarily restore old behavior of read/writeSurfacePixels
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 7e754c834aff5..454b9e05d9e8e 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': 'bb482ab871a29fad004f318210e0e01d44110a37',
    +  'skia_revision': '73cc4e8d5fcfdad5a09bf324bb21479a16e8e54e',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index f16475bb26cff..be28124e0f7fe 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: f8f59b48f51339d247105ed67f8c3dcd
    +Signature: 3057826137f37b8bb2003b7bd13c0bb0
     
     UNUSED LICENSES:
     
    
    From d8d9855dfa3f91b1517ab26f7884adc75493e87b Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Mon, 1 Apr 2019 13:37:31 -0400
    Subject: [PATCH 0655/1117] Roll src/third_party/skia
     73cc4e8d5fcf..de206c75c2c8 (2 commits) (#8396)
    
    https://skia.googlesource.com/skia.git/%2Blog/73cc4e8d5fcf..de206c75c2c8
    
    git log 73cc4e8d5fcfdad5a09bf324bb21479a16e8e54e..de206c75c2c802f6f1e4ccb8a6b8a00765e9f085 --date=short --no-merges --format=%ad %ae %s
    2019-03-27 brianosman@google.com Remove the NullGL interface (and associated test context)
    2019-03-29 mtklein@google.com more opinionated file loading in fm
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 5 +----
     2 files changed, 2 insertions(+), 5 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 454b9e05d9e8e..69d90be80ac44 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': '73cc4e8d5fcfdad5a09bf324bb21479a16e8e54e',
    +  'skia_revision': 'de206c75c2c802f6f1e4ccb8a6b8a00765e9f085',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index be28124e0f7fe..266168003c2b6 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 3057826137f37b8bb2003b7bd13c0bb0
    +Signature: 904d1207ab24d83189a5f0780836b4fd
     
     UNUSED LICENSES:
     
    @@ -1291,8 +1291,6 @@ FILE: ../../../third_party/skia/src/gpu/effects/GrShadowGeoProc.h
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLBuffer.cpp
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLBuffer.h
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLGpuCommandBuffer.h
    -FILE: ../../../third_party/skia/src/gpu/gl/GrGLTestInterface.cpp
    -FILE: ../../../third_party/skia/src/gpu/gl/GrGLTestInterface.h
     FILE: ../../../third_party/skia/src/gpu/gl/glfw/GrGLMakeNativeInterface_glfw.cpp
     FILE: ../../../third_party/skia/src/gpu/glsl/GrGLSLColorSpaceXformHelper.h
     FILE: ../../../third_party/skia/src/gpu/glsl/GrGLSLProgramDataManager.cpp
    @@ -2923,7 +2921,6 @@ FILE: ../../../third_party/skia/src/gpu/GrStencilAttachment.h
     FILE: ../../../third_party/skia/src/gpu/GrStencilSettings.cpp
     FILE: ../../../third_party/skia/src/gpu/GrTexture.cpp
     FILE: ../../../third_party/skia/src/gpu/SkGpuDevice.cpp
    -FILE: ../../../third_party/skia/src/gpu/gl/GrGLCreateNullInterface.cpp
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLDefines.h
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLGLSL.cpp
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLGLSL.h
    
    From 40eb74c50b0630d0a5fbf8586febe6581b893b66 Mon Sep 17 00:00:00 2001
    From: Dan Field 
    Date: Mon, 1 Apr 2019 12:46:28 -0700
    Subject: [PATCH 0656/1117] Make the resource context primary on iOS (#8387)
    
    * Make resource context primary on iOS
    ---
     .../darwin/ios/framework/Source/FlutterView.h     |  2 +-
     .../darwin/ios/framework/Source/FlutterView.mm    |  4 ++--
     shell/platform/darwin/ios/ios_gl_context.mm       | 14 +++++++-------
     shell/platform/darwin/ios/ios_surface_gl.h        |  3 ++-
     shell/platform/darwin/ios/ios_surface_gl.mm       |  8 ++++----
     shell/platform/darwin/ios/platform_view_ios.h     |  2 ++
     shell/platform/darwin/ios/platform_view_ios.mm    | 15 ++++++++++-----
     7 files changed, 28 insertions(+), 20 deletions(-)
    
    diff --git a/shell/platform/darwin/ios/framework/Source/FlutterView.h b/shell/platform/darwin/ios/framework/Source/FlutterView.h
    index 73f597f5cfafa..ee7110446c2f6 100644
    --- a/shell/platform/darwin/ios/framework/Source/FlutterView.h
    +++ b/shell/platform/darwin/ios/framework/Source/FlutterView.h
    @@ -33,7 +33,7 @@
     
     - (instancetype)initWithDelegate:(id)delegate
                               opaque:(BOOL)opaque NS_DESIGNATED_INITIALIZER;
    -- (std::unique_ptr)createSurface;
    +- (std::unique_ptr)createSurface:(std::shared_ptr)context;
     
     @end
     
    diff --git a/shell/platform/darwin/ios/framework/Source/FlutterView.mm b/shell/platform/darwin/ios/framework/Source/FlutterView.mm
    index f60f114f2ea1c..5cddc9708bd23 100644
    --- a/shell/platform/darwin/ios/framework/Source/FlutterView.mm
    +++ b/shell/platform/darwin/ios/framework/Source/FlutterView.mm
    @@ -75,7 +75,7 @@ + (Class)layerClass {
     #endif  // TARGET_IPHONE_SIMULATOR
     }
     
    -- (std::unique_ptr)createSurface {
    +- (std::unique_ptr)createSurface:(std::shared_ptr)context {
       if ([self.layer isKindOfClass:[CAEAGLLayer class]]) {
         fml::scoped_nsobject eagl_layer(
             reinterpret_cast([self.layer retain]));
    @@ -88,7 +88,7 @@ + (Class)layerClass {
             eagl_layer.get().presentsWithTransaction = YES;
           }
         }
    -    return std::make_unique(std::move(eagl_layer),
    +    return std::make_unique(context, std::move(eagl_layer),
                                                      [_delegate platformViewsController]);
       } else {
         fml::scoped_nsobject layer(reinterpret_cast([self.layer retain]));
    diff --git a/shell/platform/darwin/ios/ios_gl_context.mm b/shell/platform/darwin/ios/ios_gl_context.mm
    index c80919a7cab3c..74e98b223aaf9 100644
    --- a/shell/platform/darwin/ios/ios_gl_context.mm
    +++ b/shell/platform/darwin/ios/ios_gl_context.mm
    @@ -13,14 +13,14 @@
     namespace shell {
     
     IOSGLContext::IOSGLContext() {
    -  context_.reset([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]);
    -  if (context_ != nullptr) {
    -    resource_context_.reset([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3
    -                                                  sharegroup:context_.get().sharegroup]);
    +  resource_context_.reset([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]);
    +  if (resource_context_ != nullptr) {
    +    context_.reset([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3
    +                                         sharegroup:resource_context_.get().sharegroup]);
       } else {
    -    context_.reset([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]);
    -    resource_context_.reset([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2
    -                                                  sharegroup:context_.get().sharegroup]);
    +    resource_context_.reset([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]);
    +    context_.reset([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2
    +                                         sharegroup:resource_context_.get().sharegroup]);
       }
     
       // TODO:
    diff --git a/shell/platform/darwin/ios/ios_surface_gl.h b/shell/platform/darwin/ios/ios_surface_gl.h
    index 93fcc0f510624..7de1e00a31ee5 100644
    --- a/shell/platform/darwin/ios/ios_surface_gl.h
    +++ b/shell/platform/darwin/ios/ios_surface_gl.h
    @@ -20,7 +20,8 @@ class IOSSurfaceGL : public IOSSurface,
                          public GPUSurfaceGLDelegate,
                          public flow::ExternalViewEmbedder {
      public:
    -  IOSSurfaceGL(fml::scoped_nsobject layer,
    +  IOSSurfaceGL(std::shared_ptr context,
    +               fml::scoped_nsobject layer,
                    FlutterPlatformViewsController* platform_views_controller);
     
       IOSSurfaceGL(fml::scoped_nsobject layer, std::shared_ptr context);
    diff --git a/shell/platform/darwin/ios/ios_surface_gl.mm b/shell/platform/darwin/ios/ios_surface_gl.mm
    index cd0bb093d87d4..2c7ab3a2d13bd 100644
    --- a/shell/platform/darwin/ios/ios_surface_gl.mm
    +++ b/shell/platform/darwin/ios/ios_surface_gl.mm
    @@ -9,10 +9,10 @@
     
     namespace shell {
     
    -IOSSurfaceGL::IOSSurfaceGL(fml::scoped_nsobject layer,
    +IOSSurfaceGL::IOSSurfaceGL(std::shared_ptr context,
    +                           fml::scoped_nsobject layer,
                                FlutterPlatformViewsController* platform_views_controller)
    -    : IOSSurface(platform_views_controller) {
    -  context_ = std::make_shared();
    +    : IOSSurface(platform_views_controller), context_(context) {
       render_target_ = context_->CreateRenderTarget(std::move(layer));
     }
     
    @@ -29,7 +29,7 @@
     }
     
     bool IOSSurfaceGL::ResourceContextMakeCurrent() {
    -  return render_target_->IsValid() ? context_->ResourceMakeCurrent() : false;
    +  return context_->ResourceMakeCurrent();
     }
     
     void IOSSurfaceGL::UpdateStorageSizeIfNecessary() {
    diff --git a/shell/platform/darwin/ios/platform_view_ios.h b/shell/platform/darwin/ios/platform_view_ios.h
    index b7495b90fec51..b38a72b653d33 100644
    --- a/shell/platform/darwin/ios/platform_view_ios.h
    +++ b/shell/platform/darwin/ios/platform_view_ios.h
    @@ -17,6 +17,7 @@
     #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/framework/Source/platform_message_router.h"
    +#include "flutter/shell/platform/darwin/ios/ios_gl_context.h"
     #include "flutter/shell/platform/darwin/ios/ios_surface.h"
     
     @class FlutterViewController;
    @@ -46,6 +47,7 @@ class PlatformViewIOS final : public PlatformView {
      private:
       fml::WeakPtr owner_controller_;
       std::unique_ptr ios_surface_;
    +  std::shared_ptr gl_context_;
       PlatformMessageRouter platform_message_router_;
       std::unique_ptr accessibility_bridge_;
       fml::scoped_nsprotocol text_input_plugin_;
    diff --git a/shell/platform/darwin/ios/platform_view_ios.mm b/shell/platform/darwin/ios/platform_view_ios.mm
    index c0b988be882ea..b6e94649e3cc0 100644
    --- a/shell/platform/darwin/ios/platform_view_ios.mm
    +++ b/shell/platform/darwin/ios/platform_view_ios.mm
    @@ -20,7 +20,11 @@
     namespace shell {
     
     PlatformViewIOS::PlatformViewIOS(PlatformView::Delegate& delegate, blink::TaskRunners task_runners)
    -    : PlatformView(delegate, std::move(task_runners)) {}
    +    : PlatformView(delegate, std::move(task_runners)) {
    +#if !TARGET_IPHONE_SIMULATOR
    +  gl_context_ = std::make_shared();
    +#endif  // !TARGET_IPHONE_SIMULATOR
    +}
     
     PlatformViewIOS::~PlatformViewIOS() = default;
     
    @@ -45,7 +49,8 @@
       }
       owner_controller_ = owner_controller;
       if (owner_controller_) {
    -    ios_surface_ = static_cast(owner_controller.get().view).createSurface;
    +    ios_surface_ =
    +        [static_cast(owner_controller.get().view) createSurface:gl_context_];
         FML_DCHECK(ios_surface_ != nullptr);
     
         if (accessibility_bridge_) {
    @@ -77,10 +82,10 @@ new AccessibilityBridge(static_cast(owner_controller_.get().view),
     
     // |shell::PlatformView|
     sk_sp PlatformViewIOS::CreateResourceContext() const {
    -  if (!ios_surface_ || !ios_surface_->ResourceContextMakeCurrent()) {
    +  if (!gl_context_ || !gl_context_->ResourceMakeCurrent()) {
         FML_DLOG(INFO) << "Could not make resource context current on IO thread. "
    -                      "Async texture uploads "
    -                      "will be disabled.";
    +                      "Async texture uploads will be disabled. On Simulators, "
    +                      "this is expected.";
         return nullptr;
       }
     
    
    From 6c1b0b83c2b3259cf7b23c2f6d6fc5cfdb924b61 Mon Sep 17 00:00:00 2001
    From: Ben Konyi 
    Date: Mon, 1 Apr 2019 13:14:54 -0700
    Subject: [PATCH 0657/1117] Roll src/third_party/dart 1e82544b07..75b2f9f919
     (26 commits)
    
    75b2f9f919 Move more HintCode tests to individual files:
    acb62b97fe Add a default URL for lints
    3fd124db1f [vm] Repair the resolver abstraction.
    e979448597 Patch expectations for tests where AST linking does better / differently.
    1e77c187c8 Update front-end status for added tests and changed results
    87de68341f [CFE] Disallow property access on instance constants.
    4ae5b272cb [vm/bytecode/compiler] Fix dropping of expression stack values when generating Throw
    1a3e8dda3b Handle nested unevaluated constants in constant evaluator
    277f65ec93 [CFE] Permit evaluating a const variable more than once.
    a88b653e03 [CFE] Bubble out InvalidExpression from unevaluated constants.
    05dd851566 Test late CFE constant evaluation.
    413315cacd Add some tests for constants.
    dc1f6b352a Update front-end status for co19 roll
    154c324786 [vm/ffi] Lock out structs on 32-bit platforms.
    79bb83a927 [infra] Fix debianpackage build
    a062221b76 [vm] Re-number class ids for internal/external typed data and typed data views
    c14a15bad1 Remove third_party/google_test from index
    66f16d3d5e Resynthesize import/export combinators.
    4e3d1400d5 Resynthesize ImportElement.isDeferred from AST.
    8a5901a7af Support for isCovariant in fields.
    9113bb5855 Issue 36380. Increment DATA_VERSION.
    e6b0676f58 Change comment style in a few more files
    94362f1af0 [vm] Unify internal/external/view typed data into new RawTypedDataBase class
    c7dd9c1c23 Perform top-level inference using elements.
    cd34ec901c [gardening] Flutter patch is no longer needed.
    3642eddca1 Create an experiment flag for triple-shift and move existing support for the operator behind the new flag
    ---
     DEPS                                    | 2 +-
     ci/licenses_golden/licenses_third_party | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 69d90be80ac44..a64f22d67a39e 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -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': '1e82544b07f13394da8da305858de5ab7caae7ad',
    +  'dart_revision': '75b2f9f919e5728902aff39a09223d1cc9402585',
     
       # WARNING: DO NOT EDIT MANUALLY
       # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
    diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party
    index 033db69532a3e..cfc7add127e7b 100644
    --- a/ci/licenses_golden/licenses_third_party
    +++ b/ci/licenses_golden/licenses_third_party
    @@ -1,4 +1,4 @@
    -Signature: 4fbe06d52d386154c027097dac450ce8
    +Signature: 56ea8d814aee503d5f73adb0a7f1c6fd
     
     UNUSED LICENSES:
     
    
    From 8c9aca440957d14e08252be5c0f31d01cb91c416 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Mon, 1 Apr 2019 17:06:44 -0400
    Subject: [PATCH 0658/1117] Roll src/third_party/skia
     de206c75c2c8..b27667a15a15 (14 commits) (#8399)
    
    https://skia.googlesource.com/skia.git/%2Blog/de206c75c2c8..b27667a15a15
    
    git log de206c75c2c802f6f1e4ccb8a6b8a00765e9f085..b27667a15a15ce31d135538a409c419c0b8b0d1b --date=short --no-merges --format=%ad %ae %s
    2019-04-01 brianosman@google.com Remove ToolUtils::write_pixels
    2019-04-01 nifong@google.com Include wasm debugger in continuous build part 2
    2019-03-27 bungeman@google.com Expose basic shaper iterators.
    2019-04-01 reed@google.com mark introspection methods as deprecated
    2019-04-01 michaelludwig@google.com Add geometry domain for non-rectilinear quads
    2019-04-01 csmartdalton@google.com Fix mkdir_p in skpbench
    2019-04-01 nifong@google.com Include wasm debugger in continuous build
    2019-04-01 fmalita@chromium.org [sksg] Refactor gradient implementation
    2019-03-28 bungeman@google.com Cache data stream for CG typefaces.
    2019-04-01 bsalomon@google.com GrBackendTextureImageGenerator proxy callback uses unique key to find existing GrTexture.
    2019-04-01 robertphillips@google.com Make prepareSurfaceForExternalIO always flush
    2019-04-01 bsalomon@google.com Make GrVkGpuRTCommandBuffer::CommandBufferInfo hold textures by pending read.
    2019-04-01 rmistry@google.com Remove 4 page sets that are not useful as SKPs
    2019-04-01 bsalomon@google.com Make lazy proxies have 2 modes for proxy/surface key management.
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 8 +++-----
     2 files changed, 4 insertions(+), 6 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index a64f22d67a39e..c6632cb89a0ca 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': 'de206c75c2c802f6f1e4ccb8a6b8a00765e9f085',
    +  'skia_revision': 'b27667a15a15ce31d135538a409c419c0b8b0d1b',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 266168003c2b6..0af9b04a1f983 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 904d1207ab24d83189a5f0780836b4fd
    +Signature: 0cafcf3959b077da7fab02aca9869893
     
     UNUSED LICENSES:
     
    @@ -4231,7 +4231,6 @@ FILE: ../../../third_party/skia/modules/skottie/src/Skottie.cpp
     FILE: ../../../third_party/skia/modules/skottie/src/SkottieAnimator.cpp
     FILE: ../../../third_party/skia/modules/skottie/src/SkottieValue.cpp
     FILE: ../../../third_party/skia/modules/skottie/src/SkottieValue.h
    -FILE: ../../../third_party/skia/modules/sksg/include/SkSGColor.h
     FILE: ../../../third_party/skia/modules/sksg/include/SkSGDraw.h
     FILE: ../../../third_party/skia/modules/sksg/include/SkSGEffectNode.h
     FILE: ../../../third_party/skia/modules/sksg/include/SkSGGeometryNode.h
    @@ -4239,13 +4238,12 @@ FILE: ../../../third_party/skia/modules/sksg/include/SkSGGroup.h
     FILE: ../../../third_party/skia/modules/sksg/include/SkSGInvalidationController.h
     FILE: ../../../third_party/skia/modules/sksg/include/SkSGMerge.h
     FILE: ../../../third_party/skia/modules/sksg/include/SkSGNode.h
    -FILE: ../../../third_party/skia/modules/sksg/include/SkSGPaintNode.h
    +FILE: ../../../third_party/skia/modules/sksg/include/SkSGPaint.h
     FILE: ../../../third_party/skia/modules/sksg/include/SkSGPath.h
     FILE: ../../../third_party/skia/modules/sksg/include/SkSGRect.h
     FILE: ../../../third_party/skia/modules/sksg/include/SkSGRenderNode.h
     FILE: ../../../third_party/skia/modules/sksg/include/SkSGTransform.h
     FILE: ../../../third_party/skia/modules/sksg/include/SkSGTrimEffect.h
    -FILE: ../../../third_party/skia/modules/sksg/src/SkSGColor.cpp
     FILE: ../../../third_party/skia/modules/sksg/src/SkSGDraw.cpp
     FILE: ../../../third_party/skia/modules/sksg/src/SkSGEffectNode.cpp
     FILE: ../../../third_party/skia/modules/sksg/src/SkSGGeometryNode.cpp
    @@ -4253,7 +4251,7 @@ FILE: ../../../third_party/skia/modules/sksg/src/SkSGGroup.cpp
     FILE: ../../../third_party/skia/modules/sksg/src/SkSGInvalidationController.cpp
     FILE: ../../../third_party/skia/modules/sksg/src/SkSGMerge.cpp
     FILE: ../../../third_party/skia/modules/sksg/src/SkSGNode.cpp
    -FILE: ../../../third_party/skia/modules/sksg/src/SkSGPaintNode.cpp
    +FILE: ../../../third_party/skia/modules/sksg/src/SkSGPaint.cpp
     FILE: ../../../third_party/skia/modules/sksg/src/SkSGPath.cpp
     FILE: ../../../third_party/skia/modules/sksg/src/SkSGRect.cpp
     FILE: ../../../third_party/skia/modules/sksg/src/SkSGRenderNode.cpp
    
    From c991647404f8117dab2ca4ed49aa3ba48a634240 Mon Sep 17 00:00:00 2001
    From: Chinmay Garde 
    Date: Mon, 1 Apr 2019 14:58:05 -0700
    Subject: [PATCH 0659/1117] Separate the data required to bootstrap the VM into
     its own class. (#8397)
    
    When attempting to shutdown and subsequently restart the VM, having the
    VM own this data introduces lifecycle issues due to circular references.
    ---
     ci/licenses_golden/licenses_flutter           |   4 +
     common/settings.h                             |   2 +
     .../isolate_name_server_natives.cc            |  18 +-
     lib/ui/ui_dart_state.cc                       |   6 +-
     lib/ui/ui_dart_state.h                        |   6 +-
     runtime/BUILD.gn                              |   5 +
     runtime/dart_isolate.cc                       |  89 +++++-----
     runtime/dart_isolate.h                        |  26 +--
     runtime/dart_isolate_unittests.cc             |  78 +++++----
     runtime/dart_vm.cc                            | 160 ++++++++----------
     runtime/dart_vm.h                             |  58 +++----
     runtime/dart_vm_data.cc                       |  79 +++++++++
     runtime/dart_vm_data.h                        |  47 +++++
     runtime/dart_vm_lifecycle.cc                  | 117 +++++++++++++
     runtime/dart_vm_lifecycle.h                   |  72 ++++++++
     runtime/dart_vm_unittests.cc                  |   8 +-
     runtime/runtime_controller.cc                 |  10 +-
     runtime/runtime_controller.h                  |  12 +-
     shell/common/engine.cc                        |   4 +-
     shell/common/engine.h                         |   4 +-
     shell/common/shell.cc                         |  88 ++++++----
     shell/common/shell.h                          |  21 ++-
     testing/testing.cc                            |   4 +-
     testing/testing.h                             |   4 +
     24 files changed, 632 insertions(+), 290 deletions(-)
     create mode 100644 runtime/dart_vm_data.cc
     create mode 100644 runtime/dart_vm_data.h
     create mode 100644 runtime/dart_vm_lifecycle.cc
     create mode 100644 runtime/dart_vm_lifecycle.h
    
    diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter
    index c9914e4c2156f..312e6c329ab71 100644
    --- a/ci/licenses_golden/licenses_flutter
    +++ b/ci/licenses_golden/licenses_flutter
    @@ -383,6 +383,10 @@ FILE: ../../../flutter/runtime/dart_snapshot_buffer.cc
     FILE: ../../../flutter/runtime/dart_snapshot_buffer.h
     FILE: ../../../flutter/runtime/dart_vm.cc
     FILE: ../../../flutter/runtime/dart_vm.h
    +FILE: ../../../flutter/runtime/dart_vm_data.cc
    +FILE: ../../../flutter/runtime/dart_vm_data.h
    +FILE: ../../../flutter/runtime/dart_vm_lifecycle.cc
    +FILE: ../../../flutter/runtime/dart_vm_lifecycle.h
     FILE: ../../../flutter/runtime/dart_vm_unittests.cc
     FILE: ../../../flutter/runtime/embedder_resources.cc
     FILE: ../../../flutter/runtime/embedder_resources.h
    diff --git a/common/settings.h b/common/settings.h
    index bfbfd4139d322..40b647de1f431 100644
    --- a/common/settings.h
    +++ b/common/settings.h
    @@ -85,6 +85,8 @@ struct Settings {
       // Font settings
       bool use_test_fonts = false;
     
    +  bool leak_vm = true;
    +
       // Engine settings
       TaskObserverAdd task_observer_add;
       TaskObserverRemove task_observer_remove;
    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 7f4467886f4fa..3f7f80ef05fd7 100644
    --- a/lib/ui/isolate_name_server/isolate_name_server_natives.cc
    +++ b/lib/ui/isolate_name_server/isolate_name_server_natives.cc
    @@ -14,8 +14,10 @@ namespace blink {
     
     Dart_Handle IsolateNameServerNatives::LookupPortByName(
         const std::string& name) {
    -  IsolateNameServer* name_server =
    -      UIDartState::Current()->GetIsolateNameServer();
    +  auto name_server = UIDartState::Current()->GetIsolateNameServer();
    +  if (!name_server) {
    +    return Dart_Null();
    +  }
       Dart_Port port = name_server->LookupIsolatePortByName(name);
       if (port == ILLEGAL_PORT) {
         return Dart_Null();
    @@ -26,8 +28,10 @@ Dart_Handle IsolateNameServerNatives::LookupPortByName(
     Dart_Handle IsolateNameServerNatives::RegisterPortWithName(
         Dart_Handle port_handle,
         const std::string& name) {
    -  IsolateNameServer* name_server =
    -      UIDartState::Current()->GetIsolateNameServer();
    +  auto name_server = UIDartState::Current()->GetIsolateNameServer();
    +  if (!name_server) {
    +    return Dart_False();
    +  }
       Dart_Port port = ILLEGAL_PORT;
       Dart_SendPortGetId(port_handle, &port);
       if (!name_server->RegisterIsolatePortWithName(port, name)) {
    @@ -38,8 +42,10 @@ Dart_Handle IsolateNameServerNatives::RegisterPortWithName(
     
     Dart_Handle IsolateNameServerNatives::RemovePortNameMapping(
         const std::string& name) {
    -  IsolateNameServer* name_server =
    -      UIDartState::Current()->GetIsolateNameServer();
    +  auto name_server = UIDartState::Current()->GetIsolateNameServer();
    +  if (!name_server) {
    +    return Dart_False();
    +  }
       if (!name_server->RemoveIsolateNameMapping(name)) {
         return Dart_False();
       }
    diff --git a/lib/ui/ui_dart_state.cc b/lib/ui/ui_dart_state.cc
    index b42cbaf5ba607..be0a5348f31a1 100644
    --- a/lib/ui/ui_dart_state.cc
    +++ b/lib/ui/ui_dart_state.cc
    @@ -23,7 +23,7 @@ UIDartState::UIDartState(
         std::string advisory_script_entrypoint,
         std::string logger_prefix,
         UnhandledExceptionCallback unhandled_exception_callback,
    -    IsolateNameServer* isolate_name_server)
    +    std::shared_ptr isolate_name_server)
         : task_runners_(std::move(task_runners)),
           add_callback_(std::move(add_callback)),
           remove_callback_(std::move(remove_callback)),
    @@ -33,7 +33,7 @@ UIDartState::UIDartState(
           advisory_script_entrypoint_(std::move(advisory_script_entrypoint)),
           logger_prefix_(std::move(logger_prefix)),
           unhandled_exception_callback_(unhandled_exception_callback),
    -      isolate_name_server_(isolate_name_server) {
    +      isolate_name_server_(std::move(isolate_name_server)) {
       AddOrRemoveTaskObserver(true /* add */);
     }
     
    @@ -124,7 +124,7 @@ fml::WeakPtr UIDartState::GetResourceContext() const {
       return io_manager_->GetResourceContext();
     }
     
    -IsolateNameServer* UIDartState::GetIsolateNameServer() {
    +std::shared_ptr UIDartState::GetIsolateNameServer() const {
       return isolate_name_server_;
     }
     
    diff --git a/lib/ui/ui_dart_state.h b/lib/ui/ui_dart_state.h
    index f2c63cbacef60..afa5e47e83de8 100644
    --- a/lib/ui/ui_dart_state.h
    +++ b/lib/ui/ui_dart_state.h
    @@ -53,7 +53,7 @@ class UIDartState : public tonic::DartState {
     
       fml::WeakPtr GetResourceContext() const;
     
    -  IsolateNameServer* GetIsolateNameServer();
    +  std::shared_ptr GetIsolateNameServer() const;
     
       tonic::DartErrorHandleType GetLastError();
     
    @@ -81,7 +81,7 @@ class UIDartState : public tonic::DartState {
                   std::string advisory_script_entrypoint,
                   std::string logger_prefix,
                   UnhandledExceptionCallback unhandled_exception_callback,
    -              IsolateNameServer* isolate_name_server);
    +              std::shared_ptr isolate_name_server);
     
       ~UIDartState() override;
     
    @@ -107,7 +107,7 @@ class UIDartState : public tonic::DartState {
       std::unique_ptr window_;
       tonic::DartMicrotaskQueue microtask_queue_;
       UnhandledExceptionCallback unhandled_exception_callback_;
    -  IsolateNameServer* isolate_name_server_;
    +  const std::shared_ptr isolate_name_server_;
     
       void AddOrRemoveTaskObserver(bool add);
     };
    diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
    index 3d0e807585fcd..a906e589c223f 100644
    --- a/runtime/BUILD.gn
    +++ b/runtime/BUILD.gn
    @@ -50,6 +50,10 @@ source_set("runtime") {
         "dart_snapshot_buffer.h",
         "dart_vm.cc",
         "dart_vm.h",
    +    "dart_vm_data.cc",
    +    "dart_vm_data.h",
    +    "dart_vm_lifecycle.cc",
    +    "dart_vm_lifecycle.h",
         "embedder_resources.cc",
         "embedder_resources.h",
         "runtime_controller.cc",
    @@ -115,6 +119,7 @@ executable("runtime_unittests") {
         "$flutter_root/common",
         "$flutter_root/fml",
         "$flutter_root/lib/snapshot",
    +    "$flutter_root/shell/common",
         "$flutter_root/testing:dart",
         "//third_party/skia",
         "//third_party/tonic",
    diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc
    index 7cae71c36e3fd..46df151f40b0e 100644
    --- a/runtime/dart_isolate.cc
    +++ b/runtime/dart_isolate.cc
    @@ -14,6 +14,7 @@
     #include "flutter/lib/ui/dart_ui.h"
     #include "flutter/runtime/dart_service_isolate.h"
     #include "flutter/runtime/dart_vm.h"
    +#include "flutter/runtime/dart_vm_lifecycle.h"
     #include "third_party/dart/runtime/include/dart_api.h"
     #include "third_party/dart/runtime/include/dart_tools_api.h"
     #include "third_party/tonic/converter/dart_converter.h"
    @@ -29,9 +30,9 @@
     namespace blink {
     
     std::weak_ptr DartIsolate::CreateRootIsolate(
    -    DartVM* vm,
    -    fml::RefPtr isolate_snapshot,
    -    fml::RefPtr shared_snapshot,
    +    const Settings& settings,
    +    fml::RefPtr isolate_snapshot,
    +    fml::RefPtr shared_snapshot,
         TaskRunners task_runners,
         std::unique_ptr window,
         fml::WeakPtr snapshot_delegate,
    @@ -50,7 +51,7 @@ 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
    +          settings,                      // settings
               std::move(isolate_snapshot),   // isolate snapshot
               std::move(shared_snapshot),    // shared snapshot
               task_runners,                  // task runners
    @@ -93,9 +94,9 @@ std::weak_ptr DartIsolate::CreateRootIsolate(
       return embedder_isolate;
     }
     
    -DartIsolate::DartIsolate(DartVM* vm,
    -                         fml::RefPtr isolate_snapshot,
    -                         fml::RefPtr shared_snapshot,
    +DartIsolate::DartIsolate(const Settings& settings,
    +                         fml::RefPtr isolate_snapshot,
    +                         fml::RefPtr shared_snapshot,
                              TaskRunners task_runners,
                              fml::WeakPtr snapshot_delegate,
                              fml::WeakPtr io_manager,
    @@ -103,36 +104,31 @@ DartIsolate::DartIsolate(DartVM* vm,
                              std::string advisory_script_entrypoint,
                              ChildIsolatePreparer child_isolate_preparer)
         : UIDartState(std::move(task_runners),
    -                  vm->GetSettings().task_observer_add,
    -                  vm->GetSettings().task_observer_remove,
    +                  settings.task_observer_add,
    +                  settings.task_observer_remove,
                       std::move(snapshot_delegate),
                       std::move(io_manager),
                       advisory_script_uri,
                       advisory_script_entrypoint,
    -                  vm->GetSettings().log_tag,
    -                  vm->GetSettings().unhandled_exception_callback,
    -                  vm->GetIsolateNameServer()),
    -      vm_(vm),
    +                  settings.log_tag,
    +                  settings.unhandled_exception_callback,
    +                  DartVMRef::GetIsolateNameServer()),
    +      settings_(settings),
           isolate_snapshot_(std::move(isolate_snapshot)),
           shared_snapshot_(std::move(shared_snapshot)),
           child_isolate_preparer_(std::move(child_isolate_preparer)) {
       FML_DCHECK(isolate_snapshot_) << "Must contain a valid isolate snapshot.";
    -
    -  if (vm_ == nullptr) {
    -    return;
    -  }
    -
       phase_ = Phase::Uninitialized;
     }
     
     DartIsolate::~DartIsolate() = default;
     
    -DartIsolate::Phase DartIsolate::GetPhase() const {
    -  return phase_;
    +const Settings& DartIsolate::GetSettings() const {
    +  return settings_;
     }
     
    -DartVM* DartIsolate::GetDartVM() const {
    -  return vm_;
    +DartIsolate::Phase DartIsolate::GetPhase() const {
    +  return phase_;
     }
     
     bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) {
    @@ -500,16 +496,16 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
         const char* package_config,
         Dart_IsolateFlags* flags,
         char** error) {
    -  auto vm = DartVM::ForProcessIfInitialized();
    +  auto vm_data = DartVMRef::GetVMData();
     
    -  if (!vm) {
    +  if (!vm_data) {
         *error = strdup(
    -        "Could not resolve the VM when attempting to create the service "
    -        "isolate.");
    +        "Could not access VM data to initialize isolates. This may be because "
    +        "the VM has initialized shutdown on another thread already.");
         return nullptr;
       }
     
    -  const auto& settings = vm->GetSettings();
    +  const auto& settings = vm_data->GetSettings();
     
       if (!settings.enable_observatory) {
         FML_DLOG(INFO) << "Observatory is disabled.";
    @@ -524,16 +520,16 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
     
       std::weak_ptr weak_service_isolate =
           DartIsolate::CreateRootIsolate(
    -          vm.get(),                      // vm
    -          vm->GetIsolateSnapshot(),      // isolate snapshot
    -          vm->GetSharedSnapshot(),       // shared snapshot
    -          null_task_runners,             // task runners
    -          nullptr,                       // window
    -          {},                            // snapshot delegate
    -          {},                            // IO Manager
    -          DART_VM_SERVICE_ISOLATE_NAME,  // script uri
    -          DART_VM_SERVICE_ISOLATE_NAME,  // script entrypoint
    -          flags                          // flags
    +          vm_data->GetSettings(),         // settings
    +          vm_data->GetIsolateSnapshot(),  // isolate snapshot
    +          vm_data->GetSharedSnapshot(),   // shared snapshot
    +          null_task_runners,              // task runners
    +          nullptr,                        // window
    +          {},                             // snapshot delegate
    +          {},                             // IO Manager
    +          DART_VM_SERVICE_ISOLATE_NAME,   // script uri
    +          DART_VM_SERVICE_ISOLATE_NAME,   // script entrypoint
    +          flags                           // flags
           );
     
       std::shared_ptr service_isolate = weak_service_isolate.lock();
    @@ -556,7 +552,13 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
         return nullptr;
       }
     
    -  vm->GetServiceProtocol().ToggleHooks(true);
    +  if (auto service_protocol = DartVMRef::GetServiceProtocol()) {
    +    service_protocol->ToggleHooks(true);
    +  } else {
    +    FML_DLOG(ERROR)
    +        << "Could not acquire the service protocol handlers. This might be "
    +           "because the VM has already begun teardown on another thread.";
    +  }
     
       return service_isolate->isolate();
     }
    @@ -612,16 +614,13 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
       std::unique_ptr> embedder_isolate(
           p_parent_embedder_isolate);
     
    -  if (embedder_isolate == nullptr ||
    -      (*embedder_isolate)->GetDartVM() == nullptr) {
    +  if (embedder_isolate == nullptr) {
         *error =
             strdup("Parent isolate did not have embedder specific callback data.");
         FML_DLOG(ERROR) << *error;
         return {nullptr, {}};
       }
     
    -  DartVM* const vm = (*embedder_isolate)->GetDartVM();
    -
       if (!is_root_isolate) {
         auto* raw_embedder_isolate = embedder_isolate.release();
     
    @@ -630,7 +629,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
     
         embedder_isolate = std::make_unique>(
             std::make_shared(
    -            vm,                                             // vm
    +            (*raw_embedder_isolate)->GetSettings(),         // settings
                 (*raw_embedder_isolate)->GetIsolateSnapshot(),  // isolate_snapshot
                 (*raw_embedder_isolate)->GetSharedSnapshot(),   // shared_snapshot
                 null_task_runners,                              // task_runners
    @@ -703,11 +702,11 @@ void DartIsolate::DartIsolateCleanupCallback(
       delete embedder_isolate;
     }
     
    -fml::RefPtr DartIsolate::GetIsolateSnapshot() const {
    +fml::RefPtr DartIsolate::GetIsolateSnapshot() const {
       return isolate_snapshot_;
     }
     
    -fml::RefPtr DartIsolate::GetSharedSnapshot() const {
    +fml::RefPtr DartIsolate::GetSharedSnapshot() const {
       return shared_snapshot_;
     }
     
    diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h
    index 6b92875e1dc0e..49c3df3c51082 100644
    --- a/runtime/dart_isolate.h
    +++ b/runtime/dart_isolate.h
    @@ -41,9 +41,9 @@ class DartIsolate : public UIDartState {
       // bindings. From the VM's perspective, this isolate is not special in any
       // way.
       static std::weak_ptr CreateRootIsolate(
    -      DartVM* vm,
    -      fml::RefPtr isolate_snapshot,
    -      fml::RefPtr shared_snapshot,
    +      const Settings& settings,
    +      fml::RefPtr isolate_snapshot,
    +      fml::RefPtr shared_snapshot,
           TaskRunners task_runners,
           std::unique_ptr window,
           fml::WeakPtr snapshot_delegate,
    @@ -52,9 +52,9 @@ class DartIsolate : public UIDartState {
           std::string advisory_script_entrypoint,
           Dart_IsolateFlags* flags = nullptr);
     
    -  DartIsolate(DartVM* vm,
    -              fml::RefPtr isolate_snapshot,
    -              fml::RefPtr shared_snapshot,
    +  DartIsolate(const Settings& settings,
    +              fml::RefPtr isolate_snapshot,
    +              fml::RefPtr shared_snapshot,
                   TaskRunners task_runners,
                   fml::WeakPtr snapshot_delegate,
                   fml::WeakPtr io_manager,
    @@ -64,6 +64,8 @@ class DartIsolate : public UIDartState {
     
       ~DartIsolate() override;
     
    +  const Settings& GetSettings() const;
    +
       Phase GetPhase() const;
     
       FML_WARN_UNUSED_RESULT
    @@ -86,11 +88,9 @@ class DartIsolate : public UIDartState {
     
       void AddIsolateShutdownCallback(fml::closure closure);
     
    -  DartVM* GetDartVM() const;
    -
    -  fml::RefPtr GetIsolateSnapshot() const;
    +  fml::RefPtr GetIsolateSnapshot() const;
     
    -  fml::RefPtr GetSharedSnapshot() const;
    +  fml::RefPtr GetSharedSnapshot() const;
     
       std::weak_ptr GetWeakIsolatePtr();
     
    @@ -109,10 +109,10 @@ class DartIsolate : public UIDartState {
       };
       friend class DartVM;
     
    -  DartVM* const vm_ = nullptr;
       Phase phase_ = Phase::Unknown;
    -  const fml::RefPtr isolate_snapshot_;
    -  const fml::RefPtr shared_snapshot_;
    +  const Settings settings_;
    +  const fml::RefPtr isolate_snapshot_;
    +  const fml::RefPtr shared_snapshot_;
       std::vector> kernel_buffers_;
       std::vector> shutdown_callbacks_;
       ChildIsolatePreparer child_isolate_preparer_ = nullptr;
    diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc
    index d35766f58f81f..e2a7c734bb1c8 100644
    --- a/runtime/dart_isolate_unittests.cc
    +++ b/runtime/dart_isolate_unittests.cc
    @@ -9,6 +9,7 @@
     #include "flutter/fml/thread.h"
     #include "flutter/runtime/dart_isolate.h"
     #include "flutter/runtime/dart_vm.h"
    +#include "flutter/runtime/dart_vm_lifecycle.h"
     #include "flutter/runtime/runtime_test.h"
     #include "flutter/testing/testing.h"
     #include "flutter/testing/thread_test.h"
    @@ -26,8 +27,10 @@ using DartIsolateTest = RuntimeTest;
     
     TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) {
       auto settings = CreateSettingsForFixture();
    -  auto vm = DartVM::ForProcess(settings);
    -  ASSERT_TRUE(vm);
    +  auto vm_ref = DartVMRef::Create(settings);
    +  ASSERT_TRUE(vm_ref);
    +  auto vm_data = vm_ref.GetVMData();
    +  ASSERT_TRUE(vm_data);
       TaskRunners task_runners(CURRENT_TEST_NAME,       //
                                GetCurrentTaskRunner(),  //
                                GetCurrentTaskRunner(),  //
    @@ -35,15 +38,15 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) {
                                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
    -      {},                        // io manager
    -      "main.dart",               // advisory uri
    -      "main"                     // advisory entrypoint
    +      vm_data->GetSettings(),         // settings
    +      vm_data->GetIsolateSnapshot(),  // isolate snapshot
    +      vm_data->GetSharedSnapshot(),   // shared snapshot
    +      std::move(task_runners),        // task runners
    +      nullptr,                        // window
    +      {},                             // snapshot delegate
    +      {},                             // io manager
    +      "main.dart",                    // advisory uri
    +      "main"                          // advisory entrypoint
       );
       auto root_isolate = weak_isolate.lock();
       ASSERT_TRUE(root_isolate);
    @@ -53,8 +56,10 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) {
     
     TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) {
       auto settings = CreateSettingsForFixture();
    -  auto vm = DartVM::ForProcess(settings);
    -  ASSERT_TRUE(vm);
    +  auto vm_ref = DartVMRef::Create(settings);
    +  ASSERT_TRUE(vm_ref);
    +  auto vm_data = vm_ref.GetVMData();
    +  ASSERT_TRUE(vm_data);
       TaskRunners task_runners(CURRENT_TEST_NAME,       //
                                GetCurrentTaskRunner(),  //
                                GetCurrentTaskRunner(),  //
    @@ -62,15 +67,15 @@ TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) {
                                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
    -      {},                        // io manager
    -      "main.dart",               // advisory uri
    -      "main"                     // advisory entrypoint
    +      vm_data->GetSettings(),         // settings
    +      vm_data->GetIsolateSnapshot(),  // isolate snapshot
    +      vm_data->GetSharedSnapshot(),   // shared snapshot
    +      std::move(task_runners),        // task runners
    +      nullptr,                        // window
    +      {},                             // snapshot delegate
    +      {},                             // io manager
    +      "main.dart",                    // advisory uri
    +      "main"                          // advisory entrypoint
       );
       auto root_isolate = weak_isolate.lock();
       ASSERT_TRUE(root_isolate);
    @@ -148,11 +153,12 @@ static void RunDartCodeInIsolate(std::unique_ptr& result,
                                      fml::RefPtr task_runner,
                                      std::string entrypoint) {
       FML_CHECK(task_runner->RunsTasksOnCurrentThread());
    -  auto vm = DartVM::ForProcess(settings);
    +  auto vm_ref = DartVMRef::Create(settings);
     
    -  if (!vm) {
    +  if (!vm_ref) {
         return;
       }
    +
       TaskRunners task_runners(CURRENT_TEST_NAME,  //
                                task_runner,        //
                                task_runner,        //
    @@ -160,16 +166,22 @@ static void RunDartCodeInIsolate(std::unique_ptr& result,
                                task_runner         //
       );
     
    +  auto vm_data = vm_ref.GetVMData();
    +
    +  if (!vm_data) {
    +    return;
    +  }
    +
       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
    -      {},                        // io manager
    -      "main.dart",               // advisory uri
    -      "main"                     // advisory entrypoint
    +      vm_data->GetSettings(),         // settings
    +      vm_data->GetIsolateSnapshot(),  // isolate snapshot
    +      vm_data->GetSharedSnapshot(),   // shared snapshot
    +      std::move(task_runners),        // task runners
    +      nullptr,                        // window
    +      {},                             // snapshot delegate
    +      {},                             // io manager
    +      "main.dart",                    // advisory uri
    +      "main"                          // advisory entrypoint
       );
     
       auto root_isolate =
    diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc
    index 4c6054f7be25f..110f7c2b27809 100644
    --- a/runtime/dart_vm.cc
    +++ b/runtime/dart_vm.cc
    @@ -15,6 +15,7 @@
     #include "flutter/fml/file.h"
     #include "flutter/fml/logging.h"
     #include "flutter/fml/mapping.h"
    +#include "flutter/fml/synchronization/thread_annotations.h"
     #include "flutter/fml/time/time_delta.h"
     #include "flutter/fml/trace_event.h"
     #include "flutter/lib/io/dart_io.h"
    @@ -219,66 +220,48 @@ static void EmbedderInformationCallback(Dart_EmbedderInformation* info) {
       info->name = "Flutter";
     }
     
    -fml::RefPtr DartVM::ForProcess(Settings settings) {
    -  return ForProcess(settings, nullptr, nullptr, nullptr);
    -}
    -
    -static std::once_flag gVMInitialization;
    -static std::mutex gVMMutex;
    -static fml::RefPtr gVM;
    -
    -fml::RefPtr DartVM::ForProcess(
    +std::shared_ptr DartVM::Create(
         Settings settings,
         fml::RefPtr vm_snapshot,
         fml::RefPtr isolate_snapshot,
    -    fml::RefPtr shared_snapshot) {
    -  std::lock_guard lock(gVMMutex);
    -  std::call_once(gVMInitialization, [settings,          //
    -                                     vm_snapshot,       //
    -                                     isolate_snapshot,  //
    -                                     shared_snapshot    //
    -  ]() mutable {
    -    if (!vm_snapshot) {
    -      vm_snapshot = DartSnapshot::VMSnapshotFromSettings(settings);
    -    }
    -    if (!(vm_snapshot && vm_snapshot->IsValid())) {
    -      FML_LOG(ERROR) << "VM snapshot must be valid.";
    -      return;
    -    }
    -    if (!isolate_snapshot) {
    -      isolate_snapshot = DartSnapshot::IsolateSnapshotFromSettings(settings);
    -    }
    -    if (!(isolate_snapshot && isolate_snapshot->IsValid())) {
    -      FML_LOG(ERROR) << "Isolate snapshot must be valid.";
    -      return;
    -    }
    -    if (!shared_snapshot) {
    -      shared_snapshot = DartSnapshot::Empty();
    -    }
    -    gVM = fml::MakeRefCounted(settings,                     //
    -                                      std::move(vm_snapshot),       //
    -                                      std::move(isolate_snapshot),  //
    -                                      std::move(shared_snapshot)    //
    -    );
    -  });
    -  return gVM;
    +    fml::RefPtr shared_snapshot,
    +    std::shared_ptr isolate_name_server) {
    +  auto vm_data = DartVMData::Create(settings,                     //
    +                                    std::move(vm_snapshot),       //
    +                                    std::move(isolate_snapshot),  //
    +                                    std::move(shared_snapshot)    //
    +  );
    +
    +  if (!vm_data) {
    +    FML_LOG(ERROR) << "Could not setup VM data to bootstrap the VM from.";
    +    return {};
    +  }
    +
    +  // Note: std::make_shared unviable due to hidden constructor.
    +  return std::shared_ptr(
    +      new DartVM(std::move(vm_data), std::move(isolate_name_server)));
     }
     
    -fml::RefPtr DartVM::ForProcessIfInitialized() {
    -  std::lock_guard lock(gVMMutex);
    -  return gVM;
    +static std::atomic_size_t gVMLaunchCount;
    +
    +size_t DartVM::GetVMLaunchCount() {
    +  return gVMLaunchCount;
     }
     
    -DartVM::DartVM(const Settings& settings,
    -               fml::RefPtr vm_snapshot,
    -               fml::RefPtr isolate_snapshot,
    -               fml::RefPtr shared_snapshot)
    -    : settings_(settings),
    -      vm_snapshot_(std::move(vm_snapshot)),
    -      isolate_snapshot_(std::move(isolate_snapshot)),
    -      shared_snapshot_(std::move(shared_snapshot)),
    -      weak_factory_(this) {
    +DartVM::DartVM(std::shared_ptr vm_data,
    +               std::shared_ptr isolate_name_server)
    +    : settings_(vm_data->GetSettings()),
    +      vm_data_(vm_data),
    +      isolate_name_server_(std::move(isolate_name_server)),
    +      service_protocol_(std::make_shared()) {
       TRACE_EVENT0("flutter", "DartVMInitializer");
    +
    +  gVMLaunchCount++;
    +
    +  FML_DCHECK(vm_data_);
    +  FML_DCHECK(isolate_name_server_);
    +  FML_DCHECK(service_protocol_);
    +
       FML_DLOG(INFO) << "Attempting Dart VM launch for mode: "
                      << (IsRunningPrecompiledCode() ? "AOT" : "Interpreter");
     
    @@ -286,8 +269,8 @@ DartVM::DartVM(const Settings& settings,
         TRACE_EVENT0("flutter", "dart::bin::BootstrapDartIo");
         dart::bin::BootstrapDartIo();
     
    -    if (!settings.temp_directory_path.empty()) {
    -      dart::bin::SetSystemTempDirectory(settings.temp_directory_path.c_str());
    +    if (!settings_.temp_directory_path.empty()) {
    +      dart::bin::SetSystemTempDirectory(settings_.temp_directory_path.c_str());
         }
       }
     
    @@ -300,7 +283,7 @@ DartVM::DartVM(const Settings& settings,
       args.push_back("--ignore-unrecognized-flags");
     
       for (auto* const profiler_flag :
    -       ProfilingFlags(settings.enable_dart_profiling)) {
    +       ProfilingFlags(settings_.enable_dart_profiling)) {
         args.push_back(profiler_flag);
       }
     
    @@ -313,7 +296,7 @@ DartVM::DartVM(const Settings& settings,
     
       // Enable Dart assertions if we are not running precompiled code. We run non-
       // precompiled code only in the debug product mode.
    -  bool enable_asserts = !settings.disable_dart_asserts;
    +  bool enable_asserts = !settings_.disable_dart_asserts;
     
     #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_PROFILE || \
         FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE
    @@ -337,24 +320,24 @@ DartVM::DartVM(const Settings& settings,
         PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs));
       }
     
    -  if (settings.start_paused) {
    +  if (settings_.start_paused) {
         PushBackAll(&args, kDartStartPausedArgs, arraysize(kDartStartPausedArgs));
       }
     
    -  if (settings.endless_trace_buffer || settings.trace_startup) {
    +  if (settings_.endless_trace_buffer || settings_.trace_startup) {
         // If we are tracing startup, make sure the trace buffer is endless so we
         // don't lose early traces.
         PushBackAll(&args, kDartEndlessTraceBufferArgs,
                     arraysize(kDartEndlessTraceBufferArgs));
       }
     
    -  if (settings.trace_systrace) {
    +  if (settings_.trace_systrace) {
         PushBackAll(&args, kDartSystraceTraceBufferArgs,
                     arraysize(kDartSystraceTraceBufferArgs));
         PushBackAll(&args, kDartTraceStreamsArgs, arraysize(kDartTraceStreamsArgs));
       }
     
    -  if (settings.trace_startup) {
    +  if (settings_.trace_startup) {
         PushBackAll(&args, kDartTraceStartupArgs, arraysize(kDartTraceStartupArgs));
       }
     
    @@ -363,8 +346,8 @@ DartVM::DartVM(const Settings& settings,
       PushBackAll(&args, kDartTraceStreamsArgs, arraysize(kDartTraceStreamsArgs));
     #endif
     
    -  for (size_t i = 0; i < settings.dart_flags.size(); i++)
    -    args.push_back(settings.dart_flags[i].c_str());
    +  for (size_t i = 0; i < settings_.dart_flags.size(); i++)
    +    args.push_back(settings_.dart_flags[i].c_str());
     
       char* flags_error = Dart_SetVMFlags(args.size(), args.data());
       if (flags_error) {
    @@ -374,14 +357,14 @@ DartVM::DartVM(const Settings& settings,
     
       DartUI::InitForGlobal();
     
    -  Dart_SetFileModifiedCallback(&DartFileModifiedCallback);
    -
       {
         TRACE_EVENT0("flutter", "Dart_Initialize");
         Dart_InitializeParams params = {};
         params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION;
    -    params.vm_snapshot_data = vm_snapshot_->GetData()->GetSnapshotPointer();
    -    params.vm_snapshot_instructions = vm_snapshot_->GetInstructionsIfPresent();
    +    params.vm_snapshot_data =
    +        vm_data_->GetVMSnapshot().GetData()->GetSnapshotPointer();
    +    params.vm_snapshot_instructions =
    +        vm_data_->GetVMSnapshot().GetInstructionsIfPresent();
         params.create = reinterpret_cast(
             DartIsolate::DartIsolateCreateCallback);
         params.shutdown = reinterpret_cast(
    @@ -413,59 +396,58 @@ DartVM::DartVM(const Settings& settings,
         }
       }
     
    +  Dart_SetFileModifiedCallback(&DartFileModifiedCallback);
    +
       // Allow streaming of stdout and stderr by the Dart vm.
       Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback,
                                      &ServiceStreamCancelCallback);
     
       Dart_SetEmbedderInformationCallback(&EmbedderInformationCallback);
     
    -  if (settings.dart_library_sources_kernel != nullptr) {
    +  if (settings_.dart_library_sources_kernel != nullptr) {
         std::unique_ptr dart_library_sources =
    -        settings.dart_library_sources_kernel();
    +        settings_.dart_library_sources_kernel();
         // Set sources for dart:* libraries for debugging.
         Dart_SetDartLibrarySourcesKernel(dart_library_sources->GetMapping(),
                                          dart_library_sources->GetSize());
       }
    +
    +  FML_DLOG(INFO) << "New Dart VM instance created. Instance count: "
    +                 << gVMLaunchCount;
     }
     
     DartVM::~DartVM() {
       if (Dart_CurrentIsolate() != nullptr) {
         Dart_ExitIsolate();
       }
    +
       char* result = Dart_Cleanup();
    -  if (result != nullptr) {
    -    FML_LOG(ERROR) << "Could not cleanly shut down the Dart VM. Message: \""
    -                   << result << "\".";
    -    free(result);
    -  }
    -}
     
    -const Settings& DartVM::GetSettings() const {
    -  return settings_;
    -}
    +  dart::bin::CleanupDartIo();
     
    -const DartSnapshot& DartVM::GetVMSnapshot() const {
    -  return *vm_snapshot_.get();
    -}
    +  FML_CHECK(result == nullptr)
    +      << "Could not cleanly shut down the Dart VM. Error: \"" << result
    +      << "\".";
    +  free(result);
     
    -IsolateNameServer* DartVM::GetIsolateNameServer() {
    -  return &isolate_name_server_;
    +  FML_DLOG(INFO) << "Dart VM instance destroyed. Instance count: "
    +                 << gVMLaunchCount;
     }
     
    -fml::RefPtr DartVM::GetIsolateSnapshot() const {
    -  return isolate_snapshot_;
    +std::shared_ptr DartVM::GetVMData() const {
    +  return vm_data_;
     }
     
    -fml::RefPtr DartVM::GetSharedSnapshot() const {
    -  return shared_snapshot_;
    +const Settings& DartVM::GetSettings() const {
    +  return settings_;
     }
     
    -ServiceProtocol& DartVM::GetServiceProtocol() {
    +std::shared_ptr DartVM::GetServiceProtocol() const {
       return service_protocol_;
     }
     
    -fml::WeakPtr DartVM::GetWeakPtr() {
    -  return weak_factory_.GetWeakPtr();
    +std::shared_ptr DartVM::GetIsolateNameServer() const {
    +  return isolate_name_server_;
     }
     
     }  // namespace blink
    diff --git a/runtime/dart_vm.h b/runtime/dart_vm.h
    index 2c3ac0e30381e..6724abde0b828 100644
    --- a/runtime/dart_vm.h
    +++ b/runtime/dart_vm.h
    @@ -5,9 +5,8 @@
     #ifndef FLUTTER_RUNTIME_DART_VM_H_
     #define FLUTTER_RUNTIME_DART_VM_H_
     
    -#include 
    +#include 
     #include 
    -#include 
     
     #include "flutter/common/settings.h"
     #include "flutter/fml/build_config.h"
    @@ -19,57 +18,46 @@
     #include "flutter/lib/ui/isolate_name_server/isolate_name_server.h"
     #include "flutter/runtime/dart_isolate.h"
     #include "flutter/runtime/dart_snapshot.h"
    +#include "flutter/runtime/dart_vm_data.h"
     #include "flutter/runtime/service_protocol.h"
     #include "third_party/dart/runtime/include/dart_api.h"
     
     namespace blink {
     
    -class DartVM : public fml::RefCountedThreadSafe {
    +class DartVM {
      public:
    -  static fml::RefPtr ForProcess(Settings settings);
    -
    -  static fml::RefPtr ForProcess(
    -      Settings settings,
    -      fml::RefPtr vm_snapshot,
    -      fml::RefPtr isolate_snapshot,
    -      fml::RefPtr shared_snapshot);
    -
    -  static fml::RefPtr ForProcessIfInitialized();
    +  ~DartVM();
     
       static bool IsRunningPrecompiledCode();
     
    -  const Settings& GetSettings() const;
    -
    -  const DartSnapshot& GetVMSnapshot() const;
    +  static size_t GetVMLaunchCount();
     
    -  IsolateNameServer* GetIsolateNameServer();
    -
    -  fml::RefPtr GetIsolateSnapshot() const;
    +  const Settings& GetSettings() const;
     
    -  fml::RefPtr GetSharedSnapshot() const;
    +  std::shared_ptr GetVMData() const;
     
    -  fml::WeakPtr GetWeakPtr();
    +  std::shared_ptr GetServiceProtocol() const;
     
    -  ServiceProtocol& GetServiceProtocol();
    +  std::shared_ptr GetIsolateNameServer() const;
     
      private:
       const Settings settings_;
    -  const fml::RefPtr vm_snapshot_;
    -  IsolateNameServer isolate_name_server_;
    -  const fml::RefPtr isolate_snapshot_;
    -  const fml::RefPtr shared_snapshot_;
    -  ServiceProtocol service_protocol_;
    -  fml::WeakPtrFactory weak_factory_;
    -
    -  DartVM(const Settings& settings,
    -         fml::RefPtr vm_snapshot,
    -         fml::RefPtr isolate_snapshot,
    -         fml::RefPtr shared_snapshot);
    +  std::shared_ptr vm_data_;
    +  const std::shared_ptr isolate_name_server_;
    +  const std::shared_ptr service_protocol_;
     
    -  ~DartVM();
    +  friend class DartVMRef;
    +
    +  static std::shared_ptr Create(
    +      Settings settings,
    +      fml::RefPtr vm_snapshot,
    +      fml::RefPtr isolate_snapshot,
    +      fml::RefPtr shared_snapshot,
    +      std::shared_ptr isolate_name_server);
    +
    +  DartVM(std::shared_ptr data,
    +         std::shared_ptr isolate_name_server);
     
    -  FML_FRIEND_REF_COUNTED_THREAD_SAFE(DartVM);
    -  FML_FRIEND_MAKE_REF_COUNTED(DartVM);
       FML_DISALLOW_COPY_AND_ASSIGN(DartVM);
     };
     
    diff --git a/runtime/dart_vm_data.cc b/runtime/dart_vm_data.cc
    new file mode 100644
    index 0000000000000..a29074f79c92e
    --- /dev/null
    +++ b/runtime/dart_vm_data.cc
    @@ -0,0 +1,79 @@
    +// Copyright 2013 The Flutter 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_vm_data.h"
    +
    +namespace blink {
    +
    +std::shared_ptr DartVMData::Create(
    +    Settings settings,
    +    fml::RefPtr vm_snapshot,
    +    fml::RefPtr isolate_snapshot,
    +    fml::RefPtr shared_snapshot) {
    +  if (!vm_snapshot || !vm_snapshot->IsValid()) {
    +    // Caller did not provide a valid VM snapshot. Attempt to infer one
    +    // from the settings.
    +    vm_snapshot = DartSnapshot::VMSnapshotFromSettings(settings);
    +    if (!vm_snapshot) {
    +      FML_LOG(ERROR)
    +          << "VM snapshot invalid and could not be inferred from settings.";
    +      return {};
    +    }
    +  }
    +
    +  if (!isolate_snapshot || !isolate_snapshot->IsValid()) {
    +    // Caller did not provide a valid isolate snapshot. Attempt to infer one
    +    // from the settings.
    +    isolate_snapshot = DartSnapshot::IsolateSnapshotFromSettings(settings);
    +    if (!isolate_snapshot) {
    +      FML_LOG(ERROR) << "Isolate snapshot invalid and could not be inferred "
    +                        "from settings.";
    +      return {};
    +    }
    +  }
    +
    +  if (!shared_snapshot || !shared_snapshot->IsValid()) {
    +    shared_snapshot = DartSnapshot::Empty();
    +    if (!shared_snapshot) {
    +      FML_LOG(ERROR) << "Shared snapshot invalid.";
    +      return {};
    +    }
    +  }
    +
    +  return std::shared_ptr(new DartVMData(
    +      std::move(settings),          //
    +      std::move(vm_snapshot),       //
    +      std::move(isolate_snapshot),  //
    +      std::move(shared_snapshot)    //
    +      ));
    +}
    +
    +DartVMData::DartVMData(Settings settings,
    +                       fml::RefPtr vm_snapshot,
    +                       fml::RefPtr isolate_snapshot,
    +                       fml::RefPtr shared_snapshot)
    +    : settings_(settings),
    +      vm_snapshot_(vm_snapshot),
    +      isolate_snapshot_(isolate_snapshot),
    +      shared_snapshot_(shared_snapshot) {}
    +
    +DartVMData::~DartVMData() = default;
    +
    +const Settings& DartVMData::GetSettings() const {
    +  return settings_;
    +}
    +
    +const DartSnapshot& DartVMData::GetVMSnapshot() const {
    +  return *vm_snapshot_;
    +}
    +
    +fml::RefPtr DartVMData::GetIsolateSnapshot() const {
    +  return isolate_snapshot_;
    +}
    +
    +fml::RefPtr DartVMData::GetSharedSnapshot() const {
    +  return shared_snapshot_;
    +}
    +
    +}  // namespace blink
    diff --git a/runtime/dart_vm_data.h b/runtime/dart_vm_data.h
    new file mode 100644
    index 0000000000000..906cad1a4ca05
    --- /dev/null
    +++ b/runtime/dart_vm_data.h
    @@ -0,0 +1,47 @@
    +// Copyright 2013 The Flutter 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_VM_DATA_H_
    +#define FLUTTER_RUNTIME_DART_VM_DATA_H_
    +
    +#include "flutter/fml/macros.h"
    +#include "flutter/runtime/dart_snapshot.h"
    +
    +namespace blink {
    +
    +class DartVMData {
    + public:
    +  static std::shared_ptr Create(
    +      Settings settings,
    +      fml::RefPtr vm_snapshot,
    +      fml::RefPtr isolate_snapshot,
    +      fml::RefPtr shared_snapshot);
    +
    +  ~DartVMData();
    +
    +  const Settings& GetSettings() const;
    +
    +  const DartSnapshot& GetVMSnapshot() const;
    +
    +  fml::RefPtr GetIsolateSnapshot() const;
    +
    +  fml::RefPtr GetSharedSnapshot() const;
    +
    + private:
    +  const Settings settings_;
    +  const fml::RefPtr vm_snapshot_;
    +  const fml::RefPtr isolate_snapshot_;
    +  const fml::RefPtr shared_snapshot_;
    +
    +  DartVMData(Settings settings,
    +             fml::RefPtr vm_snapshot,
    +             fml::RefPtr isolate_snapshot,
    +             fml::RefPtr shared_snapshot);
    +
    +  FML_DISALLOW_COPY_AND_ASSIGN(DartVMData);
    +};
    +
    +}  // namespace blink
    +
    +#endif  // FLUTTER_RUNTIME_DART_VM_DATA_H_
    diff --git a/runtime/dart_vm_lifecycle.cc b/runtime/dart_vm_lifecycle.cc
    new file mode 100644
    index 0000000000000..1ed86e0250c4b
    --- /dev/null
    +++ b/runtime/dart_vm_lifecycle.cc
    @@ -0,0 +1,117 @@
    +// Copyright 2013 The Flutter 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_vm_lifecycle.h"
    +
    +#include 
    +
    +namespace blink {
    +
    +// We need to explicitly put the constructor and destructor of the DartVM in the
    +// critical section. All accesses (not just const members) to the global VM
    +// object weak pointer are behind this mutex.
    +static std::mutex gVMMutex;
    +static std::weak_ptr gVM FML_GUARDED_BY(gVMMutex);
    +static std::shared_ptr gVMLeak FML_GUARDED_BY(gVMMutex);
    +
    +// We are going to be modifying more than just the control blocks of the
    +// following weak pointers (in the |Create| case where an old VM could not be
    +// reused). Ideally, we would use |std::atomic>| specialization
    +// but that is only available since C++20. We don't expect contention on these
    +// locks so we just use one mutex for all.
    +static std::mutex gVMDependentsMutex;
    +static std::weak_ptr gVMData
    +    FML_GUARDED_BY(gVMDependentsMutex);
    +static std::weak_ptr gVMServiceProtocol
    +    FML_GUARDED_BY(gVMDependentsMutex);
    +static std::weak_ptr gVMIsolateNameServer
    +    FML_GUARDED_BY(gVMDependentsMutex);
    +
    +DartVMRef::DartVMRef(std::shared_ptr vm) : vm_(vm) {}
    +
    +DartVMRef::DartVMRef(DartVMRef&& other) = default;
    +
    +DartVMRef::~DartVMRef() {
    +  if (!vm_) {
    +    // If there is no valid VM (possible via a move), there is no way that the
    +    // decrement on the shared pointer can cause a collection. Avoid acquiring
    +    // the lifecycle lock in this case. This is just working around a
    +    // pessimization and not required for correctness.
    +    return;
    +  }
    +  std::lock_guard lifecycle_lock(gVMMutex);
    +  vm_.reset();
    +}
    +
    +DartVMRef DartVMRef::Create(Settings settings,
    +                            fml::RefPtr vm_snapshot,
    +                            fml::RefPtr isolate_snapshot,
    +                            fml::RefPtr shared_snapshot) {
    +  std::lock_guard lifecycle_lock(gVMMutex);
    +
    +  // If there is already a running VM in the process, grab a strong reference to
    +  // it.
    +  if (auto vm = gVM.lock()) {
    +    FML_DLOG(WARNING) << "Attempted to create a VM in a process where one was "
    +                         "already running. Ignoring arguments for current VM "
    +                         "create call and reusing the old VM.";
    +    // There was already a running VM in the process,
    +    return DartVMRef{std::move(vm)};
    +  }
    +
    +  std::lock_guard dependents_lock(gVMDependentsMutex);
    +
    +  gVMData.reset();
    +  gVMServiceProtocol.reset();
    +  gVMIsolateNameServer.reset();
    +  gVM.reset();
    +
    +  // If there is no VM in the process. Initialize one, hold the weak reference
    +  // and pass a strong reference to the caller.
    +  auto isolate_name_server = std::make_shared();
    +  auto vm = DartVM::Create(std::move(settings),          //
    +                           std::move(vm_snapshot),       //
    +                           std::move(isolate_snapshot),  //
    +                           std::move(shared_snapshot),   //
    +                           isolate_name_server           //
    +  );
    +
    +  if (!vm) {
    +    FML_LOG(ERROR) << "Could not create Dart VM instance.";
    +    return {nullptr};
    +  }
    +
    +  gVMData = vm->GetVMData();
    +  gVMServiceProtocol = vm->GetServiceProtocol();
    +  gVMIsolateNameServer = isolate_name_server;
    +  gVM = vm;
    +
    +  if (settings.leak_vm) {
    +    gVMLeak = vm;
    +  }
    +
    +  return DartVMRef{std::move(vm)};
    +}
    +
    +bool DartVMRef::IsInstanceRunning() {
    +  std::lock_guard lock(gVMMutex);
    +  return !gVM.expired();
    +}
    +
    +std::shared_ptr DartVMRef::GetVMData() {
    +  std::lock_guard lock(gVMDependentsMutex);
    +  return gVMData.lock();
    +}
    +
    +std::shared_ptr DartVMRef::GetServiceProtocol() {
    +  std::lock_guard lock(gVMDependentsMutex);
    +  return gVMServiceProtocol.lock();
    +}
    +
    +std::shared_ptr DartVMRef::GetIsolateNameServer() {
    +  std::lock_guard lock(gVMDependentsMutex);
    +  return gVMIsolateNameServer.lock();
    +}
    +
    +}  // namespace blink
    diff --git a/runtime/dart_vm_lifecycle.h b/runtime/dart_vm_lifecycle.h
    new file mode 100644
    index 0000000000000..cfe1f1b646469
    --- /dev/null
    +++ b/runtime/dart_vm_lifecycle.h
    @@ -0,0 +1,72 @@
    +// Copyright 2013 The Flutter 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_VM_LIFECYCLE_H_
    +#define FLUTTER_RUNTIME_DART_VM_LIFECYCLE_H_
    +
    +#include 
    +
    +#include "flutter/fml/macros.h"
    +#include "flutter/lib/ui/isolate_name_server/isolate_name_server.h"
    +#include "flutter/runtime/dart_vm.h"
    +#include "flutter/runtime/service_protocol.h"
    +
    +namespace blink {
    +
    +// A strong reference to the Dart VM. There can only be one VM running in the
    +// process at any given time. A reference to the VM may only be obtained via the
    +// |Create| method. In case there is already a running instance of the VM in the
    +// process, a strong reference to that VM is obtained and the arguments to the
    +// |Create| call ignored. If there is no VM already running in the process, a VM
    +// is initialized in a thread safe manner and returned to the caller. The VM
    +// will shutdown only when all callers relinquish their references (by
    +// collecting their instances of this class).
    +//
    +// DartVMRef instances may be created on any thread.
    +class DartVMRef {
    + public:
    +  FML_WARN_UNUSED_RESULT
    +  static DartVMRef Create(Settings settings,
    +                          fml::RefPtr vm_snapshot = nullptr,
    +                          fml::RefPtr isolate_snapshot = nullptr,
    +                          fml::RefPtr shared_snapshot = nullptr);
    +
    +  DartVMRef(DartVMRef&&);
    +
    +  ~DartVMRef();
    +
    +  // This is an inherently racy way to check if a VM instance is running and
    +  // should not be used outside of unit-tests where there is a known threading
    +  // model.
    +  static bool IsInstanceRunning();
    +
    +  static std::shared_ptr GetVMData();
    +
    +  static std::shared_ptr GetServiceProtocol();
    +
    +  static std::shared_ptr GetIsolateNameServer();
    +
    +  operator bool() const { return static_cast(vm_); }
    +
    +  DartVM* operator->() {
    +    FML_DCHECK(vm_);
    +    return vm_.get();
    +  }
    +
    +  DartVM* operator&() {
    +    FML_DCHECK(vm_);
    +    return vm_.get();
    +  }
    +
    + private:
    +  std::shared_ptr vm_;
    +
    +  DartVMRef(std::shared_ptr vm);
    +
    +  FML_DISALLOW_COPY_AND_ASSIGN(DartVMRef);
    +};
    +
    +}  // namespace blink
    +
    +#endif  // FLUTTER_RUNTIME_DART_VM_LIFECYCLE_H_
    diff --git a/runtime/dart_vm_unittests.cc b/runtime/dart_vm_unittests.cc
    index a0cfdfbbc5f71..2c143432b5b74 100644
    --- a/runtime/dart_vm_unittests.cc
    +++ b/runtime/dart_vm_unittests.cc
    @@ -3,6 +3,7 @@
     // found in the LICENSE file.
     
     #include "flutter/runtime/dart_vm.h"
    +#include "flutter/runtime/dart_vm_lifecycle.h"
     #include "gtest/gtest.h"
     
     namespace blink {
    @@ -11,16 +12,17 @@ TEST(DartVM, SimpleInitialization) {
       Settings settings = {};
       settings.task_observer_add = [](intptr_t, fml::closure) {};
       settings.task_observer_remove = [](intptr_t) {};
    -  auto vm = DartVM::ForProcess(settings);
    +  auto vm = DartVMRef::Create(settings);
       ASSERT_TRUE(vm);
    -  ASSERT_EQ(vm, DartVM::ForProcess(settings));
     }
     
     TEST(DartVM, SimpleIsolateNameServer) {
       Settings settings = {};
       settings.task_observer_add = [](intptr_t, fml::closure) {};
       settings.task_observer_remove = [](intptr_t) {};
    -  auto vm = DartVM::ForProcess(settings);
    +  auto vm = DartVMRef::Create(settings);
    +  ASSERT_TRUE(vm);
    +  ASSERT_TRUE(vm.GetVMData());
       auto ns = vm->GetIsolateNameServer();
       ASSERT_EQ(ns->LookupIsolatePortByName("foobar"), ILLEGAL_PORT);
       ASSERT_FALSE(ns->RemoveIsolateNameMapping("foobar"));
    diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc
    index 83a848e87955c..e1aaf51de829f 100644
    --- a/runtime/runtime_controller.cc
    +++ b/runtime/runtime_controller.cc
    @@ -17,8 +17,8 @@ namespace blink {
     RuntimeController::RuntimeController(
         RuntimeDelegate& p_client,
         DartVM* p_vm,
    -    fml::RefPtr p_isolate_snapshot,
    -    fml::RefPtr p_shared_snapshot,
    +    fml::RefPtr p_isolate_snapshot,
    +    fml::RefPtr p_shared_snapshot,
         TaskRunners p_task_runners,
         fml::WeakPtr p_snapshot_delegate,
         fml::WeakPtr p_io_manager,
    @@ -40,8 +40,8 @@ RuntimeController::RuntimeController(
     RuntimeController::RuntimeController(
         RuntimeDelegate& p_client,
         DartVM* p_vm,
    -    fml::RefPtr p_isolate_snapshot,
    -    fml::RefPtr p_shared_snapshot,
    +    fml::RefPtr p_isolate_snapshot,
    +    fml::RefPtr p_shared_snapshot,
         TaskRunners p_task_runners,
         fml::WeakPtr p_snapshot_delegate,
         fml::WeakPtr p_io_manager,
    @@ -61,7 +61,7 @@ RuntimeController::RuntimeController(
           idle_notification_callback_(idle_notification_callback),
           window_data_(std::move(p_window_data)),
           root_isolate_(
    -          DartIsolate::CreateRootIsolate(vm_,
    +          DartIsolate::CreateRootIsolate(vm_->GetVMData()->GetSettings(),
                                              isolate_snapshot_,
                                              shared_snapshot_,
                                              task_runners_,
    diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h
    index 03f1389d8c613..79d020ed38375 100644
    --- a/runtime/runtime_controller.h
    +++ b/runtime/runtime_controller.h
    @@ -30,8 +30,8 @@ class RuntimeController final : public WindowClient {
      public:
       RuntimeController(RuntimeDelegate& client,
                         DartVM* vm,
    -                    fml::RefPtr isolate_snapshot,
    -                    fml::RefPtr shared_snapshot,
    +                    fml::RefPtr isolate_snapshot,
    +                    fml::RefPtr shared_snapshot,
                         TaskRunners task_runners,
                         fml::WeakPtr snapshot_delegate,
                         fml::WeakPtr io_manager,
    @@ -121,8 +121,8 @@ class RuntimeController final : public WindowClient {
     
       RuntimeDelegate& client_;
       DartVM* const vm_;
    -  fml::RefPtr isolate_snapshot_;
    -  fml::RefPtr shared_snapshot_;
    +  fml::RefPtr isolate_snapshot_;
    +  fml::RefPtr shared_snapshot_;
       TaskRunners task_runners_;
       fml::WeakPtr snapshot_delegate_;
       fml::WeakPtr io_manager_;
    @@ -135,8 +135,8 @@ class RuntimeController final : public WindowClient {
     
       RuntimeController(RuntimeDelegate& client,
                         DartVM* vm,
    -                    fml::RefPtr isolate_snapshot,
    -                    fml::RefPtr shared_snapshot,
    +                    fml::RefPtr isolate_snapshot,
    +                    fml::RefPtr shared_snapshot,
                         TaskRunners task_runners,
                         fml::WeakPtr snapshot_delegate,
                         fml::WeakPtr io_manager,
    diff --git a/shell/common/engine.cc b/shell/common/engine.cc
    index 5b2d5a5c3dd37..f1c215570df2f 100644
    --- a/shell/common/engine.cc
    +++ b/shell/common/engine.cc
    @@ -37,8 +37,8 @@ static constexpr char kSettingsChannel[] = "flutter/settings";
     
     Engine::Engine(Delegate& delegate,
                    blink::DartVM& vm,
    -               fml::RefPtr isolate_snapshot,
    -               fml::RefPtr shared_snapshot,
    +               fml::RefPtr isolate_snapshot,
    +               fml::RefPtr shared_snapshot,
                    blink::TaskRunners task_runners,
                    blink::Settings settings,
                    std::unique_ptr animator,
    diff --git a/shell/common/engine.h b/shell/common/engine.h
    index b390b36a2b197..22160cb7ee3c9 100644
    --- a/shell/common/engine.h
    +++ b/shell/common/engine.h
    @@ -56,8 +56,8 @@ class Engine final : public blink::RuntimeDelegate {
     
       Engine(Delegate& delegate,
              blink::DartVM& vm,
    -         fml::RefPtr isolate_snapshot,
    -         fml::RefPtr shared_snapshot,
    +         fml::RefPtr isolate_snapshot,
    +         fml::RefPtr shared_snapshot,
              blink::TaskRunners task_runners,
              blink::Settings settings,
              std::unique_ptr animator,
    diff --git a/shell/common/shell.cc b/shell/common/shell.cc
    index 4d2dcc0d137a6..3c824ae8e0c02 100644
    --- a/shell/common/shell.cc
    +++ b/shell/common/shell.cc
    @@ -36,17 +36,20 @@ namespace shell {
     constexpr char kSkiaChannel[] = "flutter/skia";
     
     std::unique_ptr Shell::CreateShellOnPlatformThread(
    +    blink::DartVMRef vm,
         blink::TaskRunners task_runners,
         blink::Settings settings,
    -    fml::RefPtr isolate_snapshot,
    -    fml::RefPtr shared_snapshot,
    +    fml::RefPtr isolate_snapshot,
    +    fml::RefPtr shared_snapshot,
         Shell::CreateCallback on_create_platform_view,
         Shell::CreateCallback on_create_rasterizer) {
       if (!task_runners.IsValid()) {
    +    FML_LOG(ERROR) << "Task runners to run the shell were invalid.";
         return nullptr;
       }
     
    -  auto shell = std::unique_ptr(new Shell(task_runners, settings));
    +  auto shell =
    +      std::unique_ptr(new Shell(std::move(vm), task_runners, settings));
     
       // Create the platform view on the platform thread (this thread).
       auto platform_view = on_create_platform_view(*shell.get());
    @@ -75,6 +78,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread(
            &platform_view,  //
            io_task_runner   //
       ]() {
    +        TRACE_EVENT0("flutter", "ShellSetupIOSubsystem");
             io_manager = std::make_unique(
                 platform_view->CreateResourceContext(), io_task_runner);
             io_latch.Signal();
    @@ -92,6 +96,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread(
                                             shell = shell.get(),   //
                                             &snapshot_delegate     //
       ]() {
    +        TRACE_EVENT0("flutter", "ShellSetupGPUSubsystem");
             if (auto new_rasterizer = on_create_rasterizer(*shell)) {
               rasterizer = std::move(new_rasterizer);
               snapshot_delegate = rasterizer->GetSnapshotDelegate();
    @@ -115,6 +120,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread(
                              snapshot_delegate = std::move(snapshot_delegate),  //
                              io_manager = io_manager->GetWeakPtr()              //
       ]() mutable {
    +        TRACE_EVENT0("flutter", "ShellSetupUISubsystem");
             const auto& task_runners = shell->GetTaskRunners();
     
             // The animator is owned by the UI thread but it gets its vsync pulses
    @@ -123,7 +129,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread(
                                                        std::move(vsync_waiter));
     
             engine = std::make_unique(*shell,                        //
    -                                          shell->GetDartVM(),            //
    +                                          *shell->GetDartVM(),           //
                                               std::move(isolate_snapshot),   //
                                               std::move(shared_snapshot),    //
                                               task_runners,                  //
    @@ -206,26 +212,35 @@ std::unique_ptr Shell::Create(
         Shell::CreateCallback on_create_rasterizer) {
       PerformInitializationTasks(settings);
     
    -  auto vm = blink::DartVM::ForProcess(settings);
    +  TRACE_EVENT0("flutter", "Shell::Create");
    +
    +  auto vm = blink::DartVMRef::Create(settings);
       FML_CHECK(vm) << "Must be able to initialize the VM.";
    +
    +  auto vm_data = vm->GetVMData();
    +
       return Shell::Create(std::move(task_runners),             //
                            std::move(settings),                 //
    -                       vm->GetIsolateSnapshot(),            //
    -                       blink::DartSnapshot::Empty(),        //
    +                       vm_data->GetIsolateSnapshot(),       // isolate snapshot
    +                       blink::DartSnapshot::Empty(),        // shared snapshot
                            std::move(on_create_platform_view),  //
    -                       std::move(on_create_rasterizer)      //
    +                       std::move(on_create_rasterizer),     //
    +                       std::move(vm)                        //
       );
     }
     
     std::unique_ptr Shell::Create(
         blink::TaskRunners task_runners,
         blink::Settings settings,
    -    fml::RefPtr isolate_snapshot,
    -    fml::RefPtr shared_snapshot,
    +    fml::RefPtr isolate_snapshot,
    +    fml::RefPtr shared_snapshot,
         Shell::CreateCallback on_create_platform_view,
    -    Shell::CreateCallback on_create_rasterizer) {
    +    Shell::CreateCallback on_create_rasterizer,
    +    blink::DartVMRef vm) {
       PerformInitializationTasks(settings);
     
    +  TRACE_EVENT0("flutter", "Shell::CreateWithSnapshots");
    +
       if (!task_runners.IsValid() || !on_create_platform_view ||
           !on_create_rasterizer) {
         return nullptr;
    @@ -235,16 +250,18 @@ std::unique_ptr Shell::Create(
       std::unique_ptr shell;
       fml::TaskRunner::RunNowOrPostTask(
           task_runners.GetPlatformTaskRunner(),
    -      [&latch,                                          //
    -       &shell,                                          //
    -       task_runners = std::move(task_runners),          //
    -       settings,                                        //
    -       isolate_snapshot = std::move(isolate_snapshot),  //
    -       shared_snapshot = std::move(shared_snapshot),    //
    -       on_create_platform_view,                         //
    -       on_create_rasterizer                             //
    -  ]() {
    -        shell = CreateShellOnPlatformThread(std::move(task_runners),      //
    +      fml::MakeCopyable([&latch,                                          //
    +                         vm = std::move(vm),                              //
    +                         &shell,                                          //
    +                         task_runners = std::move(task_runners),          //
    +                         settings,                                        //
    +                         isolate_snapshot = std::move(isolate_snapshot),  //
    +                         shared_snapshot = std::move(shared_snapshot),    //
    +                         on_create_platform_view,                         //
    +                         on_create_rasterizer                             //
    +  ]() mutable {
    +        shell = CreateShellOnPlatformThread(std::move(vm),
    +                                            std::move(task_runners),      //
                                                 settings,                     //
                                                 std::move(isolate_snapshot),  //
                                                 std::move(shared_snapshot),   //
    @@ -252,15 +269,18 @@ std::unique_ptr Shell::Create(
                                                 on_create_rasterizer          //
             );
             latch.Signal();
    -      });
    +      }));
       latch.Wait();
       return shell;
     }
     
    -Shell::Shell(blink::TaskRunners task_runners, blink::Settings settings)
    +Shell::Shell(blink::DartVMRef vm,
    +             blink::TaskRunners task_runners,
    +             blink::Settings settings)
         : task_runners_(std::move(task_runners)),
           settings_(std::move(settings)),
    -      vm_(blink::DartVM::ForProcess(settings_)) {
    +      vm_(std::move(vm)) {
    +  FML_CHECK(vm_) << "Must have access to VM to create a shell.";
       FML_DCHECK(task_runners_.IsValid());
       FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread());
     
    @@ -302,9 +322,7 @@ Shell::~Shell() {
       PersistentCache::GetCacheForProcess()->RemoveWorkerTaskRunner(
           task_runners_.GetIOTaskRunner());
     
    -  if (auto vm = blink::DartVM::ForProcessIfInitialized()) {
    -    vm->GetServiceProtocol().RemoveHandler(this);
    -  }
    +  vm_->GetServiceProtocol()->RemoveHandler(this);
     
       fml::AutoResetWaitableEvent ui_latch, gpu_latch, platform_latch, io_latch;
     
    @@ -375,9 +393,7 @@ bool Shell::Setup(std::unique_ptr platform_view,
     
       is_setup_ = true;
     
    -  if (auto vm = blink::DartVM::ForProcessIfInitialized()) {
    -    vm->GetServiceProtocol().AddHandler(this, GetServiceProtocolDescription());
    -  }
    +  vm_->GetServiceProtocol()->AddHandler(this, GetServiceProtocolDescription());
     
       PersistentCache::GetCacheForProcess()->AddWorkerTaskRunner(
           task_runners_.GetIOTaskRunner());
    @@ -411,12 +427,13 @@ fml::WeakPtr Shell::GetPlatformView() {
       return platform_view_->GetWeakPtr();
     }
     
    -blink::DartVM& Shell::GetDartVM() const {
    -  return *vm_;
    +blink::DartVM* Shell::GetDartVM() {
    +  return &vm_;
     }
     
     // |shell::PlatformView::Delegate|
     void Shell::OnPlatformViewCreated(std::unique_ptr surface) {
    +  TRACE_EVENT0("flutter", "Shell::OnPlatformViewCreated");
       FML_DCHECK(is_setup_);
       FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread());
     
    @@ -500,6 +517,7 @@ void Shell::OnPlatformViewCreated(std::unique_ptr surface) {
     
     // |shell::PlatformView::Delegate|
     void Shell::OnPlatformViewDestroyed() {
    +  TRACE_EVENT0("flutter", "Shell::OnPlatformViewDestroyed");
       FML_DCHECK(is_setup_);
       FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread());
     
    @@ -860,10 +878,8 @@ void Shell::OnPreEngineRestart() {
     // |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);
    -  }
    +  Handler::Description description(isolate_port, isolate_name);
    +  vm_->GetServiceProtocol()->SetHandlerDescription(this, description);
     }
     
     // |blink::ServiceProtocol::Handler|
    diff --git a/shell/common/shell.h b/shell/common/shell.h
    index 17b0f170561d5..864235473c934 100644
    --- a/shell/common/shell.h
    +++ b/shell/common/shell.h
    @@ -23,6 +23,7 @@
     #include "flutter/lib/ui/semantics/custom_accessibility_action.h"
     #include "flutter/lib/ui/semantics/semantics_node.h"
     #include "flutter/lib/ui/window/platform_message.h"
    +#include "flutter/runtime/dart_vm_lifecycle.h"
     #include "flutter/runtime/service_protocol.h"
     #include "flutter/shell/common/animator.h"
     #include "flutter/shell/common/engine.h"
    @@ -54,10 +55,11 @@ class Shell final : public PlatformView::Delegate,
       static std::unique_ptr Create(
           blink::TaskRunners task_runners,
           blink::Settings settings,
    -      fml::RefPtr isolate_snapshot,
    -      fml::RefPtr shared_snapshot,
    +      fml::RefPtr isolate_snapshot,
    +      fml::RefPtr shared_snapshot,
           CreateCallback on_create_platform_view,
    -      CreateCallback on_create_rasterizer);
    +      CreateCallback on_create_rasterizer,
    +      blink::DartVMRef vm);
     
       ~Shell();
     
    @@ -71,7 +73,7 @@ class Shell final : public PlatformView::Delegate,
     
       fml::WeakPtr GetPlatformView();
     
    -  blink::DartVM& GetDartVM() const;
    +  blink::DartVM* GetDartVM();
     
       bool IsSetup() const;
     
    @@ -85,7 +87,7 @@ class Shell final : public PlatformView::Delegate,
     
       const blink::TaskRunners task_runners_;
       const blink::Settings settings_;
    -  fml::RefPtr vm_;
    +  blink::DartVMRef vm_;
       std::unique_ptr platform_view_;  // on platform task runner
       std::unique_ptr engine_;               // on UI task runner
       std::unique_ptr rasterizer_;       // on GPU task runner
    @@ -98,16 +100,19 @@ class Shell final : public PlatformView::Delegate,
                          >
           service_protocol_handlers_;
       bool is_setup_ = false;
    -
       uint64_t next_pointer_flow_id_ = 0;
     
       Shell(blink::TaskRunners task_runners, blink::Settings settings);
    +  Shell(blink::DartVMRef vm,
    +        blink::TaskRunners task_runners,
    +        blink::Settings settings);
     
       static std::unique_ptr CreateShellOnPlatformThread(
    +      blink::DartVMRef vm,
           blink::TaskRunners task_runners,
           blink::Settings settings,
    -      fml::RefPtr isolate_snapshot,
    -      fml::RefPtr shared_snapshot,
    +      fml::RefPtr isolate_snapshot,
    +      fml::RefPtr shared_snapshot,
           Shell::CreateCallback on_create_platform_view,
           Shell::CreateCallback on_create_rasterizer);
     
    diff --git a/testing/testing.cc b/testing/testing.cc
    index 93e135e7ab43d..c738219541452 100644
    --- a/testing/testing.cc
    +++ b/testing/testing.cc
    @@ -6,6 +6,8 @@
     
     namespace testing {
     
    -//
    +std::string GetCurrentTestName() {
    +  return UnitTest::GetInstance()->current_test_info()->name();
    +}
     
     }  // namespace testing
    diff --git a/testing/testing.h b/testing/testing.h
    index dac2d229b9169..0662055fea502 100644
    --- a/testing/testing.h
    +++ b/testing/testing.h
    @@ -5,6 +5,8 @@
     #ifndef TESTING_TESTING_H_
     #define TESTING_TESTING_H_
     
    +#include 
    +
     #include "gtest/gtest.h"
     
     namespace testing {
    @@ -14,6 +16,8 @@ namespace testing {
     // error.
     const char* GetFixturesPath();
     
    +std::string GetCurrentTestName();
    +
     }  // namespace testing
     
     #endif  // TESTING_TESTING_H_
    
    From cfe8675ff58a59dcf96d4e3ca89c8bfa3e7d2a07 Mon Sep 17 00:00:00 2001
    From: Chris Yang 
    Date: Mon, 1 Apr 2019 17:06:32 -0700
    Subject: [PATCH 0660/1117] Delay platform view removal to submitFrame. (#8380)
    
    Remove platform views inside OnDispose might cause issue if it happens before SubmitFrame and the active_composition_order has not been updated.
    We will be left at a situation where the active_composition_order still contains the old view, but the view is actually removed from the UIView hierarchy.
    
    We now cache the views need to be removed in OnDispose and actually remove them in SubmitFrame. At the same time, we remove stop detaching the subviews if they were disposed.
    
    As a side effect, this update will also fix flutter/flutter#30220
    ---
     .../framework/Source/FlutterPlatformViews.mm  | 28 +++++++++++++++----
     .../Source/FlutterPlatformViews_Internal.h    |  6 ++++
     2 files changed, 28 insertions(+), 6 deletions(-)
    
    diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
    index d3c42ed446b07..f2f0550b8cece 100644
    --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
    +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
    @@ -100,12 +100,8 @@
                                    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);
    +  // We wait for next submitFrame to dispose views.
    +  views_to_dispose_.insert(viewId);
       result(nil);
     }
     
    @@ -213,6 +209,8 @@
     bool FlutterPlatformViewsController::SubmitFrame(bool gl_rendering,
                                                      GrContext* gr_context,
                                                      std::shared_ptr gl_context) {
    +  DisposeViews();
    +
       bool did_submit = true;
       for (size_t i = 0; i < composition_order_.size(); i++) {
         int64_t view_id = composition_order_[i];
    @@ -265,12 +263,30 @@
     
       for (int64_t view_id : active_composition_order_) {
         if (composition_order_set.find(view_id) == composition_order_set.end()) {
    +      if (touch_interceptors_.find(view_id) == touch_interceptors_.end()) {
    +        continue;
    +      }
           [touch_interceptors_[view_id].get() removeFromSuperview];
           [overlays_[view_id]->overlay_view.get() removeFromSuperview];
         }
       }
     }
     
    +void FlutterPlatformViewsController::DisposeViews() {
    +  if (views_to_dispose_.empty()) {
    +    return;
    +  }
    +
    +  for (int64_t viewId : views_to_dispose_) {
    +    UIView* touch_interceptor = touch_interceptors_[viewId].get();
    +    [touch_interceptor removeFromSuperview];
    +    views_.erase(viewId);
    +    touch_interceptors_.erase(viewId);
    +    overlays_.erase(viewId);
    +  }
    +  views_to_dispose_.clear();
    +}
    +
     void FlutterPlatformViewsController::EnsureOverlayInitialized(int64_t overlay_id) {
       if (overlays_.count(overlay_id) != 0) {
         return;
    diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
    index a0ebbac98b302..0f2cfe3d57bad 100644
    --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
    +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
    @@ -91,6 +91,10 @@ class FlutterPlatformViewsController {
       GrContext* overlays_gr_context_;
       SkISize frame_size_;
     
    +  // Method channel `OnDispose` calls adds the views to be disposed to this set to be disposed on
    +  // the next frame.
    +  std::unordered_set views_to_dispose_;
    +
       // 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_;
    @@ -106,6 +110,8 @@ class FlutterPlatformViewsController {
       void OnRejectGesture(FlutterMethodCall* call, FlutterResult& result);
     
       void DetachUnusedLayers();
    +  // Dispose the views in `views_to_dispose_`.
    +  void DisposeViews();
       void EnsureOverlayInitialized(int64_t overlay_id);
       void EnsureGLOverlayInitialized(int64_t overlay_id,
                                       std::shared_ptr gl_context,
    
    From 79a988f5da4665980c6cc6916403e76b53f1e3e0 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Mon, 1 Apr 2019 20:29:49 -0400
    Subject: [PATCH 0661/1117] Roll src/third_party/skia
     b27667a15a15..3f6a2ac63670 (1 commits) (#8401)
    
    https://skia.googlesource.com/skia.git/%2Blog/b27667a15a15..3f6a2ac63670
    
    git log b27667a15a15ce31d135538a409c419c0b8b0d1b..3f6a2ac636700b5bb27834938de3b43f71a33beb --date=short --no-merges --format=%ad %ae %s
    2019-04-01 reed@google.com remove unneeded asACompose
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index c6632cb89a0ca..5d23c17808003 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': 'b27667a15a15ce31d135538a409c419c0b8b0d1b',
    +  'skia_revision': '3f6a2ac636700b5bb27834938de3b43f71a33beb',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 0af9b04a1f983..55e7acac482b1 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 0cafcf3959b077da7fab02aca9869893
    +Signature: 306f5a1810c6049ffe81737c06b9b818
     
     UNUSED LICENSES:
     
    
    From 3796d989183d588b17a110d8aaf74906c4e1c8f0 Mon Sep 17 00:00:00 2001
    From: MH Johnson 
    Date: Mon, 1 Apr 2019 21:56:19 -0400
    Subject: [PATCH 0662/1117] [ui] Add null check in FontWeight.lerp (#8274)
    
    * Add null check in FontWeight.lerp
    
    * Add Unit tests for FontWeight.lerp
    ---
     lib/ui/text.dart            |  5 ++++-
     testing/dart/text_test.dart | 27 +++++++++++++++++++++++++++
     2 files changed, 31 insertions(+), 1 deletion(-)
     create mode 100644 testing/dart/text_test.dart
    
    diff --git a/lib/ui/text.dart b/lib/ui/text.dart
    index d198d2b19c1ae..87bb557163165 100644
    --- a/lib/ui/text.dart
    +++ b/lib/ui/text.dart
    @@ -63,7 +63,8 @@ class FontWeight {
       /// Rather than using fractional weights, the interpolation rounds to the
       /// nearest weight.
       ///
    -  /// Any null values for `a` or `b` are interpreted as equivalent to [normal]
    +  /// If both `a` and `b` are null, then this method will return null. Otherwise,
    +  /// any null values for `a` or `b` are interpreted as equivalent to [normal]
       /// (also known as [w400]).
       ///
       /// The `t` argument represents position on the timeline, with 0.0 meaning
    @@ -80,6 +81,8 @@ class FontWeight {
       /// an [AnimationController].
       static FontWeight lerp(FontWeight a, FontWeight b, double t) {
         assert(t != null);
    +    if (a == null && b == null)
    +      return null;
         return values[lerpDouble(a?.index ?? normal.index, b?.index ?? normal.index, t).round().clamp(0, 8)];
       }
     
    diff --git a/testing/dart/text_test.dart b/testing/dart/text_test.dart
    new file mode 100644
    index 0000000000000..fb8b13bbbe362
    --- /dev/null
    +++ b/testing/dart/text_test.dart
    @@ -0,0 +1,27 @@
    +// Copyright 2019 The Flutter 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 'dart:ui';
    +
    +import 'package:test/test.dart';
    +
    +void main() {
    +  group('FontWeight.lerp', () {
    +    test('works with non-null values', () {
    +      expect(FontWeight.lerp(FontWeight.w400, FontWeight.w600, .5), equals(FontWeight.w500));
    +    });
    +
    +    test('returns null if a and b are null', () {
    +      expect(FontWeight.lerp(null, null, 0), isNull);
    +    });
    +
    +    test('returns FontWeight.w400 if a is null', () {
    +      expect(FontWeight.lerp(null, FontWeight.w400, 0), equals(FontWeight.w400));
    +    });
    +
    +    test('returns FontWeight.w400 if b is null', () {
    +      expect(FontWeight.lerp(FontWeight.w400, null, 1), equals(FontWeight.w400));
    +    });
    +  });
    +}
    
    From b572ade3550b3f04ccb8c18d5bc4d5804f479c03 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Tue, 2 Apr 2019 01:04:49 -0400
    Subject: [PATCH 0663/1117] Roll src/third_party/skia
     3f6a2ac63670..1acf79a3e5b8 (1 commits) (#8403)
    
    https://skia.googlesource.com/skia.git/%2Blog/3f6a2ac63670..1acf79a3e5b8
    
    git log 3f6a2ac636700b5bb27834938de3b43f71a33beb..1acf79a3e5b8abfca56193e4643b51f3c552389c --date=short --no-merges --format=%ad %ae %s
    2019-04-02 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 52a67b6495ce..459453a96257 (5 commits)
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 5d23c17808003..b30793cd714a6 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': '3f6a2ac636700b5bb27834938de3b43f71a33beb',
    +  'skia_revision': '1acf79a3e5b8abfca56193e4643b51f3c552389c',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 55e7acac482b1..56f73f17905f0 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 306f5a1810c6049ffe81737c06b9b818
    +Signature: 08adfe2d0f5ce7869685f29f69bdf8e9
     
     UNUSED LICENSES:
     
    
    From 6675f71dfb22a0b4fdab6332e37843f78c33c9e6 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Tue, 2 Apr 2019 04:33:49 -0400
    Subject: [PATCH 0664/1117] Roll src/third_party/skia
     1acf79a3e5b8..d962070feb84 (4 commits) (#8404)
    
    https://skia.googlesource.com/skia.git/%2Blog/1acf79a3e5b8..d962070feb84
    
    git log 1acf79a3e5b8abfca56193e4643b51f3c552389c..d962070feb84a95e25d99f0a6ad26fd59d32e60b --date=short --no-merges --format=%ad %ae %s
    2019-04-01 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    2019-04-02 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset
    2019-04-02 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 3115a0fc17fa..6cb0cff57376 (9 commits)
    2019-04-02 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src e01c3e081ff3..b3f3a36219a1 (475 commits)
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index b30793cd714a6..5e31109e52e7b 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': '1acf79a3e5b8abfca56193e4643b51f3c552389c',
    +  'skia_revision': 'd962070feb84a95e25d99f0a6ad26fd59d32e60b',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 56f73f17905f0..308275c0da2fa 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 08adfe2d0f5ce7869685f29f69bdf8e9
    +Signature: 7bb93da4b03881db83e145aaeca6df36
     
     UNUSED LICENSES:
     
    
    From f835789dd876ac419981ba4278b4ca7b48d4da70 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Tue, 2 Apr 2019 09:06:38 -0400
    Subject: [PATCH 0665/1117] Roll src/third_party/skia
     d962070feb84..70d8f4f3acbb (1 commits) (#8405)
    
    https://skia.googlesource.com/skia.git/%2Blog/d962070feb84..70d8f4f3acbb
    
    git log d962070feb84a95e25d99f0a6ad26fd59d32e60b..70d8f4f3acbbbc6fbce0e1f1753ba475f2c52dac --date=short --no-merges --format=%ad %ae %s
    2019-04-01 scroggo@google.com SkWuffsCodec: Use drawing to do color correction and scaling
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 3 ++-
     2 files changed, 3 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 5e31109e52e7b..ea2c0398d1a3a 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': 'd962070feb84a95e25d99f0a6ad26fd59d32e60b',
    +  'skia_revision': '70d8f4f3acbbbc6fbce0e1f1753ba475f2c52dac',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 308275c0da2fa..acf276ac7a55c 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 7bb93da4b03881db83e145aaeca6df36
    +Signature: 9dc1569e557e981bad887bab6ab265e9
     
     UNUSED LICENSES:
     
    @@ -4577,6 +4577,7 @@ FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h
     FILE: ../../../third_party/skia/samplecode/SampleDegenerateQuads.cpp
     FILE: ../../../third_party/skia/samplecode/SampleSG.cpp
     FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp
    +FILE: ../../../third_party/skia/src/codec/SkScalingCodec.h
     FILE: ../../../third_party/skia/src/core/SkColorFilter_Mixer.cpp
     FILE: ../../../third_party/skia/src/core/SkColorFilter_Mixer.h
     FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp
    
    From f7b4903d7c9913447af3aaebc4308d1a1e2a4dde Mon Sep 17 00:00:00 2001
    From: Zachary Anderson 
    Date: Tue, 2 Apr 2019 09:12:56 -0700
    Subject: [PATCH 0666/1117] Revert "Separate the data required to bootstrap the
     VM into its own class. (#8397)" (#8406)
    
    This reverts commit c991647404f8117dab2ca4ed49aa3ba48a634240.
    ---
     ci/licenses_golden/licenses_flutter           |   4 -
     common/settings.h                             |   2 -
     .../isolate_name_server_natives.cc            |  18 +-
     lib/ui/ui_dart_state.cc                       |   6 +-
     lib/ui/ui_dart_state.h                        |   6 +-
     runtime/BUILD.gn                              |   5 -
     runtime/dart_isolate.cc                       |  89 +++++-----
     runtime/dart_isolate.h                        |  26 +--
     runtime/dart_isolate_unittests.cc             |  78 ++++-----
     runtime/dart_vm.cc                            | 160 ++++++++++--------
     runtime/dart_vm.h                             |  58 ++++---
     runtime/dart_vm_data.cc                       |  79 ---------
     runtime/dart_vm_data.h                        |  47 -----
     runtime/dart_vm_lifecycle.cc                  | 117 -------------
     runtime/dart_vm_lifecycle.h                   |  72 --------
     runtime/dart_vm_unittests.cc                  |   8 +-
     runtime/runtime_controller.cc                 |  10 +-
     runtime/runtime_controller.h                  |  12 +-
     shell/common/engine.cc                        |   4 +-
     shell/common/engine.h                         |   4 +-
     shell/common/shell.cc                         |  88 ++++------
     shell/common/shell.h                          |  21 +--
     testing/testing.cc                            |   4 +-
     testing/testing.h                             |   4 -
     24 files changed, 290 insertions(+), 632 deletions(-)
     delete mode 100644 runtime/dart_vm_data.cc
     delete mode 100644 runtime/dart_vm_data.h
     delete mode 100644 runtime/dart_vm_lifecycle.cc
     delete mode 100644 runtime/dart_vm_lifecycle.h
    
    diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter
    index 312e6c329ab71..c9914e4c2156f 100644
    --- a/ci/licenses_golden/licenses_flutter
    +++ b/ci/licenses_golden/licenses_flutter
    @@ -383,10 +383,6 @@ FILE: ../../../flutter/runtime/dart_snapshot_buffer.cc
     FILE: ../../../flutter/runtime/dart_snapshot_buffer.h
     FILE: ../../../flutter/runtime/dart_vm.cc
     FILE: ../../../flutter/runtime/dart_vm.h
    -FILE: ../../../flutter/runtime/dart_vm_data.cc
    -FILE: ../../../flutter/runtime/dart_vm_data.h
    -FILE: ../../../flutter/runtime/dart_vm_lifecycle.cc
    -FILE: ../../../flutter/runtime/dart_vm_lifecycle.h
     FILE: ../../../flutter/runtime/dart_vm_unittests.cc
     FILE: ../../../flutter/runtime/embedder_resources.cc
     FILE: ../../../flutter/runtime/embedder_resources.h
    diff --git a/common/settings.h b/common/settings.h
    index 40b647de1f431..bfbfd4139d322 100644
    --- a/common/settings.h
    +++ b/common/settings.h
    @@ -85,8 +85,6 @@ struct Settings {
       // Font settings
       bool use_test_fonts = false;
     
    -  bool leak_vm = true;
    -
       // Engine settings
       TaskObserverAdd task_observer_add;
       TaskObserverRemove task_observer_remove;
    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 3f7f80ef05fd7..7f4467886f4fa 100644
    --- a/lib/ui/isolate_name_server/isolate_name_server_natives.cc
    +++ b/lib/ui/isolate_name_server/isolate_name_server_natives.cc
    @@ -14,10 +14,8 @@ namespace blink {
     
     Dart_Handle IsolateNameServerNatives::LookupPortByName(
         const std::string& name) {
    -  auto name_server = UIDartState::Current()->GetIsolateNameServer();
    -  if (!name_server) {
    -    return Dart_Null();
    -  }
    +  IsolateNameServer* name_server =
    +      UIDartState::Current()->GetIsolateNameServer();
       Dart_Port port = name_server->LookupIsolatePortByName(name);
       if (port == ILLEGAL_PORT) {
         return Dart_Null();
    @@ -28,10 +26,8 @@ Dart_Handle IsolateNameServerNatives::LookupPortByName(
     Dart_Handle IsolateNameServerNatives::RegisterPortWithName(
         Dart_Handle port_handle,
         const std::string& name) {
    -  auto name_server = UIDartState::Current()->GetIsolateNameServer();
    -  if (!name_server) {
    -    return Dart_False();
    -  }
    +  IsolateNameServer* name_server =
    +      UIDartState::Current()->GetIsolateNameServer();
       Dart_Port port = ILLEGAL_PORT;
       Dart_SendPortGetId(port_handle, &port);
       if (!name_server->RegisterIsolatePortWithName(port, name)) {
    @@ -42,10 +38,8 @@ Dart_Handle IsolateNameServerNatives::RegisterPortWithName(
     
     Dart_Handle IsolateNameServerNatives::RemovePortNameMapping(
         const std::string& name) {
    -  auto name_server = UIDartState::Current()->GetIsolateNameServer();
    -  if (!name_server) {
    -    return Dart_False();
    -  }
    +  IsolateNameServer* name_server =
    +      UIDartState::Current()->GetIsolateNameServer();
       if (!name_server->RemoveIsolateNameMapping(name)) {
         return Dart_False();
       }
    diff --git a/lib/ui/ui_dart_state.cc b/lib/ui/ui_dart_state.cc
    index be0a5348f31a1..b42cbaf5ba607 100644
    --- a/lib/ui/ui_dart_state.cc
    +++ b/lib/ui/ui_dart_state.cc
    @@ -23,7 +23,7 @@ UIDartState::UIDartState(
         std::string advisory_script_entrypoint,
         std::string logger_prefix,
         UnhandledExceptionCallback unhandled_exception_callback,
    -    std::shared_ptr isolate_name_server)
    +    IsolateNameServer* isolate_name_server)
         : task_runners_(std::move(task_runners)),
           add_callback_(std::move(add_callback)),
           remove_callback_(std::move(remove_callback)),
    @@ -33,7 +33,7 @@ UIDartState::UIDartState(
           advisory_script_entrypoint_(std::move(advisory_script_entrypoint)),
           logger_prefix_(std::move(logger_prefix)),
           unhandled_exception_callback_(unhandled_exception_callback),
    -      isolate_name_server_(std::move(isolate_name_server)) {
    +      isolate_name_server_(isolate_name_server) {
       AddOrRemoveTaskObserver(true /* add */);
     }
     
    @@ -124,7 +124,7 @@ fml::WeakPtr UIDartState::GetResourceContext() const {
       return io_manager_->GetResourceContext();
     }
     
    -std::shared_ptr UIDartState::GetIsolateNameServer() const {
    +IsolateNameServer* UIDartState::GetIsolateNameServer() {
       return isolate_name_server_;
     }
     
    diff --git a/lib/ui/ui_dart_state.h b/lib/ui/ui_dart_state.h
    index afa5e47e83de8..f2c63cbacef60 100644
    --- a/lib/ui/ui_dart_state.h
    +++ b/lib/ui/ui_dart_state.h
    @@ -53,7 +53,7 @@ class UIDartState : public tonic::DartState {
     
       fml::WeakPtr GetResourceContext() const;
     
    -  std::shared_ptr GetIsolateNameServer() const;
    +  IsolateNameServer* GetIsolateNameServer();
     
       tonic::DartErrorHandleType GetLastError();
     
    @@ -81,7 +81,7 @@ class UIDartState : public tonic::DartState {
                   std::string advisory_script_entrypoint,
                   std::string logger_prefix,
                   UnhandledExceptionCallback unhandled_exception_callback,
    -              std::shared_ptr isolate_name_server);
    +              IsolateNameServer* isolate_name_server);
     
       ~UIDartState() override;
     
    @@ -107,7 +107,7 @@ class UIDartState : public tonic::DartState {
       std::unique_ptr window_;
       tonic::DartMicrotaskQueue microtask_queue_;
       UnhandledExceptionCallback unhandled_exception_callback_;
    -  const std::shared_ptr isolate_name_server_;
    +  IsolateNameServer* isolate_name_server_;
     
       void AddOrRemoveTaskObserver(bool add);
     };
    diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
    index a906e589c223f..3d0e807585fcd 100644
    --- a/runtime/BUILD.gn
    +++ b/runtime/BUILD.gn
    @@ -50,10 +50,6 @@ source_set("runtime") {
         "dart_snapshot_buffer.h",
         "dart_vm.cc",
         "dart_vm.h",
    -    "dart_vm_data.cc",
    -    "dart_vm_data.h",
    -    "dart_vm_lifecycle.cc",
    -    "dart_vm_lifecycle.h",
         "embedder_resources.cc",
         "embedder_resources.h",
         "runtime_controller.cc",
    @@ -119,7 +115,6 @@ executable("runtime_unittests") {
         "$flutter_root/common",
         "$flutter_root/fml",
         "$flutter_root/lib/snapshot",
    -    "$flutter_root/shell/common",
         "$flutter_root/testing:dart",
         "//third_party/skia",
         "//third_party/tonic",
    diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc
    index 46df151f40b0e..7cae71c36e3fd 100644
    --- a/runtime/dart_isolate.cc
    +++ b/runtime/dart_isolate.cc
    @@ -14,7 +14,6 @@
     #include "flutter/lib/ui/dart_ui.h"
     #include "flutter/runtime/dart_service_isolate.h"
     #include "flutter/runtime/dart_vm.h"
    -#include "flutter/runtime/dart_vm_lifecycle.h"
     #include "third_party/dart/runtime/include/dart_api.h"
     #include "third_party/dart/runtime/include/dart_tools_api.h"
     #include "third_party/tonic/converter/dart_converter.h"
    @@ -30,9 +29,9 @@
     namespace blink {
     
     std::weak_ptr DartIsolate::CreateRootIsolate(
    -    const Settings& settings,
    -    fml::RefPtr isolate_snapshot,
    -    fml::RefPtr shared_snapshot,
    +    DartVM* vm,
    +    fml::RefPtr isolate_snapshot,
    +    fml::RefPtr shared_snapshot,
         TaskRunners task_runners,
         std::unique_ptr window,
         fml::WeakPtr snapshot_delegate,
    @@ -51,7 +50,7 @@ std::weak_ptr DartIsolate::CreateRootIsolate(
       // isolate lifecycle is entirely managed by the VM).
       auto root_embedder_data = std::make_unique>(
           std::make_shared(
    -          settings,                      // settings
    +          vm,                            // VM
               std::move(isolate_snapshot),   // isolate snapshot
               std::move(shared_snapshot),    // shared snapshot
               task_runners,                  // task runners
    @@ -94,9 +93,9 @@ std::weak_ptr DartIsolate::CreateRootIsolate(
       return embedder_isolate;
     }
     
    -DartIsolate::DartIsolate(const Settings& settings,
    -                         fml::RefPtr isolate_snapshot,
    -                         fml::RefPtr shared_snapshot,
    +DartIsolate::DartIsolate(DartVM* vm,
    +                         fml::RefPtr isolate_snapshot,
    +                         fml::RefPtr shared_snapshot,
                              TaskRunners task_runners,
                              fml::WeakPtr snapshot_delegate,
                              fml::WeakPtr io_manager,
    @@ -104,33 +103,38 @@ DartIsolate::DartIsolate(const Settings& settings,
                              std::string advisory_script_entrypoint,
                              ChildIsolatePreparer child_isolate_preparer)
         : UIDartState(std::move(task_runners),
    -                  settings.task_observer_add,
    -                  settings.task_observer_remove,
    +                  vm->GetSettings().task_observer_add,
    +                  vm->GetSettings().task_observer_remove,
                       std::move(snapshot_delegate),
                       std::move(io_manager),
                       advisory_script_uri,
                       advisory_script_entrypoint,
    -                  settings.log_tag,
    -                  settings.unhandled_exception_callback,
    -                  DartVMRef::GetIsolateNameServer()),
    -      settings_(settings),
    +                  vm->GetSettings().log_tag,
    +                  vm->GetSettings().unhandled_exception_callback,
    +                  vm->GetIsolateNameServer()),
    +      vm_(vm),
           isolate_snapshot_(std::move(isolate_snapshot)),
           shared_snapshot_(std::move(shared_snapshot)),
           child_isolate_preparer_(std::move(child_isolate_preparer)) {
       FML_DCHECK(isolate_snapshot_) << "Must contain a valid isolate snapshot.";
    +
    +  if (vm_ == nullptr) {
    +    return;
    +  }
    +
       phase_ = Phase::Uninitialized;
     }
     
     DartIsolate::~DartIsolate() = default;
     
    -const Settings& DartIsolate::GetSettings() const {
    -  return settings_;
    -}
    -
     DartIsolate::Phase DartIsolate::GetPhase() const {
       return phase_;
     }
     
    +DartVM* DartIsolate::GetDartVM() const {
    +  return vm_;
    +}
    +
     bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) {
       TRACE_EVENT0("flutter", "DartIsolate::Initialize");
       if (phase_ != Phase::Uninitialized) {
    @@ -496,16 +500,16 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
         const char* package_config,
         Dart_IsolateFlags* flags,
         char** error) {
    -  auto vm_data = DartVMRef::GetVMData();
    +  auto vm = DartVM::ForProcessIfInitialized();
     
    -  if (!vm_data) {
    +  if (!vm) {
         *error = strdup(
    -        "Could not access VM data to initialize isolates. This may be because "
    -        "the VM has initialized shutdown on another thread already.");
    +        "Could not resolve the VM when attempting to create the service "
    +        "isolate.");
         return nullptr;
       }
     
    -  const auto& settings = vm_data->GetSettings();
    +  const auto& settings = vm->GetSettings();
     
       if (!settings.enable_observatory) {
         FML_DLOG(INFO) << "Observatory is disabled.";
    @@ -520,16 +524,16 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
     
       std::weak_ptr weak_service_isolate =
           DartIsolate::CreateRootIsolate(
    -          vm_data->GetSettings(),         // settings
    -          vm_data->GetIsolateSnapshot(),  // isolate snapshot
    -          vm_data->GetSharedSnapshot(),   // shared snapshot
    -          null_task_runners,              // task runners
    -          nullptr,                        // window
    -          {},                             // snapshot delegate
    -          {},                             // IO Manager
    -          DART_VM_SERVICE_ISOLATE_NAME,   // script uri
    -          DART_VM_SERVICE_ISOLATE_NAME,   // script entrypoint
    -          flags                           // flags
    +          vm.get(),                      // vm
    +          vm->GetIsolateSnapshot(),      // isolate snapshot
    +          vm->GetSharedSnapshot(),       // shared snapshot
    +          null_task_runners,             // task runners
    +          nullptr,                       // window
    +          {},                            // snapshot delegate
    +          {},                            // IO Manager
    +          DART_VM_SERVICE_ISOLATE_NAME,  // script uri
    +          DART_VM_SERVICE_ISOLATE_NAME,  // script entrypoint
    +          flags                          // flags
           );
     
       std::shared_ptr service_isolate = weak_service_isolate.lock();
    @@ -552,13 +556,7 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
         return nullptr;
       }
     
    -  if (auto service_protocol = DartVMRef::GetServiceProtocol()) {
    -    service_protocol->ToggleHooks(true);
    -  } else {
    -    FML_DLOG(ERROR)
    -        << "Could not acquire the service protocol handlers. This might be "
    -           "because the VM has already begun teardown on another thread.";
    -  }
    +  vm->GetServiceProtocol().ToggleHooks(true);
     
       return service_isolate->isolate();
     }
    @@ -614,13 +612,16 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
       std::unique_ptr> embedder_isolate(
           p_parent_embedder_isolate);
     
    -  if (embedder_isolate == nullptr) {
    +  if (embedder_isolate == nullptr ||
    +      (*embedder_isolate)->GetDartVM() == nullptr) {
         *error =
             strdup("Parent isolate did not have embedder specific callback data.");
         FML_DLOG(ERROR) << *error;
         return {nullptr, {}};
       }
     
    +  DartVM* const vm = (*embedder_isolate)->GetDartVM();
    +
       if (!is_root_isolate) {
         auto* raw_embedder_isolate = embedder_isolate.release();
     
    @@ -629,7 +630,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
     
         embedder_isolate = std::make_unique>(
             std::make_shared(
    -            (*raw_embedder_isolate)->GetSettings(),         // settings
    +            vm,                                             // vm
                 (*raw_embedder_isolate)->GetIsolateSnapshot(),  // isolate_snapshot
                 (*raw_embedder_isolate)->GetSharedSnapshot(),   // shared_snapshot
                 null_task_runners,                              // task_runners
    @@ -702,11 +703,11 @@ void DartIsolate::DartIsolateCleanupCallback(
       delete embedder_isolate;
     }
     
    -fml::RefPtr DartIsolate::GetIsolateSnapshot() const {
    +fml::RefPtr DartIsolate::GetIsolateSnapshot() const {
       return isolate_snapshot_;
     }
     
    -fml::RefPtr DartIsolate::GetSharedSnapshot() const {
    +fml::RefPtr DartIsolate::GetSharedSnapshot() const {
       return shared_snapshot_;
     }
     
    diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h
    index 49c3df3c51082..6b92875e1dc0e 100644
    --- a/runtime/dart_isolate.h
    +++ b/runtime/dart_isolate.h
    @@ -41,9 +41,9 @@ class DartIsolate : public UIDartState {
       // bindings. From the VM's perspective, this isolate is not special in any
       // way.
       static std::weak_ptr CreateRootIsolate(
    -      const Settings& settings,
    -      fml::RefPtr isolate_snapshot,
    -      fml::RefPtr shared_snapshot,
    +      DartVM* vm,
    +      fml::RefPtr isolate_snapshot,
    +      fml::RefPtr shared_snapshot,
           TaskRunners task_runners,
           std::unique_ptr window,
           fml::WeakPtr snapshot_delegate,
    @@ -52,9 +52,9 @@ class DartIsolate : public UIDartState {
           std::string advisory_script_entrypoint,
           Dart_IsolateFlags* flags = nullptr);
     
    -  DartIsolate(const Settings& settings,
    -              fml::RefPtr isolate_snapshot,
    -              fml::RefPtr shared_snapshot,
    +  DartIsolate(DartVM* vm,
    +              fml::RefPtr isolate_snapshot,
    +              fml::RefPtr shared_snapshot,
                   TaskRunners task_runners,
                   fml::WeakPtr snapshot_delegate,
                   fml::WeakPtr io_manager,
    @@ -64,8 +64,6 @@ class DartIsolate : public UIDartState {
     
       ~DartIsolate() override;
     
    -  const Settings& GetSettings() const;
    -
       Phase GetPhase() const;
     
       FML_WARN_UNUSED_RESULT
    @@ -88,9 +86,11 @@ class DartIsolate : public UIDartState {
     
       void AddIsolateShutdownCallback(fml::closure closure);
     
    -  fml::RefPtr GetIsolateSnapshot() const;
    +  DartVM* GetDartVM() const;
    +
    +  fml::RefPtr GetIsolateSnapshot() const;
     
    -  fml::RefPtr GetSharedSnapshot() const;
    +  fml::RefPtr GetSharedSnapshot() const;
     
       std::weak_ptr GetWeakIsolatePtr();
     
    @@ -109,10 +109,10 @@ class DartIsolate : public UIDartState {
       };
       friend class DartVM;
     
    +  DartVM* const vm_ = nullptr;
       Phase phase_ = Phase::Unknown;
    -  const Settings settings_;
    -  const fml::RefPtr isolate_snapshot_;
    -  const fml::RefPtr shared_snapshot_;
    +  const fml::RefPtr isolate_snapshot_;
    +  const fml::RefPtr shared_snapshot_;
       std::vector> kernel_buffers_;
       std::vector> shutdown_callbacks_;
       ChildIsolatePreparer child_isolate_preparer_ = nullptr;
    diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc
    index e2a7c734bb1c8..d35766f58f81f 100644
    --- a/runtime/dart_isolate_unittests.cc
    +++ b/runtime/dart_isolate_unittests.cc
    @@ -9,7 +9,6 @@
     #include "flutter/fml/thread.h"
     #include "flutter/runtime/dart_isolate.h"
     #include "flutter/runtime/dart_vm.h"
    -#include "flutter/runtime/dart_vm_lifecycle.h"
     #include "flutter/runtime/runtime_test.h"
     #include "flutter/testing/testing.h"
     #include "flutter/testing/thread_test.h"
    @@ -27,10 +26,8 @@ using DartIsolateTest = RuntimeTest;
     
     TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) {
       auto settings = CreateSettingsForFixture();
    -  auto vm_ref = DartVMRef::Create(settings);
    -  ASSERT_TRUE(vm_ref);
    -  auto vm_data = vm_ref.GetVMData();
    -  ASSERT_TRUE(vm_data);
    +  auto vm = DartVM::ForProcess(settings);
    +  ASSERT_TRUE(vm);
       TaskRunners task_runners(CURRENT_TEST_NAME,       //
                                GetCurrentTaskRunner(),  //
                                GetCurrentTaskRunner(),  //
    @@ -38,15 +35,15 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) {
                                GetCurrentTaskRunner()   //
       );
       auto weak_isolate = DartIsolate::CreateRootIsolate(
    -      vm_data->GetSettings(),         // settings
    -      vm_data->GetIsolateSnapshot(),  // isolate snapshot
    -      vm_data->GetSharedSnapshot(),   // shared snapshot
    -      std::move(task_runners),        // task runners
    -      nullptr,                        // window
    -      {},                             // snapshot delegate
    -      {},                             // io manager
    -      "main.dart",                    // advisory uri
    -      "main"                          // advisory entrypoint
    +      vm.get(),                  // vm
    +      vm->GetIsolateSnapshot(),  // isolate snapshot
    +      vm->GetSharedSnapshot(),   // shared snapshot
    +      std::move(task_runners),   // task runners
    +      nullptr,                   // window
    +      {},                        // snapshot delegate
    +      {},                        // io manager
    +      "main.dart",               // advisory uri
    +      "main"                     // advisory entrypoint
       );
       auto root_isolate = weak_isolate.lock();
       ASSERT_TRUE(root_isolate);
    @@ -56,10 +53,8 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) {
     
     TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) {
       auto settings = CreateSettingsForFixture();
    -  auto vm_ref = DartVMRef::Create(settings);
    -  ASSERT_TRUE(vm_ref);
    -  auto vm_data = vm_ref.GetVMData();
    -  ASSERT_TRUE(vm_data);
    +  auto vm = DartVM::ForProcess(settings);
    +  ASSERT_TRUE(vm);
       TaskRunners task_runners(CURRENT_TEST_NAME,       //
                                GetCurrentTaskRunner(),  //
                                GetCurrentTaskRunner(),  //
    @@ -67,15 +62,15 @@ TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) {
                                GetCurrentTaskRunner()   //
       );
       auto weak_isolate = DartIsolate::CreateRootIsolate(
    -      vm_data->GetSettings(),         // settings
    -      vm_data->GetIsolateSnapshot(),  // isolate snapshot
    -      vm_data->GetSharedSnapshot(),   // shared snapshot
    -      std::move(task_runners),        // task runners
    -      nullptr,                        // window
    -      {},                             // snapshot delegate
    -      {},                             // io manager
    -      "main.dart",                    // advisory uri
    -      "main"                          // advisory entrypoint
    +      vm.get(),                  // vm
    +      vm->GetIsolateSnapshot(),  // isolate snapshot
    +      vm->GetSharedSnapshot(),   // shared snapshot
    +      std::move(task_runners),   // task runners
    +      nullptr,                   // window
    +      {},                        // snapshot delegate
    +      {},                        // io manager
    +      "main.dart",               // advisory uri
    +      "main"                     // advisory entrypoint
       );
       auto root_isolate = weak_isolate.lock();
       ASSERT_TRUE(root_isolate);
    @@ -153,12 +148,11 @@ static void RunDartCodeInIsolate(std::unique_ptr& result,
                                      fml::RefPtr task_runner,
                                      std::string entrypoint) {
       FML_CHECK(task_runner->RunsTasksOnCurrentThread());
    -  auto vm_ref = DartVMRef::Create(settings);
    +  auto vm = DartVM::ForProcess(settings);
     
    -  if (!vm_ref) {
    +  if (!vm) {
         return;
       }
    -
       TaskRunners task_runners(CURRENT_TEST_NAME,  //
                                task_runner,        //
                                task_runner,        //
    @@ -166,22 +160,16 @@ static void RunDartCodeInIsolate(std::unique_ptr& result,
                                task_runner         //
       );
     
    -  auto vm_data = vm_ref.GetVMData();
    -
    -  if (!vm_data) {
    -    return;
    -  }
    -
       auto weak_isolate = DartIsolate::CreateRootIsolate(
    -      vm_data->GetSettings(),         // settings
    -      vm_data->GetIsolateSnapshot(),  // isolate snapshot
    -      vm_data->GetSharedSnapshot(),   // shared snapshot
    -      std::move(task_runners),        // task runners
    -      nullptr,                        // window
    -      {},                             // snapshot delegate
    -      {},                             // io manager
    -      "main.dart",                    // advisory uri
    -      "main"                          // advisory entrypoint
    +      vm.get(),                  // vm
    +      vm->GetIsolateSnapshot(),  // isolate snapshot
    +      vm->GetSharedSnapshot(),   // shared snapshot
    +      std::move(task_runners),   // task runners
    +      nullptr,                   // window
    +      {},                        // snapshot delegate
    +      {},                        // io manager
    +      "main.dart",               // advisory uri
    +      "main"                     // advisory entrypoint
       );
     
       auto root_isolate =
    diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc
    index 110f7c2b27809..4c6054f7be25f 100644
    --- a/runtime/dart_vm.cc
    +++ b/runtime/dart_vm.cc
    @@ -15,7 +15,6 @@
     #include "flutter/fml/file.h"
     #include "flutter/fml/logging.h"
     #include "flutter/fml/mapping.h"
    -#include "flutter/fml/synchronization/thread_annotations.h"
     #include "flutter/fml/time/time_delta.h"
     #include "flutter/fml/trace_event.h"
     #include "flutter/lib/io/dart_io.h"
    @@ -220,48 +219,66 @@ static void EmbedderInformationCallback(Dart_EmbedderInformation* info) {
       info->name = "Flutter";
     }
     
    -std::shared_ptr DartVM::Create(
    +fml::RefPtr DartVM::ForProcess(Settings settings) {
    +  return ForProcess(settings, nullptr, nullptr, nullptr);
    +}
    +
    +static std::once_flag gVMInitialization;
    +static std::mutex gVMMutex;
    +static fml::RefPtr gVM;
    +
    +fml::RefPtr DartVM::ForProcess(
         Settings settings,
         fml::RefPtr vm_snapshot,
         fml::RefPtr isolate_snapshot,
    -    fml::RefPtr shared_snapshot,
    -    std::shared_ptr isolate_name_server) {
    -  auto vm_data = DartVMData::Create(settings,                     //
    -                                    std::move(vm_snapshot),       //
    -                                    std::move(isolate_snapshot),  //
    -                                    std::move(shared_snapshot)    //
    -  );
    -
    -  if (!vm_data) {
    -    FML_LOG(ERROR) << "Could not setup VM data to bootstrap the VM from.";
    -    return {};
    -  }
    -
    -  // Note: std::make_shared unviable due to hidden constructor.
    -  return std::shared_ptr(
    -      new DartVM(std::move(vm_data), std::move(isolate_name_server)));
    +    fml::RefPtr shared_snapshot) {
    +  std::lock_guard lock(gVMMutex);
    +  std::call_once(gVMInitialization, [settings,          //
    +                                     vm_snapshot,       //
    +                                     isolate_snapshot,  //
    +                                     shared_snapshot    //
    +  ]() mutable {
    +    if (!vm_snapshot) {
    +      vm_snapshot = DartSnapshot::VMSnapshotFromSettings(settings);
    +    }
    +    if (!(vm_snapshot && vm_snapshot->IsValid())) {
    +      FML_LOG(ERROR) << "VM snapshot must be valid.";
    +      return;
    +    }
    +    if (!isolate_snapshot) {
    +      isolate_snapshot = DartSnapshot::IsolateSnapshotFromSettings(settings);
    +    }
    +    if (!(isolate_snapshot && isolate_snapshot->IsValid())) {
    +      FML_LOG(ERROR) << "Isolate snapshot must be valid.";
    +      return;
    +    }
    +    if (!shared_snapshot) {
    +      shared_snapshot = DartSnapshot::Empty();
    +    }
    +    gVM = fml::MakeRefCounted(settings,                     //
    +                                      std::move(vm_snapshot),       //
    +                                      std::move(isolate_snapshot),  //
    +                                      std::move(shared_snapshot)    //
    +    );
    +  });
    +  return gVM;
     }
     
    -static std::atomic_size_t gVMLaunchCount;
    -
    -size_t DartVM::GetVMLaunchCount() {
    -  return gVMLaunchCount;
    +fml::RefPtr DartVM::ForProcessIfInitialized() {
    +  std::lock_guard lock(gVMMutex);
    +  return gVM;
     }
     
    -DartVM::DartVM(std::shared_ptr vm_data,
    -               std::shared_ptr isolate_name_server)
    -    : settings_(vm_data->GetSettings()),
    -      vm_data_(vm_data),
    -      isolate_name_server_(std::move(isolate_name_server)),
    -      service_protocol_(std::make_shared()) {
    +DartVM::DartVM(const Settings& settings,
    +               fml::RefPtr vm_snapshot,
    +               fml::RefPtr isolate_snapshot,
    +               fml::RefPtr shared_snapshot)
    +    : settings_(settings),
    +      vm_snapshot_(std::move(vm_snapshot)),
    +      isolate_snapshot_(std::move(isolate_snapshot)),
    +      shared_snapshot_(std::move(shared_snapshot)),
    +      weak_factory_(this) {
       TRACE_EVENT0("flutter", "DartVMInitializer");
    -
    -  gVMLaunchCount++;
    -
    -  FML_DCHECK(vm_data_);
    -  FML_DCHECK(isolate_name_server_);
    -  FML_DCHECK(service_protocol_);
    -
       FML_DLOG(INFO) << "Attempting Dart VM launch for mode: "
                      << (IsRunningPrecompiledCode() ? "AOT" : "Interpreter");
     
    @@ -269,8 +286,8 @@ DartVM::DartVM(std::shared_ptr vm_data,
         TRACE_EVENT0("flutter", "dart::bin::BootstrapDartIo");
         dart::bin::BootstrapDartIo();
     
    -    if (!settings_.temp_directory_path.empty()) {
    -      dart::bin::SetSystemTempDirectory(settings_.temp_directory_path.c_str());
    +    if (!settings.temp_directory_path.empty()) {
    +      dart::bin::SetSystemTempDirectory(settings.temp_directory_path.c_str());
         }
       }
     
    @@ -283,7 +300,7 @@ DartVM::DartVM(std::shared_ptr vm_data,
       args.push_back("--ignore-unrecognized-flags");
     
       for (auto* const profiler_flag :
    -       ProfilingFlags(settings_.enable_dart_profiling)) {
    +       ProfilingFlags(settings.enable_dart_profiling)) {
         args.push_back(profiler_flag);
       }
     
    @@ -296,7 +313,7 @@ DartVM::DartVM(std::shared_ptr vm_data,
     
       // Enable Dart assertions if we are not running precompiled code. We run non-
       // precompiled code only in the debug product mode.
    -  bool enable_asserts = !settings_.disable_dart_asserts;
    +  bool enable_asserts = !settings.disable_dart_asserts;
     
     #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_PROFILE || \
         FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE
    @@ -320,24 +337,24 @@ DartVM::DartVM(std::shared_ptr vm_data,
         PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs));
       }
     
    -  if (settings_.start_paused) {
    +  if (settings.start_paused) {
         PushBackAll(&args, kDartStartPausedArgs, arraysize(kDartStartPausedArgs));
       }
     
    -  if (settings_.endless_trace_buffer || settings_.trace_startup) {
    +  if (settings.endless_trace_buffer || settings.trace_startup) {
         // If we are tracing startup, make sure the trace buffer is endless so we
         // don't lose early traces.
         PushBackAll(&args, kDartEndlessTraceBufferArgs,
                     arraysize(kDartEndlessTraceBufferArgs));
       }
     
    -  if (settings_.trace_systrace) {
    +  if (settings.trace_systrace) {
         PushBackAll(&args, kDartSystraceTraceBufferArgs,
                     arraysize(kDartSystraceTraceBufferArgs));
         PushBackAll(&args, kDartTraceStreamsArgs, arraysize(kDartTraceStreamsArgs));
       }
     
    -  if (settings_.trace_startup) {
    +  if (settings.trace_startup) {
         PushBackAll(&args, kDartTraceStartupArgs, arraysize(kDartTraceStartupArgs));
       }
     
    @@ -346,8 +363,8 @@ DartVM::DartVM(std::shared_ptr vm_data,
       PushBackAll(&args, kDartTraceStreamsArgs, arraysize(kDartTraceStreamsArgs));
     #endif
     
    -  for (size_t i = 0; i < settings_.dart_flags.size(); i++)
    -    args.push_back(settings_.dart_flags[i].c_str());
    +  for (size_t i = 0; i < settings.dart_flags.size(); i++)
    +    args.push_back(settings.dart_flags[i].c_str());
     
       char* flags_error = Dart_SetVMFlags(args.size(), args.data());
       if (flags_error) {
    @@ -357,14 +374,14 @@ DartVM::DartVM(std::shared_ptr vm_data,
     
       DartUI::InitForGlobal();
     
    +  Dart_SetFileModifiedCallback(&DartFileModifiedCallback);
    +
       {
         TRACE_EVENT0("flutter", "Dart_Initialize");
         Dart_InitializeParams params = {};
         params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION;
    -    params.vm_snapshot_data =
    -        vm_data_->GetVMSnapshot().GetData()->GetSnapshotPointer();
    -    params.vm_snapshot_instructions =
    -        vm_data_->GetVMSnapshot().GetInstructionsIfPresent();
    +    params.vm_snapshot_data = vm_snapshot_->GetData()->GetSnapshotPointer();
    +    params.vm_snapshot_instructions = vm_snapshot_->GetInstructionsIfPresent();
         params.create = reinterpret_cast(
             DartIsolate::DartIsolateCreateCallback);
         params.shutdown = reinterpret_cast(
    @@ -396,58 +413,59 @@ DartVM::DartVM(std::shared_ptr vm_data,
         }
       }
     
    -  Dart_SetFileModifiedCallback(&DartFileModifiedCallback);
    -
       // Allow streaming of stdout and stderr by the Dart vm.
       Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback,
                                      &ServiceStreamCancelCallback);
     
       Dart_SetEmbedderInformationCallback(&EmbedderInformationCallback);
     
    -  if (settings_.dart_library_sources_kernel != nullptr) {
    +  if (settings.dart_library_sources_kernel != nullptr) {
         std::unique_ptr dart_library_sources =
    -        settings_.dart_library_sources_kernel();
    +        settings.dart_library_sources_kernel();
         // Set sources for dart:* libraries for debugging.
         Dart_SetDartLibrarySourcesKernel(dart_library_sources->GetMapping(),
                                          dart_library_sources->GetSize());
       }
    -
    -  FML_DLOG(INFO) << "New Dart VM instance created. Instance count: "
    -                 << gVMLaunchCount;
     }
     
     DartVM::~DartVM() {
       if (Dart_CurrentIsolate() != nullptr) {
         Dart_ExitIsolate();
       }
    -
       char* result = Dart_Cleanup();
    +  if (result != nullptr) {
    +    FML_LOG(ERROR) << "Could not cleanly shut down the Dart VM. Message: \""
    +                   << result << "\".";
    +    free(result);
    +  }
    +}
     
    -  dart::bin::CleanupDartIo();
    +const Settings& DartVM::GetSettings() const {
    +  return settings_;
    +}
     
    -  FML_CHECK(result == nullptr)
    -      << "Could not cleanly shut down the Dart VM. Error: \"" << result
    -      << "\".";
    -  free(result);
    +const DartSnapshot& DartVM::GetVMSnapshot() const {
    +  return *vm_snapshot_.get();
    +}
     
    -  FML_DLOG(INFO) << "Dart VM instance destroyed. Instance count: "
    -                 << gVMLaunchCount;
    +IsolateNameServer* DartVM::GetIsolateNameServer() {
    +  return &isolate_name_server_;
     }
     
    -std::shared_ptr DartVM::GetVMData() const {
    -  return vm_data_;
    +fml::RefPtr DartVM::GetIsolateSnapshot() const {
    +  return isolate_snapshot_;
     }
     
    -const Settings& DartVM::GetSettings() const {
    -  return settings_;
    +fml::RefPtr DartVM::GetSharedSnapshot() const {
    +  return shared_snapshot_;
     }
     
    -std::shared_ptr DartVM::GetServiceProtocol() const {
    +ServiceProtocol& DartVM::GetServiceProtocol() {
       return service_protocol_;
     }
     
    -std::shared_ptr DartVM::GetIsolateNameServer() const {
    -  return isolate_name_server_;
    +fml::WeakPtr DartVM::GetWeakPtr() {
    +  return weak_factory_.GetWeakPtr();
     }
     
     }  // namespace blink
    diff --git a/runtime/dart_vm.h b/runtime/dart_vm.h
    index 6724abde0b828..2c3ac0e30381e 100644
    --- a/runtime/dart_vm.h
    +++ b/runtime/dart_vm.h
    @@ -5,8 +5,9 @@
     #ifndef FLUTTER_RUNTIME_DART_VM_H_
     #define FLUTTER_RUNTIME_DART_VM_H_
     
    -#include 
    +#include 
     #include 
    +#include 
     
     #include "flutter/common/settings.h"
     #include "flutter/fml/build_config.h"
    @@ -18,46 +19,57 @@
     #include "flutter/lib/ui/isolate_name_server/isolate_name_server.h"
     #include "flutter/runtime/dart_isolate.h"
     #include "flutter/runtime/dart_snapshot.h"
    -#include "flutter/runtime/dart_vm_data.h"
     #include "flutter/runtime/service_protocol.h"
     #include "third_party/dart/runtime/include/dart_api.h"
     
     namespace blink {
     
    -class DartVM {
    +class DartVM : public fml::RefCountedThreadSafe {
      public:
    -  ~DartVM();
    +  static fml::RefPtr ForProcess(Settings settings);
     
    -  static bool IsRunningPrecompiledCode();
    +  static fml::RefPtr ForProcess(
    +      Settings settings,
    +      fml::RefPtr vm_snapshot,
    +      fml::RefPtr isolate_snapshot,
    +      fml::RefPtr shared_snapshot);
    +
    +  static fml::RefPtr ForProcessIfInitialized();
     
    -  static size_t GetVMLaunchCount();
    +  static bool IsRunningPrecompiledCode();
     
       const Settings& GetSettings() const;
     
    -  std::shared_ptr GetVMData() const;
    +  const DartSnapshot& GetVMSnapshot() const;
     
    -  std::shared_ptr GetServiceProtocol() const;
    +  IsolateNameServer* GetIsolateNameServer();
     
    -  std::shared_ptr GetIsolateNameServer() const;
    +  fml::RefPtr GetIsolateSnapshot() const;
     
    - private:
    -  const Settings settings_;
    -  std::shared_ptr vm_data_;
    -  const std::shared_ptr isolate_name_server_;
    -  const std::shared_ptr service_protocol_;
    +  fml::RefPtr GetSharedSnapshot() const;
     
    -  friend class DartVMRef;
    +  fml::WeakPtr GetWeakPtr();
     
    -  static std::shared_ptr Create(
    -      Settings settings,
    -      fml::RefPtr vm_snapshot,
    -      fml::RefPtr isolate_snapshot,
    -      fml::RefPtr shared_snapshot,
    -      std::shared_ptr isolate_name_server);
    +  ServiceProtocol& GetServiceProtocol();
     
    -  DartVM(std::shared_ptr data,
    -         std::shared_ptr isolate_name_server);
    + private:
    +  const Settings settings_;
    +  const fml::RefPtr vm_snapshot_;
    +  IsolateNameServer isolate_name_server_;
    +  const fml::RefPtr isolate_snapshot_;
    +  const fml::RefPtr shared_snapshot_;
    +  ServiceProtocol service_protocol_;
    +  fml::WeakPtrFactory weak_factory_;
    +
    +  DartVM(const Settings& settings,
    +         fml::RefPtr vm_snapshot,
    +         fml::RefPtr isolate_snapshot,
    +         fml::RefPtr shared_snapshot);
    +
    +  ~DartVM();
     
    +  FML_FRIEND_REF_COUNTED_THREAD_SAFE(DartVM);
    +  FML_FRIEND_MAKE_REF_COUNTED(DartVM);
       FML_DISALLOW_COPY_AND_ASSIGN(DartVM);
     };
     
    diff --git a/runtime/dart_vm_data.cc b/runtime/dart_vm_data.cc
    deleted file mode 100644
    index a29074f79c92e..0000000000000
    --- a/runtime/dart_vm_data.cc
    +++ /dev/null
    @@ -1,79 +0,0 @@
    -// Copyright 2013 The Flutter 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_vm_data.h"
    -
    -namespace blink {
    -
    -std::shared_ptr DartVMData::Create(
    -    Settings settings,
    -    fml::RefPtr vm_snapshot,
    -    fml::RefPtr isolate_snapshot,
    -    fml::RefPtr shared_snapshot) {
    -  if (!vm_snapshot || !vm_snapshot->IsValid()) {
    -    // Caller did not provide a valid VM snapshot. Attempt to infer one
    -    // from the settings.
    -    vm_snapshot = DartSnapshot::VMSnapshotFromSettings(settings);
    -    if (!vm_snapshot) {
    -      FML_LOG(ERROR)
    -          << "VM snapshot invalid and could not be inferred from settings.";
    -      return {};
    -    }
    -  }
    -
    -  if (!isolate_snapshot || !isolate_snapshot->IsValid()) {
    -    // Caller did not provide a valid isolate snapshot. Attempt to infer one
    -    // from the settings.
    -    isolate_snapshot = DartSnapshot::IsolateSnapshotFromSettings(settings);
    -    if (!isolate_snapshot) {
    -      FML_LOG(ERROR) << "Isolate snapshot invalid and could not be inferred "
    -                        "from settings.";
    -      return {};
    -    }
    -  }
    -
    -  if (!shared_snapshot || !shared_snapshot->IsValid()) {
    -    shared_snapshot = DartSnapshot::Empty();
    -    if (!shared_snapshot) {
    -      FML_LOG(ERROR) << "Shared snapshot invalid.";
    -      return {};
    -    }
    -  }
    -
    -  return std::shared_ptr(new DartVMData(
    -      std::move(settings),          //
    -      std::move(vm_snapshot),       //
    -      std::move(isolate_snapshot),  //
    -      std::move(shared_snapshot)    //
    -      ));
    -}
    -
    -DartVMData::DartVMData(Settings settings,
    -                       fml::RefPtr vm_snapshot,
    -                       fml::RefPtr isolate_snapshot,
    -                       fml::RefPtr shared_snapshot)
    -    : settings_(settings),
    -      vm_snapshot_(vm_snapshot),
    -      isolate_snapshot_(isolate_snapshot),
    -      shared_snapshot_(shared_snapshot) {}
    -
    -DartVMData::~DartVMData() = default;
    -
    -const Settings& DartVMData::GetSettings() const {
    -  return settings_;
    -}
    -
    -const DartSnapshot& DartVMData::GetVMSnapshot() const {
    -  return *vm_snapshot_;
    -}
    -
    -fml::RefPtr DartVMData::GetIsolateSnapshot() const {
    -  return isolate_snapshot_;
    -}
    -
    -fml::RefPtr DartVMData::GetSharedSnapshot() const {
    -  return shared_snapshot_;
    -}
    -
    -}  // namespace blink
    diff --git a/runtime/dart_vm_data.h b/runtime/dart_vm_data.h
    deleted file mode 100644
    index 906cad1a4ca05..0000000000000
    --- a/runtime/dart_vm_data.h
    +++ /dev/null
    @@ -1,47 +0,0 @@
    -// Copyright 2013 The Flutter 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_VM_DATA_H_
    -#define FLUTTER_RUNTIME_DART_VM_DATA_H_
    -
    -#include "flutter/fml/macros.h"
    -#include "flutter/runtime/dart_snapshot.h"
    -
    -namespace blink {
    -
    -class DartVMData {
    - public:
    -  static std::shared_ptr Create(
    -      Settings settings,
    -      fml::RefPtr vm_snapshot,
    -      fml::RefPtr isolate_snapshot,
    -      fml::RefPtr shared_snapshot);
    -
    -  ~DartVMData();
    -
    -  const Settings& GetSettings() const;
    -
    -  const DartSnapshot& GetVMSnapshot() const;
    -
    -  fml::RefPtr GetIsolateSnapshot() const;
    -
    -  fml::RefPtr GetSharedSnapshot() const;
    -
    - private:
    -  const Settings settings_;
    -  const fml::RefPtr vm_snapshot_;
    -  const fml::RefPtr isolate_snapshot_;
    -  const fml::RefPtr shared_snapshot_;
    -
    -  DartVMData(Settings settings,
    -             fml::RefPtr vm_snapshot,
    -             fml::RefPtr isolate_snapshot,
    -             fml::RefPtr shared_snapshot);
    -
    -  FML_DISALLOW_COPY_AND_ASSIGN(DartVMData);
    -};
    -
    -}  // namespace blink
    -
    -#endif  // FLUTTER_RUNTIME_DART_VM_DATA_H_
    diff --git a/runtime/dart_vm_lifecycle.cc b/runtime/dart_vm_lifecycle.cc
    deleted file mode 100644
    index 1ed86e0250c4b..0000000000000
    --- a/runtime/dart_vm_lifecycle.cc
    +++ /dev/null
    @@ -1,117 +0,0 @@
    -// Copyright 2013 The Flutter 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_vm_lifecycle.h"
    -
    -#include 
    -
    -namespace blink {
    -
    -// We need to explicitly put the constructor and destructor of the DartVM in the
    -// critical section. All accesses (not just const members) to the global VM
    -// object weak pointer are behind this mutex.
    -static std::mutex gVMMutex;
    -static std::weak_ptr gVM FML_GUARDED_BY(gVMMutex);
    -static std::shared_ptr gVMLeak FML_GUARDED_BY(gVMMutex);
    -
    -// We are going to be modifying more than just the control blocks of the
    -// following weak pointers (in the |Create| case where an old VM could not be
    -// reused). Ideally, we would use |std::atomic>| specialization
    -// but that is only available since C++20. We don't expect contention on these
    -// locks so we just use one mutex for all.
    -static std::mutex gVMDependentsMutex;
    -static std::weak_ptr gVMData
    -    FML_GUARDED_BY(gVMDependentsMutex);
    -static std::weak_ptr gVMServiceProtocol
    -    FML_GUARDED_BY(gVMDependentsMutex);
    -static std::weak_ptr gVMIsolateNameServer
    -    FML_GUARDED_BY(gVMDependentsMutex);
    -
    -DartVMRef::DartVMRef(std::shared_ptr vm) : vm_(vm) {}
    -
    -DartVMRef::DartVMRef(DartVMRef&& other) = default;
    -
    -DartVMRef::~DartVMRef() {
    -  if (!vm_) {
    -    // If there is no valid VM (possible via a move), there is no way that the
    -    // decrement on the shared pointer can cause a collection. Avoid acquiring
    -    // the lifecycle lock in this case. This is just working around a
    -    // pessimization and not required for correctness.
    -    return;
    -  }
    -  std::lock_guard lifecycle_lock(gVMMutex);
    -  vm_.reset();
    -}
    -
    -DartVMRef DartVMRef::Create(Settings settings,
    -                            fml::RefPtr vm_snapshot,
    -                            fml::RefPtr isolate_snapshot,
    -                            fml::RefPtr shared_snapshot) {
    -  std::lock_guard lifecycle_lock(gVMMutex);
    -
    -  // If there is already a running VM in the process, grab a strong reference to
    -  // it.
    -  if (auto vm = gVM.lock()) {
    -    FML_DLOG(WARNING) << "Attempted to create a VM in a process where one was "
    -                         "already running. Ignoring arguments for current VM "
    -                         "create call and reusing the old VM.";
    -    // There was already a running VM in the process,
    -    return DartVMRef{std::move(vm)};
    -  }
    -
    -  std::lock_guard dependents_lock(gVMDependentsMutex);
    -
    -  gVMData.reset();
    -  gVMServiceProtocol.reset();
    -  gVMIsolateNameServer.reset();
    -  gVM.reset();
    -
    -  // If there is no VM in the process. Initialize one, hold the weak reference
    -  // and pass a strong reference to the caller.
    -  auto isolate_name_server = std::make_shared();
    -  auto vm = DartVM::Create(std::move(settings),          //
    -                           std::move(vm_snapshot),       //
    -                           std::move(isolate_snapshot),  //
    -                           std::move(shared_snapshot),   //
    -                           isolate_name_server           //
    -  );
    -
    -  if (!vm) {
    -    FML_LOG(ERROR) << "Could not create Dart VM instance.";
    -    return {nullptr};
    -  }
    -
    -  gVMData = vm->GetVMData();
    -  gVMServiceProtocol = vm->GetServiceProtocol();
    -  gVMIsolateNameServer = isolate_name_server;
    -  gVM = vm;
    -
    -  if (settings.leak_vm) {
    -    gVMLeak = vm;
    -  }
    -
    -  return DartVMRef{std::move(vm)};
    -}
    -
    -bool DartVMRef::IsInstanceRunning() {
    -  std::lock_guard lock(gVMMutex);
    -  return !gVM.expired();
    -}
    -
    -std::shared_ptr DartVMRef::GetVMData() {
    -  std::lock_guard lock(gVMDependentsMutex);
    -  return gVMData.lock();
    -}
    -
    -std::shared_ptr DartVMRef::GetServiceProtocol() {
    -  std::lock_guard lock(gVMDependentsMutex);
    -  return gVMServiceProtocol.lock();
    -}
    -
    -std::shared_ptr DartVMRef::GetIsolateNameServer() {
    -  std::lock_guard lock(gVMDependentsMutex);
    -  return gVMIsolateNameServer.lock();
    -}
    -
    -}  // namespace blink
    diff --git a/runtime/dart_vm_lifecycle.h b/runtime/dart_vm_lifecycle.h
    deleted file mode 100644
    index cfe1f1b646469..0000000000000
    --- a/runtime/dart_vm_lifecycle.h
    +++ /dev/null
    @@ -1,72 +0,0 @@
    -// Copyright 2013 The Flutter 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_VM_LIFECYCLE_H_
    -#define FLUTTER_RUNTIME_DART_VM_LIFECYCLE_H_
    -
    -#include 
    -
    -#include "flutter/fml/macros.h"
    -#include "flutter/lib/ui/isolate_name_server/isolate_name_server.h"
    -#include "flutter/runtime/dart_vm.h"
    -#include "flutter/runtime/service_protocol.h"
    -
    -namespace blink {
    -
    -// A strong reference to the Dart VM. There can only be one VM running in the
    -// process at any given time. A reference to the VM may only be obtained via the
    -// |Create| method. In case there is already a running instance of the VM in the
    -// process, a strong reference to that VM is obtained and the arguments to the
    -// |Create| call ignored. If there is no VM already running in the process, a VM
    -// is initialized in a thread safe manner and returned to the caller. The VM
    -// will shutdown only when all callers relinquish their references (by
    -// collecting their instances of this class).
    -//
    -// DartVMRef instances may be created on any thread.
    -class DartVMRef {
    - public:
    -  FML_WARN_UNUSED_RESULT
    -  static DartVMRef Create(Settings settings,
    -                          fml::RefPtr vm_snapshot = nullptr,
    -                          fml::RefPtr isolate_snapshot = nullptr,
    -                          fml::RefPtr shared_snapshot = nullptr);
    -
    -  DartVMRef(DartVMRef&&);
    -
    -  ~DartVMRef();
    -
    -  // This is an inherently racy way to check if a VM instance is running and
    -  // should not be used outside of unit-tests where there is a known threading
    -  // model.
    -  static bool IsInstanceRunning();
    -
    -  static std::shared_ptr GetVMData();
    -
    -  static std::shared_ptr GetServiceProtocol();
    -
    -  static std::shared_ptr GetIsolateNameServer();
    -
    -  operator bool() const { return static_cast(vm_); }
    -
    -  DartVM* operator->() {
    -    FML_DCHECK(vm_);
    -    return vm_.get();
    -  }
    -
    -  DartVM* operator&() {
    -    FML_DCHECK(vm_);
    -    return vm_.get();
    -  }
    -
    - private:
    -  std::shared_ptr vm_;
    -
    -  DartVMRef(std::shared_ptr vm);
    -
    -  FML_DISALLOW_COPY_AND_ASSIGN(DartVMRef);
    -};
    -
    -}  // namespace blink
    -
    -#endif  // FLUTTER_RUNTIME_DART_VM_LIFECYCLE_H_
    diff --git a/runtime/dart_vm_unittests.cc b/runtime/dart_vm_unittests.cc
    index 2c143432b5b74..a0cfdfbbc5f71 100644
    --- a/runtime/dart_vm_unittests.cc
    +++ b/runtime/dart_vm_unittests.cc
    @@ -3,7 +3,6 @@
     // found in the LICENSE file.
     
     #include "flutter/runtime/dart_vm.h"
    -#include "flutter/runtime/dart_vm_lifecycle.h"
     #include "gtest/gtest.h"
     
     namespace blink {
    @@ -12,17 +11,16 @@ TEST(DartVM, SimpleInitialization) {
       Settings settings = {};
       settings.task_observer_add = [](intptr_t, fml::closure) {};
       settings.task_observer_remove = [](intptr_t) {};
    -  auto vm = DartVMRef::Create(settings);
    +  auto vm = DartVM::ForProcess(settings);
       ASSERT_TRUE(vm);
    +  ASSERT_EQ(vm, DartVM::ForProcess(settings));
     }
     
     TEST(DartVM, SimpleIsolateNameServer) {
       Settings settings = {};
       settings.task_observer_add = [](intptr_t, fml::closure) {};
       settings.task_observer_remove = [](intptr_t) {};
    -  auto vm = DartVMRef::Create(settings);
    -  ASSERT_TRUE(vm);
    -  ASSERT_TRUE(vm.GetVMData());
    +  auto vm = DartVM::ForProcess(settings);
       auto ns = vm->GetIsolateNameServer();
       ASSERT_EQ(ns->LookupIsolatePortByName("foobar"), ILLEGAL_PORT);
       ASSERT_FALSE(ns->RemoveIsolateNameMapping("foobar"));
    diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc
    index e1aaf51de829f..83a848e87955c 100644
    --- a/runtime/runtime_controller.cc
    +++ b/runtime/runtime_controller.cc
    @@ -17,8 +17,8 @@ namespace blink {
     RuntimeController::RuntimeController(
         RuntimeDelegate& p_client,
         DartVM* p_vm,
    -    fml::RefPtr p_isolate_snapshot,
    -    fml::RefPtr p_shared_snapshot,
    +    fml::RefPtr p_isolate_snapshot,
    +    fml::RefPtr p_shared_snapshot,
         TaskRunners p_task_runners,
         fml::WeakPtr p_snapshot_delegate,
         fml::WeakPtr p_io_manager,
    @@ -40,8 +40,8 @@ RuntimeController::RuntimeController(
     RuntimeController::RuntimeController(
         RuntimeDelegate& p_client,
         DartVM* p_vm,
    -    fml::RefPtr p_isolate_snapshot,
    -    fml::RefPtr p_shared_snapshot,
    +    fml::RefPtr p_isolate_snapshot,
    +    fml::RefPtr p_shared_snapshot,
         TaskRunners p_task_runners,
         fml::WeakPtr p_snapshot_delegate,
         fml::WeakPtr p_io_manager,
    @@ -61,7 +61,7 @@ RuntimeController::RuntimeController(
           idle_notification_callback_(idle_notification_callback),
           window_data_(std::move(p_window_data)),
           root_isolate_(
    -          DartIsolate::CreateRootIsolate(vm_->GetVMData()->GetSettings(),
    +          DartIsolate::CreateRootIsolate(vm_,
                                              isolate_snapshot_,
                                              shared_snapshot_,
                                              task_runners_,
    diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h
    index 79d020ed38375..03f1389d8c613 100644
    --- a/runtime/runtime_controller.h
    +++ b/runtime/runtime_controller.h
    @@ -30,8 +30,8 @@ class RuntimeController final : public WindowClient {
      public:
       RuntimeController(RuntimeDelegate& client,
                         DartVM* vm,
    -                    fml::RefPtr isolate_snapshot,
    -                    fml::RefPtr shared_snapshot,
    +                    fml::RefPtr isolate_snapshot,
    +                    fml::RefPtr shared_snapshot,
                         TaskRunners task_runners,
                         fml::WeakPtr snapshot_delegate,
                         fml::WeakPtr io_manager,
    @@ -121,8 +121,8 @@ class RuntimeController final : public WindowClient {
     
       RuntimeDelegate& client_;
       DartVM* const vm_;
    -  fml::RefPtr isolate_snapshot_;
    -  fml::RefPtr shared_snapshot_;
    +  fml::RefPtr isolate_snapshot_;
    +  fml::RefPtr shared_snapshot_;
       TaskRunners task_runners_;
       fml::WeakPtr snapshot_delegate_;
       fml::WeakPtr io_manager_;
    @@ -135,8 +135,8 @@ class RuntimeController final : public WindowClient {
     
       RuntimeController(RuntimeDelegate& client,
                         DartVM* vm,
    -                    fml::RefPtr isolate_snapshot,
    -                    fml::RefPtr shared_snapshot,
    +                    fml::RefPtr isolate_snapshot,
    +                    fml::RefPtr shared_snapshot,
                         TaskRunners task_runners,
                         fml::WeakPtr snapshot_delegate,
                         fml::WeakPtr io_manager,
    diff --git a/shell/common/engine.cc b/shell/common/engine.cc
    index f1c215570df2f..5b2d5a5c3dd37 100644
    --- a/shell/common/engine.cc
    +++ b/shell/common/engine.cc
    @@ -37,8 +37,8 @@ static constexpr char kSettingsChannel[] = "flutter/settings";
     
     Engine::Engine(Delegate& delegate,
                    blink::DartVM& vm,
    -               fml::RefPtr isolate_snapshot,
    -               fml::RefPtr shared_snapshot,
    +               fml::RefPtr isolate_snapshot,
    +               fml::RefPtr shared_snapshot,
                    blink::TaskRunners task_runners,
                    blink::Settings settings,
                    std::unique_ptr animator,
    diff --git a/shell/common/engine.h b/shell/common/engine.h
    index 22160cb7ee3c9..b390b36a2b197 100644
    --- a/shell/common/engine.h
    +++ b/shell/common/engine.h
    @@ -56,8 +56,8 @@ class Engine final : public blink::RuntimeDelegate {
     
       Engine(Delegate& delegate,
              blink::DartVM& vm,
    -         fml::RefPtr isolate_snapshot,
    -         fml::RefPtr shared_snapshot,
    +         fml::RefPtr isolate_snapshot,
    +         fml::RefPtr shared_snapshot,
              blink::TaskRunners task_runners,
              blink::Settings settings,
              std::unique_ptr animator,
    diff --git a/shell/common/shell.cc b/shell/common/shell.cc
    index 3c824ae8e0c02..4d2dcc0d137a6 100644
    --- a/shell/common/shell.cc
    +++ b/shell/common/shell.cc
    @@ -36,20 +36,17 @@ namespace shell {
     constexpr char kSkiaChannel[] = "flutter/skia";
     
     std::unique_ptr Shell::CreateShellOnPlatformThread(
    -    blink::DartVMRef vm,
         blink::TaskRunners task_runners,
         blink::Settings settings,
    -    fml::RefPtr isolate_snapshot,
    -    fml::RefPtr shared_snapshot,
    +    fml::RefPtr isolate_snapshot,
    +    fml::RefPtr shared_snapshot,
         Shell::CreateCallback on_create_platform_view,
         Shell::CreateCallback on_create_rasterizer) {
       if (!task_runners.IsValid()) {
    -    FML_LOG(ERROR) << "Task runners to run the shell were invalid.";
         return nullptr;
       }
     
    -  auto shell =
    -      std::unique_ptr(new Shell(std::move(vm), task_runners, settings));
    +  auto shell = std::unique_ptr(new Shell(task_runners, settings));
     
       // Create the platform view on the platform thread (this thread).
       auto platform_view = on_create_platform_view(*shell.get());
    @@ -78,7 +75,6 @@ std::unique_ptr Shell::CreateShellOnPlatformThread(
            &platform_view,  //
            io_task_runner   //
       ]() {
    -        TRACE_EVENT0("flutter", "ShellSetupIOSubsystem");
             io_manager = std::make_unique(
                 platform_view->CreateResourceContext(), io_task_runner);
             io_latch.Signal();
    @@ -96,7 +92,6 @@ std::unique_ptr Shell::CreateShellOnPlatformThread(
                                             shell = shell.get(),   //
                                             &snapshot_delegate     //
       ]() {
    -        TRACE_EVENT0("flutter", "ShellSetupGPUSubsystem");
             if (auto new_rasterizer = on_create_rasterizer(*shell)) {
               rasterizer = std::move(new_rasterizer);
               snapshot_delegate = rasterizer->GetSnapshotDelegate();
    @@ -120,7 +115,6 @@ std::unique_ptr Shell::CreateShellOnPlatformThread(
                              snapshot_delegate = std::move(snapshot_delegate),  //
                              io_manager = io_manager->GetWeakPtr()              //
       ]() mutable {
    -        TRACE_EVENT0("flutter", "ShellSetupUISubsystem");
             const auto& task_runners = shell->GetTaskRunners();
     
             // The animator is owned by the UI thread but it gets its vsync pulses
    @@ -129,7 +123,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread(
                                                        std::move(vsync_waiter));
     
             engine = std::make_unique(*shell,                        //
    -                                          *shell->GetDartVM(),           //
    +                                          shell->GetDartVM(),            //
                                               std::move(isolate_snapshot),   //
                                               std::move(shared_snapshot),    //
                                               task_runners,                  //
    @@ -212,35 +206,26 @@ std::unique_ptr Shell::Create(
         Shell::CreateCallback on_create_rasterizer) {
       PerformInitializationTasks(settings);
     
    -  TRACE_EVENT0("flutter", "Shell::Create");
    -
    -  auto vm = blink::DartVMRef::Create(settings);
    +  auto vm = blink::DartVM::ForProcess(settings);
       FML_CHECK(vm) << "Must be able to initialize the VM.";
    -
    -  auto vm_data = vm->GetVMData();
    -
       return Shell::Create(std::move(task_runners),             //
                            std::move(settings),                 //
    -                       vm_data->GetIsolateSnapshot(),       // isolate snapshot
    -                       blink::DartSnapshot::Empty(),        // shared snapshot
    +                       vm->GetIsolateSnapshot(),            //
    +                       blink::DartSnapshot::Empty(),        //
                            std::move(on_create_platform_view),  //
    -                       std::move(on_create_rasterizer),     //
    -                       std::move(vm)                        //
    +                       std::move(on_create_rasterizer)      //
       );
     }
     
     std::unique_ptr Shell::Create(
         blink::TaskRunners task_runners,
         blink::Settings settings,
    -    fml::RefPtr isolate_snapshot,
    -    fml::RefPtr shared_snapshot,
    +    fml::RefPtr isolate_snapshot,
    +    fml::RefPtr shared_snapshot,
         Shell::CreateCallback on_create_platform_view,
    -    Shell::CreateCallback on_create_rasterizer,
    -    blink::DartVMRef vm) {
    +    Shell::CreateCallback on_create_rasterizer) {
       PerformInitializationTasks(settings);
     
    -  TRACE_EVENT0("flutter", "Shell::CreateWithSnapshots");
    -
       if (!task_runners.IsValid() || !on_create_platform_view ||
           !on_create_rasterizer) {
         return nullptr;
    @@ -250,18 +235,16 @@ std::unique_ptr Shell::Create(
       std::unique_ptr shell;
       fml::TaskRunner::RunNowOrPostTask(
           task_runners.GetPlatformTaskRunner(),
    -      fml::MakeCopyable([&latch,                                          //
    -                         vm = std::move(vm),                              //
    -                         &shell,                                          //
    -                         task_runners = std::move(task_runners),          //
    -                         settings,                                        //
    -                         isolate_snapshot = std::move(isolate_snapshot),  //
    -                         shared_snapshot = std::move(shared_snapshot),    //
    -                         on_create_platform_view,                         //
    -                         on_create_rasterizer                             //
    -  ]() mutable {
    -        shell = CreateShellOnPlatformThread(std::move(vm),
    -                                            std::move(task_runners),      //
    +      [&latch,                                          //
    +       &shell,                                          //
    +       task_runners = std::move(task_runners),          //
    +       settings,                                        //
    +       isolate_snapshot = std::move(isolate_snapshot),  //
    +       shared_snapshot = std::move(shared_snapshot),    //
    +       on_create_platform_view,                         //
    +       on_create_rasterizer                             //
    +  ]() {
    +        shell = CreateShellOnPlatformThread(std::move(task_runners),      //
                                                 settings,                     //
                                                 std::move(isolate_snapshot),  //
                                                 std::move(shared_snapshot),   //
    @@ -269,18 +252,15 @@ std::unique_ptr Shell::Create(
                                                 on_create_rasterizer          //
             );
             latch.Signal();
    -      }));
    +      });
       latch.Wait();
       return shell;
     }
     
    -Shell::Shell(blink::DartVMRef vm,
    -             blink::TaskRunners task_runners,
    -             blink::Settings settings)
    +Shell::Shell(blink::TaskRunners task_runners, blink::Settings settings)
         : task_runners_(std::move(task_runners)),
           settings_(std::move(settings)),
    -      vm_(std::move(vm)) {
    -  FML_CHECK(vm_) << "Must have access to VM to create a shell.";
    +      vm_(blink::DartVM::ForProcess(settings_)) {
       FML_DCHECK(task_runners_.IsValid());
       FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread());
     
    @@ -322,7 +302,9 @@ Shell::~Shell() {
       PersistentCache::GetCacheForProcess()->RemoveWorkerTaskRunner(
           task_runners_.GetIOTaskRunner());
     
    -  vm_->GetServiceProtocol()->RemoveHandler(this);
    +  if (auto vm = blink::DartVM::ForProcessIfInitialized()) {
    +    vm->GetServiceProtocol().RemoveHandler(this);
    +  }
     
       fml::AutoResetWaitableEvent ui_latch, gpu_latch, platform_latch, io_latch;
     
    @@ -393,7 +375,9 @@ bool Shell::Setup(std::unique_ptr platform_view,
     
       is_setup_ = true;
     
    -  vm_->GetServiceProtocol()->AddHandler(this, GetServiceProtocolDescription());
    +  if (auto vm = blink::DartVM::ForProcessIfInitialized()) {
    +    vm->GetServiceProtocol().AddHandler(this, GetServiceProtocolDescription());
    +  }
     
       PersistentCache::GetCacheForProcess()->AddWorkerTaskRunner(
           task_runners_.GetIOTaskRunner());
    @@ -427,13 +411,12 @@ fml::WeakPtr Shell::GetPlatformView() {
       return platform_view_->GetWeakPtr();
     }
     
    -blink::DartVM* Shell::GetDartVM() {
    -  return &vm_;
    +blink::DartVM& Shell::GetDartVM() const {
    +  return *vm_;
     }
     
     // |shell::PlatformView::Delegate|
     void Shell::OnPlatformViewCreated(std::unique_ptr surface) {
    -  TRACE_EVENT0("flutter", "Shell::OnPlatformViewCreated");
       FML_DCHECK(is_setup_);
       FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread());
     
    @@ -517,7 +500,6 @@ void Shell::OnPlatformViewCreated(std::unique_ptr surface) {
     
     // |shell::PlatformView::Delegate|
     void Shell::OnPlatformViewDestroyed() {
    -  TRACE_EVENT0("flutter", "Shell::OnPlatformViewDestroyed");
       FML_DCHECK(is_setup_);
       FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread());
     
    @@ -878,8 +860,10 @@ void Shell::OnPreEngineRestart() {
     // |shell::Engine::Delegate|
     void Shell::UpdateIsolateDescription(const std::string isolate_name,
                                          int64_t isolate_port) {
    -  Handler::Description description(isolate_port, isolate_name);
    -  vm_->GetServiceProtocol()->SetHandlerDescription(this, description);
    +  if (auto vm = blink::DartVM::ForProcessIfInitialized()) {
    +    Handler::Description description(isolate_port, isolate_name);
    +    vm->GetServiceProtocol().SetHandlerDescription(this, description);
    +  }
     }
     
     // |blink::ServiceProtocol::Handler|
    diff --git a/shell/common/shell.h b/shell/common/shell.h
    index 864235473c934..17b0f170561d5 100644
    --- a/shell/common/shell.h
    +++ b/shell/common/shell.h
    @@ -23,7 +23,6 @@
     #include "flutter/lib/ui/semantics/custom_accessibility_action.h"
     #include "flutter/lib/ui/semantics/semantics_node.h"
     #include "flutter/lib/ui/window/platform_message.h"
    -#include "flutter/runtime/dart_vm_lifecycle.h"
     #include "flutter/runtime/service_protocol.h"
     #include "flutter/shell/common/animator.h"
     #include "flutter/shell/common/engine.h"
    @@ -55,11 +54,10 @@ class Shell final : public PlatformView::Delegate,
       static std::unique_ptr Create(
           blink::TaskRunners task_runners,
           blink::Settings settings,
    -      fml::RefPtr isolate_snapshot,
    -      fml::RefPtr shared_snapshot,
    +      fml::RefPtr isolate_snapshot,
    +      fml::RefPtr shared_snapshot,
           CreateCallback on_create_platform_view,
    -      CreateCallback on_create_rasterizer,
    -      blink::DartVMRef vm);
    +      CreateCallback on_create_rasterizer);
     
       ~Shell();
     
    @@ -73,7 +71,7 @@ class Shell final : public PlatformView::Delegate,
     
       fml::WeakPtr GetPlatformView();
     
    -  blink::DartVM* GetDartVM();
    +  blink::DartVM& GetDartVM() const;
     
       bool IsSetup() const;
     
    @@ -87,7 +85,7 @@ class Shell final : public PlatformView::Delegate,
     
       const blink::TaskRunners task_runners_;
       const blink::Settings settings_;
    -  blink::DartVMRef vm_;
    +  fml::RefPtr vm_;
       std::unique_ptr platform_view_;  // on platform task runner
       std::unique_ptr engine_;               // on UI task runner
       std::unique_ptr rasterizer_;       // on GPU task runner
    @@ -100,19 +98,16 @@ class Shell final : public PlatformView::Delegate,
                          >
           service_protocol_handlers_;
       bool is_setup_ = false;
    +
       uint64_t next_pointer_flow_id_ = 0;
     
       Shell(blink::TaskRunners task_runners, blink::Settings settings);
    -  Shell(blink::DartVMRef vm,
    -        blink::TaskRunners task_runners,
    -        blink::Settings settings);
     
       static std::unique_ptr CreateShellOnPlatformThread(
    -      blink::DartVMRef vm,
           blink::TaskRunners task_runners,
           blink::Settings settings,
    -      fml::RefPtr isolate_snapshot,
    -      fml::RefPtr shared_snapshot,
    +      fml::RefPtr isolate_snapshot,
    +      fml::RefPtr shared_snapshot,
           Shell::CreateCallback on_create_platform_view,
           Shell::CreateCallback on_create_rasterizer);
     
    diff --git a/testing/testing.cc b/testing/testing.cc
    index c738219541452..93e135e7ab43d 100644
    --- a/testing/testing.cc
    +++ b/testing/testing.cc
    @@ -6,8 +6,6 @@
     
     namespace testing {
     
    -std::string GetCurrentTestName() {
    -  return UnitTest::GetInstance()->current_test_info()->name();
    -}
    +//
     
     }  // namespace testing
    diff --git a/testing/testing.h b/testing/testing.h
    index 0662055fea502..dac2d229b9169 100644
    --- a/testing/testing.h
    +++ b/testing/testing.h
    @@ -5,8 +5,6 @@
     #ifndef TESTING_TESTING_H_
     #define TESTING_TESTING_H_
     
    -#include 
    -
     #include "gtest/gtest.h"
     
     namespace testing {
    @@ -16,8 +14,6 @@ namespace testing {
     // error.
     const char* GetFixturesPath();
     
    -std::string GetCurrentTestName();
    -
     }  // namespace testing
     
     #endif  // TESTING_TESTING_H_
    
    From 853ac1bdfac1817abecf173d803cc44952d4c6d1 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Tue, 2 Apr 2019 12:29:58 -0400
    Subject: [PATCH 0667/1117] Roll src/third_party/skia
     70d8f4f3acbb..f2d9b865d736 (11 commits) (#8408)
    
    https://skia.googlesource.com/skia.git/%2Blog/70d8f4f3acbb..f2d9b865d736
    
    git log 70d8f4f3acbbbc6fbce0e1f1753ba475f2c52dac..f2d9b865d73631d0052a323558b3c083f7e05188 --date=short --no-merges --format=%ad %ae %s
    2019-03-28 mtklein@google.com Add basic fm_bot script
    2019-04-02 brianosman@google.com Remove SkScalarSinCos
    2019-04-02 bsalomon@google.com Make GrVkGpuCommandBuffer::CopyInfo hold source as pending read.
    2019-04-02 reed@google.com add mtklein to api approvals
    2019-04-01 mtklein@google.com remove SkColorFilter::onMakeComposed()
    2019-04-02 reed@google.com remove double compose: lerp and mode
    2019-04-01 bungeman@google.com Clean up shaper handler.
    2019-04-02 fmalita@chromium.org [skottie] Initial gradient ramp effect support
    2019-04-01 mvujovic@adobe.com Inset blur domain a tiny bit to prevent certain GPUs from sampling transparent black from scratch textures.
    2019-04-02 brianosman@google.com Revert "Remove the NullGL interface (and associated test context)"
    2019-04-01 reed@google.com remove asComponentTable introspection method
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 5 ++++-
     2 files changed, 5 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index ea2c0398d1a3a..b6eecdf8746b2 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': '70d8f4f3acbbbc6fbce0e1f1753ba475f2c52dac',
    +  'skia_revision': 'f2d9b865d73631d0052a323558b3c083f7e05188',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index acf276ac7a55c..e2410207b034a 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 9dc1569e557e981bad887bab6ab265e9
    +Signature: 6928cdbcf2200936c961f80cf7e741cc
     
     UNUSED LICENSES:
     
    @@ -1291,6 +1291,8 @@ FILE: ../../../third_party/skia/src/gpu/effects/GrShadowGeoProc.h
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLBuffer.cpp
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLBuffer.h
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLGpuCommandBuffer.h
    +FILE: ../../../third_party/skia/src/gpu/gl/GrGLTestInterface.cpp
    +FILE: ../../../third_party/skia/src/gpu/gl/GrGLTestInterface.h
     FILE: ../../../third_party/skia/src/gpu/gl/glfw/GrGLMakeNativeInterface_glfw.cpp
     FILE: ../../../third_party/skia/src/gpu/glsl/GrGLSLColorSpaceXformHelper.h
     FILE: ../../../third_party/skia/src/gpu/glsl/GrGLSLProgramDataManager.cpp
    @@ -2921,6 +2923,7 @@ FILE: ../../../third_party/skia/src/gpu/GrStencilAttachment.h
     FILE: ../../../third_party/skia/src/gpu/GrStencilSettings.cpp
     FILE: ../../../third_party/skia/src/gpu/GrTexture.cpp
     FILE: ../../../third_party/skia/src/gpu/SkGpuDevice.cpp
    +FILE: ../../../third_party/skia/src/gpu/gl/GrGLCreateNullInterface.cpp
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLDefines.h
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLGLSL.cpp
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLGLSL.h
    
    From f27c5730ae83c014e3d494811ae976a594a086ed Mon Sep 17 00:00:00 2001
    From: Zachary Anderson 
    Date: Tue, 2 Apr 2019 09:49:14 -0700
    Subject: [PATCH 0668/1117] [fuchsia] Exclude glfw from the Fuchsia host build
     (#8407)
    
    ---
     shell/platform/BUILD.gn | 11 ++++++++---
     1 file changed, 8 insertions(+), 3 deletions(-)
    
    diff --git a/shell/platform/BUILD.gn b/shell/platform/BUILD.gn
    index c3bd7569c22d9..aed4d561d62f6 100644
    --- a/shell/platform/BUILD.gn
    +++ b/shell/platform/BUILD.gn
    @@ -12,9 +12,14 @@ group("platform") {
           "android",
         ]
       } else if (is_linux) {
    -    deps = [
    -      "linux",
    -    ]
    +    if (is_fuchsia_host) {
    +      # The linux build is not supported as part of the Fuchsia host build.
    +      deps = []
    +    } else {
    +      deps = [
    +        "linux",
    +      ]
    +    }
       } else if (is_win) {
         deps = [
           "windows",
    
    From 5f771144956726c3fd1e0a10de5c9fd4f1d5c86d Mon Sep 17 00:00:00 2001
    From: Ben Konyi 
    Date: Tue, 2 Apr 2019 09:51:38 -0700
    Subject: [PATCH 0669/1117] Roll src/third_party/dart 75b2f9f919..14fd3b7d6a
     (23 commits)
    
    14fd3b7d6a Report errors on invalid constants in == and !=
    4a1b153fe1 [cfe] Enable type promotion in if-elements of literal collections
    45bd79c119 [cfe] Fix inference on variable declarations in for-elements
    71a3649a5a [cfe] Assume invocations are dead if they aren't reached by type inference
    d320f42542 [CFE] Remove redundant null checks in constant evaluator.
    405bd06725 [VM] Refactors metrics variables to avoid multiple instances per compiled unit.
    3a93cf9464 Update dart_style to 1.2.5.
    8ce2d7a4e1 [CFE] Better error messages on errors with user definable operators
    c71888d537 [cfe] Async translation of block expressions
    28e658814f [dartdevc] Implementing collection concatenation
    057497e57b Revert "[vm/runtime] Create separate background compilation queues for optimized and unoptimized compilations."
    ba473d579f Unskip co19_2/Control-flow-collections for dart2js.
    bcb6df13b9 [vm/runtime] Create separate background compilation queues for optimized and unoptimized compilations.
    bfb99d146d [dartdevc] Adding superclass constraints to mixin init
    c26f1c6bf7 Do not assume stack trace is not null
    9325a3122c [infra] Add missing out directories to the "vm-kernel" fileset.
    c2f014064e [vm/debugger] Ensure TopLevel class is finalized when setting breakpoint
    e979895efb Revert "[vm] Repair the resolver abstraction."
    dd7a6320e3 Rework the way Dartdoc template information is gathered
    bb0dc80550 [gardening] Rename flutter engine patch to catch up with roll
    010f3e91fa [gardening] Follow-up to temp disable flutter engine gl build
    0d0857ca98 [gardening] Temporarily disable flutter engine gl build to unbreak hhh buildbot
    0fdaec1b8e [ Service ] Removed extra print statement in test
    ---
     DEPS                                    | 4 ++--
     ci/licenses_golden/licenses_third_party | 2 +-
     2 files changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index b6eecdf8746b2..2daf3cdfe6787 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -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': '75b2f9f919e5728902aff39a09223d1cc9402585',
    +  'dart_revision': '14fd3b7d6ad3a260eadd41c45c7c82f025938e8e',
     
       # WARNING: DO NOT EDIT MANUALLY
       # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
    @@ -48,7 +48,7 @@ vars = {
       'dart_crypto_tag': '2.0.6',
       'dart_csslib_tag': '0.14.4+1',
       'dart_dart2js_info_tag': '0.6.0',
    -  'dart_dart_style_tag': '1.2.4',
    +  'dart_dart_style_tag': '1.2.5',
       'dart_dartdoc_tag': 'v0.28.2',
       'dart_fixnum_tag': '0.10.9',
       'dart_glob_tag': '1.1.7',
    diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party
    index cfc7add127e7b..ab8e9b1462906 100644
    --- a/ci/licenses_golden/licenses_third_party
    +++ b/ci/licenses_golden/licenses_third_party
    @@ -1,4 +1,4 @@
    -Signature: 56ea8d814aee503d5f73adb0a7f1c6fd
    +Signature: 3231fa330703b8b07299a6097e9c34da
     
     UNUSED LICENSES:
     
    
    From efbecd7e8ea8632a33705e060f8be25694b459ff Mon Sep 17 00:00:00 2001
    From: Zachary Anderson 
    Date: Tue, 2 Apr 2019 10:22:12 -0700
    Subject: [PATCH 0670/1117] [txt] Add back
     FontCollection::SetDefaultFontManager (#8410)
    
    ---
     third_party/txt/src/txt/font_collection.cc | 4 ++++
     third_party/txt/src/txt/font_collection.h  | 1 +
     2 files changed, 5 insertions(+)
    
    diff --git a/third_party/txt/src/txt/font_collection.cc b/third_party/txt/src/txt/font_collection.cc
    index d1bd02ed748d8..918f490c464c2 100644
    --- a/third_party/txt/src/txt/font_collection.cc
    +++ b/third_party/txt/src/txt/font_collection.cc
    @@ -91,6 +91,10 @@ void FontCollection::SetupDefaultFontManager() {
       default_font_manager_ = GetDefaultFontManager();
     }
     
    +void FontCollection::SetDefaultFontManager(sk_sp font_manager) {
    +  default_font_manager_ = font_manager;
    +}
    +
     void FontCollection::SetAssetFontManager(sk_sp font_manager) {
       asset_font_manager_ = font_manager;
     }
    diff --git a/third_party/txt/src/txt/font_collection.h b/third_party/txt/src/txt/font_collection.h
    index e7fb842933d66..5bae9e8974288 100644
    --- a/third_party/txt/src/txt/font_collection.h
    +++ b/third_party/txt/src/txt/font_collection.h
    @@ -41,6 +41,7 @@ class FontCollection : public std::enable_shared_from_this {
       size_t GetFontManagersCount() const;
     
       void SetupDefaultFontManager();
    +  void SetDefaultFontManager(sk_sp font_manager);
       void SetAssetFontManager(sk_sp font_manager);
       void SetDynamicFontManager(sk_sp font_manager);
       void SetTestFontManager(sk_sp font_manager);
    
    From 4a8c7dceeb4b7c710e0b22090cc3bc26f458a3a9 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Tue, 2 Apr 2019 15:52:31 -0400
    Subject: [PATCH 0671/1117] Roll src/third_party/skia
     f2d9b865d736..71c0e9422038 (13 commits) (#8413)
    
    https://skia.googlesource.com/skia.git/%2Blog/f2d9b865d736..71c0e9422038
    
    git log f2d9b865d73631d0052a323558b3c083f7e05188..71c0e94220380f4cbb3a8ba462ef9036fa7ab1ff --date=short --no-merges --format=%ad %ae %s
    2019-04-02 mtklein@google.com We don't actually use thesee extensions with GLES
    2019-04-02 bsalomon@google.com Revert "Inset blur domain a tiny bit to prevent certain GPUs from sampling transparent black from scratch textures."
    2019-04-02 mtklein@google.com add skottie support to fm
    2019-04-02 mtklein@google.com allow skipped source/backend pairs in fm
    2019-04-02 jvanverth@google.com Fix some more Metal and iOS leaks
    2019-04-02 brianosman@google.com Initialize renderability in GrMockOptions
    2019-03-29 egdaniel@google.com Remove read access flags from src of memory barriers.
    2019-04-02 robertphillips@google.com Add tracking of work to GrVkCommandBuffer
    2019-04-02 brianosman@google.com Remove samples that aren't built
    2019-04-02 mtklein@google.com allow GMs to fail in DM
    2019-04-02 brianosman@google.com Remove redundant setup code in readSurfacePixels
    2019-04-02 jvanverth@google.com Updates to iOS build
    2019-04-01 herb@google.com Refactor main GPU glyph decisions
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 4 +---
     2 files changed, 2 insertions(+), 4 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 2daf3cdfe6787..e197466f93d51 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': 'f2d9b865d73631d0052a323558b3c083f7e05188',
    +  'skia_revision': '71c0e94220380f4cbb3a8ba462ef9036fa7ab1ff',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index e2410207b034a..6201adb580124 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 6928cdbcf2200936c961f80cf7e741cc
    +Signature: 2d6c6916c1b3db8760ed776b42eb606f
     
     UNUSED LICENSES:
     
    @@ -2827,7 +2827,6 @@ FILE: ../../../third_party/skia/samplecode/SampleBigGradient.cpp
     FILE: ../../../third_party/skia/samplecode/SampleBitmapRect.cpp
     FILE: ../../../third_party/skia/samplecode/SampleCamera.cpp
     FILE: ../../../third_party/skia/samplecode/SampleCircle.cpp
    -FILE: ../../../third_party/skia/samplecode/SampleClamp.cpp
     FILE: ../../../third_party/skia/samplecode/SampleClip.cpp
     FILE: ../../../third_party/skia/samplecode/SampleColorFilter.cpp
     FILE: ../../../third_party/skia/samplecode/SampleComplexClip.cpp
    @@ -2850,7 +2849,6 @@ FILE: ../../../third_party/skia/samplecode/SamplePatch.cpp
     FILE: ../../../third_party/skia/samplecode/SamplePath.cpp
     FILE: ../../../third_party/skia/samplecode/SamplePathClip.cpp
     FILE: ../../../third_party/skia/samplecode/SamplePathEffects.cpp
    -FILE: ../../../third_party/skia/samplecode/SamplePathFill.cpp
     FILE: ../../../third_party/skia/samplecode/SamplePoints.cpp
     FILE: ../../../third_party/skia/samplecode/SamplePolyToPoly.cpp
     FILE: ../../../third_party/skia/samplecode/SampleRegion.cpp
    
    From 2f17860104551e730eae77182cff86d52f44f9cd Mon Sep 17 00:00:00 2001
    From: Alexander Aprelev 
    Date: Tue, 2 Apr 2019 13:09:53 -0700
    Subject: [PATCH 0672/1117] Pass environment defines to compile flutter
     platform step. (#8412)
    
    * Pass environment defines to the compiler
    
    * Remove non-strong platform target
    ---
     lib/snapshot/BUILD.gn | 23 +++++------------------
     1 file changed, 5 insertions(+), 18 deletions(-)
    
    diff --git a/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn
    index f82c5e81f07af..8ab94ab12751b 100644
    --- a/lib/snapshot/BUILD.gn
    +++ b/lib/snapshot/BUILD.gn
    @@ -231,23 +231,6 @@ source_set("snapshot") {
                 get_target_outputs(":platform_strong_dill_linkable")
     }
     
    -compile_platform("non_strong_platform") {
    -  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",
    -    "$root_out_dir/flutter_patched_sdk/vm_outline.dill",
    -  ]
    -
    -  args = [
    -    "--target=flutter",
    -    "dart:core",
    -  ]
    -}
    -
     compile_platform("strong_platform") {
       single_root_scheme = "org-dartlang-sdk"
       single_root_base = rebase_path("../../../")
    @@ -259,8 +242,13 @@ compile_platform("strong_platform") {
         "$root_out_dir/flutter_patched_sdk/vm_outline_strong.dill",
       ]
     
    +  is_runtime_mode_release = flutter_runtime_mode == "release"
    +  allow_causal_async_stacks = !is_runtime_mode_release
       args = [
         "--target=flutter",
    +    "-Ddart.vm.product=$is_runtime_mode_release",
    +    "-Ddart.developer.causal_async_stacks=$allow_causal_async_stacks",
    +    "-Ddart.isVM=true",
         "dart:core",
       ]
     }
    @@ -275,7 +263,6 @@ if (is_fuchsia || is_fuchsia_host) {
     } else {
       group("kernel_platform_files") {
         public_deps = [
    -      ":non_strong_platform",
           ":strong_platform",
         ]
       }
    
    From 23fceaacd41a7c22481df9e87a498a1f9e7f080a Mon Sep 17 00:00:00 2001
    From: Matt Carroll 
    Date: Tue, 2 Apr 2019 13:23:47 -0700
    Subject: [PATCH 0673/1117] Added new Android embedding packages to javadoc
     generation. (#8411)
    
    ---
     tools/gen_javadoc.py | 5 +++++
     1 file changed, 5 insertions(+)
    
    diff --git a/tools/gen_javadoc.py b/tools/gen_javadoc.py
    index f38f059462f3b..28ccbeb1b8e01 100755
    --- a/tools/gen_javadoc.py
    +++ b/tools/gen_javadoc.py
    @@ -37,6 +37,11 @@ def main():
       ]
       packages = [
         'io.flutter.app',
    +    'io.flutter.embedding.android',
    +    'io.flutter.embedding.engine',
    +    'io.flutter.embedding.engine.dart',
    +    'io.flutter.embedding.engine.renderer',
    +    'io.flutter.embedding.engine.systemchannels',
         'io.flutter.plugin.common',
         'io.flutter.plugin.editing',
         'io.flutter.plugin.platform',
    
    From 77d8e12e99c03e7d6864e5bcdbc3b24fcc49cd32 Mon Sep 17 00:00:00 2001
    From: Ben Konyi 
    Date: Tue, 2 Apr 2019 13:28:27 -0700
    Subject: [PATCH 0674/1117] Roll src/third_party/dart 14fd3b7d6a..f6768b6fb3 (5
     commits)
    
    f6768b6fb3 Update the data version to prevent the use of outdated cached data
    8fee2596e5 Remove some unused front_end dependencies
    725c070632 report error on type reference before factory keyword
    ff99692175 dartfix update analysis options to enable NNBD
    aed696cea7 [infra] Update checked in SDKs to 2.2.1-dev.3.0
    ---
     DEPS                                    | 2 +-
     ci/licenses_golden/licenses_third_party | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index e197466f93d51..8b0822de51ef7 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -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': '14fd3b7d6ad3a260eadd41c45c7c82f025938e8e',
    +  'dart_revision': 'f6768b6fb3e58bb704aca1e22a7ffd11e7ff07cb',
     
       # WARNING: DO NOT EDIT MANUALLY
       # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
    diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party
    index ab8e9b1462906..1e8a3de3ace92 100644
    --- a/ci/licenses_golden/licenses_third_party
    +++ b/ci/licenses_golden/licenses_third_party
    @@ -1,4 +1,4 @@
    -Signature: 3231fa330703b8b07299a6097e9c34da
    +Signature: 3ae9b79b70f8f3445bc684cfda86e034
     
     UNUSED LICENSES:
     
    
    From a650790e44bda0e0bde3b74a635945b1558b5eb8 Mon Sep 17 00:00:00 2001
    From: stuartmorgan 
    Date: Tue, 2 Apr 2019 18:17:23 -0400
    Subject: [PATCH 0675/1117] Add scroll wheel support to desktop GLFW shell
     (#8416)
    
    Sends scroll events from GLFW to the Flutter engine, allowing scrolling
    of Scrollables via a scroll wheel.
    ---
     shell/platform/glfw/flutter_glfw.cc | 106 ++++++++++++++++++++--------
     1 file changed, 76 insertions(+), 30 deletions(-)
    
    diff --git a/shell/platform/glfw/flutter_glfw.cc b/shell/platform/glfw/flutter_glfw.cc
    index ab03cac69f9c5..98e76f02c5ade 100644
    --- a/shell/platform/glfw/flutter_glfw.cc
    +++ b/shell/platform/glfw/flutter_glfw.cc
    @@ -155,57 +155,86 @@ static void GLFWFramebufferSizeCallback(GLFWwindow* window,
       FlutterEngineSendWindowMetricsEvent(state->engine, &event);
     }
     
    -// Sends a pointer event to the Flutter engine with the given phase.
    -static void SendPointerEventWithPhase(GLFWwindow* window,
    -                                      FlutterPointerPhase phase,
    -                                      double x,
    -                                      double y) {
    -  auto state = GetSavedWindowState(window);
    +// Sends a pointer event to the Flutter engine based on the given data.
    +//
    +// Any coordinate/distance values in |event_data| should be in screen
    +// coordinates; they will be adjusted to pixel values before being sent.
    +static void SendPointerEventWithData(GLFWwindow* window,
    +                                     const FlutterPointerEvent& event_data) {
    +  auto* state = GetSavedWindowState(window);
       // If sending anything other than an add, and the pointer isn't already added,
       // synthesize an add to satisfy Flutter's expectations about events.
    -  if (!state->pointer_currently_added && phase != FlutterPointerPhase::kAdd) {
    -    SendPointerEventWithPhase(window, FlutterPointerPhase::kAdd, x, y);
    +  if (!state->pointer_currently_added &&
    +      event_data.phase != FlutterPointerPhase::kAdd) {
    +    FlutterPointerEvent event = {};
    +    event.phase = FlutterPointerPhase::kAdd;
    +    event.x = event_data.x;
    +    event.y = event_data.y;
    +    SendPointerEventWithData(window, event);
       }
       // Don't double-add (e.g., if events are delivered out of order, so an add has
       // already been synthesized).
    -  if (state->pointer_currently_added && phase == FlutterPointerPhase::kAdd) {
    +  if (state->pointer_currently_added &&
    +      event_data.phase == FlutterPointerPhase::kAdd) {
         return;
       }
     
    -  FlutterPointerEvent event = {};
    +  FlutterPointerEvent event = event_data;
    +  // Set metadata that's always the same regardless of the event.
       event.struct_size = sizeof(event);
    -  event.phase = phase;
    -  event.x = x * state->window_pixels_per_screen_coordinate;
    -  event.y = y * state->window_pixels_per_screen_coordinate;
       event.timestamp =
           std::chrono::duration_cast(
               std::chrono::high_resolution_clock::now().time_since_epoch())
               .count();
    +  // Convert all screen coordinates to pixel coordinates.
    +  event.x *= state->window_pixels_per_screen_coordinate;
    +  event.y *= state->window_pixels_per_screen_coordinate;
    +  event.scroll_delta_x *= state->window_pixels_per_screen_coordinate;
    +  event.scroll_delta_y *= state->window_pixels_per_screen_coordinate;
    +
       FlutterEngineSendPointerEvent(state->engine, &event, 1);
     
    -  if (phase == FlutterPointerPhase::kAdd) {
    +  if (event_data.phase == FlutterPointerPhase::kAdd) {
         state->pointer_currently_added = true;
    -  } else if (phase == FlutterPointerPhase::kRemove) {
    +  } else if (event_data.phase == FlutterPointerPhase::kRemove) {
         state->pointer_currently_added = false;
       }
     }
     
    +// Updates |event_data| with the current location of the mouse cursor.
    +static void SetEventLocationFromCursorPosition(
    +    GLFWwindow* window,
    +    FlutterPointerEvent* event_data) {
    +  glfwGetCursorPos(window, &event_data->x, &event_data->y);
    +}
    +
    +// Set's |event_data|'s phase to either kMove or kHover depending on the current
    +// primary mouse button state.
    +static void SetEventPhaseFromCursorButtonState(
    +    GLFWwindow* window,
    +    FlutterPointerEvent* event_data) {
    +  event_data->phase =
    +      glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS
    +          ? FlutterPointerPhase::kMove
    +          : FlutterPointerPhase::kHover;
    +}
    +
     // Reports the mouse entering or leaving the Flutter view.
     static void GLFWCursorEnterCallback(GLFWwindow* window, int entered) {
    -  double x, y;
    -  glfwGetCursorPos(window, &x, &y);
    -  FlutterPointerPhase phase =
    +  FlutterPointerEvent event = {};
    +  event.phase =
           entered ? FlutterPointerPhase::kAdd : FlutterPointerPhase::kRemove;
    -  SendPointerEventWithPhase(window, phase, x, y);
    +  SetEventLocationFromCursorPosition(window, &event);
    +  SendPointerEventWithData(window, event);
     }
     
     // Reports mouse movement to the Flutter engine.
     static void GLFWCursorPositionCallback(GLFWwindow* window, double x, double y) {
    -  bool button_down =
    -      glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS;
    -  FlutterPointerPhase phase =
    -      button_down ? FlutterPointerPhase::kMove : FlutterPointerPhase::kHover;
    -  SendPointerEventWithPhase(window, phase, x, y);
    +  FlutterPointerEvent event = {};
    +  event.x = x;
    +  event.y = y;
    +  SetEventPhaseFromCursorButtonState(window, &event);
    +  SendPointerEventWithData(window, event);
     }
     
     // Reports mouse button press to the Flutter engine.
    @@ -219,12 +248,11 @@ static void GLFWMouseButtonCallback(GLFWwindow* window,
         return;
       }
     
    -  double x, y;
    -  glfwGetCursorPos(window, &x, &y);
    -  FlutterPointerPhase phase = (action == GLFW_PRESS)
    -                                  ? FlutterPointerPhase::kDown
    -                                  : FlutterPointerPhase::kUp;
    -  SendPointerEventWithPhase(window, phase, x, y);
    +  FlutterPointerEvent event = {};
    +  event.phase = (action == GLFW_PRESS) ? FlutterPointerPhase::kDown
    +                                       : FlutterPointerPhase::kUp;
    +  SetEventLocationFromCursorPosition(window, &event);
    +  SendPointerEventWithData(window, event);
     
       // If mouse tracking isn't already enabled, turn it on for the duration of
       // the drag to generate kMove events.
    @@ -242,6 +270,22 @@ static void GLFWMouseButtonCallback(GLFWwindow* window,
       }
     }
     
    +// Reports scroll wheel events to the Flutter engine.
    +static void GLFWScrollCallback(GLFWwindow* window,
    +                               double delta_x,
    +                               double delta_y) {
    +  FlutterPointerEvent event = {};
    +  SetEventLocationFromCursorPosition(window, &event);
    +  SetEventPhaseFromCursorButtonState(window, &event);
    +  event.signal_kind = FlutterPointerSignalKind::kFlutterPointerSignalKindScroll;
    +  // TODO: See if this can be queried from the OS; this value is chosen
    +  // arbitrarily to get something that feels reasonable.
    +  const int kScrollOffsetMultiplier = 20;
    +  event.scroll_delta_x = delta_x * kScrollOffsetMultiplier;
    +  event.scroll_delta_y = -delta_y * kScrollOffsetMultiplier;
    +  SendPointerEventWithData(window, event);
    +}
    +
     // Passes character input events to registered handlers.
     static void GLFWCharCallback(GLFWwindow* window, unsigned int code_point) {
       for (const auto& handler :
    @@ -276,6 +320,7 @@ static void GLFWAssignEventCallbacks(GLFWwindow* window) {
       glfwSetKeyCallback(window, GLFWKeyCallback);
       glfwSetCharCallback(window, GLFWCharCallback);
       glfwSetMouseButtonCallback(window, GLFWMouseButtonCallback);
    +  glfwSetScrollCallback(window, GLFWScrollCallback);
       if (GetSavedWindowState(window)->hover_tracking_enabled) {
         SetHoverCallbacksEnabled(window, true);
       }
    @@ -286,6 +331,7 @@ static void GLFWClearEventCallbacks(GLFWwindow* window) {
       glfwSetKeyCallback(window, nullptr);
       glfwSetCharCallback(window, nullptr);
       glfwSetMouseButtonCallback(window, nullptr);
    +  glfwSetScrollCallback(window, nullptr);
       SetHoverCallbacksEnabled(window, false);
     }
     
    
    From 20e45996d6ce2aeb756c54f28bf3620326ed41d1 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Tue, 2 Apr 2019 19:21:39 -0400
    Subject: [PATCH 0676/1117] Roll src/third_party/skia
     71c0e9422038..c9eeab3d85b9 (4 commits) (#8418)
    
    https://skia.googlesource.com/skia.git/%2Blog/71c0e9422038..c9eeab3d85b9
    
    git log 71c0e94220380f4cbb3a8ba462ef9036fa7ab1ff..c9eeab3d85b9c85e49a4d8228ba7468072e2bb0d --date=short --no-merges --format=%ad %ae %s
    2019-04-02 bungeman@google.com Remove Skia version number.
    2019-04-02 mtklein@google.com update some FM flags
    2019-04-02 michaelludwig@google.com Do not lose existing paint shaders when drawing alpha images
    2019-04-02 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 8b0822de51ef7..8fd79a9a586b3 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': '71c0e94220380f4cbb3a8ba462ef9036fa7ab1ff',
    +  'skia_revision': 'c9eeab3d85b9c85e49a4d8228ba7468072e2bb0d',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 6201adb580124..5a06fc675ddec 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 2d6c6916c1b3db8760ed776b42eb606f
    +Signature: 27640e6e3ae5e29abe45ac591b5f2a30
     
     UNUSED LICENSES:
     
    
    From cc115500b9cb2b27d59627f202e6cd6bb87f49fc Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Tue, 2 Apr 2019 22:51:49 -0400
    Subject: [PATCH 0677/1117] Roll src/third_party/skia
     c9eeab3d85b9..e25b4472cdd9 (1 commits) (#8420)
    
    https://skia.googlesource.com/skia.git/%2Blog/c9eeab3d85b9..e25b4472cdd9
    
    git log c9eeab3d85b9c85e49a4d8228ba7468072e2bb0d..e25b4472cdd9f09cd393c9c34651218507c9847b --date=short --no-merges --format=%ad %ae %s
    2019-04-02 reed@google.com Move SkTileModes to top level
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 3 ++-
     2 files changed, 3 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 8fd79a9a586b3..1571d51e16f3e 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': 'c9eeab3d85b9c85e49a4d8228ba7468072e2bb0d',
    +  'skia_revision': 'e25b4472cdd9f09cd393c9c34651218507c9847b',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 5a06fc675ddec..9a707b50e6640 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 27640e6e3ae5e29abe45ac591b5f2a30
    +Signature: c3208174f8bb78461fab6e1835080c02
     
     UNUSED LICENSES:
     
    @@ -4565,6 +4565,7 @@ FILE: ../../../third_party/skia/gm/mixercolorfilter.cpp
     FILE: ../../../third_party/skia/gm/samplelocations.cpp
     FILE: ../../../third_party/skia/gm/skbug_8664.cpp
     FILE: ../../../third_party/skia/include/core/SkMixer.h
    +FILE: ../../../third_party/skia/include/core/SkTileMode.h
     FILE: ../../../third_party/skia/include/gpu/GrContextThreadSafeProxy.h
     FILE: ../../../third_party/skia/include/private/GrContext_Base.h
     FILE: ../../../third_party/skia/include/private/GrImageContext.h
    
    From 309d078b597d3a38fe9bcef8d8bae7b56487e8eb Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Wed, 3 Apr 2019 09:58:54 -0400
    Subject: [PATCH 0678/1117] Roll src/third_party/skia
     e25b4472cdd9..176da0bb8a10 (10 commits) (#8422)
    
    https://skia.googlesource.com/skia.git/%2Blog/e25b4472cdd9..176da0bb8a10
    
    git log e25b4472cdd9f09cd393c9c34651218507c9847b..176da0bb8a1002d2fe4c4edf4ce9fde609bda256 --date=short --no-merges --format=%ad %ae %s
    2019-04-03 mtklein@google.com tiny tweak: no need to reload lottie files
    2019-04-03 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src b3f3a36219a1..38969ffb5d49 (477 commits)
    2019-04-03 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 6cb0cff57376..89899748a858 (11 commits)
    2019-04-02 bsalomon@google.com Control access to adding ref to a GrGpuResource when it's ref count is zero.
    2019-04-02 ethannicholas@google.com added support for half input variables in SkSL fragment processors
    2019-04-03 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 459453a96257..2b9fb4bf5ece (7 commits)
    2019-04-02 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    2019-04-02 fmalita@chromium.org [skottie] Add support for (non-standard) v-centered text
    2019-04-03 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset
    2019-04-02 mtklein@google.com have FM run GMs in command line order
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 1571d51e16f3e..18e43852d7c4f 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': 'e25b4472cdd9f09cd393c9c34651218507c9847b',
    +  'skia_revision': '176da0bb8a1002d2fe4c4edf4ce9fde609bda256',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 9a707b50e6640..6e6cca16db6b2 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: c3208174f8bb78461fab6e1835080c02
    +Signature: d2b388a2bb49f02fe66504bd06401ebf
     
     UNUSED LICENSES:
     
    
    From 64fc5832951678962ec99035675fe4ffced49fe8 Mon Sep 17 00:00:00 2001
    From: Ryan Macnak 
    Date: Wed, 3 Apr 2019 10:01:57 -0700
    Subject: [PATCH 0679/1117] Remove use of DART_CHECK_VALID. (#8417)
    
    Bug: https://github.com/flutter/flutter/issues/30407
    ---
     lib/io/dart_io.cc                             |  9 ++-
     lib/ui/dart_runtime_hooks.cc                  | 70 ++++++++++---------
     lib/ui/dart_ui.cc                             |  7 +-
     lib/ui/plugins/callback_cache.cc              | 21 ++++--
     .../window/platform_message_response_dart.cc  |  4 +-
     5 files changed, 63 insertions(+), 48 deletions(-)
    
    diff --git a/lib/io/dart_io.cc b/lib/io/dart_io.cc
    index 1b1866b4e8569..ee59b9dd99de8 100644
    --- a/lib/io/dart_io.cc
    +++ b/lib/io/dart_io.cc
    @@ -13,9 +13,12 @@ using tonic::ToDart;
     namespace blink {
     
     void DartIO::InitForIsolate() {
    -  DART_CHECK_VALID(Dart_SetNativeResolver(Dart_LookupLibrary(ToDart("dart:io")),
    -                                          dart::bin::LookupIONative,
    -                                          dart::bin::LookupIONativeSymbol));
    +  Dart_Handle result = Dart_SetNativeResolver(
    +      Dart_LookupLibrary(ToDart("dart:io")), dart::bin::LookupIONative,
    +      dart::bin::LookupIONativeSymbol);
    +  if (Dart_IsError(result)) {
    +    Dart_PropagateError(result);
    +  }
     }
     
     bool DartIO::EntropySource(uint8_t* buffer, intptr_t length) {
    diff --git a/lib/ui/dart_runtime_hooks.cc b/lib/ui/dart_runtime_hooks.cc
    index 5145f11107733..32f4bf0845e50 100644
    --- a/lib/ui/dart_runtime_hooks.cc
    +++ b/lib/ui/dart_runtime_hooks.cc
    @@ -60,11 +60,15 @@ void DartRuntimeHooks::RegisterNatives(tonic::DartLibraryNatives* natives) {
       natives->Register({BUILTIN_NATIVE_LIST(REGISTER_FUNCTION)});
     }
     
    +static void PropagateIfError(Dart_Handle result) {
    +  if (Dart_IsError(result)) {
    +    Dart_PropagateError(result);
    +  }
    +}
    +
     static Dart_Handle GetFunction(Dart_Handle builtin_library, const char* name) {
       Dart_Handle getter_name = ToDart(name);
    -  Dart_Handle closure = Dart_Invoke(builtin_library, getter_name, 0, nullptr);
    -  DART_CHECK_VALID(closure);
    -  return closure;
    +  return Dart_Invoke(builtin_library, getter_name, 0, nullptr);
     }
     
     static void InitDartInternal(Dart_Handle builtin_library, bool is_ui_isolate) {
    @@ -72,24 +76,26 @@ static void InitDartInternal(Dart_Handle builtin_library, bool is_ui_isolate) {
     
       Dart_Handle internal_library = Dart_LookupLibrary(ToDart("dart:_internal"));
     
    -  DART_CHECK_VALID(
    -      Dart_SetField(internal_library, ToDart("_printClosure"), print));
    +  Dart_Handle result =
    +      Dart_SetField(internal_library, ToDart("_printClosure"), print);
    +  PropagateIfError(result);
     
       if (is_ui_isolate) {
         // Call |_setupHooks| to configure |VMLibraryHooks|.
         Dart_Handle method_name = Dart_NewStringFromCString("_setupHooks");
    -    DART_CHECK_VALID(Dart_Invoke(builtin_library, method_name, 0, NULL))
    +    result = Dart_Invoke(builtin_library, method_name, 0, NULL);
    +    PropagateIfError(result);
       }
     
       Dart_Handle setup_hooks = Dart_NewStringFromCString("_setupHooks");
     
       Dart_Handle io_lib = Dart_LookupLibrary(ToDart("dart:io"));
    -  DART_CHECK_VALID(io_lib);
    -  DART_CHECK_VALID(Dart_Invoke(io_lib, setup_hooks, 0, NULL));
    +  result = Dart_Invoke(io_lib, setup_hooks, 0, NULL);
    +  PropagateIfError(result);
     
       Dart_Handle isolate_lib = Dart_LookupLibrary(ToDart("dart:isolate"));
    -  DART_CHECK_VALID(isolate_lib);
    -  DART_CHECK_VALID(Dart_Invoke(isolate_lib, setup_hooks, 0, NULL));
    +  result = Dart_Invoke(isolate_lib, setup_hooks, 0, NULL);
    +  PropagateIfError(result);
     }
     
     static void InitDartCore(Dart_Handle builtin, const std::string& script_uri) {
    @@ -97,8 +103,9 @@ static void InitDartCore(Dart_Handle builtin, const std::string& script_uri) {
       Dart_Handle get_base_url =
           Dart_Invoke(io_lib, ToDart("_getUriBaseClosure"), 0, NULL);
       Dart_Handle core_library = Dart_LookupLibrary(ToDart("dart:core"));
    -  DART_CHECK_VALID(
    -      Dart_SetField(core_library, ToDart("_uriBaseClosure"), get_base_url));
    +  Dart_Handle result =
    +      Dart_SetField(core_library, ToDart("_uriBaseClosure"), get_base_url);
    +  PropagateIfError(result);
     }
     
     static void InitDartAsync(Dart_Handle builtin_library, bool is_ui_isolate) {
    @@ -114,31 +121,31 @@ static void InitDartAsync(Dart_Handle builtin_library, bool is_ui_isolate) {
       }
       Dart_Handle async_library = Dart_LookupLibrary(ToDart("dart:async"));
       Dart_Handle set_schedule_microtask = ToDart("_setScheduleImmediateClosure");
    -  DART_CHECK_VALID(Dart_Invoke(async_library, set_schedule_microtask, 1,
    -                               &schedule_microtask));
    +  Dart_Handle result = Dart_Invoke(async_library, set_schedule_microtask, 1,
    +                                   &schedule_microtask);
    +  PropagateIfError(result);
     }
     
     static void InitDartIO(Dart_Handle builtin_library,
                            const std::string& script_uri) {
       Dart_Handle io_lib = Dart_LookupLibrary(ToDart("dart:io"));
    -  DART_CHECK_VALID(io_lib);
       Dart_Handle platform_type =
           Dart_GetType(io_lib, ToDart("_Platform"), 0, nullptr);
    -  DART_CHECK_VALID(platform_type);
       if (!script_uri.empty()) {
    -    DART_CHECK_VALID(Dart_SetField(platform_type, ToDart("_nativeScript"),
    -                                   ToDart(script_uri)));
    +    Dart_Handle result = Dart_SetField(platform_type, ToDart("_nativeScript"),
    +                                       ToDart(script_uri));
    +    PropagateIfError(result);
       }
       Dart_Handle locale_closure =
           GetFunction(builtin_library, "_getLocaleClosure");
    -  DART_CHECK_VALID(
    -      Dart_SetField(platform_type, ToDart("_localeClosure"), locale_closure));
    +  Dart_Handle result =
    +      Dart_SetField(platform_type, ToDart("_localeClosure"), locale_closure);
    +  PropagateIfError(result);
     }
     
     void DartRuntimeHooks::Install(bool is_ui_isolate,
                                    const std::string& script_uri) {
       Dart_Handle builtin = Dart_LookupLibrary(ToDart("dart:ui"));
    -  DART_CHECK_VALID(builtin);
       InitDartInternal(builtin, is_ui_isolate);
       InitDartCore(builtin, script_uri);
       InitDartAsync(builtin, is_ui_isolate);
    @@ -242,7 +249,7 @@ void ScheduleMicrotask(Dart_NativeArguments args) {
     static std::string GetFunctionLibraryUrl(Dart_Handle closure) {
       if (Dart_IsClosure(closure)) {
         closure = Dart_ClosureFunction(closure);
    -    DART_CHECK_VALID(closure);
    +    PropagateIfError(closure);
       }
     
       if (!Dart_IsFunction(closure)) {
    @@ -256,7 +263,7 @@ static std::string GetFunctionLibraryUrl(Dart_Handle closure) {
       }
       if (Dart_IsLibrary(owner)) {
         url = Dart_LibraryUrl(owner);
    -    DART_CHECK_VALID(url);
    +    PropagateIfError(url);
       }
       return DartConverter::FromDart(url);
     }
    @@ -266,7 +273,7 @@ static std::string GetFunctionClassName(Dart_Handle closure) {
     
       if (Dart_IsClosure(closure)) {
         closure = Dart_ClosureFunction(closure);
    -    DART_CHECK_VALID(closure);
    +    PropagateIfError(closure);
       }
     
       if (!Dart_IsFunction(closure)) {
    @@ -275,13 +282,13 @@ static std::string GetFunctionClassName(Dart_Handle closure) {
     
       bool is_static = false;
       result = Dart_FunctionIsStatic(closure, &is_static);
    -  DART_CHECK_VALID(result);
    +  PropagateIfError(result);
       if (!is_static) {
         return "";
       }
     
       result = Dart_FunctionOwner(closure);
    -  DART_CHECK_VALID(result);
    +  PropagateIfError(result);
     
       if (Dart_IsLibrary(result) || !Dart_IsInstance(result)) {
         return "";
    @@ -290,11 +297,9 @@ static std::string GetFunctionClassName(Dart_Handle closure) {
     }
     
     static std::string GetFunctionName(Dart_Handle func) {
    -  DART_CHECK_VALID(func);
    -
       if (Dart_IsClosure(func)) {
         func = Dart_ClosureFunction(func);
    -    DART_CHECK_VALID(func);
    +    PropagateIfError(func);
       }
     
       if (!Dart_IsFunction(func)) {
    @@ -303,16 +308,13 @@ static std::string GetFunctionName(Dart_Handle func) {
     
       bool is_static = false;
       Dart_Handle result = Dart_FunctionIsStatic(func, &is_static);
    -  DART_CHECK_VALID(result);
    +  PropagateIfError(result);
       if (!is_static) {
         return "";
       }
     
       result = Dart_FunctionName(func);
    -  if (Dart_IsError(result)) {
    -    Dart_PropagateError(result);
    -    return "";
    -  }
    +  PropagateIfError(result);
     
       return DartConverter::FromDart(result);
     }
    diff --git a/lib/ui/dart_ui.cc b/lib/ui/dart_ui.cc
    index f6aa54c1cb946..df5bc9713f55f 100644
    --- a/lib/ui/dart_ui.cc
    +++ b/lib/ui/dart_ui.cc
    @@ -104,8 +104,11 @@ void DartUI::InitForIsolate(bool is_root_isolate) {
       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")),
    -                                          get_native_function, get_symbol));
    +  Dart_Handle result = Dart_SetNativeResolver(
    +      Dart_LookupLibrary(ToDart("dart:ui")), get_native_function, get_symbol);
    +  if (Dart_IsError(result)) {
    +    Dart_PropagateError(result);
    +  }
     }
     
     }  // namespace blink
    diff --git a/lib/ui/plugins/callback_cache.cc b/lib/ui/plugins/callback_cache.cc
    index b2d4cc0d72d44..cf1fbce539d9d 100644
    --- a/lib/ui/plugins/callback_cache.cc
    +++ b/lib/ui/plugins/callback_cache.cc
    @@ -152,12 +152,18 @@ Dart_Handle DartCallbackCache::LookupDartClosure(
         const std::string& class_name,
         const std::string& library_path) {
       Dart_Handle closure_name = ToDart(name);
    +  if (Dart_IsError(closure_name)) {
    +    return closure_name;
    +  }
       Dart_Handle library_name =
           library_path.empty() ? Dart_Null() : ToDart(library_path);
    +  if (Dart_IsError(library_name)) {
    +    return library_name;
    +  }
       Dart_Handle cls_name = class_name.empty() ? Dart_Null() : ToDart(class_name);
    -  DART_CHECK_VALID(closure_name);
    -  DART_CHECK_VALID(library_name);
    -  DART_CHECK_VALID(cls_name);
    +  if (Dart_IsError(cls_name)) {
    +    return cls_name;
    +  }
     
       Dart_Handle library;
       if (library_name == Dart_Null()) {
    @@ -165,21 +171,24 @@ Dart_Handle DartCallbackCache::LookupDartClosure(
       } else {
         library = Dart_LookupLibrary(library_name);
       }
    -  DART_CHECK_VALID(library);
    +  if (Dart_IsError(library)) {
    +    return library;
    +  }
     
       Dart_Handle closure;
       if (Dart_IsNull(cls_name)) {
         closure = Dart_GetField(library, closure_name);
       } else {
         Dart_Handle cls = Dart_GetClass(library, cls_name);
    -    DART_CHECK_VALID(cls);
    +    if (Dart_IsError(cls)) {
    +      return cls;
    +    }
         if (Dart_IsNull(cls)) {
           closure = Dart_Null();
         } else {
           closure = Dart_GetStaticMethodClosure(library, cls, closure_name);
         }
       }
    -  DART_CHECK_VALID(closure);
       return closure;
     }
     
    diff --git a/lib/ui/window/platform_message_response_dart.cc b/lib/ui/window/platform_message_response_dart.cc
    index 3a4084958b835..55da6fe8c5695 100644
    --- a/lib/ui/window/platform_message_response_dart.cc
    +++ b/lib/ui/window/platform_message_response_dart.cc
    @@ -31,11 +31,9 @@ Dart_Handle WrapByteData(std::vector data) {
         return ToByteData(data);
       } else {
         std::vector* heap_data = new std::vector(std::move(data));
    -    Dart_Handle data_handle = Dart_NewExternalTypedDataWithFinalizer(
    +    return Dart_NewExternalTypedDataWithFinalizer(
             Dart_TypedData_kByteData, heap_data->data(), heap_data->size(),
             heap_data, heap_data->size(), MessageDataFinalizer);
    -    DART_CHECK_VALID(data_handle);
    -    return data_handle;
       }
     }
     
    
    From d8bb9d793b3110d67efbbec016e2277f2be6f027 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Wed, 3 Apr 2019 13:29:35 -0400
    Subject: [PATCH 0680/1117] Roll src/third_party/skia
     176da0bb8a10..fbe240669394 (9 commits) (#8424)
    
    https://skia.googlesource.com/skia.git/%2Blog/176da0bb8a10..fbe240669394
    
    git log 176da0bb8a1002d2fe4c4edf4ce9fde609bda256..fbe240669394715ee2f3e9f85407dad241eca262 --date=short --no-merges --format=%ad %ae %s
    2019-04-03 brianosman@google.com Reland "Remove the NullGL interface (and associated test context)"
    2019-04-03 mtklein@google.com support comments
    2019-04-03 mtklein@google.com add --legacy to fm, legacy=true to fm_bot
    2019-04-03 mtklein@google.com -script - for stdin
    2019-04-03 reed@google.com Use SkTileMode instead of nested enum
    2019-04-03 mtklein@google.com don't have fm_bot send fm empty sources to run
    2019-04-01 mvujovic@adobe.com Reland "Inset blur domain a tiny bit to prevent certain GPUs from sampling transparent black from scratch textures."
    2019-04-03 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    2019-04-02 mtklein@google.com GrContext abandon: fail -> skip
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 5 +----
     2 files changed, 2 insertions(+), 5 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 18e43852d7c4f..b5b969fbf6e85 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': '176da0bb8a1002d2fe4c4edf4ce9fde609bda256',
    +  'skia_revision': 'fbe240669394715ee2f3e9f85407dad241eca262',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 6e6cca16db6b2..033b94a38e8f7 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: d2b388a2bb49f02fe66504bd06401ebf
    +Signature: 479ccc15b4edc62b97c7f0a8292dd014
     
     UNUSED LICENSES:
     
    @@ -1291,8 +1291,6 @@ FILE: ../../../third_party/skia/src/gpu/effects/GrShadowGeoProc.h
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLBuffer.cpp
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLBuffer.h
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLGpuCommandBuffer.h
    -FILE: ../../../third_party/skia/src/gpu/gl/GrGLTestInterface.cpp
    -FILE: ../../../third_party/skia/src/gpu/gl/GrGLTestInterface.h
     FILE: ../../../third_party/skia/src/gpu/gl/glfw/GrGLMakeNativeInterface_glfw.cpp
     FILE: ../../../third_party/skia/src/gpu/glsl/GrGLSLColorSpaceXformHelper.h
     FILE: ../../../third_party/skia/src/gpu/glsl/GrGLSLProgramDataManager.cpp
    @@ -2921,7 +2919,6 @@ FILE: ../../../third_party/skia/src/gpu/GrStencilAttachment.h
     FILE: ../../../third_party/skia/src/gpu/GrStencilSettings.cpp
     FILE: ../../../third_party/skia/src/gpu/GrTexture.cpp
     FILE: ../../../third_party/skia/src/gpu/SkGpuDevice.cpp
    -FILE: ../../../third_party/skia/src/gpu/gl/GrGLCreateNullInterface.cpp
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLDefines.h
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLGLSL.cpp
     FILE: ../../../third_party/skia/src/gpu/gl/GrGLGLSL.h
    
    From 7e38b0aa23df87fa643b33468d28a6cd22226a4d Mon Sep 17 00:00:00 2001
    From: Chinmay Garde 
    Date: Wed, 3 Apr 2019 13:38:12 -0700
    Subject: [PATCH 0681/1117] Revert "Revert "Separate the data required to
     bootstrap the VM into its own class. (#8397)" (#8406)" (#8414)
    
    This reverts commit f7b4903d7c9913447af3aaebc4308d1a1e2a4dde.
    ---
     ci/licenses_golden/licenses_flutter           |   4 +
     common/settings.h                             |   2 +
     .../isolate_name_server_natives.cc            |  18 +-
     lib/ui/ui_dart_state.cc                       |   6 +-
     lib/ui/ui_dart_state.h                        |   6 +-
     runtime/BUILD.gn                              |   5 +
     runtime/dart_isolate.cc                       |  89 +++++-----
     runtime/dart_isolate.h                        |  26 +--
     runtime/dart_isolate_unittests.cc             |  78 +++++----
     runtime/dart_vm.cc                            | 160 ++++++++----------
     runtime/dart_vm.h                             |  58 +++----
     runtime/dart_vm_data.cc                       |  79 +++++++++
     runtime/dart_vm_data.h                        |  47 +++++
     runtime/dart_vm_lifecycle.cc                  | 117 +++++++++++++
     runtime/dart_vm_lifecycle.h                   |  72 ++++++++
     runtime/dart_vm_unittests.cc                  |   8 +-
     runtime/runtime_controller.cc                 |  10 +-
     runtime/runtime_controller.h                  |  12 +-
     shell/common/engine.cc                        |   4 +-
     shell/common/engine.h                         |   4 +-
     shell/common/shell.cc                         |  88 ++++++----
     shell/common/shell.h                          |  21 ++-
     testing/testing.cc                            |   4 +-
     testing/testing.h                             |   4 +
     24 files changed, 632 insertions(+), 290 deletions(-)
     create mode 100644 runtime/dart_vm_data.cc
     create mode 100644 runtime/dart_vm_data.h
     create mode 100644 runtime/dart_vm_lifecycle.cc
     create mode 100644 runtime/dart_vm_lifecycle.h
    
    diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter
    index c9914e4c2156f..312e6c329ab71 100644
    --- a/ci/licenses_golden/licenses_flutter
    +++ b/ci/licenses_golden/licenses_flutter
    @@ -383,6 +383,10 @@ FILE: ../../../flutter/runtime/dart_snapshot_buffer.cc
     FILE: ../../../flutter/runtime/dart_snapshot_buffer.h
     FILE: ../../../flutter/runtime/dart_vm.cc
     FILE: ../../../flutter/runtime/dart_vm.h
    +FILE: ../../../flutter/runtime/dart_vm_data.cc
    +FILE: ../../../flutter/runtime/dart_vm_data.h
    +FILE: ../../../flutter/runtime/dart_vm_lifecycle.cc
    +FILE: ../../../flutter/runtime/dart_vm_lifecycle.h
     FILE: ../../../flutter/runtime/dart_vm_unittests.cc
     FILE: ../../../flutter/runtime/embedder_resources.cc
     FILE: ../../../flutter/runtime/embedder_resources.h
    diff --git a/common/settings.h b/common/settings.h
    index bfbfd4139d322..40b647de1f431 100644
    --- a/common/settings.h
    +++ b/common/settings.h
    @@ -85,6 +85,8 @@ struct Settings {
       // Font settings
       bool use_test_fonts = false;
     
    +  bool leak_vm = true;
    +
       // Engine settings
       TaskObserverAdd task_observer_add;
       TaskObserverRemove task_observer_remove;
    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 7f4467886f4fa..3f7f80ef05fd7 100644
    --- a/lib/ui/isolate_name_server/isolate_name_server_natives.cc
    +++ b/lib/ui/isolate_name_server/isolate_name_server_natives.cc
    @@ -14,8 +14,10 @@ namespace blink {
     
     Dart_Handle IsolateNameServerNatives::LookupPortByName(
         const std::string& name) {
    -  IsolateNameServer* name_server =
    -      UIDartState::Current()->GetIsolateNameServer();
    +  auto name_server = UIDartState::Current()->GetIsolateNameServer();
    +  if (!name_server) {
    +    return Dart_Null();
    +  }
       Dart_Port port = name_server->LookupIsolatePortByName(name);
       if (port == ILLEGAL_PORT) {
         return Dart_Null();
    @@ -26,8 +28,10 @@ Dart_Handle IsolateNameServerNatives::LookupPortByName(
     Dart_Handle IsolateNameServerNatives::RegisterPortWithName(
         Dart_Handle port_handle,
         const std::string& name) {
    -  IsolateNameServer* name_server =
    -      UIDartState::Current()->GetIsolateNameServer();
    +  auto name_server = UIDartState::Current()->GetIsolateNameServer();
    +  if (!name_server) {
    +    return Dart_False();
    +  }
       Dart_Port port = ILLEGAL_PORT;
       Dart_SendPortGetId(port_handle, &port);
       if (!name_server->RegisterIsolatePortWithName(port, name)) {
    @@ -38,8 +42,10 @@ Dart_Handle IsolateNameServerNatives::RegisterPortWithName(
     
     Dart_Handle IsolateNameServerNatives::RemovePortNameMapping(
         const std::string& name) {
    -  IsolateNameServer* name_server =
    -      UIDartState::Current()->GetIsolateNameServer();
    +  auto name_server = UIDartState::Current()->GetIsolateNameServer();
    +  if (!name_server) {
    +    return Dart_False();
    +  }
       if (!name_server->RemoveIsolateNameMapping(name)) {
         return Dart_False();
       }
    diff --git a/lib/ui/ui_dart_state.cc b/lib/ui/ui_dart_state.cc
    index b42cbaf5ba607..be0a5348f31a1 100644
    --- a/lib/ui/ui_dart_state.cc
    +++ b/lib/ui/ui_dart_state.cc
    @@ -23,7 +23,7 @@ UIDartState::UIDartState(
         std::string advisory_script_entrypoint,
         std::string logger_prefix,
         UnhandledExceptionCallback unhandled_exception_callback,
    -    IsolateNameServer* isolate_name_server)
    +    std::shared_ptr isolate_name_server)
         : task_runners_(std::move(task_runners)),
           add_callback_(std::move(add_callback)),
           remove_callback_(std::move(remove_callback)),
    @@ -33,7 +33,7 @@ UIDartState::UIDartState(
           advisory_script_entrypoint_(std::move(advisory_script_entrypoint)),
           logger_prefix_(std::move(logger_prefix)),
           unhandled_exception_callback_(unhandled_exception_callback),
    -      isolate_name_server_(isolate_name_server) {
    +      isolate_name_server_(std::move(isolate_name_server)) {
       AddOrRemoveTaskObserver(true /* add */);
     }
     
    @@ -124,7 +124,7 @@ fml::WeakPtr UIDartState::GetResourceContext() const {
       return io_manager_->GetResourceContext();
     }
     
    -IsolateNameServer* UIDartState::GetIsolateNameServer() {
    +std::shared_ptr UIDartState::GetIsolateNameServer() const {
       return isolate_name_server_;
     }
     
    diff --git a/lib/ui/ui_dart_state.h b/lib/ui/ui_dart_state.h
    index f2c63cbacef60..afa5e47e83de8 100644
    --- a/lib/ui/ui_dart_state.h
    +++ b/lib/ui/ui_dart_state.h
    @@ -53,7 +53,7 @@ class UIDartState : public tonic::DartState {
     
       fml::WeakPtr GetResourceContext() const;
     
    -  IsolateNameServer* GetIsolateNameServer();
    +  std::shared_ptr GetIsolateNameServer() const;
     
       tonic::DartErrorHandleType GetLastError();
     
    @@ -81,7 +81,7 @@ class UIDartState : public tonic::DartState {
                   std::string advisory_script_entrypoint,
                   std::string logger_prefix,
                   UnhandledExceptionCallback unhandled_exception_callback,
    -              IsolateNameServer* isolate_name_server);
    +              std::shared_ptr isolate_name_server);
     
       ~UIDartState() override;
     
    @@ -107,7 +107,7 @@ class UIDartState : public tonic::DartState {
       std::unique_ptr window_;
       tonic::DartMicrotaskQueue microtask_queue_;
       UnhandledExceptionCallback unhandled_exception_callback_;
    -  IsolateNameServer* isolate_name_server_;
    +  const std::shared_ptr isolate_name_server_;
     
       void AddOrRemoveTaskObserver(bool add);
     };
    diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
    index 3d0e807585fcd..a906e589c223f 100644
    --- a/runtime/BUILD.gn
    +++ b/runtime/BUILD.gn
    @@ -50,6 +50,10 @@ source_set("runtime") {
         "dart_snapshot_buffer.h",
         "dart_vm.cc",
         "dart_vm.h",
    +    "dart_vm_data.cc",
    +    "dart_vm_data.h",
    +    "dart_vm_lifecycle.cc",
    +    "dart_vm_lifecycle.h",
         "embedder_resources.cc",
         "embedder_resources.h",
         "runtime_controller.cc",
    @@ -115,6 +119,7 @@ executable("runtime_unittests") {
         "$flutter_root/common",
         "$flutter_root/fml",
         "$flutter_root/lib/snapshot",
    +    "$flutter_root/shell/common",
         "$flutter_root/testing:dart",
         "//third_party/skia",
         "//third_party/tonic",
    diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc
    index 7cae71c36e3fd..46df151f40b0e 100644
    --- a/runtime/dart_isolate.cc
    +++ b/runtime/dart_isolate.cc
    @@ -14,6 +14,7 @@
     #include "flutter/lib/ui/dart_ui.h"
     #include "flutter/runtime/dart_service_isolate.h"
     #include "flutter/runtime/dart_vm.h"
    +#include "flutter/runtime/dart_vm_lifecycle.h"
     #include "third_party/dart/runtime/include/dart_api.h"
     #include "third_party/dart/runtime/include/dart_tools_api.h"
     #include "third_party/tonic/converter/dart_converter.h"
    @@ -29,9 +30,9 @@
     namespace blink {
     
     std::weak_ptr DartIsolate::CreateRootIsolate(
    -    DartVM* vm,
    -    fml::RefPtr isolate_snapshot,
    -    fml::RefPtr shared_snapshot,
    +    const Settings& settings,
    +    fml::RefPtr isolate_snapshot,
    +    fml::RefPtr shared_snapshot,
         TaskRunners task_runners,
         std::unique_ptr window,
         fml::WeakPtr snapshot_delegate,
    @@ -50,7 +51,7 @@ 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
    +          settings,                      // settings
               std::move(isolate_snapshot),   // isolate snapshot
               std::move(shared_snapshot),    // shared snapshot
               task_runners,                  // task runners
    @@ -93,9 +94,9 @@ std::weak_ptr DartIsolate::CreateRootIsolate(
       return embedder_isolate;
     }
     
    -DartIsolate::DartIsolate(DartVM* vm,
    -                         fml::RefPtr isolate_snapshot,
    -                         fml::RefPtr shared_snapshot,
    +DartIsolate::DartIsolate(const Settings& settings,
    +                         fml::RefPtr isolate_snapshot,
    +                         fml::RefPtr shared_snapshot,
                              TaskRunners task_runners,
                              fml::WeakPtr snapshot_delegate,
                              fml::WeakPtr io_manager,
    @@ -103,36 +104,31 @@ DartIsolate::DartIsolate(DartVM* vm,
                              std::string advisory_script_entrypoint,
                              ChildIsolatePreparer child_isolate_preparer)
         : UIDartState(std::move(task_runners),
    -                  vm->GetSettings().task_observer_add,
    -                  vm->GetSettings().task_observer_remove,
    +                  settings.task_observer_add,
    +                  settings.task_observer_remove,
                       std::move(snapshot_delegate),
                       std::move(io_manager),
                       advisory_script_uri,
                       advisory_script_entrypoint,
    -                  vm->GetSettings().log_tag,
    -                  vm->GetSettings().unhandled_exception_callback,
    -                  vm->GetIsolateNameServer()),
    -      vm_(vm),
    +                  settings.log_tag,
    +                  settings.unhandled_exception_callback,
    +                  DartVMRef::GetIsolateNameServer()),
    +      settings_(settings),
           isolate_snapshot_(std::move(isolate_snapshot)),
           shared_snapshot_(std::move(shared_snapshot)),
           child_isolate_preparer_(std::move(child_isolate_preparer)) {
       FML_DCHECK(isolate_snapshot_) << "Must contain a valid isolate snapshot.";
    -
    -  if (vm_ == nullptr) {
    -    return;
    -  }
    -
       phase_ = Phase::Uninitialized;
     }
     
     DartIsolate::~DartIsolate() = default;
     
    -DartIsolate::Phase DartIsolate::GetPhase() const {
    -  return phase_;
    +const Settings& DartIsolate::GetSettings() const {
    +  return settings_;
     }
     
    -DartVM* DartIsolate::GetDartVM() const {
    -  return vm_;
    +DartIsolate::Phase DartIsolate::GetPhase() const {
    +  return phase_;
     }
     
     bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) {
    @@ -500,16 +496,16 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
         const char* package_config,
         Dart_IsolateFlags* flags,
         char** error) {
    -  auto vm = DartVM::ForProcessIfInitialized();
    +  auto vm_data = DartVMRef::GetVMData();
     
    -  if (!vm) {
    +  if (!vm_data) {
         *error = strdup(
    -        "Could not resolve the VM when attempting to create the service "
    -        "isolate.");
    +        "Could not access VM data to initialize isolates. This may be because "
    +        "the VM has initialized shutdown on another thread already.");
         return nullptr;
       }
     
    -  const auto& settings = vm->GetSettings();
    +  const auto& settings = vm_data->GetSettings();
     
       if (!settings.enable_observatory) {
         FML_DLOG(INFO) << "Observatory is disabled.";
    @@ -524,16 +520,16 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
     
       std::weak_ptr weak_service_isolate =
           DartIsolate::CreateRootIsolate(
    -          vm.get(),                      // vm
    -          vm->GetIsolateSnapshot(),      // isolate snapshot
    -          vm->GetSharedSnapshot(),       // shared snapshot
    -          null_task_runners,             // task runners
    -          nullptr,                       // window
    -          {},                            // snapshot delegate
    -          {},                            // IO Manager
    -          DART_VM_SERVICE_ISOLATE_NAME,  // script uri
    -          DART_VM_SERVICE_ISOLATE_NAME,  // script entrypoint
    -          flags                          // flags
    +          vm_data->GetSettings(),         // settings
    +          vm_data->GetIsolateSnapshot(),  // isolate snapshot
    +          vm_data->GetSharedSnapshot(),   // shared snapshot
    +          null_task_runners,              // task runners
    +          nullptr,                        // window
    +          {},                             // snapshot delegate
    +          {},                             // IO Manager
    +          DART_VM_SERVICE_ISOLATE_NAME,   // script uri
    +          DART_VM_SERVICE_ISOLATE_NAME,   // script entrypoint
    +          flags                           // flags
           );
     
       std::shared_ptr service_isolate = weak_service_isolate.lock();
    @@ -556,7 +552,13 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
         return nullptr;
       }
     
    -  vm->GetServiceProtocol().ToggleHooks(true);
    +  if (auto service_protocol = DartVMRef::GetServiceProtocol()) {
    +    service_protocol->ToggleHooks(true);
    +  } else {
    +    FML_DLOG(ERROR)
    +        << "Could not acquire the service protocol handlers. This might be "
    +           "because the VM has already begun teardown on another thread.";
    +  }
     
       return service_isolate->isolate();
     }
    @@ -612,16 +614,13 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
       std::unique_ptr> embedder_isolate(
           p_parent_embedder_isolate);
     
    -  if (embedder_isolate == nullptr ||
    -      (*embedder_isolate)->GetDartVM() == nullptr) {
    +  if (embedder_isolate == nullptr) {
         *error =
             strdup("Parent isolate did not have embedder specific callback data.");
         FML_DLOG(ERROR) << *error;
         return {nullptr, {}};
       }
     
    -  DartVM* const vm = (*embedder_isolate)->GetDartVM();
    -
       if (!is_root_isolate) {
         auto* raw_embedder_isolate = embedder_isolate.release();
     
    @@ -630,7 +629,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
     
         embedder_isolate = std::make_unique>(
             std::make_shared(
    -            vm,                                             // vm
    +            (*raw_embedder_isolate)->GetSettings(),         // settings
                 (*raw_embedder_isolate)->GetIsolateSnapshot(),  // isolate_snapshot
                 (*raw_embedder_isolate)->GetSharedSnapshot(),   // shared_snapshot
                 null_task_runners,                              // task_runners
    @@ -703,11 +702,11 @@ void DartIsolate::DartIsolateCleanupCallback(
       delete embedder_isolate;
     }
     
    -fml::RefPtr DartIsolate::GetIsolateSnapshot() const {
    +fml::RefPtr DartIsolate::GetIsolateSnapshot() const {
       return isolate_snapshot_;
     }
     
    -fml::RefPtr DartIsolate::GetSharedSnapshot() const {
    +fml::RefPtr DartIsolate::GetSharedSnapshot() const {
       return shared_snapshot_;
     }
     
    diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h
    index 6b92875e1dc0e..49c3df3c51082 100644
    --- a/runtime/dart_isolate.h
    +++ b/runtime/dart_isolate.h
    @@ -41,9 +41,9 @@ class DartIsolate : public UIDartState {
       // bindings. From the VM's perspective, this isolate is not special in any
       // way.
       static std::weak_ptr CreateRootIsolate(
    -      DartVM* vm,
    -      fml::RefPtr isolate_snapshot,
    -      fml::RefPtr shared_snapshot,
    +      const Settings& settings,
    +      fml::RefPtr isolate_snapshot,
    +      fml::RefPtr shared_snapshot,
           TaskRunners task_runners,
           std::unique_ptr window,
           fml::WeakPtr snapshot_delegate,
    @@ -52,9 +52,9 @@ class DartIsolate : public UIDartState {
           std::string advisory_script_entrypoint,
           Dart_IsolateFlags* flags = nullptr);
     
    -  DartIsolate(DartVM* vm,
    -              fml::RefPtr isolate_snapshot,
    -              fml::RefPtr shared_snapshot,
    +  DartIsolate(const Settings& settings,
    +              fml::RefPtr isolate_snapshot,
    +              fml::RefPtr shared_snapshot,
                   TaskRunners task_runners,
                   fml::WeakPtr snapshot_delegate,
                   fml::WeakPtr io_manager,
    @@ -64,6 +64,8 @@ class DartIsolate : public UIDartState {
     
       ~DartIsolate() override;
     
    +  const Settings& GetSettings() const;
    +
       Phase GetPhase() const;
     
       FML_WARN_UNUSED_RESULT
    @@ -86,11 +88,9 @@ class DartIsolate : public UIDartState {
     
       void AddIsolateShutdownCallback(fml::closure closure);
     
    -  DartVM* GetDartVM() const;
    -
    -  fml::RefPtr GetIsolateSnapshot() const;
    +  fml::RefPtr GetIsolateSnapshot() const;
     
    -  fml::RefPtr GetSharedSnapshot() const;
    +  fml::RefPtr GetSharedSnapshot() const;
     
       std::weak_ptr GetWeakIsolatePtr();
     
    @@ -109,10 +109,10 @@ class DartIsolate : public UIDartState {
       };
       friend class DartVM;
     
    -  DartVM* const vm_ = nullptr;
       Phase phase_ = Phase::Unknown;
    -  const fml::RefPtr isolate_snapshot_;
    -  const fml::RefPtr shared_snapshot_;
    +  const Settings settings_;
    +  const fml::RefPtr isolate_snapshot_;
    +  const fml::RefPtr shared_snapshot_;
       std::vector> kernel_buffers_;
       std::vector> shutdown_callbacks_;
       ChildIsolatePreparer child_isolate_preparer_ = nullptr;
    diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc
    index d35766f58f81f..e2a7c734bb1c8 100644
    --- a/runtime/dart_isolate_unittests.cc
    +++ b/runtime/dart_isolate_unittests.cc
    @@ -9,6 +9,7 @@
     #include "flutter/fml/thread.h"
     #include "flutter/runtime/dart_isolate.h"
     #include "flutter/runtime/dart_vm.h"
    +#include "flutter/runtime/dart_vm_lifecycle.h"
     #include "flutter/runtime/runtime_test.h"
     #include "flutter/testing/testing.h"
     #include "flutter/testing/thread_test.h"
    @@ -26,8 +27,10 @@ using DartIsolateTest = RuntimeTest;
     
     TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) {
       auto settings = CreateSettingsForFixture();
    -  auto vm = DartVM::ForProcess(settings);
    -  ASSERT_TRUE(vm);
    +  auto vm_ref = DartVMRef::Create(settings);
    +  ASSERT_TRUE(vm_ref);
    +  auto vm_data = vm_ref.GetVMData();
    +  ASSERT_TRUE(vm_data);
       TaskRunners task_runners(CURRENT_TEST_NAME,       //
                                GetCurrentTaskRunner(),  //
                                GetCurrentTaskRunner(),  //
    @@ -35,15 +38,15 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) {
                                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
    -      {},                        // io manager
    -      "main.dart",               // advisory uri
    -      "main"                     // advisory entrypoint
    +      vm_data->GetSettings(),         // settings
    +      vm_data->GetIsolateSnapshot(),  // isolate snapshot
    +      vm_data->GetSharedSnapshot(),   // shared snapshot
    +      std::move(task_runners),        // task runners
    +      nullptr,                        // window
    +      {},                             // snapshot delegate
    +      {},                             // io manager
    +      "main.dart",                    // advisory uri
    +      "main"                          // advisory entrypoint
       );
       auto root_isolate = weak_isolate.lock();
       ASSERT_TRUE(root_isolate);
    @@ -53,8 +56,10 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) {
     
     TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) {
       auto settings = CreateSettingsForFixture();
    -  auto vm = DartVM::ForProcess(settings);
    -  ASSERT_TRUE(vm);
    +  auto vm_ref = DartVMRef::Create(settings);
    +  ASSERT_TRUE(vm_ref);
    +  auto vm_data = vm_ref.GetVMData();
    +  ASSERT_TRUE(vm_data);
       TaskRunners task_runners(CURRENT_TEST_NAME,       //
                                GetCurrentTaskRunner(),  //
                                GetCurrentTaskRunner(),  //
    @@ -62,15 +67,15 @@ TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) {
                                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
    -      {},                        // io manager
    -      "main.dart",               // advisory uri
    -      "main"                     // advisory entrypoint
    +      vm_data->GetSettings(),         // settings
    +      vm_data->GetIsolateSnapshot(),  // isolate snapshot
    +      vm_data->GetSharedSnapshot(),   // shared snapshot
    +      std::move(task_runners),        // task runners
    +      nullptr,                        // window
    +      {},                             // snapshot delegate
    +      {},                             // io manager
    +      "main.dart",                    // advisory uri
    +      "main"                          // advisory entrypoint
       );
       auto root_isolate = weak_isolate.lock();
       ASSERT_TRUE(root_isolate);
    @@ -148,11 +153,12 @@ static void RunDartCodeInIsolate(std::unique_ptr& result,
                                      fml::RefPtr task_runner,
                                      std::string entrypoint) {
       FML_CHECK(task_runner->RunsTasksOnCurrentThread());
    -  auto vm = DartVM::ForProcess(settings);
    +  auto vm_ref = DartVMRef::Create(settings);
     
    -  if (!vm) {
    +  if (!vm_ref) {
         return;
       }
    +
       TaskRunners task_runners(CURRENT_TEST_NAME,  //
                                task_runner,        //
                                task_runner,        //
    @@ -160,16 +166,22 @@ static void RunDartCodeInIsolate(std::unique_ptr& result,
                                task_runner         //
       );
     
    +  auto vm_data = vm_ref.GetVMData();
    +
    +  if (!vm_data) {
    +    return;
    +  }
    +
       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
    -      {},                        // io manager
    -      "main.dart",               // advisory uri
    -      "main"                     // advisory entrypoint
    +      vm_data->GetSettings(),         // settings
    +      vm_data->GetIsolateSnapshot(),  // isolate snapshot
    +      vm_data->GetSharedSnapshot(),   // shared snapshot
    +      std::move(task_runners),        // task runners
    +      nullptr,                        // window
    +      {},                             // snapshot delegate
    +      {},                             // io manager
    +      "main.dart",                    // advisory uri
    +      "main"                          // advisory entrypoint
       );
     
       auto root_isolate =
    diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc
    index 4c6054f7be25f..110f7c2b27809 100644
    --- a/runtime/dart_vm.cc
    +++ b/runtime/dart_vm.cc
    @@ -15,6 +15,7 @@
     #include "flutter/fml/file.h"
     #include "flutter/fml/logging.h"
     #include "flutter/fml/mapping.h"
    +#include "flutter/fml/synchronization/thread_annotations.h"
     #include "flutter/fml/time/time_delta.h"
     #include "flutter/fml/trace_event.h"
     #include "flutter/lib/io/dart_io.h"
    @@ -219,66 +220,48 @@ static void EmbedderInformationCallback(Dart_EmbedderInformation* info) {
       info->name = "Flutter";
     }
     
    -fml::RefPtr DartVM::ForProcess(Settings settings) {
    -  return ForProcess(settings, nullptr, nullptr, nullptr);
    -}
    -
    -static std::once_flag gVMInitialization;
    -static std::mutex gVMMutex;
    -static fml::RefPtr gVM;
    -
    -fml::RefPtr DartVM::ForProcess(
    +std::shared_ptr DartVM::Create(
         Settings settings,
         fml::RefPtr vm_snapshot,
         fml::RefPtr isolate_snapshot,
    -    fml::RefPtr shared_snapshot) {
    -  std::lock_guard lock(gVMMutex);
    -  std::call_once(gVMInitialization, [settings,          //
    -                                     vm_snapshot,       //
    -                                     isolate_snapshot,  //
    -                                     shared_snapshot    //
    -  ]() mutable {
    -    if (!vm_snapshot) {
    -      vm_snapshot = DartSnapshot::VMSnapshotFromSettings(settings);
    -    }
    -    if (!(vm_snapshot && vm_snapshot->IsValid())) {
    -      FML_LOG(ERROR) << "VM snapshot must be valid.";
    -      return;
    -    }
    -    if (!isolate_snapshot) {
    -      isolate_snapshot = DartSnapshot::IsolateSnapshotFromSettings(settings);
    -    }
    -    if (!(isolate_snapshot && isolate_snapshot->IsValid())) {
    -      FML_LOG(ERROR) << "Isolate snapshot must be valid.";
    -      return;
    -    }
    -    if (!shared_snapshot) {
    -      shared_snapshot = DartSnapshot::Empty();
    -    }
    -    gVM = fml::MakeRefCounted(settings,                     //
    -                                      std::move(vm_snapshot),       //
    -                                      std::move(isolate_snapshot),  //
    -                                      std::move(shared_snapshot)    //
    -    );
    -  });
    -  return gVM;
    +    fml::RefPtr shared_snapshot,
    +    std::shared_ptr isolate_name_server) {
    +  auto vm_data = DartVMData::Create(settings,                     //
    +                                    std::move(vm_snapshot),       //
    +                                    std::move(isolate_snapshot),  //
    +                                    std::move(shared_snapshot)    //
    +  );
    +
    +  if (!vm_data) {
    +    FML_LOG(ERROR) << "Could not setup VM data to bootstrap the VM from.";
    +    return {};
    +  }
    +
    +  // Note: std::make_shared unviable due to hidden constructor.
    +  return std::shared_ptr(
    +      new DartVM(std::move(vm_data), std::move(isolate_name_server)));
     }
     
    -fml::RefPtr DartVM::ForProcessIfInitialized() {
    -  std::lock_guard lock(gVMMutex);
    -  return gVM;
    +static std::atomic_size_t gVMLaunchCount;
    +
    +size_t DartVM::GetVMLaunchCount() {
    +  return gVMLaunchCount;
     }
     
    -DartVM::DartVM(const Settings& settings,
    -               fml::RefPtr vm_snapshot,
    -               fml::RefPtr isolate_snapshot,
    -               fml::RefPtr shared_snapshot)
    -    : settings_(settings),
    -      vm_snapshot_(std::move(vm_snapshot)),
    -      isolate_snapshot_(std::move(isolate_snapshot)),
    -      shared_snapshot_(std::move(shared_snapshot)),
    -      weak_factory_(this) {
    +DartVM::DartVM(std::shared_ptr vm_data,
    +               std::shared_ptr isolate_name_server)
    +    : settings_(vm_data->GetSettings()),
    +      vm_data_(vm_data),
    +      isolate_name_server_(std::move(isolate_name_server)),
    +      service_protocol_(std::make_shared()) {
       TRACE_EVENT0("flutter", "DartVMInitializer");
    +
    +  gVMLaunchCount++;
    +
    +  FML_DCHECK(vm_data_);
    +  FML_DCHECK(isolate_name_server_);
    +  FML_DCHECK(service_protocol_);
    +
       FML_DLOG(INFO) << "Attempting Dart VM launch for mode: "
                      << (IsRunningPrecompiledCode() ? "AOT" : "Interpreter");
     
    @@ -286,8 +269,8 @@ DartVM::DartVM(const Settings& settings,
         TRACE_EVENT0("flutter", "dart::bin::BootstrapDartIo");
         dart::bin::BootstrapDartIo();
     
    -    if (!settings.temp_directory_path.empty()) {
    -      dart::bin::SetSystemTempDirectory(settings.temp_directory_path.c_str());
    +    if (!settings_.temp_directory_path.empty()) {
    +      dart::bin::SetSystemTempDirectory(settings_.temp_directory_path.c_str());
         }
       }
     
    @@ -300,7 +283,7 @@ DartVM::DartVM(const Settings& settings,
       args.push_back("--ignore-unrecognized-flags");
     
       for (auto* const profiler_flag :
    -       ProfilingFlags(settings.enable_dart_profiling)) {
    +       ProfilingFlags(settings_.enable_dart_profiling)) {
         args.push_back(profiler_flag);
       }
     
    @@ -313,7 +296,7 @@ DartVM::DartVM(const Settings& settings,
     
       // Enable Dart assertions if we are not running precompiled code. We run non-
       // precompiled code only in the debug product mode.
    -  bool enable_asserts = !settings.disable_dart_asserts;
    +  bool enable_asserts = !settings_.disable_dart_asserts;
     
     #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_PROFILE || \
         FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE
    @@ -337,24 +320,24 @@ DartVM::DartVM(const Settings& settings,
         PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs));
       }
     
    -  if (settings.start_paused) {
    +  if (settings_.start_paused) {
         PushBackAll(&args, kDartStartPausedArgs, arraysize(kDartStartPausedArgs));
       }
     
    -  if (settings.endless_trace_buffer || settings.trace_startup) {
    +  if (settings_.endless_trace_buffer || settings_.trace_startup) {
         // If we are tracing startup, make sure the trace buffer is endless so we
         // don't lose early traces.
         PushBackAll(&args, kDartEndlessTraceBufferArgs,
                     arraysize(kDartEndlessTraceBufferArgs));
       }
     
    -  if (settings.trace_systrace) {
    +  if (settings_.trace_systrace) {
         PushBackAll(&args, kDartSystraceTraceBufferArgs,
                     arraysize(kDartSystraceTraceBufferArgs));
         PushBackAll(&args, kDartTraceStreamsArgs, arraysize(kDartTraceStreamsArgs));
       }
     
    -  if (settings.trace_startup) {
    +  if (settings_.trace_startup) {
         PushBackAll(&args, kDartTraceStartupArgs, arraysize(kDartTraceStartupArgs));
       }
     
    @@ -363,8 +346,8 @@ DartVM::DartVM(const Settings& settings,
       PushBackAll(&args, kDartTraceStreamsArgs, arraysize(kDartTraceStreamsArgs));
     #endif
     
    -  for (size_t i = 0; i < settings.dart_flags.size(); i++)
    -    args.push_back(settings.dart_flags[i].c_str());
    +  for (size_t i = 0; i < settings_.dart_flags.size(); i++)
    +    args.push_back(settings_.dart_flags[i].c_str());
     
       char* flags_error = Dart_SetVMFlags(args.size(), args.data());
       if (flags_error) {
    @@ -374,14 +357,14 @@ DartVM::DartVM(const Settings& settings,
     
       DartUI::InitForGlobal();
     
    -  Dart_SetFileModifiedCallback(&DartFileModifiedCallback);
    -
       {
         TRACE_EVENT0("flutter", "Dart_Initialize");
         Dart_InitializeParams params = {};
         params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION;
    -    params.vm_snapshot_data = vm_snapshot_->GetData()->GetSnapshotPointer();
    -    params.vm_snapshot_instructions = vm_snapshot_->GetInstructionsIfPresent();
    +    params.vm_snapshot_data =
    +        vm_data_->GetVMSnapshot().GetData()->GetSnapshotPointer();
    +    params.vm_snapshot_instructions =
    +        vm_data_->GetVMSnapshot().GetInstructionsIfPresent();
         params.create = reinterpret_cast(
             DartIsolate::DartIsolateCreateCallback);
         params.shutdown = reinterpret_cast(
    @@ -413,59 +396,58 @@ DartVM::DartVM(const Settings& settings,
         }
       }
     
    +  Dart_SetFileModifiedCallback(&DartFileModifiedCallback);
    +
       // Allow streaming of stdout and stderr by the Dart vm.
       Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback,
                                      &ServiceStreamCancelCallback);
     
       Dart_SetEmbedderInformationCallback(&EmbedderInformationCallback);
     
    -  if (settings.dart_library_sources_kernel != nullptr) {
    +  if (settings_.dart_library_sources_kernel != nullptr) {
         std::unique_ptr dart_library_sources =
    -        settings.dart_library_sources_kernel();
    +        settings_.dart_library_sources_kernel();
         // Set sources for dart:* libraries for debugging.
         Dart_SetDartLibrarySourcesKernel(dart_library_sources->GetMapping(),
                                          dart_library_sources->GetSize());
       }
    +
    +  FML_DLOG(INFO) << "New Dart VM instance created. Instance count: "
    +                 << gVMLaunchCount;
     }
     
     DartVM::~DartVM() {
       if (Dart_CurrentIsolate() != nullptr) {
         Dart_ExitIsolate();
       }
    +
       char* result = Dart_Cleanup();
    -  if (result != nullptr) {
    -    FML_LOG(ERROR) << "Could not cleanly shut down the Dart VM. Message: \""
    -                   << result << "\".";
    -    free(result);
    -  }
    -}
     
    -const Settings& DartVM::GetSettings() const {
    -  return settings_;
    -}
    +  dart::bin::CleanupDartIo();
     
    -const DartSnapshot& DartVM::GetVMSnapshot() const {
    -  return *vm_snapshot_.get();
    -}
    +  FML_CHECK(result == nullptr)
    +      << "Could not cleanly shut down the Dart VM. Error: \"" << result
    +      << "\".";
    +  free(result);
     
    -IsolateNameServer* DartVM::GetIsolateNameServer() {
    -  return &isolate_name_server_;
    +  FML_DLOG(INFO) << "Dart VM instance destroyed. Instance count: "
    +                 << gVMLaunchCount;
     }
     
    -fml::RefPtr DartVM::GetIsolateSnapshot() const {
    -  return isolate_snapshot_;
    +std::shared_ptr DartVM::GetVMData() const {
    +  return vm_data_;
     }
     
    -fml::RefPtr DartVM::GetSharedSnapshot() const {
    -  return shared_snapshot_;
    +const Settings& DartVM::GetSettings() const {
    +  return settings_;
     }
     
    -ServiceProtocol& DartVM::GetServiceProtocol() {
    +std::shared_ptr DartVM::GetServiceProtocol() const {
       return service_protocol_;
     }
     
    -fml::WeakPtr DartVM::GetWeakPtr() {
    -  return weak_factory_.GetWeakPtr();
    +std::shared_ptr DartVM::GetIsolateNameServer() const {
    +  return isolate_name_server_;
     }
     
     }  // namespace blink
    diff --git a/runtime/dart_vm.h b/runtime/dart_vm.h
    index 2c3ac0e30381e..6724abde0b828 100644
    --- a/runtime/dart_vm.h
    +++ b/runtime/dart_vm.h
    @@ -5,9 +5,8 @@
     #ifndef FLUTTER_RUNTIME_DART_VM_H_
     #define FLUTTER_RUNTIME_DART_VM_H_
     
    -#include 
    +#include 
     #include 
    -#include 
     
     #include "flutter/common/settings.h"
     #include "flutter/fml/build_config.h"
    @@ -19,57 +18,46 @@
     #include "flutter/lib/ui/isolate_name_server/isolate_name_server.h"
     #include "flutter/runtime/dart_isolate.h"
     #include "flutter/runtime/dart_snapshot.h"
    +#include "flutter/runtime/dart_vm_data.h"
     #include "flutter/runtime/service_protocol.h"
     #include "third_party/dart/runtime/include/dart_api.h"
     
     namespace blink {
     
    -class DartVM : public fml::RefCountedThreadSafe {
    +class DartVM {
      public:
    -  static fml::RefPtr ForProcess(Settings settings);
    -
    -  static fml::RefPtr ForProcess(
    -      Settings settings,
    -      fml::RefPtr vm_snapshot,
    -      fml::RefPtr isolate_snapshot,
    -      fml::RefPtr shared_snapshot);
    -
    -  static fml::RefPtr ForProcessIfInitialized();
    +  ~DartVM();
     
       static bool IsRunningPrecompiledCode();
     
    -  const Settings& GetSettings() const;
    -
    -  const DartSnapshot& GetVMSnapshot() const;
    +  static size_t GetVMLaunchCount();
     
    -  IsolateNameServer* GetIsolateNameServer();
    -
    -  fml::RefPtr GetIsolateSnapshot() const;
    +  const Settings& GetSettings() const;
     
    -  fml::RefPtr GetSharedSnapshot() const;
    +  std::shared_ptr GetVMData() const;
     
    -  fml::WeakPtr GetWeakPtr();
    +  std::shared_ptr GetServiceProtocol() const;
     
    -  ServiceProtocol& GetServiceProtocol();
    +  std::shared_ptr GetIsolateNameServer() const;
     
      private:
       const Settings settings_;
    -  const fml::RefPtr vm_snapshot_;
    -  IsolateNameServer isolate_name_server_;
    -  const fml::RefPtr isolate_snapshot_;
    -  const fml::RefPtr shared_snapshot_;
    -  ServiceProtocol service_protocol_;
    -  fml::WeakPtrFactory weak_factory_;
    -
    -  DartVM(const Settings& settings,
    -         fml::RefPtr vm_snapshot,
    -         fml::RefPtr isolate_snapshot,
    -         fml::RefPtr shared_snapshot);
    +  std::shared_ptr vm_data_;
    +  const std::shared_ptr isolate_name_server_;
    +  const std::shared_ptr service_protocol_;
     
    -  ~DartVM();
    +  friend class DartVMRef;
    +
    +  static std::shared_ptr Create(
    +      Settings settings,
    +      fml::RefPtr vm_snapshot,
    +      fml::RefPtr isolate_snapshot,
    +      fml::RefPtr shared_snapshot,
    +      std::shared_ptr isolate_name_server);
    +
    +  DartVM(std::shared_ptr data,
    +         std::shared_ptr isolate_name_server);
     
    -  FML_FRIEND_REF_COUNTED_THREAD_SAFE(DartVM);
    -  FML_FRIEND_MAKE_REF_COUNTED(DartVM);
       FML_DISALLOW_COPY_AND_ASSIGN(DartVM);
     };
     
    diff --git a/runtime/dart_vm_data.cc b/runtime/dart_vm_data.cc
    new file mode 100644
    index 0000000000000..a29074f79c92e
    --- /dev/null
    +++ b/runtime/dart_vm_data.cc
    @@ -0,0 +1,79 @@
    +// Copyright 2013 The Flutter 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_vm_data.h"
    +
    +namespace blink {
    +
    +std::shared_ptr DartVMData::Create(
    +    Settings settings,
    +    fml::RefPtr vm_snapshot,
    +    fml::RefPtr isolate_snapshot,
    +    fml::RefPtr shared_snapshot) {
    +  if (!vm_snapshot || !vm_snapshot->IsValid()) {
    +    // Caller did not provide a valid VM snapshot. Attempt to infer one
    +    // from the settings.
    +    vm_snapshot = DartSnapshot::VMSnapshotFromSettings(settings);
    +    if (!vm_snapshot) {
    +      FML_LOG(ERROR)
    +          << "VM snapshot invalid and could not be inferred from settings.";
    +      return {};
    +    }
    +  }
    +
    +  if (!isolate_snapshot || !isolate_snapshot->IsValid()) {
    +    // Caller did not provide a valid isolate snapshot. Attempt to infer one
    +    // from the settings.
    +    isolate_snapshot = DartSnapshot::IsolateSnapshotFromSettings(settings);
    +    if (!isolate_snapshot) {
    +      FML_LOG(ERROR) << "Isolate snapshot invalid and could not be inferred "
    +                        "from settings.";
    +      return {};
    +    }
    +  }
    +
    +  if (!shared_snapshot || !shared_snapshot->IsValid()) {
    +    shared_snapshot = DartSnapshot::Empty();
    +    if (!shared_snapshot) {
    +      FML_LOG(ERROR) << "Shared snapshot invalid.";
    +      return {};
    +    }
    +  }
    +
    +  return std::shared_ptr(new DartVMData(
    +      std::move(settings),          //
    +      std::move(vm_snapshot),       //
    +      std::move(isolate_snapshot),  //
    +      std::move(shared_snapshot)    //
    +      ));
    +}
    +
    +DartVMData::DartVMData(Settings settings,
    +                       fml::RefPtr vm_snapshot,
    +                       fml::RefPtr isolate_snapshot,
    +                       fml::RefPtr shared_snapshot)
    +    : settings_(settings),
    +      vm_snapshot_(vm_snapshot),
    +      isolate_snapshot_(isolate_snapshot),
    +      shared_snapshot_(shared_snapshot) {}
    +
    +DartVMData::~DartVMData() = default;
    +
    +const Settings& DartVMData::GetSettings() const {
    +  return settings_;
    +}
    +
    +const DartSnapshot& DartVMData::GetVMSnapshot() const {
    +  return *vm_snapshot_;
    +}
    +
    +fml::RefPtr DartVMData::GetIsolateSnapshot() const {
    +  return isolate_snapshot_;
    +}
    +
    +fml::RefPtr DartVMData::GetSharedSnapshot() const {
    +  return shared_snapshot_;
    +}
    +
    +}  // namespace blink
    diff --git a/runtime/dart_vm_data.h b/runtime/dart_vm_data.h
    new file mode 100644
    index 0000000000000..906cad1a4ca05
    --- /dev/null
    +++ b/runtime/dart_vm_data.h
    @@ -0,0 +1,47 @@
    +// Copyright 2013 The Flutter 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_VM_DATA_H_
    +#define FLUTTER_RUNTIME_DART_VM_DATA_H_
    +
    +#include "flutter/fml/macros.h"
    +#include "flutter/runtime/dart_snapshot.h"
    +
    +namespace blink {
    +
    +class DartVMData {
    + public:
    +  static std::shared_ptr Create(
    +      Settings settings,
    +      fml::RefPtr vm_snapshot,
    +      fml::RefPtr isolate_snapshot,
    +      fml::RefPtr shared_snapshot);
    +
    +  ~DartVMData();
    +
    +  const Settings& GetSettings() const;
    +
    +  const DartSnapshot& GetVMSnapshot() const;
    +
    +  fml::RefPtr GetIsolateSnapshot() const;
    +
    +  fml::RefPtr GetSharedSnapshot() const;
    +
    + private:
    +  const Settings settings_;
    +  const fml::RefPtr vm_snapshot_;
    +  const fml::RefPtr isolate_snapshot_;
    +  const fml::RefPtr shared_snapshot_;
    +
    +  DartVMData(Settings settings,
    +             fml::RefPtr vm_snapshot,
    +             fml::RefPtr isolate_snapshot,
    +             fml::RefPtr shared_snapshot);
    +
    +  FML_DISALLOW_COPY_AND_ASSIGN(DartVMData);
    +};
    +
    +}  // namespace blink
    +
    +#endif  // FLUTTER_RUNTIME_DART_VM_DATA_H_
    diff --git a/runtime/dart_vm_lifecycle.cc b/runtime/dart_vm_lifecycle.cc
    new file mode 100644
    index 0000000000000..1ed86e0250c4b
    --- /dev/null
    +++ b/runtime/dart_vm_lifecycle.cc
    @@ -0,0 +1,117 @@
    +// Copyright 2013 The Flutter 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_vm_lifecycle.h"
    +
    +#include 
    +
    +namespace blink {
    +
    +// We need to explicitly put the constructor and destructor of the DartVM in the
    +// critical section. All accesses (not just const members) to the global VM
    +// object weak pointer are behind this mutex.
    +static std::mutex gVMMutex;
    +static std::weak_ptr gVM FML_GUARDED_BY(gVMMutex);
    +static std::shared_ptr gVMLeak FML_GUARDED_BY(gVMMutex);
    +
    +// We are going to be modifying more than just the control blocks of the
    +// following weak pointers (in the |Create| case where an old VM could not be
    +// reused). Ideally, we would use |std::atomic>| specialization
    +// but that is only available since C++20. We don't expect contention on these
    +// locks so we just use one mutex for all.
    +static std::mutex gVMDependentsMutex;
    +static std::weak_ptr gVMData
    +    FML_GUARDED_BY(gVMDependentsMutex);
    +static std::weak_ptr gVMServiceProtocol
    +    FML_GUARDED_BY(gVMDependentsMutex);
    +static std::weak_ptr gVMIsolateNameServer
    +    FML_GUARDED_BY(gVMDependentsMutex);
    +
    +DartVMRef::DartVMRef(std::shared_ptr vm) : vm_(vm) {}
    +
    +DartVMRef::DartVMRef(DartVMRef&& other) = default;
    +
    +DartVMRef::~DartVMRef() {
    +  if (!vm_) {
    +    // If there is no valid VM (possible via a move), there is no way that the
    +    // decrement on the shared pointer can cause a collection. Avoid acquiring
    +    // the lifecycle lock in this case. This is just working around a
    +    // pessimization and not required for correctness.
    +    return;
    +  }
    +  std::lock_guard lifecycle_lock(gVMMutex);
    +  vm_.reset();
    +}
    +
    +DartVMRef DartVMRef::Create(Settings settings,
    +                            fml::RefPtr vm_snapshot,
    +                            fml::RefPtr isolate_snapshot,
    +                            fml::RefPtr shared_snapshot) {
    +  std::lock_guard lifecycle_lock(gVMMutex);
    +
    +  // If there is already a running VM in the process, grab a strong reference to
    +  // it.
    +  if (auto vm = gVM.lock()) {
    +    FML_DLOG(WARNING) << "Attempted to create a VM in a process where one was "
    +                         "already running. Ignoring arguments for current VM "
    +                         "create call and reusing the old VM.";
    +    // There was already a running VM in the process,
    +    return DartVMRef{std::move(vm)};
    +  }
    +
    +  std::lock_guard dependents_lock(gVMDependentsMutex);
    +
    +  gVMData.reset();
    +  gVMServiceProtocol.reset();
    +  gVMIsolateNameServer.reset();
    +  gVM.reset();
    +
    +  // If there is no VM in the process. Initialize one, hold the weak reference
    +  // and pass a strong reference to the caller.
    +  auto isolate_name_server = std::make_shared();
    +  auto vm = DartVM::Create(std::move(settings),          //
    +                           std::move(vm_snapshot),       //
    +                           std::move(isolate_snapshot),  //
    +                           std::move(shared_snapshot),   //
    +                           isolate_name_server           //
    +  );
    +
    +  if (!vm) {
    +    FML_LOG(ERROR) << "Could not create Dart VM instance.";
    +    return {nullptr};
    +  }
    +
    +  gVMData = vm->GetVMData();
    +  gVMServiceProtocol = vm->GetServiceProtocol();
    +  gVMIsolateNameServer = isolate_name_server;
    +  gVM = vm;
    +
    +  if (settings.leak_vm) {
    +    gVMLeak = vm;
    +  }
    +
    +  return DartVMRef{std::move(vm)};
    +}
    +
    +bool DartVMRef::IsInstanceRunning() {
    +  std::lock_guard lock(gVMMutex);
    +  return !gVM.expired();
    +}
    +
    +std::shared_ptr DartVMRef::GetVMData() {
    +  std::lock_guard lock(gVMDependentsMutex);
    +  return gVMData.lock();
    +}
    +
    +std::shared_ptr DartVMRef::GetServiceProtocol() {
    +  std::lock_guard lock(gVMDependentsMutex);
    +  return gVMServiceProtocol.lock();
    +}
    +
    +std::shared_ptr DartVMRef::GetIsolateNameServer() {
    +  std::lock_guard lock(gVMDependentsMutex);
    +  return gVMIsolateNameServer.lock();
    +}
    +
    +}  // namespace blink
    diff --git a/runtime/dart_vm_lifecycle.h b/runtime/dart_vm_lifecycle.h
    new file mode 100644
    index 0000000000000..cfe1f1b646469
    --- /dev/null
    +++ b/runtime/dart_vm_lifecycle.h
    @@ -0,0 +1,72 @@
    +// Copyright 2013 The Flutter 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_VM_LIFECYCLE_H_
    +#define FLUTTER_RUNTIME_DART_VM_LIFECYCLE_H_
    +
    +#include 
    +
    +#include "flutter/fml/macros.h"
    +#include "flutter/lib/ui/isolate_name_server/isolate_name_server.h"
    +#include "flutter/runtime/dart_vm.h"
    +#include "flutter/runtime/service_protocol.h"
    +
    +namespace blink {
    +
    +// A strong reference to the Dart VM. There can only be one VM running in the
    +// process at any given time. A reference to the VM may only be obtained via the
    +// |Create| method. In case there is already a running instance of the VM in the
    +// process, a strong reference to that VM is obtained and the arguments to the
    +// |Create| call ignored. If there is no VM already running in the process, a VM
    +// is initialized in a thread safe manner and returned to the caller. The VM
    +// will shutdown only when all callers relinquish their references (by
    +// collecting their instances of this class).
    +//
    +// DartVMRef instances may be created on any thread.
    +class DartVMRef {
    + public:
    +  FML_WARN_UNUSED_RESULT
    +  static DartVMRef Create(Settings settings,
    +                          fml::RefPtr vm_snapshot = nullptr,
    +                          fml::RefPtr isolate_snapshot = nullptr,
    +                          fml::RefPtr shared_snapshot = nullptr);
    +
    +  DartVMRef(DartVMRef&&);
    +
    +  ~DartVMRef();
    +
    +  // This is an inherently racy way to check if a VM instance is running and
    +  // should not be used outside of unit-tests where there is a known threading
    +  // model.
    +  static bool IsInstanceRunning();
    +
    +  static std::shared_ptr GetVMData();
    +
    +  static std::shared_ptr GetServiceProtocol();
    +
    +  static std::shared_ptr GetIsolateNameServer();
    +
    +  operator bool() const { return static_cast(vm_); }
    +
    +  DartVM* operator->() {
    +    FML_DCHECK(vm_);
    +    return vm_.get();
    +  }
    +
    +  DartVM* operator&() {
    +    FML_DCHECK(vm_);
    +    return vm_.get();
    +  }
    +
    + private:
    +  std::shared_ptr vm_;
    +
    +  DartVMRef(std::shared_ptr vm);
    +
    +  FML_DISALLOW_COPY_AND_ASSIGN(DartVMRef);
    +};
    +
    +}  // namespace blink
    +
    +#endif  // FLUTTER_RUNTIME_DART_VM_LIFECYCLE_H_
    diff --git a/runtime/dart_vm_unittests.cc b/runtime/dart_vm_unittests.cc
    index a0cfdfbbc5f71..2c143432b5b74 100644
    --- a/runtime/dart_vm_unittests.cc
    +++ b/runtime/dart_vm_unittests.cc
    @@ -3,6 +3,7 @@
     // found in the LICENSE file.
     
     #include "flutter/runtime/dart_vm.h"
    +#include "flutter/runtime/dart_vm_lifecycle.h"
     #include "gtest/gtest.h"
     
     namespace blink {
    @@ -11,16 +12,17 @@ TEST(DartVM, SimpleInitialization) {
       Settings settings = {};
       settings.task_observer_add = [](intptr_t, fml::closure) {};
       settings.task_observer_remove = [](intptr_t) {};
    -  auto vm = DartVM::ForProcess(settings);
    +  auto vm = DartVMRef::Create(settings);
       ASSERT_TRUE(vm);
    -  ASSERT_EQ(vm, DartVM::ForProcess(settings));
     }
     
     TEST(DartVM, SimpleIsolateNameServer) {
       Settings settings = {};
       settings.task_observer_add = [](intptr_t, fml::closure) {};
       settings.task_observer_remove = [](intptr_t) {};
    -  auto vm = DartVM::ForProcess(settings);
    +  auto vm = DartVMRef::Create(settings);
    +  ASSERT_TRUE(vm);
    +  ASSERT_TRUE(vm.GetVMData());
       auto ns = vm->GetIsolateNameServer();
       ASSERT_EQ(ns->LookupIsolatePortByName("foobar"), ILLEGAL_PORT);
       ASSERT_FALSE(ns->RemoveIsolateNameMapping("foobar"));
    diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc
    index 83a848e87955c..e1aaf51de829f 100644
    --- a/runtime/runtime_controller.cc
    +++ b/runtime/runtime_controller.cc
    @@ -17,8 +17,8 @@ namespace blink {
     RuntimeController::RuntimeController(
         RuntimeDelegate& p_client,
         DartVM* p_vm,
    -    fml::RefPtr p_isolate_snapshot,
    -    fml::RefPtr p_shared_snapshot,
    +    fml::RefPtr p_isolate_snapshot,
    +    fml::RefPtr p_shared_snapshot,
         TaskRunners p_task_runners,
         fml::WeakPtr p_snapshot_delegate,
         fml::WeakPtr p_io_manager,
    @@ -40,8 +40,8 @@ RuntimeController::RuntimeController(
     RuntimeController::RuntimeController(
         RuntimeDelegate& p_client,
         DartVM* p_vm,
    -    fml::RefPtr p_isolate_snapshot,
    -    fml::RefPtr p_shared_snapshot,
    +    fml::RefPtr p_isolate_snapshot,
    +    fml::RefPtr p_shared_snapshot,
         TaskRunners p_task_runners,
         fml::WeakPtr p_snapshot_delegate,
         fml::WeakPtr p_io_manager,
    @@ -61,7 +61,7 @@ RuntimeController::RuntimeController(
           idle_notification_callback_(idle_notification_callback),
           window_data_(std::move(p_window_data)),
           root_isolate_(
    -          DartIsolate::CreateRootIsolate(vm_,
    +          DartIsolate::CreateRootIsolate(vm_->GetVMData()->GetSettings(),
                                              isolate_snapshot_,
                                              shared_snapshot_,
                                              task_runners_,
    diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h
    index 03f1389d8c613..79d020ed38375 100644
    --- a/runtime/runtime_controller.h
    +++ b/runtime/runtime_controller.h
    @@ -30,8 +30,8 @@ class RuntimeController final : public WindowClient {
      public:
       RuntimeController(RuntimeDelegate& client,
                         DartVM* vm,
    -                    fml::RefPtr isolate_snapshot,
    -                    fml::RefPtr shared_snapshot,
    +                    fml::RefPtr isolate_snapshot,
    +                    fml::RefPtr shared_snapshot,
                         TaskRunners task_runners,
                         fml::WeakPtr snapshot_delegate,
                         fml::WeakPtr io_manager,
    @@ -121,8 +121,8 @@ class RuntimeController final : public WindowClient {
     
       RuntimeDelegate& client_;
       DartVM* const vm_;
    -  fml::RefPtr isolate_snapshot_;
    -  fml::RefPtr shared_snapshot_;
    +  fml::RefPtr isolate_snapshot_;
    +  fml::RefPtr shared_snapshot_;
       TaskRunners task_runners_;
       fml::WeakPtr snapshot_delegate_;
       fml::WeakPtr io_manager_;
    @@ -135,8 +135,8 @@ class RuntimeController final : public WindowClient {
     
       RuntimeController(RuntimeDelegate& client,
                         DartVM* vm,
    -                    fml::RefPtr isolate_snapshot,
    -                    fml::RefPtr shared_snapshot,
    +                    fml::RefPtr isolate_snapshot,
    +                    fml::RefPtr shared_snapshot,
                         TaskRunners task_runners,
                         fml::WeakPtr snapshot_delegate,
                         fml::WeakPtr io_manager,
    diff --git a/shell/common/engine.cc b/shell/common/engine.cc
    index 5b2d5a5c3dd37..f1c215570df2f 100644
    --- a/shell/common/engine.cc
    +++ b/shell/common/engine.cc
    @@ -37,8 +37,8 @@ static constexpr char kSettingsChannel[] = "flutter/settings";
     
     Engine::Engine(Delegate& delegate,
                    blink::DartVM& vm,
    -               fml::RefPtr isolate_snapshot,
    -               fml::RefPtr shared_snapshot,
    +               fml::RefPtr isolate_snapshot,
    +               fml::RefPtr shared_snapshot,
                    blink::TaskRunners task_runners,
                    blink::Settings settings,
                    std::unique_ptr animator,
    diff --git a/shell/common/engine.h b/shell/common/engine.h
    index b390b36a2b197..22160cb7ee3c9 100644
    --- a/shell/common/engine.h
    +++ b/shell/common/engine.h
    @@ -56,8 +56,8 @@ class Engine final : public blink::RuntimeDelegate {
     
       Engine(Delegate& delegate,
              blink::DartVM& vm,
    -         fml::RefPtr isolate_snapshot,
    -         fml::RefPtr shared_snapshot,
    +         fml::RefPtr isolate_snapshot,
    +         fml::RefPtr shared_snapshot,
              blink::TaskRunners task_runners,
              blink::Settings settings,
              std::unique_ptr animator,
    diff --git a/shell/common/shell.cc b/shell/common/shell.cc
    index 4d2dcc0d137a6..3c824ae8e0c02 100644
    --- a/shell/common/shell.cc
    +++ b/shell/common/shell.cc
    @@ -36,17 +36,20 @@ namespace shell {
     constexpr char kSkiaChannel[] = "flutter/skia";
     
     std::unique_ptr Shell::CreateShellOnPlatformThread(
    +    blink::DartVMRef vm,
         blink::TaskRunners task_runners,
         blink::Settings settings,
    -    fml::RefPtr isolate_snapshot,
    -    fml::RefPtr shared_snapshot,
    +    fml::RefPtr isolate_snapshot,
    +    fml::RefPtr shared_snapshot,
         Shell::CreateCallback on_create_platform_view,
         Shell::CreateCallback on_create_rasterizer) {
       if (!task_runners.IsValid()) {
    +    FML_LOG(ERROR) << "Task runners to run the shell were invalid.";
         return nullptr;
       }
     
    -  auto shell = std::unique_ptr(new Shell(task_runners, settings));
    +  auto shell =
    +      std::unique_ptr(new Shell(std::move(vm), task_runners, settings));
     
       // Create the platform view on the platform thread (this thread).
       auto platform_view = on_create_platform_view(*shell.get());
    @@ -75,6 +78,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread(
            &platform_view,  //
            io_task_runner   //
       ]() {
    +        TRACE_EVENT0("flutter", "ShellSetupIOSubsystem");
             io_manager = std::make_unique(
                 platform_view->CreateResourceContext(), io_task_runner);
             io_latch.Signal();
    @@ -92,6 +96,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread(
                                             shell = shell.get(),   //
                                             &snapshot_delegate     //
       ]() {
    +        TRACE_EVENT0("flutter", "ShellSetupGPUSubsystem");
             if (auto new_rasterizer = on_create_rasterizer(*shell)) {
               rasterizer = std::move(new_rasterizer);
               snapshot_delegate = rasterizer->GetSnapshotDelegate();
    @@ -115,6 +120,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread(
                              snapshot_delegate = std::move(snapshot_delegate),  //
                              io_manager = io_manager->GetWeakPtr()              //
       ]() mutable {
    +        TRACE_EVENT0("flutter", "ShellSetupUISubsystem");
             const auto& task_runners = shell->GetTaskRunners();
     
             // The animator is owned by the UI thread but it gets its vsync pulses
    @@ -123,7 +129,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread(
                                                        std::move(vsync_waiter));
     
             engine = std::make_unique(*shell,                        //
    -                                          shell->GetDartVM(),            //
    +                                          *shell->GetDartVM(),           //
                                               std::move(isolate_snapshot),   //
                                               std::move(shared_snapshot),    //
                                               task_runners,                  //
    @@ -206,26 +212,35 @@ std::unique_ptr Shell::Create(
         Shell::CreateCallback on_create_rasterizer) {
       PerformInitializationTasks(settings);
     
    -  auto vm = blink::DartVM::ForProcess(settings);
    +  TRACE_EVENT0("flutter", "Shell::Create");
    +
    +  auto vm = blink::DartVMRef::Create(settings);
       FML_CHECK(vm) << "Must be able to initialize the VM.";
    +
    +  auto vm_data = vm->GetVMData();
    +
       return Shell::Create(std::move(task_runners),             //
                            std::move(settings),                 //
    -                       vm->GetIsolateSnapshot(),            //
    -                       blink::DartSnapshot::Empty(),        //
    +                       vm_data->GetIsolateSnapshot(),       // isolate snapshot
    +                       blink::DartSnapshot::Empty(),        // shared snapshot
                            std::move(on_create_platform_view),  //
    -                       std::move(on_create_rasterizer)      //
    +                       std::move(on_create_rasterizer),     //
    +                       std::move(vm)                        //
       );
     }
     
     std::unique_ptr Shell::Create(
         blink::TaskRunners task_runners,
         blink::Settings settings,
    -    fml::RefPtr isolate_snapshot,
    -    fml::RefPtr shared_snapshot,
    +    fml::RefPtr isolate_snapshot,
    +    fml::RefPtr shared_snapshot,
         Shell::CreateCallback on_create_platform_view,
    -    Shell::CreateCallback on_create_rasterizer) {
    +    Shell::CreateCallback on_create_rasterizer,
    +    blink::DartVMRef vm) {
       PerformInitializationTasks(settings);
     
    +  TRACE_EVENT0("flutter", "Shell::CreateWithSnapshots");
    +
       if (!task_runners.IsValid() || !on_create_platform_view ||
           !on_create_rasterizer) {
         return nullptr;
    @@ -235,16 +250,18 @@ std::unique_ptr Shell::Create(
       std::unique_ptr shell;
       fml::TaskRunner::RunNowOrPostTask(
           task_runners.GetPlatformTaskRunner(),
    -      [&latch,                                          //
    -       &shell,                                          //
    -       task_runners = std::move(task_runners),          //
    -       settings,                                        //
    -       isolate_snapshot = std::move(isolate_snapshot),  //
    -       shared_snapshot = std::move(shared_snapshot),    //
    -       on_create_platform_view,                         //
    -       on_create_rasterizer                             //
    -  ]() {
    -        shell = CreateShellOnPlatformThread(std::move(task_runners),      //
    +      fml::MakeCopyable([&latch,                                          //
    +                         vm = std::move(vm),                              //
    +                         &shell,                                          //
    +                         task_runners = std::move(task_runners),          //
    +                         settings,                                        //
    +                         isolate_snapshot = std::move(isolate_snapshot),  //
    +                         shared_snapshot = std::move(shared_snapshot),    //
    +                         on_create_platform_view,                         //
    +                         on_create_rasterizer                             //
    +  ]() mutable {
    +        shell = CreateShellOnPlatformThread(std::move(vm),
    +                                            std::move(task_runners),      //
                                                 settings,                     //
                                                 std::move(isolate_snapshot),  //
                                                 std::move(shared_snapshot),   //
    @@ -252,15 +269,18 @@ std::unique_ptr Shell::Create(
                                                 on_create_rasterizer          //
             );
             latch.Signal();
    -      });
    +      }));
       latch.Wait();
       return shell;
     }
     
    -Shell::Shell(blink::TaskRunners task_runners, blink::Settings settings)
    +Shell::Shell(blink::DartVMRef vm,
    +             blink::TaskRunners task_runners,
    +             blink::Settings settings)
         : task_runners_(std::move(task_runners)),
           settings_(std::move(settings)),
    -      vm_(blink::DartVM::ForProcess(settings_)) {
    +      vm_(std::move(vm)) {
    +  FML_CHECK(vm_) << "Must have access to VM to create a shell.";
       FML_DCHECK(task_runners_.IsValid());
       FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread());
     
    @@ -302,9 +322,7 @@ Shell::~Shell() {
       PersistentCache::GetCacheForProcess()->RemoveWorkerTaskRunner(
           task_runners_.GetIOTaskRunner());
     
    -  if (auto vm = blink::DartVM::ForProcessIfInitialized()) {
    -    vm->GetServiceProtocol().RemoveHandler(this);
    -  }
    +  vm_->GetServiceProtocol()->RemoveHandler(this);
     
       fml::AutoResetWaitableEvent ui_latch, gpu_latch, platform_latch, io_latch;
     
    @@ -375,9 +393,7 @@ bool Shell::Setup(std::unique_ptr platform_view,
     
       is_setup_ = true;
     
    -  if (auto vm = blink::DartVM::ForProcessIfInitialized()) {
    -    vm->GetServiceProtocol().AddHandler(this, GetServiceProtocolDescription());
    -  }
    +  vm_->GetServiceProtocol()->AddHandler(this, GetServiceProtocolDescription());
     
       PersistentCache::GetCacheForProcess()->AddWorkerTaskRunner(
           task_runners_.GetIOTaskRunner());
    @@ -411,12 +427,13 @@ fml::WeakPtr Shell::GetPlatformView() {
       return platform_view_->GetWeakPtr();
     }
     
    -blink::DartVM& Shell::GetDartVM() const {
    -  return *vm_;
    +blink::DartVM* Shell::GetDartVM() {
    +  return &vm_;
     }
     
     // |shell::PlatformView::Delegate|
     void Shell::OnPlatformViewCreated(std::unique_ptr surface) {
    +  TRACE_EVENT0("flutter", "Shell::OnPlatformViewCreated");
       FML_DCHECK(is_setup_);
       FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread());
     
    @@ -500,6 +517,7 @@ void Shell::OnPlatformViewCreated(std::unique_ptr surface) {
     
     // |shell::PlatformView::Delegate|
     void Shell::OnPlatformViewDestroyed() {
    +  TRACE_EVENT0("flutter", "Shell::OnPlatformViewDestroyed");
       FML_DCHECK(is_setup_);
       FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread());
     
    @@ -860,10 +878,8 @@ void Shell::OnPreEngineRestart() {
     // |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);
    -  }
    +  Handler::Description description(isolate_port, isolate_name);
    +  vm_->GetServiceProtocol()->SetHandlerDescription(this, description);
     }
     
     // |blink::ServiceProtocol::Handler|
    diff --git a/shell/common/shell.h b/shell/common/shell.h
    index 17b0f170561d5..864235473c934 100644
    --- a/shell/common/shell.h
    +++ b/shell/common/shell.h
    @@ -23,6 +23,7 @@
     #include "flutter/lib/ui/semantics/custom_accessibility_action.h"
     #include "flutter/lib/ui/semantics/semantics_node.h"
     #include "flutter/lib/ui/window/platform_message.h"
    +#include "flutter/runtime/dart_vm_lifecycle.h"
     #include "flutter/runtime/service_protocol.h"
     #include "flutter/shell/common/animator.h"
     #include "flutter/shell/common/engine.h"
    @@ -54,10 +55,11 @@ class Shell final : public PlatformView::Delegate,
       static std::unique_ptr Create(
           blink::TaskRunners task_runners,
           blink::Settings settings,
    -      fml::RefPtr isolate_snapshot,
    -      fml::RefPtr shared_snapshot,
    +      fml::RefPtr isolate_snapshot,
    +      fml::RefPtr shared_snapshot,
           CreateCallback on_create_platform_view,
    -      CreateCallback on_create_rasterizer);
    +      CreateCallback on_create_rasterizer,
    +      blink::DartVMRef vm);
     
       ~Shell();
     
    @@ -71,7 +73,7 @@ class Shell final : public PlatformView::Delegate,
     
       fml::WeakPtr GetPlatformView();
     
    -  blink::DartVM& GetDartVM() const;
    +  blink::DartVM* GetDartVM();
     
       bool IsSetup() const;
     
    @@ -85,7 +87,7 @@ class Shell final : public PlatformView::Delegate,
     
       const blink::TaskRunners task_runners_;
       const blink::Settings settings_;
    -  fml::RefPtr vm_;
    +  blink::DartVMRef vm_;
       std::unique_ptr platform_view_;  // on platform task runner
       std::unique_ptr engine_;               // on UI task runner
       std::unique_ptr rasterizer_;       // on GPU task runner
    @@ -98,16 +100,19 @@ class Shell final : public PlatformView::Delegate,
                          >
           service_protocol_handlers_;
       bool is_setup_ = false;
    -
       uint64_t next_pointer_flow_id_ = 0;
     
       Shell(blink::TaskRunners task_runners, blink::Settings settings);
    +  Shell(blink::DartVMRef vm,
    +        blink::TaskRunners task_runners,
    +        blink::Settings settings);
     
       static std::unique_ptr CreateShellOnPlatformThread(
    +      blink::DartVMRef vm,
           blink::TaskRunners task_runners,
           blink::Settings settings,
    -      fml::RefPtr isolate_snapshot,
    -      fml::RefPtr shared_snapshot,
    +      fml::RefPtr isolate_snapshot,
    +      fml::RefPtr shared_snapshot,
           Shell::CreateCallback on_create_platform_view,
           Shell::CreateCallback on_create_rasterizer);
     
    diff --git a/testing/testing.cc b/testing/testing.cc
    index 93e135e7ab43d..c738219541452 100644
    --- a/testing/testing.cc
    +++ b/testing/testing.cc
    @@ -6,6 +6,8 @@
     
     namespace testing {
     
    -//
    +std::string GetCurrentTestName() {
    +  return UnitTest::GetInstance()->current_test_info()->name();
    +}
     
     }  // namespace testing
    diff --git a/testing/testing.h b/testing/testing.h
    index dac2d229b9169..0662055fea502 100644
    --- a/testing/testing.h
    +++ b/testing/testing.h
    @@ -5,6 +5,8 @@
     #ifndef TESTING_TESTING_H_
     #define TESTING_TESTING_H_
     
    +#include 
    +
     #include "gtest/gtest.h"
     
     namespace testing {
    @@ -14,6 +16,8 @@ namespace testing {
     // error.
     const char* GetFixturesPath();
     
    +std::string GetCurrentTestName();
    +
     }  // namespace testing
     
     #endif  // TESTING_TESTING_H_
    
    From 20190d707a3cf51f5bcd16031b99f3cf63b1f33f Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Wed, 3 Apr 2019 17:03:54 -0400
    Subject: [PATCH 0682/1117] Roll src/third_party/skia
     fbe240669394..2273c900ea28 (13 commits) (#8428)
    
    https://skia.googlesource.com/skia.git/%2Blog/fbe240669394..2273c900ea28
    
    git log fbe240669394715ee2f3e9f85407dad241eca262..2273c900ea2888ac659dbcdfe6e6d1cd2cf76177 --date=short --no-merges --format=%ad %ae %s
    2019-04-03 herb@google.com GM for SkOverdrawCanvas
    2019-03-30 csmartdalton@google.com Add a cap to allow coverage counting or not
    2019-03-27 mtklein@google.com set PNG compression level back to 1
    2019-04-03 csmartdalton@google.com Rename GrPipeline::Flags to GrPipeline::InputFlags
    2019-04-03 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    2019-04-03 robertphillips@google.com Reset GrVkCommandBuffer's work status in end()
    2019-04-03 herb@google.com Remove SkFindAndPlaceGlyph from gn
    2019-04-02 bsalomon@google.com Track the number of resources that would become purgeable after flush in GrResourceCache.
    2019-04-03 brianosman@google.com Fix the GLSL persistent cache (and add a config to test it)
    2019-04-03 michaelludwig@google.com Support strict constraints for bulk texture sets
    2019-04-03 halcanary@google.com SkMD5 returns digest
    2019-04-03 herb@google.com Move overdraw canvas to using new painter
    2019-04-03 mtklein@google.com split cpu+gpu work queues
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 4 ++--
     2 files changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index b5b969fbf6e85..06d6ce6e0e5ad 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': 'fbe240669394715ee2f3e9f85407dad241eca262',
    +  'skia_revision': '2273c900ea2888ac659dbcdfe6e6d1cd2cf76177',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 033b94a38e8f7..e0a97c486dcf0 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 479ccc15b4edc62b97c7f0a8292dd014
    +Signature: aa4ce47d179f622bf227d1feb5d5f694
     
     UNUSED LICENSES:
     
    @@ -3666,7 +3666,6 @@ FILE: ../../../third_party/skia/src/core/SkBitmapController.cpp
     FILE: ../../../third_party/skia/src/core/SkBitmapController.h
     FILE: ../../../third_party/skia/src/core/SkBitmapProvider.cpp
     FILE: ../../../third_party/skia/src/core/SkBitmapProvider.h
    -FILE: ../../../third_party/skia/src/core/SkFindAndPlaceGlyph.h
     FILE: ../../../third_party/skia/src/core/SkFontMgr.cpp
     FILE: ../../../third_party/skia/src/core/SkLatticeIter.cpp
     FILE: ../../../third_party/skia/src/core/SkLatticeIter.h
    @@ -4559,6 +4558,7 @@ FILE: ../../../third_party/skia/gm/crbug_938592.cpp
     FILE: ../../../third_party/skia/gm/crbug_947055.cpp
     FILE: ../../../third_party/skia/gm/mac_aa_explorer.cpp
     FILE: ../../../third_party/skia/gm/mixercolorfilter.cpp
    +FILE: ../../../third_party/skia/gm/overdrawcanvas.cpp
     FILE: ../../../third_party/skia/gm/samplelocations.cpp
     FILE: ../../../third_party/skia/gm/skbug_8664.cpp
     FILE: ../../../third_party/skia/include/core/SkMixer.h
    
    From d4c815f575183ca5ad99576a3c074f8d507e36f2 Mon Sep 17 00:00:00 2001
    From: liyuqian 
    Date: Wed, 3 Apr 2019 14:27:37 -0700
    Subject: [PATCH 0683/1117] Roll buildroot (#8425)
    
    This includes flutter/buildroot#228
    ---
     DEPS | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/DEPS b/DEPS
    index 06d6ce6e0e5ad..d9b5d45cda93e 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -121,7 +121,7 @@ allowed_hosts = [
     ]
     
     deps = {
    -  'src': 'https://github.com/flutter/buildroot.git' + '@' + 'e2ca4571fa39be20ab1bf67c65d4700612756af2',
    +  'src': 'https://github.com/flutter/buildroot.git' + '@' + '5311c632822d0d2d4e4cf8cba3053cde5183c89c',
     
        # Fuchsia compatibility
        #
    
    From 804d54ddff48ad25cfede3604033940d5ea01cda Mon Sep 17 00:00:00 2001
    From: Chris Bracken 
    Date: Wed, 3 Apr 2019 14:28:29 -0700
    Subject: [PATCH 0684/1117] Eliminate unused displayBounds parameter (#8427)
    
    Use of this parameter was eliminated in 37947f9.
    ---
     .../android/io/flutter/view/AccessibilityViewEmbedder.java     | 3 +--
     1 file changed, 1 insertion(+), 2 deletions(-)
    
    diff --git a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java
    index e1065143d843a..ed92061825fca 100644
    --- a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java
    +++ b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java
    @@ -136,7 +136,7 @@ private AccessibilityNodeInfo convertToFlutterNode(
     
             copyAccessibilityFields(originNode, result);
             setFlutterNodesTranslateBounds(originNode, displayBounds, result);
    -        addChildrenToFlutterNode(originNode, embeddedView, displayBounds, result);
    +        addChildrenToFlutterNode(originNode, embeddedView, result);
             setFlutterNodeParent(originNode, embeddedView, result);
     
             return result;
    @@ -162,7 +162,6 @@ private void setFlutterNodeParent(
         private void addChildrenToFlutterNode(
                 @NonNull AccessibilityNodeInfo originNode,
                 @NonNull View embeddedView,
    -            @NonNull Rect displayBounds,
                 @NonNull AccessibilityNodeInfo resultNode
         ) {
             for (int i = 0; i < originNode.getChildCount(); i++) {
    
    From 9acdf1837f6ab8fb1d1175a201a8685da9713473 Mon Sep 17 00:00:00 2001
    From: Chris Bracken 
    Date: Wed, 3 Apr 2019 15:06:11 -0700
    Subject: [PATCH 0685/1117] Make AccessibilityViewEmbedder final (#8429)
    
    Since this class implements equals() and hashCode() it should either be
    final or handle subclasses in equals(); given this is unlikely to be
    subclassed, making it final is the simpler option.
    ---
     .../android/io/flutter/view/AccessibilityViewEmbedder.java      | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java
    index ed92061825fca..f4858d751746e 100644
    --- a/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java
    +++ b/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java
    @@ -37,7 +37,7 @@
      * for the virtual accessibility node IDs in the platform view's tree. Internally this class maintains a bidirectional
      * mapping between `flutterId`s and the corresponding platform view and `originId`.
      */
    -class AccessibilityViewEmbedder {
    +final class AccessibilityViewEmbedder {
         private static final String TAG = "AccessibilityBridge";
     
         private final ReflectionAccessors reflectionAccessors;
    
    From b59c4436ce9fb8aa09bad6eb5ca729350a3ab272 Mon Sep 17 00:00:00 2001
    From: Chinmay Garde 
    Date: Wed, 3 Apr 2019 15:44:29 -0700
    Subject: [PATCH 0686/1117] Enable shutting down all root isolates in a VM.
     (#8402)
    
    ---
     ci/licenses_golden/licenses_flutter           |   1 +
     common/settings.h                             |   8 +-
     runtime/BUILD.gn                              |  39 ++++-
     runtime/dart_isolate.cc                       |  71 +++++++--
     runtime/dart_isolate.h                        |  17 +++
     runtime/dart_lifecycle_unittests.cc           | 142 ++++++++++++++++++
     runtime/dart_vm.cc                            |  51 +++++++
     runtime/dart_vm.h                             |  14 ++
     runtime/dart_vm_lifecycle.cc                  |   5 +
     runtime/dart_vm_lifecycle.h                   |  10 ++
     runtime/fixtures/simple_main.dart             |   4 +
     runtime/runtime_test.cc                       |   7 +
     shell/common/isolate_configuration.cc         |  30 ++--
     shell/common/isolate_configuration.h          |  10 +-
     .../android/platform_view_android_jni.cc      |   2 +-
     15 files changed, 372 insertions(+), 39 deletions(-)
     create mode 100644 runtime/dart_lifecycle_unittests.cc
    
    diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter
    index 312e6c329ab71..5715a8445f803 100644
    --- a/ci/licenses_golden/licenses_flutter
    +++ b/ci/licenses_golden/licenses_flutter
    @@ -374,6 +374,7 @@ FILE: ../../../flutter/lib/ui/window/window.h
     FILE: ../../../flutter/runtime/dart_isolate.cc
     FILE: ../../../flutter/runtime/dart_isolate.h
     FILE: ../../../flutter/runtime/dart_isolate_unittests.cc
    +FILE: ../../../flutter/runtime/dart_lifecycle_unittests.cc
     FILE: ../../../flutter/runtime/dart_service_isolate.cc
     FILE: ../../../flutter/runtime/dart_service_isolate.h
     FILE: ../../../flutter/runtime/dart_service_isolate_unittests.cc
    diff --git a/common/settings.h b/common/settings.h
    index 40b647de1f431..ff0315f8fc001 100644
    --- a/common/settings.h
    +++ b/common/settings.h
    @@ -29,6 +29,8 @@ using UnhandledExceptionCallback =
     // callback that generates the mapping from these paths.
     // https://github.com/flutter/flutter/issues/26783
     using MappingCallback = std::function(void)>;
    +using MappingsCallback =
    +    std::function>(void)>;
     
     struct Settings {
       Settings();
    @@ -53,8 +55,10 @@ struct Settings {
       MappingCallback dart_library_sources_kernel;
     
       std::string application_library_path;
    -  std::string application_kernel_asset;
    -  std::string application_kernel_list_asset;
    +
    +  std::string application_kernel_asset;       // deprecated
    +  std::string application_kernel_list_asset;  // deprecated
    +  MappingsCallback application_kernels;
     
       std::string temp_directory_path;
       std::vector dart_flags;
    diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
    index a906e589c223f..4ae61ac3b46e0 100644
    --- a/runtime/BUILD.gn
    +++ b/runtime/BUILD.gn
    @@ -101,18 +101,17 @@ test_fixtures("runtime_fixtures") {
       fixtures = [ "fixtures/simple_main.dart" ]
     }
     
    -executable("runtime_unittests") {
    +source_set("runtime_unittests_common") {
    +  visibility = [ ":*" ]
    +
       testonly = true
     
       sources = [
    -    "dart_isolate_unittests.cc",
    -    "dart_service_isolate_unittests.cc",
    -    "dart_vm_unittests.cc",
         "runtime_test.cc",
         "runtime_test.h",
       ]
     
    -  deps = [
    +  public_deps = [
         ":libdart",
         ":runtime",
         ":runtime_fixtures",
    @@ -124,6 +123,36 @@ executable("runtime_unittests") {
         "//third_party/skia",
         "//third_party/tonic",
       ]
    +}
    +
    +executable("runtime_unittests") {
    +  testonly = true
    +
    +  sources = [
    +    "dart_isolate_unittests.cc",
    +    "dart_service_isolate_unittests.cc",
    +    "dart_vm_unittests.cc",
    +  ]
    +
    +  deps = [
    +    ":runtime_unittests_common",
    +  ]
    +
    +  if (is_linux) {
    +    ldflags = [ "-rdynamic" ]
    +  }
    +}
    +
    +executable("runtime_lifecycle_unittests") {
    +  testonly = true
    +
    +  sources = [
    +    "dart_lifecycle_unittests.cc",
    +  ]
    +
    +  deps = [
    +    ":runtime_unittests_common",
    +  ]
     
       if (is_linux) {
         ldflags = [ "-rdynamic" ]
    diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc
    index 46df151f40b0e..91cd8bb5dd4aa 100644
    --- a/runtime/dart_isolate.cc
    +++ b/runtime/dart_isolate.cc
    @@ -162,17 +162,8 @@ bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) {
     
       tonic::DartIsolateScope scope(isolate());
     
    -  if (is_root_isolate) {
    -    if (auto task_runner = GetTaskRunners().GetUITaskRunner()) {
    -      // Isolates may not have any particular thread affinity. Only initialize
    -      // the task dispatcher if a task runner is explicitly specified.
    -      tonic::DartMessageHandler::TaskDispatcher dispatcher =
    -          [task_runner](std::function task) {
    -            task_runner->PostTask(task);
    -          };
    -      message_handler().Initialize(dispatcher);
    -    }
    -  }
    +  SetMessageHandlingTaskRunner(GetTaskRunners().GetUITaskRunner(),
    +                               is_root_isolate);
     
       if (tonic::LogIfError(
               Dart_SetLibraryTagHandler(tonic::DartState::HandleLibraryTag))) {
    @@ -187,6 +178,23 @@ bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) {
       return true;
     }
     
    +fml::RefPtr DartIsolate::GetMessageHandlingTaskRunner() const {
    +  return message_handling_task_runner_;
    +}
    +
    +void DartIsolate::SetMessageHandlingTaskRunner(
    +    fml::RefPtr runner,
    +    bool is_root_isolate) {
    +  if (!is_root_isolate || !runner) {
    +    return;
    +  }
    +
    +  message_handling_task_runner_ = runner;
    +
    +  message_handler().Initialize(
    +      [runner](std::function task) { runner->PostTask(task); });
    +}
    +
     // Updating thread names here does not change the underlying OS thread names.
     // Instead, this is just additional metadata for the Observatory to show the
     // thread name of the isolate.
    @@ -361,6 +369,34 @@ bool DartIsolate::PrepareForRunningFromKernel(
       return true;
     }
     
    +FML_WARN_UNUSED_RESULT
    +bool DartIsolate::PrepareForRunningFromKernels(
    +    std::vector> kernels) {
    +  const auto count = kernels.size();
    +  if (count == 0) {
    +    return false;
    +  }
    +
    +  for (size_t i = 0; i < count; ++i) {
    +    bool last = (i == (count - 1));
    +    if (!PrepareForRunningFromKernel(kernels[i], last)) {
    +      return false;
    +    }
    +  }
    +
    +  return true;
    +}
    +
    +FML_WARN_UNUSED_RESULT
    +bool DartIsolate::PrepareForRunningFromKernels(
    +    std::vector> kernels) {
    +  std::vector> shared_kernels;
    +  for (auto& kernel : kernels) {
    +    shared_kernels.emplace_back(std::move(kernel));
    +  }
    +  return PrepareForRunningFromKernels(shared_kernels);
    +}
    +
     bool DartIsolate::MarkIsolateRunnable() {
       TRACE_EVENT0("flutter", "DartIsolate::MarkIsolateRunnable");
       if (phase_ != Phase::LibrariesSetup) {
    @@ -484,7 +520,6 @@ 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);
       }
    @@ -686,6 +721,8 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
         }
       }
     
    +  DartVMRef::GetRunningVM()->RegisterActiveIsolate(*embedder_isolate);
    +
       // The ownership of the embedder object is controlled by the Dart VM. So the
       // only reference returned to the caller is weak.
       embedder_isolate.release();
    @@ -694,7 +731,9 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
     
     // |Dart_IsolateShutdownCallback|
     void DartIsolate::DartIsolateShutdownCallback(
    -    std::shared_ptr* embedder_isolate) {}
    +    std::shared_ptr* embedder_isolate) {
    +  embedder_isolate->get()->OnShutdownCallback();
    +}
     
     // |Dart_IsolateCleanupCallback|
     void DartIsolate::DartIsolateCleanupCallback(
    @@ -719,6 +758,12 @@ void DartIsolate::AddIsolateShutdownCallback(fml::closure closure) {
           std::make_unique(std::move(closure)));
     }
     
    +void DartIsolate::OnShutdownCallback() {
    +  shutdown_callbacks_.clear();
    +  DartVMRef::GetRunningVM()->UnregisterActiveIsolate(
    +      std::static_pointer_cast(shared_from_this()));
    +}
    +
     DartIsolate::AutoFireClosure::AutoFireClosure(fml::closure closure)
         : closure_(std::move(closure)) {}
     
    diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h
    index 49c3df3c51082..96753830e0bb3 100644
    --- a/runtime/dart_isolate.h
    +++ b/runtime/dart_isolate.h
    @@ -5,6 +5,7 @@
     #ifndef FLUTTER_RUNTIME_DART_ISOLATE_H_
     #define FLUTTER_RUNTIME_DART_ISOLATE_H_
     
    +#include 
     #include 
     #include 
     
    @@ -75,6 +76,14 @@ class DartIsolate : public UIDartState {
       bool PrepareForRunningFromKernel(std::shared_ptr kernel,
                                        bool last_piece = true);
     
    +  FML_WARN_UNUSED_RESULT
    +  bool PrepareForRunningFromKernels(
    +      std::vector> kernels);
    +
    +  FML_WARN_UNUSED_RESULT
    +  bool PrepareForRunningFromKernels(
    +      std::vector> kernels);
    +
       FML_WARN_UNUSED_RESULT
       bool Run(const std::string& entrypoint, fml::closure on_run = nullptr);
     
    @@ -94,6 +103,8 @@ class DartIsolate : public UIDartState {
     
       std::weak_ptr GetWeakIsolatePtr();
     
    +  fml::RefPtr GetMessageHandlingTaskRunner() const;
    +
      private:
       bool LoadKernel(std::shared_ptr mapping, bool last_piece);
     
    @@ -116,10 +127,14 @@ class DartIsolate : public UIDartState {
       std::vector> kernel_buffers_;
       std::vector> shutdown_callbacks_;
       ChildIsolatePreparer child_isolate_preparer_ = nullptr;
    +  fml::RefPtr message_handling_task_runner_;
     
       FML_WARN_UNUSED_RESULT
       bool Initialize(Dart_Isolate isolate, bool is_root_isolate);
     
    +  void SetMessageHandlingTaskRunner(fml::RefPtr runner,
    +                                    bool is_root_isolate);
    +
       FML_WARN_UNUSED_RESULT
       bool LoadLibraries(bool is_root_isolate);
     
    @@ -128,6 +143,8 @@ class DartIsolate : public UIDartState {
       FML_WARN_UNUSED_RESULT
       bool MarkIsolateRunnable();
     
    +  void OnShutdownCallback();
    +
       // |Dart_IsolateCreateCallback|
       static Dart_Isolate DartIsolateCreateCallback(
           const char* advisory_script_uri,
    diff --git a/runtime/dart_lifecycle_unittests.cc b/runtime/dart_lifecycle_unittests.cc
    new file mode 100644
    index 0000000000000..039d93793cb6d
    --- /dev/null
    +++ b/runtime/dart_lifecycle_unittests.cc
    @@ -0,0 +1,142 @@
    +// Copyright 2013 The Flutter 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/common/task_runners.h"
    +#include "flutter/fml/paths.h"
    +#include "flutter/fml/synchronization/waitable_event.h"
    +#include "flutter/runtime/dart_vm.h"
    +#include "flutter/runtime/dart_vm_lifecycle.h"
    +#include "flutter/runtime/runtime_test.h"
    +
    +namespace blink {
    +namespace testing {
    +
    +using DartLifecycleTest = RuntimeTest;
    +
    +TEST_F(DartLifecycleTest, CanStartAndShutdownVM) {
    +  auto settings = CreateSettingsForFixture();
    +  settings.leak_vm = false;
    +  settings.enable_observatory = false;
    +  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
    +  {
    +    auto vm_ref = DartVMRef::Create(settings);
    +    ASSERT_TRUE(DartVMRef::IsInstanceRunning());
    +  }
    +  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
    +}
    +
    +TEST_F(DartLifecycleTest, CanStartAndShutdownVMOverAndOver) {
    +  auto settings = CreateSettingsForFixture();
    +  settings.leak_vm = false;
    +  settings.enable_observatory = false;
    +  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
    +  auto count = DartVM::GetVMLaunchCount();
    +  for (size_t i = 0; i < 10; i++) {
    +    auto vm_ref = DartVMRef::Create(settings);
    +    ASSERT_TRUE(DartVMRef::IsInstanceRunning());
    +    ASSERT_EQ(DartVM::GetVMLaunchCount(), count + 1);
    +    count = DartVM::GetVMLaunchCount();
    +  }
    +  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
    +}
    +
    +static void CreateAndRunRootIsolate(
    +    std::shared_ptr& isolate_result,
    +    const Settings& settings,
    +    const DartVMData& vm,
    +    fml::RefPtr task_runner,
    +    std::string entrypoint) {
    +  FML_CHECK(entrypoint.size() > 0);
    +  TaskRunners runners("io.flutter.test", task_runner, task_runner, task_runner,
    +                      task_runner);
    +  auto isolate_weak = DartIsolate::CreateRootIsolate(
    +      vm.GetSettings(),         // settings
    +      vm.GetIsolateSnapshot(),  // isolate_snapshot
    +      vm.GetSharedSnapshot(),   // shared_snapshot
    +      runners,                  // task_runners
    +      {},                       // window
    +      {},                       // snapshot_delegate
    +      {},                       // io_manager
    +      "main.dart",              // advisory_script_uri
    +      entrypoint.c_str(),       // advisory_script_entrypoint
    +      nullptr                   // flags
    +  );
    +
    +  auto isolate = isolate_weak.lock();
    +
    +  if (!isolate) {
    +    FML_LOG(ERROR) << "Could not create valid isolate.";
    +    return;
    +  }
    +
    +  if (DartVM::IsRunningPrecompiledCode()) {
    +    if (!isolate->PrepareForRunningFromPrecompiledCode()) {
    +      FML_LOG(ERROR)
    +          << "Could not prepare to run the isolate from precompiled code.";
    +      return;
    +    }
    +
    +  } else {
    +    if (!isolate->PrepareForRunningFromKernels(
    +            settings.application_kernels())) {
    +      FML_LOG(ERROR) << "Could not prepare isolate from application kernels.";
    +      return;
    +    }
    +  }
    +
    +  if (isolate->GetPhase() != DartIsolate::Phase::Ready) {
    +    FML_LOG(ERROR) << "Isolate was not ready.";
    +    return;
    +  }
    +
    +  if (!isolate->Run(entrypoint, settings.root_isolate_create_callback)) {
    +    FML_LOG(ERROR) << "Could not run entrypoint: " << entrypoint << ".";
    +    return;
    +  }
    +
    +  if (isolate->GetPhase() != DartIsolate::Phase::Running) {
    +    FML_LOG(ERROR) << "Isolate was not Running.";
    +    return;
    +  }
    +
    +  isolate_result = isolate;
    +}
    +
    +static std::shared_ptr CreateAndRunRootIsolate(
    +    const Settings& settings,
    +    const DartVMData& vm,
    +    fml::RefPtr task_runner,
    +    std::string entrypoint) {
    +  fml::AutoResetWaitableEvent latch;
    +  std::shared_ptr isolate;
    +  fml::TaskRunner::RunNowOrPostTask(task_runner, [&]() {
    +    CreateAndRunRootIsolate(isolate, settings, vm, task_runner, entrypoint);
    +    latch.Signal();
    +  });
    +  latch.Wait();
    +  return isolate;
    +}
    +
    +TEST_F(DartLifecycleTest, ShuttingDownTheVMShutsDownTheIsolate) {
    +  auto settings = CreateSettingsForFixture();
    +  settings.leak_vm = false;
    +  settings.enable_observatory = false;
    +  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
    +  {
    +    auto vm_ref = DartVMRef::Create(settings);
    +    ASSERT_TRUE(DartVMRef::IsInstanceRunning());
    +    ASSERT_EQ(vm_ref->GetIsolateCount(), 0u);
    +    auto isolate =
    +        CreateAndRunRootIsolate(settings, *vm_ref.GetVMData(),
    +                                GetThreadTaskRunner(), "testIsolateShutdown");
    +    ASSERT_TRUE(isolate);
    +    ASSERT_EQ(vm_ref->GetIsolateCount(), 1u);
    +    vm_ref->ShutdownAllIsolates();
    +    ASSERT_EQ(vm_ref->GetIsolateCount(), 0u);
    +  }
    +  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
    +}
    +
    +}  // namespace testing
    +}  // namespace blink
    diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc
    index 110f7c2b27809..db8acaaa46abc 100644
    --- a/runtime/dart_vm.cc
    +++ b/runtime/dart_vm.cc
    @@ -15,6 +15,7 @@
     #include "flutter/fml/file.h"
     #include "flutter/fml/logging.h"
     #include "flutter/fml/mapping.h"
    +#include "flutter/fml/synchronization/count_down_latch.h"
     #include "flutter/fml/synchronization/thread_annotations.h"
     #include "flutter/fml/time/time_delta.h"
     #include "flutter/fml/trace_event.h"
    @@ -450,4 +451,54 @@ std::shared_ptr DartVM::GetIsolateNameServer() const {
       return isolate_name_server_;
     }
     
    +size_t DartVM::GetIsolateCount() const {
    +  std::lock_guard lock(active_isolates_mutex_);
    +  return active_isolates_.size();
    +}
    +
    +void DartVM::ShutdownAllIsolates() {
    +  std::set> isolates_to_shutdown;
    +  // We may be shutting down isolates on the current thread. Shutting down the
    +  // isolate calls the shutdown callback which removes the entry from the
    +  // active isolate. The lock must be obtained to mutate that entry. To avoid a
    +  // deadlock, collect the isolate is a seprate collection.
    +  {
    +    std::lock_guard lock(active_isolates_mutex_);
    +    for (const auto& active_isolate : active_isolates_) {
    +      if (auto task_runner = active_isolate->GetMessageHandlingTaskRunner()) {
    +        isolates_to_shutdown.insert(active_isolate);
    +      }
    +    }
    +  }
    +
    +  fml::CountDownLatch latch(isolates_to_shutdown.size());
    +
    +  for (const auto& isolate : isolates_to_shutdown) {
    +    fml::TaskRunner::RunNowOrPostTask(
    +        isolate->GetMessageHandlingTaskRunner(), [&latch, isolate]() {
    +          if (!isolate || !isolate->Shutdown()) {
    +            FML_LOG(ERROR) << "Could not shutdown isolate.";
    +          }
    +          latch.CountDown();
    +        });
    +  }
    +  latch.Wait();
    +}
    +
    +void DartVM::RegisterActiveIsolate(std::shared_ptr isolate) {
    +  if (!isolate) {
    +    return;
    +  }
    +  std::lock_guard lock(active_isolates_mutex_);
    +  active_isolates_.insert(isolate);
    +}
    +
    +void DartVM::UnregisterActiveIsolate(std::shared_ptr isolate) {
    +  if (!isolate) {
    +    return;
    +  }
    +  std::lock_guard lock(active_isolates_mutex_);
    +  active_isolates_.erase(isolate);
    +}
    +
     }  // namespace blink
    diff --git a/runtime/dart_vm.h b/runtime/dart_vm.h
    index 6724abde0b828..bff23f7352a7e 100644
    --- a/runtime/dart_vm.h
    +++ b/runtime/dart_vm.h
    @@ -36,17 +36,27 @@ class DartVM {
     
       std::shared_ptr GetVMData() const;
     
    +  // This accessor is racy and only meant to the used in tests where there is a
    +  // consistent threading mode.
    +  size_t GetIsolateCount() const;
    +
       std::shared_ptr GetServiceProtocol() const;
     
       std::shared_ptr GetIsolateNameServer() const;
     
    +  void ShutdownAllIsolates();
    +
      private:
       const Settings settings_;
       std::shared_ptr vm_data_;
       const std::shared_ptr isolate_name_server_;
       const std::shared_ptr service_protocol_;
    +  mutable std::mutex active_isolates_mutex_;
    +  std::set> active_isolates_
    +      FML_GUARDED_BY(active_isolates_mutex_);
     
       friend class DartVMRef;
    +  friend class DartIsolate;
     
       static std::shared_ptr Create(
           Settings settings,
    @@ -58,6 +68,10 @@ class DartVM {
       DartVM(std::shared_ptr data,
              std::shared_ptr isolate_name_server);
     
    +  void RegisterActiveIsolate(std::shared_ptr isolate);
    +
    +  void UnregisterActiveIsolate(std::shared_ptr isolate);
    +
       FML_DISALLOW_COPY_AND_ASSIGN(DartVM);
     };
     
    diff --git a/runtime/dart_vm_lifecycle.cc b/runtime/dart_vm_lifecycle.cc
    index 1ed86e0250c4b..07f88cbc83daf 100644
    --- a/runtime/dart_vm_lifecycle.cc
    +++ b/runtime/dart_vm_lifecycle.cc
    @@ -114,4 +114,9 @@ std::shared_ptr DartVMRef::GetIsolateNameServer() {
       return gVMIsolateNameServer.lock();
     }
     
    +DartVM* DartVMRef::GetRunningVM() {
    +  std::lock_guard lock(gVMMutex);
    +  return gVM.lock().get();
    +}
    +
     }  // namespace blink
    diff --git a/runtime/dart_vm_lifecycle.h b/runtime/dart_vm_lifecycle.h
    index cfe1f1b646469..44a6cdba7b8b1 100644
    --- a/runtime/dart_vm_lifecycle.h
    +++ b/runtime/dart_vm_lifecycle.h
    @@ -49,6 +49,11 @@ class DartVMRef {
     
       operator bool() const { return static_cast(vm_); }
     
    +  DartVM* get() {
    +    FML_DCHECK(vm_);
    +    return vm_.get();
    +  }
    +
       DartVM* operator->() {
         FML_DCHECK(vm_);
         return vm_.get();
    @@ -60,10 +65,15 @@ class DartVMRef {
       }
     
      private:
    +  friend class DartIsolate;
    +
       std::shared_ptr vm_;
     
       DartVMRef(std::shared_ptr vm);
     
    +  // Only used by Dart Isolate to register itself with the VM.
    +  static DartVM* GetRunningVM();
    +
       FML_DISALLOW_COPY_AND_ASSIGN(DartVMRef);
     };
     
    diff --git a/runtime/fixtures/simple_main.dart b/runtime/fixtures/simple_main.dart
    index 594f69470bc2f..bc2d880ff1427 100644
    --- a/runtime/fixtures/simple_main.dart
    +++ b/runtime/fixtures/simple_main.dart
    @@ -25,3 +25,7 @@ void canRegisterNativeCallback() async {
     }
     
     void NotifyNative() native "NotifyNative";
    +
    +
    +@pragma('vm:entry-point')
    +void testIsolateShutdown() {  }
    diff --git a/runtime/runtime_test.cc b/runtime/runtime_test.cc
    index 2613b133d241b..adb345d85d33a 100644
    --- a/runtime/runtime_test.cc
    +++ b/runtime/runtime_test.cc
    @@ -68,6 +68,13 @@ void RuntimeTest::SetSnapshotsAndAssets(Settings& settings) {
             return GetMapping(assets_dir_, "isolate_snapshot_instr", true);
           };
         }
    +  } else {
    +    settings.application_kernels = [this]() {
    +      std::vector> kernel_mappings;
    +      kernel_mappings.emplace_back(
    +          GetMapping(assets_dir_, "kernel_blob.bin", false));
    +      return kernel_mappings;
    +    };
       }
     }
     
    diff --git a/shell/common/isolate_configuration.cc b/shell/common/isolate_configuration.cc
    index 173973b64e5b1..e45b6ab15e5f9 100644
    --- a/shell/common/isolate_configuration.cc
    +++ b/shell/common/isolate_configuration.cc
    @@ -38,7 +38,7 @@ class AppSnapshotIsolateConfiguration final : public IsolateConfiguration {
     
     class KernelIsolateConfiguration : public IsolateConfiguration {
      public:
    -  KernelIsolateConfiguration(std::unique_ptr kernel)
    +  KernelIsolateConfiguration(std::unique_ptr kernel)
           : kernel_(std::move(kernel)) {}
     
       // |shell::IsolateConfiguration|
    @@ -50,7 +50,7 @@ class KernelIsolateConfiguration : public IsolateConfiguration {
       }
     
      private:
    -  std::unique_ptr kernel_;
    +  std::unique_ptr kernel_;
     
       FML_DISALLOW_COPY_AND_ASSIGN(KernelIsolateConfiguration);
     };
    @@ -58,7 +58,8 @@ 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|
    @@ -80,7 +81,7 @@ class KernelListIsolateConfiguration final : public IsolateConfiguration {
       }
     
      private:
    -  std::vector>> kernel_pieces_;
    +  std::vector>> kernel_pieces_;
     
       FML_DISALLOW_COPY_AND_ASSIGN(KernelListIsolateConfiguration);
     };
    @@ -112,15 +113,15 @@ static std::vector ParseKernelListPaths(
       return kernel_pieces_paths;
     }
     
    -static std::vector>>
    +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;
    +  std::vector>> fetch_futures;
     
       for (const auto& kernel_pieces_path : kernel_pieces_paths) {
    -    std::promise> fetch_promise;
    +    std::promise> fetch_promise;
         fetch_futures.push_back(fetch_promise.get_future());
         auto fetch_task =
             fml::MakeCopyable([asset_manager, kernel_pieces_path,
    @@ -153,6 +154,10 @@ std::unique_ptr IsolateConfiguration::InferFromSettings(
         return nullptr;
       }
     
    +  if (settings.application_kernels) {
    +    return CreateForKernelList(settings.application_kernels());
    +  }
    +
       if (settings.application_kernel_asset.empty() &&
           settings.application_kernel_list_asset.empty()) {
         FML_DLOG(ERROR) << "application_kernel_asset or "
    @@ -192,15 +197,15 @@ IsolateConfiguration::CreateForAppSnapshot() {
     }
     
     std::unique_ptr IsolateConfiguration::CreateForKernel(
    -    std::unique_ptr kernel) {
    +    std::unique_ptr kernel) {
       return std::make_unique(std::move(kernel));
     }
     
     std::unique_ptr IsolateConfiguration::CreateForKernelList(
    -    std::vector> kernel_pieces) {
    -  std::vector>> pieces;
    +    std::vector> kernel_pieces) {
    +  std::vector>> pieces;
       for (auto& piece : kernel_pieces) {
    -    std::promise> promise;
    +    std::promise> promise;
         pieces.push_back(promise.get_future());
         promise.set_value(std::move(piece));
       }
    @@ -208,7 +213,8 @@ std::unique_ptr IsolateConfiguration::CreateForKernelList(
     }
     
     std::unique_ptr IsolateConfiguration::CreateForKernelList(
    -    std::vector>> kernel_pieces) {
    +    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 e9f8d66b2e433..0d2619e6068c1 100644
    --- a/shell/common/isolate_configuration.h
    +++ b/shell/common/isolate_configuration.h
    @@ -29,16 +29,14 @@ class IsolateConfiguration {
       static std::unique_ptr CreateForAppSnapshot();
     
       static std::unique_ptr CreateForKernel(
    -      std::unique_ptr kernel);
    +      std::unique_ptr kernel);
     
       static std::unique_ptr CreateForKernelList(
    -      std::vector>> kernel_pieces);
    +      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);
    +      std::vector> kernel_pieces);
     
       IsolateConfiguration();
     
    diff --git a/shell/platform/android/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc
    index b26f5939902f2..cbddd1b9f81f4 100644
    --- a/shell/platform/android/platform_view_android_jni.cc
    +++ b/shell/platform/android/platform_view_android_jni.cc
    @@ -207,7 +207,7 @@ std::unique_ptr CreateIsolateConfiguration(
         auto blob = asset_manager.GetAsMapping(snapshot_name);
         auto delta = asset_manager.GetAsMapping("kernel_delta.bin");
         if (blob && delta) {
    -      std::vector> kernels;
    +      std::vector> kernels;
           kernels.emplace_back(std::move(blob));
           kernels.emplace_back(std::move(delta));
           return IsolateConfiguration::CreateForKernelList(std::move(kernels));
    
    From 800ea0a40397d53311715e0de94f0340195bfcea Mon Sep 17 00:00:00 2001
    From: Chinmay Garde 
    Date: Wed, 3 Apr 2019 17:08:56 -0700
    Subject: [PATCH 0687/1117] Revert "Enable shutting down all root isolates in a
     VM. (#8402)" (#8431)
    
    This reverts commit b59c4436ce9fb8aa09bad6eb5ca729350a3ab272.
    ---
     ci/licenses_golden/licenses_flutter           |   1 -
     common/settings.h                             |   8 +-
     runtime/BUILD.gn                              |  39 +----
     runtime/dart_isolate.cc                       |  71 ++-------
     runtime/dart_isolate.h                        |  17 ---
     runtime/dart_lifecycle_unittests.cc           | 142 ------------------
     runtime/dart_vm.cc                            |  51 -------
     runtime/dart_vm.h                             |  14 --
     runtime/dart_vm_lifecycle.cc                  |   5 -
     runtime/dart_vm_lifecycle.h                   |  10 --
     runtime/fixtures/simple_main.dart             |   4 -
     runtime/runtime_test.cc                       |   7 -
     shell/common/isolate_configuration.cc         |  30 ++--
     shell/common/isolate_configuration.h          |  10 +-
     .../android/platform_view_android_jni.cc      |   2 +-
     15 files changed, 39 insertions(+), 372 deletions(-)
     delete mode 100644 runtime/dart_lifecycle_unittests.cc
    
    diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter
    index 5715a8445f803..312e6c329ab71 100644
    --- a/ci/licenses_golden/licenses_flutter
    +++ b/ci/licenses_golden/licenses_flutter
    @@ -374,7 +374,6 @@ FILE: ../../../flutter/lib/ui/window/window.h
     FILE: ../../../flutter/runtime/dart_isolate.cc
     FILE: ../../../flutter/runtime/dart_isolate.h
     FILE: ../../../flutter/runtime/dart_isolate_unittests.cc
    -FILE: ../../../flutter/runtime/dart_lifecycle_unittests.cc
     FILE: ../../../flutter/runtime/dart_service_isolate.cc
     FILE: ../../../flutter/runtime/dart_service_isolate.h
     FILE: ../../../flutter/runtime/dart_service_isolate_unittests.cc
    diff --git a/common/settings.h b/common/settings.h
    index ff0315f8fc001..40b647de1f431 100644
    --- a/common/settings.h
    +++ b/common/settings.h
    @@ -29,8 +29,6 @@ using UnhandledExceptionCallback =
     // callback that generates the mapping from these paths.
     // https://github.com/flutter/flutter/issues/26783
     using MappingCallback = std::function(void)>;
    -using MappingsCallback =
    -    std::function>(void)>;
     
     struct Settings {
       Settings();
    @@ -55,10 +53,8 @@ struct Settings {
       MappingCallback dart_library_sources_kernel;
     
       std::string application_library_path;
    -
    -  std::string application_kernel_asset;       // deprecated
    -  std::string application_kernel_list_asset;  // deprecated
    -  MappingsCallback application_kernels;
    +  std::string application_kernel_asset;
    +  std::string application_kernel_list_asset;
     
       std::string temp_directory_path;
       std::vector dart_flags;
    diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
    index 4ae61ac3b46e0..a906e589c223f 100644
    --- a/runtime/BUILD.gn
    +++ b/runtime/BUILD.gn
    @@ -101,17 +101,18 @@ test_fixtures("runtime_fixtures") {
       fixtures = [ "fixtures/simple_main.dart" ]
     }
     
    -source_set("runtime_unittests_common") {
    -  visibility = [ ":*" ]
    -
    +executable("runtime_unittests") {
       testonly = true
     
       sources = [
    +    "dart_isolate_unittests.cc",
    +    "dart_service_isolate_unittests.cc",
    +    "dart_vm_unittests.cc",
         "runtime_test.cc",
         "runtime_test.h",
       ]
     
    -  public_deps = [
    +  deps = [
         ":libdart",
         ":runtime",
         ":runtime_fixtures",
    @@ -123,36 +124,6 @@ source_set("runtime_unittests_common") {
         "//third_party/skia",
         "//third_party/tonic",
       ]
    -}
    -
    -executable("runtime_unittests") {
    -  testonly = true
    -
    -  sources = [
    -    "dart_isolate_unittests.cc",
    -    "dart_service_isolate_unittests.cc",
    -    "dart_vm_unittests.cc",
    -  ]
    -
    -  deps = [
    -    ":runtime_unittests_common",
    -  ]
    -
    -  if (is_linux) {
    -    ldflags = [ "-rdynamic" ]
    -  }
    -}
    -
    -executable("runtime_lifecycle_unittests") {
    -  testonly = true
    -
    -  sources = [
    -    "dart_lifecycle_unittests.cc",
    -  ]
    -
    -  deps = [
    -    ":runtime_unittests_common",
    -  ]
     
       if (is_linux) {
         ldflags = [ "-rdynamic" ]
    diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc
    index 91cd8bb5dd4aa..46df151f40b0e 100644
    --- a/runtime/dart_isolate.cc
    +++ b/runtime/dart_isolate.cc
    @@ -162,8 +162,17 @@ bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) {
     
       tonic::DartIsolateScope scope(isolate());
     
    -  SetMessageHandlingTaskRunner(GetTaskRunners().GetUITaskRunner(),
    -                               is_root_isolate);
    +  if (is_root_isolate) {
    +    if (auto task_runner = GetTaskRunners().GetUITaskRunner()) {
    +      // Isolates may not have any particular thread affinity. Only initialize
    +      // the task dispatcher if a task runner is explicitly specified.
    +      tonic::DartMessageHandler::TaskDispatcher dispatcher =
    +          [task_runner](std::function task) {
    +            task_runner->PostTask(task);
    +          };
    +      message_handler().Initialize(dispatcher);
    +    }
    +  }
     
       if (tonic::LogIfError(
               Dart_SetLibraryTagHandler(tonic::DartState::HandleLibraryTag))) {
    @@ -178,23 +187,6 @@ bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) {
       return true;
     }
     
    -fml::RefPtr DartIsolate::GetMessageHandlingTaskRunner() const {
    -  return message_handling_task_runner_;
    -}
    -
    -void DartIsolate::SetMessageHandlingTaskRunner(
    -    fml::RefPtr runner,
    -    bool is_root_isolate) {
    -  if (!is_root_isolate || !runner) {
    -    return;
    -  }
    -
    -  message_handling_task_runner_ = runner;
    -
    -  message_handler().Initialize(
    -      [runner](std::function task) { runner->PostTask(task); });
    -}
    -
     // Updating thread names here does not change the underlying OS thread names.
     // Instead, this is just additional metadata for the Observatory to show the
     // thread name of the isolate.
    @@ -369,34 +361,6 @@ bool DartIsolate::PrepareForRunningFromKernel(
       return true;
     }
     
    -FML_WARN_UNUSED_RESULT
    -bool DartIsolate::PrepareForRunningFromKernels(
    -    std::vector> kernels) {
    -  const auto count = kernels.size();
    -  if (count == 0) {
    -    return false;
    -  }
    -
    -  for (size_t i = 0; i < count; ++i) {
    -    bool last = (i == (count - 1));
    -    if (!PrepareForRunningFromKernel(kernels[i], last)) {
    -      return false;
    -    }
    -  }
    -
    -  return true;
    -}
    -
    -FML_WARN_UNUSED_RESULT
    -bool DartIsolate::PrepareForRunningFromKernels(
    -    std::vector> kernels) {
    -  std::vector> shared_kernels;
    -  for (auto& kernel : kernels) {
    -    shared_kernels.emplace_back(std::move(kernel));
    -  }
    -  return PrepareForRunningFromKernels(shared_kernels);
    -}
    -
     bool DartIsolate::MarkIsolateRunnable() {
       TRACE_EVENT0("flutter", "DartIsolate::MarkIsolateRunnable");
       if (phase_ != Phase::LibrariesSetup) {
    @@ -520,6 +484,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);
       }
    @@ -721,8 +686,6 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
         }
       }
     
    -  DartVMRef::GetRunningVM()->RegisterActiveIsolate(*embedder_isolate);
    -
       // The ownership of the embedder object is controlled by the Dart VM. So the
       // only reference returned to the caller is weak.
       embedder_isolate.release();
    @@ -731,9 +694,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
     
     // |Dart_IsolateShutdownCallback|
     void DartIsolate::DartIsolateShutdownCallback(
    -    std::shared_ptr* embedder_isolate) {
    -  embedder_isolate->get()->OnShutdownCallback();
    -}
    +    std::shared_ptr* embedder_isolate) {}
     
     // |Dart_IsolateCleanupCallback|
     void DartIsolate::DartIsolateCleanupCallback(
    @@ -758,12 +719,6 @@ void DartIsolate::AddIsolateShutdownCallback(fml::closure closure) {
           std::make_unique(std::move(closure)));
     }
     
    -void DartIsolate::OnShutdownCallback() {
    -  shutdown_callbacks_.clear();
    -  DartVMRef::GetRunningVM()->UnregisterActiveIsolate(
    -      std::static_pointer_cast(shared_from_this()));
    -}
    -
     DartIsolate::AutoFireClosure::AutoFireClosure(fml::closure closure)
         : closure_(std::move(closure)) {}
     
    diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h
    index 96753830e0bb3..49c3df3c51082 100644
    --- a/runtime/dart_isolate.h
    +++ b/runtime/dart_isolate.h
    @@ -5,7 +5,6 @@
     #ifndef FLUTTER_RUNTIME_DART_ISOLATE_H_
     #define FLUTTER_RUNTIME_DART_ISOLATE_H_
     
    -#include 
     #include 
     #include 
     
    @@ -76,14 +75,6 @@ class DartIsolate : public UIDartState {
       bool PrepareForRunningFromKernel(std::shared_ptr kernel,
                                        bool last_piece = true);
     
    -  FML_WARN_UNUSED_RESULT
    -  bool PrepareForRunningFromKernels(
    -      std::vector> kernels);
    -
    -  FML_WARN_UNUSED_RESULT
    -  bool PrepareForRunningFromKernels(
    -      std::vector> kernels);
    -
       FML_WARN_UNUSED_RESULT
       bool Run(const std::string& entrypoint, fml::closure on_run = nullptr);
     
    @@ -103,8 +94,6 @@ class DartIsolate : public UIDartState {
     
       std::weak_ptr GetWeakIsolatePtr();
     
    -  fml::RefPtr GetMessageHandlingTaskRunner() const;
    -
      private:
       bool LoadKernel(std::shared_ptr mapping, bool last_piece);
     
    @@ -127,14 +116,10 @@ class DartIsolate : public UIDartState {
       std::vector> kernel_buffers_;
       std::vector> shutdown_callbacks_;
       ChildIsolatePreparer child_isolate_preparer_ = nullptr;
    -  fml::RefPtr message_handling_task_runner_;
     
       FML_WARN_UNUSED_RESULT
       bool Initialize(Dart_Isolate isolate, bool is_root_isolate);
     
    -  void SetMessageHandlingTaskRunner(fml::RefPtr runner,
    -                                    bool is_root_isolate);
    -
       FML_WARN_UNUSED_RESULT
       bool LoadLibraries(bool is_root_isolate);
     
    @@ -143,8 +128,6 @@ class DartIsolate : public UIDartState {
       FML_WARN_UNUSED_RESULT
       bool MarkIsolateRunnable();
     
    -  void OnShutdownCallback();
    -
       // |Dart_IsolateCreateCallback|
       static Dart_Isolate DartIsolateCreateCallback(
           const char* advisory_script_uri,
    diff --git a/runtime/dart_lifecycle_unittests.cc b/runtime/dart_lifecycle_unittests.cc
    deleted file mode 100644
    index 039d93793cb6d..0000000000000
    --- a/runtime/dart_lifecycle_unittests.cc
    +++ /dev/null
    @@ -1,142 +0,0 @@
    -// Copyright 2013 The Flutter 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/common/task_runners.h"
    -#include "flutter/fml/paths.h"
    -#include "flutter/fml/synchronization/waitable_event.h"
    -#include "flutter/runtime/dart_vm.h"
    -#include "flutter/runtime/dart_vm_lifecycle.h"
    -#include "flutter/runtime/runtime_test.h"
    -
    -namespace blink {
    -namespace testing {
    -
    -using DartLifecycleTest = RuntimeTest;
    -
    -TEST_F(DartLifecycleTest, CanStartAndShutdownVM) {
    -  auto settings = CreateSettingsForFixture();
    -  settings.leak_vm = false;
    -  settings.enable_observatory = false;
    -  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
    -  {
    -    auto vm_ref = DartVMRef::Create(settings);
    -    ASSERT_TRUE(DartVMRef::IsInstanceRunning());
    -  }
    -  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
    -}
    -
    -TEST_F(DartLifecycleTest, CanStartAndShutdownVMOverAndOver) {
    -  auto settings = CreateSettingsForFixture();
    -  settings.leak_vm = false;
    -  settings.enable_observatory = false;
    -  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
    -  auto count = DartVM::GetVMLaunchCount();
    -  for (size_t i = 0; i < 10; i++) {
    -    auto vm_ref = DartVMRef::Create(settings);
    -    ASSERT_TRUE(DartVMRef::IsInstanceRunning());
    -    ASSERT_EQ(DartVM::GetVMLaunchCount(), count + 1);
    -    count = DartVM::GetVMLaunchCount();
    -  }
    -  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
    -}
    -
    -static void CreateAndRunRootIsolate(
    -    std::shared_ptr& isolate_result,
    -    const Settings& settings,
    -    const DartVMData& vm,
    -    fml::RefPtr task_runner,
    -    std::string entrypoint) {
    -  FML_CHECK(entrypoint.size() > 0);
    -  TaskRunners runners("io.flutter.test", task_runner, task_runner, task_runner,
    -                      task_runner);
    -  auto isolate_weak = DartIsolate::CreateRootIsolate(
    -      vm.GetSettings(),         // settings
    -      vm.GetIsolateSnapshot(),  // isolate_snapshot
    -      vm.GetSharedSnapshot(),   // shared_snapshot
    -      runners,                  // task_runners
    -      {},                       // window
    -      {},                       // snapshot_delegate
    -      {},                       // io_manager
    -      "main.dart",              // advisory_script_uri
    -      entrypoint.c_str(),       // advisory_script_entrypoint
    -      nullptr                   // flags
    -  );
    -
    -  auto isolate = isolate_weak.lock();
    -
    -  if (!isolate) {
    -    FML_LOG(ERROR) << "Could not create valid isolate.";
    -    return;
    -  }
    -
    -  if (DartVM::IsRunningPrecompiledCode()) {
    -    if (!isolate->PrepareForRunningFromPrecompiledCode()) {
    -      FML_LOG(ERROR)
    -          << "Could not prepare to run the isolate from precompiled code.";
    -      return;
    -    }
    -
    -  } else {
    -    if (!isolate->PrepareForRunningFromKernels(
    -            settings.application_kernels())) {
    -      FML_LOG(ERROR) << "Could not prepare isolate from application kernels.";
    -      return;
    -    }
    -  }
    -
    -  if (isolate->GetPhase() != DartIsolate::Phase::Ready) {
    -    FML_LOG(ERROR) << "Isolate was not ready.";
    -    return;
    -  }
    -
    -  if (!isolate->Run(entrypoint, settings.root_isolate_create_callback)) {
    -    FML_LOG(ERROR) << "Could not run entrypoint: " << entrypoint << ".";
    -    return;
    -  }
    -
    -  if (isolate->GetPhase() != DartIsolate::Phase::Running) {
    -    FML_LOG(ERROR) << "Isolate was not Running.";
    -    return;
    -  }
    -
    -  isolate_result = isolate;
    -}
    -
    -static std::shared_ptr CreateAndRunRootIsolate(
    -    const Settings& settings,
    -    const DartVMData& vm,
    -    fml::RefPtr task_runner,
    -    std::string entrypoint) {
    -  fml::AutoResetWaitableEvent latch;
    -  std::shared_ptr isolate;
    -  fml::TaskRunner::RunNowOrPostTask(task_runner, [&]() {
    -    CreateAndRunRootIsolate(isolate, settings, vm, task_runner, entrypoint);
    -    latch.Signal();
    -  });
    -  latch.Wait();
    -  return isolate;
    -}
    -
    -TEST_F(DartLifecycleTest, ShuttingDownTheVMShutsDownTheIsolate) {
    -  auto settings = CreateSettingsForFixture();
    -  settings.leak_vm = false;
    -  settings.enable_observatory = false;
    -  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
    -  {
    -    auto vm_ref = DartVMRef::Create(settings);
    -    ASSERT_TRUE(DartVMRef::IsInstanceRunning());
    -    ASSERT_EQ(vm_ref->GetIsolateCount(), 0u);
    -    auto isolate =
    -        CreateAndRunRootIsolate(settings, *vm_ref.GetVMData(),
    -                                GetThreadTaskRunner(), "testIsolateShutdown");
    -    ASSERT_TRUE(isolate);
    -    ASSERT_EQ(vm_ref->GetIsolateCount(), 1u);
    -    vm_ref->ShutdownAllIsolates();
    -    ASSERT_EQ(vm_ref->GetIsolateCount(), 0u);
    -  }
    -  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
    -}
    -
    -}  // namespace testing
    -}  // namespace blink
    diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc
    index db8acaaa46abc..110f7c2b27809 100644
    --- a/runtime/dart_vm.cc
    +++ b/runtime/dart_vm.cc
    @@ -15,7 +15,6 @@
     #include "flutter/fml/file.h"
     #include "flutter/fml/logging.h"
     #include "flutter/fml/mapping.h"
    -#include "flutter/fml/synchronization/count_down_latch.h"
     #include "flutter/fml/synchronization/thread_annotations.h"
     #include "flutter/fml/time/time_delta.h"
     #include "flutter/fml/trace_event.h"
    @@ -451,54 +450,4 @@ std::shared_ptr DartVM::GetIsolateNameServer() const {
       return isolate_name_server_;
     }
     
    -size_t DartVM::GetIsolateCount() const {
    -  std::lock_guard lock(active_isolates_mutex_);
    -  return active_isolates_.size();
    -}
    -
    -void DartVM::ShutdownAllIsolates() {
    -  std::set> isolates_to_shutdown;
    -  // We may be shutting down isolates on the current thread. Shutting down the
    -  // isolate calls the shutdown callback which removes the entry from the
    -  // active isolate. The lock must be obtained to mutate that entry. To avoid a
    -  // deadlock, collect the isolate is a seprate collection.
    -  {
    -    std::lock_guard lock(active_isolates_mutex_);
    -    for (const auto& active_isolate : active_isolates_) {
    -      if (auto task_runner = active_isolate->GetMessageHandlingTaskRunner()) {
    -        isolates_to_shutdown.insert(active_isolate);
    -      }
    -    }
    -  }
    -
    -  fml::CountDownLatch latch(isolates_to_shutdown.size());
    -
    -  for (const auto& isolate : isolates_to_shutdown) {
    -    fml::TaskRunner::RunNowOrPostTask(
    -        isolate->GetMessageHandlingTaskRunner(), [&latch, isolate]() {
    -          if (!isolate || !isolate->Shutdown()) {
    -            FML_LOG(ERROR) << "Could not shutdown isolate.";
    -          }
    -          latch.CountDown();
    -        });
    -  }
    -  latch.Wait();
    -}
    -
    -void DartVM::RegisterActiveIsolate(std::shared_ptr isolate) {
    -  if (!isolate) {
    -    return;
    -  }
    -  std::lock_guard lock(active_isolates_mutex_);
    -  active_isolates_.insert(isolate);
    -}
    -
    -void DartVM::UnregisterActiveIsolate(std::shared_ptr isolate) {
    -  if (!isolate) {
    -    return;
    -  }
    -  std::lock_guard lock(active_isolates_mutex_);
    -  active_isolates_.erase(isolate);
    -}
    -
     }  // namespace blink
    diff --git a/runtime/dart_vm.h b/runtime/dart_vm.h
    index bff23f7352a7e..6724abde0b828 100644
    --- a/runtime/dart_vm.h
    +++ b/runtime/dart_vm.h
    @@ -36,27 +36,17 @@ class DartVM {
     
       std::shared_ptr GetVMData() const;
     
    -  // This accessor is racy and only meant to the used in tests where there is a
    -  // consistent threading mode.
    -  size_t GetIsolateCount() const;
    -
       std::shared_ptr GetServiceProtocol() const;
     
       std::shared_ptr GetIsolateNameServer() const;
     
    -  void ShutdownAllIsolates();
    -
      private:
       const Settings settings_;
       std::shared_ptr vm_data_;
       const std::shared_ptr isolate_name_server_;
       const std::shared_ptr service_protocol_;
    -  mutable std::mutex active_isolates_mutex_;
    -  std::set> active_isolates_
    -      FML_GUARDED_BY(active_isolates_mutex_);
     
       friend class DartVMRef;
    -  friend class DartIsolate;
     
       static std::shared_ptr Create(
           Settings settings,
    @@ -68,10 +58,6 @@ class DartVM {
       DartVM(std::shared_ptr data,
              std::shared_ptr isolate_name_server);
     
    -  void RegisterActiveIsolate(std::shared_ptr isolate);
    -
    -  void UnregisterActiveIsolate(std::shared_ptr isolate);
    -
       FML_DISALLOW_COPY_AND_ASSIGN(DartVM);
     };
     
    diff --git a/runtime/dart_vm_lifecycle.cc b/runtime/dart_vm_lifecycle.cc
    index 07f88cbc83daf..1ed86e0250c4b 100644
    --- a/runtime/dart_vm_lifecycle.cc
    +++ b/runtime/dart_vm_lifecycle.cc
    @@ -114,9 +114,4 @@ std::shared_ptr DartVMRef::GetIsolateNameServer() {
       return gVMIsolateNameServer.lock();
     }
     
    -DartVM* DartVMRef::GetRunningVM() {
    -  std::lock_guard lock(gVMMutex);
    -  return gVM.lock().get();
    -}
    -
     }  // namespace blink
    diff --git a/runtime/dart_vm_lifecycle.h b/runtime/dart_vm_lifecycle.h
    index 44a6cdba7b8b1..cfe1f1b646469 100644
    --- a/runtime/dart_vm_lifecycle.h
    +++ b/runtime/dart_vm_lifecycle.h
    @@ -49,11 +49,6 @@ class DartVMRef {
     
       operator bool() const { return static_cast(vm_); }
     
    -  DartVM* get() {
    -    FML_DCHECK(vm_);
    -    return vm_.get();
    -  }
    -
       DartVM* operator->() {
         FML_DCHECK(vm_);
         return vm_.get();
    @@ -65,15 +60,10 @@ class DartVMRef {
       }
     
      private:
    -  friend class DartIsolate;
    -
       std::shared_ptr vm_;
     
       DartVMRef(std::shared_ptr vm);
     
    -  // Only used by Dart Isolate to register itself with the VM.
    -  static DartVM* GetRunningVM();
    -
       FML_DISALLOW_COPY_AND_ASSIGN(DartVMRef);
     };
     
    diff --git a/runtime/fixtures/simple_main.dart b/runtime/fixtures/simple_main.dart
    index bc2d880ff1427..594f69470bc2f 100644
    --- a/runtime/fixtures/simple_main.dart
    +++ b/runtime/fixtures/simple_main.dart
    @@ -25,7 +25,3 @@ void canRegisterNativeCallback() async {
     }
     
     void NotifyNative() native "NotifyNative";
    -
    -
    -@pragma('vm:entry-point')
    -void testIsolateShutdown() {  }
    diff --git a/runtime/runtime_test.cc b/runtime/runtime_test.cc
    index adb345d85d33a..2613b133d241b 100644
    --- a/runtime/runtime_test.cc
    +++ b/runtime/runtime_test.cc
    @@ -68,13 +68,6 @@ void RuntimeTest::SetSnapshotsAndAssets(Settings& settings) {
             return GetMapping(assets_dir_, "isolate_snapshot_instr", true);
           };
         }
    -  } else {
    -    settings.application_kernels = [this]() {
    -      std::vector> kernel_mappings;
    -      kernel_mappings.emplace_back(
    -          GetMapping(assets_dir_, "kernel_blob.bin", false));
    -      return kernel_mappings;
    -    };
       }
     }
     
    diff --git a/shell/common/isolate_configuration.cc b/shell/common/isolate_configuration.cc
    index e45b6ab15e5f9..173973b64e5b1 100644
    --- a/shell/common/isolate_configuration.cc
    +++ b/shell/common/isolate_configuration.cc
    @@ -38,7 +38,7 @@ class AppSnapshotIsolateConfiguration final : public IsolateConfiguration {
     
     class KernelIsolateConfiguration : public IsolateConfiguration {
      public:
    -  KernelIsolateConfiguration(std::unique_ptr kernel)
    +  KernelIsolateConfiguration(std::unique_ptr kernel)
           : kernel_(std::move(kernel)) {}
     
       // |shell::IsolateConfiguration|
    @@ -50,7 +50,7 @@ class KernelIsolateConfiguration : public IsolateConfiguration {
       }
     
      private:
    -  std::unique_ptr kernel_;
    +  std::unique_ptr kernel_;
     
       FML_DISALLOW_COPY_AND_ASSIGN(KernelIsolateConfiguration);
     };
    @@ -58,8 +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|
    @@ -81,7 +80,7 @@ class KernelListIsolateConfiguration final : public IsolateConfiguration {
       }
     
      private:
    -  std::vector>> kernel_pieces_;
    +  std::vector>> kernel_pieces_;
     
       FML_DISALLOW_COPY_AND_ASSIGN(KernelListIsolateConfiguration);
     };
    @@ -113,15 +112,15 @@ static std::vector ParseKernelListPaths(
       return kernel_pieces_paths;
     }
     
    -static std::vector>>
    +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;
    +  std::vector>> fetch_futures;
     
       for (const auto& kernel_pieces_path : kernel_pieces_paths) {
    -    std::promise> fetch_promise;
    +    std::promise> fetch_promise;
         fetch_futures.push_back(fetch_promise.get_future());
         auto fetch_task =
             fml::MakeCopyable([asset_manager, kernel_pieces_path,
    @@ -154,10 +153,6 @@ std::unique_ptr IsolateConfiguration::InferFromSettings(
         return nullptr;
       }
     
    -  if (settings.application_kernels) {
    -    return CreateForKernelList(settings.application_kernels());
    -  }
    -
       if (settings.application_kernel_asset.empty() &&
           settings.application_kernel_list_asset.empty()) {
         FML_DLOG(ERROR) << "application_kernel_asset or "
    @@ -197,15 +192,15 @@ IsolateConfiguration::CreateForAppSnapshot() {
     }
     
     std::unique_ptr IsolateConfiguration::CreateForKernel(
    -    std::unique_ptr kernel) {
    +    std::unique_ptr kernel) {
       return std::make_unique(std::move(kernel));
     }
     
     std::unique_ptr IsolateConfiguration::CreateForKernelList(
    -    std::vector> kernel_pieces) {
    -  std::vector>> pieces;
    +    std::vector> kernel_pieces) {
    +  std::vector>> pieces;
       for (auto& piece : kernel_pieces) {
    -    std::promise> promise;
    +    std::promise> promise;
         pieces.push_back(promise.get_future());
         promise.set_value(std::move(piece));
       }
    @@ -213,8 +208,7 @@ std::unique_ptr IsolateConfiguration::CreateForKernelList(
     }
     
     std::unique_ptr IsolateConfiguration::CreateForKernelList(
    -    std::vector>>
    -        kernel_pieces) {
    +    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 0d2619e6068c1..e9f8d66b2e433 100644
    --- a/shell/common/isolate_configuration.h
    +++ b/shell/common/isolate_configuration.h
    @@ -29,14 +29,16 @@ class IsolateConfiguration {
       static std::unique_ptr CreateForAppSnapshot();
     
       static std::unique_ptr CreateForKernel(
    -      std::unique_ptr kernel);
    +      std::unique_ptr kernel);
     
       static std::unique_ptr CreateForKernelList(
    -      std::vector>>
    -          kernel_pieces);
    +      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);
    +      std::vector> kernel_pieces);
     
       IsolateConfiguration();
     
    diff --git a/shell/platform/android/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc
    index cbddd1b9f81f4..b26f5939902f2 100644
    --- a/shell/platform/android/platform_view_android_jni.cc
    +++ b/shell/platform/android/platform_view_android_jni.cc
    @@ -207,7 +207,7 @@ std::unique_ptr CreateIsolateConfiguration(
         auto blob = asset_manager.GetAsMapping(snapshot_name);
         auto delta = asset_manager.GetAsMapping("kernel_delta.bin");
         if (blob && delta) {
    -      std::vector> kernels;
    +      std::vector> kernels;
           kernels.emplace_back(std::move(blob));
           kernels.emplace_back(std::move(delta));
           return IsolateConfiguration::CreateForKernelList(std::move(kernels));
    
    From 7b831986f4d0b95f89d10388f11e50cd4cc82afe Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Wed, 3 Apr 2019 20:31:36 -0400
    Subject: [PATCH 0688/1117] Roll src/third_party/skia
     2273c900ea28..5c5de2146309 (5 commits) (#8432)
    
    https://skia.googlesource.com/skia.git/%2Blog/2273c900ea28..5c5de2146309
    
    git log 2273c900ea2888ac659dbcdfe6e6d1cd2cf76177..5c5de21463095923adfb3349c5c794be56665395 --date=short --no-merges --format=%ad %ae %s
    2019-04-03 reed@google.com no more legacy enum references
    2019-04-03 halcanary@google.com Fix SkTypeface_Mac::getGlyphToUnicodeMap
    2019-04-03 fmalita@chromium.org [skottie] Fix gradient ramp for non-solid layers
    2019-04-03 ethannicholas@google.com fix SkSL constant comparisons involving negated vectors
    2019-04-03 ethannicholas@google.com fixed error reporting in SkSL->Metal
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index d9b5d45cda93e..76070a9a64199 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': '2273c900ea2888ac659dbcdfe6e6d1cd2cf76177',
    +  'skia_revision': '5c5de21463095923adfb3349c5c794be56665395',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index e0a97c486dcf0..992e43c3133dd 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: aa4ce47d179f622bf227d1feb5d5f694
    +Signature: 87dbb29dfcb54f59099581850289c1d9
     
     UNUSED LICENSES:
     
    
    From 4ff18fbda740496f2d2e7610a960e4b9694903c6 Mon Sep 17 00:00:00 2001
    From: Ben Konyi 
    Date: Wed, 3 Apr 2019 18:17:26 -0700
    Subject: [PATCH 0689/1117] Roll src/third_party/dart f6768b6fb3..11a3dd7332
     (56 commits)
    
    11a3dd7332 Split up language_2/control_flow_collections/for_test.
    35f45cf3f1 Remove _mainLibraryUri, replace with user-code-locations
    5fffa99993 Add helper method to clear batch-mode state
    0669c2cee5 fix dartfix modification of analysis options
    82f8477314 Split up language_2/control_flow_collections/if_test.
    e3164c9078 [vm, reload] ResetICDatas may allocate, so it cannot run during heap iteration.
    26c45e78a4 [vm/compiler] Prevent incorrect caching of mutable CompileType objects as reaching types.
    830ec419b6 Cleanup warnings and sort a few files
    2ebdb0890f [gardening] Update flutter engine patch as DART_CHECK_VALID change is no longer needed.
    dfdd974390 [vm/kernel] Pass environment defines through CompilerOptions for front-end const evaluator
    dc655d9e1a [vm, bytecode] Propagate interface targets to the flow graph and ICData.
    1dd6eaac56 Resolve default values.
    ab065aedda Fix a potential infinite loop in type_error_test.
    1dd72d4309 Revert "[vm/build] Expose is_release/is_profile so they are available in third_party gn scripts." and different fix.
    e64bd9a01a [vm/compiler] Fix incorrect labeling of stack slots
    fe2d66006d improve type-before-factory error message
    f32db1a453 Start adding type algebra.
    1d6a7bee36 rework dartfix NNBD to use FixCodeTask.processPackage
    9e81e4bfe5 [vm/compiler] Move BlockBuilder from graph_intrinsifier.cc to a header.
    93d0e8279a Include liveness of type arguments in supertypes in RTI needed checks computation
    80b40bdbeb Add completion subscriptions to the status page
    f15f9208e6 Remove !googletest from third_party/.gitignore
    28734c5f23 [vm] Deoptimize when encountering uninitialized guard state for final field in optimized code.
    9f3e9f37a0 [cfe] Make checks on individual leaves of collection element sub-trees
    fad85a6bfa Broken test fixes
    54783db99c [cfe] Ensure that `await for` elements are marked async
    592aee4838 Revert "Reland "Temporary revert of two changes which potentially caused performance regressions in Flutter.""
    debd918696 Reland "Temporary revert of two changes which potentially caused performance regressions in Flutter."
    0368adee9d [infra] Switch benchmark builders to Ubuntu 16.04.
    8754eb128c Test bytecode benchmarks when built with bytecode support.
    dbb6bf0237 [cfe] Ensure that async for map entries are marked
    78fca5b2fa Include liveness of type argument in supertypes in RTI needed checks computation
    9a2b222cba [infra] dart_sdk builder script won't upload from tryjobs
    e1e5bb59c9 [cfe] Check that the condition in if-elements is a bool
    c5f1614bcc [fasta] Don't use invalidCollectionElement when ui-as-code is enabled
    cc0997f1bc Compute 'isSimplyBounded' for generic classes and typedefs.
    efa9b9da99 [gardening] Patch flutter engine to fix flutter hhh build.
    7f09c40db4 Add builder tag to dart2js-production-*-d8 and mark language_2/control_flow_collections/for_test as Crash on dart2js-production-linux-d8.
    33fb2431c0 changelog: remove linter details that don't affect SDK users
    dc9370a07d [vm/runtime] Create separate background compilation queues for optimized and unoptimized compilations.
    f3aaf8a770 [vm/build] Expose is_release/is_profile so they are available in third_party gn scripts.
    d63d0b4bcd Revert "Temporary revert of two changes which potentially caused performance regressions in Flutter."
    49c94d3600 Temporary revert of two changes which potentially caused performance regressions in Flutter.
    5f03a9a07e Fix lints in summary generator: setter types, star-slash docs
    d77a6064a9 [vm, profiler] Improve profiler stacks and VM backtraces.
    335a854696 Implement JavaScript semantics for frontend constant folding.
    9f59f46650 Fix an exception in the changeArgumentName quick fix (issue 36440)
    0d0f5916f7 Issue 36439. Fix for incomplete generic type alias, without function type.
    3379eefd5f [vm] Remove DART_CHECK_VALID; add check for a current isolate to Dart_PropagateError.
    3782887c37 [gardening] Update flutter glfw-disabling patch
    5bbfc06b83 [vm/build] Pass predefined environment variables to compile_platform.
    2ee8bb87e4 Remove control flow collections test skips for all platforms
    8fb77ec84d [vm/bytecode] Preliminary support for new language features in bytecode
    8aabbf39e5 Move last meta-based hint code tests to diagnostics:
    6d934b94c5 [vm, service] Remove _getCrashDump.
    50d4e489d4 Fix type comparisons in language_2/control_flow_collections.
    ---
     DEPS                                    | 2 +-
     ci/licenses_golden/licenses_third_party | 6 +++---
     2 files changed, 4 insertions(+), 4 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 76070a9a64199..8c85d34ee6c31 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -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': 'f6768b6fb3e58bb704aca1e22a7ffd11e7ff07cb',
    +  'dart_revision': '11a3dd7332f03c82fc01c19af3e75209ebb725a8',
     
       # WARNING: DO NOT EDIT MANUALLY
       # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
    diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party
    index 1e8a3de3ace92..3391a9cd9819d 100644
    --- a/ci/licenses_golden/licenses_third_party
    +++ b/ci/licenses_golden/licenses_third_party
    @@ -1,4 +1,4 @@
    -Signature: 3ae9b79b70f8f3445bc684cfda86e034
    +Signature: 000c3eafbb894888c3cb2a57ebcf6ace
     
     UNUSED LICENSES:
     
    @@ -4608,7 +4608,6 @@ FILE: ../../../third_party/dart/runtime/observatory/web/favicon.ico
     FILE: ../../../third_party/dart/runtime/observatory/web/index.html
     FILE: ../../../third_party/dart/runtime/observatory/web/third_party/trace_viewer_full.html
     FILE: ../../../third_party/dart/runtime/observatory/web/timeline.html
    -FILE: ../../../third_party/dart/runtime/vm/snapshot_test_in.dat
     FILE: ../../../third_party/dart/samples/ffi/sqlite/docs/lib/scenario-default.svg
     FILE: ../../../third_party/dart/samples/ffi/sqlite/docs/lib/scenario-full.svg
     FILE: ../../../third_party/dart/sdk/lib/html/html_common/conversions_dart2js.dart
    @@ -4970,7 +4969,6 @@ FILE: ../../../third_party/dart/runtime/vm/snapshot.cc
     FILE: ../../../third_party/dart/runtime/vm/snapshot.h
     FILE: ../../../third_party/dart/runtime/vm/snapshot_ids.h
     FILE: ../../../third_party/dart/runtime/vm/snapshot_test.cc
    -FILE: ../../../third_party/dart/runtime/vm/snapshot_test.dart
     FILE: ../../../third_party/dart/runtime/vm/stack_frame.cc
     FILE: ../../../third_party/dart/runtime/vm/stack_frame_test.cc
     FILE: ../../../third_party/dart/runtime/vm/stub_code.cc
    @@ -5150,9 +5148,11 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_arm.cc
     FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_arm64.cc
     FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_ia32.cc
     FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_x64.cc
    +FILE: ../../../third_party/dart/runtime/vm/compiler/backend/block_builder.h
     FILE: ../../../third_party/dart/runtime/vm/compiler/backend/flow_graph_checker.cc
     FILE: ../../../third_party/dart/runtime/vm/compiler/backend/flow_graph_checker.h
     FILE: ../../../third_party/dart/runtime/vm/compiler/backend/slot_test.cc
    +FILE: ../../../third_party/dart/runtime/vm/compiler/backend/type_propagator_test.cc
     FILE: ../../../third_party/dart/runtime/vm/compiler/ffi.cc
     FILE: ../../../third_party/dart/runtime/vm/compiler/ffi.h
     FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier.cc
    
    From 49d0dc6d61c61e22d909da102eeebfdb351b6d5b Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Wed, 3 Apr 2019 23:54:54 -0400
    Subject: [PATCH 0690/1117] Roll src/third_party/skia
     5c5de2146309..b6d04556c34d (1 commits) (#8434)
    
    https://skia.googlesource.com/skia.git/%2Blog/5c5de2146309..b6d04556c34d
    
    git log 5c5de21463095923adfb3349c5c794be56665395..b6d04556c34db25d6d8aef4eff9c5f0a61ea3733 --date=short --no-merges --format=%ad %ae %s
    2019-04-03 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 8c85d34ee6c31..a3c93bbde8382 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': '5c5de21463095923adfb3349c5c794be56665395',
    +  'skia_revision': 'b6d04556c34db25d6d8aef4eff9c5f0a61ea3733',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 992e43c3133dd..ba17b32f178df 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 87dbb29dfcb54f59099581850289c1d9
    +Signature: 2b725648c503ac5c4a9d1cc011905e94
     
     UNUSED LICENSES:
     
    
    From 445ab42efc93cbef4b78ec7cb3a7eb97db2ff3d3 Mon Sep 17 00:00:00 2001
    From: Ben Konyi 
    Date: Wed, 3 Apr 2019 22:03:28 -0700
    Subject: [PATCH 0691/1117] Roll src/third_party/dart 11a3dd7332..600b2831ef (9
     commits)
    
    600b2831ef [dartdevc] Updating nullability inference to account for unevaluated constants
    7c9d02b313 [vm/bytecode] Generate empty list literals more efficiently
    bf293ea34c [vm/bytecode] Remove support for old version of bytecode format (v1)
    e9f5b85492 [vm/bytecode] fixed typo in stack test
    da15746f4c Update the production of training data
    603a57e4c2 [vm, interpreter] Increment implicit accessor usage counts.
    4d37977473 [vm/bytecode] Do not mark null-initialized instance fields as nullable too early
    2f77af1c6f Fold `identical(double.nan, double.nan)` => `false` in dart2js.
    f1cfcc621a [test/vm status files] Update vm status file to remove all entries related to spread and control_flow
    ---
     DEPS                                    | 2 +-
     ci/licenses_golden/licenses_third_party | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index a3c93bbde8382..5a8651623d0c0 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -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': '11a3dd7332f03c82fc01c19af3e75209ebb725a8',
    +  'dart_revision': '600b2831ef76ad99fd4d11358a035956f5d8259d',
     
       # WARNING: DO NOT EDIT MANUALLY
       # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
    diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party
    index 3391a9cd9819d..b2d042dcdcf4a 100644
    --- a/ci/licenses_golden/licenses_third_party
    +++ b/ci/licenses_golden/licenses_third_party
    @@ -1,4 +1,4 @@
    -Signature: 000c3eafbb894888c3cb2a57ebcf6ace
    +Signature: 5c238ef9816dbc5ee5f25a2ceda8b238
     
     UNUSED LICENSES:
     
    
    From 0ed237c19eee00faa65dcee40de9db19bf99c733 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Thu, 4 Apr 2019 03:23:54 -0400
    Subject: [PATCH 0692/1117] Roll src/third_party/skia
     b6d04556c34d..dde12a25bb5e (4 commits) (#8437)
    
    https://skia.googlesource.com/skia.git/%2Blog/b6d04556c34d..dde12a25bb5e
    
    git log b6d04556c34db25d6d8aef4eff9c5f0a61ea3733..dde12a25bb5e05ab929590cc7b71851ee76378ec --date=short --no-merges --format=%ad %ae %s
    2019-04-04 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset
    2019-04-04 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 38969ffb5d49..3ae962179e68 (476 commits)
    2019-04-04 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 89899748a858..43997017b0ed (9 commits)
    2019-04-04 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 2b9fb4bf5ece..225a13016b1c (11 commits)
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 5a8651623d0c0..affbac008f9b7 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': 'b6d04556c34db25d6d8aef4eff9c5f0a61ea3733',
    +  'skia_revision': 'dde12a25bb5e05ab929590cc7b71851ee76378ec',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index ba17b32f178df..fd96bc2d67ad1 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 2b725648c503ac5c4a9d1cc011905e94
    +Signature: f965c0935d4097a38fbdcd5085d9e7ca
     
     UNUSED LICENSES:
     
    
    From ad9d2417e9aa182700f0d1423de758d2a000598d Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Thu, 4 Apr 2019 08:13:54 -0400
    Subject: [PATCH 0693/1117] Roll src/third_party/skia
     dde12a25bb5e..f346df396a23 (1 commits) (#8438)
    
    https://skia.googlesource.com/skia.git/%2Blog/dde12a25bb5e..f346df396a23
    
    git log dde12a25bb5e05ab929590cc7b71851ee76378ec..f346df396a23adde4bd93f17067a9b17549acc84 --date=short --no-merges --format=%ad %ae %s
    2019-04-03 egdaniel@google.com Minor refactoring of where we call addingWork in GrVkCommandBuffer.
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index affbac008f9b7..3bc54e15d7022 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': 'dde12a25bb5e05ab929590cc7b71851ee76378ec',
    +  'skia_revision': 'f346df396a23adde4bd93f17067a9b17549acc84',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index fd96bc2d67ad1..a54dca1656d2b 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: f965c0935d4097a38fbdcd5085d9e7ca
    +Signature: 9c97c7b3d56c573e76b98566579a4509
     
     UNUSED LICENSES:
     
    
    From 5944867cabdb934ef9fea0dccb865cb1acef51b5 Mon Sep 17 00:00:00 2001
    From: reed-at-google 
    Date: Thu, 4 Apr 2019 08:41:49 -0400
    Subject: [PATCH 0694/1117] update to use SkTileMode (#8439)
    
    ---
     flow/paint_utils.cc             |  4 ++--
     lib/ui/painting/gradient.cc     |  8 ++++----
     lib/ui/painting/gradient.h      | 10 +++++-----
     lib/ui/painting/image_shader.cc |  4 ++--
     lib/ui/painting/image_shader.h  |  4 ++--
     5 files changed, 15 insertions(+), 15 deletions(-)
    
    diff --git a/flow/paint_utils.cc b/flow/paint_utils.cc
    index 22b0735b8939f..791965f69b6d2 100644
    --- a/flow/paint_utils.cc
    +++ b/flow/paint_utils.cc
    @@ -20,8 +20,8 @@ sk_sp CreateCheckerboardShader(SkColor c1, SkColor c2, int size) {
       bm.eraseColor(c1);
       bm.eraseArea(SkIRect::MakeLTRB(0, 0, size, size), c2);
       bm.eraseArea(SkIRect::MakeLTRB(size, size, 2 * size, 2 * size), c2);
    -  return SkShader::MakeBitmapShader(bm, SkShader::kRepeat_TileMode,
    -                                    SkShader::kRepeat_TileMode);
    +  return SkShader::MakeBitmapShader(bm, SkTileMode::kRepeat,
    +                                    SkTileMode::kRepeat);
     }
     
     }  // anonymous namespace
    diff --git a/lib/ui/painting/gradient.cc b/lib/ui/painting/gradient.cc
    index 287e8e78621cc..d18f0a637ccad 100644
    --- a/lib/ui/painting/gradient.cc
    +++ b/lib/ui/painting/gradient.cc
    @@ -42,7 +42,7 @@ fml::RefPtr CanvasGradient::Create() {
     void CanvasGradient::initLinear(const tonic::Float32List& end_points,
                                     const tonic::Int32List& colors,
                                     const tonic::Float32List& color_stops,
    -                                SkShader::TileMode tile_mode) {
    +                                SkTileMode tile_mode) {
       FML_DCHECK(end_points.num_elements() == 4);
       FML_DCHECK(colors.num_elements() == color_stops.num_elements() ||
                  color_stops.data() == nullptr);
    @@ -63,7 +63,7 @@ void CanvasGradient::initRadial(double center_x,
                                     double radius,
                                     const tonic::Int32List& colors,
                                     const tonic::Float32List& color_stops,
    -                                SkShader::TileMode tile_mode,
    +                                SkTileMode tile_mode,
                                     const tonic::Float64List& matrix4) {
       FML_DCHECK(colors.num_elements() == color_stops.num_elements() ||
                  color_stops.data() == nullptr);
    @@ -87,7 +87,7 @@ void CanvasGradient::initSweep(double center_x,
                                    double center_y,
                                    const tonic::Int32List& colors,
                                    const tonic::Float32List& color_stops,
    -                               SkShader::TileMode tile_mode,
    +                               SkTileMode tile_mode,
                                    double start_angle,
                                    double end_angle,
                                    const tonic::Float64List& matrix4) {
    @@ -118,7 +118,7 @@ void CanvasGradient::initTwoPointConical(double start_x,
                                              double end_radius,
                                              const tonic::Int32List& colors,
                                              const tonic::Float32List& color_stops,
    -                                         SkShader::TileMode tile_mode,
    +                                         SkTileMode tile_mode,
                                              const tonic::Float64List& matrix4) {
       FML_DCHECK(colors.num_elements() == color_stops.num_elements() ||
                  color_stops.data() == nullptr);
    diff --git a/lib/ui/painting/gradient.h b/lib/ui/painting/gradient.h
    index 83e2a45e0d22a..622542db0a2ba 100644
    --- a/lib/ui/painting/gradient.h
    +++ b/lib/ui/painting/gradient.h
    @@ -20,7 +20,7 @@ class DartLibraryNatives;
     namespace blink {
     
     // TODO: update this if/when Skia adds Decal mode skbug.com/7638
    -static_assert(SkShader::kTileModeCount >= 3, "Need to update tile mode enum");
    +static_assert(kSkTileModeCount >= 3, "Need to update tile mode enum");
     
     class CanvasGradient : public Shader {
       DEFINE_WRAPPERTYPEINFO();
    @@ -33,21 +33,21 @@ class CanvasGradient : public Shader {
       void initLinear(const tonic::Float32List& end_points,
                       const tonic::Int32List& colors,
                       const tonic::Float32List& color_stops,
    -                  SkShader::TileMode tile_mode);
    +                  SkTileMode tile_mode);
     
       void initRadial(double center_x,
                       double center_y,
                       double radius,
                       const tonic::Int32List& colors,
                       const tonic::Float32List& color_stops,
    -                  SkShader::TileMode tile_mode,
    +                  SkTileMode tile_mode,
                       const tonic::Float64List& matrix4);
     
       void initSweep(double center_x,
                      double center_y,
                      const tonic::Int32List& colors,
                      const tonic::Float32List& color_stops,
    -                 SkShader::TileMode tile_mode,
    +                 SkTileMode tile_mode,
                      double start_angle,
                      double end_angle,
                      const tonic::Float64List& matrix4);
    @@ -60,7 +60,7 @@ class CanvasGradient : public Shader {
                                double end_radius,
                                const tonic::Int32List& colors,
                                const tonic::Float32List& color_stops,
    -                           SkShader::TileMode tile_mode,
    +                           SkTileMode tile_mode,
                                const tonic::Float64List& matrix4);
     
       static void RegisterNatives(tonic::DartLibraryNatives* natives);
    diff --git a/lib/ui/painting/image_shader.cc b/lib/ui/painting/image_shader.cc
    index 389a214270618..136471e26c983 100644
    --- a/lib/ui/painting/image_shader.cc
    +++ b/lib/ui/painting/image_shader.cc
    @@ -35,8 +35,8 @@ fml::RefPtr ImageShader::Create() {
     }
     
     void ImageShader::initWithImage(CanvasImage* image,
    -                                SkShader::TileMode tmx,
    -                                SkShader::TileMode tmy,
    +                                SkTileMode tmx,
    +                                SkTileMode tmy,
                                     const tonic::Float64List& matrix4) {
       if (!image) {
         Dart_ThrowException(
    diff --git a/lib/ui/painting/image_shader.h b/lib/ui/painting/image_shader.h
    index 1365577fa1de7..e2a35cb285e22 100644
    --- a/lib/ui/painting/image_shader.h
    +++ b/lib/ui/painting/image_shader.h
    @@ -29,8 +29,8 @@ class ImageShader : public Shader {
       static fml::RefPtr Create();
     
       void initWithImage(CanvasImage* image,
    -                     SkShader::TileMode tmx,
    -                     SkShader::TileMode tmy,
    +                     SkTileMode tmx,
    +                     SkTileMode tmy,
                          const tonic::Float64List& matrix4);
     
       static void RegisterNatives(tonic::DartLibraryNatives* natives);
    
    From 4b1ec56bc855df5dd28556aef2550eba8a8b2231 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Thu, 4 Apr 2019 11:42:55 -0400
    Subject: [PATCH 0695/1117] Roll src/third_party/skia
     f346df396a23..1383a38e1d92 (8 commits) (#8440)
    
    https://skia.googlesource.com/skia.git/%2Blog/f346df396a23..1383a38e1d92
    
    git log f346df396a23adde4bd93f17067a9b17549acc84..1383a38e1d92fb70d94185b454daa6c1afecc6a0 --date=short --no-merges --format=%ad %ae %s
    2019-04-03 bungeman@google.com Allow users to create stock shaping iterators.
    2019-04-04 robertphillips@google.com Revert "Stop using pendingIO in read/writeSurfacePixels"
    2019-04-04 reed@google.com Revert "rely on clients to opt in to legacy enums"
    2019-04-04 kjlubick@google.com [canvaskit] Make SkImageShader from SkImage
    2019-04-03 ethannicholas@google.com SkSL now properly errors when invocations are used outside of a geometry shader
    2019-04-03 robertphillips@google.com Stop using pendingIO in read/writeSurfacePixels
    2019-03-29 kjlubick@google.com [canvaskit] adding drawAtlas to canvas API
    2019-04-03 reed@google.com rely on clients to opt in to legacy enums
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 3bc54e15d7022..64a54ba40d0ba 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': 'f346df396a23adde4bd93f17067a9b17549acc84',
    +  'skia_revision': '1383a38e1d92fb70d94185b454daa6c1afecc6a0',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index a54dca1656d2b..c5a29efdee81f 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 9c97c7b3d56c573e76b98566579a4509
    +Signature: ac694f519e0c290649e1f013c837ee67
     
     UNUSED LICENSES:
     
    
    From 0f70d5d4f1e3ed377781bc6e73e3666c73afc7f8 Mon Sep 17 00:00:00 2001
    From: Ben Konyi 
    Date: Thu, 4 Apr 2019 10:04:26 -0700
    Subject: [PATCH 0696/1117] Roll src/third_party/dart 600b2831ef..9814cb1b9c (7
     commits)
    
    9814cb1b9c [vm/compiler] Make new CheckBoundBase and allow range analysis contrain values after GenericCheckBound
    688475b1cd Fix bug in evaluation of == under constantUpdate2018
    a069ddda21 [CFE] Produce InstanceCreation from unevaluated constructor invocation.
    f63eaab3af [kernel] Add instance creation kernel node.
    395e5f6037 [cfe/vm] make dart:ffi compatible with constant-update-2018
    76f3630d04 [vm/compiler] Remove polymorphic typed data access in inliner
    31d558c81c [vm/compiler] Add il_test_helper.h with support for running compilation pipelines for testing
    ---
     DEPS                                    | 2 +-
     ci/licenses_golden/licenses_third_party | 4 +++-
     2 files changed, 4 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 64a54ba40d0ba..48ee95aa54ede 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -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': '600b2831ef76ad99fd4d11358a035956f5d8259d',
    +  'dart_revision': '9814cb1b9c782b4fa9b7ea05dee5942577410478',
     
       # WARNING: DO NOT EDIT MANUALLY
       # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
    diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party
    index b2d042dcdcf4a..15d5586afc9eb 100644
    --- a/ci/licenses_golden/licenses_third_party
    +++ b/ci/licenses_golden/licenses_third_party
    @@ -1,4 +1,4 @@
    -Signature: 5c238ef9816dbc5ee5f25a2ceda8b238
    +Signature: 09835d48c2532bcddee117fcf30aa73a
     
     UNUSED LICENSES:
     
    @@ -5151,6 +5151,8 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/asm_intrinsifier_x64.cc
     FILE: ../../../third_party/dart/runtime/vm/compiler/backend/block_builder.h
     FILE: ../../../third_party/dart/runtime/vm/compiler/backend/flow_graph_checker.cc
     FILE: ../../../third_party/dart/runtime/vm/compiler/backend/flow_graph_checker.h
    +FILE: ../../../third_party/dart/runtime/vm/compiler/backend/il_test_helper.cc
    +FILE: ../../../third_party/dart/runtime/vm/compiler/backend/il_test_helper.h
     FILE: ../../../third_party/dart/runtime/vm/compiler/backend/slot_test.cc
     FILE: ../../../third_party/dart/runtime/vm/compiler/backend/type_propagator_test.cc
     FILE: ../../../third_party/dart/runtime/vm/compiler/ffi.cc
    
    From a40adfdf4ae5555903f4caad4f3418a1a1575062 Mon Sep 17 00:00:00 2001
    From: stuartmorgan 
    Date: Thu, 4 Apr 2019 13:54:07 -0400
    Subject: [PATCH 0697/1117] Add window title/icon support to GLFW shell (#8435)
    
    The GLFW shell used a hard-coded title and default icon for the window,
    but these are things that a client should be able to control.
    ---
     .../flutter_window_controller.cc              | 13 ++++++++++-
     .../flutter/flutter_window_controller.h       | 11 +++++++++
     .../testing/stub_flutter_glfw_api.cc          | 23 ++++++++++++++++---
     .../testing/stub_flutter_glfw_api.h           |  9 +++++++-
     shell/platform/glfw/flutter_glfw.cc           | 22 ++++++++++++++----
     shell/platform/glfw/public/flutter_glfw.h     | 17 ++++++++++++++
     6 files changed, 86 insertions(+), 9 deletions(-)
    
    diff --git a/shell/platform/glfw/client_wrapper/flutter_window_controller.cc b/shell/platform/glfw/client_wrapper/flutter_window_controller.cc
    index c73d6e7078699..235be0b2bd6b3 100644
    --- a/shell/platform/glfw/client_wrapper/flutter_window_controller.cc
    +++ b/shell/platform/glfw/client_wrapper/flutter_window_controller.cc
    @@ -24,6 +24,7 @@ FlutterWindowController::~FlutterWindowController() {
     bool FlutterWindowController::CreateWindow(
         int width,
         int height,
    +    const std::string& title,
         const std::string& assets_path,
         const std::vector& arguments) {
       if (!init_succeeded_) {
    @@ -44,7 +45,7 @@ bool FlutterWindowController::CreateWindow(
       size_t arg_count = engine_arguments.size();
     
       window_ = FlutterDesktopCreateWindow(
    -      width, height, assets_path.c_str(), icu_data_path_.c_str(),
    +      width, height, title.c_str(), assets_path.c_str(), icu_data_path_.c_str(),
           arg_count > 0 ? &engine_arguments[0] : nullptr, arg_count);
       if (!window_) {
         std::cerr << "Failed to create window." << std::endl;
    @@ -68,6 +69,16 @@ void FlutterWindowController::SetHoverEnabled(bool enabled) {
       FlutterDesktopSetHoverEnabled(window_, enabled);
     }
     
    +void FlutterWindowController::SetTitle(const std::string& title) {
    +  FlutterDesktopSetWindowTitle(window_, title.c_str());
    +}
    +
    +void FlutterWindowController::SetIcon(uint8_t* pixel_data,
    +                                      int width,
    +                                      int height) {
    +  FlutterDesktopSetWindowIcon(window_, pixel_data, width, height);
    +}
    +
     void FlutterWindowController::RunEventLoop() {
       if (window_) {
         FlutterDesktopRunWindowLoop(window_);
    diff --git a/shell/platform/glfw/client_wrapper/include/flutter/flutter_window_controller.h b/shell/platform/glfw/client_wrapper/include/flutter/flutter_window_controller.h
    index 24496252c887c..70169e48cc79a 100644
    --- a/shell/platform/glfw/client_wrapper/include/flutter/flutter_window_controller.h
    +++ b/shell/platform/glfw/client_wrapper/include/flutter/flutter_window_controller.h
    @@ -46,6 +46,7 @@ class FlutterWindowController {
       // Only one Flutter window can exist at a time; see constructor comment.
       bool CreateWindow(int width,
                         int height,
    +                    const std::string& title,
                         const std::string& assets_path,
                         const std::vector& arguments);
     
    @@ -63,6 +64,16 @@ class FlutterWindowController {
       // Defaults to off.
       void SetHoverEnabled(bool enabled);
     
    +  // Sets the displayed title of the window.
    +  void SetTitle(const std::string& title);
    +
    +  // Sets the displayed icon for the window.
    +  //
    +  // The pixel format is 32-bit RGBA. The provided image data only needs to be
    +  // valid for the duration of the call to this method. Pass a nullptr to revert
    +  // to the default icon.
    +  void SetIcon(uint8_t* pixel_data, int width, int height);
    +
       // Loops on Flutter window events until the window closes.
       void RunEventLoop();
     
    diff --git a/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.cc b/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.cc
    index f3a5e9a436469..db564018bc412 100644
    --- a/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.cc
    +++ b/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.cc
    @@ -50,14 +50,15 @@ void FlutterDesktopTerminate() {
     
     FlutterDesktopWindowRef FlutterDesktopCreateWindow(int initial_width,
                                                        int initial_height,
    +                                                   const char* title,
                                                        const char* assets_path,
                                                        const char* icu_data_path,
                                                        const char** arguments,
                                                        size_t argument_count) {
       if (s_stub_implementation) {
    -    return s_stub_implementation->CreateWindow(initial_width, initial_height,
    -                                               assets_path, icu_data_path,
    -                                               arguments, argument_count);
    +    return s_stub_implementation->CreateWindow(
    +        initial_width, initial_height, title, assets_path, icu_data_path,
    +        arguments, argument_count);
       }
       return nullptr;
     }
    @@ -69,6 +70,22 @@ void FlutterDesktopSetHoverEnabled(FlutterDesktopWindowRef flutter_window,
       }
     }
     
    +void FlutterDesktopSetWindowTitle(FlutterDesktopWindowRef flutter_window,
    +                                  const char* title) {
    +  if (s_stub_implementation) {
    +    s_stub_implementation->SetWindowTitle(title);
    +  }
    +}
    +
    +void FlutterDesktopSetWindowIcon(FlutterDesktopWindowRef flutter_window,
    +                                 uint8_t* pixel_data,
    +                                 int width,
    +                                 int height) {
    +  if (s_stub_implementation) {
    +    s_stub_implementation->SetWindowIcon(pixel_data, width, height);
    +  }
    +}
    +
     void FlutterDesktopRunWindowLoop(FlutterDesktopWindowRef flutter_window) {
       if (s_stub_implementation) {
         s_stub_implementation->RunWindowLoop();
    diff --git a/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.h b/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.h
    index 70f993646d3c0..95f2be2148d01 100644
    --- a/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.h
    +++ b/shell/platform/glfw/client_wrapper/testing/stub_flutter_glfw_api.h
    @@ -38,6 +38,7 @@ class StubFlutterGlfwApi {
       // Called for FlutterDesktopCreateWindow.
       virtual FlutterDesktopWindowRef CreateWindow(int initial_width,
                                                    int initial_height,
    +                                               const char* title,
                                                    const char* assets_path,
                                                    const char* icu_data_path,
                                                    const char** arguments,
    @@ -45,9 +46,15 @@ class StubFlutterGlfwApi {
         return nullptr;
       }
     
    -  // Called for FlutterDesktopSetHoverEnabled
    +  // Called for FlutterDesktopSetHoverEnabled.
       virtual void SetHoverEnabled(bool enabled) {}
     
    +  // Called for FlutterDesktopSetWindowTitle.
    +  virtual void SetWindowTitle(const char* title) {}
    +
    +  //  Called for FlutterDesktopSetWindowIcon.
    +  virtual void SetWindowIcon(uint8_t* pixel_data, int width, int height) {}
    +
       // Called for FlutterDesktopRunWindowLoop.
       virtual void RunWindowLoop() {}
     
    diff --git a/shell/platform/glfw/flutter_glfw.cc b/shell/platform/glfw/flutter_glfw.cc
    index 98e76f02c5ade..77a3d40e6a66b 100644
    --- a/shell/platform/glfw/flutter_glfw.cc
    +++ b/shell/platform/glfw/flutter_glfw.cc
    @@ -94,8 +94,6 @@ struct FlutterDesktopMessenger {
       shell::IncomingMessageDispatcher* dispatcher;
     };
     
    -static constexpr char kDefaultWindowTitle[] = "Flutter";
    -
     // Retrieves state bag for the window in question from the GLFWWindow.
     static FlutterDesktopWindowState* GetSavedWindowState(GLFWwindow* window) {
       return reinterpret_cast(
    @@ -473,6 +471,7 @@ void FlutterDesktopTerminate() {
     
     FlutterDesktopWindowRef FlutterDesktopCreateWindow(int initial_width,
                                                        int initial_height,
    +                                                   const char* title,
                                                        const char* assets_path,
                                                        const char* icu_data_path,
                                                        const char** arguments,
    @@ -481,8 +480,8 @@ FlutterDesktopWindowRef FlutterDesktopCreateWindow(int initial_width,
       gtk_init(0, nullptr);
     #endif
       // Create the window.
    -  auto window = glfwCreateWindow(initial_width, initial_height,
    -                                 kDefaultWindowTitle, NULL, NULL);
    +  auto window =
    +      glfwCreateWindow(initial_width, initial_height, title, NULL, NULL);
       if (window == nullptr) {
         return nullptr;
       }
    @@ -543,6 +542,21 @@ void FlutterDesktopSetHoverEnabled(FlutterDesktopWindowRef flutter_window,
       SetHoverCallbacksEnabled(flutter_window->window, enabled);
     }
     
    +void FlutterDesktopSetWindowTitle(FlutterDesktopWindowRef flutter_window,
    +                                  const char* title) {
    +  GLFWwindow* window = flutter_window->window;
    +  glfwSetWindowTitle(window, title);
    +}
    +
    +void FlutterDesktopSetWindowIcon(FlutterDesktopWindowRef flutter_window,
    +                                 uint8_t* pixel_data,
    +                                 int width,
    +                                 int height) {
    +  GLFWwindow* window = flutter_window->window;
    +  GLFWimage image = {width, height, static_cast(pixel_data)};
    +  glfwSetWindowIcon(window, pixel_data ? 1 : 0, &image);
    +}
    +
     void FlutterDesktopRunWindowLoop(FlutterDesktopWindowRef flutter_window) {
       GLFWwindow* window = flutter_window->window;
     #ifdef __linux__
    diff --git a/shell/platform/glfw/public/flutter_glfw.h b/shell/platform/glfw/public/flutter_glfw.h
    index c969581e161df..85dbe14325da1 100644
    --- a/shell/platform/glfw/public/flutter_glfw.h
    +++ b/shell/platform/glfw/public/flutter_glfw.h
    @@ -52,6 +52,7 @@ FLUTTER_EXPORT void FlutterDesktopTerminate();
     FLUTTER_EXPORT FlutterDesktopWindowRef
     FlutterDesktopCreateWindow(int initial_width,
                                int initial_height,
    +                           const char* title,
                                const char* assets_path,
                                const char* icu_data_path,
                                const char** arguments,
    @@ -66,6 +67,22 @@ FLUTTER_EXPORT void FlutterDesktopSetHoverEnabled(
         FlutterDesktopWindowRef flutter_window,
         bool enabled);
     
    +// Sets the displayed title for |flutter_window|.
    +FLUTTER_EXPORT void FlutterDesktopSetWindowTitle(
    +    FlutterDesktopWindowRef flutter_window,
    +    const char* title);
    +
    +// Sets the displayed icon for |flutter_window|.
    +//
    +// The pixel format is 32-bit RGBA. The provided image data only needs to be
    +// valid for the duration of the call to this method. Pass a nullptr to revert
    +// to the default icon.
    +FLUTTER_EXPORT void FlutterDesktopSetWindowIcon(
    +    FlutterDesktopWindowRef flutter_window,
    +    uint8_t* pixel_data,
    +    int width,
    +    int height);
    +
     // Loops on Flutter window events until the window is closed.
     //
     // Once this function returns, FlutterDesktopWindowRef is no longer valid, and
    
    From 219bf5938752e0030b491565af1910c137b83dd8 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Thu, 4 Apr 2019 15:17:51 -0400
    Subject: [PATCH 0698/1117] Roll src/third_party/skia
     1383a38e1d92..e4628b10722f (12 commits) (#8443)
    
    https://skia.googlesource.com/skia.git/%2Blog/1383a38e1d92..e4628b10722f
    
    git log 1383a38e1d92fb70d94185b454daa6c1afecc6a0..e4628b10722f09adfb49943a43b9668fb9a02723 --date=short --no-merges --format=%ad %ae %s
    2019-04-03 malaykeshav@chromium.org Make SkRRect work with axis aligned rotation transforms
    2019-04-04 kjlubick@google.com [canvaskit] Bump GPU resource cache to 256MB
    2019-04-04 bsalomon@google.com Handle promise texture image fulfill returning nullptr.
    2019-04-04 fmalita@chromium.org Revert "[canvaskit] Bump GPU resource cache to 256MB"
    2019-04-04 fmalita@chromium.org [skottie] Fix gradient ramp interaction with non-atomic draws
    2019-04-04 robertphillips@google.com Blacklist two more GMs for gltestthreading
    2019-04-04 ethannicholas@google.com fixed skslc crash when the last token in a file is invalid
    2019-04-04 bsalomon@google.com Avoid flushing due to cache pressure when nothing will become purgeable.
    2019-04-03 egdaniel@google.com Batch up pipelineBarrier calls in vulkan.
    2019-04-04 fmalita@chromium.org [canvaskit] Bump GPU resource cache to 256MB
    2019-04-02 halcanary@google.com Examples: compile faster
    2019-04-04 reed@google.com Reland "rely on clients to opt in to legacy enums"
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 48ee95aa54ede..21a08da80b333 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': '1383a38e1d92fb70d94185b454daa6c1afecc6a0',
    +  'skia_revision': 'e4628b10722f09adfb49943a43b9668fb9a02723',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index c5a29efdee81f..91492d271168d 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: ac694f519e0c290649e1f013c837ee67
    +Signature: 80674cf6dbe928ef708c6790cf83b6bd
     
     UNUSED LICENSES:
     
    
    From 694fc5677e681437c2297a39418d0e769228656b Mon Sep 17 00:00:00 2001
    From: liyuqian 
    Date: Thu, 4 Apr 2019 13:19:35 -0700
    Subject: [PATCH 0699/1117] Build windows engine on GCE (#8442)
    
    This allows us to test windows engine compilation in presubmit checks using our own 32-CPU GCE instance for less than 10 minutes.
    ---
     .cirrus.yml | 60 +++++++++++++++++++++++++++++++----------------------
     1 file changed, 35 insertions(+), 25 deletions(-)
    
    diff --git a/.cirrus.yml b/.cirrus.yml
    index cc6796b3faf69..136c255a6e936 100644
    --- a/.cirrus.yml
    +++ b/.cirrus.yml
    @@ -1,14 +1,13 @@
     gcp_credentials: ENCRYPTED[987a78af29b91ce8489594c9ab3fec21845bbe5ba68294b8f6def3cf0d380830f06687a89ea69c87344c5ade369700fe]
     
    -gke_container:
    - image: gcr.io/flutter-cirrus/build-engine-image:latest
    - cluster_name: build-32-cluster
    - zone: us-central1-a
    - namespace: default
    - cpu: 30 # can't use all 30-cores; system pods needs cores too
    - memory: 100Gb # similarly, can't use all 100Gb memory
    -
     task:
    +  gke_container:
    +   image: gcr.io/flutter-cirrus/build-engine-image:latest
    +   cluster_name: build-32-cluster
    +   zone: us-central1-a
    +   namespace: default
    +   cpu: 30 # can't use all 30-cores; system pods needs cores too
    +   memory: 100Gb # similarly, can't use all 100Gb memory
       env:
         CIRRUS_WORKING_DIR: "/tmp/github_repo"
         ENGINE_PATH: "/tmp/clean_engine"
    @@ -59,25 +58,36 @@ task:
             ninja -C out/android_debug_unopt
             mkdir javadoc_tmp
             ./flutter/tools/gen_javadoc.py --out-dir javadoc_tmp
    +    - name: format_and_dart_test
    +      format_script: cd $ENGINE_PATH/src/flutter && ./ci/format.sh
    +      build_script: cd $ENGINE_PATH/src/flutter && ./ci/build.sh
     
    -format_and_dart_test_task:
    -  container:
    -    image: gcr.io/flutter-cirrus/build-engine-image:latest
    +build_windows_task:
    +  gce_instance:
    +    image_project: flutter-cirrus
    +    image_name: flutter-engine-windows-server-2016-core
    +    zone: us-central1-a
    +    platform: windows
    +    cpu: 32
    +    memory: 32Gb
    +    disk: 50
     
       env:
    -    CIRRUS_WORKING_DIR: "/tmp/github_repo"
    -    DEPOT_TOOLS: "/tmp/depot_tools"
    -    ENGINE_PATH: "/tmp/clean_engine"
    -    PATH: "$DEPOT_TOOLS:$PATH"
    -  depot_tools_script:
    -    git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS
    +    # Cirrus is somehow not picking up the environment variables set in the VM image.
    +    PATH: "c:/depot_tools;c:/MinGit/cmd;$PATH"
    +    DEPOT_TOOLS_WIN_TOOLCHAIN: 0
    +    GYP_MSVS_OVERRIDE_PATH: "c:/Program Files (x86)/Microsoft Visual Studio/2017/Community"
    +
    +    ENGINE_PATH: "c:/flutter/engine"
    +
    +  # robocopy can return 1 for successful copy; suppress its error code.
    +  # move somehow doesn't work as it complains that the file is being used by another process.
       gclient_sync_script: |
    -    mkdir -p $ENGINE_PATH/src
    -    echo 'solutions = [{"managed": False,"name": "src/flutter","url": "git@github.com:flutter/engine.git","deps_file": "DEPS", "custom_vars": {"download_android_deps" : False, "download_windows_deps" : False,},},]' > $ENGINE_PATH/.gclient
    -    cd $ENGINE_PATH/src
    -    rm -rf flutter
    -    rm -rf out
    -    mv $CIRRUS_WORKING_DIR flutter
    +    robocopy %CIRRUS_WORKING_DIR% %ENGINE_PATH%/src/flutter /MIR || (cmd /s /c exit /b 0)
    +    cd %ENGINE_PATH%/src
         gclient sync
    -  format_script: cd $ENGINE_PATH/src/flutter && ./ci/format.sh
    -  build_script: cd $ENGINE_PATH/src/flutter && ./ci/build.sh
    +  # Currently there's a problem with `flutter/tools/gn --unoptimized` so we omit --unoptimized for now
    +  compile_host_script: |
    +    cd %ENGINE_PATH%/src
    +    python flutter/tools/gn
    +    ninja -C out/host_debug
    
    From 5460926c06d6088803e4edeaad190e272212540d Mon Sep 17 00:00:00 2001
    From: Ben Konyi 
    Date: Thu, 4 Apr 2019 13:24:49 -0700
    Subject: [PATCH 0700/1117] Roll src/third_party/dart 9814cb1b9c..896f1c4bb9 (4
     commits)
    
    896f1c4bb9 CFE tests for issue 36400
    a112b11e2e [gardening] Disable dwarf_stack_trace_test on product mode because symbols can be wrong
    313e0f5410 [CFE] Check if set element or map key overrides operator '=='.
    e58a8fade5 Fix typos in the diagnostic messages
    ---
     DEPS | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/DEPS b/DEPS
    index 21a08da80b333..fb761a18fe4f6 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -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': '9814cb1b9c782b4fa9b7ea05dee5942577410478',
    +  'dart_revision': '896f1c4bb94a390c2969953626980d9de320cd84',
     
       # WARNING: DO NOT EDIT MANUALLY
       # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
    
    From 06cab8171e995ba2b326921d328deff373c856e3 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Thu, 4 Apr 2019 18:46:54 -0400
    Subject: [PATCH 0701/1117] Roll src/third_party/skia
     e4628b10722f..51874e3e3712 (2 commits) (#8445)
    
    https://skia.googlesource.com/skia.git/%2Blog/e4628b10722f..51874e3e3712
    
    git log e4628b10722f09adfb49943a43b9668fb9a02723..51874e3e371230e2cc02912ed0c9ddb569e48532 --date=short --no-merges --format=%ad %ae %s
    2019-04-04 bungeman@google.com Allow selection of shaper wrapping algorithm.
    2019-04-04 halcanary@google.com SkPDF: Use fewer complex PathOps to speed up clipping
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index fb761a18fe4f6..407d8f331abaa 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': 'e4628b10722f09adfb49943a43b9668fb9a02723',
    +  'skia_revision': '51874e3e371230e2cc02912ed0c9ddb569e48532',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 91492d271168d..feb7271ce3461 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 80674cf6dbe928ef708c6790cf83b6bd
    +Signature: 71fc8d0d1ecce72de33ca2aa449ab4a7
     
     UNUSED LICENSES:
     
    
    From 8b74cba20bb878d1e75747200f75dfaff5925bda Mon Sep 17 00:00:00 2001
    From: xster 
    Date: Thu, 4 Apr 2019 16:22:37 -0700
    Subject: [PATCH 0702/1117] Make sure FlutterViewController flushs all pending
     touches when no longer active (#8400)
    
    ---
     .../framework/Source/FlutterViewController.mm | 59 +++++++++++++++++++
     1 file changed, 59 insertions(+)
    
    diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm
    index 076e3bec3402b..9bcbcff388a47 100644
    --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm
    +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm
    @@ -39,6 +39,7 @@ @implementation FlutterViewController {
       BOOL _initialized;
       BOOL _viewOpaque;
       BOOL _engineNeedsLaunch;
    +  NSMutableSet* _ongoingTouches;
     }
     
     #pragma mark - Manage and override all designated initializers
    @@ -54,6 +55,7 @@ - (instancetype)initWithEngine:(FlutterEngine*)engine
         _engineNeedsLaunch = NO;
         _flutterView.reset([[FlutterView alloc] initWithDelegate:_engine opaque:self.isViewOpaque]);
         _weakFactory = std::make_unique>(self);
    +    _ongoingTouches = [[NSMutableSet alloc] init];
     
         [self performCommonViewControllerInitialization];
         [engine setViewController:self];
    @@ -75,6 +77,7 @@ - (instancetype)initWithProject:(FlutterDartProject*)projectOrNil
         _flutterView.reset([[FlutterView alloc] initWithDelegate:_engine opaque:self.isViewOpaque]);
         [_engine.get() createShell:nil libraryURI:nil];
         _engineNeedsLaunch = YES;
    +    _ongoingTouches = [[NSMutableSet alloc] init];
         [self loadDefaultSplashScreenView];
         [self performCommonViewControllerInitialization];
       }
    @@ -427,9 +430,44 @@ - (void)viewDidDisappear:(BOOL)animated {
       TRACE_EVENT0("flutter", "viewDidDisappear");
       [self surfaceUpdated:NO];
       [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.paused"];
    +  [self flushOngoingTouches];
    +
       [super viewDidDisappear:animated];
     }
     
    +- (void)flushOngoingTouches {
    +  if (_ongoingTouches.count > 0) {
    +    auto packet = std::make_unique(_ongoingTouches.count);
    +    size_t pointer_index = 0;
    +    // If the view controller is going away, we want to flush cancel all the ongoing
    +    // touches to the framework so nothing gets orphaned.
    +    for (NSNumber* device in _ongoingTouches) {
    +      // Create fake PointerData to balance out each previously started one for the framework.
    +      blink::PointerData pointer_data;
    +      pointer_data.Clear();
    +
    +      constexpr int kMicrosecondsPerSecond = 1000 * 1000;
    +      // Use current time.
    +      pointer_data.time_stamp = [[NSDate date] timeIntervalSince1970] * kMicrosecondsPerSecond;
    +
    +      pointer_data.change = blink::PointerData::Change::kCancel;
    +      pointer_data.kind = blink::PointerData::DeviceKind::kTouch;
    +      pointer_data.device = device.longLongValue;
    +
    +      // Anything we put here will be arbitrary since there are no touches.
    +      pointer_data.physical_x = 0;
    +      pointer_data.physical_y = 0;
    +      pointer_data.pressure = 1.0;
    +      pointer_data.pressure_max = 1.0;
    +
    +      packet->SetPointerData(pointer_index++, pointer_data);
    +    }
    +
    +    [_ongoingTouches removeAllObjects];
    +    [_engine.get() dispatchPointerDataPacket:std::move(packet)];
    +  }
    +}
    +
     - (void)dealloc {
       [_engine.get() notifyViewControllerDeallocated];
       [[NSNotificationCenter defaultCenter] removeObserver:self];
    @@ -528,6 +566,27 @@ - (void)dispatchTouches:(NSSet*)touches
         pointer_data.physical_x = windowCoordinates.x * scale;
         pointer_data.physical_y = windowCoordinates.y * scale;
     
    +    NSNumber* deviceKey = [NSNumber numberWithLongLong:pointer_data.device];
    +    // Track touches that began and not yet stopped so we can flush them
    +    // if the view controller goes away.
    +    switch (pointer_data.change) {
    +      case blink::PointerData::Change::kDown:
    +        [_ongoingTouches addObject:deviceKey];
    +        break;
    +      case blink::PointerData::Change::kCancel:
    +      case blink::PointerData::Change::kUp:
    +        [_ongoingTouches removeObject:deviceKey];
    +        break;
    +      case blink::PointerData::Change::kHover:
    +      case blink::PointerData::Change::kMove:
    +        // We're only tracking starts and stops.
    +        break;
    +      case blink::PointerData::Change::kAdd:
    +      case blink::PointerData::Change::kRemove:
    +        // We don't use kAdd/kRemove.
    +        break;
    +    }
    +
         // pressure_min is always 0.0
         if (@available(iOS 9, *)) {
           // These properties were introduced in iOS 9.0.
    
    From 697e541a8d9475b504a2bd6f335b4f004775adf3 Mon Sep 17 00:00:00 2001
    From: liyuqian 
    Date: Thu, 4 Apr 2019 17:28:03 -0700
    Subject: [PATCH 0703/1117] Add scripts that prepares our windows VM image
     (#8446)
    
    Have this script reviewed and committed to our repo for our future reference.
    
    This prepares the VM used in https://github.com/flutter/engine/pull/8442
    
    Once our Docker container is tested in GKE (after Kubernetes 1.14 is ready), I'll also upload Dockefiles and its related scripts here.
    ---
     ci/docker/windows_build/README.md             |  8 +++
     .../prepare_windows_server_2016_core.ps1      | 53 +++++++++++++++++++
     2 files changed, 61 insertions(+)
     create mode 100644 ci/docker/windows_build/README.md
     create mode 100644 ci/docker/windows_build/prepare_windows_server_2016_core.ps1
    
    diff --git a/ci/docker/windows_build/README.md b/ci/docker/windows_build/README.md
    new file mode 100644
    index 0000000000000..30298defa3166
    --- /dev/null
    +++ b/ci/docker/windows_build/README.md
    @@ -0,0 +1,8 @@
    +This directory should include scripts to build the docker container image used
    +for building flutter/engine in our CI system (currently [Cirrus](cirrus-ci.org))
    +using Windows.
    +
    +So far we're still waiting GKE to have Kubernetes 1.14 and Windows containers.
    +
    +Before that, we use GCE Windows VMs for our CI tests. This directory includes
    +scripts for preparing that VM.
    diff --git a/ci/docker/windows_build/prepare_windows_server_2016_core.ps1 b/ci/docker/windows_build/prepare_windows_server_2016_core.ps1
    new file mode 100644
    index 0000000000000..9b2f6ff2d307a
    --- /dev/null
    +++ b/ci/docker/windows_build/prepare_windows_server_2016_core.ps1
    @@ -0,0 +1,53 @@
    +# The following powershell script prepares the VM image
    +# flutter-engine-windows-server-2016-core used by Flutter engine's
    +# build_windows presubmit tests (see .cirrus.yml).
    +#
    +# The exact step of generating the VM image is:
    +# 1. Create a "Windows Server 2016 Datacenter Core" GCE instance with 50GB disk
    +# 2. RDP into that GCE instance to run this script with powershell
    +#    (e.g., `powershell -File prepare_windows_server_2016_core.ps1`)
    +# 3. Shutdown the instance and take an image of that instance
    +#
    +# Note that ` is the escape character in powershell.
    +
    +# Install visual studio 2017
    +curl https://aka.ms/vs/15/release/vs_community.exe -o vs_community.exe
    +./vs_community.exe --passive --wait `
    +    --add Microsoft.VisualStudio.Workload.NativeCrossPlat `
    +    --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended
    +
    +# Install debugger tools
    +curl https://download.microsoft.com/download/5/C/3/5C3770A3-12B4-4DB4-BAE7-99C624EB32AD/windowssdk/winsdksetup.exe `
    +    -o winsdksetup.exe
    +./winsdksetup.exe /features OptionId.WindowsDesktopDebuggers /q
    +
    +# Download depot tools
    +curl https://storage.googleapis.com/chrome-infra/depot_tools.zip `
    +    -o depot_tools.zip
    +Expand-Archive -LiteralPath depot_tools.zip -DestinationPath c:/depot_tools
    +
    +# Download git. Although depot_tools has its own git.bat, this is needed for
    +# Flutter engine's gn to run correctly.
    +#
    +# Somehow, curl can't get the MinGit from github. Fortunately, taobo works.
    +curl https://npm.taobao.org/mirrors/git-for-windows/v2.21.0.windows.1/MinGit-2.21.0-64-bit.zip `
    +    -o MinGit.zip
    +Expand-Archive -LiteralPath MinGit.zip -DestinationPath c:/MinGit
    +
    +# Restarting the terminal (or even the whole VM) is required to let following
    +# environment variables to take effect.
    +setx path "c:/depot_tools/;c:/MinGit/cmd;${env:path}"
    +setx DEPOT_TOOLS_WIN_TOOLCHAIN 0
    +setx GYP_MSVS_OVERRIDE_PATH "c:/Program Files (x86)/Microsoft Visual Studio/2017/Community"
    +
    +mkdir c:/flutter/engine
    +curl https://raw.githubusercontent.com/flutter/engine/master/ci/docker/build/engine_gclient `
    +    -o c:/flutter/engine/.gclient
    +
    +# Once all the environment variables above are loaded correctly, one may test
    +# build the engine by:
    +#   cd c:/flutter/engine
    +#   gclient sync
    +#   cd src
    +#   python flutter/tools/gn
    +#   ninja -C out/host_debug
    
    From 3c3b26b55c1682cbf58a712d102c66dca53f93e4 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Thu, 4 Apr 2019 22:13:54 -0400
    Subject: [PATCH 0704/1117] Roll src/third_party/skia
     51874e3e3712..b0ababfe5ad2 (1 commits) (#8449)
    
    https://skia.googlesource.com/skia.git/%2Blog/51874e3e3712..b0ababfe5ad2
    
    git log 51874e3e371230e2cc02912ed0c9ddb569e48532..b0ababfe5ad2bddf4b900991cbc5ba8e6c9040b4 --date=short --no-merges --format=%ad %ae %s
    2019-04-04 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 407d8f331abaa..93082e41ca471 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': '51874e3e371230e2cc02912ed0c9ddb569e48532',
    +  'skia_revision': 'b0ababfe5ad2bddf4b900991cbc5ba8e6c9040b4',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index feb7271ce3461..3c8cfd103ba04 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 71fc8d0d1ecce72de33ca2aa449ab4a7
    +Signature: 95ea5cf5394065d98bb6333e68d495bf
     
     UNUSED LICENSES:
     
    
    From d6d45da07e14e14f38b8e220080860ae1c12c87b Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Fri, 5 Apr 2019 01:42:54 -0400
    Subject: [PATCH 0705/1117] Roll src/third_party/skia
     b0ababfe5ad2..1f58a8e457ba (3 commits) (#8450)
    
    https://skia.googlesource.com/skia.git/%2Blog/b0ababfe5ad2..1f58a8e457ba
    
    git log b0ababfe5ad2bddf4b900991cbc5ba8e6c9040b4..1f58a8e457baef95ebf081d673859410e6e6c635 --date=short --no-merges --format=%ad %ae %s
    2019-04-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 43997017b0ed..fb201c5e208d (6 commits)
    2019-04-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 3ae962179e68..3e2882be2dde (447 commits)
    2019-04-05 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 225a13016b1c..0e3d328ac338 (5 commits)
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 93082e41ca471..ceda203b0df7b 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': 'b0ababfe5ad2bddf4b900991cbc5ba8e6c9040b4',
    +  'skia_revision': '1f58a8e457baef95ebf081d673859410e6e6c635',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 3c8cfd103ba04..290b59d35ada6 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 95ea5cf5394065d98bb6333e68d495bf
    +Signature: 66f8a6b16b828c1f1ddaf6792d44db3e
     
     UNUSED LICENSES:
     
    
    From 754453df3fd22c46323e676a35a6d88cea8e88b9 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Fri, 5 Apr 2019 05:12:55 -0400
    Subject: [PATCH 0706/1117] Roll src/third_party/skia
     1f58a8e457ba..604d5a3fca01 (1 commits) (#8451)
    
    https://skia.googlesource.com/skia.git/%2Blog/1f58a8e457ba..604d5a3fca01
    
    git log 1f58a8e457baef95ebf081d673859410e6e6c635..604d5a3fca0166c1a4da3f199668e641b2ce8945 --date=short --no-merges --format=%ad %ae %s
    2019-04-05 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index ceda203b0df7b..290d6551e447a 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': '1f58a8e457baef95ebf081d673859410e6e6c635',
    +  'skia_revision': '604d5a3fca0166c1a4da3f199668e641b2ce8945',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 290b59d35ada6..5b58d85920b84 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 66f8a6b16b828c1f1ddaf6792d44db3e
    +Signature: 74db28f9254a5665451a226b48976477
     
     UNUSED LICENSES:
     
    
    From 9c4c043aee7bcb9e43fdde19587543a5929c5e5a Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Fri, 5 Apr 2019 08:54:55 -0400
    Subject: [PATCH 0707/1117] Roll src/third_party/skia
     604d5a3fca01..558637996569 (1 commits) (#8452)
    
    https://skia.googlesource.com/skia.git/%2Blog/604d5a3fca01..558637996569
    
    git log 604d5a3fca0166c1a4da3f199668e641b2ce8945..558637996569eb53c18ffd7f8ca553bc5d1f4a6a --date=short --no-merges --format=%ad %ae %s
    2019-04-04 robertphillips@google.com Disable the TextureStripAtlasManagerColorFilterTest on MoltenVK
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index 290d6551e447a..b105d9b68c60c 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': '604d5a3fca0166c1a4da3f199668e641b2ce8945',
    +  'skia_revision': '558637996569eb53c18ffd7f8ca553bc5d1f4a6a',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index 5b58d85920b84..f060ae304d0a2 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 74db28f9254a5665451a226b48976477
    +Signature: 475c95a413e3d4d3b0923ab77b854158
     
     UNUSED LICENSES:
     
    
    From 7e79b1f03db04a70509a207d5a0ce2de498f9aba Mon Sep 17 00:00:00 2001
    From: Ben Konyi 
    Date: Fri, 5 Apr 2019 07:03:56 -0700
    Subject: [PATCH 0708/1117] Roll src/third_party/dart 896f1c4bb9..a2709992a2
     (25 commits)
    
    a2709992a2 [vm] Support optcounter=1 and randomize it for testing.
    4958a4e782 [vm] Adds a --help flag to vm/lib/kernel_front_end.dart (and by extension gen_kernel).
    b700223542 [cfe] Do not reset the VM async name generator
    245576a096 Update dart_style to 1.2.6.
    38dbddc90d [vm/bytecode] Add AllocateClosure bytecode
    a38dbf8575 update ChangeBuilder to lazily build the source change
    b45c67a933 [vm] improve vm help messages
    5a5b58db7e Reland "[vm] Allow running with the latest ABI dill files."
    2415c08373 Add Dartdoc template info to the status pages
    4ff8846d79 associate CONVERT_TO_SPREAD assist w/ `spread_collections` lint
    7e28fc2cd6 Increment Analysis Server version to 1.26.0
    4fa79e9ded Remove comments from the token stream
    3d6e29d251 set empty environment defines to CompilerOptions
    afe609d2c2 Update NNBD migration to add import as necessary
    e4fa8904f8 Fix the windows bot
    ddbeda075f Rework storing constructors and enum constants.
    fd9e32df56 Reland "Spawn isolates using platform kernel when using old ABIs"
    652a8be7a7 [Tests] Fix inifinite replication of Dart processes in tests
    69ff056b51 Revert "[vm] Allow running with the latest ABI dill files."
    a0e82ba23e [gardening] Disable exception caused by missing core dumps on windows
    2a8117c341 Revert "Spawn isolates using platform kernel when using old ABIs"
    5e8b0b7a97 [dart/fuzzer] Fuzz support for spread and control flow collections
    c3113b0818 Spawn isolates using platform kernel when using old ABIs
    35c4af445b [vm] Allow running with the latest ABI dill files.
    7e5810ab30 Add an offset to the protocol used for import-on-paste
    ---
     DEPS                                    | 4 ++--
     ci/licenses_golden/licenses_third_party | 2 +-
     2 files changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index b105d9b68c60c..cd4c9188b7b7b 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -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': '896f1c4bb94a390c2969953626980d9de320cd84',
    +  'dart_revision': 'a2709992a2b61705a1035f53b26c40828edd29f9',
     
       # WARNING: DO NOT EDIT MANUALLY
       # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
    @@ -48,7 +48,7 @@ vars = {
       'dart_crypto_tag': '2.0.6',
       'dart_csslib_tag': '0.14.4+1',
       'dart_dart2js_info_tag': '0.6.0',
    -  'dart_dart_style_tag': '1.2.5',
    +  'dart_dart_style_tag': '1.2.6',
       'dart_dartdoc_tag': 'v0.28.2',
       'dart_fixnum_tag': '0.10.9',
       'dart_glob_tag': '1.1.7',
    diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party
    index 15d5586afc9eb..e8ca9564ad9f5 100644
    --- a/ci/licenses_golden/licenses_third_party
    +++ b/ci/licenses_golden/licenses_third_party
    @@ -1,4 +1,4 @@
    -Signature: 09835d48c2532bcddee117fcf30aa73a
    +Signature: cbf8e245ca4d75c5fd125ab57b6b730e
     
     UNUSED LICENSES:
     
    
    From 2fe4439178f3e09ddaa4d016688691a1adc65ed6 Mon Sep 17 00:00:00 2001
    From: skia-flutter-autoroll 
    Date: Fri, 5 Apr 2019 12:44:26 -0400
    Subject: [PATCH 0709/1117] Roll src/third_party/skia
     558637996569..0e35ce27e0e9 (11 commits) (#8454)
    
    https://skia.googlesource.com/skia.git/%2Blog/558637996569..0e35ce27e0e9
    
    git log 558637996569eb53c18ffd7f8ca553bc5d1f4a6a..0e35ce27e0e933bdca908d8d772ef156ee6cbbb2 --date=short --no-merges --format=%ad %ae %s
    2019-04-05 robertphillips@google.com Favor full screen clears for platforms that desire initialized memory
    2019-04-05 reed@google.com Revert "Move localmatrix routines to shaderbase, no need to be public."
    2019-02-19 herb@google.com Use canonical colors for luminance color
    2019-04-04 reed@google.com Move localmatrix routines to shaderbase, no need to be public.
    2019-04-05 robertphillips@google.com checkCommandBuffers when skipping a submit in submitCommandBuffer
    2019-03-18 mtklein@google.com lift main-thread limit on iOS bots
    2019-04-05 nigeltao@google.com Rewrite some SkWuffsCodec designated initializers
    2019-04-05 brianosman@google.com Use GrGLenum consistently for cached program binaryFormat
    2019-04-04 jvanverth@google.com Some more Metal memory fixes.
    2019-04-04 jvanverth@google.com Add mm files to cmake sources
    2019-04-05 robertphillips@google.com Stop using pendingIO in read/writeSurfacePixels (take 2)
    
    The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
    
    If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop
    the roller if necessary.
    ---
     DEPS                             | 2 +-
     ci/licenses_golden/licenses_skia | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/DEPS b/DEPS
    index cd4c9188b7b7b..923f450792407 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': '558637996569eb53c18ffd7f8ca553bc5d1f4a6a',
    +  'skia_revision': '0e35ce27e0e933bdca908d8d772ef156ee6cbbb2',
     
       # When updating the Dart revision, ensure that all entries that are
       # dependencies of Dart are also updated to match the entries in the
    diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia
    index f060ae304d0a2..d2151b7b5f274 100644
    --- a/ci/licenses_golden/licenses_skia
    +++ b/ci/licenses_golden/licenses_skia
    @@ -1,4 +1,4 @@
    -Signature: 475c95a413e3d4d3b0923ab77b854158
    +Signature: cf6c48b736d4219c0e182b4de96f1336
     
     UNUSED LICENSES:
     
    
    From 1854b8571f2508ee35e59b654b46b300acddccd5 Mon Sep 17 00:00:00 2001
    From: Ben Konyi 
    Date: Fri, 5 Apr 2019 09:54:50 -0700
    Subject: [PATCH 0710/1117] Roll src/third_party/dart a2709992a2..907c514c89 (1
     commits)
    
    907c514c89 [SDK] Adds build targets, wrappers and SDK builds for Dart AOT.
    ---
     DEPS | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/DEPS b/DEPS
    index 923f450792407..0de4938fab7ab 100644
    --- a/DEPS
    +++ b/DEPS
    @@ -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': 'a2709992a2b61705a1035f53b26c40828edd29f9',
    +  'dart_revision': '907c514c8937cf76e825d427364cf3475797f18f',
     
       # WARNING: DO NOT EDIT MANUALLY
       # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
    
    From 08a1335088543b250bc1517927fd9c068d9424ce Mon Sep 17 00:00:00 2001
    From: liyuqian 
    Date: Fri, 5 Apr 2019 11:01:27 -0700
    Subject: [PATCH 0711/1117] More detailed comments for engine build windows VM
     (#8456)
    
    To make it clearer what the next step is after the script run.
    ---
     .../prepare_windows_server_2016_core.ps1        | 17 ++++++++++++++++-
     1 file changed, 16 insertions(+), 1 deletion(-)
    
    diff --git a/ci/docker/windows_build/prepare_windows_server_2016_core.ps1 b/ci/docker/windows_build/prepare_windows_server_2016_core.ps1
    index 9b2f6ff2d307a..f11c1b7a53e37 100644
    --- a/ci/docker/windows_build/prepare_windows_server_2016_core.ps1
    +++ b/ci/docker/windows_build/prepare_windows_server_2016_core.ps1
    @@ -44,7 +44,22 @@ mkdir c:/flutter/engine
     curl https://raw.githubusercontent.com/flutter/engine/master/ci/docker/build/engine_gclient `
         -o c:/flutter/engine/.gclient
     
    -# Once all the environment variables above are loaded correctly, one may test
    +# Once the above script finishes successfully, one can make an image of the VM
    +# for the CI test.
    +#
    +# For sanity check, one can also test the VM to make sure that Flutter engine
    +# can be built in that VM. (The test is optional and our current image is made
    +# before doing these tests. We only did a reboot before making that image to
    +# ensure environment variables are loaded. However, Cirrus CI seems to have
    +# problems reading those environment variables so we ended up setting them in
    +# ".cirrus.yml" manually.)
    +#
    +# To test, first reboot of the terminal (or VM) to ensure that environment
    +# variables "path", "DEPOT_TOOLS_WIN_TOOLCHAIN", and "GYP_MSVS_OVERRIDE_PATH"
    +# are set. (Those environment variables are not needed for Cirrus CI as Cirrus
    +# sets those environment variables by itself.)
    +#
    +# After all the environment variables above are loaded correctly, one may test
     # build the engine by:
     #   cd c:/flutter/engine
     #   gclient sync
    
    From 6bc33b5e144254ceab274298dd61d9d9ed0dcc8f Mon Sep 17 00:00:00 2001
    From: Matt Carroll 
    Date: Fri, 5 Apr 2019 13:04:17 -0700
    Subject: [PATCH 0712/1117] Android Embedding PR24: Allow FlutterActivity to
     provide an engine, also adjust FlutterFragment timing to avoid Activity
     launch lag. (#8448)
    
    ---
     .../embedding/android/FlutterActivity.java    |  29 +++-
     .../embedding/android/FlutterFragment.java    | 128 ++++++++++++------
     2 files changed, 113 insertions(+), 44 deletions(-)
    
    diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java b/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java
    index 2ce499870053c..ad6bacb0c936c 100644
    --- a/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java
    +++ b/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java
    @@ -15,6 +15,7 @@
     import android.support.annotation.Nullable;
     import android.support.v4.app.FragmentActivity;
     import android.support.v4.app.FragmentManager;
    +import android.util.Log;
     import android.view.View;
     import android.view.ViewGroup;
     import android.view.Window;
    @@ -81,14 +82,35 @@ public class FlutterActivity extends FragmentActivity {
       private static final int FRAGMENT_CONTAINER_ID = 609893468; // random number
       private FlutterFragment flutterFragment;
     
    +  /**
    +   * Creates an {@link Intent} that launches a {@code FlutterActivity}, which executes
    +   * a {@code main()} Dart entrypoint, and displays the "/" route as Flutter's initial route.
    +   */
    +  public static Intent createDefaultIntent(@NonNull Context launchContext) {
    +    return createBuilder().build(launchContext);
    +  }
    +
    +  /**
    +   * Creates an {@link IntentBuilder}, which can be used to configure an {@link Intent} to
    +   * launch a {@code FlutterActivity}.
    +   */
    +  public static IntentBuilder createBuilder() {
    +    return new IntentBuilder(FlutterActivity.class);
    +  }
    +
       /**
        * Builder to create an {@code Intent} that launches a {@code FlutterActivity} with the
        * desired configuration.
        */
       public static class IntentBuilder {
    +    private final Class activityClass;
         private String dartEntrypoint = DEFAULT_DART_ENTRYPOINT;
         private String initialRoute = DEFAULT_INITIAL_ROUTE;
     
    +    protected IntentBuilder(@NonNull Class activityClass) {
    +      this.activityClass = activityClass;
    +    }
    +
         /**
          * The name of the initial Dart method to invoke, defaults to "main".
          */
    @@ -108,9 +130,13 @@ public IntentBuilder initialRoute(@NonNull String initialRoute) {
           return this;
         }
     
    +    /**
    +     * Creates and returns an {@link Intent} that will launch a {@code FlutterActivity} with
    +     * the desired configuration.
    +     */
         @NonNull
         public Intent build(@NonNull Context context) {
    -      return new Intent(context, FlutterActivity.class)
    +      return new Intent(context, activityClass)
               .putExtra(EXTRA_DART_ENTRYPOINT, dartEntrypoint)
               .putExtra(EXTRA_INITIAL_ROUTE, initialRoute);
         }
    @@ -118,6 +144,7 @@ public Intent build(@NonNull Context context) {
     
       @Override
       public void onCreate(Bundle savedInstanceState) {
    +    Log.d(TAG, "onCreate()");
         super.onCreate(savedInstanceState);
         setContentView(createFragmentContainer());
         configureStatusBarForFullscreenFlutterExperience();
    diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java
    index 771928f866ed7..a3115a691801b 100644
    --- a/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java
    +++ b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java
    @@ -8,9 +8,11 @@
     import android.content.Intent;
     import android.os.Build;
     import android.os.Bundle;
    +import android.os.Handler;
     import android.support.annotation.NonNull;
     import android.support.annotation.Nullable;
     import android.support.v4.app.Fragment;
    +import android.support.v4.app.FragmentActivity;
     import android.util.Log;
     import android.view.LayoutInflater;
     import android.view.View;
    @@ -206,6 +208,7 @@ protected static Bundle createArgsBundle(@Nullable String dartEntrypoint,
     
       @Nullable
       private FlutterEngine flutterEngine;
    +  private boolean isFlutterEngineFromActivity;
       @Nullable
       private FlutterView flutterView;
       @Nullable
    @@ -217,6 +220,10 @@ public FlutterFragment() {
         setArguments(new Bundle());
       }
     
    +  public void prepareForNavigation() {
    +    flutterView.setAlpha(0.0f);
    +  }
    +
       /**
        * The {@link FlutterEngine} that backs the Flutter content presented by this {@code Fragment}.
        *
    @@ -236,7 +243,7 @@ public void onAttach(Context context) {
         // When "retain instance" is true, the FlutterEngine will survive configuration
         // changes. Therefore, we create a new one only if one does not already exist.
         if (flutterEngine == null) {
    -      createFlutterEngine();
    +      setupFlutterEngine();
         }
     
         // Regardless of whether or not a FlutterEngine already existed, the PlatformPlugin
    @@ -258,55 +265,63 @@ private void initializeFlutter(@NonNull Context context) {
       }
     
       /**
    -   * Creates a new FlutterEngine instance.
    -   *
    -   * Subclasses can instantiate their own {@link FlutterEngine} by overriding
    -   * {@link #onCreateFlutterEngine(Context)}.
    -   *
    -   * Subclasses can alter the {@link FlutterEngine} after creation by overriding
    -   * {@link #onFlutterEngineCreated(FlutterEngine)}.
    -   */
    -  private void createFlutterEngine() {
    -    // Create a FlutterEngine to back our FlutterView.
    -    flutterEngine = onCreateFlutterEngine(getActivity());
    -
    -    // Allow subclasses to customize FlutterEngine as desired.
    -    onFlutterEngineCreated(flutterEngine);
    -  }
    -
    -  /**
    -   * Hook for subclasses to customize the creation of the {@code FlutterEngine}.
    -   *
    -   * By default, this method returns a standard {@link FlutterEngine} without any modification.
    +   * Obtains a reference to a FlutterEngine to back this {@code FlutterFragment}.
    +   * 

    + * First, the {@link FragmentActivity} that owns this {@code FlutterFragment} is + * given the opportunity to provide a {@link FlutterEngine} as a {@link FlutterEngineProvider}. + *

    + * If the owning {@link FragmentActivity} does not implement {@link FlutterEngineProvider}, or + * chooses to return {@code null}, then a new {@link FlutterEngine} is instantiated. Subclasses + * may override this method to provide a {@link FlutterEngine} of choice. */ - @NonNull - protected FlutterEngine onCreateFlutterEngine(@NonNull Context context) { - Log.d(TAG, "onCreateFlutterEngine()"); - return new FlutterEngine(context); - } + protected void setupFlutterEngine() { + // First, defer to the FragmentActivity that owns us to see if it wants to provide a + // FlutterEngine. + FragmentActivity attachedActivity = getActivity(); + if (attachedActivity instanceof FlutterEngineProvider) { + // Defer to the Activity that owns us to provide a FlutterEngine. + Log.d(TAG, "Deferring to attached Activity to provide a FlutterEngine."); + FlutterEngineProvider flutterEngineProvider = (FlutterEngineProvider) attachedActivity; + flutterEngine = flutterEngineProvider.getFlutterEngine(getContext()); + if (flutterEngine != null) { + isFlutterEngineFromActivity = true; + } + } - /** - * Hook for subclasses to customize the {@link FlutterEngine} owned by this {@link FlutterFragment} - * after the {@link FlutterEngine} has been instantiated. - * - * Consider using this method to connect desired Flutter plugins to this {@code Fragment}'s - * {@link FlutterEngine}. - */ - protected void onFlutterEngineCreated(@NonNull FlutterEngine flutterEngine) { - // no-op + // If flutterEngine is null then either our Activity is not a FlutterEngineProvider, + // or our Activity decided that it didn't want to provide a FlutterEngine. Either way, + // we will now create a FlutterEngine for this FlutterFragment. + if (flutterEngine == null) { + // Create a FlutterEngine to back our FlutterView. + Log.d(TAG, "Our attached Activity did not want to provide a FlutterEngine. Creating a " + + "new FlutterEngine for this FlutterFragment."); + flutterEngine = new FlutterEngine(getContext()); + isFlutterEngineFromActivity = false; + } } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { flutterView = new FlutterView(getContext(), getRenderMode()); - flutterView.attachToFlutterEngine(flutterEngine); - - // TODO(mattcarroll): the following call should exist here, but the plugin system needs to be revamped. - // The existing attach() method does not know how to handle this kind of FlutterView. - //flutterEngine.getPluginRegistry().attach(this, getActivity()); - doInitialFlutterViewRun(); + // We post() the code that attaches the FlutterEngine to our FlutterView because there is + // some kind of blocking logic on the native side when the surface is connected. That lag + // causes launching Activitys to wait a second or two before launching. By post()'ing this + // behavior we are able to move this blocking logic to after the Activity's launch. + // TODO(mattcarroll): figure out how to avoid blocking the MAIN thread when connecting a surface + new Handler().post(new Runnable() { + @Override + public void run() { + flutterView.attachToFlutterEngine(flutterEngine); + + // TODO(mattcarroll): the following call should exist here, but the plugin system needs to be revamped. + // The existing attach() method does not know how to handle this kind of FlutterView. + //flutterEngine.getPluginRegistry().attach(this, getActivity()); + + doInitialFlutterViewRun(); + } + }); return flutterView; } @@ -431,7 +446,7 @@ public void onDetach() { platformPlugin = null; // Destroy our FlutterEngine if we're not set to retain it. - if (!retainFlutterIsolateAfterFragmentDestruction()) { + if (!retainFlutterEngineAfterFragmentDestruction() && !isFlutterEngineFromActivity) { flutterEngine.destroy(); flutterEngine = null; } @@ -447,7 +462,7 @@ public void onDetach() { // TODO(mattcarroll): consider a dynamic determination of this preference based on whether the // engine was created automatically, or if the engine was provided manually. // Manually provided engines should probably not be destroyed. - protected boolean retainFlutterIsolateAfterFragmentDestruction() { + protected boolean retainFlutterEngineAfterFragmentDestruction() { return false; } @@ -564,4 +579,31 @@ private Context getContextCompat() { ? getContext() : getActivity(); } + + /** + * Provides a {@link FlutterEngine} instance to be used by a {@code FlutterFragment}. + *

    + * {@link FlutterEngine} instances require significant time to warm up. Therefore, a developer + * might choose to hold onto an existing {@link FlutterEngine} and connect it to various + * {@link FlutterActivity}s and/or {@code FlutterFragments}. + *

    + * If the {@link FragmentActivity} that owns this {@code FlutterFragment} implements + * {@code FlutterEngineProvider}, that {@link FlutterActivity} will be given an opportunity + * to provide a {@link FlutterEngine} instead of the {@code FlutterFragment} creating a + * new one. The {@link FragmentActivity} can provide an existing, pre-warmed {@link FlutterEngine}, + * if desired. + *

    + * See {@link #setupFlutterEngine()} for more information. + */ + public interface FlutterEngineProvider { + /** + * Returns the {@link FlutterEngine} that should be used by a child {@code FlutterFragment}. + *

    + * This method may return a new {@link FlutterEngine}, an existing, cached {@link FlutterEngine}, + * or null to express that the {@code FlutterEngineProvider} would like the {@code FlutterFragment} + * to provide its own {@code FlutterEngine} instance. + */ + @Nullable + FlutterEngine getFlutterEngine(@NonNull Context context); + } } From 45dc353eeb364b793120fd5bacce42148b7d3416 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 5 Apr 2019 16:10:34 -0400 Subject: [PATCH 0713/1117] Roll src/third_party/skia 0e35ce27e0e9..053b2939938c (10 commits) (#8458) https://skia.googlesource.com/skia.git/%2Blog/0e35ce27e0e9..053b2939938c git log 0e35ce27e0e933bdca908d8d772ef156ee6cbbb2..053b2939938ca55cbc7aa1457628c4c3a1bcd7fa --date=short --no-merges --format=%ad %ae %s 2019-04-05 michaelludwig@google.com Support clip masks for SaveLayerRec and drawSpecial in Ganesh 2019-04-05 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-04-05 halcanary@google.com SkPDF: Add regression benchmark for multiple path clips 2019-04-05 nifong@google.com Add helper for loading files, use let 2019-04-05 kjlubick@google.com [canvaskit] Bump GPU resource cache to 256MB 2019-04-05 mtklein@google.com update SkMallocPixelRef docs 2019-04-05 kjlubick@google.com [CanvasKit] Add basic support for SkPicture 2019-04-05 fmalita@chromium.org [skottie] Add support for pre-decoding images at load time 2019-04-05 brianosman@google.com Always mark bitmap glyph runs as such, to ensure they are properly regenerated 2019-04-04 bsalomon@google.com Blacklist mobi_wsj.skp on IntelIris 540 and 655 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jlavrova@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 0de4938fab7ab..00968e14440db 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': '0e35ce27e0e933bdca908d8d772ef156ee6cbbb2', + 'skia_revision': '053b2939938ca55cbc7aa1457628c4c3a1bcd7fa', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index d2151b7b5f274..f4e3bf9f172d4 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: cf6c48b736d4219c0e182b4de96f1336 +Signature: 2df9b62db9970814911c832678507502 UNUSED LICENSES: @@ -2038,6 +2038,7 @@ FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/debugger/sample.s FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/externs.js FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/fonts/NotoMono-Regular.ttf FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/gpu.js +FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/helper.js FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/karma.conf.js FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/package.json FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/ready.js @@ -4561,6 +4562,7 @@ FILE: ../../../third_party/skia/gm/mixercolorfilter.cpp FILE: ../../../third_party/skia/gm/overdrawcanvas.cpp FILE: ../../../third_party/skia/gm/samplelocations.cpp FILE: ../../../third_party/skia/gm/skbug_8664.cpp +FILE: ../../../third_party/skia/gm/skbug_8955.cpp FILE: ../../../third_party/skia/include/core/SkMixer.h FILE: ../../../third_party/skia/include/core/SkTileMode.h FILE: ../../../third_party/skia/include/gpu/GrContextThreadSafeProxy.h From 816e3dc0f5361ac6459ca96e94117851985c21c2 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 5 Apr 2019 13:03:10 -0700 Subject: [PATCH 0714/1117] Roll src/third_party/dart 907c514c89..1ad11facec (7 commits) 1ad11facec Fix mustCallSuper for mixins and inherited interfaces: 6dc9c8d127 [CFE] JS: Treat integer valued double constants as integers. dbfd00f44d [vm/compiler] Add new optimization pass which inlines typed data accesses dbc9ff11bf [vm/vmservice] Switch from const bool.fromEnvironment() to new for 'DART_SERVICE_USE_AUTH'. 44799241fa Revert "set empty environment defines to CompilerOptions" ec8222f457 bump to linter 0.1.84 d14990b3ad Remove no-longer-needed override --- DEPS | 4 ++-- ci/licenses_golden/licenses_third_party | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 00968e14440db..deb0ff1f6680f 100644 --- a/DEPS +++ b/DEPS @@ -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': '907c514c8937cf76e825d427364cf3475797f18f', + 'dart_revision': '1ad11facec401ed51a8bdf79dafd77e955b23082', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -60,7 +60,7 @@ vars = { 'dart_http_throttle_tag': '1.0.2', 'dart_intl_tag': '0.15.7', 'dart_json_rpc_2_tag': '2.0.9', - 'dart_linter_tag': '0.1.83', + 'dart_linter_tag': '0.1.84', 'dart_logging_tag': '0.11.3+2', 'dart_markdown_tag': '2.0.2', 'dart_matcher_tag': '0.12.3', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index e8ca9564ad9f5..cc55ff37f40f5 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: cbf8e245ca4d75c5fd125ab57b6b730e +Signature: a8a4c10952be81c36641faedbc1b238f UNUSED LICENSES: @@ -5155,6 +5155,7 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/backend/il_test_helper.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/il_test_helper.h FILE: ../../../third_party/dart/runtime/vm/compiler/backend/slot_test.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/type_propagator_test.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/backend/typed_data_aot_test.cc FILE: ../../../third_party/dart/runtime/vm/compiler/ffi.cc FILE: ../../../third_party/dart/runtime/vm/compiler/ffi.h FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier.cc From 424045c3f29891c5ca5e05e69180445850ed62c2 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 5 Apr 2019 13:34:40 -0700 Subject: [PATCH 0715/1117] Enable shutting down all root isolates in a VM. (#8457) This reverts commit 800ea0a40397d53311715e0de94f0340195bfcea. --- ci/licenses_golden/licenses_flutter | 1 + common/settings.h | 8 +- runtime/BUILD.gn | 39 ++++- runtime/dart_isolate.cc | 71 +++++++-- runtime/dart_isolate.h | 17 +++ runtime/dart_lifecycle_unittests.cc | 142 ++++++++++++++++++ runtime/dart_vm.cc | 51 +++++++ runtime/dart_vm.h | 14 ++ runtime/dart_vm_lifecycle.cc | 11 +- runtime/dart_vm_lifecycle.h | 10 ++ runtime/fixtures/simple_main.dart | 4 + runtime/runtime_test.cc | 7 + shell/common/isolate_configuration.cc | 30 ++-- shell/common/isolate_configuration.h | 10 +- .../android/platform_view_android_jni.cc | 2 +- 15 files changed, 376 insertions(+), 41 deletions(-) create mode 100644 runtime/dart_lifecycle_unittests.cc diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 312e6c329ab71..5715a8445f803 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -374,6 +374,7 @@ FILE: ../../../flutter/lib/ui/window/window.h FILE: ../../../flutter/runtime/dart_isolate.cc FILE: ../../../flutter/runtime/dart_isolate.h FILE: ../../../flutter/runtime/dart_isolate_unittests.cc +FILE: ../../../flutter/runtime/dart_lifecycle_unittests.cc FILE: ../../../flutter/runtime/dart_service_isolate.cc FILE: ../../../flutter/runtime/dart_service_isolate.h FILE: ../../../flutter/runtime/dart_service_isolate_unittests.cc diff --git a/common/settings.h b/common/settings.h index 40b647de1f431..ff0315f8fc001 100644 --- a/common/settings.h +++ b/common/settings.h @@ -29,6 +29,8 @@ using UnhandledExceptionCallback = // callback that generates the mapping from these paths. // https://github.com/flutter/flutter/issues/26783 using MappingCallback = std::function(void)>; +using MappingsCallback = + std::function>(void)>; struct Settings { Settings(); @@ -53,8 +55,10 @@ struct Settings { MappingCallback dart_library_sources_kernel; std::string application_library_path; - std::string application_kernel_asset; - std::string application_kernel_list_asset; + + std::string application_kernel_asset; // deprecated + std::string application_kernel_list_asset; // deprecated + MappingsCallback application_kernels; std::string temp_directory_path; std::vector dart_flags; diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index a906e589c223f..4ae61ac3b46e0 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -101,18 +101,17 @@ test_fixtures("runtime_fixtures") { fixtures = [ "fixtures/simple_main.dart" ] } -executable("runtime_unittests") { +source_set("runtime_unittests_common") { + visibility = [ ":*" ] + testonly = true sources = [ - "dart_isolate_unittests.cc", - "dart_service_isolate_unittests.cc", - "dart_vm_unittests.cc", "runtime_test.cc", "runtime_test.h", ] - deps = [ + public_deps = [ ":libdart", ":runtime", ":runtime_fixtures", @@ -124,6 +123,36 @@ executable("runtime_unittests") { "//third_party/skia", "//third_party/tonic", ] +} + +executable("runtime_unittests") { + testonly = true + + sources = [ + "dart_isolate_unittests.cc", + "dart_service_isolate_unittests.cc", + "dart_vm_unittests.cc", + ] + + deps = [ + ":runtime_unittests_common", + ] + + if (is_linux) { + ldflags = [ "-rdynamic" ] + } +} + +executable("runtime_lifecycle_unittests") { + testonly = true + + sources = [ + "dart_lifecycle_unittests.cc", + ] + + deps = [ + ":runtime_unittests_common", + ] if (is_linux) { ldflags = [ "-rdynamic" ] diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 46df151f40b0e..91cd8bb5dd4aa 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -162,17 +162,8 @@ bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) { tonic::DartIsolateScope scope(isolate()); - if (is_root_isolate) { - if (auto task_runner = GetTaskRunners().GetUITaskRunner()) { - // Isolates may not have any particular thread affinity. Only initialize - // the task dispatcher if a task runner is explicitly specified. - tonic::DartMessageHandler::TaskDispatcher dispatcher = - [task_runner](std::function task) { - task_runner->PostTask(task); - }; - message_handler().Initialize(dispatcher); - } - } + SetMessageHandlingTaskRunner(GetTaskRunners().GetUITaskRunner(), + is_root_isolate); if (tonic::LogIfError( Dart_SetLibraryTagHandler(tonic::DartState::HandleLibraryTag))) { @@ -187,6 +178,23 @@ bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) { return true; } +fml::RefPtr DartIsolate::GetMessageHandlingTaskRunner() const { + return message_handling_task_runner_; +} + +void DartIsolate::SetMessageHandlingTaskRunner( + fml::RefPtr runner, + bool is_root_isolate) { + if (!is_root_isolate || !runner) { + return; + } + + message_handling_task_runner_ = runner; + + message_handler().Initialize( + [runner](std::function task) { runner->PostTask(task); }); +} + // Updating thread names here does not change the underlying OS thread names. // Instead, this is just additional metadata for the Observatory to show the // thread name of the isolate. @@ -361,6 +369,34 @@ bool DartIsolate::PrepareForRunningFromKernel( return true; } +FML_WARN_UNUSED_RESULT +bool DartIsolate::PrepareForRunningFromKernels( + std::vector> kernels) { + const auto count = kernels.size(); + if (count == 0) { + return false; + } + + for (size_t i = 0; i < count; ++i) { + bool last = (i == (count - 1)); + if (!PrepareForRunningFromKernel(kernels[i], last)) { + return false; + } + } + + return true; +} + +FML_WARN_UNUSED_RESULT +bool DartIsolate::PrepareForRunningFromKernels( + std::vector> kernels) { + std::vector> shared_kernels; + for (auto& kernel : kernels) { + shared_kernels.emplace_back(std::move(kernel)); + } + return PrepareForRunningFromKernels(shared_kernels); +} + bool DartIsolate::MarkIsolateRunnable() { TRACE_EVENT0("flutter", "DartIsolate::MarkIsolateRunnable"); if (phase_ != Phase::LibrariesSetup) { @@ -484,7 +520,6 @@ 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); } @@ -686,6 +721,8 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( } } + DartVMRef::GetRunningVM()->RegisterActiveIsolate(*embedder_isolate); + // The ownership of the embedder object is controlled by the Dart VM. So the // only reference returned to the caller is weak. embedder_isolate.release(); @@ -694,7 +731,9 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( // |Dart_IsolateShutdownCallback| void DartIsolate::DartIsolateShutdownCallback( - std::shared_ptr* embedder_isolate) {} + std::shared_ptr* embedder_isolate) { + embedder_isolate->get()->OnShutdownCallback(); +} // |Dart_IsolateCleanupCallback| void DartIsolate::DartIsolateCleanupCallback( @@ -719,6 +758,12 @@ void DartIsolate::AddIsolateShutdownCallback(fml::closure closure) { std::make_unique(std::move(closure))); } +void DartIsolate::OnShutdownCallback() { + shutdown_callbacks_.clear(); + DartVMRef::GetRunningVM()->UnregisterActiveIsolate( + std::static_pointer_cast(shared_from_this())); +} + DartIsolate::AutoFireClosure::AutoFireClosure(fml::closure closure) : closure_(std::move(closure)) {} diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index 49c3df3c51082..96753830e0bb3 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -5,6 +5,7 @@ #ifndef FLUTTER_RUNTIME_DART_ISOLATE_H_ #define FLUTTER_RUNTIME_DART_ISOLATE_H_ +#include #include #include @@ -75,6 +76,14 @@ class DartIsolate : public UIDartState { bool PrepareForRunningFromKernel(std::shared_ptr kernel, bool last_piece = true); + FML_WARN_UNUSED_RESULT + bool PrepareForRunningFromKernels( + std::vector> kernels); + + FML_WARN_UNUSED_RESULT + bool PrepareForRunningFromKernels( + std::vector> kernels); + FML_WARN_UNUSED_RESULT bool Run(const std::string& entrypoint, fml::closure on_run = nullptr); @@ -94,6 +103,8 @@ class DartIsolate : public UIDartState { std::weak_ptr GetWeakIsolatePtr(); + fml::RefPtr GetMessageHandlingTaskRunner() const; + private: bool LoadKernel(std::shared_ptr mapping, bool last_piece); @@ -116,10 +127,14 @@ class DartIsolate : public UIDartState { std::vector> kernel_buffers_; std::vector> shutdown_callbacks_; ChildIsolatePreparer child_isolate_preparer_ = nullptr; + fml::RefPtr message_handling_task_runner_; FML_WARN_UNUSED_RESULT bool Initialize(Dart_Isolate isolate, bool is_root_isolate); + void SetMessageHandlingTaskRunner(fml::RefPtr runner, + bool is_root_isolate); + FML_WARN_UNUSED_RESULT bool LoadLibraries(bool is_root_isolate); @@ -128,6 +143,8 @@ class DartIsolate : public UIDartState { FML_WARN_UNUSED_RESULT bool MarkIsolateRunnable(); + void OnShutdownCallback(); + // |Dart_IsolateCreateCallback| static Dart_Isolate DartIsolateCreateCallback( const char* advisory_script_uri, diff --git a/runtime/dart_lifecycle_unittests.cc b/runtime/dart_lifecycle_unittests.cc new file mode 100644 index 0000000000000..039d93793cb6d --- /dev/null +++ b/runtime/dart_lifecycle_unittests.cc @@ -0,0 +1,142 @@ +// Copyright 2013 The Flutter 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/common/task_runners.h" +#include "flutter/fml/paths.h" +#include "flutter/fml/synchronization/waitable_event.h" +#include "flutter/runtime/dart_vm.h" +#include "flutter/runtime/dart_vm_lifecycle.h" +#include "flutter/runtime/runtime_test.h" + +namespace blink { +namespace testing { + +using DartLifecycleTest = RuntimeTest; + +TEST_F(DartLifecycleTest, CanStartAndShutdownVM) { + auto settings = CreateSettingsForFixture(); + settings.leak_vm = false; + settings.enable_observatory = false; + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); + { + auto vm_ref = DartVMRef::Create(settings); + ASSERT_TRUE(DartVMRef::IsInstanceRunning()); + } + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); +} + +TEST_F(DartLifecycleTest, CanStartAndShutdownVMOverAndOver) { + auto settings = CreateSettingsForFixture(); + settings.leak_vm = false; + settings.enable_observatory = false; + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); + auto count = DartVM::GetVMLaunchCount(); + for (size_t i = 0; i < 10; i++) { + auto vm_ref = DartVMRef::Create(settings); + ASSERT_TRUE(DartVMRef::IsInstanceRunning()); + ASSERT_EQ(DartVM::GetVMLaunchCount(), count + 1); + count = DartVM::GetVMLaunchCount(); + } + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); +} + +static void CreateAndRunRootIsolate( + std::shared_ptr& isolate_result, + const Settings& settings, + const DartVMData& vm, + fml::RefPtr task_runner, + std::string entrypoint) { + FML_CHECK(entrypoint.size() > 0); + TaskRunners runners("io.flutter.test", task_runner, task_runner, task_runner, + task_runner); + auto isolate_weak = DartIsolate::CreateRootIsolate( + vm.GetSettings(), // settings + vm.GetIsolateSnapshot(), // isolate_snapshot + vm.GetSharedSnapshot(), // shared_snapshot + runners, // task_runners + {}, // window + {}, // snapshot_delegate + {}, // io_manager + "main.dart", // advisory_script_uri + entrypoint.c_str(), // advisory_script_entrypoint + nullptr // flags + ); + + auto isolate = isolate_weak.lock(); + + if (!isolate) { + FML_LOG(ERROR) << "Could not create valid isolate."; + return; + } + + if (DartVM::IsRunningPrecompiledCode()) { + if (!isolate->PrepareForRunningFromPrecompiledCode()) { + FML_LOG(ERROR) + << "Could not prepare to run the isolate from precompiled code."; + return; + } + + } else { + if (!isolate->PrepareForRunningFromKernels( + settings.application_kernels())) { + FML_LOG(ERROR) << "Could not prepare isolate from application kernels."; + return; + } + } + + if (isolate->GetPhase() != DartIsolate::Phase::Ready) { + FML_LOG(ERROR) << "Isolate was not ready."; + return; + } + + if (!isolate->Run(entrypoint, settings.root_isolate_create_callback)) { + FML_LOG(ERROR) << "Could not run entrypoint: " << entrypoint << "."; + return; + } + + if (isolate->GetPhase() != DartIsolate::Phase::Running) { + FML_LOG(ERROR) << "Isolate was not Running."; + return; + } + + isolate_result = isolate; +} + +static std::shared_ptr CreateAndRunRootIsolate( + const Settings& settings, + const DartVMData& vm, + fml::RefPtr task_runner, + std::string entrypoint) { + fml::AutoResetWaitableEvent latch; + std::shared_ptr isolate; + fml::TaskRunner::RunNowOrPostTask(task_runner, [&]() { + CreateAndRunRootIsolate(isolate, settings, vm, task_runner, entrypoint); + latch.Signal(); + }); + latch.Wait(); + return isolate; +} + +TEST_F(DartLifecycleTest, ShuttingDownTheVMShutsDownTheIsolate) { + auto settings = CreateSettingsForFixture(); + settings.leak_vm = false; + settings.enable_observatory = false; + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); + { + auto vm_ref = DartVMRef::Create(settings); + ASSERT_TRUE(DartVMRef::IsInstanceRunning()); + ASSERT_EQ(vm_ref->GetIsolateCount(), 0u); + auto isolate = + CreateAndRunRootIsolate(settings, *vm_ref.GetVMData(), + GetThreadTaskRunner(), "testIsolateShutdown"); + ASSERT_TRUE(isolate); + ASSERT_EQ(vm_ref->GetIsolateCount(), 1u); + vm_ref->ShutdownAllIsolates(); + ASSERT_EQ(vm_ref->GetIsolateCount(), 0u); + } + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); +} + +} // namespace testing +} // namespace blink diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 110f7c2b27809..db8acaaa46abc 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -15,6 +15,7 @@ #include "flutter/fml/file.h" #include "flutter/fml/logging.h" #include "flutter/fml/mapping.h" +#include "flutter/fml/synchronization/count_down_latch.h" #include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/time/time_delta.h" #include "flutter/fml/trace_event.h" @@ -450,4 +451,54 @@ std::shared_ptr DartVM::GetIsolateNameServer() const { return isolate_name_server_; } +size_t DartVM::GetIsolateCount() const { + std::lock_guard lock(active_isolates_mutex_); + return active_isolates_.size(); +} + +void DartVM::ShutdownAllIsolates() { + std::set> isolates_to_shutdown; + // We may be shutting down isolates on the current thread. Shutting down the + // isolate calls the shutdown callback which removes the entry from the + // active isolate. The lock must be obtained to mutate that entry. To avoid a + // deadlock, collect the isolate is a seprate collection. + { + std::lock_guard lock(active_isolates_mutex_); + for (const auto& active_isolate : active_isolates_) { + if (auto task_runner = active_isolate->GetMessageHandlingTaskRunner()) { + isolates_to_shutdown.insert(active_isolate); + } + } + } + + fml::CountDownLatch latch(isolates_to_shutdown.size()); + + for (const auto& isolate : isolates_to_shutdown) { + fml::TaskRunner::RunNowOrPostTask( + isolate->GetMessageHandlingTaskRunner(), [&latch, isolate]() { + if (!isolate || !isolate->Shutdown()) { + FML_LOG(ERROR) << "Could not shutdown isolate."; + } + latch.CountDown(); + }); + } + latch.Wait(); +} + +void DartVM::RegisterActiveIsolate(std::shared_ptr isolate) { + if (!isolate) { + return; + } + std::lock_guard lock(active_isolates_mutex_); + active_isolates_.insert(isolate); +} + +void DartVM::UnregisterActiveIsolate(std::shared_ptr isolate) { + if (!isolate) { + return; + } + std::lock_guard lock(active_isolates_mutex_); + active_isolates_.erase(isolate); +} + } // namespace blink diff --git a/runtime/dart_vm.h b/runtime/dart_vm.h index 6724abde0b828..bff23f7352a7e 100644 --- a/runtime/dart_vm.h +++ b/runtime/dart_vm.h @@ -36,17 +36,27 @@ class DartVM { std::shared_ptr GetVMData() const; + // This accessor is racy and only meant to the used in tests where there is a + // consistent threading mode. + size_t GetIsolateCount() const; + std::shared_ptr GetServiceProtocol() const; std::shared_ptr GetIsolateNameServer() const; + void ShutdownAllIsolates(); + private: const Settings settings_; std::shared_ptr vm_data_; const std::shared_ptr isolate_name_server_; const std::shared_ptr service_protocol_; + mutable std::mutex active_isolates_mutex_; + std::set> active_isolates_ + FML_GUARDED_BY(active_isolates_mutex_); friend class DartVMRef; + friend class DartIsolate; static std::shared_ptr Create( Settings settings, @@ -58,6 +68,10 @@ class DartVM { DartVM(std::shared_ptr data, std::shared_ptr isolate_name_server); + void RegisterActiveIsolate(std::shared_ptr isolate); + + void UnregisterActiveIsolate(std::shared_ptr isolate); + FML_DISALLOW_COPY_AND_ASSIGN(DartVM); }; diff --git a/runtime/dart_vm_lifecycle.cc b/runtime/dart_vm_lifecycle.cc index 1ed86e0250c4b..d7f50f19ab1ff 100644 --- a/runtime/dart_vm_lifecycle.cc +++ b/runtime/dart_vm_lifecycle.cc @@ -13,7 +13,7 @@ namespace blink { // object weak pointer are behind this mutex. static std::mutex gVMMutex; static std::weak_ptr gVM FML_GUARDED_BY(gVMMutex); -static std::shared_ptr gVMLeak FML_GUARDED_BY(gVMMutex); +static std::shared_ptr* gVMLeak FML_GUARDED_BY(gVMMutex); // We are going to be modifying more than just the control blocks of the // following weak pointers (in the |Create| case where an old VM could not be @@ -88,7 +88,7 @@ DartVMRef DartVMRef::Create(Settings settings, gVM = vm; if (settings.leak_vm) { - gVMLeak = vm; + gVMLeak = new std::shared_ptr(vm); } return DartVMRef{std::move(vm)}; @@ -114,4 +114,11 @@ std::shared_ptr DartVMRef::GetIsolateNameServer() { return gVMIsolateNameServer.lock(); } +DartVM* DartVMRef::GetRunningVM() { + std::lock_guard lock(gVMMutex); + auto vm = gVM.lock().get(); + FML_CHECK(vm) << "Caller assumed VM would be running when it wasn't"; + return vm; +} + } // namespace blink diff --git a/runtime/dart_vm_lifecycle.h b/runtime/dart_vm_lifecycle.h index cfe1f1b646469..44a6cdba7b8b1 100644 --- a/runtime/dart_vm_lifecycle.h +++ b/runtime/dart_vm_lifecycle.h @@ -49,6 +49,11 @@ class DartVMRef { operator bool() const { return static_cast(vm_); } + DartVM* get() { + FML_DCHECK(vm_); + return vm_.get(); + } + DartVM* operator->() { FML_DCHECK(vm_); return vm_.get(); @@ -60,10 +65,15 @@ class DartVMRef { } private: + friend class DartIsolate; + std::shared_ptr vm_; DartVMRef(std::shared_ptr vm); + // Only used by Dart Isolate to register itself with the VM. + static DartVM* GetRunningVM(); + FML_DISALLOW_COPY_AND_ASSIGN(DartVMRef); }; diff --git a/runtime/fixtures/simple_main.dart b/runtime/fixtures/simple_main.dart index 594f69470bc2f..bc2d880ff1427 100644 --- a/runtime/fixtures/simple_main.dart +++ b/runtime/fixtures/simple_main.dart @@ -25,3 +25,7 @@ void canRegisterNativeCallback() async { } void NotifyNative() native "NotifyNative"; + + +@pragma('vm:entry-point') +void testIsolateShutdown() { } diff --git a/runtime/runtime_test.cc b/runtime/runtime_test.cc index 2613b133d241b..adb345d85d33a 100644 --- a/runtime/runtime_test.cc +++ b/runtime/runtime_test.cc @@ -68,6 +68,13 @@ void RuntimeTest::SetSnapshotsAndAssets(Settings& settings) { return GetMapping(assets_dir_, "isolate_snapshot_instr", true); }; } + } else { + settings.application_kernels = [this]() { + std::vector> kernel_mappings; + kernel_mappings.emplace_back( + GetMapping(assets_dir_, "kernel_blob.bin", false)); + return kernel_mappings; + }; } } diff --git a/shell/common/isolate_configuration.cc b/shell/common/isolate_configuration.cc index 173973b64e5b1..e45b6ab15e5f9 100644 --- a/shell/common/isolate_configuration.cc +++ b/shell/common/isolate_configuration.cc @@ -38,7 +38,7 @@ class AppSnapshotIsolateConfiguration final : public IsolateConfiguration { class KernelIsolateConfiguration : public IsolateConfiguration { public: - KernelIsolateConfiguration(std::unique_ptr kernel) + KernelIsolateConfiguration(std::unique_ptr kernel) : kernel_(std::move(kernel)) {} // |shell::IsolateConfiguration| @@ -50,7 +50,7 @@ class KernelIsolateConfiguration : public IsolateConfiguration { } private: - std::unique_ptr kernel_; + std::unique_ptr kernel_; FML_DISALLOW_COPY_AND_ASSIGN(KernelIsolateConfiguration); }; @@ -58,7 +58,8 @@ 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| @@ -80,7 +81,7 @@ class KernelListIsolateConfiguration final : public IsolateConfiguration { } private: - std::vector>> kernel_pieces_; + std::vector>> kernel_pieces_; FML_DISALLOW_COPY_AND_ASSIGN(KernelListIsolateConfiguration); }; @@ -112,15 +113,15 @@ static std::vector ParseKernelListPaths( return kernel_pieces_paths; } -static std::vector>> +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; + std::vector>> fetch_futures; for (const auto& kernel_pieces_path : kernel_pieces_paths) { - std::promise> fetch_promise; + std::promise> fetch_promise; fetch_futures.push_back(fetch_promise.get_future()); auto fetch_task = fml::MakeCopyable([asset_manager, kernel_pieces_path, @@ -153,6 +154,10 @@ std::unique_ptr IsolateConfiguration::InferFromSettings( return nullptr; } + if (settings.application_kernels) { + return CreateForKernelList(settings.application_kernels()); + } + if (settings.application_kernel_asset.empty() && settings.application_kernel_list_asset.empty()) { FML_DLOG(ERROR) << "application_kernel_asset or " @@ -192,15 +197,15 @@ IsolateConfiguration::CreateForAppSnapshot() { } std::unique_ptr IsolateConfiguration::CreateForKernel( - std::unique_ptr kernel) { + std::unique_ptr kernel) { return std::make_unique(std::move(kernel)); } std::unique_ptr IsolateConfiguration::CreateForKernelList( - std::vector> kernel_pieces) { - std::vector>> pieces; + std::vector> kernel_pieces) { + std::vector>> pieces; for (auto& piece : kernel_pieces) { - std::promise> promise; + std::promise> promise; pieces.push_back(promise.get_future()); promise.set_value(std::move(piece)); } @@ -208,7 +213,8 @@ std::unique_ptr IsolateConfiguration::CreateForKernelList( } std::unique_ptr IsolateConfiguration::CreateForKernelList( - std::vector>> kernel_pieces) { + 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 e9f8d66b2e433..0d2619e6068c1 100644 --- a/shell/common/isolate_configuration.h +++ b/shell/common/isolate_configuration.h @@ -29,16 +29,14 @@ class IsolateConfiguration { static std::unique_ptr CreateForAppSnapshot(); static std::unique_ptr CreateForKernel( - std::unique_ptr kernel); + std::unique_ptr kernel); static std::unique_ptr CreateForKernelList( - std::vector>> kernel_pieces); + 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); + std::vector> kernel_pieces); IsolateConfiguration(); diff --git a/shell/platform/android/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index b26f5939902f2..cbddd1b9f81f4 100644 --- a/shell/platform/android/platform_view_android_jni.cc +++ b/shell/platform/android/platform_view_android_jni.cc @@ -207,7 +207,7 @@ std::unique_ptr CreateIsolateConfiguration( auto blob = asset_manager.GetAsMapping(snapshot_name); auto delta = asset_manager.GetAsMapping("kernel_delta.bin"); if (blob && delta) { - std::vector> kernels; + std::vector> kernels; kernels.emplace_back(std::move(blob)); kernels.emplace_back(std::move(delta)); return IsolateConfiguration::CreateForKernelList(std::move(kernels)); From e10d46421de7e544e104f1f5bff4cb38574c8900 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 5 Apr 2019 13:58:46 -0700 Subject: [PATCH 0716/1117] Improve path metrics tests and docs (#7851) * Improve path metrics tests and docs --- lib/ui/painting.dart | 7 +++---- testing/dart/path_test.dart | 38 ++++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index e7b0e01c9ea70..6703dfd01083e 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -2257,7 +2257,9 @@ class PathMetricIterator implements Iterator { /// iterator is at the contour for which they were created. It will also only be /// valid for the path as it was specified when [Path.computeMetrics] was called. /// If additional contours are added or any contours are updated, the metrics -/// need to be recomputed. +/// need to be recomputed. Previously created metrics will still refer to a +/// snapshot of the path at the time they were computed, rather than to the +/// actual metrics for the new mutations to the path. class PathMetric { PathMetric._(this._measure) : assert(_measure != null), @@ -2364,9 +2366,6 @@ class _PathMeasure extends NativeFieldWrapperClass2 { // // A path can have a next contour if [Path.moveTo] was called after drawing began. // Return true if one exists, or false. - // - // Before Skia introduced an SkPathContourMeasureIter, this didn't work like - // a normal iterator. Now it does. bool _nextContour() { final bool next = _nativeNextContour(); if (next) { diff --git a/testing/dart/path_test.dart b/testing/dart/path_test.dart index 6a0c99f1aefad..a65b0bcb82b9d 100644 --- a/testing/dart/path_test.dart +++ b/testing/dart/path_test.dart @@ -207,14 +207,42 @@ void main() { ..lineTo(10, 15); final List metrics = path.computeMetrics().toList(); expect(metrics.length, 2); - print(metrics); expect(metrics[0].length, 20); expect(metrics[0].isClosed, true); - expect(() => metrics[0].getTangentForOffset(4.0), isNotNull); - expect(() => metrics[0].extractPath(4.0, 10.0), isNotNull); + expect(metrics[0].getTangentForOffset(4.0).vector, const Offset(0.0, 1.0)); + expect(metrics[0].extractPath(4.0, 10.0).computeMetrics().first.length, 6.0); expect(metrics[1].length, 10); expect(metrics[1].isClosed, false); - expect(() => metrics[1].getTangentForOffset(4.0), isNotNull); - expect(() => metrics[1].extractPath(4.0, 10.0), isNotNull); + expect(metrics[1].getTangentForOffset(4.0).vector, const Offset(1.0, 0.0)); + expect(metrics[1].extractPath(4.0, 6.0).computeMetrics().first.length, 2.0); + }); + + test('PathMetrics on a mutated path', () { + final Path path = Path()..lineTo(0, 10); + final PathMetrics metrics = path.computeMetrics(); + final PathMetric firstMetric = metrics.first; + // We've consumed the iterator. + expect(metrics, isEmpty); + expect(firstMetric.length, 10); + expect(firstMetric.isClosed, false); + expect(firstMetric.getTangentForOffset(4.0).vector, const Offset(0.0, 1.0)); + expect(firstMetric.extractPath(4.0, 10.0).computeMetrics().first.length, 6.0); + + path..lineTo(10, 10)..lineTo(10, 0)..close(); + // mutating the path shouldn't have added anything to the iterator. + expect(metrics, isEmpty); + expect(firstMetric.length, 10); + expect(firstMetric.isClosed, false); + expect(firstMetric.getTangentForOffset(4.0).vector, const Offset(0.0, 1.0)); + expect(firstMetric.extractPath(4.0, 10.0).computeMetrics().first.length, 6.0); + + // getting a new iterator should update us. + final PathMetrics newMetrics = path.computeMetrics(); + final PathMetric newFirstMetric = newMetrics.first; + expect(newMetrics, isEmpty); + expect(newFirstMetric.length, 40); + expect(newFirstMetric.isClosed, true); + expect(newFirstMetric.getTangentForOffset(4.0).vector, const Offset(0.0, 1.0)); + expect(newFirstMetric.extractPath(4.0, 10.0).computeMetrics().first.length, 6.0); }); } From ce7c21ce9b7a992c0991db489293a7064f7c9ae9 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 5 Apr 2019 15:16:07 -0700 Subject: [PATCH 0717/1117] Log the correct function on error in the embedder. (#8461) --- shell/platform/embedder/embedder.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 93c23b12207e1..1683d10bfe8a7 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -45,7 +45,7 @@ static FlutterEngineResult LogEmbedderError(FlutterEngineResult code, const char* file, int line) { FML_LOG(ERROR) << "Returning error '" << name << "' (" << code - << ") from Flutter Embedder API call to '" << __FUNCTION__ + << ") from Flutter Embedder API call to '" << function << "'. Origin: " << file << ":" << line; return code; } From 99da038dab2c61f562cb8947eb91e4d812980f11 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 5 Apr 2019 15:37:14 -0700 Subject: [PATCH 0718/1117] Document the leak_vm flag. (#8462) --- common/settings.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/settings.h b/common/settings.h index ff0315f8fc001..1bd54f4126b38 100644 --- a/common/settings.h +++ b/common/settings.h @@ -89,6 +89,18 @@ struct Settings { // Font settings bool use_test_fonts = false; + // All shells in the process share the same VM. The last shell to shutdown + // should typically shut down the VM as well. However, applications depend on + // the behavior of "warming-up" the VM by creating a shell that does not do + // anything. This used to work earlier when the VM could not be shut down (and + // hence never was). Shutting down the VM now breaks such assumptions in + // existing embedders. To keep this behavior consistent and allow existing + // embedders the chance to migrate, this flag defaults to true. Any shell + // launched with this flag set to true will leak the VM in the process. There + // is no way to shut down the VM once such a shell has been started. All + // shells in the platform (via their embedding APIs) should cooperate to make + // sure this flag is never set if they want the VM to shutdown and free all + // associated resources. bool leak_vm = true; // Engine settings From d3fbaea9a496e03c660fa778f5d39d29ef1d0ae5 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Fri, 5 Apr 2019 15:59:12 -0700 Subject: [PATCH 0719/1117] Android Embedding PR25: Prevent black rectangle when launching FlutterActivity (#8460) --- .../embedding/android/FlutterActivity.java | 69 ++++++++++++++++++- .../embedding/android/FlutterFragment.java | 32 +++++++-- .../embedding/android/FlutterSurfaceView.java | 28 ++++++++ .../embedding/android/FlutterTextureView.java | 28 ++++++++ .../embedding/android/FlutterView.java | 17 +++++ .../engine/renderer/FlutterRenderer.java | 12 ++++ .../io/flutter/view/FlutterNativeView.java | 7 ++ 7 files changed, 188 insertions(+), 5 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java b/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java index ad6bacb0c936c..fa26cf387d9e8 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java @@ -9,6 +9,8 @@ import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; +import android.graphics.Color; +import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; @@ -16,6 +18,7 @@ import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.util.Log; +import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; import android.view.Window; @@ -24,6 +27,7 @@ import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.FlutterShellArgs; +import io.flutter.embedding.engine.renderer.OnFirstFrameRenderedListener; import io.flutter.plugin.platform.PlatformPlugin; import io.flutter.view.FlutterMain; @@ -61,7 +65,7 @@ * {@code Fragment}. */ // TODO(mattcarroll): explain each call forwarded to Fragment (first requires resolution of PluginRegistry API). -public class FlutterActivity extends FragmentActivity { +public class FlutterActivity extends FragmentActivity implements OnFirstFrameRenderedListener { private static final String TAG = "FlutterActivity"; // Meta-data arguments, processed from manifest XML. @@ -82,6 +86,10 @@ public class FlutterActivity extends FragmentActivity { private static final int FRAGMENT_CONTAINER_ID = 609893468; // random number private FlutterFragment flutterFragment; + // Used to cover the Activity until the 1st frame is rendered so as to + // avoid a brief black flicker from a SurfaceView version of FlutterView. + private View coverView; + /** * Creates an {@link Intent} that launches a {@code FlutterActivity}, which executes * a {@code main()} Dart entrypoint, and displays the "/" route as Flutter's initial route. @@ -147,10 +155,64 @@ public void onCreate(Bundle savedInstanceState) { Log.d(TAG, "onCreate()"); super.onCreate(savedInstanceState); setContentView(createFragmentContainer()); + showCoverView(); configureStatusBarForFullscreenFlutterExperience(); ensureFlutterFragmentCreated(); } + /** + * Cover all visible {@code Activity} area with a {@code View} that paints everything the same + * color as the {@code Window}. + *

    + * This cover {@code View} should be displayed at the very beginning of the {@code Activity}'s + * lifespan and then hidden once Flutter renders its first frame. The purpose of this cover is to + * cover {@link FlutterSurfaceView}, which briefly displays a black rectangle before it can make + * itself transparent. + */ + private void showCoverView() { + // Create the coverView. + if (coverView == null) { + coverView = new View(this); + addContentView(coverView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); + } + + // Pain the coverView with the Window's background. + Drawable background = createCoverViewBackground(); + if (background != null) { + coverView.setBackground(background); + } else { + // If we can't obtain a window background to replicate then we'd be guessing as to the least + // intrusive color. But there is no way to make an accurate guess. In this case we don't + // give the coverView any color, which means a brief black rectangle will be visible upon + // Activity launch. + } + } + + @Nullable + private Drawable createCoverViewBackground() { + TypedValue typedValue = new TypedValue(); + boolean hasBackgroundColor = getTheme().resolveAttribute( + android.R.attr.windowBackground, + typedValue, + true + ); + if (hasBackgroundColor && typedValue.resourceId != 0) { + return getResources().getDrawable(typedValue.resourceId, getTheme()); + } else { + return null; + } + } + + /** + * Hides the cover {@code View}. + *

    + * This method should be called when Flutter renders its first frame. See {@link #showCoverView()} + * for details. + */ + private void hideCoverView() { + coverView.setVisibility(View.GONE); + } + private void configureStatusBarForFullscreenFlutterExperience() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); @@ -360,4 +422,9 @@ protected String getInitialRoute() { private boolean isDebuggable() { return (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; } + + @Override + public void onFirstFrameRendered() { + hideCoverView(); + } } diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java index a3115a691801b..3beb6d8ae2578 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java @@ -21,6 +21,7 @@ import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.FlutterShellArgs; import io.flutter.embedding.engine.dart.DartExecutor; +import io.flutter.embedding.engine.renderer.OnFirstFrameRenderedListener; import io.flutter.plugin.platform.PlatformPlugin; import io.flutter.view.FlutterMain; @@ -214,16 +215,27 @@ protected static Bundle createArgsBundle(@Nullable String dartEntrypoint, @Nullable private PlatformPlugin platformPlugin; + private final OnFirstFrameRenderedListener onFirstFrameRenderedListener = new OnFirstFrameRenderedListener() { + @Override + public void onFirstFrameRendered() { + // Notify our subclasses that the first frame has been rendered. + FlutterFragment.this.onFirstFrameRendered(); + + // Notify our owning Activity that the first frame has been rendered. + FragmentActivity fragmentActivity = getActivity(); + if (fragmentActivity != null && fragmentActivity instanceof OnFirstFrameRenderedListener) { + OnFirstFrameRenderedListener activityAsListener = (OnFirstFrameRenderedListener) fragmentActivity; + activityAsListener.onFirstFrameRendered(); + } + } + }; + public FlutterFragment() { // Ensure that we at least have an empty Bundle of arguments so that we don't // need to continually check for null arguments before grabbing one. setArguments(new Bundle()); } - public void prepareForNavigation() { - flutterView.setAlpha(0.0f); - } - /** * The {@link FlutterEngine} that backs the Flutter content presented by this {@code Fragment}. * @@ -304,6 +316,7 @@ protected void setupFlutterEngine() { @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { flutterView = new FlutterView(getContext(), getRenderMode()); + flutterView.addOnFirstFrameRenderedListener(onFirstFrameRenderedListener); // We post() the code that attaches the FlutterEngine to our FlutterView because there is // some kind of blocking logic on the native side when the surface is connected. That lag @@ -433,6 +446,7 @@ public void onStop() { public void onDestroyView() { super.onDestroyView(); Log.d(TAG, "onDestroyView()"); + flutterView.removeOnFirstFrameRenderedListener(onFirstFrameRenderedListener); flutterView.detachFromFlutterEngine(); } @@ -580,6 +594,16 @@ private Context getContextCompat() { : getActivity(); } + /** + * Invoked after the {@link FlutterView} within this {@code FlutterFragment} renders its first + * frame. + *

    + * The owning {@code Activity} is also sent this message, if it implements + * {@link OnFirstFrameRenderedListener}. This method is invoked before the {@code Activity}'s + * version. + */ + protected void onFirstFrameRendered() {} + /** * Provides a {@link FlutterEngine} instance to be used by a {@code FlutterFragment}. *

    diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java b/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java index ac19c5ae15798..df78c06f9255e 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java @@ -12,7 +12,11 @@ import android.view.SurfaceHolder; import android.view.SurfaceView; +import java.util.HashSet; +import java.util.Set; + import io.flutter.embedding.engine.renderer.FlutterRenderer; +import io.flutter.embedding.engine.renderer.OnFirstFrameRenderedListener; /** * Paints a Flutter UI on a {@link android.view.Surface}. @@ -36,6 +40,8 @@ public class FlutterSurfaceView extends SurfaceView implements FlutterRenderer.R private boolean isAttachedToFlutterRenderer = false; @Nullable private FlutterRenderer flutterRenderer; + @NonNull + private Set onFirstFrameRenderedListeners = new HashSet<>(); // Connects the {@code Surface} beneath this {@code SurfaceView} with Flutter's native code. // Callbacks are received by this Object and then those messages are forwarded to our @@ -177,11 +183,33 @@ private void disconnectSurfaceFromRenderer() { flutterRenderer.surfaceDestroyed(); } + /** + * Adds the given {@code listener} to this {@code FlutterSurfaceView}, to be notified upon Flutter's + * first rendered frame. + */ + @Override + public void addOnFirstFrameRenderedListener(@NonNull OnFirstFrameRenderedListener listener) { + onFirstFrameRenderedListeners.add(listener); + } + + /** + * Removes the given {@code listener}, which was previously added with + * {@link #addOnFirstFrameRenderedListener(OnFirstFrameRenderedListener)}. + */ + @Override + public void removeOnFirstFrameRenderedListener(@NonNull OnFirstFrameRenderedListener listener) { + onFirstFrameRenderedListeners.remove(listener); + } + @Override public void onFirstFrameRendered() { // TODO(mattcarroll): decide where this method should live and what it needs to do. Log.d(TAG, "onFirstFrameRendered()"); // Now that a frame is ready to display, take this SurfaceView from transparent to opaque. setAlpha(1.0f); + + for (OnFirstFrameRenderedListener listener : onFirstFrameRenderedListeners) { + listener.onFirstFrameRendered(); + } } } diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterTextureView.java b/shell/platform/android/io/flutter/embedding/android/FlutterTextureView.java index 32850ff17e875..bf6a4b8497c6a 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterTextureView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterTextureView.java @@ -13,7 +13,11 @@ import android.view.Surface; import android.view.TextureView; +import java.util.HashSet; +import java.util.Set; + import io.flutter.embedding.engine.renderer.FlutterRenderer; +import io.flutter.embedding.engine.renderer.OnFirstFrameRenderedListener; /** * Paints a Flutter UI on a {@link SurfaceTexture}. @@ -37,6 +41,8 @@ public class FlutterTextureView extends TextureView implements FlutterRenderer.R private boolean isAttachedToFlutterRenderer = false; @Nullable private FlutterRenderer flutterRenderer; + @NonNull + private Set onFirstFrameRenderedListeners = new HashSet<>(); // Connects the {@code SurfaceTexture} beneath this {@code TextureView} with Flutter's native code. // Callbacks are received by this Object and then those messages are forwarded to our @@ -181,9 +187,31 @@ private void disconnectSurfaceFromRenderer() { flutterRenderer.surfaceDestroyed(); } + /** + * Adds the given {@code listener} to this {@code FlutterTextureView}, to be notified upon Flutter's + * first rendered frame. + */ + @Override + public void addOnFirstFrameRenderedListener(@NonNull OnFirstFrameRenderedListener listener) { + onFirstFrameRenderedListeners.add(listener); + } + + /** + * Removes the given {@code listener}, which was previously added with + * {@link #addOnFirstFrameRenderedListener(OnFirstFrameRenderedListener)}. + */ + @Override + public void removeOnFirstFrameRenderedListener(@NonNull OnFirstFrameRenderedListener listener) { + onFirstFrameRenderedListeners.remove(listener); + } + @Override public void onFirstFrameRendered() { // TODO(mattcarroll): decide where this method should live and what it needs to do. Log.d(TAG, "onFirstFrameRendered()"); + + for (OnFirstFrameRenderedListener listener : onFirstFrameRenderedListeners) { + listener.onFirstFrameRendered(); + } } } diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/android/FlutterView.java index 8469519b3ee63..b3395b4d24273 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -31,6 +31,7 @@ import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.renderer.FlutterRenderer; +import io.flutter.embedding.engine.renderer.OnFirstFrameRenderedListener; import io.flutter.plugin.editing.TextInputPlugin; import io.flutter.view.AccessibilityBridge; @@ -147,6 +148,22 @@ private void init() { } } + /** + * Adds the given {@code listener} to this {@code FlutterView}, to be notified upon Flutter's + * first rendered frame. + */ + public void addOnFirstFrameRenderedListener(@NonNull OnFirstFrameRenderedListener listener) { + renderSurface.addOnFirstFrameRenderedListener(listener); + } + + /** + * Removes the given {@code listener}, which was previously added with + * {@link #addOnFirstFrameRenderedListener(OnFirstFrameRenderedListener)}. + */ + public void removeOnFirstFrameRenderedListener(@NonNull OnFirstFrameRenderedListener listener) { + renderSurface.removeOnFirstFrameRenderedListener(listener); + } + //------- Start: Process View configuration that Flutter cares about. ------ /** * Sends relevant configuration data from Android to Flutter when the Android 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 5fd3521e545df..2dfac4c67e826 100644 --- a/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java +++ b/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java @@ -267,6 +267,18 @@ public interface RenderSurface { * never be called. */ void onFirstFrameRendered(); + + /** + * Adds the given {@code listener} to this {@code FlutterRenderer}, to be notified upon Flutter's + * first rendered frame. + */ + void addOnFirstFrameRenderedListener(@NonNull OnFirstFrameRenderedListener listener); + + /** + * Removes the given {@code listener}, which was previously added with + * {@link #addOnFirstFrameRenderedListener(OnFirstFrameRenderedListener)}. + */ + void removeOnFirstFrameRenderedListener(@NonNull OnFirstFrameRenderedListener listener); } /** diff --git a/shell/platform/android/io/flutter/view/FlutterNativeView.java b/shell/platform/android/io/flutter/view/FlutterNativeView.java index 2c2b57a5f174a..65622be1f42cd 100644 --- a/shell/platform/android/io/flutter/view/FlutterNativeView.java +++ b/shell/platform/android/io/flutter/view/FlutterNativeView.java @@ -14,6 +14,7 @@ import io.flutter.embedding.engine.dart.DartExecutor; import io.flutter.embedding.engine.renderer.FlutterRenderer; import io.flutter.embedding.engine.renderer.FlutterRenderer.RenderSurface; +import io.flutter.embedding.engine.renderer.OnFirstFrameRenderedListener; import io.flutter.plugin.common.*; import java.nio.ByteBuffer; import java.util.concurrent.atomic.AtomicBoolean; @@ -199,6 +200,12 @@ public void onFirstFrameRendered() { } mFlutterView.onFirstFrame(); } + + @Override + public void addOnFirstFrameRenderedListener(@NonNull OnFirstFrameRenderedListener listener) {} + + @Override + public void removeOnFirstFrameRenderedListener(@NonNull OnFirstFrameRenderedListener listener) {} } private final class EngineLifecycleListenerImpl implements EngineLifecycleListener { From 7fd4caf03736343c2d70d5cd486aa1c8a6d86c60 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 5 Apr 2019 15:56:32 -0700 Subject: [PATCH 0720/1117] Roll src/third_party/dart 1ad11facec..da4ccd0855 (6 commits) da4ccd0855 [analyzer] fix #32918, eliminate type variables during const inference 0e7bec7d2f Add validation for AndroidManifest.xml files ca4e707e80 Fix AvailableSuggestionSetsTest on Windows. d4c61411f3 Update bug number to reflect deprioritized bug ee248fef23 Add a fix for using relative imports when the missing import is in the same library. 07482eeb5e [bots] Run all tests on vm-dartkb-* bots --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index deb0ff1f6680f..b0fc6b47069d2 100644 --- a/DEPS +++ b/DEPS @@ -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': '1ad11facec401ed51a8bdf79dafd77e955b23082', + 'dart_revision': 'da4ccd08559c0252312c5f3d5cbb7c8b9460b9e5', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py From 0c2a2c1c445369dd90664a4067be83ba26fa5567 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Fri, 5 Apr 2019 18:34:05 -0700 Subject: [PATCH 0721/1117] Initialize OpacityLayer's matrix to identity (#8467) Should have https://github.com/flutter/flutter/issues/30586 fixed once the engine rolls. --- flow/layers/opacity_layer.cc | 7 +++++++ flow/layers/transform_layer.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/flow/layers/opacity_layer.cc b/flow/layers/opacity_layer.cc index 436a88594a807..99c705d8d5440 100644 --- a/flow/layers/opacity_layer.cc +++ b/flow/layers/opacity_layer.cc @@ -20,6 +20,13 @@ void OpacityLayer::EnsureSingleChild() { } auto new_child = std::make_shared(); + + // Be careful: SkMatrix's default constructor doesn't initialize the matrix to + // identity. Hence we have to explicitly call SkMatrix::setIdentity. + SkMatrix identity; + identity.setIdentity(); + + new_child->set_transform(identity); for (auto& child : layers()) { new_child->Add(child); } diff --git a/flow/layers/transform_layer.h b/flow/layers/transform_layer.h index b1fb830bf2b9d..ea5250662b361 100644 --- a/flow/layers/transform_layer.h +++ b/flow/layers/transform_layer.h @@ -9,6 +9,8 @@ namespace flow { +// Be careful that SkMatrix's default constructor doesn't initialize the matrix +// at all. Hence |set_transform| must be called with an initialized SkMatrix. class TransformLayer : public ContainerLayer { public: TransformLayer(); From d6cf2bda1d3db3a0299e66a37755b26ee2d398e9 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 5 Apr 2019 19:04:00 -0700 Subject: [PATCH 0722/1117] Roll src/third_party/dart da4ccd0855..9e1adc54a7 (3 commits) 9e1adc54a7 [vm] When loading a compilation trace, speculatively populate ICData based on the receiver's static type. f93b93dd91 [dartdevc] fix string escaping for string_literal_test 4b9b8562c6 Update expectation for conditional expression and constant_update_2018. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index b0fc6b47069d2..7da06138ac3ac 100644 --- a/DEPS +++ b/DEPS @@ -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': 'da4ccd08559c0252312c5f3d5cbb7c8b9460b9e5', + 'dart_revision': '9e1adc54a756f4abf165fba6bd46ad8cc769ff4f', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index cc55ff37f40f5..d5cdb761d807a 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: a8a4c10952be81c36641faedbc1b238f +Signature: c982041ba3e409f92b651d01e865d074 UNUSED LICENSES: From fea42a25960c07648da5d7a85ef1d32723120abd Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 5 Apr 2019 22:03:19 -0700 Subject: [PATCH 0723/1117] Roll src/third_party/dart 9e1adc54a7..389ccc9000 (10 commits) 389ccc9000 when analyzing fuchsia workspaces, expect to find .fx-build-dir files a47b4ad2b8 Bring dart_style 1.2.7 into the SDK repo. e5d78513a1 [dartdevc] Hoisting covariance checks for generators outside of the body. 73b931b6e6 Start reworking to use actual AST nodes created lazily. fd2393d6d3 [dart/fuzzer] Re-enable optimization_counter_threshold testing 8e6851f0e4 [vm] Don't create edge counter arrays when edge counters are disabled. 90c757c766 [vm, interpreter] Allocation fast paths. 43046b7f7c [vm/bytecode] Enable building of kernel service snapshot 7beed016a0 [vm/bytecode] Add 'bytecode' into snapshot feature flags cf04a16527 dartfix to migrate to spread collections --- DEPS | 4 ++-- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 7da06138ac3ac..6ca5c041497bb 100644 --- a/DEPS +++ b/DEPS @@ -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': '9e1adc54a756f4abf165fba6bd46ad8cc769ff4f', + 'dart_revision': '389ccc90007ab49425530216e13199f52c177246', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -48,7 +48,7 @@ vars = { 'dart_crypto_tag': '2.0.6', 'dart_csslib_tag': '0.14.4+1', 'dart_dart2js_info_tag': '0.6.0', - 'dart_dart_style_tag': '1.2.6', + 'dart_dart_style_tag': '1.2.7', 'dart_dartdoc_tag': 'v0.28.2', 'dart_fixnum_tag': '0.10.9', 'dart_glob_tag': '1.1.7', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index d5cdb761d807a..e44f48ba8653e 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: c982041ba3e409f92b651d01e865d074 +Signature: aad6f00938e9ac93307738cd263cb96a UNUSED LICENSES: From 0c393d64e4d1c4cd408a591eac72ba05cdc2c0da Mon Sep 17 00:00:00 2001 From: liyuqian Date: Sat, 6 Apr 2019 15:04:05 -0700 Subject: [PATCH 0724/1117] Roll dart back to 907c514c8937cf76e (#8473) The dart revision 1ad11facec401ed51a8bdf79dafd77e955b23082 (rolled in https://github.com/flutter/engine/pull/8459) is causing engine-to-framework roll failure for the following two reasons: 1. analyze error: marked @mustCallSuper but does not invoke the overridden method 2. `flutter build aot` failure for examples/hello_world in build_tests-macos The 1. is likely due to https://github.com/dart-lang/sdk/commit/1ad11facec401ed51a8bdf79dafd77e955b23082 and it easy to fix in the framework. However, the 2. is likely due to https://github.com/dart-lang/sdk/commit/dbfd00f44daf67e5f42f4d297d77be3237b8a35d which I'm not sure how to fix. TBR: bkonyi --- DEPS | 4 ++-- ci/licenses_golden/licenses_third_party | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index 6ca5c041497bb..42ca7b7605c96 100644 --- a/DEPS +++ b/DEPS @@ -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': '389ccc90007ab49425530216e13199f52c177246', + 'dart_revision': '907c514c8937cf76e825d427364cf3475797f18f', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -60,7 +60,7 @@ vars = { 'dart_http_throttle_tag': '1.0.2', 'dart_intl_tag': '0.15.7', 'dart_json_rpc_2_tag': '2.0.9', - 'dart_linter_tag': '0.1.84', + 'dart_linter_tag': '0.1.83', 'dart_logging_tag': '0.11.3+2', 'dart_markdown_tag': '2.0.2', 'dart_matcher_tag': '0.12.3', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index e44f48ba8653e..e8ca9564ad9f5 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: aad6f00938e9ac93307738cd263cb96a +Signature: cbf8e245ca4d75c5fd125ab57b6b730e UNUSED LICENSES: @@ -5155,7 +5155,6 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/backend/il_test_helper.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/il_test_helper.h FILE: ../../../third_party/dart/runtime/vm/compiler/backend/slot_test.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/type_propagator_test.cc -FILE: ../../../third_party/dart/runtime/vm/compiler/backend/typed_data_aot_test.cc FILE: ../../../third_party/dart/runtime/vm/compiler/ffi.cc FILE: ../../../third_party/dart/runtime/vm/compiler/ffi.h FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier.cc From ff1bcdc00941188ba27123a4857b443e3c9392bb Mon Sep 17 00:00:00 2001 From: David Worsham Date: Sun, 7 Apr 2019 01:18:59 -0700 Subject: [PATCH 0725/1117] Add Views V2 support for Fuchsia (#8115) --- ci/licenses_golden/licenses_flutter | 2 + flow/BUILD.gn | 8 +- flow/export_node.cc | 115 +++++++------- flow/export_node.h | 79 +++------- flow/layers/child_scene_layer.cc | 36 +++-- flow/layers/child_scene_layer.h | 28 ++-- flow/scene_update_context.cc | 66 +++------ flow/scene_update_context.h | 37 ++--- flow/view_holder.cc | 151 +++++++++++++++++++ flow/view_holder.h | 75 ++++++++++ fml/command_line.h | 6 +- lib/stub_ui/lib/compositing.dart | 18 +++ lib/ui/BUILD.gn | 14 +- lib/ui/compositing.dart | 27 ++++ lib/ui/compositing/scene_builder.cc | 33 +++-- lib/ui/compositing/scene_builder.h | 8 +- lib/ui/compositing/scene_host.cc | 222 +++++++++++++++++++++++++--- lib/ui/compositing/scene_host.h | 74 +++++----- lib/ui/dart_ui.cc | 8 +- 19 files changed, 709 insertions(+), 298 deletions(-) create mode 100644 flow/view_holder.cc create mode 100644 flow/view_holder.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 5715a8445f803..720b26d9908aa 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -117,6 +117,8 @@ 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/flow/view_holder.cc +FILE: ../../../flutter/flow/view_holder.h FILE: ../../../flutter/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart FILE: ../../../flutter/fml/arraysize.h FILE: ../../../flutter/fml/base32.cc diff --git a/flow/BUILD.gn b/flow/BUILD.gn index 7f7fb87ef7958..23fc36d3a8b84 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -77,15 +77,17 @@ source_set("flow") { "layers/child_scene_layer.h", "scene_update_context.cc", "scene_update_context.h", + "view_holder.cc", + "view_holder.h", ] public_deps += [ - "//garnet/public/lib/ui/scenic/cpp", "//sdk/fidl/fuchsia.ui.scenic", + "//sdk/fidl/fuchsia.ui.views", + "//sdk/lib/ui/scenic/cpp", "//topaz/public/dart-pkg/zircon", + "//zircon/public/lib/zx", ] - - public_deps += [ "//zircon/public/lib/zx" ] } } diff --git a/flow/export_node.cc b/flow/export_node.cc index acf7e42da3215..9895369f4d250 100644 --- a/flow/export_node.cc +++ b/flow/export_node.cc @@ -4,81 +4,82 @@ #include "flutter/flow/export_node.h" -#include "flutter/fml/make_copyable.h" +#include "flutter/fml/thread_local.h" + +namespace { + +using ExportNodeBindings = + std::unordered_map>; + +FML_THREAD_LOCAL fml::ThreadLocal tls_export_node_bindings([](intptr_t value) { + delete reinterpret_cast(value); +}); + +} // namespace namespace flow { -ExportNodeHolder::ExportNodeHolder( - fml::RefPtr gpu_task_runner, - fml::RefPtr export_token_handle) - : gpu_task_runner_(std::move(gpu_task_runner)), - export_node_(std::make_unique(export_token_handle)) { - FML_DCHECK(gpu_task_runner_); +ExportNode::ExportNode(zx::eventpair export_token) + : pending_export_token_(std::move(export_token)) { + FML_DCHECK(pending_export_token_); } -void ExportNodeHolder::Bind(SceneUpdateContext& context, - scenic::ContainerNode& container, - const SkPoint& offset, - bool hit_testable) { - export_node_->Bind(context, container, offset, hit_testable); -} +void ExportNode::Create(zx_koid_t id, zx::eventpair export_token) { + // This GPU thread contains at least 1 ViewHolder. Initialize the per-thread + // bindings. + if (tls_export_node_bindings.Get() == 0) { + tls_export_node_bindings.Set( + reinterpret_cast(new ExportNodeBindings())); + } -ExportNodeHolder::~ExportNodeHolder() { - gpu_task_runner_->PostTask( - fml::MakeCopyable([export_node = std::move(export_node_)]() { - export_node->Dispose(true); - })); + auto* bindings = + reinterpret_cast(tls_export_node_bindings.Get()); + FML_DCHECK(bindings); + FML_DCHECK(bindings->find(id) == bindings->end()); + + auto export_node = + std::unique_ptr(new ExportNode(std::move(export_token))); + bindings->emplace(id, std::move(export_node)); } -ExportNode::ExportNode(fml::RefPtr export_token_handle) - : export_token_(export_token_handle->ReleaseHandle()) {} +void ExportNode::Destroy(zx_koid_t id) { + auto* bindings = + reinterpret_cast(tls_export_node_bindings.Get()); + FML_DCHECK(bindings); -ExportNode::~ExportNode() { - // Ensure that we properly released the node. - FML_DCHECK(!node_); - FML_DCHECK(scene_update_context_ == nullptr); + bindings->erase(id); } -void ExportNode::Bind(SceneUpdateContext& context, - scenic::ContainerNode& container, - const SkPoint& offset, - bool hit_testable) { - if (export_token_) { - // Happens first time we bind. - node_.reset(new scenic::EntityNode(container.session())); - node_->Export(std::move(export_token_)); - - // Add ourselves to the context so it can call Dispose() on us if the Scenic - // session is closed. - context.AddExportNode(this); - scene_update_context_ = &context; +ExportNode* ExportNode::FromId(zx_koid_t id) { + auto* bindings = + reinterpret_cast(tls_export_node_bindings.Get()); + if (!bindings) { + return nullptr; } - if (node_) { - container.AddChild(*node_); - node_->SetTranslation(offset.x(), offset.y(), 0.f); - node_->SetHitTestBehavior( - hit_testable ? fuchsia::ui::gfx::HitTestBehavior::kDefault - : fuchsia::ui::gfx::HitTestBehavior::kSuppress); + auto binding = bindings->find(id); + if (binding == bindings->end()) { + return nullptr; } + + return binding->second.get(); } -void ExportNode::Dispose(bool remove_from_scene_update_context) { - // If scene_update_context_ is set, then we should still have a node left to - // dereference. - // If scene_update_context_ is null, then either: - // 1. A node was never created, or - // 2. A node was created but was already dereferenced (i.e. Dispose has - // already been called). - FML_DCHECK(scene_update_context_ || !node_); - - if (remove_from_scene_update_context && scene_update_context_) { - scene_update_context_->RemoveExportNode(this); +void ExportNode::UpdateScene(SceneUpdateContext& context, + const SkPoint& offset, + const SkSize& size, + bool hit_testable) { + if (pending_export_token_) { + export_node_ = std::make_unique(context.session()); + export_node_->Export(std::move(pending_export_token_)); } + FML_DCHECK(export_node_); - scene_update_context_ = nullptr; - export_token_.reset(); - node_ = nullptr; + context.top_entity()->entity_node().AddChild(*export_node_); + export_node_->SetTranslation(offset.x(), offset.y(), -0.1f); + export_node_->SetHitTestBehavior( + hit_testable ? fuchsia::ui::gfx::HitTestBehavior::kDefault + : fuchsia::ui::gfx::HitTestBehavior::kSuppress); } } // namespace flow diff --git a/flow/export_node.h b/flow/export_node.h index 50df904bc4116..3b232abdcf18d 100644 --- a/flow/export_node.h +++ b/flow/export_node.h @@ -5,75 +5,42 @@ #ifndef FLUTTER_FLOW_EXPORT_NODE_H_ #define FLUTTER_FLOW_EXPORT_NODE_H_ -#include - +#include #include +#include +#include +#include +#include + +#include -#include "dart-pkg/zircon/sdk_ext/handle.h" #include "flutter/flow/scene_update_context.h" -#include "flutter/fml/build_config.h" #include "flutter/fml/macros.h" -#include "flutter/fml/memory/ref_counted.h" -#include "lib/ui/scenic/cpp/resources.h" -#include "third_party/flutter/fml/task_runner.h" -#include "third_party/skia/include/core/SkPoint.h" namespace flow { -// Wrapper class for ExportNode to use on UI Thread. When ExportNodeHolder is -// destroyed, a task is posted on the Rasterizer thread to dispose the resources -// held by the ExportNode. -class ExportNodeHolder : public fml::RefCountedThreadSafe { - public: - ExportNodeHolder(fml::RefPtr gpu_task_runner, - fml::RefPtr export_token_handle); - ~ExportNodeHolder(); - - // Calls Bind() on the wrapped ExportNode. - void Bind(SceneUpdateContext& context, - scenic::ContainerNode& container, - const SkPoint& offset, - bool hit_testable); - - ExportNode* export_node() { return export_node_.get(); } - - private: - fml::RefPtr gpu_task_runner_; - std::unique_ptr export_node_; - - FML_FRIEND_MAKE_REF_COUNTED(ExportNodeHolder); - FML_FRIEND_REF_COUNTED_THREAD_SAFE(ExportNodeHolder); - FML_DISALLOW_COPY_AND_ASSIGN(ExportNodeHolder); -}; - -// Represents a node which is being exported from the session. -// This object is created on the UI thread but the entity node it contains -// must be created and destroyed by the rasterizer thread. +// Represents a Scenic |ExportNode| resource that exports an |EntityNode| to +// another session. +// +// This object is created and destroyed on the |Rasterizer|'s' thread. class ExportNode { public: - ExportNode(fml::RefPtr export_token_handle); - - ~ExportNode(); + static void Create(zx_koid_t id, zx::eventpair export_token); + static void Destroy(zx_koid_t id); + static ExportNode* FromId(zx_koid_t id); - // Binds the export token to the entity node and adds it as a child of - // the specified container. Must be called on the Rasterizer thread. - void Bind(SceneUpdateContext& context, - scenic::ContainerNode& container, - const SkPoint& offset, - bool hit_testable); + // Creates or updates the contained EntityNode resource using the specified + // |SceneUpdateContext|. + void UpdateScene(SceneUpdateContext& context, + const SkPoint& offset, + const SkSize& size, + bool hit_testable); private: - friend class SceneUpdateContext; - friend class ExportNodeHolder; - - // Cleans up resources held and removes this ExportNode from - // SceneUpdateContext. Must be called on the Rasterizer thread. - void Dispose(bool remove_from_scene_update_context); + ExportNode(zx::eventpair export_token); - // Member variables can only be read or modified on Rasterizer thread. - SceneUpdateContext* scene_update_context_ = nullptr; - zx::eventpair export_token_; - std::unique_ptr node_; + zx::eventpair pending_export_token_; + std::unique_ptr export_node_; FML_DISALLOW_COPY_AND_ASSIGN(ExportNode); }; diff --git a/flow/layers/child_scene_layer.cc b/flow/layers/child_scene_layer.cc index 162a8d1a4df50..a1391da09e18d 100644 --- a/flow/layers/child_scene_layer.cc +++ b/flow/layers/child_scene_layer.cc @@ -4,31 +4,43 @@ #include "flutter/flow/layers/child_scene_layer.h" -namespace flow { +#include "flutter/flow/export_node.h" +#include "flutter/flow/view_holder.h" -ChildSceneLayer::ChildSceneLayer() = default; +namespace flow { -ChildSceneLayer::~ChildSceneLayer() = default; +ChildSceneLayer::ChildSceneLayer(zx_koid_t layer_id, + bool use_view_holder, + const SkPoint& offset, + const SkSize& size, + bool hit_testable) + : layer_id_(layer_id), + offset_(offset), + size_(size), + hit_testable_(hit_testable), + use_view_holder_(use_view_holder) {} void ChildSceneLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { set_needs_system_composite(true); } void ChildSceneLayer::Paint(PaintContext& context) const { - FXL_NOTREACHED() << "This layer never needs painting."; + FML_NOTREACHED() << "This layer never needs painting."; } void ChildSceneLayer::UpdateScene(SceneUpdateContext& context) { FML_DCHECK(needs_system_composite()); - // TODO(MZ-191): Set clip. - // It's worth asking whether all children should be clipped implicitly - // or whether we should leave this up to the Flutter application to decide. - // In some situations, it might be useful to allow children to draw - // outside of their layout bounds. - if (export_node_holder_) { - context.AddChildScene(export_node_holder_->export_node(), offset_, - hit_testable_); + if (use_view_holder_) { + auto* view_holder = ViewHolder::FromId(layer_id_); + FML_DCHECK(view_holder); + + view_holder->UpdateScene(context, offset_, size_, hit_testable_); + } else { + auto* export_node = ExportNode::FromId(layer_id_); + FML_DCHECK(export_node); + + export_node->UpdateScene(context, offset_, size_, hit_testable_); } } diff --git a/flow/layers/child_scene_layer.h b/flow/layers/child_scene_layer.h index 89fd367a0e69b..da7caa4086db5 100644 --- a/flow/layers/child_scene_layer.h +++ b/flow/layers/child_scene_layer.h @@ -5,27 +5,24 @@ #ifndef FLUTTER_FLOW_LAYERS_CHILD_SCENE_LAYER_H_ #define FLUTTER_FLOW_LAYERS_CHILD_SCENE_LAYER_H_ -#include "flutter/flow/export_node.h" +#include +#include +#include + #include "flutter/flow/layers/layer.h" +#include "flutter/flow/scene_update_context.h" namespace flow { // Layer that represents an embedded child. class ChildSceneLayer : public Layer { public: - ChildSceneLayer(); - ~ChildSceneLayer() override; - - void set_offset(const SkPoint& offset) { offset_ = offset; } - - void set_size(const SkSize& size) { size_ = size; } - - void set_export_node_holder( - fml::RefPtr export_node_holder) { - export_node_holder_ = std::move(export_node_holder); - } - - void set_hit_testable(bool hit_testable) { hit_testable_ = hit_testable; } + ChildSceneLayer(zx_koid_t layer_id, + bool use_view_holder, + const SkPoint& offset, + const SkSize& size, + bool hit_testable); + ~ChildSceneLayer() override = default; void Preroll(PrerollContext* context, const SkMatrix& matrix) override; @@ -34,10 +31,11 @@ class ChildSceneLayer : public Layer { void UpdateScene(SceneUpdateContext& context) override; private: + zx_koid_t layer_id_ = ZX_KOID_INVALID; SkPoint offset_; SkSize size_; - fml::RefPtr export_node_holder_; bool hit_testable_ = true; + bool use_view_holder_ = true; FML_DISALLOW_COPY_AND_ASSIGN(ChildSceneLayer); }; diff --git a/flow/scene_update_context.cc b/flow/scene_update_context.cc index c663d5633e17c..11cda2a4edbd0 100644 --- a/flow/scene_update_context.cc +++ b/flow/scene_update_context.cc @@ -4,42 +4,12 @@ #include "flutter/flow/scene_update_context.h" -#include "flutter/flow/export_node.h" #include "flutter/flow/layers/layer.h" #include "flutter/flow/matrix_decomposition.h" #include "flutter/fml/trace_event.h" namespace flow { -SceneUpdateContext::SceneUpdateContext(scenic::Session* session, - SurfaceProducer* surface_producer) - : session_(session), surface_producer_(surface_producer) { - FML_DCHECK(surface_producer_ != nullptr); -} - -SceneUpdateContext::~SceneUpdateContext() { - // Release Mozart session resources for all ExportNodes. - for (auto export_node : export_nodes_) { - export_node->Dispose(false); - } -}; - -void SceneUpdateContext::AddChildScene(ExportNode* export_node, - SkPoint offset, - bool hit_testable) { - FML_DCHECK(top_entity_); - - export_node->Bind(*this, top_entity_->entity_node(), offset, hit_testable); -} - -void SceneUpdateContext::AddExportNode(ExportNode* export_node) { - export_nodes_.insert(export_node); // Might already have been added. -} - -void SceneUpdateContext::RemoveExportNode(ExportNode* export_node) { - export_nodes_.erase(export_node); -} - // Helper function to generate clip planes for a scenic::EntityNode. static void SetEntityNodeClipPlanes(scenic::EntityNode* entity_node, const SkRect& bounds) { @@ -79,6 +49,12 @@ static void SetEntityNodeClipPlanes(scenic::EntityNode* entity_node, entity_node->SetClipPlanes(std::move(clip_planes)); } +SceneUpdateContext::SceneUpdateContext(scenic::Session* session, + SurfaceProducer* surface_producer) + : session_(session), surface_producer_(surface_producer) { + FML_DCHECK(surface_producer_ != nullptr); +} + void SceneUpdateContext::CreateFrame( std::unique_ptr entity_node, std::unique_ptr shape_node, @@ -256,21 +232,6 @@ SceneUpdateContext::Entity::~Entity() { context_.top_entity_ = previous_entity_; } -SceneUpdateContext::Clip::Clip(SceneUpdateContext& context, - scenic::Shape& shape, - const SkRect& shape_bounds) - : Entity(context) { - shape_node().SetShape(shape); - shape_node().SetTranslationRH( - shape_bounds.width() * 0.5f + shape_bounds.left(), - shape_bounds.height() * 0.5f + shape_bounds.top(), 0.f); - entity_node().SetClip(0u, true /* clip to self */); - - SetEntityNodeClipPlanes(&entity_node(), shape_bounds); -} - -SceneUpdateContext::Clip::~Clip() = default; - SceneUpdateContext::Transform::Transform(SceneUpdateContext& context, const SkMatrix& transform) : Entity(context), @@ -283,7 +244,7 @@ SceneUpdateContext::Transform::Transform(SceneUpdateContext& context, if (decomposition.IsValid()) { entity_node().SetTranslation(decomposition.translation().x(), // decomposition.translation().y(), // - decomposition.translation().z() // + -decomposition.translation().z() // ); entity_node().SetScale(decomposition.scale().x(), // @@ -347,4 +308,17 @@ void SceneUpdateContext::Frame::AddPaintLayer(Layer* layer) { paint_bounds_.join(layer->paint_bounds()); } +SceneUpdateContext::Clip::Clip(SceneUpdateContext& context, + scenic::Shape& shape, + const SkRect& shape_bounds) + : Entity(context) { + shape_node().SetShape(shape); + shape_node().SetTranslationRH( + shape_bounds.width() * 0.5f + shape_bounds.left(), + shape_bounds.height() * 0.5f + shape_bounds.top(), 0.f); + entity_node().SetClip(0u, true /* clip to self */); + + SetEntityNodeClipPlanes(&entity_node(), shape_bounds); +} + } // namespace flow diff --git a/flow/scene_update_context.h b/flow/scene_update_context.h index def6d441547b5..f19c5b8f76e4e 100644 --- a/flow/scene_update_context.h +++ b/flow/scene_update_context.h @@ -11,7 +11,6 @@ #include "flutter/flow/compositor_context.h" #include "flutter/flow/raster_cache_key.h" -#include "flutter/fml/build_config.h" #include "flutter/fml/compiler_specific.h" #include "flutter/fml/logging.h" #include "flutter/fml/macros.h" @@ -22,8 +21,6 @@ namespace flow { class Layer; -class ExportNodeHolder; -class ExportNode; class SceneUpdateContext { public: @@ -93,14 +90,6 @@ class SceneUpdateContext { std::unique_ptr shape_node_ptr_; }; - class Clip : public Entity { - public: - Clip(SceneUpdateContext& context, - scenic::Shape& shape, - const SkRect& shape_bounds); - ~Clip(); - }; - class Transform : public Entity { public: Transform(SceneUpdateContext& context, const SkMatrix& transform); @@ -139,10 +128,17 @@ class SceneUpdateContext { Layer* layer_; }; + class Clip : public Entity { + public: + Clip(SceneUpdateContext& context, + scenic::Shape& shape, + const SkRect& shape_bounds); + ~Clip() = default; + }; + SceneUpdateContext(scenic::Session* session, SurfaceProducer* surface_producer); - - ~SceneUpdateContext(); + ~SceneUpdateContext() = default; scenic::Session* session() { return session_; } @@ -154,18 +150,6 @@ class SceneUpdateContext { } const fuchsia::ui::gfx::MetricsPtr& metrics() const { return metrics_; } - void AddChildScene(ExportNode* export_node, - SkPoint offset, - bool hit_testable); - - // Adds reference to |export_node| so we can call export_node->Dispose() in - // our destructor. Caller is responsible for calling RemoveExportNode() before - // |export_node| is destroyed. - void AddExportNode(ExportNode* export_node); - - // Removes reference to |export_node|. - void RemoveExportNode(ExportNode* export_node); - // TODO(chinmaygarde): This method must submit the surfaces as soon as paint // tasks are done. However, given that there is no support currently for // Vulkan semaphores, we need to submit all the surfaces after an explicit @@ -243,9 +227,6 @@ class SceneUpdateContext { std::vector paint_tasks_; - // Save ExportNodes so we can dispose them in our destructor. - std::set export_nodes_; - FML_DISALLOW_COPY_AND_ASSIGN(SceneUpdateContext); }; diff --git a/flow/view_holder.cc b/flow/view_holder.cc new file mode 100644 index 0000000000000..129f843724da5 --- /dev/null +++ b/flow/view_holder.cc @@ -0,0 +1,151 @@ +// Copyright 2013 The Flutter 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/view_holder.h" + +#include "flutter/fml/thread_local.h" + +namespace { + +using ViewHolderBindings = + std::unordered_map>; + +FML_THREAD_LOCAL fml::ThreadLocal tls_view_holder_bindings([](intptr_t value) { + delete reinterpret_cast(value); +}); + +fuchsia::ui::gfx::ViewProperties ToViewProperties(float width, + float height, + float insetTop, + float insetRight, + float insetBottom, + float insetLeft, + bool focusable) { + return fuchsia::ui::gfx::ViewProperties({ + .bounding_box = fuchsia::ui::gfx::BoundingBox({ + .min = fuchsia::ui::gfx::vec3({ + .x = 0.f, + .y = 0.f, + .z = -1000.f, + }), + .max = fuchsia::ui::gfx::vec3({.x = width, .y = height, .z = 0.f}), + }), + .inset_from_min = fuchsia::ui::gfx::vec3({ + .x = insetLeft, + .y = insetTop, + .z = 0.f, + }), + .inset_from_max = fuchsia::ui::gfx::vec3({ + .x = insetRight, + .y = insetBottom, + .z = 0.f, + }), + .focus_change = focusable, + }); +} + +} // namespace + +namespace flow { + +ViewHolder::ViewHolder(fml::RefPtr ui_task_runner, + fuchsia::ui::views::ViewHolderToken view_holder_token, + BindCallback on_bind_callback) + : pending_view_holder_token_(std::move(view_holder_token)), + ui_task_runner_(std::move(ui_task_runner)), + pending_bind_callback_(std::move(on_bind_callback)) { + FML_DCHECK(pending_view_holder_token_.value); + FML_DCHECK(ui_task_runner_); +} + +void ViewHolder::Create(zx_koid_t id, + fml::RefPtr ui_task_runner, + fuchsia::ui::views::ViewHolderToken view_holder_token, + BindCallback on_bind_callback) { + // This GPU thread contains at least 1 ViewHolder. Initialize the per-thread + // bindings. + if (tls_view_holder_bindings.Get() == 0) { + tls_view_holder_bindings.Set( + reinterpret_cast(new ViewHolderBindings())); + } + + auto* bindings = + reinterpret_cast(tls_view_holder_bindings.Get()); + FML_DCHECK(bindings); + FML_DCHECK(bindings->find(id) == bindings->end()); + + auto view_holder = std::unique_ptr( + new ViewHolder(std::move(ui_task_runner), std::move(view_holder_token), + std::move(on_bind_callback))); + bindings->emplace(id, std::move(view_holder)); +} + +void ViewHolder::Destroy(zx_koid_t id) { + auto* bindings = + reinterpret_cast(tls_view_holder_bindings.Get()); + FML_DCHECK(bindings); + + bindings->erase(id); +} + +ViewHolder* ViewHolder::FromId(zx_koid_t id) { + auto* bindings = + reinterpret_cast(tls_view_holder_bindings.Get()); + if (!bindings) { + return nullptr; + } + + auto binding = bindings->find(id); + if (binding == bindings->end()) { + return nullptr; + } + + return binding->second.get(); +} + +void ViewHolder::UpdateScene(SceneUpdateContext& context, + const SkPoint& offset, + const SkSize& size, + bool hit_testable) { + if (pending_view_holder_token_.value) { + entity_node_ = std::make_unique(context.session()); + view_holder_ = std::make_unique( + context.session(), std::move(pending_view_holder_token_), + "Flutter SceneHost"); + + entity_node_->Attach(*view_holder_); + ui_task_runner_->PostTask( + [bind_callback = std::move(pending_bind_callback_), + view_holder_id = view_holder_->id()]() { + bind_callback(view_holder_id); + }); + } + FML_DCHECK(entity_node_); + FML_DCHECK(view_holder_); + + context.top_entity()->entity_node().AddChild(*entity_node_); + entity_node_->SetTranslation(offset.x(), offset.y(), -0.1f); + entity_node_->SetHitTestBehavior( + hit_testable ? fuchsia::ui::gfx::HitTestBehavior::kDefault + : fuchsia::ui::gfx::HitTestBehavior::kSuppress); + if (has_pending_properties_) { + view_holder_->SetViewProperties(std::move(pending_properties_)); + + has_pending_properties_ = false; + } +} + +void ViewHolder::SetProperties(double width, + double height, + double insetTop, + double insetRight, + double insetBottom, + double insetLeft, + bool focusable) { + pending_properties_ = ToViewProperties(width, height, insetTop, insetRight, + insetBottom, insetLeft, focusable); + has_pending_properties_ = true; +} + +} // namespace flow diff --git a/flow/view_holder.h b/flow/view_holder.h new file mode 100644 index 0000000000000..2695ab86c6695 --- /dev/null +++ b/flow/view_holder.h @@ -0,0 +1,75 @@ +// Copyright 2013 The Flutter 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_VIEW_HOLDER_H_ +#define FLUTTER_FLOW_VIEW_HOLDER_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "flutter/flow/scene_update_context.h" +#include "flutter/fml/macros.h" +#include "flutter/fml/memory/ref_counted.h" +#include "flutter/fml/task_runner.h" + +namespace flow { + +// Represents a Scenic |ViewHolder| resource that imports a |View| from another +// session. +// +// This object is created and destroyed on the |Rasterizer|'s thread. +class ViewHolder { + public: + using BindCallback = std::function; + + static void Create(zx_koid_t id, + fml::RefPtr ui_task_runner, + fuchsia::ui::views::ViewHolderToken view_holder_token, + BindCallback on_bind_callback); + static void Destroy(zx_koid_t id); + static ViewHolder* FromId(zx_koid_t id); + + // Sets the properties of the child view by issuing a Scenic command. + void SetProperties(double width, + double height, + double insetTop, + double insetRight, + double insetBottom, + double insetLeft, + bool focusable); + + // Creates or updates the contained ViewHolder resource using the specified + // |SceneUpdateContext|. + void UpdateScene(SceneUpdateContext& context, + const SkPoint& offset, + const SkSize& size, + bool hit_testable); + + private: + ViewHolder(fml::RefPtr ui_task_runner, + fuchsia::ui::views::ViewHolderToken view_holder_token, + BindCallback on_bind_callback); + + fuchsia::ui::gfx::ViewProperties pending_properties_; + fuchsia::ui::views::ViewHolderToken pending_view_holder_token_; + fml::RefPtr ui_task_runner_; + std::unique_ptr entity_node_; + std::unique_ptr view_holder_; + BindCallback pending_bind_callback_; + bool has_pending_properties_ = false; + + FML_DISALLOW_COPY_AND_ASSIGN(ViewHolder); +}; + +} // namespace flow + +#endif // FLUTTER_FLOW_VIEW_HOLDER_H_ diff --git a/fml/command_line.h b/fml/command_line.h index e1d06e6e6bed5..ea25151641ddd 100644 --- a/fml/command_line.h +++ b/fml/command_line.h @@ -33,8 +33,8 @@ // mostly explains a.), c. it makes parsing "subcommands", like "my_program // --flag_for_my_program subcommand --flag_for_subcommand" saner. -#ifndef LIB_FXL_COMMAND_LINE_H_ -#define LIB_FXL_COMMAND_LINE_H_ +#ifndef LIB_FML_COMMAND_LINE_H_ +#define LIB_FML_COMMAND_LINE_H_ #include @@ -239,4 +239,4 @@ std::vector CommandLineToArgv(const CommandLine& command_line); } // namespace fml -#endif // LIB_FXL_COMMAND_LINE_H_ +#endif // LIB_FML_COMMAND_LINE_H_ diff --git a/lib/stub_ui/lib/compositing.dart b/lib/stub_ui/lib/compositing.dart index 021977a761f29..01257b99fd059 100644 --- a/lib/stub_ui/lib/compositing.dart +++ b/lib/stub_ui/lib/compositing.dart @@ -318,6 +318,11 @@ class SceneHost { /// /// The scene host takes ownership of the provided export token handle. SceneHost(dynamic exportTokenHandle); + SceneHost.fromViewHolderToken( + dynamic viewHolderTokenHandle, + void Function() viewConnectedCallback, + void Function() viewDisconnectedCallback, + void Function(bool) viewStateChangedCallback); /// Releases the resources associated with the child scene host. /// @@ -325,4 +330,17 @@ class SceneHost { void dispose() { throw UnimplementedError(); } + + /// Set properties on the linked scene. These properties include its bounds, + /// as well as whether it can be the target of focus events or not. + void setProperties( + double width, + double height, + double insetTop, + double insetRight, + double insetBottom, + double insetLeft, + bool focusable) { + throw UnimplementedError(); + } } diff --git a/lib/ui/BUILD.gn b/lib/ui/BUILD.gn index cba7632ce0b60..51dd35ccfbea8 100644 --- a/lib/ui/BUILD.gn +++ b/lib/ui/BUILD.gn @@ -8,8 +8,6 @@ source_set("ui") { "compositing/scene.h", "compositing/scene_builder.cc", "compositing/scene_builder.h", - "compositing/scene_host.cc", - "compositing/scene_host.h", "dart_runtime_hooks.cc", "dart_runtime_hooks.h", "dart_ui.cc", @@ -115,11 +113,17 @@ source_set("ui") { "//third_party/skia", "//third_party/tonic", ] - if (is_fuchsia) { - deps += [ "//topaz/public/dart-pkg/zircon" ] - } public_deps = [ "$flutter_root/third_party/txt", ] + + if (is_fuchsia) { + sources += [ + "compositing/scene_host.cc", + "compositing/scene_host.h", + ] + + deps += [ "//topaz/public/dart-pkg/zircon" ] + } } diff --git a/lib/ui/compositing.dart b/lib/ui/compositing.dart index 9eb7c317485b0..8b3f98c821106 100644 --- a/lib/ui/compositing.dart +++ b/lib/ui/compositing.dart @@ -376,10 +376,37 @@ class SceneHost extends NativeFieldWrapperClass2 { SceneHost(dynamic exportTokenHandle) { _constructor(exportTokenHandle); } + SceneHost.fromViewHolderToken( + dynamic viewHolderTokenHandle, + void Function() viewConnectedCallback, + void Function() viewDisconnectedCallback, + void Function(bool) viewStateChangedCallback) { + _constructorViewHolderToken(viewHolderTokenHandle, viewConnectedCallback, + viewDisconnectedCallback, viewStateChangedCallback); + } + void _constructor(dynamic exportTokenHandle) native 'SceneHost_constructor'; + void + _constructorViewHolderToken( + dynamic viewHolderTokenHandle, + void Function() viewConnectedCallback, + void Function() viewDisconnectedCallback, + void Function(bool) viewStateChangedCallback) + native 'SceneHost_constructorViewHolderToken'; /// Releases the resources associated with the child scene host. /// /// After calling this function, the child scene host cannot be used further. void dispose() native 'SceneHost_dispose'; + + /// Set properties on the linked scene. These properties include its bounds, + /// as well as whether it can be the target of focus events or not. + void setProperties( + double width, + double height, + double insetTop, + double insetRight, + double insetBottom, + double insetLeft, + bool focusable) native 'SceneHost_setProperties'; } diff --git a/lib/ui/compositing/scene_builder.cc b/lib/ui/compositing/scene_builder.cc index 39eabaaba8598..c028196969c2d 100644 --- a/lib/ui/compositing/scene_builder.cc +++ b/lib/ui/compositing/scene_builder.cc @@ -5,9 +5,6 @@ #include "flutter/lib/ui/compositing/scene_builder.h" #include "flutter/flow/layers/backdrop_filter_layer.h" -#if defined(OS_FUCHSIA) -#include "flutter/flow/layers/child_scene_layer.h" -#endif #include "flutter/flow/layers/clip_path_layer.h" #include "flutter/flow/layers/clip_rect_layer.h" #include "flutter/flow/layers/clip_rrect_layer.h" @@ -34,6 +31,10 @@ #include "third_party/tonic/dart_binding_macros.h" #include "third_party/tonic/dart_library_natives.h" +#if defined(OS_FUCHSIA) +#include "flutter/flow/layers/child_scene_layer.h" +#endif + namespace blink { static void SceneBuilder_constructor(Dart_NativeArguments args) { @@ -58,7 +59,6 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, SceneBuilder); V(SceneBuilder, addRetained) \ V(SceneBuilder, addPicture) \ V(SceneBuilder, addTexture) \ - V(SceneBuilder, addChildScene) \ V(SceneBuilder, addPerformanceOverlay) \ V(SceneBuilder, setRasterizerTracingThreshold) \ V(SceneBuilder, setCheckerboardOffscreenLayers) \ @@ -66,11 +66,18 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, SceneBuilder); V(SceneBuilder, build) FOR_EACH_BINDING(DART_NATIVE_CALLBACK) +#if defined(OS_FUCHSIA) +DART_NATIVE_CALLBACK(SceneBuilder, addChildScene) +#endif void SceneBuilder::RegisterNatives(tonic::DartLibraryNatives* natives) { - natives->Register( - {{"SceneBuilder_constructor", SceneBuilder_constructor, 1, true}, - FOR_EACH_BINDING(DART_REGISTER_NATIVE)}); + natives->Register({ + {"SceneBuilder_constructor", SceneBuilder_constructor, 1, true}, + FOR_EACH_BINDING(DART_REGISTER_NATIVE) +#if defined(OS_FUCHSIA) + DART_REGISTER_NATIVE(SceneBuilder, addChildScene) +#endif + }); } SceneBuilder::SceneBuilder() = default; @@ -251,24 +258,22 @@ void SceneBuilder::addPlatformView(double dx, current_layer_->Add(std::move(layer)); } +#if defined(OS_FUCHSIA) void SceneBuilder::addChildScene(double dx, double dy, double width, double height, SceneHost* sceneHost, bool hitTestable) { -#if defined(OS_FUCHSIA) 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_export_node_holder(sceneHost->export_node_holder()); - layer->set_hit_testable(hitTestable); + auto layer = std::make_unique( + sceneHost->id(), sceneHost->use_view_holder(), SkPoint::Make(dx, dy), + SkSize::Make(width, height), hitTestable); current_layer_->Add(std::move(layer)); -#endif // defined(OS_FUCHSIA) } +#endif // defined(OS_FUCHSIA) void SceneBuilder::addPerformanceOverlay(uint64_t enabledOptions, double left, diff --git a/lib/ui/compositing/scene_builder.h b/lib/ui/compositing/scene_builder.h index 2f59be6510f4f..84723049a9160 100644 --- a/lib/ui/compositing/scene_builder.h +++ b/lib/ui/compositing/scene_builder.h @@ -6,11 +6,11 @@ #define FLUTTER_LIB_UI_COMPOSITING_SCENE_BUILDER_H_ #include + #include #include #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" @@ -20,6 +20,10 @@ #include "flutter/lib/ui/painting/shader.h" #include "third_party/tonic/typed_data/float64_list.h" +#if defined(OS_FUCHSIA) +#include "flutter/lib/ui/compositing/scene_host.h" +#endif + namespace blink { class SceneBuilder : public RefCountedDartWrappable { @@ -83,12 +87,14 @@ class SceneBuilder : public RefCountedDartWrappable { double height, int64_t viewId); +#if defined(OS_FUCHSIA) void addChildScene(double dx, double dy, double width, double height, SceneHost* sceneHost, bool hitTestable); +#endif void setRasterizerTracingThreshold(uint32_t frameInterval); diff --git a/lib/ui/compositing/scene_host.cc b/lib/ui/compositing/scene_host.cc index d0441354949c4..75f40449f2ded 100644 --- a/lib/ui/compositing/scene_host.cc +++ b/lib/ui/compositing/scene_host.cc @@ -4,52 +4,226 @@ #include "flutter/lib/ui/compositing/scene_host.h" +#include +#include +#include +#include +#include +#include + +#include "flutter/flow/export_node.h" +#include "flutter/flow/view_holder.h" +#include "flutter/fml/thread_local.h" #include "flutter/lib/ui/ui_dart_state.h" -#include "third_party/tonic/dart_args.h" -#include "third_party/tonic/dart_binding_macros.h" -#include "third_party/tonic/dart_library_natives.h" -#ifdef OS_FUCHSIA -#include "dart-pkg/zircon/sdk_ext/handle.h" -#endif +namespace { -namespace blink { +using SceneHostBindings = std::unordered_map; + +FML_THREAD_LOCAL fml::ThreadLocal tls_scene_host_bindings([](intptr_t value) { + delete reinterpret_cast(value); +}); + +void SceneHost_constructor(Dart_NativeArguments args) { + tonic::DartCallConstructor(&blink::SceneHost::Create, args); +} + +void SceneHost_constructorViewHolderToken(Dart_NativeArguments args) { + // This UI thread / Isolate contains at least 1 SceneHost. Initialize the + // per-Isolate bindings. + if (tls_scene_host_bindings.Get() == 0) { + tls_scene_host_bindings.Set( + reinterpret_cast(new SceneHostBindings())); + } + + tonic::DartCallConstructor(&blink::SceneHost::CreateViewHolder, args); +} + +blink::SceneHost* GetSceneHost(scenic::ResourceId id) { + auto* bindings = + reinterpret_cast(tls_scene_host_bindings.Get()); + FML_DCHECK(bindings); + + auto binding = bindings->find(id); + if (binding != bindings->end()) { + return binding->second; + } -static void SceneHost_constructor(Dart_NativeArguments args) { - DartCallConstructor(&SceneHost::create, args); + return nullptr; } +void InvokeDartClosure(tonic::DartPersistentValue* closure) { + if (closure) { + std::shared_ptr dart_state = closure->dart_state().lock(); + if (!dart_state) { + return; + } + + tonic::DartState::Scope scope(dart_state); + tonic::DartInvoke(closure->value(), {}); + } +} + +template +void InvokeDartFunction(tonic::DartPersistentValue* function, T& arg) { + if (function) { + std::shared_ptr dart_state = + function->dart_state().lock(); + if (!dart_state) { + return; + } + + tonic::DartState::Scope scope(dart_state); + tonic::DartInvoke(function->value(), {tonic::ToDart(arg)}); + } +} + +} // namespace + +namespace blink { + IMPLEMENT_WRAPPERTYPEINFO(ui, SceneHost); -#define FOR_EACH_BINDING(V) V(SceneHost, dispose) +#define FOR_EACH_BINDING(V) \ + V(SceneHost, dispose) \ + V(SceneHost, setProperties) FOR_EACH_BINDING(DART_NATIVE_CALLBACK) void SceneHost::RegisterNatives(tonic::DartLibraryNatives* natives) { natives->Register({{"SceneHost_constructor", SceneHost_constructor, 2, true}, FOR_EACH_BINDING(DART_REGISTER_NATIVE)}); + natives->Register({{"SceneHost_constructorViewHolderToken", + SceneHost_constructorViewHolderToken, 5, true}, + FOR_EACH_BINDING(DART_REGISTER_NATIVE)}); } -#if defined(OS_FUCHSIA) -fml::RefPtr SceneHost::create( - fml::RefPtr export_token_handle) { - return fml::MakeRefCounted(export_token_handle); +fml::RefPtr SceneHost::Create( + fml::RefPtr exportTokenHandle) { + return fml::MakeRefCounted(exportTokenHandle); } -SceneHost::SceneHost(fml::RefPtr export_token_handle) { - export_node_holder_ = fml::MakeRefCounted( - blink::UIDartState::Current()->GetTaskRunners().GetGPUTaskRunner(), - export_token_handle); +fml::RefPtr SceneHost::CreateViewHolder( + fml::RefPtr viewHolderTokenHandle, + Dart_Handle viewConnectedCallback, + Dart_Handle viewDisconnectedCallback, + Dart_Handle viewStateChangedCallback) { + return fml::MakeRefCounted( + viewHolderTokenHandle, viewConnectedCallback, viewDisconnectedCallback, + viewStateChangedCallback); } -#else -fml::RefPtr SceneHost::create(Dart_Handle export_token_handle) { - return fml::MakeRefCounted(export_token_handle); + +SceneHost::SceneHost(fml::RefPtr exportTokenHandle) + : gpu_task_runner_( + UIDartState::Current()->GetTaskRunners().GetGPUTaskRunner()), + id_(fsl::GetKoid(exportTokenHandle->handle())), + use_view_holder_(false) { + gpu_task_runner_->PostTask( + [id = id_, handle = std::move(exportTokenHandle)]() { + auto export_token = zx::eventpair(handle->ReleaseHandle()); + flow::ExportNode::Create(id, std::move(export_token)); + }); +} + +SceneHost::SceneHost(fml::RefPtr viewHolderTokenHandle, + Dart_Handle viewConnectedCallback, + Dart_Handle viewDisconnectedCallback, + Dart_Handle viewStateChangedCallback) + : gpu_task_runner_( + UIDartState::Current()->GetTaskRunners().GetGPUTaskRunner()), + id_(fsl::GetKoid(viewHolderTokenHandle->handle())), + use_view_holder_(true) { + if (Dart_IsClosure(viewConnectedCallback)) { + view_connected_callback_ = std::make_unique( + UIDartState::Current(), viewConnectedCallback); + } + if (Dart_IsClosure(viewDisconnectedCallback)) { + view_disconnected_callback_ = std::make_unique( + UIDartState::Current(), viewDisconnectedCallback); + } + if (Dart_IsClosure(viewConnectedCallback)) { + view_state_changed_callback_ = std::make_unique( + UIDartState::Current(), viewStateChangedCallback); + } + + auto bind_callback = [scene_host = this](scenic::ResourceId id) { + auto* bindings = + reinterpret_cast(tls_scene_host_bindings.Get()); + FML_DCHECK(bindings); + FML_DCHECK(bindings->find(id) == bindings->end()); + + bindings->emplace(std::make_pair(id, scene_host)); + }; + + auto ui_task_runner = + UIDartState::Current()->GetTaskRunners().GetUITaskRunner(); + gpu_task_runner_->PostTask([id = id_, + ui_task_runner = std::move(ui_task_runner), + handle = std::move(viewHolderTokenHandle), + bind_callback = std::move(bind_callback)]() { + auto view_holder_token = + scenic::ToViewHolderToken(zx::eventpair(handle->ReleaseHandle())); + flow::ViewHolder::Create(id, std::move(ui_task_runner), + std::move(view_holder_token), + std::move(bind_callback)); + }); +} + +SceneHost::~SceneHost() { + if (use_view_holder_) { + auto* bindings = + reinterpret_cast(tls_scene_host_bindings.Get()); + FML_DCHECK(bindings); + bindings->erase(id_); + + gpu_task_runner_->PostTask([id = id_]() { flow::ViewHolder::Destroy(id); }); + } else { + gpu_task_runner_->PostTask([id = id_]() { flow::ExportNode::Destroy(id); }); + } +} + +void SceneHost::OnViewConnected(scenic::ResourceId id) { + auto* scene_host = GetSceneHost(id); + + if (scene_host) { + InvokeDartClosure(scene_host->view_connected_callback_.get()); + } +} + +void SceneHost::OnViewDisconnected(scenic::ResourceId id) { + auto* scene_host = GetSceneHost(id); + + if (scene_host) { + InvokeDartClosure(scene_host->view_disconnected_callback_.get()); + } } -SceneHost::SceneHost(Dart_Handle export_token_handle) {} -#endif +void SceneHost::OnViewStateChanged(scenic::ResourceId id, bool state) { + auto* scene_host = GetSceneHost(id); -SceneHost::~SceneHost() {} + if (scene_host) { + InvokeDartFunction(scene_host->view_state_changed_callback_.get(), state); + } +} + +void SceneHost::setProperties(double width, + double height, + double insetTop, + double insetRight, + double insetBottom, + double insetLeft, + bool focusable) { + FML_DCHECK(use_view_holder_); + + gpu_task_runner_->PostTask([id = id_, width, height, insetTop, insetRight, + insetBottom, insetLeft, focusable]() { + auto* view_holder = flow::ViewHolder::FromId(id); + FML_DCHECK(view_holder); + + view_holder->SetProperties(width, height, insetTop, insetRight, insetBottom, + insetLeft, focusable); + }); +} void SceneHost::dispose() { ClearDartWrapper(); diff --git a/lib/ui/compositing/scene_host.h b/lib/ui/compositing/scene_host.h index cad141d0941ba..04f4ffa824718 100644 --- a/lib/ui/compositing/scene_host.h +++ b/lib/ui/compositing/scene_host.h @@ -5,19 +5,17 @@ #ifndef FLUTTER_LIB_UI_COMPOSITING_SCENE_HOST_H_ #define FLUTTER_LIB_UI_COMPOSITING_SCENE_HOST_H_ +#include +#include #include +#include +#include +#include -#include "flutter/fml/build_config.h" +#include "flutter/fml/memory/ref_counted.h" +#include "flutter/fml/task_runner.h" #include "flutter/lib/ui/dart_wrapper.h" -#if defined(OS_FUCHSIA) -#include "flutter/flow/export_node.h" -#endif - -namespace tonic { -class DartLibraryNatives; -} // namespace tonic - namespace blink { class SceneHost : public RefCountedDartWrappable { @@ -25,35 +23,45 @@ class SceneHost : public RefCountedDartWrappable { FML_FRIEND_MAKE_REF_COUNTED(SceneHost); public: -#if defined(OS_FUCHSIA) - static fml::RefPtr create( - fml::RefPtr export_token_handle); -#else - static fml::RefPtr create(Dart_Handle export_token_handle); -#endif - ~SceneHost() override; -#if defined(OS_FUCHSIA) - const fml::RefPtr& export_node_holder() const { - return export_node_holder_; - } -#endif - - void dispose(); - static void RegisterNatives(tonic::DartLibraryNatives* natives); + static fml::RefPtr Create( + fml::RefPtr exportTokenHandle); + static fml::RefPtr CreateViewHolder( + fml::RefPtr viewHolderTokenHandle, + Dart_Handle viewConnectedCallback, + Dart_Handle viewDisconnectedCallback, + Dart_Handle viewStateChangedCallback); + static void OnViewConnected(scenic::ResourceId id); + static void OnViewDisconnected(scenic::ResourceId id); + static void OnViewStateChanged(scenic::ResourceId id, bool state); + + zx_koid_t id() const { return id_; } + bool use_view_holder() const { return use_view_holder_; } + + void setProperties(double width, + double height, + double insetTop, + double insetRight, + double insetBottom, + double insetLeft, + bool focusable); + void dispose(); private: -#if defined(OS_FUCHSIA) - fml::RefPtr export_node_holder_; -#endif - -#if defined(OS_FUCHSIA) - explicit SceneHost(fml::RefPtr export_token_handle); -#else - explicit SceneHost(Dart_Handle export_token_handle); -#endif + explicit SceneHost(fml::RefPtr exportTokenHandle); + SceneHost(fml::RefPtr viewHolderTokenHandle, + Dart_Handle viewConnectedCallback, + Dart_Handle viewDisconnectedCallback, + Dart_Handle viewStateChangedCallback); + + fml::RefPtr gpu_task_runner_; + std::unique_ptr view_connected_callback_; + std::unique_ptr view_disconnected_callback_; + std::unique_ptr view_state_changed_callback_; + zx_koid_t id_ = ZX_KOID_INVALID; + bool use_view_holder_ = false; }; } // namespace blink diff --git a/lib/ui/dart_ui.cc b/lib/ui/dart_ui.cc index df5bc9713f55f..514813017978d 100644 --- a/lib/ui/dart_ui.cc +++ b/lib/ui/dart_ui.cc @@ -32,6 +32,10 @@ #include "third_party/tonic/converter/dart_converter.h" #include "third_party/tonic/logging/dart_error.h" +#if defined(OS_FUCHSIA) +#include "flutter/lib/ui/compositing/scene_host.h" +#endif + using tonic::ToDart; namespace blink { @@ -85,12 +89,14 @@ void DartUI::InitForGlobal() { PictureRecorder::RegisterNatives(g_natives); Scene::RegisterNatives(g_natives); SceneBuilder::RegisterNatives(g_natives); - SceneHost::RegisterNatives(g_natives); SemanticsUpdate::RegisterNatives(g_natives); SemanticsUpdateBuilder::RegisterNatives(g_natives); Versions::RegisterNatives(g_natives); Vertices::RegisterNatives(g_natives); Window::RegisterNatives(g_natives); +#if defined(OS_FUCHSIA) + SceneHost::RegisterNatives(g_natives); +#endif // Secondary isolates do not provide UI-related APIs. g_natives_secondary = new tonic::DartLibraryNatives(); From 7ee3a31c55d45d70261a22f9d1e280e71f4f03d3 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 8 Apr 2019 00:58:29 -0700 Subject: [PATCH 0726/1117] Roll src/third_party/dart 907c514c89..86b5304ccd (27 commits) 86b5304ccd Revert "Fix mustCallSuper for mixins and inherited interfaces:" 389ccc9000 when analyzing fuchsia workspaces, expect to find .fx-build-dir files a47b4ad2b8 Bring dart_style 1.2.7 into the SDK repo. e5d78513a1 [dartdevc] Hoisting covariance checks for generators outside of the body. 73b931b6e6 Start reworking to use actual AST nodes created lazily. fd2393d6d3 [dart/fuzzer] Re-enable optimization_counter_threshold testing 8e6851f0e4 [vm] Don't create edge counter arrays when edge counters are disabled. 90c757c766 [vm, interpreter] Allocation fast paths. 43046b7f7c [vm/bytecode] Enable building of kernel service snapshot 7beed016a0 [vm/bytecode] Add 'bytecode' into snapshot feature flags cf04a16527 dartfix to migrate to spread collections 9e1adc54a7 [vm] When loading a compilation trace, speculatively populate ICData based on the receiver's static type. f93b93dd91 [dartdevc] fix string escaping for string_literal_test 4b9b8562c6 Update expectation for conditional expression and constant_update_2018. da4ccd0855 [analyzer] fix #32918, eliminate type variables during const inference 0e7bec7d2f Add validation for AndroidManifest.xml files ca4e707e80 Fix AvailableSuggestionSetsTest on Windows. d4c61411f3 Update bug number to reflect deprioritized bug ee248fef23 Add a fix for using relative imports when the missing import is in the same library. 07482eeb5e [bots] Run all tests on vm-dartkb-* bots 1ad11facec Fix mustCallSuper for mixins and inherited interfaces: 6dc9c8d127 [CFE] JS: Treat integer valued double constants as integers. dbfd00f44d [vm/compiler] Add new optimization pass which inlines typed data accesses dbc9ff11bf [vm/vmservice] Switch from const bool.fromEnvironment() to new for 'DART_SERVICE_USE_AUTH'. 44799241fa Revert "set empty environment defines to CompilerOptions" ec8222f457 bump to linter 0.1.84 d14990b3ad Remove no-longer-needed override --- DEPS | 4 ++-- ci/licenses_golden/licenses_third_party | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 42ca7b7605c96..eb077af6c45c0 100644 --- a/DEPS +++ b/DEPS @@ -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': '907c514c8937cf76e825d427364cf3475797f18f', + 'dart_revision': '86b5304ccd3bb7650bc7f08a9fce04023056bf26', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -60,7 +60,7 @@ vars = { 'dart_http_throttle_tag': '1.0.2', 'dart_intl_tag': '0.15.7', 'dart_json_rpc_2_tag': '2.0.9', - 'dart_linter_tag': '0.1.83', + 'dart_linter_tag': '0.1.84', 'dart_logging_tag': '0.11.3+2', 'dart_markdown_tag': '2.0.2', 'dart_matcher_tag': '0.12.3', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index e8ca9564ad9f5..e44f48ba8653e 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: cbf8e245ca4d75c5fd125ab57b6b730e +Signature: aad6f00938e9ac93307738cd263cb96a UNUSED LICENSES: @@ -5155,6 +5155,7 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/backend/il_test_helper.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/il_test_helper.h FILE: ../../../third_party/dart/runtime/vm/compiler/backend/slot_test.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/type_propagator_test.cc +FILE: ../../../third_party/dart/runtime/vm/compiler/backend/typed_data_aot_test.cc FILE: ../../../third_party/dart/runtime/vm/compiler/ffi.cc FILE: ../../../third_party/dart/runtime/vm/compiler/ffi.h FILE: ../../../third_party/dart/runtime/vm/compiler/graph_intrinsifier.cc From 377dc6400329fc48cb30b07d0a929d3405f2ee20 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 8 Apr 2019 07:02:03 -0700 Subject: [PATCH 0727/1117] Roll src/third_party/dart 86b5304ccd..8e0a669e74 (6 commits) 8e0a669e74 Revert "[vm] Refactor Location to use either dart::Register or dart::host::Register" 3e12bdd717 Update `dart2aot` help output 50f3a6c960 [gardening] Make deferred imports part of the corresponding tests. 60b3643e8e [vm] Refactor Location to use either dart::Register or dart::host::Register 544371c7f2 [vm] Refactor constants to be available in namespaces dart and dart::host 7f5ed18ffc [release] Update changelog to match dev branch --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index eb077af6c45c0..54ffa6ef44c06 100644 --- a/DEPS +++ b/DEPS @@ -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': '86b5304ccd3bb7650bc7f08a9fce04023056bf26', + 'dart_revision': '8e0a669e746b5a2f4ae07f877b6f754743d8bb97', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index e44f48ba8653e..7ed9f306ff1ef 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: aad6f00938e9ac93307738cd263cb96a +Signature: fdee877841854f0765109e4194b4a4c6 UNUSED LICENSES: From a6b8e70ad53a730c72420757e5e419ccf8321a31 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Mon, 8 Apr 2019 11:02:11 -0400 Subject: [PATCH 0728/1117] Remove unused variable (#8490) --- flow/matrix_decomposition_unittests.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/flow/matrix_decomposition_unittests.cc b/flow/matrix_decomposition_unittests.cc index 6c2ba6737372d..b47af613c084d 100644 --- a/flow/matrix_decomposition_unittests.cc +++ b/flow/matrix_decomposition_unittests.cc @@ -58,8 +58,6 @@ TEST(MatrixDecomposition, Translate) { } TEST(MatrixDecomposition, Combination) { - SkMatrix44 matrix = SkMatrix44::I(); - const auto rotation = M_PI_4; const auto scale = 5; const auto translate = 125.0; From 85ca8c4855700f9a20eacd2f148702a270e283c5 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 8 Apr 2019 12:11:47 -0400 Subject: [PATCH 0729/1117] Roll src/third_party/skia 053b2939938c..602df41025ea (21 commits) (#8492) https://skia.googlesource.com/skia.git/%2Blog/053b2939938c..602df41025ea git log 053b2939938ca55cbc7aa1457628c4c3a1bcd7fa..602df41025eadb33e872d0314c340d526c740183 --date=short --no-merges --format=%ad %ae %s 2019-04-08 robertphillips@google.com Reduce the number of flush entry points 2019-04-08 kjlubick@google.com [pathkit] build with newer emscripten 2019-04-05 reed@google.com Revert "Revert "Move localmatrix routines to shaderbase, no need to be public."" 2019-04-08 mtklein@google.com fix -script parsing 2019-04-06 masonfreed@chromium.org Added the ability to set the entire matrix at once 2019-03-26 jvanverth@google.com Enable fixed tests on Metal 2019-04-08 robertphillips@google.com Reland "Revert "Reland "GPU support for SkMixers""" 2019-04-08 ethannicholas@google.com Revert "Revert "Reland "GPU support for SkMixers""" 2019-04-08 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-04-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 fb201c5e208d..90b1865e2a8b (10 commits) 2019-04-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 3e2882be2dde..afd96fdcf75a (504 commits) 2019-04-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 0e3d328ac338..4ba1911b2d7f (14 commits) 2019-04-07 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update SKP version 2019-04-07 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-04-06 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-04-05 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-04-05 masonfreed@chromium.org Made the fTypeMask field non-lazily computed. 2019-04-05 michaelludwig@google.com Revert "Support clip masks for SaveLayerRec and drawSpecial in Ganesh" 2018-05-07 halcanary@google.com SkString: simplify impl 2019-04-05 khushalsagar@chromium.org remote fonts: Validate format on deserialized glyph. 2019-04-05 jvanverth@google.com Fix WritePixels and ReadPixels for MacOS Metal The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 54ffa6ef44c06..e2b28ec2ec08a 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': '053b2939938ca55cbc7aa1457628c4c3a1bcd7fa', + 'skia_revision': '602df41025eadb33e872d0314c340d526c740183', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index f4e3bf9f172d4..dfa7bec569145 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2df9b62db9970814911c832678507502 +Signature: c57817ef7ecddfa3a3e3a4fb74a7e125 UNUSED LICENSES: From 075b4899d0c651a86d1a85759f42eccbd2f64feb Mon Sep 17 00:00:00 2001 From: Alan Doubleday <391948+agd@users.noreply.github.com> Date: Tue, 9 Apr 2019 03:30:36 +1000 Subject: [PATCH 0730/1117] Support ContextWrapper when FlutterView is instantiated within a Fragment. (#7776) --- .../android/io/flutter/view/FlutterView.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 7ba52567572ca..075a828f2e294 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -7,6 +7,7 @@ import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; +import android.content.ContextWrapper; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.PixelFormat; @@ -129,7 +130,11 @@ public FlutterView(Context context, AttributeSet attrs) { public FlutterView(Context context, AttributeSet attrs, FlutterNativeView nativeView) { super(context, attrs); - Activity activity = (Activity) getContext(); + Activity activity = getActivity(getContext()); + if (activity == null) { + throw new IllegalArgumentException("Bad context"); + } + if (nativeView == null) { mNativeView = new FlutterNativeView(activity.getApplicationContext()); } else { @@ -191,6 +196,20 @@ public void surfaceDestroyed(SurfaceHolder holder) { sendLocalesToDart(getResources().getConfiguration()); sendUserPlatformSettingsToDart(); } + + private static Activity getActivity(Context context) { + if (context == null) { + return null; + } + if (context instanceof Activity) { + return (Activity) context; + } + if (context instanceof ContextWrapper) { + // Recurse up chain of base contexts until we find an Activity. + return getActivity(((ContextWrapper) context).getBaseContext()); + } + return null; + } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { From efb3b003fd2e6a5855fdaa818b479df2fc6d7c84 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 8 Apr 2019 10:47:35 -0700 Subject: [PATCH 0731/1117] Roll src/third_party/dart 8e0a669e74..8e4dcf48c4 (8 commits) 8e4dcf48c4 [vm/compiler/aot] Fix unboxing of int32/uint32 in typed data specializer 287c9de1b2 [infra] Update checked in SDKs to 2.2.1-dev.3.1 6d47db7629 bump to linter 0.1.85 4ca7401604 [co19] Roll to 7e743ef29b4c06f1a2b8b9dc70ead60b31aab526 94baf382cc Revert "Revert "set empty environment defines to CompilerOptions"" fadae89a38 Remove unused imports 26874860e3 [SDK] Adds .exe extension for Windows binaries in dart_sdk.py. d75a49a44f [CFE] Ignore abstract methods when looking for operator '=='. --- DEPS | 4 ++-- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index e2b28ec2ec08a..90652ebc32b58 100644 --- a/DEPS +++ b/DEPS @@ -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': '8e0a669e746b5a2f4ae07f877b6f754743d8bb97', + 'dart_revision': '8e4dcf48c4bb64beaf930b3f85f6e4d01b570203', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -60,7 +60,7 @@ vars = { 'dart_http_throttle_tag': '1.0.2', 'dart_intl_tag': '0.15.7', 'dart_json_rpc_2_tag': '2.0.9', - 'dart_linter_tag': '0.1.84', + 'dart_linter_tag': '0.1.85', 'dart_logging_tag': '0.11.3+2', 'dart_markdown_tag': '2.0.2', 'dart_matcher_tag': '0.12.3', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 7ed9f306ff1ef..62ea3ab87428b 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: fdee877841854f0765109e4194b4a4c6 +Signature: 0b65326c10b07fe94aff5d5d32b01635 UNUSED LICENSES: From 78bd318c96b808321e5710a03ab3a69820a5af0a Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 8 Apr 2019 20:21:19 +0200 Subject: [PATCH 0732/1117] Add Locale.toLanguageTag() (#8421) Adds `Locale.toLanguageTag()`, which returns a valid Unicode Locale Identifier using underscores as separator that can be reliably parsed. --- lib/ui/window.dart | 24 +++++++++++++++++++----- testing/dart/locale_test.dart | 13 ++++++++++--- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/lib/ui/window.dart b/lib/ui/window.dart index 27a8902d2b3ef..e495cb065d3df 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -374,21 +374,35 @@ class Locale { static Locale cachedLocale; static String cachedLocaleString; + /// Returns a string representing the locale. + /// + /// This identifier happens to be a valid Unicode Locale Identifier using + /// underscores as separator, however it is intended to be used for debugging + /// purposes only. For parseable results, use [toLanguageTag] instead. @override - String toString() { + String toString() => _toLanguageTag('_'); + + /// Returns a syntactically valid Unicode BCP47 Locale Identifier. + /// + /// Some examples of such identifiers: "en", "es-419", "hi-Deva-IN" and + /// "zh-Hans-CN". See http://www.unicode.org/reports/tr35/ for technical + /// details. + String toLanguageTag() => _toLanguageTag(); + + String _toLanguageTag([String separator = '-']) { if (!identical(cachedLocale, this)) { cachedLocale = this; - cachedLocaleString = _rawToString(); + cachedLocaleString = _rawToString(separator); } return cachedLocaleString; } - String _rawToString() { + String _rawToString(String separator) { final StringBuffer out = StringBuffer(languageCode); if (scriptCode != null) - out.write('_$scriptCode'); + out.write('$separator$scriptCode'); if (_countryCode != null) - out.write('_$countryCode'); + out.write('$separator$countryCode'); return out.toString(); } } diff --git a/testing/dart/locale_test.dart b/testing/dart/locale_test.dart index 576df68af7064..98cc73dbb5bf4 100644 --- a/testing/dart/locale_test.dart +++ b/testing/dart/locale_test.dart @@ -9,13 +9,15 @@ import 'package:test/test.dart'; void main() { test('Locale', () { const Null $null = null; - expect(const Locale('en').toString(), 'en'); + expect(const Locale('en').toLanguageTag(), 'en'); expect(const Locale('en'), const Locale('en', $null)); expect(const Locale('en').hashCode, const Locale('en', $null).hashCode); expect(const Locale('en'), isNot(const Locale('en', ''))); expect(const Locale('en').hashCode, isNot(const Locale('en', '').hashCode)); + expect(const Locale('en', 'US').toLanguageTag(), 'en-US'); expect(const Locale('en', 'US').toString(), 'en_US'); - expect(const Locale('iw').toString(), 'he'); + expect(const Locale('iw').toLanguageTag(), 'he'); + expect(const Locale('iw', 'DD').toLanguageTag(), 'he-DE'); expect(const Locale('iw', 'DD').toString(), 'he_DE'); expect(const Locale('iw', 'DD'), const Locale('he', 'DE')); }); @@ -25,17 +27,22 @@ void main() { 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').toLanguageTag(), 'en'); expect(const Locale.fromSubtags(languageCode: 'en').languageCode, 'en'); + expect(const Locale.fromSubtags(scriptCode: 'Latn').toLanguageTag(), 'und-Latn'); expect(const Locale.fromSubtags(scriptCode: 'Latn').toString(), 'und_Latn'); expect(const Locale.fromSubtags(scriptCode: 'Latn').scriptCode, 'Latn'); + expect(const Locale.fromSubtags(countryCode: 'US').toLanguageTag(), 'und-US'); expect(const Locale.fromSubtags(countryCode: 'US').toString(), 'und_US'); expect(const Locale.fromSubtags(countryCode: 'US').countryCode, 'US'); + expect(const Locale.fromSubtags(languageCode: 'es', countryCode: '419').toLanguageTag(), 'es-419'); expect(const Locale.fromSubtags(languageCode: 'es', countryCode: '419').toString(), 'es_419'); expect(const Locale.fromSubtags(languageCode: 'es', countryCode: '419').languageCode, 'es'); + expect(const Locale.fromSubtags(languageCode: 'es', countryCode: '419').scriptCode, null); expect(const Locale.fromSubtags(languageCode: 'es', countryCode: '419').countryCode, '419'); + expect(const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans', countryCode: 'CN').toLanguageTag(), 'zh-Hans-CN'); expect(const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans', countryCode: 'CN').toString(), 'zh_Hans_CN'); }); From 0bf708ee1a3a7c9b1b9b788685544124bfbeba16 Mon Sep 17 00:00:00 2001 From: KyleWong Date: Tue, 9 Apr 2019 02:31:23 +0800 Subject: [PATCH 0733/1117] Refactor ios play input sound logic. (#7783) As there are extra requirement to use playInputClick in iOS, use AudioServicesPlaySystemSound instead to play input sound. --- .../darwin/ios/framework/Source/FlutterPlatformPlugin.mm | 6 +++--- shell/platform/darwin/ios/framework/Source/FlutterView.mm | 8 -------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm index bfb3032dcc267..5f43a026b571a 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm @@ -13,6 +13,7 @@ namespace { constexpr char kTextPlainFormat[] = "text/plain"; +const UInt32 kKeyPressClickSoundId = 1306; } // namespaces @@ -93,9 +94,8 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { - (void)playSystemSound:(NSString*)soundType { if ([soundType isEqualToString:@"SystemSoundType.click"]) { // All feedback types are specific to Android and are treated as equal on - // iOS. The surface must (and does) adopt the UIInputViewAudioFeedback - // protocol - [[UIDevice currentDevice] playInputClick]; + // iOS. + AudioServicesPlaySystemSound(kKeyPressClickSoundId); } } diff --git a/shell/platform/darwin/ios/framework/Source/FlutterView.mm b/shell/platform/darwin/ios/framework/Source/FlutterView.mm index 5cddc9708bd23..17caee87ed31f 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterView.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterView.mm @@ -17,10 +17,6 @@ #include "flutter/shell/platform/darwin/ios/ios_surface_software.h" #include "third_party/skia/include/utils/mac/SkCGUtils.h" -@interface FlutterView () - -@end - @implementation FlutterView id _delegate; @@ -97,10 +93,6 @@ + (Class)layerClass { } } -- (BOOL)enableInputClicksWhenVisible { - return YES; -} - - (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context { TRACE_EVENT0("flutter", "SnapshotFlutterView"); From 3558fa65a3c749bb3defef0746dda9da0a9a33a9 Mon Sep 17 00:00:00 2001 From: Will Larche Date: Mon, 8 Apr 2019 14:32:22 -0400 Subject: [PATCH 0734/1117] [Docs] Correcting link to contributing guide. (#8472) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c5d94d44120ef..5a9aefa434773 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,5 +18,5 @@ contributing guide. [build_status]: https://cirrus-ci.com/github/flutter/engine [code_of_conduct]: https://github.com/flutter/flutter/blob/master/CODE_OF_CONDUCT.md -[contrib_guide]: https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment +[contrib_guide]: https://github.com/flutter/flutter/blob/master/CONTRIBUTING.md [engine_dev_setup]: https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment From acfc83179d99fb29c84859f055a5e689b5fc2c10 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 8 Apr 2019 15:41:35 -0400 Subject: [PATCH 0735/1117] Roll src/third_party/skia 602df41025ea..6b797fec83f0 (19 commits) (#8494) https://skia.googlesource.com/skia.git/%2Blog/602df41025ea..6b797fec83f0 git log 602df41025eadb33e872d0314c340d526c740183..6b797fec83f05cd1c57e0d5505a0f69b9f753c78 --date=short --no-merges --format=%ad %ae %s 2019-04-08 brianosman@google.com Simplify persistent cache code, make GLSL easier for tools to access 2019-04-08 csmartdalton@google.com Add a mustWriteToFragColor() workaround flag 2019-04-08 bsalomon@google.com Start on supporting transfer from GrSurface. 2019-04-08 reed@google.com add flag to stage API change 2019-04-08 herb@google.com Do not use sub-pixel positioning for source space 2019-04-08 reed@google.com extend guard to makeAsALocalMatrixShader for google3 2019-04-08 halcanary@google.com SkPDF: device to use SkTCopyOnFirstWrite<SkPaint> 2019-04-08 nifong@google.com add SkpFilePlayer to externs 2019-04-08 reed@google.com add makeShader() to SkBitmap, and deprecate SkShader version 2019-04-08 herb@google.com Handle translating blob to origin in bulk 2019-04-08 robertphillips@google.com Skip flush in GrDrawingManager if the specifed proxy doesn't have any work 2019-04-08 kjlubick@google.com Initialize unfilled textures based on GrCaps 2019-04-08 michaelludwig@google.com Reland "Support clip masks for SaveLayerRec and drawSpecial in Ganesh" 2019-04-08 ethannicholas@google.com Revert "Reland "Revert "Reland "GPU support for SkMixers"""" 2019-04-08 reed@google.com Revert "Revert "Move localmatrix routines to shaderbase, no need to be public."" 2019-04-08 ethannicholas@google.com fixed ArithmeticImageFilter input type 2019-04-07 nigeltao@google.com Update Wuffs version 2019-04-08 mtklein@google.com fm_bot: look for and explain too-late flags 2019-04-08 reed@google.com Reland "Revert "Move localmatrix routines to shaderbase, no need to be public."" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 90652ebc32b58..a172f7992b322 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': '602df41025eadb33e872d0314c340d526c740183', + 'skia_revision': '6b797fec83f05cd1c57e0d5505a0f69b9f753c78', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index dfa7bec569145..33d6f31a1da95 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c57817ef7ecddfa3a3e3a4fb74a7e125 +Signature: 4d703499240d61f71bfebdfc7445f256 UNUSED LICENSES: @@ -2683,6 +2683,7 @@ FILE: ../../../third_party/skia/src/sksl/sksl.inc FILE: ../../../third_party/skia/src/sksl/sksl_fp.inc FILE: ../../../third_party/skia/src/sksl/sksl_frag.inc FILE: ../../../third_party/skia/src/sksl/sksl_geom.inc +FILE: ../../../third_party/skia/src/sksl/sksl_mixer.inc FILE: ../../../third_party/skia/src/sksl/sksl_pipeline.inc FILE: ../../../third_party/skia/src/sksl/sksl_vert.inc ---------------------------------------------------------------------------------------------------- @@ -5784,6 +5785,7 @@ FILE: ../../../third_party/skia/docs/examples/Text_Skew_X.cpp FILE: ../../../third_party/skia/docs/examples/Typeface_Methods.cpp FILE: ../../../third_party/skia/docs/examples/Xor.cpp FILE: ../../../third_party/skia/gm/crbug_918512.cpp +FILE: ../../../third_party/skia/src/gpu/GrPersistentCacheUtils.h ---------------------------------------------------------------------------------------------------- Copyright 2019 Google LLC. From a930ca89354a2ecf9388c116dc3cc9323c53cc55 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 8 Apr 2019 13:38:51 -0700 Subject: [PATCH 0736/1117] Roll src/third_party/dart 8e4dcf48c4..aacc0b0709 (4 commits) aacc0b0709 Index more declarations and build more scopes. b2df6eddda Make a new "nullability node" abstraction for the migration tool. 258d2f121b Rewrite more element model to using AST. 27a58d455d [vm/aot] Remove special casing of td views, allow external/internal typed data to be fast as well in string decoding --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index a172f7992b322..a9b655e822cc6 100644 --- a/DEPS +++ b/DEPS @@ -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': '8e4dcf48c4bb64beaf930b3f85f6e4d01b570203', + 'dart_revision': 'aacc0b07098231ff2051cbc7b40c932171caaddb', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 62ea3ab87428b..a08f5ef5f3457 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 0b65326c10b07fe94aff5d5d32b01635 +Signature: 18193ae58a638fba93466a2ff63b69b6 UNUSED LICENSES: From dbcfc504cc5c8ec15fa5b02a6b6b5bb80d6a7594 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Mon, 8 Apr 2019 14:46:41 -0700 Subject: [PATCH 0737/1117] Android Embedding PR26: Offer an async version of FlutterMain's ensure initialization complete. (#8465) --- .../android/io/flutter/view/FlutterMain.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/shell/platform/android/io/flutter/view/FlutterMain.java b/shell/platform/android/io/flutter/view/FlutterMain.java index c632dca387ced..504e7b32278eb 100644 --- a/shell/platform/android/io/flutter/view/FlutterMain.java +++ b/shell/platform/android/io/flutter/view/FlutterMain.java @@ -12,6 +12,7 @@ import android.app.AlarmManager; import android.app.PendingIntent; import android.os.Bundle; +import android.os.Handler; import android.os.Looper; import android.os.SystemClock; import android.util.Log; @@ -242,6 +243,41 @@ public static void ensureInitializationComplete(Context applicationContext, Stri } } + /** + * Same as {@link #ensureInitializationComplete(Context, String[])} but waiting on a background + * thread, then invoking {@code callback} on the {@code callbackHandler}. + */ + public static void ensureInitializationCompleteAsync( + Context applicationContext, + String[] args, + Handler callbackHandler, + Runnable callback + ) { + if (Looper.myLooper() != Looper.getMainLooper()) { + throw new IllegalStateException("ensureInitializationComplete must be called on the main thread"); + } + if (sSettings == null) { + throw new IllegalStateException("ensureInitializationComplete must be called after startInitialization"); + } + if (sInitialized) { + return; + } + + new Thread(new Runnable() { + @Override + public void run() { + sResourceExtractor.waitForCompletion(); + new Handler(Looper.getMainLooper()).post(new Runnable() { + @Override + public void run() { + ensureInitializationComplete(applicationContext.getApplicationContext(), args); + callbackHandler.post(callback); + } + }); + } + }).start(); + } + private static native void nativeInit(Context context, String[] args, String bundlePath, String appStoragePath, String engineCachesPath); private static native void nativeRecordStartTimestamp(long initTimeMillis); From 612abee90bcdab9ba349570c9bbb7e640d317dbc Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 8 Apr 2019 15:36:07 -0700 Subject: [PATCH 0738/1117] Wire up support for Dart fixtures in shell_unittests. (#8497) --- ci/licenses_golden/licenses_flutter | 3 + shell/common/BUILD.gn | 15 +++- shell/common/fixtures/main.dart | 8 ++ shell/common/shell_test.cc | 133 ++++++++++++++++++++++++++++ shell/common/shell_test.h | 50 +++++++++++ shell/common/shell_unittests.cc | 101 +++++++++++++-------- 6 files changed, 269 insertions(+), 41 deletions(-) create mode 100644 shell/common/fixtures/main.dart create mode 100644 shell/common/shell_test.cc create mode 100644 shell/common/shell_test.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 720b26d9908aa..e5c04c4678a24 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -410,6 +410,7 @@ 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/fixtures/main.dart FILE: ../../../flutter/shell/common/io_manager.cc FILE: ../../../flutter/shell/common/io_manager.h FILE: ../../../flutter/shell/common/isolate_configuration.cc @@ -425,6 +426,8 @@ 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_test.cc +FILE: ../../../flutter/shell/common/shell_test.h 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 diff --git a/shell/common/BUILD.gn b/shell/common/BUILD.gn index c678388a108c6..c8366f7bed089 100644 --- a/shell/common/BUILD.gn +++ b/shell/common/BUILD.gn @@ -128,7 +128,8 @@ template("shell_host_executable") { ":common", "$flutter_root/fml", "$flutter_root/lib/snapshot", - "//third_party/dart/runtime:libdart_jit", + "$flutter_root/runtime", + "$flutter_root/runtime:libdart", "//third_party/skia", "//third_party/tonic", ] @@ -145,15 +146,23 @@ shell_gpu_configuration("shell_unittests_gpu_configuration") { enable_gl = false } +test_fixtures("shell_unittests_fixtures") { + fixtures = [ "fixtures/main.dart" ] +} + shell_host_executable("shell_unittests") { sources = [ + "shell_test.cc", + "shell_test.h", "shell_unittests.cc", ] deps = [ + ":shell_unittests_fixtures", ":shell_unittests_gpu_configuration", - "$flutter_root/shell/", - "$flutter_root/testing", + "$flutter_root/common", + "$flutter_root/shell", + "$flutter_root/testing:dart", ] } diff --git a/shell/common/fixtures/main.dart b/shell/common/fixtures/main.dart new file mode 100644 index 0000000000000..c896712d2da7e --- /dev/null +++ b/shell/common/fixtures/main.dart @@ -0,0 +1,8 @@ +main() {} + +@pragma('vm:entry-point') +fixturesAreFunctionalMain() { + SayHiFromFixturesAreFunctionalMain(); +} + +void SayHiFromFixturesAreFunctionalMain() native "SayHiFromFixturesAreFunctionalMain"; \ No newline at end of file diff --git a/shell/common/shell_test.cc b/shell/common/shell_test.cc new file mode 100644 index 0000000000000..c8aab6004603a --- /dev/null +++ b/shell/common/shell_test.cc @@ -0,0 +1,133 @@ +// Copyright 2013 The Flutter 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/shell/common/shell_test.h" + +#include "flutter/fml/mapping.h" +#include "flutter/runtime/dart_vm.h" +#include "flutter/testing/testing.h" + +namespace shell { +namespace testing { + +ShellTest::ShellTest() + : native_resolver_(std::make_shared<::testing::TestDartNativeResolver>()) {} + +ShellTest::~ShellTest() = default; + +static std::unique_ptr GetMapping(const fml::UniqueFD& directory, + const char* path, + bool executable) { + fml::UniqueFD file = fml::OpenFile(directory, path, false /* create */, + fml::FilePermission::kRead); + if (!file.is_valid()) { + return nullptr; + } + + using Prot = fml::FileMapping::Protection; + std::unique_ptr mapping; + if (executable) { + mapping = std::make_unique( + file, std::initializer_list{Prot::kRead, Prot::kExecute}); + } else { + mapping = std::make_unique( + file, std::initializer_list{Prot::kRead}); + } + + if (mapping->GetSize() == 0 || mapping->GetMapping() == nullptr) { + return nullptr; + } + + return mapping; +} + +void ShellTest::SetSnapshotsAndAssets(blink::Settings& settings) { + if (!assets_dir_.is_valid()) { + return; + } + + settings.assets_dir = assets_dir_.get(); + + // In JIT execution, all snapshots are present within the binary itself and + // don't need to be explicitly suppiled by the embedder. + if (blink::DartVM::IsRunningPrecompiledCode()) { + settings.vm_snapshot_data = [this]() { + return GetMapping(assets_dir_, "vm_snapshot_data", false); + }; + + settings.isolate_snapshot_data = [this]() { + return GetMapping(assets_dir_, "isolate_snapshot_data", false); + }; + + if (blink::DartVM::IsRunningPrecompiledCode()) { + settings.vm_snapshot_instr = [this]() { + return GetMapping(assets_dir_, "vm_snapshot_instr", true); + }; + + settings.isolate_snapshot_instr = [this]() { + return GetMapping(assets_dir_, "isolate_snapshot_instr", true); + }; + } + } else { + settings.application_kernels = [this]() { + std::vector> kernel_mappings; + kernel_mappings.emplace_back( + GetMapping(assets_dir_, "kernel_blob.bin", false)); + return kernel_mappings; + }; + } +} + +blink::Settings ShellTest::CreateSettingsForFixture() { + blink::Settings settings; + settings.task_observer_add = [](intptr_t key, fml::closure handler) { + fml::MessageLoop::GetCurrent().AddTaskObserver(key, handler); + }; + settings.task_observer_remove = [](intptr_t key) { + fml::MessageLoop::GetCurrent().RemoveTaskObserver(key); + }; + settings.root_isolate_create_callback = [this]() { + native_resolver_->SetNativeResolverForIsolate(); + }; + SetSnapshotsAndAssets(settings); + return settings; +} + +blink::TaskRunners ShellTest::GetTaskRunnersForFixture() { + return { + "test", + thread_host_->platform_thread->GetTaskRunner(), // platform + thread_host_->gpu_thread->GetTaskRunner(), // gpu + thread_host_->ui_thread->GetTaskRunner(), // ui + thread_host_->io_thread->GetTaskRunner() // io + }; +} + +// |testing::ThreadTest| +void ShellTest::SetUp() { + ThreadTest::SetUp(); + assets_dir_ = fml::OpenDirectory(::testing::GetFixturesPath(), false, + fml::FilePermission::kRead); + thread_host_ = std::make_unique( + "io.flutter.test." + ::testing::GetCurrentTestName() + ".", + ThreadHost::Type::Platform | ThreadHost::Type::IO | ThreadHost::Type::UI | + ThreadHost::Type::GPU); +} + +// |testing::ThreadTest| +void ShellTest::TearDown() { + ThreadTest::TearDown(); + assets_dir_.reset(); + thread_host_.reset(); +} + +void ShellTest::AddNativeCallback(std::string name, + Dart_NativeFunction callback) { + native_resolver_->AddNativeCallback(std::move(name), callback); +} + +} // namespace testing +} // namespace shell diff --git a/shell/common/shell_test.h b/shell/common/shell_test.h new file mode 100644 index 0000000000000..4dcd9f8dbfc15 --- /dev/null +++ b/shell/common/shell_test.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_SHELL_COMMON_SHELL_TEST_H_ +#define FLUTTER_SHELL_COMMON_SHELL_TEST_H_ + +#include + +#include "flutter/common/settings.h" +#include "flutter/fml/macros.h" +#include "flutter/shell/common/run_configuration.h" +#include "flutter/shell/common/thread_host.h" +#include "flutter/testing/test_dart_native_resolver.h" +#include "flutter/testing/thread_test.h" + +namespace shell { +namespace testing { + +class ShellTest : public ::testing::ThreadTest { + public: + ShellTest(); + + ~ShellTest(); + + blink::Settings CreateSettingsForFixture(); + + blink::TaskRunners GetTaskRunnersForFixture(); + + void AddNativeCallback(std::string name, Dart_NativeFunction callback); + + protected: + // |testing::ThreadTest| + void SetUp() override; + + // |testing::ThreadTest| + void TearDown() override; + + private: + fml::UniqueFD assets_dir_; + std::shared_ptr<::testing::TestDartNativeResolver> native_resolver_; + std::unique_ptr thread_host_; + + void SetSnapshotsAndAssets(blink::Settings& settings); +}; + +} // namespace testing +} // namespace shell + +#endif // FLUTTER_SHELL_COMMON_SHELL_TEST_H_ diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc index 85c6b7962ae55..793df24a41825 100644 --- a/shell/common/shell_unittests.cc +++ b/shell/common/shell_unittests.cc @@ -8,21 +8,20 @@ #include #include +#include "flutter/fml/make_copyable.h" #include "flutter/fml/message_loop.h" #include "flutter/fml/synchronization/waitable_event.h" #include "flutter/shell/common/platform_view.h" #include "flutter/shell/common/rasterizer.h" #include "flutter/shell/common/shell.h" +#include "flutter/shell/common/shell_test.h" #include "flutter/shell/common/thread_host.h" #include "flutter/shell/gpu/gpu_surface_software.h" +#include "flutter/testing/testing.h" #include "gtest/gtest.h" -#define CURRENT_TEST_NAME \ - std::string { \ - ::testing::UnitTest::GetInstance()->current_test_info()->name() \ - } - namespace shell { +namespace testing { class TestPlatformView : public PlatformView, public GPUSurfaceSoftwareDelegate { @@ -84,10 +83,8 @@ static bool ValidateShell(Shell* shell) { return true; } -TEST(ShellTest, InitializeWithInvalidThreads) { - blink::Settings settings = {}; - settings.task_observer_add = [](intptr_t, fml::closure) {}; - settings.task_observer_remove = [](intptr_t) {}; +TEST_F(ShellTest, InitializeWithInvalidThreads) { + blink::Settings settings = CreateSettingsForFixture(); blink::TaskRunners task_runners("test", nullptr, nullptr, nullptr, nullptr); auto shell = Shell::Create( std::move(task_runners), settings, @@ -101,13 +98,12 @@ TEST(ShellTest, InitializeWithInvalidThreads) { ASSERT_FALSE(shell); } -TEST(ShellTest, InitializeWithDifferentThreads) { - 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::GPU | - ThreadHost::Type::IO | ThreadHost::Type::UI); +TEST_F(ShellTest, InitializeWithDifferentThreads) { + blink::Settings settings = CreateSettingsForFixture(); + ThreadHost thread_host( + "io.flutter.test." + ::testing::GetCurrentTestName() + ".", + 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(), @@ -125,12 +121,11 @@ TEST(ShellTest, InitializeWithDifferentThreads) { ASSERT_TRUE(ValidateShell(shell.get())); } -TEST(ShellTest, InitializeWithSingleThread) { - 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); +TEST_F(ShellTest, InitializeWithSingleThread) { + blink::Settings settings = CreateSettingsForFixture(); + ThreadHost thread_host( + "io.flutter.test." + ::testing::GetCurrentTestName() + ".", + ThreadHost::Type::Platform); auto task_runner = thread_host.platform_thread->GetTaskRunner(); blink::TaskRunners task_runners("test", task_runner, task_runner, task_runner, task_runner); @@ -146,10 +141,8 @@ TEST(ShellTest, InitializeWithSingleThread) { ASSERT_TRUE(ValidateShell(shell.get())); } -TEST(ShellTest, InitializeWithSingleThreadWhichIsTheCallingThread) { - blink::Settings settings = {}; - settings.task_observer_add = [](intptr_t, fml::closure) {}; - settings.task_observer_remove = [](intptr_t) {}; +TEST_F(ShellTest, InitializeWithSingleThreadWhichIsTheCallingThread) { + blink::Settings settings = CreateSettingsForFixture(); fml::MessageLoop::EnsureInitializedForCurrentThread(); auto task_runner = fml::MessageLoop::GetCurrent().GetTaskRunner(); blink::TaskRunners task_runners("test", task_runner, task_runner, task_runner, @@ -166,12 +159,11 @@ TEST(ShellTest, InitializeWithSingleThreadWhichIsTheCallingThread) { ASSERT_TRUE(ValidateShell(shell.get())); } -TEST(ShellTest, InitializeWithMultipleThreadButCallingThreadAsPlatformThread) { - blink::Settings settings = {}; - settings.task_observer_add = [](intptr_t, fml::closure) {}; - settings.task_observer_remove = [](intptr_t) {}; +TEST_F(ShellTest, + InitializeWithMultipleThreadButCallingThreadAsPlatformThread) { + blink::Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( - "io.flutter.test." + CURRENT_TEST_NAME + ".", + "io.flutter.test." + ::testing::GetCurrentTestName() + ".", ThreadHost::Type::GPU | ThreadHost::Type::IO | ThreadHost::Type::UI); fml::MessageLoop::EnsureInitializedForCurrentThread(); blink::TaskRunners task_runners( @@ -191,14 +183,10 @@ TEST(ShellTest, InitializeWithMultipleThreadButCallingThreadAsPlatformThread) { 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, InitializeWithGPUAndPlatformThreadsTheSame) { - blink::Settings settings = {}; - settings.task_observer_add = [](intptr_t, fml::closure) {}; - settings.task_observer_remove = [](intptr_t) {}; +TEST_F(ShellTest, InitializeWithGPUAndPlatformThreadsTheSame) { + blink::Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( - "io.flutter.test." + CURRENT_TEST_NAME + ".", + "io.flutter.test." + ::testing::GetCurrentTestName() + ".", ThreadHost::Type::Platform | ThreadHost::Type::IO | ThreadHost::Type::UI); blink::TaskRunners task_runners( "test", @@ -219,4 +207,41 @@ TEST(ShellTest, InitializeWithGPUAndPlatformThreadsTheSame) { ASSERT_TRUE(ValidateShell(shell.get())); } +TEST_F(ShellTest, FixturesAreFunctional) { + const auto settings = CreateSettingsForFixture(); + auto shell = Shell::Create( + GetTaskRunnersForFixture(), settings, + [](Shell& shell) { + return std::make_unique(shell, + shell.GetTaskRunners()); + }, + [](Shell& shell) { + return std::make_unique(shell.GetTaskRunners()); + }); + ASSERT_TRUE(ValidateShell(shell.get())); + + auto configuration = RunConfiguration::InferFromSettings(settings); + ASSERT_TRUE(configuration.IsValid()); + configuration.SetEntrypoint("fixturesAreFunctionalMain"); + + fml::AutoResetWaitableEvent main_latch; + AddNativeCallback( + "SayHiFromFixturesAreFunctionalMain", + CREATE_NATIVE_ENTRY([&main_latch](auto args) { main_latch.Signal(); })); + + fml::AutoResetWaitableEvent latch; + fml::TaskRunner::RunNowOrPostTask( + shell->GetTaskRunners().GetUITaskRunner(), + fml::MakeCopyable([&latch, config = std::move(configuration), + engine = shell->GetEngine()]() mutable { + ASSERT_TRUE(engine); + ASSERT_EQ(engine->Run(std::move(config)), Engine::RunStatus::Success); + latch.Signal(); + })); + + latch.Wait(); + main_latch.Wait(); +} + +} // namespace testing } // namespace shell From 533ca016ea5a2264c930c1da018a32126da81cd2 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 8 Apr 2019 19:05:34 -0400 Subject: [PATCH 0739/1117] Roll src/third_party/skia 6b797fec83f0..2f08a4043b26 (8 commits) (#8501) https://skia.googlesource.com/skia.git/%2Blog/6b797fec83f0..2f08a4043b26 git log 6b797fec83f05cd1c57e0d5505a0f69b9f753c78..2f08a4043b26370aa24f713f5960433af8dd398f --date=short --no-merges --format=%ad %ae %s 2019-04-08 gkaiser@google.com examples: Avoid undefined behavior 2019-04-08 reed@google.com undef guard for bitmap shader 2019-04-08 reed@google.com Introduce new factory for SkColorFilters 2019-04-08 herb@google.com Add maxDimension() to glyph 2019-04-08 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-04-08 csmartdalton@google.com Disable output swizzling from GrDisableColorXP 2019-04-08 brianosman@google.com Update SPIRV caching to use SkWriter32/SkReader32 and allow inspection 2019-04-08 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms 99740cdf2835..36eeb1311a72 (1 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index a9b655e822cc6..9997fe191459b 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': '6b797fec83f05cd1c57e0d5505a0f69b9f753c78', + 'skia_revision': '2f08a4043b26370aa24f713f5960433af8dd398f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 33d6f31a1da95..b3efa51f919c4 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 4d703499240d61f71bfebdfc7445f256 +Signature: b30e63bcfcd9fbf90fcec07c5afe0ca7 UNUSED LICENSES: From 046b3cd28e44cb76417136fee0a218eaad64d5f2 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 8 Apr 2019 16:11:21 -0700 Subject: [PATCH 0740/1117] Get rid of the macro for accessing the current test name. (#8500) --- runtime/dart_isolate_unittests.cc | 35 +++++++++++++------------------ 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc index e2a7c734bb1c8..6a09e62a78a20 100644 --- a/runtime/dart_isolate_unittests.cc +++ b/runtime/dart_isolate_unittests.cc @@ -15,11 +15,6 @@ #include "flutter/testing/thread_test.h" #include "third_party/tonic/scopes/dart_isolate_scope.h" -#define CURRENT_TEST_NAME \ - std::string { \ - ::testing::UnitTest::GetInstance()->current_test_info()->name() \ - } - namespace blink { namespace testing { @@ -31,11 +26,11 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) { ASSERT_TRUE(vm_ref); auto vm_data = vm_ref.GetVMData(); ASSERT_TRUE(vm_data); - TaskRunners task_runners(CURRENT_TEST_NAME, // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner() // + TaskRunners task_runners(::testing::GetCurrentTestName(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner() // ); auto weak_isolate = DartIsolate::CreateRootIsolate( vm_data->GetSettings(), // settings @@ -60,11 +55,11 @@ TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) { ASSERT_TRUE(vm_ref); auto vm_data = vm_ref.GetVMData(); ASSERT_TRUE(vm_data); - TaskRunners task_runners(CURRENT_TEST_NAME, // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner() // + TaskRunners task_runners(::testing::GetCurrentTestName(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner() // ); auto weak_isolate = DartIsolate::CreateRootIsolate( vm_data->GetSettings(), // settings @@ -159,11 +154,11 @@ static void RunDartCodeInIsolate(std::unique_ptr& result, return; } - TaskRunners task_runners(CURRENT_TEST_NAME, // - task_runner, // - task_runner, // - task_runner, // - task_runner // + TaskRunners task_runners(::testing::GetCurrentTestName(), // + task_runner, // + task_runner, // + task_runner, // + task_runner // ); auto vm_data = vm_ref.GetVMData(); From 53620352ad4b6e4460f2240730a5417743cc524d Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 8 Apr 2019 16:00:50 -0700 Subject: [PATCH 0741/1117] Roll src/third_party/dart aacc0b0709..b23817105c (8 commits) b23817105c Build types for function typed formal parameters. 93b4c5ca57 [vm] Improve error message for Dart_PropagateError with no exit frame. 3dd09e2a3d Follow up on change https://dart-review.googlesource.com/c/sdk/+/98623 to fix a failing Windows test 94c34d3cbe Introduce a getter on the Variables class to represent types that are a priori known to be non-nullable. 3ffe59e1e9 Fix for URIs of parts. f1f297e213 Build export elements and combinators. 762acf00e8 Restore computing export scopes. 959cf5967d Simplify strong_test_helper --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 9997fe191459b..c24abbeea411d 100644 --- a/DEPS +++ b/DEPS @@ -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': 'aacc0b07098231ff2051cbc7b40c932171caaddb', + 'dart_revision': 'b23817105c8ba0456bf7733e3595069e3d545929', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index a08f5ef5f3457..618e62a9026be 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 18193ae58a638fba93466a2ff63b69b6 +Signature: 622a5f3981f1c4097fb6ec06bd83d708 UNUSED LICENSES: From c7b138d82dda8ed98d5472034f00fcb9b12fa6e7 Mon Sep 17 00:00:00 2001 From: freiling Date: Mon, 8 Apr 2019 16:32:26 -0700 Subject: [PATCH 0742/1117] [scenic][SCN-1054] remove dangling uses of SetTranslationRH (#8503) Looks like someone added a new use of the method while I was waiting for flutter to roll. nuking the last instance so i can move forward with deprecating and removing it. --- flow/scene_update_context.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flow/scene_update_context.cc b/flow/scene_update_context.cc index 11cda2a4edbd0..07ff4d876a887 100644 --- a/flow/scene_update_context.cc +++ b/flow/scene_update_context.cc @@ -86,9 +86,9 @@ void SceneUpdateContext::CreateFrame( rrect.radii(SkRRect::kLowerLeft_Corner).x() // bottom_left_radius ); shape_node->SetShape(shape); - shape_node->SetTranslationRH( - shape_bounds.width() * 0.5f + shape_bounds.left(), - shape_bounds.height() * 0.5f + shape_bounds.top(), 0.f); + shape_node->SetTranslation(shape_bounds.width() * 0.5f + shape_bounds.left(), + shape_bounds.height() * 0.5f + shape_bounds.top(), + 0.f); // Check whether the painted layers will be visible. if (paint_bounds.isEmpty() || !paint_bounds.intersects(shape_bounds)) @@ -313,9 +313,9 @@ SceneUpdateContext::Clip::Clip(SceneUpdateContext& context, const SkRect& shape_bounds) : Entity(context) { shape_node().SetShape(shape); - shape_node().SetTranslationRH( - shape_bounds.width() * 0.5f + shape_bounds.left(), - shape_bounds.height() * 0.5f + shape_bounds.top(), 0.f); + shape_node().SetTranslation(shape_bounds.width() * 0.5f + shape_bounds.left(), + shape_bounds.height() * 0.5f + shape_bounds.top(), + 0.f); entity_node().SetClip(0u, true /* clip to self */); SetEntityNodeClipPlanes(&entity_node(), shape_bounds); From 623dca0537366ad6f45de3ddb166bc6fd94aa07a Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 8 Apr 2019 19:02:21 -0700 Subject: [PATCH 0743/1117] Roll src/third_party/dart b23817105c..cc63d6e647 (8 commits) cc63d6e647 dart fix support for control_flow_collection fixes 6d941f8099 Add manifest file error codes to master list of errors e9765499cc Support for name offset, code offset/length, documentation. cb894430ae error code associations for ui as code lints 29a6ad3beb Lazy AstBinaryReader is always lazy. 8f3608ca25 Enable ddb to run with experiments de6a7feb24 [vm] Add assertion to check if number of type arguments was calculated before setting type parameters 86734d476b [infra] Remove obsolete tools/infra/config directory --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c24abbeea411d..e3a66d0c13f0b 100644 --- a/DEPS +++ b/DEPS @@ -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': 'b23817105c8ba0456bf7733e3595069e3d545929', + 'dart_revision': 'cc63d6e647df1cfd34a54adb63aba7f937ce6f6b', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 618e62a9026be..399228ebbc79a 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 622a5f3981f1c4097fb6ec06bd83d708 +Signature: c14120782eb49deb9f66922808723741 UNUSED LICENSES: From edb050f7a99531dfe9f260dc52e870afd1da5ef2 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 8 Apr 2019 22:27:35 -0400 Subject: [PATCH 0744/1117] Roll src/third_party/skia 2f08a4043b26..0ea414a08208 (2 commits) (#8506) https://skia.googlesource.com/skia.git/%2Blog/2f08a4043b26..0ea414a08208 git log 2f08a4043b26370aa24f713f5960433af8dd398f..0ea414a082083f56ea2ab18828192d020b50e69f --date=short --no-merges --format=%ad %ae %s 2019-04-08 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-04-08 fmalita@chromium.org [skottie] More snug kTop Shaper alignment The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index e3a66d0c13f0b..f859b6aaafa9a 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': '2f08a4043b26370aa24f713f5960433af8dd398f', + 'skia_revision': '0ea414a082083f56ea2ab18828192d020b50e69f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b3efa51f919c4..39890f68f5213 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b30e63bcfcd9fbf90fcec07c5afe0ca7 +Signature: 380ab90c36b54b52dc324a0525cece52 UNUSED LICENSES: From 7ce64be6c12aff3f5872e5275a3c7dffd683e846 Mon Sep 17 00:00:00 2001 From: David Worsham Date: Mon, 8 Apr 2019 19:49:59 -0700 Subject: [PATCH 0745/1117] [scenic] Remove unused mozart.internal (#8496) --- lib/snapshot/fuchsia_compilation_trace.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/snapshot/fuchsia_compilation_trace.txt b/lib/snapshot/fuchsia_compilation_trace.txt index 49bf715cfcdca..22337aa202081 100644 --- a/lib/snapshot/fuchsia_compilation_trace.txt +++ b/lib/snapshot/fuchsia_compilation_trace.txt @@ -1807,9 +1807,6 @@ dart:io,::,get:_OUTGOING_BUFFER_SIZE dart:io,::,_getHttpVersion dart:io,::,_setupHooks dart:io,::,_throwOnBadPort -dart:mozart.internal,Mozart,offerServiceProvider -dart:mozart.internal,Mozart,_offerServiceProvider -dart:mozart.internal,MozartStartupInfo,takeViewContainer dart:ui,TextBaseline,get:index dart:ui,StrokeCap,get:index dart:ui,BlurStyle,get:index From 8a465596533d75eb128faab5cd70b60c5e989935 Mon Sep 17 00:00:00 2001 From: nathanrogersgoogle Date: Mon, 8 Apr 2019 22:54:06 -0400 Subject: [PATCH 0746/1117] Route FlutterEventTracer events to Fuchsia tracing for Fuchsia (#8499) When running on Fuchsia, "fml/trace_event.h" sends trace events towards Fuchsia's tracing system, rather than its own |fml::tracing::*| one. Do the same thing for |FlutterEventTracer|, in order to unlock category "skia" trace events when running on Fuchsia. The reason this was not working before is because |FlutterEventTracer| was directly using |fml::tracing::*| functions, rather than the TRACE_EVENT_* macros. In the future, we can look into having the skia event tracer enabled by default on Fuchsia, controlling the presence of Skia events by enabling/disabling the "skia" category, once we measure the performance cost of doing so. --- shell/common/skia_event_tracer_impl.cc | 32 ++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/shell/common/skia_event_tracer_impl.cc b/shell/common/skia_event_tracer_impl.cc index 7b073a729638e..b04bfb36bc4f5 100644 --- a/shell/common/skia_event_tracer_impl.cc +++ b/shell/common/skia_event_tracer_impl.cc @@ -5,11 +5,10 @@ #include "flutter/shell/common/skia_event_tracer_impl.h" #define TRACE_EVENT_HIDE_MACROS -#include "flutter/fml/trace_event.h" - #include #include "flutter/fml/logging.h" +#include "flutter/fml/trace_event.h" #include "third_party/dart/runtime/include/dart_tools_api.h" #include "third_party/skia/include/utils/SkEventTracer.h" #include "third_party/skia/include/utils/SkTraceEventPhase.h" @@ -33,6 +32,30 @@ class FlutterEventTracer : public SkEventTracer { const uint8_t* p_arg_types, const uint64_t* p_arg_values, uint8_t flags) override { +#if defined(OS_FUCHSIA) + // In a manner analogous to "fml/trace_event.h", use Fuchsia's system + // tracing macros when running on Fuchsia. + switch (phase) { + case TRACE_EVENT_PHASE_BEGIN: + case TRACE_EVENT_PHASE_COMPLETE: + TRACE_DURATION_BEGIN(kSkiaTag, name); + break; + case TRACE_EVENT_PHASE_END: + TRACE_DURATION_END(kSkiaTag, name); + break; + case TRACE_EVENT_PHASE_INSTANT: + TRACE_INSTANT(kSkiaTag, name, TRACE_SCOPE_THREAD); + break; + case TRACE_EVENT_PHASE_ASYNC_BEGIN: + TRACE_ASYNC_BEGIN(kSkiaTag, name, id); + break; + case TRACE_EVENT_PHASE_ASYNC_END: + TRACE_ASYNC_END(kSkiaTag, name, id); + break; + default: + break; + } +#else // defined(OS_FUCHSIA) switch (phase) { case TRACE_EVENT_PHASE_BEGIN: case TRACE_EVENT_PHASE_COMPLETE: @@ -53,6 +76,7 @@ class FlutterEventTracer : public SkEventTracer { default: break; } +#endif // defined(OS_FUCHSIA) return 0; } @@ -61,7 +85,11 @@ class FlutterEventTracer : public SkEventTracer { SkEventTracer::Handle handle) override { // This is only ever called from a scoped trace event so we will just end // the section. +#if defined(OS_FUCHSIA) + TRACE_DURATION_END(kSkiaTag, name); +#else fml::tracing::TraceEventEnd(name); +#endif } const uint8_t* getCategoryGroupEnabled(const char* name) override { From 4e839444f81eec776955015a303e79c79bf51935 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 9 Apr 2019 01:56:52 -0400 Subject: [PATCH 0747/1117] Roll src/third_party/skia 0ea414a08208..696e8dda3ca3 (3 commits) (#8509) https://skia.googlesource.com/skia.git/%2Blog/0ea414a08208..696e8dda3ca3 git log 0ea414a082083f56ea2ab18828192d020b50e69f..696e8dda3ca30438f440777bd17e69e5ccd748c1 --date=short --no-merges --format=%ad %ae %s 2019-04-09 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 4ba1911b2d7f..eba396cc66d3 (3 commits) 2019-04-09 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 90b1865e2a8b..82418c821689 (8 commits) 2019-04-09 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src afd96fdcf75a..79154509c679 (442 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f859b6aaafa9a..bc86b707a7539 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': '0ea414a082083f56ea2ab18828192d020b50e69f', + 'skia_revision': '696e8dda3ca30438f440777bd17e69e5ccd748c1', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 39890f68f5213..7906d45a08ac7 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 380ab90c36b54b52dc324a0525cece52 +Signature: b03070c1e912ee3eed5ab9716a07b0b5 UNUSED LICENSES: From 2335dd2f8acfbbe9af5db626fd9c71031492fa8f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 9 Apr 2019 05:26:34 -0400 Subject: [PATCH 0748/1117] Roll src/third_party/skia 696e8dda3ca3..097e77cd3ba0 (1 commits) (#8510) https://skia.googlesource.com/skia.git/%2Blog/696e8dda3ca3..097e77cd3ba0 git log 696e8dda3ca30438f440777bd17e69e5ccd748c1..097e77cd3ba09f7b81025ecd52d73fa5511e9161 --date=short --no-merges --format=%ad %ae %s 2019-04-09 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index bc86b707a7539..d7973695e9147 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': '696e8dda3ca30438f440777bd17e69e5ccd748c1', + 'skia_revision': '097e77cd3ba09f7b81025ecd52d73fa5511e9161', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 7906d45a08ac7..6d38084d183d8 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b03070c1e912ee3eed5ab9716a07b0b5 +Signature: 05e28da5a42c93b33d8321e9813eb4f7 UNUSED LICENSES: From 6a0460c33ff7e4f18b809285301337698de9ab38 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 9 Apr 2019 09:09:13 -0400 Subject: [PATCH 0749/1117] Roll src/third_party/skia 097e77cd3ba0..9a7c7be15969 (1 commits) (#8512) https://skia.googlesource.com/skia.git/%2Blog/097e77cd3ba0..9a7c7be15969 git log 097e77cd3ba09f7b81025ecd52d73fa5511e9161..9a7c7be15969e1e0bad0b7a5c6bb40e254265838 --date=short --no-merges --format=%ad %ae %s 2019-04-09 robertphillips@google.com Revert "Skip flush in GrDrawingManager if the specifed proxy doesn't have any work" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d7973695e9147..49c5bfadb829d 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': '097e77cd3ba09f7b81025ecd52d73fa5511e9161', + 'skia_revision': '9a7c7be15969e1e0bad0b7a5c6bb40e254265838', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6d38084d183d8..3a6835b881357 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 05e28da5a42c93b33d8321e9813eb4f7 +Signature: 979e49fe2ee55f481c36973e18987679 UNUSED LICENSES: From df707c6f1f1ac87b02d4d65195d171bdd861da01 Mon Sep 17 00:00:00 2001 From: reed-at-google Date: Tue, 9 Apr 2019 11:00:36 -0400 Subject: [PATCH 0750/1117] switch to newer APIs for shaders and filters (#8511) * switch to newer APIs for shaders and filters * fix formatting --- flow/layers/color_filter_layer.cc | 4 +--- flow/paint_utils.cc | 3 +-- lib/ui/painting/paint.cc | 13 ++++++------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/flow/layers/color_filter_layer.cc b/flow/layers/color_filter_layer.cc index 3b140ad7ceb5e..40732be5a7323 100644 --- a/flow/layers/color_filter_layer.cc +++ b/flow/layers/color_filter_layer.cc @@ -14,10 +14,8 @@ void ColorFilterLayer::Paint(PaintContext& context) const { TRACE_EVENT0("flutter", "ColorFilterLayer::Paint"); FML_DCHECK(needs_painting()); - sk_sp color_filter = - SkColorFilter::MakeModeFilter(color_, blend_mode_); SkPaint paint; - paint.setColorFilter(std::move(color_filter)); + paint.setColorFilter(SkColorFilters::Blend(color_, blend_mode_)); Layer::AutoSaveLayer save = Layer::AutoSaveLayer::Create(context, paint_bounds(), &paint); diff --git a/flow/paint_utils.cc b/flow/paint_utils.cc index 791965f69b6d2..b8ceddd48928c 100644 --- a/flow/paint_utils.cc +++ b/flow/paint_utils.cc @@ -20,8 +20,7 @@ sk_sp CreateCheckerboardShader(SkColor c1, SkColor c2, int size) { bm.eraseColor(c1); bm.eraseArea(SkIRect::MakeLTRB(0, 0, size, size), c2); bm.eraseArea(SkIRect::MakeLTRB(size, size, 2 * size, 2 * size), c2); - return SkShader::MakeBitmapShader(bm, SkTileMode::kRepeat, - SkTileMode::kRepeat); + return bm.makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat); } } // anonymous namespace diff --git a/lib/ui/painting/paint.cc b/lib/ui/painting/paint.cc index 4e67a48916eb1..92d5ce3c18e4b 100644 --- a/lib/ui/painting/paint.cc +++ b/lib/ui/painting/paint.cc @@ -80,7 +80,7 @@ sk_sp ExtractColorFilter(const uint32_t* uint_data, SkBlendMode blend_mode = static_cast(uint_data[kColorFilterBlendModeIndex]); - return SkColorFilter::MakeModeFilter(color, blend_mode); + return SkColorFilters::Blend(color, blend_mode); } case Matrix: { Dart_Handle matrixHandle = values[kColorFilterMatrixIndex]; @@ -92,15 +92,15 @@ sk_sp ExtractColorFilter(const uint32_t* uint_data, FML_CHECK(length == 20); tonic::Float32List decoded(matrixHandle); - return SkColorFilter::MakeMatrixFilterRowMajor255(decoded.data()); + return SkColorFilters::MatrixRowMajor255(decoded.data()); } return nullptr; } case LinearToSRGBGamma: { - return SkColorFilter::MakeLinearToSRGBGamma(); + return SkColorFilters::LinearToSRGBGamma(); } case SRGBToLinearGamma: { - return SkColorFilter::MakeSRGBToLinearGamma(); + return SkColorFilters::SRGBToLinearGamma(); } default: FML_DLOG(ERROR) << "Out of range value received for kColorFilterIndex."; @@ -178,12 +178,11 @@ Paint::Paint(Dart_Handle paint_objects, Dart_Handle paint_data) { sk_sp color_filter = ExtractColorFilter(uint_data, values); if (color_filter) { sk_sp invert_filter = - SkColorFilter::MakeMatrixFilterRowMajor255(invert_colors); + SkColorFilters::MatrixRowMajor255(invert_colors); paint_.setColorFilter(invert_filter->makeComposed(color_filter)); } } else if (uint_data[kInvertColorIndex]) { - paint_.setColorFilter( - SkColorFilter::MakeMatrixFilterRowMajor255(invert_colors)); + paint_.setColorFilter(SkColorFilters::MatrixRowMajor255(invert_colors)); } else if (uint_data[kColorFilterIndex]) { sk_sp color_filter = ExtractColorFilter(uint_data, values); if (color_filter) { From 5381e57ea30b2927fdf854a35567996c4f2676f9 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 9 Apr 2019 12:40:24 -0400 Subject: [PATCH 0751/1117] Roll src/third_party/skia 9a7c7be15969..b5d8c634f95b (11 commits) (#8513) https://skia.googlesource.com/skia.git/%2Blog/9a7c7be15969..b5d8c634f95b git log 9a7c7be15969e1e0bad0b7a5c6bb40e254265838..b5d8c634f95b008882710cb27b6094b3f69d1a85 --date=short --no-merges --format=%ad %ae %s 2019-04-08 reed@google.com remove guard for bitmap shader api 2019-04-09 bsalomon@google.com Add support for importing GL_R16F for YUVA promise images 2019-04-04 martin@mainframe.co.uk add missing shared lib visibility macros 2019-04-09 herb@google.com Revert "Handle translating blob to origin in bulk" 2019-04-09 herb@google.com Revert "Reland "Do not use sub-pixel positioning for source space"" 2019-04-09 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms 36eeb1311a72..0da672fc2c69 (1 commits) 2019-04-09 herb@google.com Reland "Add maxDimension() to glyph" 2019-04-09 herb@google.com Reland "Do not use sub-pixel positioning for source space" 2019-04-08 brianosman@google.com Shader serialization experiment (with Mali Offline Compiler analysis) 2019-04-09 reed@google.com Revert "Do not use sub-pixel positioning for source space" 2019-04-09 reed@google.com Revert "Add maxDimension() to glyph" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 49c5bfadb829d..5f5f093fa7247 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': '9a7c7be15969e1e0bad0b7a5c6bb40e254265838', + 'skia_revision': 'b5d8c634f95b008882710cb27b6094b3f69d1a85', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3a6835b881357..67206df1a7d7d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 979e49fe2ee55f481c36973e18987679 +Signature: c209a0ed9657c1f2ec1912be3288138e UNUSED LICENSES: From 9bfa96dee97b9d679a95bba6bbc4036781534276 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Tue, 9 Apr 2019 10:21:12 -0700 Subject: [PATCH 0752/1117] Add trace events for creating minikin fonts (#8477) Creating fonts can take a long time (50ms+) during frame build in the UI thread. Trace them to help us understand when it's causing a jank. --- third_party/txt/src/txt/font_collection.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/third_party/txt/src/txt/font_collection.cc b/third_party/txt/src/txt/font_collection.cc index 918f490c464c2..2872af08c0e65 100644 --- a/third_party/txt/src/txt/font_collection.cc +++ b/third_party/txt/src/txt/font_collection.cc @@ -25,6 +25,7 @@ #include #include #include "flutter/fml/logging.h" +#include "flutter/fml/trace_event.h" #include "font_skia.h" #include "txt/platform.h" #include "txt/text_style.h" @@ -184,6 +185,7 @@ FontCollection::GetMinikinFontCollectionForFamilies( std::shared_ptr FontCollection::FindFontFamilyInManagers( const std::string& family_name) { + TRACE_EVENT0("flutter", "FontCollection::FindFontFamilyInManagers"); // Search for the font family in each font manager. for (sk_sp& manager : GetFontManagerOrder()) { std::shared_ptr minikin_family = @@ -198,6 +200,8 @@ std::shared_ptr FontCollection::FindFontFamilyInManagers( std::shared_ptr FontCollection::CreateMinikinFontFamily( const sk_sp& manager, const std::string& family_name) { + TRACE_EVENT1("flutter", "FontCollection::CreateMinikinFontFamily", + "family_name", family_name.c_str()); sk_sp font_style_set( manager->matchFamily(family_name.c_str())); if (font_style_set == nullptr || font_style_set->count() == 0) { @@ -208,6 +212,7 @@ std::shared_ptr FontCollection::CreateMinikinFontFamily( // Add fonts to the Minikin font family. for (int i = 0; i < font_style_set->count(); ++i) { + TRACE_EVENT0("flutter", "CreateMinikinFont") // Create the skia typeface. sk_sp skia_typeface( sk_sp(font_style_set->createTypeface(i))); @@ -225,6 +230,8 @@ std::shared_ptr FontCollection::CreateMinikinFontFamily( minikin_fonts.emplace_back(std::move(minikin_font)); } + TRACE_EVENT1("flutter", "minikin::FontFamily", "MinikinFontsCount", + std::to_string(minikin_fonts.size()).c_str()); return std::make_shared(std::move(minikin_fonts)); } @@ -270,6 +277,7 @@ const std::shared_ptr& FontCollection::DoMatchFallbackFont( const std::shared_ptr& FontCollection::GetFallbackFontFamily(const sk_sp& manager, const std::string& family_name) { + TRACE_EVENT0("flutter", "FontCollection::GetFallbackFontFamily"); auto fallback_it = fallback_fonts_.find(family_name); if (fallback_it != fallback_fonts_.end()) { return fallback_it->second; From 000f8e31ae53ad0c8fdb198dda2155eb117cefbb Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 9 Apr 2019 11:18:06 -0700 Subject: [PATCH 0753/1117] Remove dart_utf_tag from DEPS --- DEPS | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/DEPS b/DEPS index 5f5f093fa7247..26413a6e46c31 100644 --- a/DEPS +++ b/DEPS @@ -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': 'cc63d6e647df1cfd34a54adb63aba7f937ce6f6b', + 'dart_revision': '06ed3f598c4baf48c7a09ff90240dae02d6d6df5', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -52,7 +52,7 @@ vars = { 'dart_dartdoc_tag': 'v0.28.2', 'dart_fixnum_tag': '0.10.9', 'dart_glob_tag': '1.1.7', - 'dart_html_tag': '0.13.4+1', + 'dart_html_tag': '0.14.0', 'dart_http_multi_server_tag': '2.0.5', 'dart_http_parser_tag': '3.1.3', 'dart_http_retry_tag': '0.1.1', @@ -94,7 +94,6 @@ vars = { 'dart_test_tag': '1.3.4', 'dart_typed_data_tag': '1.1.6', 'dart_usage_tag': '3.4.0', - 'dart_utf_tag': '0.9.0+5', 'dart_watcher_rev': '0.9.7+12', 'dart_web_socket_channel_tag': '1.0.9', 'dart_yaml_tag': '2.1.15', @@ -341,9 +340,6 @@ deps = { 'src/third_party/dart/third_party/pkg/test': Var('dart_git') + '/test.git' + '@' + Var('dart_test_tag'), - 'src/third_party/dart/third_party/pkg/utf': - Var('dart_git') + '/utf.git' + '@' + Var('dart_utf_tag'), - 'src/third_party/dart/third_party/pkg/usage': Var('dart_git') + '/usage.git' + '@' + Var('dart_usage_tag'), From fff80a0d95e92da3bca4b73b935de59337b620c9 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 9 Apr 2019 12:20:40 -0700 Subject: [PATCH 0754/1117] Roll src/third_party/dart 06ed3f598c..06ed3f598c (0 commits) --- ci/licenses_golden/licenses_third_party | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 399228ebbc79a..06004ee215a85 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: c14120782eb49deb9f66922808723741 +Signature: 4cf7ee38ae49da305ce5588b83b4c21b UNUSED LICENSES: From eec74e5c92313f01a28dfbeb78d96e81231edab7 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 9 Apr 2019 12:44:42 -0700 Subject: [PATCH 0755/1117] Rename the blink namespace to flutter. (#8517) Some components in the Flutter engine were derived from the forked blink codebase. While the forked components have either been removed or rewritten, the use of the blink namespace has mostly (and inconsistently) remained. This renames the blink namesapce to flutter for consistency. There are no functional changes in this patch. --- assets/asset_manager.cc | 8 +- assets/asset_manager.h | 8 +- assets/asset_resolver.h | 4 +- assets/directory_asset_bundle.cc | 8 +- assets/directory_asset_bundle.h | 8 +- assets/zip_asset_store.cc | 8 +- assets/zip_asset_store.h | 8 +- common/settings.cc | 4 +- common/settings.h | 4 +- common/task_runners.cc | 4 +- common/task_runners.h | 4 +- common/version/version.cc | 4 +- common/version/version.h | 4 +- lib/io/dart_io.cc | 4 +- lib/io/dart_io.h | 4 +- lib/ui/compositing/scene.cc | 4 +- lib/ui/compositing/scene.h | 4 +- lib/ui/compositing/scene_builder.cc | 4 +- lib/ui/compositing/scene_builder.h | 4 +- lib/ui/compositing/scene_host.cc | 12 +- lib/ui/compositing/scene_host.h | 4 +- lib/ui/dart_runtime_hooks.cc | 4 +- lib/ui/dart_runtime_hooks.h | 4 +- lib/ui/dart_ui.cc | 4 +- lib/ui/dart_ui.h | 4 +- lib/ui/dart_wrapper.h | 4 +- lib/ui/io_manager.h | 4 +- .../isolate_name_server.cc | 4 +- .../isolate_name_server/isolate_name_server.h | 4 +- .../isolate_name_server_natives.cc | 4 +- .../isolate_name_server_natives.h | 4 +- lib/ui/painting/canvas.cc | 4 +- lib/ui/painting/canvas.h | 4 +- lib/ui/painting/codec.cc | 4 +- lib/ui/painting/codec.h | 4 +- lib/ui/painting/engine_layer.cc | 4 +- lib/ui/painting/engine_layer.h | 4 +- lib/ui/painting/frame_info.cc | 4 +- lib/ui/painting/frame_info.h | 4 +- lib/ui/painting/gradient.cc | 4 +- lib/ui/painting/gradient.h | 4 +- lib/ui/painting/image.cc | 4 +- lib/ui/painting/image.h | 4 +- lib/ui/painting/image_encoding.cc | 4 +- lib/ui/painting/image_encoding.h | 4 +- lib/ui/painting/image_filter.cc | 4 +- lib/ui/painting/image_filter.h | 4 +- lib/ui/painting/image_shader.cc | 4 +- lib/ui/painting/image_shader.h | 4 +- lib/ui/painting/matrix.cc | 4 +- lib/ui/painting/matrix.h | 4 +- lib/ui/painting/paint.cc | 12 +- lib/ui/painting/paint.h | 20 +-- lib/ui/painting/path.cc | 4 +- lib/ui/painting/path.h | 4 +- lib/ui/painting/path_measure.cc | 4 +- lib/ui/painting/path_measure.h | 4 +- lib/ui/painting/picture.cc | 4 +- lib/ui/painting/picture.h | 4 +- lib/ui/painting/picture_recorder.cc | 4 +- lib/ui/painting/picture_recorder.h | 4 +- lib/ui/painting/rrect.cc | 2 +- lib/ui/painting/rrect.h | 14 +- lib/ui/painting/shader.cc | 4 +- lib/ui/painting/shader.h | 4 +- lib/ui/painting/vertices.cc | 4 +- lib/ui/painting/vertices.h | 4 +- lib/ui/plugins/callback_cache.cc | 4 +- lib/ui/plugins/callback_cache.h | 4 +- .../semantics/custom_accessibility_action.cc | 4 +- .../semantics/custom_accessibility_action.h | 4 +- lib/ui/semantics/semantics_node.cc | 4 +- lib/ui/semantics/semantics_node.h | 4 +- lib/ui/semantics/semantics_update.cc | 4 +- lib/ui/semantics/semantics_update.h | 4 +- lib/ui/semantics/semantics_update_builder.cc | 4 +- lib/ui/semantics/semantics_update_builder.h | 4 +- lib/ui/snapshot_delegate.h | 4 +- lib/ui/text/asset_manager_font_provider.cc | 8 +- lib/ui/text/asset_manager_font_provider.h | 12 +- lib/ui/text/font_collection.cc | 4 +- lib/ui/text/font_collection.h | 4 +- lib/ui/text/paragraph.cc | 4 +- lib/ui/text/paragraph.h | 4 +- lib/ui/text/paragraph_builder.cc | 6 +- lib/ui/text/paragraph_builder.h | 4 +- lib/ui/text/paragraph_impl.cc | 2 +- lib/ui/text/paragraph_impl.h | 4 +- lib/ui/text/paragraph_impl_txt.cc | 6 +- lib/ui/text/paragraph_impl_txt.h | 4 +- lib/ui/text/text_box.cc | 2 +- lib/ui/text/text_box.h | 10 +- lib/ui/ui_dart_state.cc | 4 +- lib/ui/ui_dart_state.h | 4 +- lib/ui/versions.cc | 4 +- lib/ui/versions.h | 4 +- lib/ui/window/platform_message.cc | 4 +- lib/ui/window/platform_message.h | 4 +- lib/ui/window/platform_message_response.cc | 4 +- lib/ui/window/platform_message_response.h | 4 +- .../window/platform_message_response_dart.cc | 4 +- .../window/platform_message_response_dart.h | 4 +- lib/ui/window/pointer_data.cc | 4 +- lib/ui/window/pointer_data.h | 4 +- lib/ui/window/pointer_data_packet.cc | 4 +- lib/ui/window/pointer_data_packet.h | 4 +- lib/ui/window/viewport_metrics.cc | 4 +- lib/ui/window/viewport_metrics.h | 4 +- lib/ui/window/window.cc | 4 +- lib/ui/window/window.h | 6 +- runtime/dart_isolate.cc | 10 +- runtime/dart_isolate.h | 4 +- runtime/dart_isolate_unittests.cc | 10 +- runtime/dart_lifecycle_unittests.cc | 4 +- runtime/dart_service_isolate.cc | 4 +- runtime/dart_service_isolate.h | 4 +- runtime/dart_service_isolate_unittests.cc | 4 +- runtime/dart_snapshot.cc | 4 +- runtime/dart_snapshot.h | 4 +- runtime/dart_snapshot_buffer.cc | 4 +- runtime/dart_snapshot_buffer.h | 4 +- runtime/dart_vm.cc | 21 +-- runtime/dart_vm.h | 4 +- runtime/dart_vm_data.cc | 4 +- runtime/dart_vm_data.h | 4 +- runtime/dart_vm_lifecycle.cc | 4 +- runtime/dart_vm_lifecycle.h | 4 +- runtime/dart_vm_unittests.cc | 4 +- runtime/embedder_resources.cc | 4 +- runtime/embedder_resources.h | 4 +- runtime/runtime_controller.cc | 4 +- runtime/runtime_controller.h | 18 +-- runtime/runtime_delegate.cc | 4 +- runtime/runtime_delegate.h | 8 +- runtime/runtime_test.cc | 4 +- runtime/runtime_test.h | 4 +- runtime/service_protocol.cc | 4 +- runtime/service_protocol.h | 4 +- runtime/start_up.cc | 4 +- runtime/start_up.h | 4 +- runtime/test_font_data.cc | 4 +- runtime/test_font_data.h | 4 +- shell/common/animator.cc | 2 +- shell/common/animator.h | 4 +- shell/common/engine.cc | 55 ++++---- shell/common/engine.h | 73 +++++----- shell/common/io_manager.h | 2 +- shell/common/isolate_configuration.cc | 22 +-- shell/common/isolate_configuration.h | 8 +- shell/common/persistent_cache.cc | 4 +- shell/common/platform_view.cc | 17 +-- shell/common/platform_view.h | 27 ++-- shell/common/rasterizer.cc | 7 +- shell/common/rasterizer.h | 12 +- shell/common/run_configuration.cc | 17 +-- shell/common/run_configuration.h | 10 +- shell/common/shell.cc | 132 +++++++++--------- shell/common/shell.h | 84 +++++------ shell/common/shell_benchmarks.cc | 4 +- shell/common/shell_test.cc | 12 +- shell/common/shell_test.h | 6 +- shell/common/shell_unittests.cc | 38 ++--- shell/common/switches.cc | 11 +- shell/common/switches.h | 2 +- shell/common/vsync_waiter.cc | 2 +- shell/common/vsync_waiter.h | 4 +- shell/common/vsync_waiter_fallback.cc | 2 +- shell/common/vsync_waiter_fallback.h | 2 +- .../platform/android/android_shell_holder.cc | 18 +-- shell/platform/android/android_shell_holder.h | 12 +- shell/platform/android/apk_asset_provider.cc | 4 +- shell/platform/android/apk_asset_provider.h | 8 +- shell/platform/android/flutter_main.cc | 12 +- shell/platform/android/flutter_main.h | 6 +- .../platform_message_response_android.cc | 4 +- .../platform_message_response_android.h | 6 +- .../platform/android/platform_view_android.cc | 29 ++-- .../platform/android/platform_view_android.h | 12 +- .../android/platform_view_android_jni.cc | 20 +-- .../platform/android/vsync_waiter_android.cc | 2 +- shell/platform/android/vsync_waiter_android.h | 2 +- .../framework/Source/FlutterCallbackCache.mm | 6 +- .../framework/Source/FlutterDartProject.mm | 10 +- .../Source/FlutterDartProject_Internal.h | 2 +- .../ios/framework/Source/FlutterEngine.mm | 30 ++-- .../framework/Source/FlutterEngine_Internal.h | 4 +- .../Source/FlutterObservatoryPublisher.mm | 6 +- .../FlutterPluginAppLifeCycleDelegate.mm | 2 +- .../framework/Source/FlutterViewController.mm | 64 ++++----- .../framework/Source/accessibility_bridge.h | 18 +-- .../framework/Source/accessibility_bridge.mm | 113 +++++++-------- .../Source/accessibility_text_entry.mm | 8 +- .../Source/platform_message_response_darwin.h | 2 +- .../Source/platform_message_router.h | 3 +- .../Source/platform_message_router.mm | 4 +- .../ios/framework/Source/vsync_waiter_ios.h | 2 +- .../ios/framework/Source/vsync_waiter_ios.mm | 2 +- shell/platform/darwin/ios/platform_view_ios.h | 8 +- .../platform/darwin/ios/platform_view_ios.mm | 9 +- shell/platform/embedder/embedder.cc | 62 ++++---- shell/platform/embedder/embedder_engine.cc | 12 +- shell/platform/embedder/embedder_engine.h | 12 +- .../platform/embedder/embedder_thread_host.cc | 8 +- .../platform/embedder/embedder_thread_host.h | 6 +- .../embedder/platform_view_embedder.cc | 10 +- .../embedder/platform_view_embedder.h | 16 +-- .../embedder/tests/embedder_a11y_unittests.cc | 2 +- .../embedder/tests/embedder_context.cc | 2 +- .../embedder/vsync_waiter_embedder.cc | 2 +- .../platform/embedder/vsync_waiter_embedder.h | 3 +- shell/testing/tester_main.cc | 26 ++-- 211 files changed, 932 insertions(+), 915 deletions(-) diff --git a/assets/asset_manager.cc b/assets/asset_manager.cc index 610bd10a14a3f..002c5b77a8e88 100644 --- a/assets/asset_manager.cc +++ b/assets/asset_manager.cc @@ -7,7 +7,7 @@ #include "flutter/assets/directory_asset_bundle.h" #include "flutter/fml/trace_event.h" -namespace blink { +namespace flutter { AssetManager::AssetManager() = default; @@ -29,7 +29,7 @@ void AssetManager::PushBack(std::unique_ptr resolver) { resolvers_.push_back(std::move(resolver)); } -// |blink::AssetResolver| +// |flutter::AssetResolver| std::unique_ptr AssetManager::GetAsMapping( const std::string& asset_name) const { if (asset_name.size() == 0) { @@ -47,9 +47,9 @@ std::unique_ptr AssetManager::GetAsMapping( return nullptr; } -// |blink::AssetResolver| +// |flutter::AssetResolver| bool AssetManager::IsValid() const { return resolvers_.size() > 0; } -} // namespace blink +} // namespace flutter diff --git a/assets/asset_manager.h b/assets/asset_manager.h index 42ffa9b1053c4..d19bbb799a234 100644 --- a/assets/asset_manager.h +++ b/assets/asset_manager.h @@ -13,7 +13,7 @@ #include "flutter/fml/macros.h" #include "flutter/fml/memory/ref_counted.h" -namespace blink { +namespace flutter { class AssetManager final : public AssetResolver { public: @@ -25,10 +25,10 @@ class AssetManager final : public AssetResolver { void PushBack(std::unique_ptr resolver); - // |blink::AssetResolver| + // |flutter::AssetResolver| bool IsValid() const override; - // |blink::AssetResolver| + // |flutter::AssetResolver| std::unique_ptr GetAsMapping( const std::string& asset_name) const override; @@ -38,6 +38,6 @@ class AssetManager final : public AssetResolver { FML_DISALLOW_COPY_AND_ASSIGN(AssetManager); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_ASSETS_ASSET_MANAGER_H_ diff --git a/assets/asset_resolver.h b/assets/asset_resolver.h index c49b8fb99a868..cbfadd2ada455 100644 --- a/assets/asset_resolver.h +++ b/assets/asset_resolver.h @@ -11,7 +11,7 @@ #include "flutter/fml/macros.h" #include "flutter/fml/mapping.h" -namespace blink { +namespace flutter { class AssetResolver { public: @@ -29,6 +29,6 @@ class AssetResolver { FML_DISALLOW_COPY_AND_ASSIGN(AssetResolver); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_ASSETS_ASSET_RESOLVER_H_ diff --git a/assets/directory_asset_bundle.cc b/assets/directory_asset_bundle.cc index 2f39535314d91..ceb42447f8486 100644 --- a/assets/directory_asset_bundle.cc +++ b/assets/directory_asset_bundle.cc @@ -10,7 +10,7 @@ #include "flutter/fml/file.h" #include "flutter/fml/mapping.h" -namespace blink { +namespace flutter { DirectoryAssetBundle::DirectoryAssetBundle(fml::UniqueFD descriptor) : descriptor_(std::move(descriptor)) { @@ -22,12 +22,12 @@ DirectoryAssetBundle::DirectoryAssetBundle(fml::UniqueFD descriptor) DirectoryAssetBundle::~DirectoryAssetBundle() = default; -// |blink::AssetResolver| +// |flutter::AssetResolver| bool DirectoryAssetBundle::IsValid() const { return is_valid_; } -// |blink::AssetResolver| +// |flutter::AssetResolver| std::unique_ptr DirectoryAssetBundle::GetAsMapping( const std::string& asset_name) const { if (!is_valid_) { @@ -45,4 +45,4 @@ std::unique_ptr DirectoryAssetBundle::GetAsMapping( return mapping; } -} // namespace blink +} // namespace flutter diff --git a/assets/directory_asset_bundle.h b/assets/directory_asset_bundle.h index 041c301e8730a..660d8df04dff7 100644 --- a/assets/directory_asset_bundle.h +++ b/assets/directory_asset_bundle.h @@ -10,7 +10,7 @@ #include "flutter/fml/memory/ref_counted.h" #include "flutter/fml/unique_fd.h" -namespace blink { +namespace flutter { class DirectoryAssetBundle : public AssetResolver { public: @@ -22,16 +22,16 @@ class DirectoryAssetBundle : public AssetResolver { const fml::UniqueFD descriptor_; bool is_valid_ = false; - // |blink::AssetResolver| + // |flutter::AssetResolver| bool IsValid() const override; - // |blink::AssetResolver| + // |flutter::AssetResolver| std::unique_ptr GetAsMapping( const std::string& asset_name) const override; FML_DISALLOW_COPY_AND_ASSIGN(DirectoryAssetBundle); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_ASSETS_DIRECTORY_ASSET_BUNDLE_H_ diff --git a/assets/zip_asset_store.cc b/assets/zip_asset_store.cc index 97228f96087a8..2c3a576452ad9 100644 --- a/assets/zip_asset_store.cc +++ b/assets/zip_asset_store.cc @@ -16,7 +16,7 @@ #include "flutter/fml/trace_event.h" -namespace blink { +namespace flutter { void UniqueUnzipperTraits::Free(void* file) { unzClose(file); @@ -33,12 +33,12 @@ UniqueUnzipper ZipAssetStore::CreateUnzipper() const { return UniqueUnzipper{::unzOpen2(file_path_.c_str(), nullptr)}; } -// |blink::AssetResolver| +// |flutter::AssetResolver| bool ZipAssetStore::IsValid() const { return stat_cache_.size() > 0; } -// |blink::AssetResolver| +// |flutter::AssetResolver| std::unique_ptr ZipAssetStore::GetAsMapping( const std::string& asset_name) const { TRACE_EVENT1("flutter", "ZipAssetStore::GetAsMapping", "name", @@ -126,4 +126,4 @@ void ZipAssetStore::BuildStatCache() { } while (unzGoToNextFile(unzipper.get()) == UNZ_OK); } -} // namespace blink +} // namespace flutter diff --git a/assets/zip_asset_store.h b/assets/zip_asset_store.h index b8b66a7d4f5ea..b80f5432a0de7 100644 --- a/assets/zip_asset_store.h +++ b/assets/zip_asset_store.h @@ -11,7 +11,7 @@ #include "flutter/fml/macros.h" #include "third_party/zlib/contrib/minizip/unzip.h" -namespace blink { +namespace flutter { struct UniqueUnzipperTraits { static inline void* InvalidValue() { return nullptr; } @@ -40,10 +40,10 @@ class ZipAssetStore final : public AssetResolver { mutable std::map stat_cache_; - // |blink::AssetResolver| + // |flutter::AssetResolver| bool IsValid() const override; - // |blink::AssetResolver| + // |flutter::AssetResolver| std::unique_ptr GetAsMapping( const std::string& asset_name) const override; @@ -54,6 +54,6 @@ class ZipAssetStore final : public AssetResolver { FML_DISALLOW_COPY_AND_ASSIGN(ZipAssetStore); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_ASSETS_ZIP_ASSET_STORE_H_ diff --git a/common/settings.cc b/common/settings.cc index b292d376be0c3..7dae838f4ac7f 100644 --- a/common/settings.cc +++ b/common/settings.cc @@ -6,7 +6,7 @@ #include -namespace blink { +namespace flutter { Settings::Settings() = default; @@ -54,4 +54,4 @@ std::string Settings::ToString() const { return stream.str(); } -} // namespace blink +} // namespace flutter diff --git a/common/settings.h b/common/settings.h index 1bd54f4126b38..ab47a559ffe8e 100644 --- a/common/settings.h +++ b/common/settings.h @@ -16,7 +16,7 @@ #include "flutter/fml/mapping.h" #include "flutter/fml/unique_fd.h" -namespace blink { +namespace flutter { using TaskObserverAdd = std::function; @@ -145,6 +145,6 @@ struct Settings { std::string ToString() const; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_COMMON_SETTINGS_H_ diff --git a/common/task_runners.cc b/common/task_runners.cc index d76bc20f6ae38..baa0d2b132c91 100644 --- a/common/task_runners.cc +++ b/common/task_runners.cc @@ -6,7 +6,7 @@ #include -namespace blink { +namespace flutter { TaskRunners::TaskRunners(std::string label, fml::RefPtr platform, @@ -47,4 +47,4 @@ bool TaskRunners::IsValid() const { return platform_ && gpu_ && ui_ && io_; } -} // namespace blink +} // namespace flutter diff --git a/common/task_runners.h b/common/task_runners.h index 0bd0c301903ae..6e08abcad1d1d 100644 --- a/common/task_runners.h +++ b/common/task_runners.h @@ -10,7 +10,7 @@ #include "flutter/fml/macros.h" #include "flutter/fml/task_runner.h" -namespace blink { +namespace flutter { class TaskRunners { public: @@ -44,6 +44,6 @@ class TaskRunners { fml::RefPtr io_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_COMMON_TASK_RUNNERS_H_ diff --git a/common/version/version.cc b/common/version/version.cc index e1d1c57d3baa8..db5fb0608001e 100644 --- a/common/version/version.cc +++ b/common/version/version.cc @@ -4,7 +4,7 @@ #include "flutter/common/version/version.h" -namespace blink { +namespace flutter { const char* GetFlutterEngineVersion() { return FLUTTER_ENGINE_VERSION; @@ -18,4 +18,4 @@ const char* GetDartVersion() { return DART_VERSION; } -} // namespace blink +} // namespace flutter diff --git a/common/version/version.h b/common/version/version.h index d9ca8aa3f17e3..00ab5031db419 100644 --- a/common/version/version.h +++ b/common/version/version.h @@ -5,7 +5,7 @@ #ifndef FLUTTER_COMMON_VERSION_VERSION_H_ #define FLUTTER_COMMON_VERSION_VERSION_H_ -namespace blink { +namespace flutter { const char* GetFlutterEngineVersion(); @@ -13,6 +13,6 @@ const char* GetSkiaVersion(); const char* GetDartVersion(); -} // namespace blink +} // namespace flutter #endif // FLUTTER_COMMON_VERSION_VERSION_H_ diff --git a/lib/io/dart_io.cc b/lib/io/dart_io.cc index ee59b9dd99de8..b0f2f0202ae01 100644 --- a/lib/io/dart_io.cc +++ b/lib/io/dart_io.cc @@ -10,7 +10,7 @@ using tonic::ToDart; -namespace blink { +namespace flutter { void DartIO::InitForIsolate() { Dart_Handle result = Dart_SetNativeResolver( @@ -25,4 +25,4 @@ bool DartIO::EntropySource(uint8_t* buffer, intptr_t length) { return dart::bin::GetEntropy(buffer, length); } -} // namespace blink +} // namespace flutter diff --git a/lib/io/dart_io.h b/lib/io/dart_io.h index 6d2a36abbbf45..a073a850b1f63 100644 --- a/lib/io/dart_io.h +++ b/lib/io/dart_io.h @@ -9,7 +9,7 @@ #include "flutter/fml/macros.h" -namespace blink { +namespace flutter { class DartIO { public: @@ -20,6 +20,6 @@ class DartIO { FML_DISALLOW_IMPLICIT_CONSTRUCTORS(DartIO); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_IO_DART_IO_H_ diff --git a/lib/ui/compositing/scene.cc b/lib/ui/compositing/scene.cc index 3ad02d3867cbf..4bf30e92aa474 100644 --- a/lib/ui/compositing/scene.cc +++ b/lib/ui/compositing/scene.cc @@ -14,7 +14,7 @@ #include "third_party/tonic/dart_binding_macros.h" #include "third_party/tonic/dart_library_natives.h" -namespace blink { +namespace flutter { IMPLEMENT_WRAPPERTYPEINFO(ui, Scene); @@ -72,4 +72,4 @@ std::unique_ptr Scene::takeLayerTree() { return std::move(m_layerTree); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/compositing/scene.h b/lib/ui/compositing/scene.h index 308a652c1e5ed..7bec8f7e58ea1 100644 --- a/lib/ui/compositing/scene.h +++ b/lib/ui/compositing/scene.h @@ -16,7 +16,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class Scene : public RefCountedDartWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -48,6 +48,6 @@ class Scene : public RefCountedDartWrappable { std::unique_ptr m_layerTree; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_COMPOSITING_SCENE_H_ diff --git a/lib/ui/compositing/scene_builder.cc b/lib/ui/compositing/scene_builder.cc index c028196969c2d..e504529559b6a 100644 --- a/lib/ui/compositing/scene_builder.cc +++ b/lib/ui/compositing/scene_builder.cc @@ -35,7 +35,7 @@ #include "flutter/flow/layers/child_scene_layer.h" #endif -namespace blink { +namespace flutter { static void SceneBuilder_constructor(Dart_NativeArguments args) { DartCallConstructor(&SceneBuilder::create, args); @@ -327,4 +327,4 @@ void SceneBuilder::PushLayer(std::shared_ptr layer) { current_layer_ = newLayer; } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/compositing/scene_builder.h b/lib/ui/compositing/scene_builder.h index 84723049a9160..3f33d17c435e5 100644 --- a/lib/ui/compositing/scene_builder.h +++ b/lib/ui/compositing/scene_builder.h @@ -24,7 +24,7 @@ #include "flutter/lib/ui/compositing/scene_host.h" #endif -namespace blink { +namespace flutter { class SceneBuilder : public RefCountedDartWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -120,6 +120,6 @@ class SceneBuilder : public RefCountedDartWrappable { FML_DISALLOW_COPY_AND_ASSIGN(SceneBuilder); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_COMPOSITING_SCENE_BUILDER_H_ diff --git a/lib/ui/compositing/scene_host.cc b/lib/ui/compositing/scene_host.cc index 75f40449f2ded..4247fc247cb44 100644 --- a/lib/ui/compositing/scene_host.cc +++ b/lib/ui/compositing/scene_host.cc @@ -18,14 +18,14 @@ namespace { -using SceneHostBindings = std::unordered_map; +using SceneHostBindings = std::unordered_map; FML_THREAD_LOCAL fml::ThreadLocal tls_scene_host_bindings([](intptr_t value) { delete reinterpret_cast(value); }); void SceneHost_constructor(Dart_NativeArguments args) { - tonic::DartCallConstructor(&blink::SceneHost::Create, args); + tonic::DartCallConstructor(&flutter::SceneHost::Create, args); } void SceneHost_constructorViewHolderToken(Dart_NativeArguments args) { @@ -36,10 +36,10 @@ void SceneHost_constructorViewHolderToken(Dart_NativeArguments args) { reinterpret_cast(new SceneHostBindings())); } - tonic::DartCallConstructor(&blink::SceneHost::CreateViewHolder, args); + tonic::DartCallConstructor(&flutter::SceneHost::CreateViewHolder, args); } -blink::SceneHost* GetSceneHost(scenic::ResourceId id) { +flutter::SceneHost* GetSceneHost(scenic::ResourceId id) { auto* bindings = reinterpret_cast(tls_scene_host_bindings.Get()); FML_DCHECK(bindings); @@ -80,7 +80,7 @@ void InvokeDartFunction(tonic::DartPersistentValue* function, T& arg) { } // namespace -namespace blink { +namespace flutter { IMPLEMENT_WRAPPERTYPEINFO(ui, SceneHost); @@ -229,4 +229,4 @@ void SceneHost::dispose() { ClearDartWrapper(); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/compositing/scene_host.h b/lib/ui/compositing/scene_host.h index 04f4ffa824718..38c4503eb74a2 100644 --- a/lib/ui/compositing/scene_host.h +++ b/lib/ui/compositing/scene_host.h @@ -16,7 +16,7 @@ #include "flutter/fml/task_runner.h" #include "flutter/lib/ui/dart_wrapper.h" -namespace blink { +namespace flutter { class SceneHost : public RefCountedDartWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -64,6 +64,6 @@ class SceneHost : public RefCountedDartWrappable { bool use_view_holder_ = false; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_COMPOSITING_SCENE_HOST_H_ diff --git a/lib/ui/dart_runtime_hooks.cc b/lib/ui/dart_runtime_hooks.cc index 32f4bf0845e50..1b08181313543 100644 --- a/lib/ui/dart_runtime_hooks.cc +++ b/lib/ui/dart_runtime_hooks.cc @@ -41,7 +41,7 @@ using tonic::DartConverter; using tonic::LogIfError; using tonic::ToDart; -namespace blink { +namespace flutter { #define REGISTER_FUNCTION(name, count) {"" #name, name, count, true}, #define DECLARE_FUNCTION(name, count) \ @@ -344,4 +344,4 @@ void GetCallbackFromHandle(Dart_NativeArguments args) { Dart_SetReturnValue(args, DartCallbackCache::GetCallback(handle)); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/dart_runtime_hooks.h b/lib/ui/dart_runtime_hooks.h index d3beefa46bd36..62f4234cd1671 100644 --- a/lib/ui/dart_runtime_hooks.h +++ b/lib/ui/dart_runtime_hooks.h @@ -9,7 +9,7 @@ #include "third_party/dart/runtime/include/dart_api.h" #include "third_party/tonic/dart_library_natives.h" -namespace blink { +namespace flutter { class DartRuntimeHooks { public: @@ -20,6 +20,6 @@ class DartRuntimeHooks { FML_DISALLOW_IMPLICIT_CONSTRUCTORS(DartRuntimeHooks); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_DART_RUNTIME_HOOKS_H_ diff --git a/lib/ui/dart_ui.cc b/lib/ui/dart_ui.cc index 514813017978d..a434db2b95baa 100644 --- a/lib/ui/dart_ui.cc +++ b/lib/ui/dart_ui.cc @@ -38,7 +38,7 @@ using tonic::ToDart; -namespace blink { +namespace flutter { namespace { static tonic::DartLibraryNatives* g_natives; @@ -117,4 +117,4 @@ void DartUI::InitForIsolate(bool is_root_isolate) { } } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/dart_ui.h b/lib/ui/dart_ui.h index 8dd4a3270ed6e..fd3fabfd95a66 100644 --- a/lib/ui/dart_ui.h +++ b/lib/ui/dart_ui.h @@ -7,7 +7,7 @@ #include "flutter/fml/macros.h" -namespace blink { +namespace flutter { class DartUI { public: @@ -18,6 +18,6 @@ class DartUI { FML_DISALLOW_IMPLICIT_CONSTRUCTORS(DartUI); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_DART_UI_H_ diff --git a/lib/ui/dart_wrapper.h b/lib/ui/dart_wrapper.h index ef895513dda64..fdd2e35b1ba42 100644 --- a/lib/ui/dart_wrapper.h +++ b/lib/ui/dart_wrapper.h @@ -8,7 +8,7 @@ #include "flutter/fml/memory/ref_counted.h" #include "third_party/tonic/dart_wrappable.h" -namespace blink { +namespace flutter { template class RefCountedDartWrappable : public fml::RefCountedThreadSafe, @@ -23,6 +23,6 @@ class RefCountedDartWrappable : public fml::RefCountedThreadSafe, } }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_DART_WRAPPER_H_ diff --git a/lib/ui/io_manager.h b/lib/ui/io_manager.h index cf260e0abb6b3..1b2a2370cbcd3 100644 --- a/lib/ui/io_manager.h +++ b/lib/ui/io_manager.h @@ -9,7 +9,7 @@ #include "flutter/fml/memory/weak_ptr.h" #include "third_party/skia/include/gpu/GrContext.h" -namespace blink { +namespace flutter { // Interface for methods that manage access to the resource GrContext and Skia // unref queue. Meant to be implemented by the owner of the resource GrContext, // i.e. the shell's IOManager. @@ -20,6 +20,6 @@ class IOManager { virtual fml::RefPtr GetSkiaUnrefQueue() const = 0; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_IO_MANAGER_H_ diff --git a/lib/ui/isolate_name_server/isolate_name_server.cc b/lib/ui/isolate_name_server/isolate_name_server.cc index deae4fe6f8f16..118b00df71d62 100644 --- a/lib/ui/isolate_name_server/isolate_name_server.cc +++ b/lib/ui/isolate_name_server/isolate_name_server.cc @@ -4,7 +4,7 @@ #include "flutter/lib/ui/isolate_name_server/isolate_name_server.h" -namespace blink { +namespace flutter { IsolateNameServer::IsolateNameServer() {} @@ -45,4 +45,4 @@ bool IsolateNameServer::RemoveIsolateNameMapping(const std::string& name) { return true; } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/isolate_name_server/isolate_name_server.h b/lib/ui/isolate_name_server/isolate_name_server.h index db62ad871f771..ac840118cc56a 100644 --- a/lib/ui/isolate_name_server/isolate_name_server.h +++ b/lib/ui/isolate_name_server/isolate_name_server.h @@ -13,7 +13,7 @@ #include "flutter/fml/synchronization/thread_annotations.h" #include "third_party/dart/runtime/include/dart_api.h" -namespace blink { +namespace flutter { class IsolateNameServer { public: @@ -46,6 +46,6 @@ class IsolateNameServer { FML_DISALLOW_COPY_AND_ASSIGN(IsolateNameServer); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_ISOLATE_NAME_SERVER_H_ 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 3f7f80ef05fd7..ab27f6579d65a 100644 --- a/lib/ui/isolate_name_server/isolate_name_server_natives.cc +++ b/lib/ui/isolate_name_server/isolate_name_server_natives.cc @@ -10,7 +10,7 @@ #include "third_party/tonic/dart_binding_macros.h" #include "third_party/tonic/dart_library_natives.h" -namespace blink { +namespace flutter { Dart_Handle IsolateNameServerNatives::LookupPortByName( const std::string& name) { @@ -67,4 +67,4 @@ void IsolateNameServerNatives::RegisterNatives( natives->Register({FOR_EACH_BINDING(DART_REGISTER_NATIVE_STATIC_)}); } -} // namespace blink +} // namespace flutter 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 cc3e1438cfbee..cf36eb093c452 100644 --- a/lib/ui/isolate_name_server/isolate_name_server_natives.h +++ b/lib/ui/isolate_name_server/isolate_name_server_natives.h @@ -12,7 +12,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class IsolateNameServerNatives { public: @@ -23,6 +23,6 @@ class IsolateNameServerNatives { static void RegisterNatives(tonic::DartLibraryNatives* natives); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_ISOLATE_NAME_SERVER_NATIVES_H_ diff --git a/lib/ui/painting/canvas.cc b/lib/ui/painting/canvas.cc index 691a41949ecd7..803ae8735bef6 100644 --- a/lib/ui/painting/canvas.cc +++ b/lib/ui/painting/canvas.cc @@ -22,7 +22,7 @@ using tonic::ToDart; -namespace blink { +namespace flutter { static void Canvas_constructor(Dart_NativeArguments args) { DartCallConstructor(&Canvas::Create, args); @@ -431,4 +431,4 @@ bool Canvas::IsRecording() const { return !!canvas_; } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/canvas.h b/lib/ui/painting/canvas.h index 98632b9235edc..9e58a0fe0821a 100644 --- a/lib/ui/painting/canvas.h +++ b/lib/ui/painting/canvas.h @@ -22,7 +22,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class CanvasImage; class Canvas : public RefCountedDartWrappable { @@ -181,6 +181,6 @@ class Canvas : public RefCountedDartWrappable { SkCanvas* canvas_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PAINTING_CANVAS_H_ diff --git a/lib/ui/painting/codec.cc b/lib/ui/painting/codec.cc index 0b1de9c2c7889..600d9ad26e193 100644 --- a/lib/ui/painting/codec.cc +++ b/lib/ui/painting/codec.cc @@ -21,7 +21,7 @@ using tonic::DartInvoke; using tonic::DartPersistentValue; using tonic::ToDart; -namespace blink { +namespace flutter { namespace { @@ -553,4 +553,4 @@ void Codec::RegisterNatives(tonic::DartLibraryNatives* natives) { natives->Register({FOR_EACH_BINDING(DART_REGISTER_NATIVE)}); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/codec.h b/lib/ui/painting/codec.h index 0c104bf788e4b..777b77ea9a818 100644 --- a/lib/ui/painting/codec.h +++ b/lib/ui/painting/codec.h @@ -17,7 +17,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { // A handle to an SkCodec object. // @@ -96,6 +96,6 @@ class SingleFrameCodec : public Codec { FML_FRIEND_REF_COUNTED_THREAD_SAFE(SingleFrameCodec); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PAINTING_CODEC_H_ diff --git a/lib/ui/painting/engine_layer.cc b/lib/ui/painting/engine_layer.cc index f365e37cb8fbc..98b8b0ae3b238 100644 --- a/lib/ui/painting/engine_layer.cc +++ b/lib/ui/painting/engine_layer.cc @@ -13,7 +13,7 @@ using tonic::ToDart; -namespace blink { +namespace flutter { EngineLayer::EngineLayer(std::shared_ptr layer) : layer_(layer) {} @@ -33,4 +33,4 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, EngineLayer); DART_BIND_ALL(EngineLayer, FOR_EACH_BINDING) -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/engine_layer.h b/lib/ui/painting/engine_layer.h index a95e58a9e2e6a..653d559b9c0c6 100644 --- a/lib/ui/painting/engine_layer.h +++ b/lib/ui/painting/engine_layer.h @@ -13,7 +13,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class EngineLayer; @@ -41,6 +41,6 @@ class EngineLayer : public RefCountedDartWrappable { FML_FRIEND_MAKE_REF_COUNTED(EngineLayer); }; -} // namespace blink +} // namespace flutter #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 40359a02dce77..ad77f7b50d8a4 100644 --- a/lib/ui/painting/frame_info.cc +++ b/lib/ui/painting/frame_info.cc @@ -8,7 +8,7 @@ #include "third_party/tonic/dart_binding_macros.h" #include "third_party/tonic/dart_library_natives.h" -namespace blink { +namespace flutter { IMPLEMENT_WRAPPERTYPEINFO(ui, FrameInfo); @@ -27,4 +27,4 @@ void FrameInfo::RegisterNatives(tonic::DartLibraryNatives* natives) { natives->Register({FOR_EACH_BINDING(DART_REGISTER_NATIVE)}); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/frame_info.h b/lib/ui/painting/frame_info.h index 57ff23d91c43a..2637d3e66d182 100644 --- a/lib/ui/painting/frame_info.h +++ b/lib/ui/painting/frame_info.h @@ -12,7 +12,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { // A single animation frame. class FrameInfo final : public RefCountedDartWrappable { @@ -36,6 +36,6 @@ class FrameInfo final : public RefCountedDartWrappable { FML_FRIEND_REF_COUNTED_THREAD_SAFE(FrameInfo); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PAINTING_FRAME_INFO_H_ diff --git a/lib/ui/painting/gradient.cc b/lib/ui/painting/gradient.cc index d18f0a637ccad..72cb4f8ca6922 100644 --- a/lib/ui/painting/gradient.cc +++ b/lib/ui/painting/gradient.cc @@ -11,7 +11,7 @@ #include "third_party/tonic/dart_binding_macros.h" #include "third_party/tonic/dart_library_natives.h" -namespace blink { +namespace flutter { typedef CanvasGradient Gradient; // Because the C++ name doesn't match the Dart name. @@ -143,4 +143,4 @@ CanvasGradient::CanvasGradient() = default; CanvasGradient::~CanvasGradient() = default; -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/gradient.h b/lib/ui/painting/gradient.h index 622542db0a2ba..20501f6e8c385 100644 --- a/lib/ui/painting/gradient.h +++ b/lib/ui/painting/gradient.h @@ -17,7 +17,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { // TODO: update this if/when Skia adds Decal mode skbug.com/7638 static_assert(kSkTileModeCount >= 3, "Need to update tile mode enum"); @@ -69,6 +69,6 @@ class CanvasGradient : public Shader { CanvasGradient(); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PAINTING_GRADIENT_H_ diff --git a/lib/ui/painting/image.cc b/lib/ui/painting/image.cc index bbb3b69736ed6..a0a4bfcb02737 100644 --- a/lib/ui/painting/image.cc +++ b/lib/ui/painting/image.cc @@ -10,7 +10,7 @@ #include "third_party/tonic/dart_binding_macros.h" #include "third_party/tonic/dart_library_natives.h" -namespace blink { +namespace flutter { typedef CanvasImage Image; @@ -48,4 +48,4 @@ size_t CanvasImage::GetAllocationSize() { } } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/image.h b/lib/ui/painting/image.h index a2db734b57516..aef394b71312c 100644 --- a/lib/ui/painting/image.h +++ b/lib/ui/painting/image.h @@ -14,7 +14,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class CanvasImage final : public RefCountedDartWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -49,6 +49,6 @@ class CanvasImage final : public RefCountedDartWrappable { flow::SkiaGPUObject image_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PAINTING_IMAGE_H_ diff --git a/lib/ui/painting/image_encoding.cc b/lib/ui/painting/image_encoding.cc index cee3896dae7b3..5bb72936e7849 100644 --- a/lib/ui/painting/image_encoding.cc +++ b/lib/ui/painting/image_encoding.cc @@ -25,7 +25,7 @@ using tonic::DartInvoke; using tonic::DartPersistentValue; using tonic::ToDart; -namespace blink { +namespace flutter { namespace { // This must be kept in sync with the enum in painting.dart @@ -231,4 +231,4 @@ Dart_Handle EncodeImage(CanvasImage* canvas_image, return Dart_Null(); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/image_encoding.h b/lib/ui/painting/image_encoding.h index e4d66f0c8a0c9..df7801302d9be 100644 --- a/lib/ui/painting/image_encoding.h +++ b/lib/ui/painting/image_encoding.h @@ -7,7 +7,7 @@ #include "third_party/tonic/dart_library_natives.h" -namespace blink { +namespace flutter { class CanvasImage; @@ -15,6 +15,6 @@ Dart_Handle EncodeImage(CanvasImage* canvas_image, int format, Dart_Handle callback_handle); -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PAINTING_IMAGE_ENCODING_H_ diff --git a/lib/ui/painting/image_filter.cc b/lib/ui/painting/image_filter.cc index 94017beeb3ab3..742f6dfff0c62 100644 --- a/lib/ui/painting/image_filter.cc +++ b/lib/ui/painting/image_filter.cc @@ -13,7 +13,7 @@ #include "third_party/tonic/dart_binding_macros.h" #include "third_party/tonic/dart_library_natives.h" -namespace blink { +namespace flutter { static void ImageFilter_constructor(Dart_NativeArguments args) { DartCallConstructor(&ImageFilter::Create, args); @@ -63,4 +63,4 @@ void ImageFilter::initMatrix(const tonic::Float64List& matrix4, nullptr); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/image_filter.h b/lib/ui/painting/image_filter.h index 0cc0259113996..0bee25c8497a5 100644 --- a/lib/ui/painting/image_filter.h +++ b/lib/ui/painting/image_filter.h @@ -11,7 +11,7 @@ #include "third_party/skia/include/core/SkImageFilter.h" #include "third_party/tonic/typed_data/float64_list.h" -namespace blink { +namespace flutter { class ImageFilter : public RefCountedDartWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -36,6 +36,6 @@ class ImageFilter : public RefCountedDartWrappable { sk_sp filter_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PAINTING_IMAGE_FILTER_H_ diff --git a/lib/ui/painting/image_shader.cc b/lib/ui/painting/image_shader.cc index 136471e26c983..4aec1f18d5775 100644 --- a/lib/ui/painting/image_shader.cc +++ b/lib/ui/painting/image_shader.cc @@ -12,7 +12,7 @@ using tonic::ToDart; -namespace blink { +namespace flutter { static void ImageShader_constructor(Dart_NativeArguments args) { DartCallConstructor(&ImageShader::Create, args); @@ -51,4 +51,4 @@ ImageShader::ImageShader() = default; ImageShader::~ImageShader() = default; -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/image_shader.h b/lib/ui/painting/image_shader.h index e2a35cb285e22..555dadc706f57 100644 --- a/lib/ui/painting/image_shader.h +++ b/lib/ui/painting/image_shader.h @@ -18,7 +18,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class ImageShader : public Shader { DEFINE_WRAPPERTYPEINFO(); @@ -39,6 +39,6 @@ class ImageShader : public Shader { ImageShader(); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PAINTING_IMAGE_SHADER_H_ diff --git a/lib/ui/painting/matrix.cc b/lib/ui/painting/matrix.cc index 3fe56783b7bcd..52ba981ebda9d 100644 --- a/lib/ui/painting/matrix.cc +++ b/lib/ui/painting/matrix.cc @@ -6,7 +6,7 @@ #include "flutter/fml/logging.h" -namespace blink { +namespace flutter { // Mappings from SkMatrix-index to input-index. static const int kSkMatrixIndexToMatrix4Index[] = { @@ -38,4 +38,4 @@ tonic::Float64List ToMatrix4(const SkMatrix& sk_matrix) { return matrix4; } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/matrix.h b/lib/ui/painting/matrix.h index 0a1d35064bde1..e47e35917eaa5 100644 --- a/lib/ui/painting/matrix.h +++ b/lib/ui/painting/matrix.h @@ -8,11 +8,11 @@ #include "third_party/skia/include/core/SkMatrix.h" #include "third_party/tonic/typed_data/float64_list.h" -namespace blink { +namespace flutter { SkMatrix ToSkMatrix(const tonic::Float64List& matrix4); tonic::Float64List ToMatrix4(const SkMatrix& sk_matrix); -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PAINTING_MATRIX_H_ diff --git a/lib/ui/painting/paint.cc b/lib/ui/painting/paint.cc index 92d5ce3c18e4b..febe40fe70f64 100644 --- a/lib/ui/painting/paint.cc +++ b/lib/ui/painting/paint.cc @@ -13,7 +13,7 @@ #include "third_party/tonic/typed_data/dart_byte_data.h" #include "third_party/tonic/typed_data/float32_list.h" -namespace blink { +namespace flutter { // Indices for 32bit values. constexpr int kIsAntiAliasIndex = 0; @@ -202,11 +202,11 @@ Paint::Paint(Dart_Handle paint_objects, Dart_Handle paint_data) { } } -} // namespace blink +} // namespace flutter namespace tonic { -blink::Paint DartConverter::FromArguments( +flutter::Paint DartConverter::FromArguments( Dart_NativeArguments args, int index, Dart_Handle& exception) { @@ -216,14 +216,14 @@ blink::Paint DartConverter::FromArguments( Dart_Handle paint_data = Dart_GetNativeArgument(args, index + 1); FML_DCHECK(!LogIfError(paint_data)); - return blink::Paint(paint_objects, paint_data); + return flutter::Paint(paint_objects, paint_data); } -blink::PaintData DartConverter::FromArguments( +flutter::PaintData DartConverter::FromArguments( Dart_NativeArguments args, int index, Dart_Handle& exception) { - return blink::PaintData(); + return flutter::PaintData(); } } // namespace tonic diff --git a/lib/ui/painting/paint.h b/lib/ui/painting/paint.h index 67495736b489f..2c6eef8455af2 100644 --- a/lib/ui/painting/paint.h +++ b/lib/ui/painting/paint.h @@ -8,7 +8,7 @@ #include "third_party/skia/include/core/SkPaint.h" #include "third_party/tonic/converter/dart_converter.h" -namespace blink { +namespace flutter { class Paint { public: @@ -30,22 +30,22 @@ class Paint { // data for a Paint object). class PaintData {}; -} // namespace blink +} // namespace flutter namespace tonic { template <> -struct DartConverter { - static blink::Paint FromArguments(Dart_NativeArguments args, - int index, - Dart_Handle& exception); +struct DartConverter { + static flutter::Paint FromArguments(Dart_NativeArguments args, + int index, + Dart_Handle& exception); }; template <> -struct DartConverter { - static blink::PaintData FromArguments(Dart_NativeArguments args, - int index, - Dart_Handle& exception); +struct DartConverter { + static flutter::PaintData FromArguments(Dart_NativeArguments args, + int index, + Dart_Handle& exception); }; } // namespace tonic diff --git a/lib/ui/painting/path.cc b/lib/ui/painting/path.cc index b6daf002d40ff..facd8d1ce3899 100644 --- a/lib/ui/painting/path.cc +++ b/lib/ui/painting/path.cc @@ -15,7 +15,7 @@ using tonic::ToDart; -namespace blink { +namespace flutter { typedef CanvasPath Path; @@ -299,4 +299,4 @@ fml::RefPtr CanvasPath::clone() { return path; } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/path.h b/lib/ui/painting/path.h index c4bffa61f68e4..7605ef4bc2974 100644 --- a/lib/ui/painting/path.h +++ b/lib/ui/painting/path.h @@ -16,7 +16,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class CanvasPath : public RefCountedDartWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -112,6 +112,6 @@ class CanvasPath : public RefCountedDartWrappable { SkPath path_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PAINTING_PATH_H_ diff --git a/lib/ui/painting/path_measure.cc b/lib/ui/painting/path_measure.cc index 6eff5c310cf91..d195485d83652 100644 --- a/lib/ui/painting/path_measure.cc +++ b/lib/ui/painting/path_measure.cc @@ -15,7 +15,7 @@ using tonic::ToDart; -namespace blink { +namespace flutter { typedef CanvasPathMeasure PathMeasure; @@ -132,4 +132,4 @@ bool CanvasPathMeasure::nextContour() { return false; } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/path_measure.h b/lib/ui/painting/path_measure.h index c19bc29e614de..31c824f274726 100644 --- a/lib/ui/painting/path_measure.h +++ b/lib/ui/painting/path_measure.h @@ -20,7 +20,7 @@ class DartLibraryNatives; // Be sure that the client doesn't modify a path on us before Skia finishes // See AOSP's reasoning in PathMeasure.cpp -namespace blink { +namespace flutter { class CanvasPathMeasure : public RefCountedDartWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -52,6 +52,6 @@ class CanvasPathMeasure : public RefCountedDartWrappable { std::vector> measures_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PAINTING_PATH_MEASURE_H_ diff --git a/lib/ui/painting/picture.cc b/lib/ui/painting/picture.cc index f7cdd78ca1301..442b2c1702c25 100644 --- a/lib/ui/painting/picture.cc +++ b/lib/ui/painting/picture.cc @@ -15,7 +15,7 @@ #include "third_party/tonic/dart_persistent_value.h" #include "third_party/tonic/logging/dart_invoke.h" -namespace blink { +namespace flutter { IMPLEMENT_WRAPPERTYPEINFO(ui, Picture); @@ -125,4 +125,4 @@ Dart_Handle Picture::RasterizeToImage(sk_sp picture, return Dart_Null(); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/picture.h b/lib/ui/painting/picture.h index c1ff32a9bd7e2..b5c329537de74 100644 --- a/lib/ui/painting/picture.h +++ b/lib/ui/painting/picture.h @@ -14,7 +14,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class Canvas; class Picture : public RefCountedDartWrappable { @@ -48,6 +48,6 @@ class Picture : public RefCountedDartWrappable { flow::SkiaGPUObject picture_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PAINTING_PICTURE_H_ diff --git a/lib/ui/painting/picture_recorder.cc b/lib/ui/painting/picture_recorder.cc index 1cce5042ae204..711ea93b5252a 100644 --- a/lib/ui/painting/picture_recorder.cc +++ b/lib/ui/painting/picture_recorder.cc @@ -11,7 +11,7 @@ #include "third_party/tonic/dart_binding_macros.h" #include "third_party/tonic/dart_library_natives.h" -namespace blink { +namespace flutter { static void PictureRecorder_constructor(Dart_NativeArguments args) { DartCallConstructor(&PictureRecorder::Create, args); @@ -60,4 +60,4 @@ fml::RefPtr PictureRecorder::endRecording() { return picture; } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/picture_recorder.h b/lib/ui/painting/picture_recorder.h index 90e5a4c03f365..58835fb034059 100644 --- a/lib/ui/painting/picture_recorder.h +++ b/lib/ui/painting/picture_recorder.h @@ -12,7 +12,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class Canvas; class Picture; @@ -41,6 +41,6 @@ class PictureRecorder : public RefCountedDartWrappable { fml::RefPtr canvas_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PAINTING_PICTURE_RECORDER_H_ diff --git a/lib/ui/painting/rrect.cc b/lib/ui/painting/rrect.cc index cd6a7d4456d33..d47ea9b7b633f 100644 --- a/lib/ui/painting/rrect.cc +++ b/lib/ui/painting/rrect.cc @@ -8,7 +8,7 @@ #include "third_party/tonic/logging/dart_error.h" #include "third_party/tonic/typed_data/float32_list.h" -using namespace blink; +using namespace flutter; namespace tonic { diff --git a/lib/ui/painting/rrect.h b/lib/ui/painting/rrect.h index c4a9045e674df..75c89468a307b 100644 --- a/lib/ui/painting/rrect.h +++ b/lib/ui/painting/rrect.h @@ -9,7 +9,7 @@ #include "third_party/skia/include/core/SkRRect.h" #include "third_party/tonic/converter/dart_converter.h" -namespace blink { +namespace flutter { class RRect { public: @@ -17,16 +17,16 @@ class RRect { bool is_null; }; -} // namespace blink +} // namespace flutter namespace tonic { template <> -struct DartConverter { - static blink::RRect FromDart(Dart_Handle handle); - static blink::RRect FromArguments(Dart_NativeArguments args, - int index, - Dart_Handle& exception); +struct DartConverter { + static flutter::RRect FromDart(Dart_Handle handle); + static flutter::RRect FromArguments(Dart_NativeArguments args, + int index, + Dart_Handle& exception); }; } // namespace tonic diff --git a/lib/ui/painting/shader.cc b/lib/ui/painting/shader.cc index 1331135917e71..c426e09b8b5c1 100644 --- a/lib/ui/painting/shader.cc +++ b/lib/ui/painting/shader.cc @@ -6,7 +6,7 @@ #include "flutter/lib/ui/ui_dart_state.h" -namespace blink { +namespace flutter { IMPLEMENT_WRAPPERTYPEINFO(ui, Shader); @@ -15,4 +15,4 @@ Shader::Shader(flow::SkiaGPUObject shader) Shader::~Shader() = default; -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/shader.h b/lib/ui/painting/shader.h index cfda1f341df35..8e268c1ac7499 100644 --- a/lib/ui/painting/shader.h +++ b/lib/ui/painting/shader.h @@ -10,7 +10,7 @@ #include "flutter/lib/ui/ui_dart_state.h" #include "third_party/skia/include/core/SkShader.h" -namespace blink { +namespace flutter { class Shader : public RefCountedDartWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -32,6 +32,6 @@ class Shader : public RefCountedDartWrappable { flow::SkiaGPUObject shader_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PAINTING_SHADER_H_ diff --git a/lib/ui/painting/vertices.cc b/lib/ui/painting/vertices.cc index 0f29ad593b65a..0cfae48236fef 100644 --- a/lib/ui/painting/vertices.cc +++ b/lib/ui/painting/vertices.cc @@ -7,7 +7,7 @@ #include "third_party/tonic/dart_binding_macros.h" #include "third_party/tonic/dart_library_natives.h" -namespace blink { +namespace flutter { namespace { @@ -83,4 +83,4 @@ void Vertices::init(SkVertices::VertexMode vertex_mode, vertices_ = builder.detach(); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/painting/vertices.h b/lib/ui/painting/vertices.h index 38ad28ac746f5..8d9d3861fcaf5 100644 --- a/lib/ui/painting/vertices.h +++ b/lib/ui/painting/vertices.h @@ -14,7 +14,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class Vertices : public RefCountedDartWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -41,6 +41,6 @@ class Vertices : public RefCountedDartWrappable { sk_sp vertices_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PAINTING_VERTICES_H_ diff --git a/lib/ui/plugins/callback_cache.cc b/lib/ui/plugins/callback_cache.cc index cf1fbce539d9d..e43772efca9dd 100644 --- a/lib/ui/plugins/callback_cache.cc +++ b/lib/ui/plugins/callback_cache.cc @@ -19,7 +19,7 @@ using rapidjson::StringBuffer; using rapidjson::Writer; using tonic::ToDart; -namespace blink { +namespace flutter { static const char* kHandleKey = "handle"; static const char* kRepresentationKey = "representation"; @@ -192,4 +192,4 @@ Dart_Handle DartCallbackCache::LookupDartClosure( return closure; } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/plugins/callback_cache.h b/lib/ui/plugins/callback_cache.h index 997b84426a4e5..bbcb8d2af101d 100644 --- a/lib/ui/plugins/callback_cache.h +++ b/lib/ui/plugins/callback_cache.h @@ -14,7 +14,7 @@ #include "flutter/fml/synchronization/thread_annotations.h" #include "third_party/dart/runtime/include/dart_api.h" -namespace blink { +namespace flutter { typedef struct { std::string name; @@ -55,6 +55,6 @@ class DartCallbackCache { FML_DISALLOW_IMPLICIT_CONSTRUCTORS(DartCallbackCache); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_CALLBACK_CACHE_H_ diff --git a/lib/ui/semantics/custom_accessibility_action.cc b/lib/ui/semantics/custom_accessibility_action.cc index 886bced770c7d..352a5f746f839 100644 --- a/lib/ui/semantics/custom_accessibility_action.cc +++ b/lib/ui/semantics/custom_accessibility_action.cc @@ -4,10 +4,10 @@ #include "flutter/lib/ui/semantics/custom_accessibility_action.h" -namespace blink { +namespace flutter { CustomAccessibilityAction::CustomAccessibilityAction() = default; CustomAccessibilityAction::~CustomAccessibilityAction() = default; -} // namespace blink +} // namespace flutter diff --git a/lib/ui/semantics/custom_accessibility_action.h b/lib/ui/semantics/custom_accessibility_action.h index ce9415aa00630..a40bf8d7d18d9 100644 --- a/lib/ui/semantics/custom_accessibility_action.h +++ b/lib/ui/semantics/custom_accessibility_action.h @@ -10,7 +10,7 @@ #include "third_party/tonic/typed_data/float64_list.h" #include "third_party/tonic/typed_data/int32_list.h" -namespace blink { +namespace flutter { /// A custom accessibility action is used to indicate additional semantics /// actions that a user can perform on a semantics node beyond the @@ -32,6 +32,6 @@ struct CustomAccessibilityAction { using CustomAccessibilityActionUpdates = std::unordered_map; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_SEMANTICS_LOCAL_CONTEXT_ACTION_H_ diff --git a/lib/ui/semantics/semantics_node.cc b/lib/ui/semantics/semantics_node.cc index 7b591d8f6d4f7..ac4f48fe686e8 100644 --- a/lib/ui/semantics/semantics_node.cc +++ b/lib/ui/semantics/semantics_node.cc @@ -6,7 +6,7 @@ #include -namespace blink { +namespace flutter { constexpr int32_t kMinPlatformViewId = -1; @@ -28,4 +28,4 @@ bool SemanticsNode::IsPlatformViewNode() const { return platformViewId > kMinPlatformViewId; } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/semantics/semantics_node.h b/lib/ui/semantics/semantics_node.h index e45a8ef4cac5d..940fee1fe4ee9 100644 --- a/lib/ui/semantics/semantics_node.h +++ b/lib/ui/semantics/semantics_node.h @@ -14,7 +14,7 @@ #include "third_party/skia/include/core/SkMatrix44.h" #include "third_party/skia/include/core/SkRect.h" -namespace blink { +namespace flutter { // Must match the SemanticsAction enum in semantics.dart and in each of the // embedders. @@ -117,6 +117,6 @@ struct SemanticsNode { // semantic information for the node corresponding to the ID. using SemanticsNodeUpdates = std::unordered_map; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_SEMANTICS_SEMANTICS_NODE_H_ diff --git a/lib/ui/semantics/semantics_update.cc b/lib/ui/semantics/semantics_update.cc index 6bb51751f46fa..e559af58aec61 100644 --- a/lib/ui/semantics/semantics_update.cc +++ b/lib/ui/semantics/semantics_update.cc @@ -12,7 +12,7 @@ #include "third_party/tonic/dart_binding_macros.h" #include "third_party/tonic/dart_library_natives.h" -namespace blink { +namespace flutter { IMPLEMENT_WRAPPERTYPEINFO(ui, SemanticsUpdate); @@ -45,4 +45,4 @@ void SemanticsUpdate::dispose() { ClearDartWrapper(); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/semantics/semantics_update.h b/lib/ui/semantics/semantics_update.h index df43c425c39ba..35ecbfbb9d510 100644 --- a/lib/ui/semantics/semantics_update.h +++ b/lib/ui/semantics/semantics_update.h @@ -13,7 +13,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class SemanticsUpdate : public RefCountedDartWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -41,6 +41,6 @@ class SemanticsUpdate : public RefCountedDartWrappable { CustomAccessibilityActionUpdates actions_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_SEMANTICS_SEMANTICS_UPDATE_H_ diff --git a/lib/ui/semantics/semantics_update_builder.cc b/lib/ui/semantics/semantics_update_builder.cc index 75cfdcf40c95a..16c4ed213a536 100644 --- a/lib/ui/semantics/semantics_update_builder.cc +++ b/lib/ui/semantics/semantics_update_builder.cc @@ -9,7 +9,7 @@ #include "third_party/tonic/dart_binding_macros.h" #include "third_party/tonic/dart_library_natives.h" -namespace blink { +namespace flutter { static void SemanticsUpdateBuilder_constructor(Dart_NativeArguments args) { DartCallConstructor(&SemanticsUpdateBuilder::create, args); @@ -114,4 +114,4 @@ fml::RefPtr SemanticsUpdateBuilder::build() { return SemanticsUpdate::create(std::move(nodes_), std::move(actions_)); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/semantics/semantics_update_builder.h b/lib/ui/semantics/semantics_update_builder.h index fa6201c3d84c1..d1e4eca9cf4f3 100644 --- a/lib/ui/semantics/semantics_update_builder.h +++ b/lib/ui/semantics/semantics_update_builder.h @@ -10,7 +10,7 @@ #include "third_party/tonic/typed_data/float64_list.h" #include "third_party/tonic/typed_data/int32_list.h" -namespace blink { +namespace flutter { class SemanticsUpdateBuilder : public RefCountedDartWrappable { @@ -68,6 +68,6 @@ class SemanticsUpdateBuilder CustomAccessibilityActionUpdates actions_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_SEMANTICS_SEMANTICS_UPDATE_BUILDER_H_ diff --git a/lib/ui/snapshot_delegate.h b/lib/ui/snapshot_delegate.h index a124ff5b7ef21..9a771f1219cd8 100644 --- a/lib/ui/snapshot_delegate.h +++ b/lib/ui/snapshot_delegate.h @@ -8,7 +8,7 @@ #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkPicture.h" -namespace blink { +namespace flutter { class SnapshotDelegate { public: @@ -16,6 +16,6 @@ class SnapshotDelegate { SkISize picture_size) = 0; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_SNAPSHOT_DELEGATE_H_ diff --git a/lib/ui/text/asset_manager_font_provider.cc b/lib/ui/text/asset_manager_font_provider.cc index da2d0a15be9d7..619798c13bda7 100644 --- a/lib/ui/text/asset_manager_font_provider.cc +++ b/lib/ui/text/asset_manager_font_provider.cc @@ -10,7 +10,7 @@ #include "third_party/skia/include/core/SkString.h" #include "third_party/skia/include/core/SkTypeface.h" -namespace blink { +namespace flutter { namespace { @@ -21,7 +21,7 @@ void MappingReleaseProc(const void* ptr, void* context) { } // anonymous namespace AssetManagerFontProvider::AssetManagerFontProvider( - std::shared_ptr asset_manager) + std::shared_ptr asset_manager) : asset_manager_(asset_manager) {} AssetManagerFontProvider::~AssetManagerFontProvider() = default; @@ -65,7 +65,7 @@ void AssetManagerFontProvider::RegisterAsset(std::string family_name, } AssetManagerFontStyleSet::AssetManagerFontStyleSet( - std::shared_ptr asset_manager) + std::shared_ptr asset_manager) : asset_manager_(asset_manager) {} AssetManagerFontStyleSet::~AssetManagerFontStyleSet() = default; @@ -131,4 +131,4 @@ AssetManagerFontStyleSet::TypefaceAsset::TypefaceAsset( AssetManagerFontStyleSet::TypefaceAsset::~TypefaceAsset() = default; -} // namespace blink +} // namespace flutter diff --git a/lib/ui/text/asset_manager_font_provider.h b/lib/ui/text/asset_manager_font_provider.h index d55cf71e3bd93..d287ba7634fb8 100644 --- a/lib/ui/text/asset_manager_font_provider.h +++ b/lib/ui/text/asset_manager_font_provider.h @@ -16,11 +16,12 @@ #include "third_party/skia/include/core/SkTypeface.h" #include "txt/font_asset_provider.h" -namespace blink { +namespace flutter { class AssetManagerFontStyleSet : public SkFontStyleSet { public: - AssetManagerFontStyleSet(std::shared_ptr asset_manager); + AssetManagerFontStyleSet( + std::shared_ptr asset_manager); ~AssetManagerFontStyleSet() override; @@ -39,7 +40,7 @@ class AssetManagerFontStyleSet : public SkFontStyleSet { SkTypeface* matchStyle(const SkFontStyle& pattern) override; private: - std::shared_ptr asset_manager_; + std::shared_ptr asset_manager_; struct TypefaceAsset { TypefaceAsset(std::string a); @@ -58,7 +59,8 @@ class AssetManagerFontStyleSet : public SkFontStyleSet { class AssetManagerFontProvider : public txt::FontAssetProvider { public: - AssetManagerFontProvider(std::shared_ptr asset_manager); + AssetManagerFontProvider( + std::shared_ptr asset_manager); ~AssetManagerFontProvider() override; @@ -82,6 +84,6 @@ class AssetManagerFontProvider : public txt::FontAssetProvider { FML_DISALLOW_COPY_AND_ASSIGN(AssetManagerFontProvider); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_TEXT_ASSET_MANAGER_FONT_PROVIDER_H_ diff --git a/lib/ui/text/font_collection.cc b/lib/ui/text/font_collection.cc index 55e95df96740b..5cb20ff1dcee2 100644 --- a/lib/ui/text/font_collection.cc +++ b/lib/ui/text/font_collection.cc @@ -23,7 +23,7 @@ #include "txt/asset_font_manager.h" #include "txt/test_font_manager.h" -namespace blink { +namespace flutter { namespace { @@ -161,4 +161,4 @@ void FontCollection::LoadFontFromList(const uint8_t* font_data, collection_->ClearFontFamilyCache(); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/text/font_collection.h b/lib/ui/text/font_collection.h index a50eab4b8d529..4e19e2a999776 100644 --- a/lib/ui/text/font_collection.h +++ b/lib/ui/text/font_collection.h @@ -17,7 +17,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class FontCollection { public: @@ -44,6 +44,6 @@ class FontCollection { FML_DISALLOW_COPY_AND_ASSIGN(FontCollection); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_TEXT_FONT_COLLECTION_H_ diff --git a/lib/ui/text/paragraph.cc b/lib/ui/text/paragraph.cc index 9c4438f12f19d..8d776076077d3 100644 --- a/lib/ui/text/paragraph.cc +++ b/lib/ui/text/paragraph.cc @@ -15,7 +15,7 @@ using tonic::ToDart; -namespace blink { +namespace flutter { IMPLEMENT_WRAPPERTYPEINFO(ui, Paragraph); @@ -101,4 +101,4 @@ Dart_Handle Paragraph::getWordBoundary(unsigned offset) { return m_paragraphImpl->getWordBoundary(offset); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/text/paragraph.h b/lib/ui/text/paragraph.h index 15df77310c17a..a96f6fdfeff56 100644 --- a/lib/ui/text/paragraph.h +++ b/lib/ui/text/paragraph.h @@ -17,7 +17,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class Paragraph : public RefCountedDartWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -59,6 +59,6 @@ class Paragraph : public RefCountedDartWrappable { explicit Paragraph(std::unique_ptr paragraph); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_TEXT_PARAGRAPH_H_ diff --git a/lib/ui/text/paragraph_builder.cc b/lib/ui/text/paragraph_builder.cc index da8a4366ccbcc..c244cd03bce21 100644 --- a/lib/ui/text/paragraph_builder.cc +++ b/lib/ui/text/paragraph_builder.cc @@ -24,7 +24,7 @@ #include "third_party/tonic/dart_library_natives.h" #include "third_party/tonic/typed_data/dart_byte_data.h" -namespace blink { +namespace flutter { namespace { // TextStyle @@ -275,7 +275,7 @@ ParagraphBuilder::ParagraphBuilder( UIDartState::Current()->window()->client()->GetFontCollection(); m_paragraphBuilder = std::make_unique( style, font_collection.GetFontCollection()); -} // namespace blink +} // namespace flutter ParagraphBuilder::~ParagraphBuilder() = default; @@ -434,4 +434,4 @@ fml::RefPtr ParagraphBuilder::build() { return Paragraph::Create(m_paragraphBuilder->Build()); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/text/paragraph_builder.h b/lib/ui/text/paragraph_builder.h index 9ef52fbe4c0d6..195f43d989635 100644 --- a/lib/ui/text/paragraph_builder.h +++ b/lib/ui/text/paragraph_builder.h @@ -16,7 +16,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class Paragraph; @@ -72,6 +72,6 @@ class ParagraphBuilder : public RefCountedDartWrappable { std::unique_ptr m_paragraphBuilder; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_TEXT_PARAGRAPH_BUILDER_H_ diff --git a/lib/ui/text/paragraph_impl.cc b/lib/ui/text/paragraph_impl.cc index eb5f4bb0d9005..b54f195b59f30 100644 --- a/lib/ui/text/paragraph_impl.cc +++ b/lib/ui/text/paragraph_impl.cc @@ -4,4 +4,4 @@ #include "flutter/lib/ui/text/paragraph_impl.h" -namespace blink {} // namespace blink +namespace flutter {} // namespace flutter diff --git a/lib/ui/text/paragraph_impl.h b/lib/ui/text/paragraph_impl.h index b1b3c51f77107..357fbd3dffdbc 100644 --- a/lib/ui/text/paragraph_impl.h +++ b/lib/ui/text/paragraph_impl.h @@ -9,7 +9,7 @@ #include "flutter/lib/ui/text/text_box.h" #include "flutter/third_party/txt/src/txt/paragraph.h" -namespace blink { +namespace flutter { class ParagraphImpl { public: @@ -44,6 +44,6 @@ class ParagraphImpl { virtual Dart_Handle getWordBoundary(unsigned offset) = 0; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_TEXT_PARAGRAPH_IMPL_H_ diff --git a/lib/ui/text/paragraph_impl_txt.cc b/lib/ui/text/paragraph_impl_txt.cc index 5a00fbbda93cd..666a2b2c89c0b 100644 --- a/lib/ui/text/paragraph_impl_txt.cc +++ b/lib/ui/text/paragraph_impl_txt.cc @@ -14,7 +14,7 @@ using tonic::ToDart; -namespace blink { +namespace flutter { ParagraphImplTxt::ParagraphImplTxt(std::unique_ptr paragraph) : m_paragraph(std::move(paragraph)) {} @@ -71,7 +71,7 @@ std::vector ParagraphImplTxt::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)); + static_cast(box.direction)); } return result; } @@ -93,4 +93,4 @@ Dart_Handle ParagraphImplTxt::getWordBoundary(unsigned offset) { return result; } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/text/paragraph_impl_txt.h b/lib/ui/text/paragraph_impl_txt.h index 226526e6e696f..ad44d7235b052 100644 --- a/lib/ui/text/paragraph_impl_txt.h +++ b/lib/ui/text/paragraph_impl_txt.h @@ -9,7 +9,7 @@ #include "flutter/lib/ui/text/paragraph_impl.h" #include "flutter/lib/ui/text/text_box.h" -namespace blink { +namespace flutter { class ParagraphImplTxt : public ParagraphImpl { public: @@ -41,6 +41,6 @@ class ParagraphImplTxt : public ParagraphImpl { double m_width = -1.0; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_TEXT_PARAGRAPH_IMPL_TXT_H_ diff --git a/lib/ui/text/text_box.cc b/lib/ui/text/text_box.cc index 2d22d954a8b93..421bf16376a09 100644 --- a/lib/ui/text/text_box.cc +++ b/lib/ui/text/text_box.cc @@ -9,7 +9,7 @@ #include "third_party/tonic/dart_state.h" #include "third_party/tonic/logging/dart_error.h" -using namespace blink; +using namespace flutter; namespace tonic { diff --git a/lib/ui/text/text_box.h b/lib/ui/text/text_box.h index 785f5b37bd3b6..c3eea00aa8999 100644 --- a/lib/ui/text/text_box.h +++ b/lib/ui/text/text_box.h @@ -9,7 +9,7 @@ #include "third_party/skia/include/core/SkRect.h" #include "third_party/tonic/converter/dart_converter.h" -namespace blink { +namespace flutter { enum class TextDirection { rtl, @@ -23,17 +23,17 @@ struct TextBox { TextBox(SkRect r, TextDirection d) : rect(r), direction(d) {} }; -} // namespace blink +} // namespace flutter namespace tonic { template <> -struct DartConverter { - static Dart_Handle ToDart(const blink::TextBox& val); +struct DartConverter { + static Dart_Handle ToDart(const flutter::TextBox& val); }; template <> -struct DartListFactory { +struct DartListFactory { static Dart_Handle NewList(intptr_t length); }; diff --git a/lib/ui/ui_dart_state.cc b/lib/ui/ui_dart_state.cc index be0a5348f31a1..58f9b77a4bf52 100644 --- a/lib/ui/ui_dart_state.cc +++ b/lib/ui/ui_dart_state.cc @@ -11,7 +11,7 @@ using tonic::ToDart; -namespace blink { +namespace flutter { UIDartState::UIDartState( TaskRunners task_runners, @@ -149,4 +149,4 @@ void UIDartState::ReportUnhandledException(const std::string& error, << stack_trace; } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/ui_dart_state.h b/lib/ui/ui_dart_state.h index afa5e47e83de8..b32cf6588e758 100644 --- a/lib/ui/ui_dart_state.h +++ b/lib/ui/ui_dart_state.h @@ -23,7 +23,7 @@ #include "third_party/tonic/dart_persistent_value.h" #include "third_party/tonic/dart_state.h" -namespace blink { +namespace flutter { class FontSelector; class Window; @@ -112,6 +112,6 @@ class UIDartState : public tonic::DartState { void AddOrRemoveTaskObserver(bool add); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_UI_DART_STATE_H_ diff --git a/lib/ui/versions.cc b/lib/ui/versions.cc index b044621a86916..0398eccf2963c 100644 --- a/lib/ui/versions.cc +++ b/lib/ui/versions.cc @@ -12,7 +12,7 @@ using tonic::DartConverter; -namespace blink { +namespace flutter { // returns a vector with 3 versions. // Dart, Skia and Flutter engine versions in this order. @@ -28,4 +28,4 @@ void Versions::RegisterNatives(tonic::DartLibraryNatives* natives) { natives->Register({{"Versions_getVersions", GetVersions, 0, true}}); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/versions.h b/lib/ui/versions.h index 84737e5eb68e6..eb18ce380ca64 100644 --- a/lib/ui/versions.h +++ b/lib/ui/versions.h @@ -9,13 +9,13 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class Versions final { public: static void RegisterNatives(tonic::DartLibraryNatives* natives); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_VERSIONS_H_ diff --git a/lib/ui/window/platform_message.cc b/lib/ui/window/platform_message.cc index 6a8c754d2aa83..8423da599ed29 100644 --- a/lib/ui/window/platform_message.cc +++ b/lib/ui/window/platform_message.cc @@ -6,7 +6,7 @@ #include -namespace blink { +namespace flutter { PlatformMessage::PlatformMessage(std::string channel, std::vector data, @@ -24,4 +24,4 @@ PlatformMessage::PlatformMessage(std::string channel, PlatformMessage::~PlatformMessage() = default; -} // namespace blink +} // namespace flutter diff --git a/lib/ui/window/platform_message.h b/lib/ui/window/platform_message.h index ef26d621600ea..64cef2ca06a6e 100644 --- a/lib/ui/window/platform_message.h +++ b/lib/ui/window/platform_message.h @@ -12,7 +12,7 @@ #include "flutter/fml/memory/ref_ptr.h" #include "flutter/lib/ui/window/platform_message_response.h" -namespace blink { +namespace flutter { class PlatformMessage : public fml::RefCountedThreadSafe { FML_FRIEND_REF_COUNTED_THREAD_SAFE(PlatformMessage); @@ -41,6 +41,6 @@ class PlatformMessage : public fml::RefCountedThreadSafe { fml::RefPtr response_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PLATFORM_PLATFORM_MESSAGE_H_ diff --git a/lib/ui/window/platform_message_response.cc b/lib/ui/window/platform_message_response.cc index 31f02ca286384..fec20c5f0067d 100644 --- a/lib/ui/window/platform_message_response.cc +++ b/lib/ui/window/platform_message_response.cc @@ -4,10 +4,10 @@ #include "flutter/lib/ui/window/platform_message_response.h" -namespace blink { +namespace flutter { PlatformMessageResponse::PlatformMessageResponse() = default; PlatformMessageResponse::~PlatformMessageResponse() = default; -} // namespace blink +} // namespace flutter diff --git a/lib/ui/window/platform_message_response.h b/lib/ui/window/platform_message_response.h index decd17a46beea..e0404c5adc749 100644 --- a/lib/ui/window/platform_message_response.h +++ b/lib/ui/window/platform_message_response.h @@ -11,7 +11,7 @@ #include "flutter/fml/memory/ref_counted.h" #include "flutter/fml/memory/ref_ptr.h" -namespace blink { +namespace flutter { class PlatformMessageResponse : public fml::RefCountedThreadSafe { @@ -31,6 +31,6 @@ class PlatformMessageResponse bool is_complete_ = false; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PLATFORM_PLATFORM_MESSAGE_RESPONSE_H_ diff --git a/lib/ui/window/platform_message_response_dart.cc b/lib/ui/window/platform_message_response_dart.cc index 55da6fe8c5695..dca1ab74f9d58 100644 --- a/lib/ui/window/platform_message_response_dart.cc +++ b/lib/ui/window/platform_message_response_dart.cc @@ -12,7 +12,7 @@ #include "third_party/tonic/dart_state.h" #include "third_party/tonic/logging/dart_invoke.h" -namespace blink { +namespace flutter { namespace { @@ -92,4 +92,4 @@ void PlatformMessageResponseDart::CompleteEmpty() { })); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/window/platform_message_response_dart.h b/lib/ui/window/platform_message_response_dart.h index 3ff0333937096..79293ff8412db 100644 --- a/lib/ui/window/platform_message_response_dart.h +++ b/lib/ui/window/platform_message_response_dart.h @@ -9,7 +9,7 @@ #include "flutter/lib/ui/window/platform_message_response.h" #include "third_party/tonic/dart_persistent_value.h" -namespace blink { +namespace flutter { class PlatformMessageResponseDart : public PlatformMessageResponse { FML_FRIEND_MAKE_REF_COUNTED(PlatformMessageResponseDart); @@ -29,6 +29,6 @@ class PlatformMessageResponseDart : public PlatformMessageResponse { fml::RefPtr ui_task_runner_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_PLATFORM_PLATFORM_MESSAGE_RESPONSE_DART_H_ diff --git a/lib/ui/window/pointer_data.cc b/lib/ui/window/pointer_data.cc index d52bda18c3f58..a2d92e8eed36e 100644 --- a/lib/ui/window/pointer_data.cc +++ b/lib/ui/window/pointer_data.cc @@ -6,7 +6,7 @@ #include -namespace blink { +namespace flutter { // If this value changes, update the pointer data unpacking code in hooks.dart. static constexpr int kPointerDataFieldCount = 24; @@ -18,4 +18,4 @@ void PointerData::Clear() { memset(this, 0, sizeof(PointerData)); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/window/pointer_data.h b/lib/ui/window/pointer_data.h index f58c377044d3d..05d91fada30fe 100644 --- a/lib/ui/window/pointer_data.h +++ b/lib/ui/window/pointer_data.h @@ -7,7 +7,7 @@ #include -namespace blink { +namespace flutter { // This structure is unpacked by hooks.dart. struct alignas(8) PointerData { @@ -64,6 +64,6 @@ struct alignas(8) PointerData { void Clear(); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_WINDOW_POINTER_DATA_H_ diff --git a/lib/ui/window/pointer_data_packet.cc b/lib/ui/window/pointer_data_packet.cc index f560df1a2b7d6..a9680dd9bb1dd 100644 --- a/lib/ui/window/pointer_data_packet.cc +++ b/lib/ui/window/pointer_data_packet.cc @@ -6,7 +6,7 @@ #include -namespace blink { +namespace flutter { PointerDataPacket::PointerDataPacket(size_t count) : data_(count * sizeof(PointerData)) {} @@ -20,4 +20,4 @@ void PointerDataPacket::SetPointerData(size_t i, const PointerData& data) { memcpy(&data_[i * sizeof(PointerData)], &data, sizeof(PointerData)); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/window/pointer_data_packet.h b/lib/ui/window/pointer_data_packet.h index c9f54dec7a677..77fd9e605d319 100644 --- a/lib/ui/window/pointer_data_packet.h +++ b/lib/ui/window/pointer_data_packet.h @@ -12,7 +12,7 @@ #include "flutter/fml/macros.h" #include "flutter/lib/ui/window/pointer_data.h" -namespace blink { +namespace flutter { class PointerDataPacket { public: @@ -29,6 +29,6 @@ class PointerDataPacket { FML_DISALLOW_COPY_AND_ASSIGN(PointerDataPacket); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_WINDOW_POINTER_DATA_PACKET_H_ diff --git a/lib/ui/window/viewport_metrics.cc b/lib/ui/window/viewport_metrics.cc index 1047b3e4da1cf..88a9eb8434955 100644 --- a/lib/ui/window/viewport_metrics.cc +++ b/lib/ui/window/viewport_metrics.cc @@ -4,7 +4,7 @@ #include "flutter/lib/ui/window/viewport_metrics.h" -namespace blink { +namespace flutter { ViewportMetrics::ViewportMetrics() = default; ViewportMetrics::ViewportMetrics(double p_device_pixel_ratio, @@ -32,4 +32,4 @@ ViewportMetrics::ViewportMetrics(double p_device_pixel_ratio, ViewportMetrics::ViewportMetrics(const ViewportMetrics& other) = default; -} // namespace blink +} // namespace flutter diff --git a/lib/ui/window/viewport_metrics.h b/lib/ui/window/viewport_metrics.h index c4daa9ebe7192..3a40505ba329e 100644 --- a/lib/ui/window/viewport_metrics.h +++ b/lib/ui/window/viewport_metrics.h @@ -7,7 +7,7 @@ #include -namespace blink { +namespace flutter { struct ViewportMetrics { ViewportMetrics(); @@ -58,6 +58,6 @@ struct LogicalMetrics { LogicalInset view_inset; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_WINDOW_VIEWPORT_METRICS_H_ diff --git a/lib/ui/window/window.cc b/lib/ui/window/window.cc index fb53dda3f1028..b7691229612ae 100644 --- a/lib/ui/window/window.cc +++ b/lib/ui/window/window.cc @@ -14,7 +14,7 @@ #include "third_party/tonic/logging/dart_invoke.h" #include "third_party/tonic/typed_data/dart_byte_data.h" -namespace blink { +namespace flutter { namespace { void DefaultRouteName(Dart_NativeArguments args) { @@ -356,4 +356,4 @@ void Window::RegisterNatives(tonic::DartLibraryNatives* natives) { }); } -} // namespace blink +} // namespace flutter diff --git a/lib/ui/window/window.h b/lib/ui/window/window.h index f5624e4bad6af..ab4d27e2f035d 100644 --- a/lib/ui/window/window.h +++ b/lib/ui/window/window.h @@ -21,7 +21,7 @@ namespace tonic { class DartLibraryNatives; } // namespace tonic -namespace blink { +namespace flutter { class FontCollection; class Scene; @@ -88,10 +88,10 @@ class Window final { // We use id 0 to mean that no response is expected. int next_response_id_ = 1; - std::unordered_map> + std::unordered_map> pending_responses_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_LIB_UI_WINDOW_WINDOW_H_ diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 91cd8bb5dd4aa..eb8097f119fb1 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -27,7 +27,7 @@ #include "third_party/tonic/scopes/dart_api_scope.h" #include "third_party/tonic/scopes/dart_isolate_scope.h" -namespace blink { +namespace flutter { std::weak_ptr DartIsolate::CreateRootIsolate( const Settings& settings, @@ -547,7 +547,7 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( return nullptr; } - blink::TaskRunners null_task_runners( + flutter::TaskRunners null_task_runners( "io.flutter." DART_VM_SERVICE_ISOLATE_NAME, nullptr, nullptr, nullptr, nullptr); @@ -659,8 +659,8 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( if (!is_root_isolate) { auto* raw_embedder_isolate = embedder_isolate.release(); - blink::TaskRunners null_task_runners(advisory_script_uri, nullptr, nullptr, - nullptr, nullptr); + flutter::TaskRunners null_task_runners(advisory_script_uri, nullptr, + nullptr, nullptr, nullptr); embedder_isolate = std::make_unique>( std::make_shared( @@ -773,4 +773,4 @@ DartIsolate::AutoFireClosure::~AutoFireClosure() { } } -} // namespace blink +} // namespace flutter diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index 96753830e0bb3..d2c09517e1676 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -21,7 +21,7 @@ #include "third_party/dart/runtime/include/dart_api.h" #include "third_party/tonic/dart_state.h" -namespace blink { +namespace flutter { class DartVM; class DartIsolate : public UIDartState { @@ -184,6 +184,6 @@ class DartIsolate : public UIDartState { FML_DISALLOW_COPY_AND_ASSIGN(DartIsolate); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_RUNTIME_DART_ISOLATE_H_ diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc index 6a09e62a78a20..de5b5ff629734 100644 --- a/runtime/dart_isolate_unittests.cc +++ b/runtime/dart_isolate_unittests.cc @@ -15,7 +15,7 @@ #include "flutter/testing/thread_test.h" #include "third_party/tonic/scopes/dart_isolate_scope.h" -namespace blink { +namespace flutter { namespace testing { using DartIsolateTest = RuntimeTest; @@ -88,7 +88,7 @@ class AutoIsolateShutdown { public: AutoIsolateShutdown() = default; - AutoIsolateShutdown(std::shared_ptr isolate, + AutoIsolateShutdown(std::shared_ptr isolate, fml::RefPtr runner) : isolate_(std::move(isolate)), runner_(std::move(runner)) {} @@ -131,13 +131,13 @@ class AutoIsolateShutdown { return true; } - blink::DartIsolate* get() { + flutter::DartIsolate* get() { FML_CHECK(isolate_); return isolate_.get(); } private: - std::shared_ptr isolate_; + std::shared_ptr isolate_; fml::RefPtr runner_; FML_DISALLOW_COPY_AND_ASSIGN(AutoIsolateShutdown); @@ -307,4 +307,4 @@ TEST_F(DartIsolateTest, CanRegisterNativeCallback) { } } // namespace testing -} // namespace blink +} // namespace flutter diff --git a/runtime/dart_lifecycle_unittests.cc b/runtime/dart_lifecycle_unittests.cc index 039d93793cb6d..b51734deb1cb9 100644 --- a/runtime/dart_lifecycle_unittests.cc +++ b/runtime/dart_lifecycle_unittests.cc @@ -9,7 +9,7 @@ #include "flutter/runtime/dart_vm_lifecycle.h" #include "flutter/runtime/runtime_test.h" -namespace blink { +namespace flutter { namespace testing { using DartLifecycleTest = RuntimeTest; @@ -139,4 +139,4 @@ TEST_F(DartLifecycleTest, ShuttingDownTheVMShutsDownTheIsolate) { } } // namespace testing -} // namespace blink +} // namespace flutter diff --git a/runtime/dart_service_isolate.cc b/runtime/dart_service_isolate.cc index 2bedd79f81716..530af43d147d2 100644 --- a/runtime/dart_service_isolate.cc +++ b/runtime/dart_service_isolate.cc @@ -27,7 +27,7 @@ return false; \ } -namespace blink { +namespace flutter { namespace { static Dart_LibraryTagHandler g_embedder_tag_handler; @@ -199,4 +199,4 @@ bool DartServiceIsolate::Startup(std::string server_ip, return true; } -} // namespace blink +} // namespace flutter diff --git a/runtime/dart_service_isolate.h b/runtime/dart_service_isolate.h index cf4137a1e6b49..4b98e83607c56 100644 --- a/runtime/dart_service_isolate.h +++ b/runtime/dart_service_isolate.h @@ -15,7 +15,7 @@ #include "third_party/dart/runtime/include/dart_api.h" -namespace blink { +namespace flutter { class DartServiceIsolate { public: @@ -51,6 +51,6 @@ class DartServiceIsolate { FML_GUARDED_BY(callbacks_mutex_); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_RUNTIME_DART_SERVICE_ISOLATE_H_ diff --git a/runtime/dart_service_isolate_unittests.cc b/runtime/dart_service_isolate_unittests.cc index b0e2baf0b62af..7131bfad43f3c 100644 --- a/runtime/dart_service_isolate_unittests.cc +++ b/runtime/dart_service_isolate_unittests.cc @@ -5,7 +5,7 @@ #include "flutter/runtime/dart_service_isolate.h" #include "flutter/testing/testing.h" -namespace blink { +namespace flutter { TEST(DartServiceIsolateTest, CanAddAndRemoveHandles) { ASSERT_EQ(DartServiceIsolate::AddServerStatusCallback(nullptr), 0); @@ -14,4 +14,4 @@ TEST(DartServiceIsolateTest, CanAddAndRemoveHandles) { ASSERT_TRUE(DartServiceIsolate::RemoveServerStatusCallback(handle)); } -} // namespace blink +} // namespace flutter diff --git a/runtime/dart_snapshot.cc b/runtime/dart_snapshot.cc index a752dd0818379..c2d6d40017164 100644 --- a/runtime/dart_snapshot.cc +++ b/runtime/dart_snapshot.cc @@ -13,7 +13,7 @@ #include "flutter/runtime/dart_snapshot_buffer.h" #include "flutter/runtime/dart_vm.h" -namespace blink { +namespace flutter { const char* DartSnapshot::kVMDataSymbol = "kDartVmSnapshotData"; const char* DartSnapshot::kVMInstructionsSymbol = "kDartVmSnapshotInstructions"; @@ -232,4 +232,4 @@ const uint8_t* DartSnapshot::GetInstructionsIfPresent() const { return instructions_ ? instructions_->GetSnapshotPointer() : nullptr; } -} // namespace blink +} // namespace flutter diff --git a/runtime/dart_snapshot.h b/runtime/dart_snapshot.h index 19d2968833f90..29ab3f035b54b 100644 --- a/runtime/dart_snapshot.h +++ b/runtime/dart_snapshot.h @@ -13,7 +13,7 @@ #include "flutter/fml/memory/ref_counted.h" #include "flutter/runtime/dart_snapshot_buffer.h" -namespace blink { +namespace flutter { class DartSnapshot : public fml::RefCountedThreadSafe { public: @@ -56,6 +56,6 @@ class DartSnapshot : public fml::RefCountedThreadSafe { FML_DISALLOW_COPY_AND_ASSIGN(DartSnapshot); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_RUNTIME_DART_SNAPSHOT_H_ diff --git a/runtime/dart_snapshot_buffer.cc b/runtime/dart_snapshot_buffer.cc index c697e28f47c4a..fcd71e9500454 100644 --- a/runtime/dart_snapshot_buffer.cc +++ b/runtime/dart_snapshot_buffer.cc @@ -8,7 +8,7 @@ #include "flutter/fml/mapping.h" -namespace blink { +namespace flutter { class NativeLibrarySnapshotBuffer final : public DartSnapshotBuffer { public: @@ -99,4 +99,4 @@ DartSnapshotBuffer::CreateWithUnmanagedAllocation(const uint8_t* allocation) { DartSnapshotBuffer::~DartSnapshotBuffer() = default; -} // namespace blink +} // namespace flutter diff --git a/runtime/dart_snapshot_buffer.h b/runtime/dart_snapshot_buffer.h index 34fee1f411cb9..2c5887ad7e3bf 100644 --- a/runtime/dart_snapshot_buffer.h +++ b/runtime/dart_snapshot_buffer.h @@ -13,7 +13,7 @@ #include "flutter/fml/mapping.h" #include "flutter/fml/native_library.h" -namespace blink { +namespace flutter { // TODO(chinmaygarde): Replace this with just |fml::Mapping|. // https://github.com/flutter/flutter/issues/26782 @@ -40,6 +40,6 @@ class DartSnapshotBuffer { virtual size_t GetSnapshotSize() const = 0; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_RUNTIME_DART_SNAPSHOT_BUFFER_H_ diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index db8acaaa46abc..af5086660fc34 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -54,7 +54,7 @@ extern const uint8_t* observatory_assets_archive; } // namespace observatory } // namespace dart -namespace blink { +namespace flutter { // Arguments passed to the Dart VM in all configurations. static const char* kDartLanguageArgs[] = { @@ -385,14 +385,15 @@ DartVM::DartVM(std::shared_ptr vm_data, // the very first frame gives us a good idea about Flutter's startup time. // Use a duration event so about:tracing will consider this event when // deciding the earliest event to use as time 0. - if (blink::engine_main_enter_ts != 0) { - Dart_TimelineEvent("FlutterEngineMainEnter", // label - blink::engine_main_enter_ts, // timestamp0 - blink::engine_main_enter_ts, // timestamp1_or_async_id - Dart_Timeline_Event_Duration, // event type - 0, // argument_count - nullptr, // argument_names - nullptr // argument_values + if (flutter::engine_main_enter_ts != 0) { + Dart_TimelineEvent( + "FlutterEngineMainEnter", // label + flutter::engine_main_enter_ts, // timestamp0 + flutter::engine_main_enter_ts, // timestamp1_or_async_id + Dart_Timeline_Event_Duration, // event type + 0, // argument_count + nullptr, // argument_names + nullptr // argument_values ); } } @@ -501,4 +502,4 @@ void DartVM::UnregisterActiveIsolate(std::shared_ptr isolate) { active_isolates_.erase(isolate); } -} // namespace blink +} // namespace flutter diff --git a/runtime/dart_vm.h b/runtime/dart_vm.h index bff23f7352a7e..690130984a54f 100644 --- a/runtime/dart_vm.h +++ b/runtime/dart_vm.h @@ -22,7 +22,7 @@ #include "flutter/runtime/service_protocol.h" #include "third_party/dart/runtime/include/dart_api.h" -namespace blink { +namespace flutter { class DartVM { public: @@ -75,6 +75,6 @@ class DartVM { FML_DISALLOW_COPY_AND_ASSIGN(DartVM); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_RUNTIME_DART_VM_H_ diff --git a/runtime/dart_vm_data.cc b/runtime/dart_vm_data.cc index a29074f79c92e..e14c998daa746 100644 --- a/runtime/dart_vm_data.cc +++ b/runtime/dart_vm_data.cc @@ -4,7 +4,7 @@ #include "flutter/runtime/dart_vm_data.h" -namespace blink { +namespace flutter { std::shared_ptr DartVMData::Create( Settings settings, @@ -76,4 +76,4 @@ fml::RefPtr DartVMData::GetSharedSnapshot() const { return shared_snapshot_; } -} // namespace blink +} // namespace flutter diff --git a/runtime/dart_vm_data.h b/runtime/dart_vm_data.h index 906cad1a4ca05..95c4565e2ef74 100644 --- a/runtime/dart_vm_data.h +++ b/runtime/dart_vm_data.h @@ -8,7 +8,7 @@ #include "flutter/fml/macros.h" #include "flutter/runtime/dart_snapshot.h" -namespace blink { +namespace flutter { class DartVMData { public: @@ -42,6 +42,6 @@ class DartVMData { FML_DISALLOW_COPY_AND_ASSIGN(DartVMData); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_RUNTIME_DART_VM_DATA_H_ diff --git a/runtime/dart_vm_lifecycle.cc b/runtime/dart_vm_lifecycle.cc index d7f50f19ab1ff..ba6debf5d407e 100644 --- a/runtime/dart_vm_lifecycle.cc +++ b/runtime/dart_vm_lifecycle.cc @@ -6,7 +6,7 @@ #include -namespace blink { +namespace flutter { // We need to explicitly put the constructor and destructor of the DartVM in the // critical section. All accesses (not just const members) to the global VM @@ -121,4 +121,4 @@ DartVM* DartVMRef::GetRunningVM() { return vm; } -} // namespace blink +} // namespace flutter diff --git a/runtime/dart_vm_lifecycle.h b/runtime/dart_vm_lifecycle.h index 44a6cdba7b8b1..5ce6cf7a57778 100644 --- a/runtime/dart_vm_lifecycle.h +++ b/runtime/dart_vm_lifecycle.h @@ -12,7 +12,7 @@ #include "flutter/runtime/dart_vm.h" #include "flutter/runtime/service_protocol.h" -namespace blink { +namespace flutter { // A strong reference to the Dart VM. There can only be one VM running in the // process at any given time. A reference to the VM may only be obtained via the @@ -77,6 +77,6 @@ class DartVMRef { FML_DISALLOW_COPY_AND_ASSIGN(DartVMRef); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_RUNTIME_DART_VM_LIFECYCLE_H_ diff --git a/runtime/dart_vm_unittests.cc b/runtime/dart_vm_unittests.cc index 2c143432b5b74..b8e329e7aa013 100644 --- a/runtime/dart_vm_unittests.cc +++ b/runtime/dart_vm_unittests.cc @@ -6,7 +6,7 @@ #include "flutter/runtime/dart_vm_lifecycle.h" #include "gtest/gtest.h" -namespace blink { +namespace flutter { TEST(DartVM, SimpleInitialization) { Settings settings = {}; @@ -32,4 +32,4 @@ TEST(DartVM, SimpleIsolateNameServer) { ASSERT_TRUE(ns->RemoveIsolateNameMapping("foobar")); } -} // namespace blink +} // namespace flutter diff --git a/runtime/embedder_resources.cc b/runtime/embedder_resources.cc index 2eb73880d3d08..e9d869a28aa41 100644 --- a/runtime/embedder_resources.cc +++ b/runtime/embedder_resources.cc @@ -8,7 +8,7 @@ #include "flutter/fml/logging.h" -namespace blink { +namespace flutter { using flutter::runtime::ResourcesEntry; @@ -49,4 +49,4 @@ ResourcesEntry* EmbedderResources::At(int idx) { return nullptr; } -} // namespace blink +} // namespace flutter diff --git a/runtime/embedder_resources.h b/runtime/embedder_resources.h index 1ae866a54a75f..7b5b38ac88d5f 100644 --- a/runtime/embedder_resources.h +++ b/runtime/embedder_resources.h @@ -17,7 +17,7 @@ struct ResourcesEntry { } // namespace runtime } // namespace flutter -namespace blink { +namespace flutter { class EmbedderResources { public: @@ -34,6 +34,6 @@ class EmbedderResources { flutter::runtime::ResourcesEntry* resources_table_; }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_RUNTIME_EMBEDDER_RESOURCES_H_ diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc index e1aaf51de829f..341cbe7ee078d 100644 --- a/runtime/runtime_controller.cc +++ b/runtime/runtime_controller.cc @@ -12,7 +12,7 @@ #include "flutter/runtime/runtime_delegate.h" #include "third_party/tonic/dart_message_handler.h" -namespace blink { +namespace flutter { RuntimeController::RuntimeController( RuntimeDelegate& p_client, @@ -344,4 +344,4 @@ RuntimeController::WindowData::WindowData(const WindowData& other) = default; RuntimeController::WindowData::~WindowData() = default; -} // namespace blink +} // namespace flutter diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h index 79d020ed38375..7d06b9f2337d0 100644 --- a/runtime/runtime_controller.h +++ b/runtime/runtime_controller.h @@ -20,7 +20,7 @@ #include "rapidjson/document.h" #include "rapidjson/stringbuffer.h" -namespace blink { +namespace flutter { class Scene; class RuntimeDelegate; class View; @@ -149,31 +149,31 @@ class RuntimeController final : public WindowClient { bool FlushRuntimeStateToIsolate(); - // |blink::WindowClient| + // |flutter::WindowClient| std::string DefaultRouteName() override; - // |blink::WindowClient| + // |flutter::WindowClient| void ScheduleFrame() override; - // |blink::WindowClient| + // |flutter::WindowClient| void Render(Scene* scene) override; - // |blink::WindowClient| + // |flutter::WindowClient| void UpdateSemantics(SemanticsUpdate* update) override; - // |blink::WindowClient| + // |flutter::WindowClient| void HandlePlatformMessage(fml::RefPtr message) override; - // |blink::WindowClient| + // |flutter::WindowClient| FontCollection& GetFontCollection() override; - // |blink::WindowClient| + // |flutter::WindowClient| void UpdateIsolateDescription(const std::string isolate_name, int64_t isolate_port) override; FML_DISALLOW_COPY_AND_ASSIGN(RuntimeController); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_RUNTIME_RUNTIME_CONTROLLER_H_ diff --git a/runtime/runtime_delegate.cc b/runtime/runtime_delegate.cc index 65e86bbde539e..f22f5abd96175 100644 --- a/runtime/runtime_delegate.cc +++ b/runtime/runtime_delegate.cc @@ -4,8 +4,8 @@ #include "flutter/runtime/runtime_delegate.h" -namespace blink { +namespace flutter { RuntimeDelegate::~RuntimeDelegate() = default; -} // namespace blink +} // namespace flutter diff --git a/runtime/runtime_delegate.h b/runtime/runtime_delegate.h index 7d79dac199838..355b34888df78 100644 --- a/runtime/runtime_delegate.h +++ b/runtime/runtime_delegate.h @@ -15,7 +15,7 @@ #include "flutter/lib/ui/window/platform_message.h" #include "third_party/dart/runtime/include/dart_api.h" -namespace blink { +namespace flutter { class RuntimeDelegate { public: @@ -26,8 +26,8 @@ class RuntimeDelegate { virtual void Render(std::unique_ptr layer_tree) = 0; virtual void UpdateSemantics( - blink::SemanticsNodeUpdates update, - blink::CustomAccessibilityActionUpdates actions) = 0; + flutter::SemanticsNodeUpdates update, + flutter::CustomAccessibilityActionUpdates actions) = 0; virtual void HandlePlatformMessage(fml::RefPtr message) = 0; @@ -40,6 +40,6 @@ class RuntimeDelegate { virtual ~RuntimeDelegate(); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_RUNTIME_RUNTIME_DELEGATE_H_ diff --git a/runtime/runtime_test.cc b/runtime/runtime_test.cc index adb345d85d33a..069ed1a30a056 100644 --- a/runtime/runtime_test.cc +++ b/runtime/runtime_test.cc @@ -7,7 +7,7 @@ #include "flutter/runtime/dart_vm.h" #include "flutter/testing/testing.h" -namespace blink { +namespace flutter { namespace testing { RuntimeTest::RuntimeTest() @@ -108,4 +108,4 @@ void RuntimeTest::AddNativeCallback(std::string name, } } // namespace testing -} // namespace blink +} // namespace flutter diff --git a/runtime/runtime_test.h b/runtime/runtime_test.h index 142a5d3937d5b..40f781cf8f97a 100644 --- a/runtime/runtime_test.h +++ b/runtime/runtime_test.h @@ -12,7 +12,7 @@ #include "flutter/testing/test_dart_native_resolver.h" #include "flutter/testing/thread_test.h" -namespace blink { +namespace flutter { namespace testing { class RuntimeTest : public ::testing::ThreadTest { @@ -40,6 +40,6 @@ class RuntimeTest : public ::testing::ThreadTest { }; } // namespace testing -} // namespace blink +} // namespace flutter #endif // FLUTTER_RUNTIME_RUNTIME_TEST_H_ diff --git a/runtime/service_protocol.cc b/runtime/service_protocol.cc index 42e4eb7528d17..343600d18c8e0 100644 --- a/runtime/service_protocol.cc +++ b/runtime/service_protocol.cc @@ -18,7 +18,7 @@ #include "rapidjson/writer.h" #include "third_party/dart/runtime/include/dart_tools_api.h" -namespace blink { +namespace flutter { const fml::StringView ServiceProtocol::kScreenshotExtensionName = "_flutter.screenshot"; @@ -276,4 +276,4 @@ bool ServiceProtocol::HandleListViewsMethod( return true; } -} // namespace blink +} // namespace flutter diff --git a/runtime/service_protocol.h b/runtime/service_protocol.h index b514beaf55fcf..7576bbd232850 100644 --- a/runtime/service_protocol.h +++ b/runtime/service_protocol.h @@ -18,7 +18,7 @@ #include "flutter/fml/task_runner.h" #include "rapidjson/document.h" -namespace blink { +namespace flutter { class ServiceProtocol { public: @@ -100,6 +100,6 @@ class ServiceProtocol { FML_DISALLOW_COPY_AND_ASSIGN(ServiceProtocol); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_RUNTIME_SERVICE_PROTOCOL_H_ diff --git a/runtime/start_up.cc b/runtime/start_up.cc index a58a24afb03fa..cba501ad23579 100644 --- a/runtime/start_up.cc +++ b/runtime/start_up.cc @@ -4,8 +4,8 @@ #include "flutter/runtime/start_up.h" -namespace blink { +namespace flutter { int64_t engine_main_enter_ts = 0; -} // namespace blink +} // namespace flutter diff --git a/runtime/start_up.h b/runtime/start_up.h index 603069e16a255..83079a3e8a472 100644 --- a/runtime/start_up.h +++ b/runtime/start_up.h @@ -7,7 +7,7 @@ #include -namespace blink { +namespace flutter { // The earliest available timestamp in the application's lifecycle. The // difference between this timestamp and the time we render the very first @@ -19,6 +19,6 @@ namespace blink { // user code prior to initializing Flutter. extern int64_t engine_main_enter_ts; -} // namespace blink +} // namespace flutter #endif // FLUTTER_RUNTIME_START_UP_H_ diff --git a/runtime/test_font_data.cc b/runtime/test_font_data.cc index 66d99e483d01d..dd6e070159e65 100644 --- a/runtime/test_font_data.cc +++ b/runtime/test_font_data.cc @@ -1215,7 +1215,7 @@ static const unsigned int kAhemFontLength = 0; #endif // EMBED_TEST_FONT_DATA -namespace blink { +namespace flutter { std::unique_ptr GetTestFontData() { if (kAhemFontLength == 0) { @@ -1229,4 +1229,4 @@ std::string GetTestFontFamilyName() { return "Ahem"; } -} // namespace blink +} // namespace flutter diff --git a/runtime/test_font_data.h b/runtime/test_font_data.h index 2f4c7bff12a5c..957422e0bd470 100644 --- a/runtime/test_font_data.h +++ b/runtime/test_font_data.h @@ -10,11 +10,11 @@ #include "third_party/skia/include/core/SkStream.h" -namespace blink { +namespace flutter { std::unique_ptr GetTestFontData(); std::string GetTestFontFamilyName(); -} // namespace blink +} // namespace flutter #endif // FLUTTER_RUNTIME_TEST_FONT_DATA_H_ diff --git a/shell/common/animator.cc b/shell/common/animator.cc index 622b86c238c92..785f28413aace 100644 --- a/shell/common/animator.cc +++ b/shell/common/animator.cc @@ -20,7 +20,7 @@ constexpr fml::TimeDelta kNotifyIdleTaskWaitTime = } // namespace Animator::Animator(Delegate& delegate, - blink::TaskRunners task_runners, + flutter::TaskRunners task_runners, std::unique_ptr waiter) : delegate_(delegate), task_runners_(std::move(task_runners)), diff --git a/shell/common/animator.h b/shell/common/animator.h index 15f8b8c745e67..4795d1267846b 100644 --- a/shell/common/animator.h +++ b/shell/common/animator.h @@ -33,7 +33,7 @@ class Animator final { }; Animator(Delegate& delegate, - blink::TaskRunners task_runners, + flutter::TaskRunners task_runners, std::unique_ptr waiter); ~Animator(); @@ -68,7 +68,7 @@ class Animator final { const char* FrameParity(); Delegate& delegate_; - blink::TaskRunners task_runners_; + flutter::TaskRunners task_runners_; std::shared_ptr waiter_; fml::TimePoint last_begin_frame_time_; diff --git a/shell/common/engine.cc b/shell/common/engine.cc index f1c215570df2f..dea021a5f009c 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -36,14 +36,14 @@ static constexpr char kLocalizationChannel[] = "flutter/localization"; static constexpr char kSettingsChannel[] = "flutter/settings"; Engine::Engine(Delegate& delegate, - blink::DartVM& vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, - blink::TaskRunners task_runners, - blink::Settings settings, + flutter::DartVM& vm, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, + flutter::TaskRunners task_runners, + flutter::Settings settings, std::unique_ptr animator, - fml::WeakPtr snapshot_delegate, - fml::WeakPtr io_manager) + fml::WeakPtr snapshot_delegate, + fml::WeakPtr io_manager) : delegate_(delegate), settings_(std::move(settings)), animator_(std::move(animator)), @@ -53,7 +53,7 @@ Engine::Engine(Delegate& delegate, // Runtime controller is initialized here because it takes a reference to this // object as its delegate. The delegate may be called in the constructor and // we want to be fully initilazed by that point. - runtime_controller_ = std::make_unique( + runtime_controller_ = std::make_unique( *this, // runtime delegate &vm, // VM std::move(isolate_snapshot), // isolate snapshot @@ -78,7 +78,7 @@ fml::WeakPtr Engine::GetWeakPtr() const { } bool Engine::UpdateAssetManager( - std::shared_ptr new_asset_manager) { + std::shared_ptr new_asset_manager) { if (asset_manager_ == new_asset_manager) { return false; } @@ -127,11 +127,11 @@ Engine::RunStatus Engine::Run(RunConfiguration configuration) { return isolate_launch_status; } - std::shared_ptr isolate = + std::shared_ptr isolate = runtime_controller_->GetRootIsolate().lock(); bool isolate_running = - isolate && isolate->GetPhase() == blink::DartIsolate::Phase::Running; + isolate && isolate->GetPhase() == flutter::DartIsolate::Phase::Running; if (isolate_running) { tonic::DartState::Scope scope(isolate.get()); @@ -158,7 +158,7 @@ shell::Engine::RunStatus Engine::PrepareAndLaunchIsolate( auto isolate_configuration = configuration.TakeIsolateConfiguration(); - std::shared_ptr isolate = + std::shared_ptr isolate = runtime_controller_->GetRootIsolate().lock(); if (!isolate) { @@ -167,7 +167,7 @@ shell::Engine::RunStatus Engine::PrepareAndLaunchIsolate( // This can happen on iOS after a plugin shows a native window and returns to // the Flutter ViewController. - if (isolate->GetPhase() == blink::DartIsolate::Phase::Running) { + if (isolate->GetPhase() == flutter::DartIsolate::Phase::Running) { FML_DLOG(WARNING) << "Isolate was already running!"; return RunStatus::FailureAlreadyRunning; } @@ -235,7 +235,7 @@ void Engine::OnOutputSurfaceDestroyed() { StopAnimator(); } -void Engine::SetViewportMetrics(const blink::ViewportMetrics& metrics) { +void Engine::SetViewportMetrics(const flutter::ViewportMetrics& metrics) { bool dimensions_changed = viewport_metrics_.physical_height != metrics.physical_height || viewport_metrics_.physical_width != metrics.physical_width; @@ -250,7 +250,7 @@ void Engine::SetViewportMetrics(const blink::ViewportMetrics& metrics) { } void Engine::DispatchPlatformMessage( - fml::RefPtr message) { + fml::RefPtr message) { if (message->channel() == kLifecycleChannel) { if (HandleLifecyclePlatformMessage(message.get())) return; @@ -272,7 +272,7 @@ void Engine::DispatchPlatformMessage( HandleNavigationPlatformMessage(std::move(message)); } -bool Engine::HandleLifecyclePlatformMessage(blink::PlatformMessage* message) { +bool Engine::HandleLifecyclePlatformMessage(flutter::PlatformMessage* message) { const auto& data = message->data(); std::string state(reinterpret_cast(data.data()), data.size()); if (state == "AppLifecycleState.paused" || @@ -297,7 +297,7 @@ bool Engine::HandleLifecyclePlatformMessage(blink::PlatformMessage* message) { } bool Engine::HandleNavigationPlatformMessage( - fml::RefPtr message) { + fml::RefPtr message) { const auto& data = message->data(); rapidjson::Document document; @@ -314,7 +314,7 @@ bool Engine::HandleNavigationPlatformMessage( } bool Engine::HandleLocalizationPlatformMessage( - blink::PlatformMessage* message) { + flutter::PlatformMessage* message) { const auto& data = message->data(); rapidjson::Document document; @@ -348,7 +348,7 @@ bool Engine::HandleLocalizationPlatformMessage( return runtime_controller_->SetLocales(locale_data); } -void Engine::HandleSettingsPlatformMessage(blink::PlatformMessage* message) { +void Engine::HandleSettingsPlatformMessage(flutter::PlatformMessage* message) { const auto& data = message->data(); std::string jsonData(reinterpret_cast(data.data()), data.size()); if (runtime_controller_->SetUserSettingsData(std::move(jsonData)) && @@ -357,7 +357,7 @@ void Engine::HandleSettingsPlatformMessage(blink::PlatformMessage* message) { } } -void Engine::DispatchPointerDataPacket(const blink::PointerDataPacket& packet, +void Engine::DispatchPointerDataPacket(const flutter::PointerDataPacket& packet, uint64_t trace_flow_id) { TRACE_EVENT0("flutter", "Engine::DispatchPointerDataPacket"); TRACE_FLOW_STEP("flutter", "PointerEvent", trace_flow_id); @@ -366,7 +366,7 @@ void Engine::DispatchPointerDataPacket(const blink::PointerDataPacket& packet, } void Engine::DispatchSemanticsAction(int id, - blink::SemanticsAction action, + flutter::SemanticsAction action, std::vector args) { runtime_controller_->DispatchSemanticsAction(id, action, std::move(args)); } @@ -412,13 +412,14 @@ void Engine::Render(std::unique_ptr layer_tree) { animator_->Render(std::move(layer_tree)); } -void Engine::UpdateSemantics(blink::SemanticsNodeUpdates update, - blink::CustomAccessibilityActionUpdates actions) { +void Engine::UpdateSemantics( + flutter::SemanticsNodeUpdates update, + flutter::CustomAccessibilityActionUpdates actions) { delegate_.OnEngineUpdateSemantics(std::move(update), std::move(actions)); } void Engine::HandlePlatformMessage( - fml::RefPtr message) { + fml::RefPtr message) { if (message->channel() == kAssetChannel) { HandleAssetPlatformMessage(std::move(message)); } else { @@ -431,13 +432,13 @@ void Engine::UpdateIsolateDescription(const std::string isolate_name, delegate_.UpdateIsolateDescription(isolate_name, isolate_port); } -blink::FontCollection& Engine::GetFontCollection() { +flutter::FontCollection& Engine::GetFontCollection() { return font_collection_; } void Engine::HandleAssetPlatformMessage( - fml::RefPtr message) { - fml::RefPtr response = message->response(); + fml::RefPtr message) { + fml::RefPtr response = message->response(); if (!response) { return; } diff --git a/shell/common/engine.h b/shell/common/engine.h index 22160cb7ee3c9..68eee4ad9906e 100644 --- a/shell/common/engine.h +++ b/shell/common/engine.h @@ -29,7 +29,7 @@ namespace shell { -class Engine final : public blink::RuntimeDelegate { +class Engine final : public flutter::RuntimeDelegate { public: // Used by Engine::Run enum class RunStatus { @@ -42,11 +42,11 @@ class Engine final : public blink::RuntimeDelegate { class Delegate { public: virtual void OnEngineUpdateSemantics( - blink::SemanticsNodeUpdates update, - blink::CustomAccessibilityActionUpdates actions) = 0; + flutter::SemanticsNodeUpdates update, + flutter::CustomAccessibilityActionUpdates actions) = 0; virtual void OnEngineHandlePlatformMessage( - fml::RefPtr message) = 0; + fml::RefPtr message) = 0; virtual void OnPreEngineRestart() = 0; @@ -55,14 +55,14 @@ class Engine final : public blink::RuntimeDelegate { }; Engine(Delegate& delegate, - blink::DartVM& vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, - blink::TaskRunners task_runners, - blink::Settings settings, + flutter::DartVM& vm, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, + flutter::TaskRunners task_runners, + flutter::Settings settings, std::unique_ptr animator, - fml::WeakPtr snapshot_delegate, - fml::WeakPtr io_manager); + fml::WeakPtr snapshot_delegate, + fml::WeakPtr io_manager); ~Engine() override; @@ -80,7 +80,7 @@ class Engine final : public blink::RuntimeDelegate { FML_WARN_UNUSED_RESULT bool Restart(RunConfiguration configuration); - bool UpdateAssetManager(std::shared_ptr asset_manager); + bool UpdateAssetManager(std::shared_ptr asset_manager); void BeginFrame(fml::TimePoint frame_time); @@ -100,15 +100,15 @@ class Engine final : public blink::RuntimeDelegate { void OnOutputSurfaceDestroyed(); - void SetViewportMetrics(const blink::ViewportMetrics& metrics); + void SetViewportMetrics(const flutter::ViewportMetrics& metrics); - void DispatchPlatformMessage(fml::RefPtr message); + void DispatchPlatformMessage(fml::RefPtr message); - void DispatchPointerDataPacket(const blink::PointerDataPacket& packet, + void DispatchPointerDataPacket(const flutter::PointerDataPacket& packet, uint64_t trace_flow_id); void DispatchSemanticsAction(int id, - blink::SemanticsAction action, + flutter::SemanticsAction action, std::vector args); void SetSemanticsEnabled(bool enabled); @@ -117,38 +117,38 @@ class Engine final : public blink::RuntimeDelegate { void ScheduleFrame(bool regenerate_layer_tree = true) override; - // |blink::RuntimeDelegate| - blink::FontCollection& GetFontCollection() override; + // |flutter::RuntimeDelegate| + flutter::FontCollection& GetFontCollection() override; private: Engine::Delegate& delegate_; - const blink::Settings settings_; + const flutter::Settings settings_; std::unique_ptr animator_; - std::unique_ptr runtime_controller_; + std::unique_ptr runtime_controller_; std::string initial_route_; - blink::ViewportMetrics viewport_metrics_; - std::shared_ptr asset_manager_; + flutter::ViewportMetrics viewport_metrics_; + std::shared_ptr asset_manager_; bool activity_running_; bool have_surface_; - blink::FontCollection font_collection_; + flutter::FontCollection font_collection_; fml::WeakPtrFactory weak_factory_; - // |blink::RuntimeDelegate| + // |flutter::RuntimeDelegate| std::string DefaultRouteName() override; - // |blink::RuntimeDelegate| + // |flutter::RuntimeDelegate| void Render(std::unique_ptr layer_tree) override; - // |blink::RuntimeDelegate| + // |flutter::RuntimeDelegate| void UpdateSemantics( - blink::SemanticsNodeUpdates update, - blink::CustomAccessibilityActionUpdates actions) override; + flutter::SemanticsNodeUpdates update, + flutter::CustomAccessibilityActionUpdates actions) override; - // |blink::RuntimeDelegate| + // |flutter::RuntimeDelegate| void HandlePlatformMessage( - fml::RefPtr message) override; + fml::RefPtr message) override; - // |blink::RuntimeDelegate| + // |flutter::RuntimeDelegate| void UpdateIsolateDescription(const std::string isolate_name, int64_t isolate_port) override; @@ -156,16 +156,17 @@ class Engine final : public blink::RuntimeDelegate { void StartAnimatorIfPossible(); - bool HandleLifecyclePlatformMessage(blink::PlatformMessage* message); + bool HandleLifecyclePlatformMessage(flutter::PlatformMessage* message); bool HandleNavigationPlatformMessage( - fml::RefPtr message); + fml::RefPtr message); - bool HandleLocalizationPlatformMessage(blink::PlatformMessage* message); + bool HandleLocalizationPlatformMessage(flutter::PlatformMessage* message); - void HandleSettingsPlatformMessage(blink::PlatformMessage* message); + void HandleSettingsPlatformMessage(flutter::PlatformMessage* message); - void HandleAssetPlatformMessage(fml::RefPtr message); + void HandleAssetPlatformMessage( + fml::RefPtr message); bool GetAssetAsBuffer(const std::string& name, std::vector* data); diff --git a/shell/common/io_manager.h b/shell/common/io_manager.h index a69c42abbc311..ed6bbd0311e5a 100644 --- a/shell/common/io_manager.h +++ b/shell/common/io_manager.h @@ -15,7 +15,7 @@ namespace shell { -class IOManager : public blink::IOManager { +class IOManager : public flutter::IOManager { public: // Convenience methods for platforms to create a GrContext used to supply to // the IOManager. The platforms may create the context themselves if they so diff --git a/shell/common/isolate_configuration.cc b/shell/common/isolate_configuration.cc index e45b6ab15e5f9..93ec0afac13a3 100644 --- a/shell/common/isolate_configuration.cc +++ b/shell/common/isolate_configuration.cc @@ -13,8 +13,8 @@ IsolateConfiguration::IsolateConfiguration() = default; IsolateConfiguration::~IsolateConfiguration() = default; -bool IsolateConfiguration::PrepareIsolate(blink::DartIsolate& isolate) { - if (isolate.GetPhase() != blink::DartIsolate::Phase::LibrariesSetup) { +bool IsolateConfiguration::PrepareIsolate(flutter::DartIsolate& isolate) { + if (isolate.GetPhase() != flutter::DartIsolate::Phase::LibrariesSetup) { FML_DLOG(ERROR) << "Isolate was in incorrect phase to be prepared for running."; return false; @@ -28,7 +28,7 @@ class AppSnapshotIsolateConfiguration final : public IsolateConfiguration { AppSnapshotIsolateConfiguration() = default; // |shell::IsolateConfiguration| - bool DoPrepareIsolate(blink::DartIsolate& isolate) override { + bool DoPrepareIsolate(flutter::DartIsolate& isolate) override { return isolate.PrepareForRunningFromPrecompiledCode(); } @@ -42,8 +42,8 @@ class KernelIsolateConfiguration : public IsolateConfiguration { : kernel_(std::move(kernel)) {} // |shell::IsolateConfiguration| - bool DoPrepareIsolate(blink::DartIsolate& isolate) override { - if (blink::DartVM::IsRunningPrecompiledCode()) { + bool DoPrepareIsolate(flutter::DartIsolate& isolate) override { + if (flutter::DartVM::IsRunningPrecompiledCode()) { return false; } return isolate.PrepareForRunningFromKernel(std::move(kernel_)); @@ -63,8 +63,8 @@ class KernelListIsolateConfiguration final : public IsolateConfiguration { : kernel_pieces_(std::move(kernel_pieces)) {} // |shell::IsolateConfiguration| - bool DoPrepareIsolate(blink::DartIsolate& isolate) override { - if (blink::DartVM::IsRunningPrecompiledCode()) { + bool DoPrepareIsolate(flutter::DartIsolate& isolate) override { + if (flutter::DartVM::IsRunningPrecompiledCode()) { return false; } @@ -115,7 +115,7 @@ static std::vector ParseKernelListPaths( static std::vector>> PrepareKernelMappings(std::vector kernel_pieces_paths, - std::shared_ptr asset_manager, + std::shared_ptr asset_manager, fml::RefPtr io_worker) { FML_DCHECK(asset_manager); std::vector>> fetch_futures; @@ -142,11 +142,11 @@ PrepareKernelMappings(std::vector kernel_pieces_paths, } std::unique_ptr IsolateConfiguration::InferFromSettings( - const blink::Settings& settings, - std::shared_ptr asset_manager, + const flutter::Settings& settings, + std::shared_ptr asset_manager, fml::RefPtr io_worker) { // Running in AOT mode. - if (blink::DartVM::IsRunningPrecompiledCode()) { + if (flutter::DartVM::IsRunningPrecompiledCode()) { return CreateForAppSnapshot(); } diff --git a/shell/common/isolate_configuration.h b/shell/common/isolate_configuration.h index 0d2619e6068c1..8de0a8192b571 100644 --- a/shell/common/isolate_configuration.h +++ b/shell/common/isolate_configuration.h @@ -22,8 +22,8 @@ namespace shell { class IsolateConfiguration { public: static std::unique_ptr InferFromSettings( - const blink::Settings& settings, - std::shared_ptr asset_manager, + const flutter::Settings& settings, + std::shared_ptr asset_manager, fml::RefPtr io_worker); static std::unique_ptr CreateForAppSnapshot(); @@ -42,10 +42,10 @@ class IsolateConfiguration { virtual ~IsolateConfiguration(); - bool PrepareIsolate(blink::DartIsolate& isolate); + bool PrepareIsolate(flutter::DartIsolate& isolate); protected: - virtual bool DoPrepareIsolate(blink::DartIsolate& isolate) = 0; + virtual bool DoPrepareIsolate(flutter::DartIsolate& isolate) = 0; private: FML_DISALLOW_COPY_AND_ASSIGN(IsolateConfiguration); diff --git a/shell/common/persistent_cache.cc b/shell/common/persistent_cache.cc index 64d29f15c2b58..fe9f6e48243e2 100644 --- a/shell/common/persistent_cache.cc +++ b/shell/common/persistent_cache.cc @@ -61,8 +61,8 @@ PersistentCache::PersistentCache(bool read_only) : is_read_only_(read_only) { if (cache_base_dir.is_valid()) { cache_directory_ = std::make_shared( CreateDirectory(cache_base_dir, - {"flutter_engine", blink::GetFlutterEngineVersion(), - "skia", blink::GetSkiaVersion()}, + {"flutter_engine", flutter::GetFlutterEngineVersion(), + "skia", flutter::GetSkiaVersion()}, read_only ? fml::FilePermission::kRead : fml::FilePermission::kReadWrite)); } diff --git a/shell/common/platform_view.cc b/shell/common/platform_view.cc index cd909814c66b8..f10d29941d54e 100644 --- a/shell/common/platform_view.cc +++ b/shell/common/platform_view.cc @@ -16,7 +16,8 @@ namespace shell { -PlatformView::PlatformView(Delegate& delegate, blink::TaskRunners task_runners) +PlatformView::PlatformView(Delegate& delegate, + flutter::TaskRunners task_runners) : delegate_(delegate), task_runners_(std::move(task_runners)), size_(SkISize::Make(0, 0)), @@ -32,17 +33,17 @@ std::unique_ptr PlatformView::CreateVSyncWaiter() { } void PlatformView::DispatchPlatformMessage( - fml::RefPtr message) { + fml::RefPtr message) { delegate_.OnPlatformViewDispatchPlatformMessage(std::move(message)); } void PlatformView::DispatchPointerDataPacket( - std::unique_ptr packet) { + std::unique_ptr packet) { delegate_.OnPlatformViewDispatchPointerDataPacket(std::move(packet)); } void PlatformView::DispatchSemanticsAction(int32_t id, - blink::SemanticsAction action, + flutter::SemanticsAction action, std::vector args) { delegate_.OnPlatformViewDispatchSemanticsAction(id, action, std::move(args)); } @@ -55,7 +56,7 @@ void PlatformView::SetAccessibilityFeatures(int32_t flags) { delegate_.OnPlatformViewSetAccessibilityFeatures(flags); } -void PlatformView::SetViewportMetrics(const blink::ViewportMetrics& metrics) { +void PlatformView::SetViewportMetrics(const flutter::ViewportMetrics& metrics) { delegate_.OnPlatformViewSetViewportMetrics(metrics); } @@ -93,11 +94,11 @@ fml::WeakPtr PlatformView::GetWeakPtr() const { } void PlatformView::UpdateSemantics( - blink::SemanticsNodeUpdates update, - blink::CustomAccessibilityActionUpdates actions) {} + flutter::SemanticsNodeUpdates update, + flutter::CustomAccessibilityActionUpdates actions) {} void PlatformView::HandlePlatformMessage( - fml::RefPtr message) { + fml::RefPtr message) { if (auto response = message->response()) response->CompleteEmpty(); } diff --git a/shell/common/platform_view.h b/shell/common/platform_view.h index 2ed5091b46895..07e92dd5377b3 100644 --- a/shell/common/platform_view.h +++ b/shell/common/platform_view.h @@ -36,17 +36,17 @@ class PlatformView { virtual void OnPlatformViewSetNextFrameCallback(fml::closure closure) = 0; virtual void OnPlatformViewSetViewportMetrics( - const blink::ViewportMetrics& metrics) = 0; + const flutter::ViewportMetrics& metrics) = 0; virtual void OnPlatformViewDispatchPlatformMessage( - fml::RefPtr message) = 0; + fml::RefPtr message) = 0; virtual void OnPlatformViewDispatchPointerDataPacket( - std::unique_ptr packet) = 0; + std::unique_ptr packet) = 0; virtual void OnPlatformViewDispatchSemanticsAction( int32_t id, - blink::SemanticsAction action, + flutter::SemanticsAction action, std::vector args) = 0; virtual void OnPlatformViewSetSemanticsEnabled(bool enabled) = 0; @@ -62,23 +62,23 @@ class PlatformView { int64_t texture_id) = 0; }; - explicit PlatformView(Delegate& delegate, blink::TaskRunners task_runners); + explicit PlatformView(Delegate& delegate, flutter::TaskRunners task_runners); virtual ~PlatformView(); virtual std::unique_ptr CreateVSyncWaiter(); - void DispatchPlatformMessage(fml::RefPtr message); + void DispatchPlatformMessage(fml::RefPtr message); void DispatchSemanticsAction(int32_t id, - blink::SemanticsAction action, + flutter::SemanticsAction action, std::vector args); virtual void SetSemanticsEnabled(bool enabled); virtual void SetAccessibilityFeatures(int32_t flags); - void SetViewportMetrics(const blink::ViewportMetrics& metrics); + void SetViewportMetrics(const flutter::ViewportMetrics& metrics); void NotifyCreated(); @@ -94,18 +94,19 @@ class PlatformView { fml::WeakPtr GetWeakPtr() const; - virtual void UpdateSemantics(blink::SemanticsNodeUpdates updates, - blink::CustomAccessibilityActionUpdates actions); + virtual void UpdateSemantics( + flutter::SemanticsNodeUpdates updates, + flutter::CustomAccessibilityActionUpdates actions); virtual void HandlePlatformMessage( - fml::RefPtr message); + fml::RefPtr message); virtual void OnPreEngineRestart() const; void SetNextFrameCallback(fml::closure closure); void DispatchPointerDataPacket( - std::unique_ptr packet); + std::unique_ptr packet); // Called once per texture, on the platform thread. void RegisterTexture(std::shared_ptr texture); @@ -118,7 +119,7 @@ class PlatformView { protected: PlatformView::Delegate& delegate_; - const blink::TaskRunners task_runners_; + const flutter::TaskRunners task_runners_; SkISize size_; fml::WeakPtrFactory weak_factory_; diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index b86e7cf19c469..6759ef974078f 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -22,12 +22,12 @@ namespace shell { // used within this interval. static constexpr std::chrono::milliseconds kSkiaCleanupExpiration(15000); -Rasterizer::Rasterizer(blink::TaskRunners task_runners) +Rasterizer::Rasterizer(flutter::TaskRunners task_runners) : Rasterizer(std::move(task_runners), std::make_unique()) {} Rasterizer::Rasterizer( - blink::TaskRunners task_runners, + flutter::TaskRunners task_runners, std::unique_ptr compositor_context) : task_runners_(std::move(task_runners)), compositor_context_(std::move(compositor_context)), @@ -41,7 +41,8 @@ fml::WeakPtr Rasterizer::GetWeakPtr() const { return weak_factory_.GetWeakPtr(); } -fml::WeakPtr Rasterizer::GetSnapshotDelegate() const { +fml::WeakPtr Rasterizer::GetSnapshotDelegate() + const { return weak_factory_.GetWeakPtr(); } diff --git a/shell/common/rasterizer.h b/shell/common/rasterizer.h index 17e429f54b4d6..0319afe744b56 100644 --- a/shell/common/rasterizer.h +++ b/shell/common/rasterizer.h @@ -19,11 +19,11 @@ namespace shell { -class Rasterizer final : public blink::SnapshotDelegate { +class Rasterizer final : public flutter::SnapshotDelegate { public: - Rasterizer(blink::TaskRunners task_runners); + Rasterizer(flutter::TaskRunners task_runners); - Rasterizer(blink::TaskRunners task_runners, + Rasterizer(flutter::TaskRunners task_runners, std::unique_ptr compositor_context); ~Rasterizer(); @@ -34,7 +34,7 @@ class Rasterizer final : public blink::SnapshotDelegate { fml::WeakPtr GetWeakPtr() const; - fml::WeakPtr GetSnapshotDelegate() const; + fml::WeakPtr GetSnapshotDelegate() const; flow::LayerTree* GetLastLayerTree(); @@ -76,14 +76,14 @@ class Rasterizer final : public blink::SnapshotDelegate { void SetResourceCacheMaxBytes(int max_bytes); private: - blink::TaskRunners task_runners_; + flutter::TaskRunners task_runners_; std::unique_ptr surface_; std::unique_ptr compositor_context_; std::unique_ptr last_layer_tree_; fml::closure next_frame_callback_; fml::WeakPtrFactory weak_factory_; - // |blink::SnapshotDelegate| + // |flutter::SnapshotDelegate| sk_sp MakeRasterSnapshot(sk_sp picture, SkISize picture_size) override; diff --git a/shell/common/run_configuration.cc b/shell/common/run_configuration.cc index 122b45e6b0eff..d6cf5d75802f3 100644 --- a/shell/common/run_configuration.cc +++ b/shell/common/run_configuration.cc @@ -13,15 +13,15 @@ namespace shell { RunConfiguration RunConfiguration::InferFromSettings( - const blink::Settings& settings, + const flutter::Settings& settings, fml::RefPtr io_worker) { - auto asset_manager = std::make_shared(); + auto asset_manager = std::make_shared(); - asset_manager->PushBack(std::make_unique( + asset_manager->PushBack(std::make_unique( fml::Duplicate(settings.assets_dir))); asset_manager->PushBack( - std::make_unique(fml::OpenDirectory( + std::make_unique(fml::OpenDirectory( settings.assets_path.c_str(), false, fml::FilePermission::kRead))); return {IsolateConfiguration::InferFromSettings(settings, asset_manager, @@ -32,11 +32,11 @@ RunConfiguration RunConfiguration::InferFromSettings( RunConfiguration::RunConfiguration( std::unique_ptr configuration) : RunConfiguration(std::move(configuration), - std::make_shared()) {} + std::make_shared()) {} RunConfiguration::RunConfiguration( std::unique_ptr configuration, - std::shared_ptr asset_manager) + std::shared_ptr asset_manager) : isolate_configuration_(std::move(configuration)), asset_manager_(std::move(asset_manager)) {} @@ -49,7 +49,7 @@ bool RunConfiguration::IsValid() const { } bool RunConfiguration::AddAssetResolver( - std::unique_ptr resolver) { + std::unique_ptr resolver) { if (!resolver || !resolver->IsValid()) { return false; } @@ -68,7 +68,8 @@ void RunConfiguration::SetEntrypointAndLibrary(std::string entrypoint, entrypoint_library_ = std::move(library); } -std::shared_ptr 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 7cdebdd9f4a6b..9158813bff16b 100644 --- a/shell/common/run_configuration.h +++ b/shell/common/run_configuration.h @@ -21,13 +21,13 @@ namespace shell { class RunConfiguration { public: static RunConfiguration InferFromSettings( - const blink::Settings& settings, + const flutter::Settings& settings, fml::RefPtr io_worker = nullptr); RunConfiguration(std::unique_ptr configuration); RunConfiguration(std::unique_ptr configuration, - std::shared_ptr asset_manager); + std::shared_ptr asset_manager); RunConfiguration(RunConfiguration&&); @@ -35,13 +35,13 @@ class RunConfiguration { bool IsValid() const; - bool AddAssetResolver(std::unique_ptr resolver); + bool AddAssetResolver(std::unique_ptr resolver); void SetEntrypoint(std::string entrypoint); void SetEntrypointAndLibrary(std::string entrypoint, std::string library); - std::shared_ptr GetAssetManager() const; + std::shared_ptr GetAssetManager() const; const std::string& GetEntrypoint() const; @@ -51,7 +51,7 @@ class RunConfiguration { private: std::unique_ptr isolate_configuration_; - std::shared_ptr 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 3c824ae8e0c02..84a879e4baf63 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -36,11 +36,11 @@ namespace shell { constexpr char kSkiaChannel[] = "flutter/skia"; std::unique_ptr Shell::CreateShellOnPlatformThread( - blink::DartVMRef vm, - blink::TaskRunners task_runners, - blink::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + flutter::DartVMRef vm, + flutter::TaskRunners task_runners, + flutter::Settings settings, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, Shell::CreateCallback on_create_platform_view, Shell::CreateCallback on_create_rasterizer) { if (!task_runners.IsValid()) { @@ -88,7 +88,7 @@ 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::WeakPtr snapshot_delegate; fml::TaskRunner::RunNowOrPostTask( task_runners.GetGPUTaskRunner(), [&gpu_latch, // &rasterizer, // @@ -157,8 +157,8 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( } static void RecordStartupTimestamp() { - if (blink::engine_main_enter_ts == 0) { - blink::engine_main_enter_ts = Dart_TimelineGetMicros(); + if (flutter::engine_main_enter_ts == 0) { + flutter::engine_main_enter_ts = Dart_TimelineGetMicros(); } } @@ -168,7 +168,7 @@ static void RecordStartupTimestamp() { // TODO(chinmaygarde): The unfortunate side effect of this call is that settings // that cause shell initialization failures will still lead to some of their // settings being applied. -static void PerformInitializationTasks(const blink::Settings& settings) { +static void PerformInitializationTasks(const flutter::Settings& settings) { { fml::LogSettings log_settings; log_settings.min_log_level = @@ -206,15 +206,15 @@ static void PerformInitializationTasks(const blink::Settings& settings) { } std::unique_ptr Shell::Create( - blink::TaskRunners task_runners, - blink::Settings settings, + flutter::TaskRunners task_runners, + flutter::Settings settings, Shell::CreateCallback on_create_platform_view, Shell::CreateCallback on_create_rasterizer) { PerformInitializationTasks(settings); TRACE_EVENT0("flutter", "Shell::Create"); - auto vm = blink::DartVMRef::Create(settings); + auto vm = flutter::DartVMRef::Create(settings); FML_CHECK(vm) << "Must be able to initialize the VM."; auto vm_data = vm->GetVMData(); @@ -222,7 +222,7 @@ std::unique_ptr Shell::Create( return Shell::Create(std::move(task_runners), // std::move(settings), // vm_data->GetIsolateSnapshot(), // isolate snapshot - blink::DartSnapshot::Empty(), // shared snapshot + flutter::DartSnapshot::Empty(), // shared snapshot std::move(on_create_platform_view), // std::move(on_create_rasterizer), // std::move(vm) // @@ -230,13 +230,13 @@ std::unique_ptr Shell::Create( } std::unique_ptr Shell::Create( - blink::TaskRunners task_runners, - blink::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + flutter::TaskRunners task_runners, + flutter::Settings settings, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, Shell::CreateCallback on_create_platform_view, Shell::CreateCallback on_create_rasterizer, - blink::DartVMRef vm) { + flutter::DartVMRef vm) { PerformInitializationTasks(settings); TRACE_EVENT0("flutter", "Shell::CreateWithSnapshots"); @@ -274,9 +274,9 @@ std::unique_ptr Shell::Create( return shell; } -Shell::Shell(blink::DartVMRef vm, - blink::TaskRunners task_runners, - blink::Settings settings) +Shell::Shell(flutter::DartVMRef vm, + flutter::TaskRunners task_runners, + flutter::Settings settings) : task_runners_(std::move(task_runners)), settings_(std::move(settings)), vm_(std::move(vm)) { @@ -286,36 +286,37 @@ Shell::Shell(blink::DartVMRef vm, // Install service protocol handlers. - service_protocol_handlers_[blink::ServiceProtocol::kScreenshotExtensionName + service_protocol_handlers_[flutter::ServiceProtocol::kScreenshotExtensionName .ToString()] = { task_runners_.GetGPUTaskRunner(), std::bind(&Shell::OnServiceProtocolScreenshot, this, std::placeholders::_1, std::placeholders::_2)}; - service_protocol_handlers_[blink::ServiceProtocol::kScreenshotSkpExtensionName - .ToString()] = { - task_runners_.GetGPUTaskRunner(), - std::bind(&Shell::OnServiceProtocolScreenshotSKP, this, - std::placeholders::_1, std::placeholders::_2)}; - service_protocol_handlers_[blink::ServiceProtocol::kRunInViewExtensionName + service_protocol_handlers_ + [flutter::ServiceProtocol::kScreenshotSkpExtensionName.ToString()] = { + task_runners_.GetGPUTaskRunner(), + std::bind(&Shell::OnServiceProtocolScreenshotSKP, this, + std::placeholders::_1, std::placeholders::_2)}; + service_protocol_handlers_[flutter::ServiceProtocol::kRunInViewExtensionName .ToString()] = { task_runners_.GetUITaskRunner(), std::bind(&Shell::OnServiceProtocolRunInView, this, std::placeholders::_1, std::placeholders::_2)}; service_protocol_handlers_ - [blink::ServiceProtocol::kFlushUIThreadTasksExtensionName.ToString()] = { - task_runners_.GetUITaskRunner(), - std::bind(&Shell::OnServiceProtocolFlushUIThreadTasks, this, - std::placeholders::_1, std::placeholders::_2)}; - service_protocol_handlers_ - [blink::ServiceProtocol::kSetAssetBundlePathExtensionName.ToString()] = { - task_runners_.GetUITaskRunner(), - std::bind(&Shell::OnServiceProtocolSetAssetBundlePath, this, - std::placeholders::_1, std::placeholders::_2)}; + [flutter::ServiceProtocol::kFlushUIThreadTasksExtensionName.ToString()] = + {task_runners_.GetUITaskRunner(), + std::bind(&Shell::OnServiceProtocolFlushUIThreadTasks, this, + std::placeholders::_1, std::placeholders::_2)}; service_protocol_handlers_ - [blink::ServiceProtocol::kGetDisplayRefreshRateExtensionName.ToString()] = + [flutter::ServiceProtocol::kSetAssetBundlePathExtensionName.ToString()] = {task_runners_.GetUITaskRunner(), - std::bind(&Shell::OnServiceProtocolGetDisplayRefreshRate, this, + std::bind(&Shell::OnServiceProtocolSetAssetBundlePath, this, std::placeholders::_1, std::placeholders::_2)}; + service_protocol_handlers_ + [flutter::ServiceProtocol::kGetDisplayRefreshRateExtensionName + .ToString()] = { + task_runners_.GetUITaskRunner(), + std::bind(&Shell::OnServiceProtocolGetDisplayRefreshRate, this, + std::placeholders::_1, std::placeholders::_2)}; } Shell::~Shell() { @@ -404,11 +405,11 @@ bool Shell::Setup(std::unique_ptr platform_view, return true; } -const blink::Settings& Shell::GetSettings() const { +const flutter::Settings& Shell::GetSettings() const { return settings_; } -const blink::TaskRunners& Shell::GetTaskRunners() const { +const flutter::TaskRunners& Shell::GetTaskRunners() const { return task_runners_; } @@ -427,7 +428,7 @@ fml::WeakPtr Shell::GetPlatformView() { return platform_view_->GetWeakPtr(); } -blink::DartVM* Shell::GetDartVM() { +flutter::DartVM* Shell::GetDartVM() { return &vm_; } @@ -591,7 +592,7 @@ void Shell::OnPlatformViewDestroyed() { // |shell::PlatformView::Delegate| void Shell::OnPlatformViewSetViewportMetrics( - const blink::ViewportMetrics& metrics) { + const flutter::ViewportMetrics& metrics) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -605,7 +606,7 @@ void Shell::OnPlatformViewSetViewportMetrics( // |shell::PlatformView::Delegate| void Shell::OnPlatformViewDispatchPlatformMessage( - fml::RefPtr message) { + fml::RefPtr message) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -619,7 +620,7 @@ void Shell::OnPlatformViewDispatchPlatformMessage( // |shell::PlatformView::Delegate| void Shell::OnPlatformViewDispatchPointerDataPacket( - std::unique_ptr packet) { + std::unique_ptr packet) { TRACE_EVENT0("flutter", "Shell::OnPlatformViewDispatchPointerDataPacket"); TRACE_FLOW_BEGIN("flutter", "PointerEvent", next_pointer_flow_id_); FML_DCHECK(is_setup_); @@ -635,9 +636,10 @@ void Shell::OnPlatformViewDispatchPointerDataPacket( } // |shell::PlatformView::Delegate| -void Shell::OnPlatformViewDispatchSemanticsAction(int32_t id, - blink::SemanticsAction action, - std::vector args) { +void Shell::OnPlatformViewDispatchSemanticsAction( + int32_t id, + flutter::SemanticsAction action, + std::vector args) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -798,8 +800,8 @@ void Shell::OnAnimatorDrawLastLayerTree() { // |shell::Engine::Delegate| void Shell::OnEngineUpdateSemantics( - blink::SemanticsNodeUpdates update, - blink::CustomAccessibilityActionUpdates actions) { + flutter::SemanticsNodeUpdates update, + flutter::CustomAccessibilityActionUpdates actions) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); @@ -814,7 +816,7 @@ void Shell::OnEngineUpdateSemantics( // |shell::Engine::Delegate| void Shell::OnEngineHandlePlatformMessage( - fml::RefPtr message) { + fml::RefPtr message) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); @@ -832,7 +834,7 @@ void Shell::OnEngineHandlePlatformMessage( } void Shell::HandleEngineSkiaMessage( - fml::RefPtr message) { + fml::RefPtr message) { const auto& data = message->data(); rapidjson::Document document; @@ -882,7 +884,7 @@ void Shell::UpdateIsolateDescription(const std::string isolate_name, vm_->GetServiceProtocol()->SetHandlerDescription(this, description); } -// |blink::ServiceProtocol::Handler| +// |flutter::ServiceProtocol::Handler| fml::RefPtr Shell::GetServiceProtocolHandlerTaskRunner( fml::StringView method) const { FML_DCHECK(is_setup_); @@ -893,7 +895,7 @@ fml::RefPtr Shell::GetServiceProtocolHandlerTaskRunner( return task_runners_.GetUITaskRunner(); } -// |blink::ServiceProtocol::Handler| +// |flutter::ServiceProtocol::Handler| bool Shell::HandleServiceProtocolMessage( fml::StringView method, // one if the extension names specified above. const ServiceProtocolMap& params, @@ -905,8 +907,8 @@ bool Shell::HandleServiceProtocolMessage( return false; } -// |blink::ServiceProtocol::Handler| -blink::ServiceProtocol::Handler::Description +// |flutter::ServiceProtocol::Handler| +flutter::ServiceProtocol::Handler::Description Shell::GetServiceProtocolDescription() const { return { engine_->GetUIIsolateMainPort(), @@ -939,7 +941,7 @@ static void ServiceProtocolFailureError(rapidjson::Document& response, // Service protocol handler bool Shell::OnServiceProtocolScreenshot( - const blink::ServiceProtocol::Handler::ServiceProtocolMap& params, + const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response) { FML_DCHECK(task_runners_.GetGPUTaskRunner()->RunsTasksOnCurrentThread()); auto screenshot = rasterizer_->ScreenshotLastLayerTree( @@ -960,7 +962,7 @@ bool Shell::OnServiceProtocolScreenshot( // Service protocol handler bool Shell::OnServiceProtocolScreenshotSKP( - const blink::ServiceProtocol::Handler::ServiceProtocolMap& params, + const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response) { FML_DCHECK(task_runners_.GetGPUTaskRunner()->RunsTasksOnCurrentThread()); auto screenshot = rasterizer_->ScreenshotLastLayerTree( @@ -981,7 +983,7 @@ bool Shell::OnServiceProtocolScreenshotSKP( // Service protocol handler bool Shell::OnServiceProtocolRunInView( - const blink::ServiceProtocol::Handler::ServiceProtocolMap& params, + const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response) { FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); @@ -1024,7 +1026,7 @@ bool Shell::OnServiceProtocolRunInView( RunConfiguration configuration(std::move(isolate_configuration)); configuration.AddAssetResolver( - std::make_unique(fml::OpenDirectory( + std::make_unique(fml::OpenDirectory( asset_directory_path.c_str(), false, fml::FilePermission::kRead))); auto& allocator = response.GetAllocator(); @@ -1049,7 +1051,7 @@ bool Shell::OnServiceProtocolRunInView( // Service protocol handler bool Shell::OnServiceProtocolFlushUIThreadTasks( - const blink::ServiceProtocol::Handler::ServiceProtocolMap& params, + const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response) { FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); // This API should not be invoked by production code. @@ -1064,7 +1066,7 @@ bool Shell::OnServiceProtocolFlushUIThreadTasks( } bool Shell::OnServiceProtocolGetDisplayRefreshRate( - const blink::ServiceProtocol::Handler::ServiceProtocolMap& params, + const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response) { FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); response.SetObject(); @@ -1075,7 +1077,7 @@ bool Shell::OnServiceProtocolGetDisplayRefreshRate( // Service protocol handler bool Shell::OnServiceProtocolSetAssetBundlePath( - const blink::ServiceProtocol::Handler::ServiceProtocolMap& params, + const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response) { FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); @@ -1088,9 +1090,9 @@ bool Shell::OnServiceProtocolSetAssetBundlePath( auto& allocator = response.GetAllocator(); response.SetObject(); - auto asset_manager = std::make_shared(); + auto asset_manager = std::make_shared(); - asset_manager->PushFront(std::make_unique( + asset_manager->PushFront(std::make_unique( fml::OpenDirectory(params.at("assetDirectory").ToString().c_str(), false, fml::FilePermission::kRead))); diff --git a/shell/common/shell.h b/shell/common/shell.h index 864235473c934..01f166846d89f 100644 --- a/shell/common/shell.h +++ b/shell/common/shell.h @@ -37,7 +37,7 @@ namespace shell { class Shell final : public PlatformView::Delegate, public Animator::Delegate, public Engine::Delegate, - public blink::ServiceProtocol::Handler { + public flutter::ServiceProtocol::Handler { public: template using CreateCallback = std::function(Shell&)>; @@ -45,27 +45,27 @@ class Shell final : public PlatformView::Delegate, // Create a shell with the given task runners and settings. The isolate // snapshot will be shared with the snapshot of the service isolate. static std::unique_ptr Create( - blink::TaskRunners task_runners, - blink::Settings settings, + flutter::TaskRunners task_runners, + flutter::Settings settings, CreateCallback on_create_platform_view, CreateCallback on_create_rasterizer); // Creates a shell with the given task runners and settings. The isolate // snapshot is specified upfront. static std::unique_ptr Create( - blink::TaskRunners task_runners, - blink::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + flutter::TaskRunners task_runners, + flutter::Settings settings, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, CreateCallback on_create_platform_view, CreateCallback on_create_rasterizer, - blink::DartVMRef vm); + flutter::DartVMRef vm); ~Shell(); - const blink::Settings& GetSettings() const; + const flutter::Settings& GetSettings() const; - const blink::TaskRunners& GetTaskRunners() const; + const flutter::TaskRunners& GetTaskRunners() const; fml::WeakPtr GetRasterizer(); @@ -73,7 +73,7 @@ class Shell final : public PlatformView::Delegate, fml::WeakPtr GetPlatformView(); - blink::DartVM* GetDartVM(); + flutter::DartVM* GetDartVM(); bool IsSetup() const; @@ -82,12 +82,12 @@ class Shell final : public PlatformView::Delegate, private: using ServiceProtocolHandler = std::function; - const blink::TaskRunners task_runners_; - const blink::Settings settings_; - blink::DartVMRef vm_; + const flutter::TaskRunners task_runners_; + const flutter::Settings settings_; + flutter::DartVMRef vm_; std::unique_ptr platform_view_; // on platform task runner std::unique_ptr engine_; // on UI task runner std::unique_ptr rasterizer_; // on GPU task runner @@ -102,17 +102,17 @@ class Shell final : public PlatformView::Delegate, bool is_setup_ = false; uint64_t next_pointer_flow_id_ = 0; - Shell(blink::TaskRunners task_runners, blink::Settings settings); - Shell(blink::DartVMRef vm, - blink::TaskRunners task_runners, - blink::Settings settings); + Shell(flutter::TaskRunners task_runners, flutter::Settings settings); + Shell(flutter::DartVMRef vm, + flutter::TaskRunners task_runners, + flutter::Settings settings); static std::unique_ptr CreateShellOnPlatformThread( - blink::DartVMRef vm, - blink::TaskRunners task_runners, - blink::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + flutter::DartVMRef vm, + flutter::TaskRunners task_runners, + flutter::Settings settings, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, Shell::CreateCallback on_create_platform_view, Shell::CreateCallback on_create_rasterizer); @@ -129,20 +129,20 @@ class Shell final : public PlatformView::Delegate, // |shell::PlatformView::Delegate| void OnPlatformViewSetViewportMetrics( - const blink::ViewportMetrics& metrics) override; + const flutter::ViewportMetrics& metrics) override; // |shell::PlatformView::Delegate| void OnPlatformViewDispatchPlatformMessage( - fml::RefPtr message) override; + fml::RefPtr message) override; // |shell::PlatformView::Delegate| void OnPlatformViewDispatchPointerDataPacket( - std::unique_ptr packet) override; + std::unique_ptr packet) override; // |shell::PlatformView::Delegate| void OnPlatformViewDispatchSemanticsAction( int32_t id, - blink::SemanticsAction action, + flutter::SemanticsAction action, std::vector args) override; // |shell::PlatformView::Delegate| @@ -179,14 +179,14 @@ class Shell final : public PlatformView::Delegate, // |shell::Engine::Delegate| void OnEngineUpdateSemantics( - blink::SemanticsNodeUpdates update, - blink::CustomAccessibilityActionUpdates actions) override; + flutter::SemanticsNodeUpdates update, + flutter::CustomAccessibilityActionUpdates actions) override; // |shell::Engine::Delegate| void OnEngineHandlePlatformMessage( - fml::RefPtr message) override; + fml::RefPtr message) override; - void HandleEngineSkiaMessage(fml::RefPtr message); + void HandleEngineSkiaMessage(fml::RefPtr message); // |shell::Engine::Delegate| void OnPreEngineRestart() override; @@ -195,48 +195,48 @@ class Shell final : public PlatformView::Delegate, void UpdateIsolateDescription(const std::string isolate_name, int64_t isolate_port) override; - // |blink::ServiceProtocol::Handler| + // |flutter::ServiceProtocol::Handler| fml::RefPtr GetServiceProtocolHandlerTaskRunner( fml::StringView method) const override; - // |blink::ServiceProtocol::Handler| + // |flutter::ServiceProtocol::Handler| bool HandleServiceProtocolMessage( fml::StringView method, // one if the extension names specified above. const ServiceProtocolMap& params, rapidjson::Document& response) override; - // |blink::ServiceProtocol::Handler| - blink::ServiceProtocol::Handler::Description GetServiceProtocolDescription() + // |flutter::ServiceProtocol::Handler| + flutter::ServiceProtocol::Handler::Description GetServiceProtocolDescription() const override; // Service protocol handler bool OnServiceProtocolScreenshot( - const blink::ServiceProtocol::Handler::ServiceProtocolMap& params, + const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response); // Service protocol handler bool OnServiceProtocolScreenshotSKP( - const blink::ServiceProtocol::Handler::ServiceProtocolMap& params, + const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response); // Service protocol handler bool OnServiceProtocolRunInView( - const blink::ServiceProtocol::Handler::ServiceProtocolMap& params, + const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response); // Service protocol handler bool OnServiceProtocolFlushUIThreadTasks( - const blink::ServiceProtocol::Handler::ServiceProtocolMap& params, + const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response); // Service protocol handler bool OnServiceProtocolSetAssetBundlePath( - const blink::ServiceProtocol::Handler::ServiceProtocolMap& params, + const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response); // Service protocol handler bool OnServiceProtocolGetDisplayRefreshRate( - const blink::ServiceProtocol::Handler::ServiceProtocolMap& params, + const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response); FML_DISALLOW_COPY_AND_ASSIGN(Shell); diff --git a/shell/common/shell_benchmarks.cc b/shell/common/shell_benchmarks.cc index df15b8f1b40ff..645344e37d3ff 100644 --- a/shell/common/shell_benchmarks.cc +++ b/shell/common/shell_benchmarks.cc @@ -16,7 +16,7 @@ static void StartupAndShutdownShell(benchmark::State& state, std::unique_ptr thread_host; { benchmarking::ScopedPauseTiming pause(state, !measure_startup); - blink::Settings settings = {}; + flutter::Settings settings = {}; settings.task_observer_add = [](intptr_t, fml::closure) {}; settings.task_observer_remove = [](intptr_t) {}; @@ -26,7 +26,7 @@ static void StartupAndShutdownShell(benchmark::State& state, ThreadHost::Type::GPU | ThreadHost::Type::IO | ThreadHost::Type::UI); - blink::TaskRunners task_runners( + flutter::TaskRunners task_runners( "test", thread_host->platform_thread->GetTaskRunner(), thread_host->gpu_thread->GetTaskRunner(), thread_host->ui_thread->GetTaskRunner(), diff --git a/shell/common/shell_test.cc b/shell/common/shell_test.cc index c8aab6004603a..a32a524428b39 100644 --- a/shell/common/shell_test.cc +++ b/shell/common/shell_test.cc @@ -44,7 +44,7 @@ static std::unique_ptr GetMapping(const fml::UniqueFD& directory, return mapping; } -void ShellTest::SetSnapshotsAndAssets(blink::Settings& settings) { +void ShellTest::SetSnapshotsAndAssets(flutter::Settings& settings) { if (!assets_dir_.is_valid()) { return; } @@ -53,7 +53,7 @@ void ShellTest::SetSnapshotsAndAssets(blink::Settings& settings) { // In JIT execution, all snapshots are present within the binary itself and // don't need to be explicitly suppiled by the embedder. - if (blink::DartVM::IsRunningPrecompiledCode()) { + if (flutter::DartVM::IsRunningPrecompiledCode()) { settings.vm_snapshot_data = [this]() { return GetMapping(assets_dir_, "vm_snapshot_data", false); }; @@ -62,7 +62,7 @@ void ShellTest::SetSnapshotsAndAssets(blink::Settings& settings) { return GetMapping(assets_dir_, "isolate_snapshot_data", false); }; - if (blink::DartVM::IsRunningPrecompiledCode()) { + if (flutter::DartVM::IsRunningPrecompiledCode()) { settings.vm_snapshot_instr = [this]() { return GetMapping(assets_dir_, "vm_snapshot_instr", true); }; @@ -81,8 +81,8 @@ void ShellTest::SetSnapshotsAndAssets(blink::Settings& settings) { } } -blink::Settings ShellTest::CreateSettingsForFixture() { - blink::Settings settings; +flutter::Settings ShellTest::CreateSettingsForFixture() { + flutter::Settings settings; settings.task_observer_add = [](intptr_t key, fml::closure handler) { fml::MessageLoop::GetCurrent().AddTaskObserver(key, handler); }; @@ -96,7 +96,7 @@ blink::Settings ShellTest::CreateSettingsForFixture() { return settings; } -blink::TaskRunners ShellTest::GetTaskRunnersForFixture() { +flutter::TaskRunners ShellTest::GetTaskRunnersForFixture() { return { "test", thread_host_->platform_thread->GetTaskRunner(), // platform diff --git a/shell/common/shell_test.h b/shell/common/shell_test.h index 4dcd9f8dbfc15..38c28d1756c8b 100644 --- a/shell/common/shell_test.h +++ b/shell/common/shell_test.h @@ -23,9 +23,9 @@ class ShellTest : public ::testing::ThreadTest { ~ShellTest(); - blink::Settings CreateSettingsForFixture(); + flutter::Settings CreateSettingsForFixture(); - blink::TaskRunners GetTaskRunnersForFixture(); + flutter::TaskRunners GetTaskRunnersForFixture(); void AddNativeCallback(std::string name, Dart_NativeFunction callback); @@ -41,7 +41,7 @@ class ShellTest : public ::testing::ThreadTest { std::shared_ptr<::testing::TestDartNativeResolver> native_resolver_; std::unique_ptr thread_host_; - void SetSnapshotsAndAssets(blink::Settings& settings); + void SetSnapshotsAndAssets(flutter::Settings& settings); }; } // namespace testing diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc index 793df24a41825..333a8f3354173 100644 --- a/shell/common/shell_unittests.cc +++ b/shell/common/shell_unittests.cc @@ -27,7 +27,7 @@ class TestPlatformView : public PlatformView, public GPUSurfaceSoftwareDelegate { public: TestPlatformView(PlatformView::Delegate& delegate, - blink::TaskRunners task_runners) + flutter::TaskRunners task_runners) : PlatformView(delegate, std::move(task_runners)) {} private: @@ -84,8 +84,8 @@ static bool ValidateShell(Shell* shell) { } TEST_F(ShellTest, InitializeWithInvalidThreads) { - blink::Settings settings = CreateSettingsForFixture(); - blink::TaskRunners task_runners("test", nullptr, nullptr, nullptr, nullptr); + flutter::Settings settings = CreateSettingsForFixture(); + flutter::TaskRunners task_runners("test", nullptr, nullptr, nullptr, nullptr); auto shell = Shell::Create( std::move(task_runners), settings, [](Shell& shell) { @@ -99,16 +99,16 @@ TEST_F(ShellTest, InitializeWithInvalidThreads) { } TEST_F(ShellTest, InitializeWithDifferentThreads) { - blink::Settings settings = CreateSettingsForFixture(); + flutter::Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( "io.flutter.test." + ::testing::GetCurrentTestName() + ".", 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()); + flutter::TaskRunners task_runners( + "test", thread_host.platform_thread->GetTaskRunner(), + thread_host.gpu_thread->GetTaskRunner(), + thread_host.ui_thread->GetTaskRunner(), + thread_host.io_thread->GetTaskRunner()); auto shell = Shell::Create( std::move(task_runners), settings, [](Shell& shell) { @@ -122,13 +122,13 @@ TEST_F(ShellTest, InitializeWithDifferentThreads) { } TEST_F(ShellTest, InitializeWithSingleThread) { - blink::Settings settings = CreateSettingsForFixture(); + flutter::Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( "io.flutter.test." + ::testing::GetCurrentTestName() + ".", ThreadHost::Type::Platform); auto task_runner = thread_host.platform_thread->GetTaskRunner(); - blink::TaskRunners task_runners("test", task_runner, task_runner, task_runner, - task_runner); + flutter::TaskRunners task_runners("test", task_runner, task_runner, + task_runner, task_runner); auto shell = Shell::Create( std::move(task_runners), settings, [](Shell& shell) { @@ -142,11 +142,11 @@ TEST_F(ShellTest, InitializeWithSingleThread) { } TEST_F(ShellTest, InitializeWithSingleThreadWhichIsTheCallingThread) { - blink::Settings settings = CreateSettingsForFixture(); + flutter::Settings settings = CreateSettingsForFixture(); fml::MessageLoop::EnsureInitializedForCurrentThread(); auto task_runner = fml::MessageLoop::GetCurrent().GetTaskRunner(); - blink::TaskRunners task_runners("test", task_runner, task_runner, task_runner, - task_runner); + flutter::TaskRunners task_runners("test", task_runner, task_runner, + task_runner, task_runner); auto shell = Shell::Create( std::move(task_runners), settings, [](Shell& shell) { @@ -161,12 +161,12 @@ TEST_F(ShellTest, InitializeWithSingleThreadWhichIsTheCallingThread) { TEST_F(ShellTest, InitializeWithMultipleThreadButCallingThreadAsPlatformThread) { - blink::Settings settings = CreateSettingsForFixture(); + flutter::Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( "io.flutter.test." + ::testing::GetCurrentTestName() + ".", ThreadHost::Type::GPU | ThreadHost::Type::IO | ThreadHost::Type::UI); fml::MessageLoop::EnsureInitializedForCurrentThread(); - blink::TaskRunners task_runners( + flutter::TaskRunners task_runners( "test", fml::MessageLoop::GetCurrent().GetTaskRunner(), thread_host.gpu_thread->GetTaskRunner(), thread_host.ui_thread->GetTaskRunner(), @@ -184,11 +184,11 @@ TEST_F(ShellTest, } TEST_F(ShellTest, InitializeWithGPUAndPlatformThreadsTheSame) { - blink::Settings settings = CreateSettingsForFixture(); + flutter::Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( "io.flutter.test." + ::testing::GetCurrentTestName() + ".", ThreadHost::Type::Platform | ThreadHost::Type::IO | ThreadHost::Type::UI); - blink::TaskRunners task_runners( + flutter::TaskRunners task_runners( "test", thread_host.platform_thread->GetTaskRunner(), // platform thread_host.platform_thread->GetTaskRunner(), // gpu diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 215e043f78505..68c1c90f119b1 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -46,11 +46,11 @@ void PrintUsage(const std::string& executable_name) { std::cerr << "Versions: " << std::endl << std::endl; - std::cerr << "Flutter Engine Version: " << blink::GetFlutterEngineVersion() + std::cerr << "Flutter Engine Version: " << flutter::GetFlutterEngineVersion() << std::endl; - std::cerr << "Skia Version: " << blink::GetSkiaVersion() << std::endl; + std::cerr << "Skia Version: " << flutter::GetSkiaVersion() << std::endl; - std::cerr << "Dart Version: " << blink::GetDartVersion() << std::endl + std::cerr << "Dart Version: " << flutter::GetDartVersion() << std::endl << std::endl; std::cerr << "Available Flags:" << std::endl; @@ -150,8 +150,9 @@ std::unique_ptr GetSymbolMapping(std::string symbol_prefix, return std::make_unique(mapping, size); } -blink::Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { - blink::Settings settings = {}; +flutter::Settings SettingsFromCommandLine( + const fml::CommandLine& command_line) { + flutter::Settings settings = {}; // Enable Observatory settings.enable_observatory = diff --git a/shell/common/switches.h b/shell/common/switches.h index 951bf7ad55b24..44d886ef32f53 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -151,7 +151,7 @@ void PrintUsage(const std::string& executable_name); const fml::StringView FlagForSwitch(Switch swtch); -blink::Settings SettingsFromCommandLine(const fml::CommandLine& command_line); +flutter::Settings SettingsFromCommandLine(const fml::CommandLine& command_line); } // namespace shell diff --git a/shell/common/vsync_waiter.cc b/shell/common/vsync_waiter.cc index 87ead7cc205cf..49f45e9d6d8b6 100644 --- a/shell/common/vsync_waiter.cc +++ b/shell/common/vsync_waiter.cc @@ -23,7 +23,7 @@ static constexpr const char* kVsyncTraceName = "VSYNC"; static constexpr const char* kVsyncFlowName = "VsyncFlow"; -VsyncWaiter::VsyncWaiter(blink::TaskRunners task_runners) +VsyncWaiter::VsyncWaiter(flutter::TaskRunners task_runners) : task_runners_(std::move(task_runners)) {} VsyncWaiter::~VsyncWaiter() = default; diff --git a/shell/common/vsync_waiter.h b/shell/common/vsync_waiter.h index afb7d3cd36b72..50fb6b275649e 100644 --- a/shell/common/vsync_waiter.h +++ b/shell/common/vsync_waiter.h @@ -36,9 +36,9 @@ class VsyncWaiter : public std::enable_shared_from_this { friend class VsyncWaiterAndroid; friend class VsyncWaiterEmbedder; - const blink::TaskRunners task_runners_; + const flutter::TaskRunners task_runners_; - VsyncWaiter(blink::TaskRunners task_runners); + VsyncWaiter(flutter::TaskRunners task_runners); // Implementations are meant to override this method and arm their vsync // latches when in response to this invocation. On vsync, they are meant to diff --git a/shell/common/vsync_waiter_fallback.cc b/shell/common/vsync_waiter_fallback.cc index 602770ba677ff..d8cbc6cdd4245 100644 --- a/shell/common/vsync_waiter_fallback.cc +++ b/shell/common/vsync_waiter_fallback.cc @@ -20,7 +20,7 @@ static fml::TimePoint SnapToNextTick(fml::TimePoint value, } // namespace -VsyncWaiterFallback::VsyncWaiterFallback(blink::TaskRunners task_runners) +VsyncWaiterFallback::VsyncWaiterFallback(flutter::TaskRunners task_runners) : VsyncWaiter(std::move(task_runners)), phase_(fml::TimePoint::Now()) {} VsyncWaiterFallback::~VsyncWaiterFallback() = default; diff --git a/shell/common/vsync_waiter_fallback.h b/shell/common/vsync_waiter_fallback.h index b3ab8db9f43f2..17ee2043e93c0 100644 --- a/shell/common/vsync_waiter_fallback.h +++ b/shell/common/vsync_waiter_fallback.h @@ -14,7 +14,7 @@ namespace shell { class VsyncWaiterFallback final : public VsyncWaiter { public: - VsyncWaiterFallback(blink::TaskRunners task_runners); + VsyncWaiterFallback(flutter::TaskRunners task_runners); ~VsyncWaiterFallback() override; diff --git a/shell/platform/android/android_shell_holder.cc b/shell/platform/android/android_shell_holder.cc index 06a3697da36ce..ca1dfd0ea7382 100644 --- a/shell/platform/android/android_shell_holder.cc +++ b/shell/platform/android/android_shell_holder.cc @@ -22,7 +22,7 @@ namespace shell { AndroidShellHolder::AndroidShellHolder( - blink::Settings settings, + flutter::Settings settings, fml::jni::JavaObjectWeakGlobalRef java_object, bool is_background_view) : settings_(std::move(settings)), java_object_(java_object) { @@ -94,11 +94,11 @@ AndroidShellHolder::AndroidShellHolder( ui_runner = thread_host_.ui_thread->GetTaskRunner(); io_runner = thread_host_.io_thread->GetTaskRunner(); } - blink::TaskRunners task_runners(thread_label, // label - platform_runner, // platform - gpu_runner, // gpu - ui_runner, // ui - io_runner // io + flutter::TaskRunners task_runners(thread_label, // label + platform_runner, // platform + gpu_runner, // gpu + ui_runner, // ui + io_runner // io ); shell_ = @@ -148,7 +148,7 @@ bool AndroidShellHolder::IsValid() const { return is_valid_; } -const blink::Settings& AndroidShellHolder::GetSettings() const { +const flutter::Settings& AndroidShellHolder::GetSettings() const { return settings_; } @@ -173,7 +173,7 @@ void AndroidShellHolder::Launch(RunConfiguration config) { } void AndroidShellHolder::SetViewportMetrics( - const blink::ViewportMetrics& metrics) { + const flutter::ViewportMetrics& metrics) { if (!IsValid()) { return; } @@ -187,7 +187,7 @@ void AndroidShellHolder::SetViewportMetrics( } void AndroidShellHolder::DispatchPointerDataPacket( - std::unique_ptr packet) { + std::unique_ptr packet) { if (!IsValid()) { return; } diff --git a/shell/platform/android/android_shell_holder.h b/shell/platform/android/android_shell_holder.h index d01cc5d43d5e4..5e33dbc9724d0 100644 --- a/shell/platform/android/android_shell_holder.h +++ b/shell/platform/android/android_shell_holder.h @@ -20,7 +20,7 @@ namespace shell { class AndroidShellHolder { public: - AndroidShellHolder(blink::Settings settings, + AndroidShellHolder(flutter::Settings settings, fml::jni::JavaObjectWeakGlobalRef java_object, bool is_background_view); @@ -30,22 +30,22 @@ class AndroidShellHolder { void Launch(RunConfiguration configuration); - void SetViewportMetrics(const blink::ViewportMetrics& metrics); + void SetViewportMetrics(const flutter::ViewportMetrics& metrics); void DispatchPointerDataPacket( - std::unique_ptr packet); + std::unique_ptr packet); - const blink::Settings& GetSettings() const; + const flutter::Settings& GetSettings() const; fml::WeakPtr GetPlatformView(); Rasterizer::Screenshot Screenshot(Rasterizer::ScreenshotType type, bool base64_encode); - void UpdateAssetManager(fml::RefPtr asset_manager); + void UpdateAssetManager(fml::RefPtr asset_manager); private: - const blink::Settings settings_; + const flutter::Settings settings_; const fml::jni::JavaObjectWeakGlobalRef java_object_; fml::WeakPtr platform_view_; ThreadHost thread_host_; diff --git a/shell/platform/android/apk_asset_provider.cc b/shell/platform/android/apk_asset_provider.cc index 446d8b4e57a4f..7ffbf2b45afb5 100644 --- a/shell/platform/android/apk_asset_provider.cc +++ b/shell/platform/android/apk_asset_provider.cc @@ -5,7 +5,7 @@ #include "flutter/fml/logging.h" #include "flutter/shell/platform/android/apk_asset_provider.h" -namespace blink { +namespace flutter { APKAssetProvider::APKAssetProvider(JNIEnv* env, jobject jassetManager, @@ -52,4 +52,4 @@ std::unique_ptr APKAssetProvider::GetAsMapping( return std::make_unique(asset); } -} // namespace blink +} // namespace flutter diff --git a/shell/platform/android/apk_asset_provider.h b/shell/platform/android/apk_asset_provider.h index be41a685ebfeb..6ff1e8da7b776 100644 --- a/shell/platform/android/apk_asset_provider.h +++ b/shell/platform/android/apk_asset_provider.h @@ -12,7 +12,7 @@ #include "flutter/fml/memory/ref_counted.h" #include "flutter/fml/platform/android/scoped_java_ref.h" -namespace blink { +namespace flutter { class APKAssetProvider final : public AssetResolver { public: @@ -26,16 +26,16 @@ class APKAssetProvider final : public AssetResolver { AAssetManager* assetManager_; const std::string directory_; - // |blink::AssetResolver| + // |flutter::AssetResolver| bool IsValid() const override; - // |blink::AssetResolver| + // |flutter::AssetResolver| std::unique_ptr GetAsMapping( const std::string& asset_name) const override; FML_DISALLOW_COPY_AND_ASSIGN(APKAssetProvider); }; -} // namespace blink +} // namespace flutter #endif // FLUTTER_ASSETS_APK_ASSET_PROVIDER_H diff --git a/shell/platform/android/flutter_main.cc b/shell/platform/android/flutter_main.cc index e02eae9faba7a..d1bdd20c01e48 100644 --- a/shell/platform/android/flutter_main.cc +++ b/shell/platform/android/flutter_main.cc @@ -33,7 +33,7 @@ extern const intptr_t kPlatformStrongDillSize; #endif } -FlutterMain::FlutterMain(blink::Settings settings) +FlutterMain::FlutterMain(flutter::Settings settings) : settings_(std::move(settings)) {} FlutterMain::~FlutterMain() = default; @@ -46,7 +46,7 @@ FlutterMain& FlutterMain::Get() { return *g_flutter_main; } -const blink::Settings& FlutterMain::GetSettings() const { +const flutter::Settings& FlutterMain::GetSettings() const { return settings_; } @@ -71,15 +71,15 @@ void FlutterMain::Init(JNIEnv* env, // Restore the callback cache. // TODO(chinmaygarde): Route all cache file access through FML and remove this // setter. - blink::DartCallbackCache::SetCachePath( + flutter::DartCallbackCache::SetCachePath( fml::jni::JavaStringToString(env, appStoragePath)); fml::paths::InitializeAndroidCachesPath( fml::jni::JavaStringToString(env, engineCachesPath)); - blink::DartCallbackCache::LoadCacheFromDisk(); + flutter::DartCallbackCache::LoadCacheFromDisk(); - if (!blink::DartVM::IsRunningPrecompiledCode()) { + if (!flutter::DartVM::IsRunningPrecompiledCode()) { // Check to see if the appropriate kernel files are present and configure // settings accordingly. auto application_kernel_path = @@ -121,7 +121,7 @@ static void RecordStartTimestamp(JNIEnv* env, jlong initTimeMillis) { int64_t initTimeMicros = static_cast(initTimeMillis) * static_cast(1000); - blink::engine_main_enter_ts = Dart_TimelineGetMicros() - initTimeMicros; + flutter::engine_main_enter_ts = Dart_TimelineGetMicros() - initTimeMicros; } bool FlutterMain::Register(JNIEnv* env) { diff --git a/shell/platform/android/flutter_main.h b/shell/platform/android/flutter_main.h index 4ce8e49658662..f40438dfae7fd 100644 --- a/shell/platform/android/flutter_main.h +++ b/shell/platform/android/flutter_main.h @@ -20,12 +20,12 @@ class FlutterMain { static FlutterMain& Get(); - const blink::Settings& GetSettings() const; + const flutter::Settings& GetSettings() const; private: - const blink::Settings settings_; + const flutter::Settings settings_; - FlutterMain(blink::Settings settings); + FlutterMain(flutter::Settings settings); static void Init(JNIEnv* env, jclass clazz, diff --git a/shell/platform/android/platform_message_response_android.cc b/shell/platform/android/platform_message_response_android.cc index eb88a6a5840bb..b204d6db60289 100644 --- a/shell/platform/android/platform_message_response_android.cc +++ b/shell/platform/android/platform_message_response_android.cc @@ -19,7 +19,7 @@ PlatformMessageResponseAndroid::PlatformMessageResponseAndroid( PlatformMessageResponseAndroid::~PlatformMessageResponseAndroid() = default; -// |blink::PlatformMessageResponse| +// |flutter::PlatformMessageResponse| void PlatformMessageResponseAndroid::Complete( std::unique_ptr data) { platform_task_runner_->PostTask( @@ -51,7 +51,7 @@ void PlatformMessageResponseAndroid::Complete( })); } -// |blink::PlatformMessageResponse| +// |flutter::PlatformMessageResponse| void PlatformMessageResponseAndroid::CompleteEmpty() { platform_task_runner_->PostTask( fml::MakeCopyable([response = response_id_, // diff --git a/shell/platform/android/platform_message_response_android.h b/shell/platform/android/platform_message_response_android.h index f3d79c1aa4faf..83e58bf47d9d0 100644 --- a/shell/platform/android/platform_message_response_android.h +++ b/shell/platform/android/platform_message_response_android.h @@ -12,12 +12,12 @@ namespace shell { -class PlatformMessageResponseAndroid : public blink::PlatformMessageResponse { +class PlatformMessageResponseAndroid : public flutter::PlatformMessageResponse { public: - // |blink::PlatformMessageResponse| + // |flutter::PlatformMessageResponse| void Complete(std::unique_ptr data) override; - // |blink::PlatformMessageResponse| + // |flutter::PlatformMessageResponse| void CompleteEmpty() override; private: diff --git a/shell/platform/android/platform_view_android.cc b/shell/platform/android/platform_view_android.cc index 4817133054071..11fb3c91b45a2 100644 --- a/shell/platform/android/platform_view_android.cc +++ b/shell/platform/android/platform_view_android.cc @@ -20,7 +20,7 @@ namespace shell { PlatformViewAndroid::PlatformViewAndroid( PlatformView::Delegate& delegate, - blink::TaskRunners task_runners, + flutter::TaskRunners task_runners, fml::jni::JavaObjectWeakGlobalRef java_object, bool use_software_rendering) : PlatformView(delegate, std::move(task_runners)), @@ -33,7 +33,7 @@ PlatformViewAndroid::PlatformViewAndroid( PlatformViewAndroid::PlatformViewAndroid( PlatformView::Delegate& delegate, - blink::TaskRunners task_runners, + flutter::TaskRunners task_runners, fml::jni::JavaObjectWeakGlobalRef java_object) : PlatformView(delegate, std::move(task_runners)), java_object_(java_object), @@ -99,29 +99,29 @@ void PlatformViewAndroid::DispatchPlatformMessage(JNIEnv* env, std::vector message = std::vector(message_data, message_data + java_message_position); - fml::RefPtr response; + fml::RefPtr response; if (response_id) { response = fml::MakeRefCounted( response_id, java_object_, task_runners_.GetPlatformTaskRunner()); } PlatformView::DispatchPlatformMessage( - fml::MakeRefCounted( + fml::MakeRefCounted( std::move(name), std::move(message), std::move(response))); } void PlatformViewAndroid::DispatchEmptyPlatformMessage(JNIEnv* env, std::string name, jint response_id) { - fml::RefPtr response; + fml::RefPtr response; if (response_id) { response = fml::MakeRefCounted( response_id, java_object_, task_runners_.GetPlatformTaskRunner()); } PlatformView::DispatchPlatformMessage( - fml::MakeRefCounted(std::move(name), - std::move(response))); + fml::MakeRefCounted(std::move(name), + std::move(response))); } void PlatformViewAndroid::InvokePlatformMessageResponseCallback( @@ -159,7 +159,7 @@ void PlatformViewAndroid::InvokePlatformMessageEmptyResponseCallback( // |shell::PlatformView| void PlatformViewAndroid::HandlePlatformMessage( - fml::RefPtr message) { + fml::RefPtr message) { JNIEnv* env = fml::jni::AttachCurrentThread(); fml::jni::ScopedJavaLocalRef view = java_object_.get(env); if (view.is_null()) @@ -210,7 +210,7 @@ void PlatformViewAndroid::DispatchSemanticsAction(JNIEnv* env, if (env->IsSameObject(args, NULL)) { std::vector args_vector; PlatformView::DispatchSemanticsAction( - id, static_cast(action), args_vector); + id, static_cast(action), args_vector); return; } @@ -219,13 +219,14 @@ void PlatformViewAndroid::DispatchSemanticsAction(JNIEnv* env, std::vector(args_data, args_data + args_position); PlatformView::DispatchSemanticsAction( - id, static_cast(action), std::move(args_vector)); + id, static_cast(action), + std::move(args_vector)); } // |shell::PlatformView| void PlatformViewAndroid::UpdateSemantics( - blink::SemanticsNodeUpdates update, - blink::CustomAccessibilityActionUpdates actions) { + flutter::SemanticsNodeUpdates update, + flutter::CustomAccessibilityActionUpdates actions) { constexpr size_t kBytesPerNode = 39 * sizeof(int32_t); constexpr size_t kBytesPerChild = sizeof(int32_t); constexpr size_t kBytesPerAction = 4 * sizeof(int32_t); @@ -256,7 +257,7 @@ void PlatformViewAndroid::UpdateSemantics( // If you edit this code, make sure you update kBytesPerNode // and/or kBytesPerChild above to match the number of values you are // sending. - const blink::SemanticsNode& node = value.second; + const flutter::SemanticsNode& node = value.second; buffer_int32[position++] = node.id; buffer_int32[position++] = node.flags; buffer_int32[position++] = node.actions; @@ -330,7 +331,7 @@ void PlatformViewAndroid::UpdateSemantics( // If you edit this code, make sure you update kBytesPerAction // to match the number of values you are // sending. - const blink::CustomAccessibilityAction& action = value.second; + const flutter::CustomAccessibilityAction& action = value.second; actions_buffer_int32[actions_position++] = action.id; actions_buffer_int32[actions_position++] = action.overrideId; if (action.label.empty()) { diff --git a/shell/platform/android/platform_view_android.h b/shell/platform/android/platform_view_android.h index c162ac5a2e8f3..34cd55dad8b2f 100644 --- a/shell/platform/android/platform_view_android.h +++ b/shell/platform/android/platform_view_android.h @@ -27,12 +27,12 @@ class PlatformViewAndroid final : public PlatformView { // Creates a PlatformViewAndroid with no rendering surface for use with // background execution. PlatformViewAndroid(PlatformView::Delegate& delegate, - blink::TaskRunners task_runners, + flutter::TaskRunners task_runners, fml::jni::JavaObjectWeakGlobalRef java_object); // Creates a PlatformViewAndroid with a rendering surface. PlatformViewAndroid(PlatformView::Delegate& delegate, - blink::TaskRunners task_runners, + flutter::TaskRunners task_runners, fml::jni::JavaObjectWeakGlobalRef java_object, bool use_software_rendering); @@ -78,17 +78,17 @@ class PlatformViewAndroid final : public PlatformView { const std::unique_ptr android_surface_; // We use id 0 to mean that no response is expected. int next_response_id_ = 1; - std::unordered_map> + std::unordered_map> pending_responses_; // |shell::PlatformView| void UpdateSemantics( - blink::SemanticsNodeUpdates update, - blink::CustomAccessibilityActionUpdates actions) override; + flutter::SemanticsNodeUpdates update, + flutter::CustomAccessibilityActionUpdates actions) override; // |shell::PlatformView| void HandlePlatformMessage( - fml::RefPtr message) override; + fml::RefPtr message) override; // |shell::PlatformView| void OnPreEngineRestart() const override; diff --git a/shell/platform/android/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index cbddd1b9f81f4..2e972c7ecd7c5 100644 --- a/shell/platform/android/platform_view_android_jni.cc +++ b/shell/platform/android/platform_view_android_jni.cc @@ -166,7 +166,7 @@ static void DestroyJNI(JNIEnv* env, jobject jcaller, jlong shell_holder) { static jstring GetObservatoryUri(JNIEnv* env, jclass clazz) { return env->NewStringUTF( - blink::DartServiceIsolate::GetObservatoryUri().c_str()); + flutter::DartServiceIsolate::GetObservatoryUri().c_str()); } static void SurfaceCreated(JNIEnv* env, @@ -196,8 +196,8 @@ static void SurfaceDestroyed(JNIEnv* env, jobject jcaller, jlong shell_holder) { } std::unique_ptr CreateIsolateConfiguration( - const blink::AssetManager& asset_manager) { - if (blink::DartVM::IsRunningPrecompiledCode()) { + const flutter::AssetManager& asset_manager) { + if (flutter::DartVM::IsRunningPrecompiledCode()) { return IsolateConfiguration::CreateForAppSnapshot(); } @@ -236,7 +236,7 @@ static void RunBundleAndSnapshotFromLibrary(JNIEnv* env, jstring jEntrypoint, jstring jLibraryUrl, jobject jAssetManager) { - auto asset_manager = std::make_shared(); + auto asset_manager = std::make_shared(); for (const auto& bundlepath : fml::jni::StringArrayToVector(env, jbundlepaths)) { if (bundlepath.empty()) { @@ -247,12 +247,12 @@ static void RunBundleAndSnapshotFromLibrary(JNIEnv* env, // bundle or a zip asset bundle. const auto file_ext_index = bundlepath.rfind("."); if (bundlepath.substr(file_ext_index) == ".zip") { - asset_manager->PushBack(std::make_unique( + asset_manager->PushBack(std::make_unique( bundlepath, "assets/flutter_assets")); } else { asset_manager->PushBack( - std::make_unique(fml::OpenDirectory( + std::make_unique(fml::OpenDirectory( bundlepath.c_str(), false, fml::FilePermission::kRead))); // Use the last path component of the bundle path to determine the @@ -262,7 +262,7 @@ static void RunBundleAndSnapshotFromLibrary(JNIEnv* env, auto apk_asset_dir = bundlepath.substr( last_slash_index + 1, bundlepath.size() - last_slash_index); - asset_manager->PushBack(std::make_unique( + asset_manager->PushBack(std::make_unique( env, // jni environment jAssetManager, // asset manager std::move(apk_asset_dir)) // apk asset dir @@ -299,7 +299,7 @@ static void RunBundleAndSnapshotFromLibrary(JNIEnv* env, static jobject LookupCallbackInformation(JNIEnv* env, /* unused */ jobject, jlong handle) { - auto cbInfo = blink::DartCallbackCache::GetCallbackInformation(handle); + auto cbInfo = flutter::DartCallbackCache::GetCallbackInformation(handle); if (cbInfo == nullptr) { return nullptr; } @@ -321,7 +321,7 @@ static void SetViewportMetrics(JNIEnv* env, jint physicalViewInsetRight, jint physicalViewInsetBottom, jint physicalViewInsetLeft) { - const blink::ViewportMetrics metrics{ + const flutter::ViewportMetrics metrics{ static_cast(devicePixelRatio), static_cast(physicalWidth), static_cast(physicalHeight), @@ -445,7 +445,7 @@ static void DispatchPointerDataPacket(JNIEnv* env, jobject buffer, jint position) { uint8_t* data = static_cast(env->GetDirectBufferAddress(buffer)); - auto packet = std::make_unique(data, position); + auto packet = std::make_unique(data, position); ANDROID_SHELL_HOLDER->DispatchPointerDataPacket(std::move(packet)); } diff --git a/shell/platform/android/vsync_waiter_android.cc b/shell/platform/android/vsync_waiter_android.cc index 854d2f21eb062..9a9d79f6727cb 100644 --- a/shell/platform/android/vsync_waiter_android.cc +++ b/shell/platform/android/vsync_waiter_android.cc @@ -19,7 +19,7 @@ namespace shell { static fml::jni::ScopedJavaGlobalRef* g_vsync_waiter_class = nullptr; static jmethodID g_async_wait_for_vsync_method_ = nullptr; -VsyncWaiterAndroid::VsyncWaiterAndroid(blink::TaskRunners task_runners) +VsyncWaiterAndroid::VsyncWaiterAndroid(flutter::TaskRunners task_runners) : VsyncWaiter(std::move(task_runners)) {} VsyncWaiterAndroid::~VsyncWaiterAndroid() = default; diff --git a/shell/platform/android/vsync_waiter_android.h b/shell/platform/android/vsync_waiter_android.h index 7f6f926418374..a3089cd074367 100644 --- a/shell/platform/android/vsync_waiter_android.h +++ b/shell/platform/android/vsync_waiter_android.h @@ -18,7 +18,7 @@ class VsyncWaiterAndroid final : public VsyncWaiter { public: static bool Register(JNIEnv* env); - VsyncWaiterAndroid(blink::TaskRunners task_runners); + VsyncWaiterAndroid(flutter::TaskRunners task_runners); ~VsyncWaiterAndroid() override; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache.mm b/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache.mm index 562155d319130..4e97b4e6d1d1f 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache.mm @@ -12,7 +12,7 @@ @implementation FlutterCallbackInformation @implementation FlutterCallbackCache + (FlutterCallbackInformation*)lookupCallbackInformation:(int64_t)handle { - auto info = blink::DartCallbackCache::GetCallbackInformation(handle); + auto info = flutter::DartCallbackCache::GetCallbackInformation(handle); if (info == nullptr) { return nil; } @@ -25,9 +25,9 @@ + (FlutterCallbackInformation*)lookupCallbackInformation:(int64_t)handle { + (void)setCachePath:(NSString*)path { assert(path != nil); - blink::DartCallbackCache::SetCachePath([path UTF8String]); + flutter::DartCallbackCache::SetCachePath([path UTF8String]); NSString* cache_path = - [NSString stringWithUTF8String:blink::DartCallbackCache::GetCachePath().c_str()]; + [NSString stringWithUTF8String:flutter::DartCallbackCache::GetCachePath().c_str()]; // Set the "Do Not Backup" flag to ensure that the cache isn't moved off disk in // low-memory situations. if (![[NSFileManager defaultManager] fileExistsAtPath:cache_path]) { diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index 4e0c97b3f113a..1af9fcdd9f171 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -25,7 +25,7 @@ static const char* kApplicationKernelSnapshotFileName = "kernel_blob.bin"; -static blink::Settings DefaultSettingsForProcess(NSBundle* bundle = nil) { +static flutter::Settings DefaultSettingsForProcess(NSBundle* bundle = nil) { auto command_line = shell::CommandLineFromNSProcessInfo(); // Precedence: @@ -66,7 +66,7 @@ } } - if (blink::DartVM::IsRunningPrecompiledCode()) { + if (flutter::DartVM::IsRunningPrecompiledCode()) { if (hasExplicitBundle) { NSString* executablePath = bundle.executablePath; if ([[NSFileManager defaultManager] fileExistsAtPath:executablePath]) { @@ -118,7 +118,7 @@ // Check if there is an application kernel snapshot in the assets directory we could // potentially use. Looking for the snapshot makes sense only if we have a VM that can use // it. - if (!blink::DartVM::IsRunningPrecompiledCode()) { + if (!flutter::DartVM::IsRunningPrecompiledCode()) { NSURL* applicationKernelSnapshotURL = [NSURL URLWithString:@(kApplicationKernelSnapshotFileName) relativeToURL:[NSURL fileURLWithPath:assetsPath]]; @@ -147,7 +147,7 @@ @implementation FlutterDartProject { fml::scoped_nsobject _precompiledDartBundle; - blink::Settings _settings; + flutter::Settings _settings; } #pragma mark - Override base class designated initializers @@ -171,7 +171,7 @@ - (instancetype)initWithPrecompiledDartBundle:(NSBundle*)bundle { #pragma mark - Settings accessors -- (const blink::Settings&)settings { +- (const flutter::Settings&)settings { return _settings; } diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h index 844c74d01ad34..3147b44ef8a45 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h @@ -11,7 +11,7 @@ @interface FlutterDartProject () -- (const blink::Settings&)settings; +- (const flutter::Settings&)settings; - (shell::RunConfiguration)runConfiguration; - (shell::RunConfiguration)runConfigurationForEntrypoint:(NSString*)entrypointOrNil; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm index 00fead7de304c..326b1867a3db7 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -110,7 +110,7 @@ - (void)dealloc { return _weakFactory->GetWeakPtr(); } -- (void)updateViewportMetrics:(blink::ViewportMetrics)viewportMetrics { +- (void)updateViewportMetrics:(flutter::ViewportMetrics)viewportMetrics { self.shell.GetTaskRunners().GetUITaskRunner()->PostTask( [engine = self.shell.GetEngine(), metrics = viewportMetrics]() { if (engine) { @@ -119,7 +119,7 @@ - (void)updateViewportMetrics:(blink::ViewportMetrics)viewportMetrics { }); } -- (void)dispatchPointerDataPacket:(std::unique_ptr)packet { +- (void)dispatchPointerDataPacket:(std::unique_ptr)packet { TRACE_EVENT0("flutter", "dispatchPointerDataPacket"); TRACE_FLOW_BEGIN("flutter", "PointerEvent", _nextPointerFlowId); self.shell.GetTaskRunners().GetUITaskRunner()->PostTask(fml::MakeCopyable( @@ -360,11 +360,11 @@ - (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI { // 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 - _threadHost.ui_thread->GetTaskRunner(), // ui - _threadHost.io_thread->GetTaskRunner() // io + flutter::TaskRunners task_runners(threadLabel.UTF8String, // label + fml::MessageLoop::GetCurrent().GetTaskRunner(), // platform + fml::MessageLoop::GetCurrent().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 @@ -373,11 +373,11 @@ - (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI { 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 + flutter::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 @@ -510,9 +510,9 @@ - (void)sendOnChannel:(NSString*)channel callback(reply); }, _shell->GetTaskRunners().GetPlatformTaskRunner()); - fml::RefPtr platformMessage = - (message == nil) ? fml::MakeRefCounted(channel.UTF8String, response) - : fml::MakeRefCounted( + fml::RefPtr platformMessage = + (message == nil) ? fml::MakeRefCounted(channel.UTF8String, response) + : fml::MakeRefCounted( channel.UTF8String, shell::GetVectorFromNSData(message), response); _shell->GetPlatformView()->DispatchPlatformMessage(platformMessage); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h index e21444cc6a9d8..f00f4dbd0161c 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h @@ -28,8 +28,8 @@ - (shell::Shell&)shell; -- (void)updateViewportMetrics:(blink::ViewportMetrics)viewportMetrics; -- (void)dispatchPointerDataPacket:(std::unique_ptr)packet; +- (void)updateViewportMetrics:(flutter::ViewportMetrics)viewportMetrics; +- (void)dispatchPointerDataPacket:(std::unique_ptr)packet; - (fml::RefPtr)platformTaskRunner; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm index c0add5502389c..4c86ec7b991f8 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm @@ -42,7 +42,7 @@ @implementation FlutterObservatoryPublisher { fml::scoped_nsobject _netService; #endif // TARGET_IPHONE_SIMULATOR - blink::DartServiceIsolate::CallbackHandle _callbackHandle; + flutter::DartServiceIsolate::CallbackHandle _callbackHandle; std::unique_ptr> _weakFactory; } @@ -54,7 +54,7 @@ - (instancetype)init { fml::MessageLoop::EnsureInitializedForCurrentThread(); - _callbackHandle = blink::DartServiceIsolate::AddServerStatusCallback( + _callbackHandle = flutter::DartServiceIsolate::AddServerStatusCallback( [weak = _weakFactory->GetWeakPtr(), runner = fml::MessageLoop::GetCurrent().GetTaskRunner()](const std::string& uri) { runner->PostTask([weak, uri]() { @@ -81,7 +81,7 @@ - (void)stopService { - (void)dealloc { [self stopService]; - blink::DartServiceIsolate::RemoveServerStatusCallback(std::move(_callbackHandle)); + flutter::DartServiceIsolate::RemoveServerStatusCallback(std::move(_callbackHandle)); [super dealloc]; } diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm b/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm index 70b54b0f29231..99f3ff7fab351 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm @@ -60,7 +60,7 @@ - (BOOL)application:(UIApplication*)application - (BOOL)application:(UIApplication*)application willFinishLaunchingWithOptions:(NSDictionary*)launchOptions { - blink::DartCallbackCache::LoadCacheFromDisk(); + flutter::DartCallbackCache::LoadCacheFromDisk(); for (id plugin in [_pluginDelegates allObjects]) { if (!plugin) { continue; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 9bcbcff388a47..bebfabbc7ee3c 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -35,7 +35,7 @@ @implementation FlutterViewController { fml::ScopedBlock _flutterViewRenderedCallback; UIInterfaceOrientationMask _orientationPreferences; UIStatusBarStyle _statusBarStyle; - blink::ViewportMetrics _viewportMetrics; + flutter::ViewportMetrics _viewportMetrics; BOOL _initialized; BOOL _viewOpaque; BOOL _engineNeedsLaunch; @@ -437,21 +437,21 @@ - (void)viewDidDisappear:(BOOL)animated { - (void)flushOngoingTouches { if (_ongoingTouches.count > 0) { - auto packet = std::make_unique(_ongoingTouches.count); + auto packet = std::make_unique(_ongoingTouches.count); size_t pointer_index = 0; // If the view controller is going away, we want to flush cancel all the ongoing // touches to the framework so nothing gets orphaned. for (NSNumber* device in _ongoingTouches) { // Create fake PointerData to balance out each previously started one for the framework. - blink::PointerData pointer_data; + flutter::PointerData pointer_data; pointer_data.Clear(); constexpr int kMicrosecondsPerSecond = 1000 * 1000; // Use current time. pointer_data.time_stamp = [[NSDate date] timeIntervalSince1970] * kMicrosecondsPerSecond; - pointer_data.change = blink::PointerData::Change::kCancel; - pointer_data.kind = blink::PointerData::DeviceKind::kTouch; + pointer_data.change = flutter::PointerData::Change::kCancel; + pointer_data.kind = flutter::PointerData::DeviceKind::kTouch; pointer_data.device = device.longLongValue; // Anything we put here will be arbitrary since there are no touches. @@ -501,38 +501,38 @@ - (void)applicationWillEnterForeground:(NSNotification*)notification { #pragma mark - Touch event handling -static blink::PointerData::Change PointerDataChangeFromUITouchPhase(UITouchPhase phase) { +static flutter::PointerData::Change PointerDataChangeFromUITouchPhase(UITouchPhase phase) { switch (phase) { case UITouchPhaseBegan: - return blink::PointerData::Change::kDown; + return flutter::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 blink::PointerData::Change::kMove; + return flutter::PointerData::Change::kMove; case UITouchPhaseEnded: - return blink::PointerData::Change::kUp; + return flutter::PointerData::Change::kUp; case UITouchPhaseCancelled: - return blink::PointerData::Change::kCancel; + return flutter::PointerData::Change::kCancel; } - return blink::PointerData::Change::kCancel; + return flutter::PointerData::Change::kCancel; } -static blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* touch) { +static flutter::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* touch) { if (@available(iOS 9, *)) { switch (touch.type) { case UITouchTypeDirect: case UITouchTypeIndirect: - return blink::PointerData::DeviceKind::kTouch; + return flutter::PointerData::DeviceKind::kTouch; case UITouchTypeStylus: - return blink::PointerData::DeviceKind::kStylus; + return flutter::PointerData::DeviceKind::kStylus; } } else { - return blink::PointerData::DeviceKind::kTouch; + return flutter::PointerData::DeviceKind::kTouch; } - return blink::PointerData::DeviceKind::kTouch; + return flutter::PointerData::DeviceKind::kTouch; } // Dispatches the UITouches to the engine. Usually, the type of change of the touch is determined @@ -540,16 +540,16 @@ - (void)applicationWillEnterForeground:(NSNotification*)notification { // 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 { + pointerDataChangeOverride:(flutter::PointerData::Change*)overridden_change { const CGFloat scale = [UIScreen mainScreen].scale; - auto packet = std::make_unique(touches.count); + auto packet = std::make_unique(touches.count); size_t pointer_index = 0; for (UITouch* touch in touches) { CGPoint windowCoordinates = [touch locationInView:self.view]; - blink::PointerData pointer_data; + flutter::PointerData pointer_data; pointer_data.Clear(); constexpr int kMicrosecondsPerSecond = 1000 * 1000; @@ -570,19 +570,19 @@ - (void)dispatchTouches:(NSSet*)touches // Track touches that began and not yet stopped so we can flush them // if the view controller goes away. switch (pointer_data.change) { - case blink::PointerData::Change::kDown: + case flutter::PointerData::Change::kDown: [_ongoingTouches addObject:deviceKey]; break; - case blink::PointerData::Change::kCancel: - case blink::PointerData::Change::kUp: + case flutter::PointerData::Change::kCancel: + case flutter::PointerData::Change::kUp: [_ongoingTouches removeObject:deviceKey]; break; - case blink::PointerData::Change::kHover: - case blink::PointerData::Change::kMove: + case flutter::PointerData::Change::kHover: + case flutter::PointerData::Change::kMove: // We're only tracking starts and stops. break; - case blink::PointerData::Change::kAdd: - case blink::PointerData::Change::kRemove: + case flutter::PointerData::Change::kAdd: + case flutter::PointerData::Change::kRemove: // We don't use kAdd/kRemove. break; } @@ -781,11 +781,11 @@ - (void)onAccessibilityStatusChanged:(NSNotification*)notification { auto platformView = [_engine.get() platformView]; int32_t flags = 0; if (UIAccessibilityIsInvertColorsEnabled()) - flags |= static_cast(blink::AccessibilityFeatureFlag::kInvertColors); + flags |= static_cast(flutter::AccessibilityFeatureFlag::kInvertColors); if (UIAccessibilityIsReduceMotionEnabled()) - flags |= static_cast(blink::AccessibilityFeatureFlag::kReduceMotion); + flags |= static_cast(flutter::AccessibilityFeatureFlag::kReduceMotion); if (UIAccessibilityIsBoldTextEnabled()) - flags |= static_cast(blink::AccessibilityFeatureFlag::kBoldText); + flags |= static_cast(flutter::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 @@ -795,7 +795,7 @@ - (void)onAccessibilityStatusChanged:(NSNotification*)notification { #else bool enabled = UIAccessibilityIsVoiceOverRunning() || UIAccessibilityIsSwitchControlRunning(); if (enabled) - flags |= static_cast(blink::AccessibilityFeatureFlag::kAccessibleNavigation); + flags |= static_cast(flutter::AccessibilityFeatureFlag::kAccessibleNavigation); platformView->SetSemanticsEnabled(enabled || UIAccessibilityIsSpeakScreenEnabled()); platformView->SetAccessibilityFeatures(flags); #endif @@ -954,9 +954,9 @@ - (void)handleStatusBarTouches:(UIEvent*)event { if (CGRectContainsPoint(statusBarFrame, screenLoc)) { NSSet* statusbarTouches = [NSSet setWithObject:touch]; - blink::PointerData::Change change = blink::PointerData::Change::kDown; + flutter::PointerData::Change change = flutter::PointerData::Change::kDown; [self dispatchTouches:statusbarTouches pointerDataChangeOverride:&change]; - change = blink::PointerData::Change::kUp; + change = flutter::PointerData::Change::kUp; [self dispatchTouches:statusbarTouches pointerDataChangeOverride:&change]; return; } diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h index f48064a258afd..c7f62b8890764 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h +++ b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h @@ -55,12 +55,12 @@ class AccessibilityBridge; /** * The semantics node used to produce this semantics object. */ -@property(nonatomic, readonly) blink::SemanticsNode node; +@property(nonatomic, readonly) flutter::SemanticsNode node; /** * Updates this semantics object using data from the `node` argument. */ -- (void)setSemanticsNode:(const blink::SemanticsNode*)node NS_REQUIRES_SUPER; +- (void)setSemanticsNode:(const flutter::SemanticsNode*)node NS_REQUIRES_SUPER; /** * Whether this semantics object has child semantics objects. @@ -78,7 +78,7 @@ class AccessibilityBridge; */ @property(strong, nonatomic) FlutterPlatformViewSemanticsContainer* platformViewSemanticsContainer; -- (BOOL)nodeWillCauseLayoutChange:(const blink::SemanticsNode*)node; +- (BOOL)nodeWillCauseLayoutChange:(const flutter::SemanticsNode*)node; #pragma mark - Designated initializers @@ -142,11 +142,11 @@ class AccessibilityBridge final { FlutterPlatformViewsController* platform_views_controller); ~AccessibilityBridge(); - void UpdateSemantics(blink::SemanticsNodeUpdates nodes, - blink::CustomAccessibilityActionUpdates actions); - void DispatchSemanticsAction(int32_t id, blink::SemanticsAction action); + void UpdateSemantics(flutter::SemanticsNodeUpdates nodes, + flutter::CustomAccessibilityActionUpdates actions); + void DispatchSemanticsAction(int32_t id, flutter::SemanticsAction action); void DispatchSemanticsAction(int32_t id, - blink::SemanticsAction action, + flutter::SemanticsAction action, std::vector args); UIView* textInputView(); @@ -162,7 +162,7 @@ class AccessibilityBridge final { void clearState(); private: - SemanticsObject* GetOrCreateObject(int32_t id, blink::SemanticsNodeUpdates& updates); + SemanticsObject* GetOrCreateObject(int32_t id, flutter::SemanticsNodeUpdates& updates); void VisitObjectsRecursivelyAndRemove(SemanticsObject* object, NSMutableArray* doomed_uids); void HandleEvent(NSDictionary* annotatedEvent); @@ -174,7 +174,7 @@ class AccessibilityBridge final { fml::scoped_nsprotocol accessibility_channel_; fml::WeakPtrFactory weak_factory_; int32_t previous_route_id_; - std::unordered_map actions_; + std::unordered_map actions_; std::vector previous_routes_; FML_DISALLOW_COPY_AND_ASSIGN(AccessibilityBridge); diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm index 39bfce29fb702..1c62c19eebe13 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm +++ b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm @@ -18,7 +18,7 @@ constexpr int32_t kRootNodeId = 0; -blink::SemanticsAction GetSemanticsActionForScrollDirection( +flutter::SemanticsAction GetSemanticsActionForScrollDirection( UIAccessibilityScrollDirection direction) { // To describe scroll direction, UIAccessibilityScrollDirection uses the direction the scroll bar // moves in and SemanticsAction uses the direction the finger moves in. Both move in opposite @@ -27,18 +27,18 @@ case UIAccessibilityScrollDirectionRight: case UIAccessibilityScrollDirectionPrevious: // TODO(abarth): Support RTL using // _node.textDirection. - return blink::SemanticsAction::kScrollLeft; + return flutter::SemanticsAction::kScrollLeft; case UIAccessibilityScrollDirectionLeft: case UIAccessibilityScrollDirectionNext: // TODO(abarth): Support RTL using // _node.textDirection. - return blink::SemanticsAction::kScrollRight; + return flutter::SemanticsAction::kScrollRight; case UIAccessibilityScrollDirectionUp: - return blink::SemanticsAction::kScrollDown; + return flutter::SemanticsAction::kScrollDown; case UIAccessibilityScrollDirectionDown: - return blink::SemanticsAction::kScrollUp; + return flutter::SemanticsAction::kScrollUp; } FML_DCHECK(false); // Unreachable - return blink::SemanticsAction::kScrollUp; + return flutter::SemanticsAction::kScrollUp; } } // namespace @@ -134,21 +134,21 @@ - (void)dealloc { #pragma mark - Semantic object methods -- (void)setSemanticsNode:(const blink::SemanticsNode*)node { +- (void)setSemanticsNode:(const flutter::SemanticsNode*)node { _node = *node; } /** * Whether calling `setSemanticsNode:` with `node` would cause a layout change. */ -- (BOOL)nodeWillCauseLayoutChange:(const blink::SemanticsNode*)node { +- (BOOL)nodeWillCauseLayoutChange:(const flutter::SemanticsNode*)node { return [self node].rect != node->rect || [self node].transform != node->transform; } /** * Whether calling `setSemanticsNode:` with `node` would cause a scroll event. */ -- (BOOL)nodeWillCauseScroll:(const blink::SemanticsNode*)node { +- (BOOL)nodeWillCauseScroll:(const flutter::SemanticsNode*)node { return !isnan([self node].scrollPosition) && !isnan(node->scrollPosition) && [self node].scrollPosition != node->scrollPosition; } @@ -168,17 +168,17 @@ - (BOOL)isAccessibilityElement { // entire element tree looking for such a hit. // We enforce in the framework that no other useful semantics are merged with these nodes. - if ([self node].HasFlag(blink::SemanticsFlags::kScopesRoute)) + if ([self node].HasFlag(flutter::SemanticsFlags::kScopesRoute)) return false; return ([self node].flags != 0 && - [self node].flags != static_cast(blink::SemanticsFlags::kIsHidden)) || + [self node].flags != static_cast(flutter::SemanticsFlags::kIsHidden)) || ![self node].label.empty() || ![self node].value.empty() || ![self node].hint.empty() || - ([self node].actions & ~blink::kScrollableSemanticsActions) != 0; + ([self node].actions & ~flutter::kScrollableSemanticsActions) != 0; } - (void)collectRoutes:(NSMutableArray*)edges { - if ([self node].HasFlag(blink::SemanticsFlags::kScopesRoute)) + if ([self node].HasFlag(flutter::SemanticsFlags::kScopesRoute)) [edges addObject:self]; if ([self hasChildren]) { for (SemanticsObject* child in self.children) { @@ -188,7 +188,7 @@ - (void)collectRoutes:(NSMutableArray*)edges { } - (BOOL)onCustomAccessibilityAction:(FlutterCustomAccessibilityAction*)action { - if (![self node].HasAction(blink::SemanticsAction::kCustomAction)) + if (![self node].HasAction(flutter::SemanticsAction::kCustomAction)) return NO; int32_t action_id = action.uid; std::vector args; @@ -197,14 +197,15 @@ - (BOOL)onCustomAccessibilityAction:(FlutterCustomAccessibilityAction*)action { args.push_back(action_id >> 8); args.push_back(action_id >> 16); args.push_back(action_id >> 24); - [self bridge] -> DispatchSemanticsAction([self uid], blink::SemanticsAction::kCustomAction, args); + [self bridge] -> DispatchSemanticsAction([self uid], flutter::SemanticsAction::kCustomAction, + args); return YES; } - (NSString*)routeName { // Returns the first non-null and non-empty semantic label of a child // with an NamesRoute flag. Otherwise returns nil. - if ([self node].HasFlag(blink::SemanticsFlags::kNamesRoute)) { + if ([self node].HasFlag(flutter::SemanticsFlags::kNamesRoute)) { NSString* newName = [self accessibilityLabel]; if (newName != nil && [newName length] > 0) { return newName; @@ -240,7 +241,7 @@ - (NSString*)accessibilityValue { } - (CGRect)accessibilityFrame { - if ([self node].HasFlag(blink::SemanticsFlags::kIsHidden)) { + if ([self node].HasFlag(flutter::SemanticsFlags::kIsHidden)) { return [super accessibilityFrame]; } return [self globalRect]; @@ -292,28 +293,28 @@ - (id)accessibilityContainer { #pragma mark - UIAccessibilityAction overrides - (BOOL)accessibilityActivate { - if (![self node].HasAction(blink::SemanticsAction::kTap)) + if (![self node].HasAction(flutter::SemanticsAction::kTap)) return NO; - [self bridge] -> DispatchSemanticsAction([self uid], blink::SemanticsAction::kTap); + [self bridge] -> DispatchSemanticsAction([self uid], flutter::SemanticsAction::kTap); return YES; } - (void)accessibilityIncrement { - if ([self node].HasAction(blink::SemanticsAction::kIncrease)) { + if ([self node].HasAction(flutter::SemanticsAction::kIncrease)) { [self node].value = [self node].increasedValue; - [self bridge] -> DispatchSemanticsAction([self uid], blink::SemanticsAction::kIncrease); + [self bridge] -> DispatchSemanticsAction([self uid], flutter::SemanticsAction::kIncrease); } } - (void)accessibilityDecrement { - if ([self node].HasAction(blink::SemanticsAction::kDecrease)) { + if ([self node].HasAction(flutter::SemanticsAction::kDecrease)) { [self node].value = [self node].decreasedValue; - [self bridge] -> DispatchSemanticsAction([self uid], blink::SemanticsAction::kDecrease); + [self bridge] -> DispatchSemanticsAction([self uid], flutter::SemanticsAction::kDecrease); } } - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { - blink::SemanticsAction action = GetSemanticsActionForScrollDirection(direction); + flutter::SemanticsAction action = GetSemanticsActionForScrollDirection(direction); if (![self node].HasAction(action)) return NO; [self bridge] -> DispatchSemanticsAction([self uid], action); @@ -321,28 +322,28 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { } - (BOOL)accessibilityPerformEscape { - if (![self node].HasAction(blink::SemanticsAction::kDismiss)) + if (![self node].HasAction(flutter::SemanticsAction::kDismiss)) return NO; - [self bridge] -> DispatchSemanticsAction([self uid], blink::SemanticsAction::kDismiss); + [self bridge] -> DispatchSemanticsAction([self uid], flutter::SemanticsAction::kDismiss); return YES; } #pragma mark UIAccessibilityFocus overrides - (void)accessibilityElementDidBecomeFocused { - if ([self node].HasFlag(blink::SemanticsFlags::kIsHidden)) { - [self bridge] -> DispatchSemanticsAction([self uid], blink::SemanticsAction::kShowOnScreen); + if ([self node].HasFlag(flutter::SemanticsFlags::kIsHidden)) { + [self bridge] -> DispatchSemanticsAction([self uid], flutter::SemanticsAction::kShowOnScreen); } - if ([self node].HasAction(blink::SemanticsAction::kDidGainAccessibilityFocus)) { + if ([self node].HasAction(flutter::SemanticsAction::kDidGainAccessibilityFocus)) { [self bridge] -> DispatchSemanticsAction([self uid], - blink::SemanticsAction::kDidGainAccessibilityFocus); + flutter::SemanticsAction::kDidGainAccessibilityFocus); } } - (void)accessibilityElementDidLoseFocus { - if ([self node].HasAction(blink::SemanticsAction::kDidLoseAccessibilityFocus)) { + if ([self node].HasAction(flutter::SemanticsAction::kDidLoseAccessibilityFocus)) { [self bridge] -> DispatchSemanticsAction([self uid], - blink::SemanticsAction::kDidLoseAccessibilityFocus); + flutter::SemanticsAction::kDidLoseAccessibilityFocus); } } @@ -371,30 +372,30 @@ - (instancetype)initWithBridge:(fml::WeakPtr)bridge - (UIAccessibilityTraits)accessibilityTraits { UIAccessibilityTraits traits = UIAccessibilityTraitNone; - if ([self node].HasAction(blink::SemanticsAction::kIncrease) || - [self node].HasAction(blink::SemanticsAction::kDecrease)) { + if ([self node].HasAction(flutter::SemanticsAction::kIncrease) || + [self node].HasAction(flutter::SemanticsAction::kDecrease)) { traits |= UIAccessibilityTraitAdjustable; } // TODO(jonahwilliams): switches should have a value of "on" or "off" - if ([self node].HasFlag(blink::SemanticsFlags::kIsSelected) || - [self node].HasFlag(blink::SemanticsFlags::kIsToggled) || - [self node].HasFlag(blink::SemanticsFlags::kIsChecked)) { + if ([self node].HasFlag(flutter::SemanticsFlags::kIsSelected) || + [self node].HasFlag(flutter::SemanticsFlags::kIsToggled) || + [self node].HasFlag(flutter::SemanticsFlags::kIsChecked)) { traits |= UIAccessibilityTraitSelected; } - if ([self node].HasFlag(blink::SemanticsFlags::kIsButton)) { + if ([self node].HasFlag(flutter::SemanticsFlags::kIsButton)) { traits |= UIAccessibilityTraitButton; } - if ([self node].HasFlag(blink::SemanticsFlags::kHasEnabledState) && - ![self node].HasFlag(blink::SemanticsFlags::kIsEnabled)) { + if ([self node].HasFlag(flutter::SemanticsFlags::kHasEnabledState) && + ![self node].HasFlag(flutter::SemanticsFlags::kIsEnabled)) { traits |= UIAccessibilityTraitNotEnabled; } - if ([self node].HasFlag(blink::SemanticsFlags::kIsHeader)) { + if ([self node].HasFlag(flutter::SemanticsFlags::kIsHeader)) { traits |= UIAccessibilityTraitHeader; } - if ([self node].HasFlag(blink::SemanticsFlags::kIsImage)) { + if ([self node].HasFlag(flutter::SemanticsFlags::kIsImage)) { traits |= UIAccessibilityTraitImage; } - if ([self node].HasFlag(blink::SemanticsFlags::kIsLiveRegion)) { + if ([self node].HasFlag(flutter::SemanticsFlags::kIsLiveRegion)) { traits |= UIAccessibilityTraitUpdatesFrequently; } return traits; @@ -559,16 +560,16 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { return [platform_view_->GetTextInputPlugin() textInputView]; } -void AccessibilityBridge::UpdateSemantics(blink::SemanticsNodeUpdates nodes, - blink::CustomAccessibilityActionUpdates actions) { +void AccessibilityBridge::UpdateSemantics(flutter::SemanticsNodeUpdates nodes, + flutter::CustomAccessibilityActionUpdates actions) { BOOL layoutChanged = NO; BOOL scrollOccured = NO; for (const auto& entry : actions) { - const blink::CustomAccessibilityAction& action = entry.second; + const flutter::CustomAccessibilityAction& action = entry.second; actions_[action.id] = action; } for (const auto& entry : nodes) { - const blink::SemanticsNode& node = entry.second; + const flutter::SemanticsNode& node = entry.second; SemanticsObject* object = GetOrCreateObject(node.id, nodes); layoutChanged = layoutChanged || [object nodeWillCauseLayoutChange:&node]; scrollOccured = scrollOccured || [object nodeWillCauseScroll:&node]; @@ -586,7 +587,7 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { NSMutableArray* accessibilityCustomActions = [[[NSMutableArray alloc] init] autorelease]; for (int32_t action_id : node.customAccessibilityActions) { - blink::CustomAccessibilityAction& action = actions_[action_id]; + flutter::CustomAccessibilityAction& action = actions_[action_id]; if (action.overrideId != -1) { // iOS does not support overriding standard actions, so we ignore any // custom actions that have an override id provided. @@ -672,24 +673,24 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { } } -void AccessibilityBridge::DispatchSemanticsAction(int32_t uid, blink::SemanticsAction action) { +void AccessibilityBridge::DispatchSemanticsAction(int32_t uid, flutter::SemanticsAction action) { std::vector args; platform_view_->DispatchSemanticsAction(uid, action, args); } void AccessibilityBridge::DispatchSemanticsAction(int32_t uid, - blink::SemanticsAction action, + flutter::SemanticsAction action, std::vector args) { platform_view_->DispatchSemanticsAction(uid, action, args); } SemanticsObject* AccessibilityBridge::GetOrCreateObject(int32_t uid, - blink::SemanticsNodeUpdates& updates) { + flutter::SemanticsNodeUpdates& updates) { SemanticsObject* object = objects_.get()[@(uid)]; if (!object) { // New node case: simply create a new SemanticsObject. - blink::SemanticsNode node = updates[uid]; - if (node.HasFlag(blink::SemanticsFlags::kIsTextField)) { + flutter::SemanticsNode node = updates[uid]; + if (node.HasFlag(flutter::SemanticsFlags::kIsTextField)) { // Text fields are backed by objects that implement UITextInput. object = [[[TextInputSemanticsObject alloc] initWithBridge:GetWeakPtr() uid:uid] autorelease]; } else { @@ -702,9 +703,9 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { auto nodeEntry = updates.find(object.node.id); if (nodeEntry != updates.end()) { // There's an update for this node - blink::SemanticsNode node = nodeEntry->second; - BOOL isTextField = node.HasFlag(blink::SemanticsFlags::kIsTextField); - BOOL wasTextField = object.node.HasFlag(blink::SemanticsFlags::kIsTextField); + flutter::SemanticsNode node = nodeEntry->second; + BOOL isTextField = node.HasFlag(flutter::SemanticsFlags::kIsTextField); + BOOL wasTextField = object.node.HasFlag(flutter::SemanticsFlags::kIsTextField); if (wasTextField != isTextField) { // The node changed its type from text field to something else, or vice versa. In this // case, we cannot reuse the existing SemanticsObject implementation. Instead, we replace 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 0edde04a2c2c1..35e50e1a13f7d 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.mm +++ b/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.mm @@ -186,10 +186,10 @@ - (void)dealloc { #pragma mark - SemanticsObject overrides -- (void)setSemanticsNode:(const blink::SemanticsNode*)node { +- (void)setSemanticsNode:(const flutter::SemanticsNode*)node { [super setSemanticsNode:node]; _inactive_text_input.text = @(node->value.data()); - if ([self node].HasFlag(blink::SemanticsFlags::kIsFocused)) { + if ([self node].HasFlag(flutter::SemanticsFlags::kIsFocused)) { // The text input view must have a non-trivial size for the accessibility // system to send text editing events. [self bridge] -> textInputView().frame = CGRectMake(0.0, 0.0, 1.0, 1.0); @@ -207,7 +207,7 @@ - (void)setSemanticsNode:(const blink::SemanticsNode*)node { * we use an FlutterInactiveTextInput. */ - (UIView*)textInputSurrogate { - if ([self node].HasFlag(blink::SemanticsFlags::kIsFocused)) { + if ([self node].HasFlag(flutter::SemanticsFlags::kIsFocused)) { return [self bridge] -> textInputView(); } else { return _inactive_text_input; @@ -229,7 +229,7 @@ - (void)accessibilityElementDidLoseFocus { } - (BOOL)accessibilityElementIsFocused { - return [self node].HasFlag(blink::SemanticsFlags::kIsFocused); + return [self node].HasFlag(flutter::SemanticsFlags::kIsFocused); } - (BOOL)accessibilityActivate { 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 ee6b929bc9843..75660e3744976 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 @@ -18,7 +18,7 @@ typedef void (^PlatformMessageResponseCallback)(NSData*); namespace shell { -class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse { +class PlatformMessageResponseDarwin : public flutter::PlatformMessageResponse { public: void Complete(std::unique_ptr data) override; 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 1949d817d888d..d9c4cc2af7909 100644 --- a/shell/platform/darwin/ios/framework/Source/platform_message_router.h +++ b/shell/platform/darwin/ios/framework/Source/platform_message_router.h @@ -19,7 +19,8 @@ class PlatformMessageRouter { PlatformMessageRouter(); ~PlatformMessageRouter(); - void HandlePlatformMessage(fml::RefPtr message) const; + void HandlePlatformMessage( + fml::RefPtr message) const; void SetMessageHandler(const std::string& channel, FlutterBinaryMessageHandler handler); 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 6cfb3049ac63a..997a96ce8d79e 100644 --- a/shell/platform/darwin/ios/framework/Source/platform_message_router.mm +++ b/shell/platform/darwin/ios/framework/Source/platform_message_router.mm @@ -15,8 +15,8 @@ PlatformMessageRouter::~PlatformMessageRouter() = default; void PlatformMessageRouter::HandlePlatformMessage( - fml::RefPtr message) const { - fml::RefPtr completer = message->response(); + fml::RefPtr message) const { + fml::RefPtr completer = message->response(); auto it = message_handlers_.find(message->channel()); if (it != message_handlers_.end()) { FlutterBinaryMessageHandler handler = it->second; 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 335d47892ae81..81dbe8d737cea 100644 --- a/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h +++ b/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h @@ -16,7 +16,7 @@ namespace shell { class VsyncWaiterIOS final : public VsyncWaiter { public: - VsyncWaiterIOS(blink::TaskRunners task_runners); + VsyncWaiterIOS(flutter::TaskRunners task_runners); ~VsyncWaiterIOS() override; 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 702fdc9a51e13..4f1486eeb897c 100644 --- a/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm +++ b/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm @@ -27,7 +27,7 @@ - (void)invalidate; namespace shell { -VsyncWaiterIOS::VsyncWaiterIOS(blink::TaskRunners task_runners) +VsyncWaiterIOS::VsyncWaiterIOS(flutter::TaskRunners task_runners) : VsyncWaiter(std::move(task_runners)), client_([[VSyncClient alloc] initWithTaskRunner:task_runners_.GetUITaskRunner() callback:std::bind(&VsyncWaiterIOS::FireCallback, diff --git a/shell/platform/darwin/ios/platform_view_ios.h b/shell/platform/darwin/ios/platform_view_ios.h index b38a72b653d33..1b13055ee14b3 100644 --- a/shell/platform/darwin/ios/platform_view_ios.h +++ b/shell/platform/darwin/ios/platform_view_ios.h @@ -26,7 +26,7 @@ namespace shell { class PlatformViewIOS final : public PlatformView { public: - explicit PlatformViewIOS(PlatformView::Delegate& delegate, blink::TaskRunners task_runners); + explicit PlatformViewIOS(PlatformView::Delegate& delegate, flutter::TaskRunners task_runners); ~PlatformViewIOS() override; @@ -54,7 +54,7 @@ class PlatformViewIOS final : public PlatformView { fml::closure firstFrameCallback_; // |shell::PlatformView| - void HandlePlatformMessage(fml::RefPtr message) override; + void HandlePlatformMessage(fml::RefPtr message) override; // |shell::PlatformView| std::unique_ptr CreateRenderingSurface() override; @@ -66,8 +66,8 @@ class PlatformViewIOS final : public PlatformView { void SetAccessibilityFeatures(int32_t flags) override; // |shell::PlatformView| - void UpdateSemantics(blink::SemanticsNodeUpdates update, - blink::CustomAccessibilityActionUpdates actions) override; + void UpdateSemantics(flutter::SemanticsNodeUpdates update, + flutter::CustomAccessibilityActionUpdates actions) override; // |shell::PlatformView| std::unique_ptr CreateVSyncWaiter() override; diff --git a/shell/platform/darwin/ios/platform_view_ios.mm b/shell/platform/darwin/ios/platform_view_ios.mm index b6e94649e3cc0..d2a24ffce0725 100644 --- a/shell/platform/darwin/ios/platform_view_ios.mm +++ b/shell/platform/darwin/ios/platform_view_ios.mm @@ -19,7 +19,8 @@ namespace shell { -PlatformViewIOS::PlatformViewIOS(PlatformView::Delegate& delegate, blink::TaskRunners task_runners) +PlatformViewIOS::PlatformViewIOS(PlatformView::Delegate& delegate, + flutter::TaskRunners task_runners) : PlatformView(delegate, std::move(task_runners)) { #if !TARGET_IPHONE_SIMULATOR gl_context_ = std::make_shared(); @@ -33,7 +34,7 @@ } // |shell::PlatformView| -void PlatformViewIOS::HandlePlatformMessage(fml::RefPtr message) { +void PlatformViewIOS::HandlePlatformMessage(fml::RefPtr message) { platform_message_router_.HandlePlatformMessage(std::move(message)); } @@ -116,8 +117,8 @@ new AccessibilityBridge(static_cast(owner_controller_.get().view), } // |shell::PlatformView| -void PlatformViewIOS::UpdateSemantics(blink::SemanticsNodeUpdates update, - blink::CustomAccessibilityActionUpdates actions) { +void PlatformViewIOS::UpdateSemantics(flutter::SemanticsNodeUpdates update, + flutter::CustomAccessibilityActionUpdates actions) { FML_DCHECK(owner_controller_); if (accessibility_bridge_) { accessibility_bridge_->UpdateSemantics(std::move(update), std::move(actions)); diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 1683d10bfe8a7..ba48329a49c37 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -258,11 +258,11 @@ InferPlatformViewCreationCallback( } struct _FlutterPlatformMessageResponseHandle { - fml::RefPtr message; + fml::RefPtr message; }; void PopulateSnapshotMappingCallbacks(const FlutterProjectArgs* args, - blink::Settings& settings) { + flutter::Settings& settings) { // There are no ownership concerns here as all mappings are owned by the // embedder and not the engine. auto make_mapping_callback = [](const uint8_t* mapping, size_t size) { @@ -271,7 +271,7 @@ void PopulateSnapshotMappingCallbacks(const FlutterProjectArgs* args, }; }; - if (blink::DartVM::IsRunningPrecompiledCode()) { + if (flutter::DartVM::IsRunningPrecompiledCode()) { if (SAFE_ACCESS(args, vm_snapshot_data_size, 0) != 0 && SAFE_ACCESS(args, vm_snapshot_data, nullptr) != nullptr) { settings.vm_snapshot_data = make_mapping_callback( @@ -363,14 +363,14 @@ FlutterEngineResult FlutterEngineRun(size_t version, SAFE_ACCESS(args, command_line_argv, nullptr)); } - blink::Settings settings = shell::SettingsFromCommandLine(command_line); + flutter::Settings settings = shell::SettingsFromCommandLine(command_line); PopulateSnapshotMappingCallbacks(args, settings); settings.icu_data_path = icu_data_path; settings.assets_path = args->assets_path; - if (!blink::DartVM::IsRunningPrecompiledCode()) { + if (!flutter::DartVM::IsRunningPrecompiledCode()) { // Verify the assets path contains Dart 2 kernel assets. const std::string kApplicationKernelSnapshotFileName = "kernel_blob.bin"; std::string application_kernel_path = fml::paths::JoinPaths( @@ -402,7 +402,7 @@ FlutterEngineResult FlutterEngineRun(size_t version, if (SAFE_ACCESS(args, update_semantics_node_callback, nullptr) != nullptr) { update_semantics_nodes_callback = [ptr = args->update_semantics_node_callback, - user_data](blink::SemanticsNodeUpdates update) { + user_data](flutter::SemanticsNodeUpdates update) { for (const auto& value : update) { const auto& node = value.second; SkMatrix transform = static_cast(node.transform); @@ -461,7 +461,7 @@ FlutterEngineResult FlutterEngineRun(size_t version, nullptr) { update_semantics_custom_actions_callback = [ptr = args->update_semantics_custom_action_callback, - user_data](blink::CustomAccessibilityActionUpdates actions) { + user_data](flutter::CustomAccessibilityActionUpdates actions) { for (const auto& value : actions) { const auto& action = value.second; const FlutterSemanticsCustomAction embedder_action = { @@ -486,7 +486,7 @@ FlutterEngineResult FlutterEngineRun(size_t version, if (SAFE_ACCESS(args, platform_message_callback, nullptr) != nullptr) { platform_message_response_callback = [ptr = args->platform_message_callback, - user_data](fml::RefPtr message) { + user_data](fml::RefPtr message) { auto handle = new FlutterPlatformMessageResponseHandle(); const FlutterPlatformMessage incoming_message = { sizeof(FlutterPlatformMessage), // struct_size @@ -624,11 +624,11 @@ FlutterEngineResult FlutterEngineRun(size_t version, } run_configuration.AddAssetResolver( - std::make_unique( + std::make_unique( fml::Duplicate(settings.assets_dir))); run_configuration.AddAssetResolver( - std::make_unique(fml::OpenDirectory( + std::make_unique(fml::OpenDirectory( settings.assets_path.c_str(), false, fml::FilePermission::kRead))); if (!run_configuration.IsValid()) { return LOG_EMBEDDER_ERROR(kInvalidArguments); @@ -660,7 +660,7 @@ FlutterEngineResult FlutterEngineSendWindowMetricsEvent( return LOG_EMBEDDER_ERROR(kInvalidArguments); } - blink::ViewportMetrics metrics; + flutter::ViewportMetrics metrics; metrics.physical_width = SAFE_ACCESS(flutter_metrics, width, 0.0); metrics.physical_height = SAFE_ACCESS(flutter_metrics, height, 0.0); @@ -672,39 +672,39 @@ FlutterEngineResult FlutterEngineSendWindowMetricsEvent( : LOG_EMBEDDER_ERROR(kInvalidArguments); } -// Returns the blink::PointerData::Change for the given FlutterPointerPhase. -inline blink::PointerData::Change ToPointerDataChange( +// Returns the flutter::PointerData::Change for the given FlutterPointerPhase. +inline flutter::PointerData::Change ToPointerDataChange( FlutterPointerPhase phase) { switch (phase) { case kCancel: - return blink::PointerData::Change::kCancel; + return flutter::PointerData::Change::kCancel; case kUp: - return blink::PointerData::Change::kUp; + return flutter::PointerData::Change::kUp; case kDown: - return blink::PointerData::Change::kDown; + return flutter::PointerData::Change::kDown; case kMove: - return blink::PointerData::Change::kMove; + return flutter::PointerData::Change::kMove; case kAdd: - return blink::PointerData::Change::kAdd; + return flutter::PointerData::Change::kAdd; case kRemove: - return blink::PointerData::Change::kRemove; + return flutter::PointerData::Change::kRemove; case kHover: - return blink::PointerData::Change::kHover; + return flutter::PointerData::Change::kHover; } - return blink::PointerData::Change::kCancel; + return flutter::PointerData::Change::kCancel; } -// Returns the blink::PointerData::SignalKind for the given +// Returns the flutter::PointerData::SignalKind for the given // FlutterPointerSignaKind. -inline blink::PointerData::SignalKind ToPointerDataSignalKind( +inline flutter::PointerData::SignalKind ToPointerDataSignalKind( FlutterPointerSignalKind kind) { switch (kind) { case kFlutterPointerSignalKindNone: - return blink::PointerData::SignalKind::kNone; + return flutter::PointerData::SignalKind::kNone; case kFlutterPointerSignalKindScroll: - return blink::PointerData::SignalKind::kScroll; + return flutter::PointerData::SignalKind::kScroll; } - return blink::PointerData::SignalKind::kNone; + return flutter::PointerData::SignalKind::kNone; } FlutterEngineResult FlutterEngineSendPointerEvent( @@ -715,17 +715,17 @@ FlutterEngineResult FlutterEngineSendPointerEvent( return LOG_EMBEDDER_ERROR(kInvalidArguments); } - auto packet = std::make_unique(events_count); + auto packet = std::make_unique(events_count); const FlutterPointerEvent* current = pointers; for (size_t i = 0; i < events_count; ++i) { - blink::PointerData pointer_data; + flutter::PointerData pointer_data; pointer_data.Clear(); pointer_data.time_stamp = SAFE_ACCESS(current, timestamp, 0); pointer_data.change = ToPointerDataChange( SAFE_ACCESS(current, phase, FlutterPointerPhase::kCancel)); - pointer_data.kind = blink::PointerData::DeviceKind::kMouse; + pointer_data.kind = flutter::PointerData::DeviceKind::kMouse; pointer_data.physical_x = SAFE_ACCESS(current, x, 0.0); pointer_data.physical_y = SAFE_ACCESS(current, y, 0.0); pointer_data.device = SAFE_ACCESS(current, device, 0); @@ -756,7 +756,7 @@ FlutterEngineResult FlutterEngineSendPlatformMessage( return LOG_EMBEDDER_ERROR(kInvalidArguments); } - auto message = fml::MakeRefCounted( + auto message = fml::MakeRefCounted( flutter_message->channel, std::vector( flutter_message->message, @@ -872,7 +872,7 @@ FlutterEngineResult FlutterEngineDispatchSemanticsAction( if (engine == nullptr) { return LOG_EMBEDDER_ERROR(kInvalidArguments); } - auto engine_action = static_cast(action); + auto engine_action = static_cast(action); if (!reinterpret_cast(engine) ->DispatchSemanticsAction( id, engine_action, diff --git a/shell/platform/embedder/embedder_engine.cc b/shell/platform/embedder/embedder_engine.cc index 836dfc645c1a7..ad48b52802a1c 100644 --- a/shell/platform/embedder/embedder_engine.cc +++ b/shell/platform/embedder/embedder_engine.cc @@ -11,8 +11,8 @@ namespace shell { EmbedderEngine::EmbedderEngine( std::unique_ptr thread_host, - blink::TaskRunners task_runners, - blink::Settings settings, + flutter::TaskRunners task_runners, + flutter::Settings settings, Shell::CreateCallback on_create_platform_view, Shell::CreateCallback on_create_rasterizer, EmbedderExternalTextureGL::ExternalTextureCallback @@ -74,7 +74,7 @@ bool EmbedderEngine::Run(RunConfiguration run_configuration) { return true; } -bool EmbedderEngine::SetViewportMetrics(blink::ViewportMetrics metrics) { +bool EmbedderEngine::SetViewportMetrics(flutter::ViewportMetrics metrics) { if (!IsValid()) { return false; } @@ -89,7 +89,7 @@ bool EmbedderEngine::SetViewportMetrics(blink::ViewportMetrics metrics) { } bool EmbedderEngine::DispatchPointerDataPacket( - std::unique_ptr packet) { + std::unique_ptr packet) { if (!IsValid() || !packet) { return false; } @@ -110,7 +110,7 @@ bool EmbedderEngine::DispatchPointerDataPacket( } bool EmbedderEngine::SendPlatformMessage( - fml::RefPtr message) { + fml::RefPtr message) { if (!IsValid() || !message) { return false; } @@ -178,7 +178,7 @@ bool EmbedderEngine::SetAccessibilityFeatures(int32_t flags) { } bool EmbedderEngine::DispatchSemanticsAction(int id, - blink::SemanticsAction action, + flutter::SemanticsAction action, std::vector args) { if (!IsValid()) { return false; diff --git a/shell/platform/embedder/embedder_engine.h b/shell/platform/embedder/embedder_engine.h index bd2ff92d16d8b..c6ea8d55ea9c2 100644 --- a/shell/platform/embedder/embedder_engine.h +++ b/shell/platform/embedder/embedder_engine.h @@ -23,8 +23,8 @@ namespace shell { class EmbedderEngine { public: EmbedderEngine(std::unique_ptr thread_host, - blink::TaskRunners task_runners, - blink::Settings settings, + flutter::TaskRunners task_runners, + flutter::Settings settings, Shell::CreateCallback on_create_platform_view, Shell::CreateCallback on_create_rasterizer, EmbedderExternalTextureGL::ExternalTextureCallback @@ -40,12 +40,12 @@ class EmbedderEngine { bool IsValid() const; - bool SetViewportMetrics(blink::ViewportMetrics metrics); + bool SetViewportMetrics(flutter::ViewportMetrics metrics); bool DispatchPointerDataPacket( - std::unique_ptr packet); + std::unique_ptr packet); - bool SendPlatformMessage(fml::RefPtr message); + bool SendPlatformMessage(fml::RefPtr message); bool RegisterTexture(int64_t texture); @@ -58,7 +58,7 @@ class EmbedderEngine { bool SetAccessibilityFeatures(int32_t flags); bool DispatchSemanticsAction(int id, - blink::SemanticsAction action, + flutter::SemanticsAction action, std::vector args); bool OnVsyncEvent(intptr_t baton, diff --git a/shell/platform/embedder/embedder_thread_host.cc b/shell/platform/embedder/embedder_thread_host.cc index 925b596d8a18d..8cf8515914be1 100644 --- a/shell/platform/embedder/embedder_thread_host.cc +++ b/shell/platform/embedder/embedder_thread_host.cc @@ -108,7 +108,7 @@ EmbedderThreadHost::CreateEmbedderManagedThreadHost( ThreadHost::Type::IO | ThreadHost::Type::UI); - blink::TaskRunners task_runners( + flutter::TaskRunners task_runners( kFlutterThreadName, platform_task_runner, // platform thread_host.gpu_thread->GetTaskRunner(), // gpu @@ -150,7 +150,7 @@ EmbedderThreadHost::CreateEngineManagedThreadHost() { // implementation. auto platform_task_runner = fml::MessageLoop::GetCurrent().GetTaskRunner(); - blink::TaskRunners task_runners( + flutter::TaskRunners task_runners( kFlutterThreadName, platform_task_runner, // platform thread_host.gpu_thread->GetTaskRunner(), // gpu @@ -177,7 +177,7 @@ EmbedderThreadHost::CreateEngineManagedThreadHost() { EmbedderThreadHost::EmbedderThreadHost( ThreadHost host, - blink::TaskRunners runners, + flutter::TaskRunners runners, std::set> embedder_task_runners) : host_(std::move(host)), runners_(std::move(runners)) { for (const auto& runner : embedder_task_runners) { @@ -191,7 +191,7 @@ bool EmbedderThreadHost::IsValid() const { return runners_.IsValid(); } -const blink::TaskRunners& EmbedderThreadHost::GetTaskRunners() const { +const flutter::TaskRunners& EmbedderThreadHost::GetTaskRunners() const { return runners_; } diff --git a/shell/platform/embedder/embedder_thread_host.h b/shell/platform/embedder/embedder_thread_host.h index 1ae9c309ed72f..eb2b5a5eaeced 100644 --- a/shell/platform/embedder/embedder_thread_host.h +++ b/shell/platform/embedder/embedder_thread_host.h @@ -25,20 +25,20 @@ class EmbedderThreadHost { EmbedderThreadHost( ThreadHost host, - blink::TaskRunners runners, + flutter::TaskRunners runners, std::set> embedder_task_runners); ~EmbedderThreadHost(); bool IsValid() const; - const blink::TaskRunners& GetTaskRunners() const; + const flutter::TaskRunners& GetTaskRunners() const; bool PostTask(int64_t runner, uint64_t task) const; private: ThreadHost host_; - blink::TaskRunners runners_; + flutter::TaskRunners runners_; std::map> runners_map_; static std::unique_ptr CreateEmbedderManagedThreadHost( diff --git a/shell/platform/embedder/platform_view_embedder.cc b/shell/platform/embedder/platform_view_embedder.cc index bdb45c072dbe0..8a5d6b32830cc 100644 --- a/shell/platform/embedder/platform_view_embedder.cc +++ b/shell/platform/embedder/platform_view_embedder.cc @@ -8,7 +8,7 @@ namespace shell { PlatformViewEmbedder::PlatformViewEmbedder( PlatformView::Delegate& delegate, - blink::TaskRunners task_runners, + flutter::TaskRunners task_runners, EmbedderSurfaceGL::GLDispatchTable gl_dispatch_table, bool fbo_reset_after_present, PlatformDispatchTable platform_dispatch_table) @@ -20,7 +20,7 @@ PlatformViewEmbedder::PlatformViewEmbedder( PlatformViewEmbedder::PlatformViewEmbedder( PlatformView::Delegate& delegate, - blink::TaskRunners task_runners, + flutter::TaskRunners task_runners, EmbedderSurfaceSoftware::SoftwareDispatchTable software_dispatch_table, PlatformDispatchTable platform_dispatch_table) : PlatformView(delegate, std::move(task_runners)), @@ -31,8 +31,8 @@ PlatformViewEmbedder::PlatformViewEmbedder( PlatformViewEmbedder::~PlatformViewEmbedder() = default; void PlatformViewEmbedder::UpdateSemantics( - blink::SemanticsNodeUpdates update, - blink::CustomAccessibilityActionUpdates actions) { + flutter::SemanticsNodeUpdates update, + flutter::CustomAccessibilityActionUpdates actions) { if (platform_dispatch_table_.update_semantics_nodes_callback != nullptr) { platform_dispatch_table_.update_semantics_nodes_callback(std::move(update)); } @@ -44,7 +44,7 @@ void PlatformViewEmbedder::UpdateSemantics( } void PlatformViewEmbedder::HandlePlatformMessage( - fml::RefPtr message) { + fml::RefPtr message) { if (!message) { return; } diff --git a/shell/platform/embedder/platform_view_embedder.h b/shell/platform/embedder/platform_view_embedder.h index 377dd337ddee8..e0d885db4e709 100644 --- a/shell/platform/embedder/platform_view_embedder.h +++ b/shell/platform/embedder/platform_view_embedder.h @@ -20,11 +20,11 @@ namespace shell { class PlatformViewEmbedder final : public PlatformView { public: using UpdateSemanticsNodesCallback = - std::function; + std::function; using UpdateSemanticsCustomActionsCallback = - std::function; + std::function; using PlatformMessageResponseCallback = - std::function)>; + std::function)>; struct PlatformDispatchTable { UpdateSemanticsNodesCallback update_semantics_nodes_callback; // optional @@ -37,7 +37,7 @@ class PlatformViewEmbedder final : public PlatformView { // Creates a platform view that sets up an OpenGL rasterizer. PlatformViewEmbedder(PlatformView::Delegate& delegate, - blink::TaskRunners task_runners, + flutter::TaskRunners task_runners, EmbedderSurfaceGL::GLDispatchTable gl_dispatch_table, bool fbo_reset_after_present, PlatformDispatchTable platform_dispatch_table); @@ -45,7 +45,7 @@ class PlatformViewEmbedder final : public PlatformView { // Create a platform view that sets up a software rasterizer. PlatformViewEmbedder( PlatformView::Delegate& delegate, - blink::TaskRunners task_runners, + flutter::TaskRunners task_runners, EmbedderSurfaceSoftware::SoftwareDispatchTable software_dispatch_table, PlatformDispatchTable platform_dispatch_table); @@ -53,12 +53,12 @@ class PlatformViewEmbedder final : public PlatformView { // |shell::PlatformView| void UpdateSemantics( - blink::SemanticsNodeUpdates update, - blink::CustomAccessibilityActionUpdates actions) override; + flutter::SemanticsNodeUpdates update, + flutter::CustomAccessibilityActionUpdates actions) override; // |shell::PlatformView| void HandlePlatformMessage( - fml::RefPtr message) override; + fml::RefPtr message) override; private: std::unique_ptr embedder_surface_; diff --git a/shell/platform/embedder/tests/embedder_a11y_unittests.cc b/shell/platform/embedder/tests/embedder_a11y_unittests.cc index bfabfd491f13e..326a6bdac0068 100644 --- a/shell/platform/embedder/tests/embedder_a11y_unittests.cc +++ b/shell/platform/embedder/tests/embedder_a11y_unittests.cc @@ -137,7 +137,7 @@ TEST_F(Embedder11yTest, A11yTreeIsConsistent) { int64_t action_id; Dart_GetNativeIntegerArgument(args, 1, &action_id); - ASSERT_EQ(static_cast(blink::SemanticsAction::kTap), action_id); + ASSERT_EQ(static_cast(flutter::SemanticsAction::kTap), action_id); Dart_Handle semantic_args = Dart_GetNativeArgument(args, 2); int64_t data; diff --git a/shell/platform/embedder/tests/embedder_context.cc b/shell/platform/embedder/tests/embedder_context.cc index 00faf97413d51..779c50f6329ba 100644 --- a/shell/platform/embedder/tests/embedder_context.cc +++ b/shell/platform/embedder/tests/embedder_context.cc @@ -44,7 +44,7 @@ EmbedderContext::EmbedderContext(std::string assets_path) isolate_snapshot_data_ = GetMapping(assets_dir, "isolate_snapshot_data", false); - if (blink::DartVM::IsRunningPrecompiledCode()) { + if (flutter::DartVM::IsRunningPrecompiledCode()) { vm_snapshot_instructions_ = GetMapping(assets_dir, "vm_snapshot_instr", true); isolate_snapshot_instructions_ = diff --git a/shell/platform/embedder/vsync_waiter_embedder.cc b/shell/platform/embedder/vsync_waiter_embedder.cc index 3c3509ecc7d0d..c7662b4105e04 100644 --- a/shell/platform/embedder/vsync_waiter_embedder.cc +++ b/shell/platform/embedder/vsync_waiter_embedder.cc @@ -7,7 +7,7 @@ namespace shell { VsyncWaiterEmbedder::VsyncWaiterEmbedder(VsyncCallback vsync_callback, - blink::TaskRunners task_runners) + flutter::TaskRunners task_runners) : VsyncWaiter(std::move(task_runners)), vsync_callback_(vsync_callback) { FML_DCHECK(vsync_callback_); } diff --git a/shell/platform/embedder/vsync_waiter_embedder.h b/shell/platform/embedder/vsync_waiter_embedder.h index fc7700417e0d7..84b7f4eeeaacb 100644 --- a/shell/platform/embedder/vsync_waiter_embedder.h +++ b/shell/platform/embedder/vsync_waiter_embedder.h @@ -14,7 +14,8 @@ class VsyncWaiterEmbedder final : public VsyncWaiter { public: using VsyncCallback = std::function; - VsyncWaiterEmbedder(VsyncCallback callback, blink::TaskRunners task_runners); + VsyncWaiterEmbedder(VsyncCallback callback, + flutter::TaskRunners task_runners); ~VsyncWaiterEmbedder() override; diff --git a/shell/testing/tester_main.cc b/shell/testing/tester_main.cc index 75cd8fe79657b..d3fe5616ff354 100644 --- a/shell/testing/tester_main.cc +++ b/shell/testing/tester_main.cc @@ -85,7 +85,7 @@ class ScriptCompletionTaskObserver { FML_DISALLOW_COPY_AND_ASSIGN(ScriptCompletionTaskObserver); }; -int RunTester(const blink::Settings& settings, bool run_forever) { +int RunTester(const flutter::Settings& settings, bool run_forever) { const auto thread_label = "io.flutter.test"; fml::MessageLoop::EnsureInitializedForCurrentThread(); @@ -93,11 +93,11 @@ int RunTester(const blink::Settings& settings, bool run_forever) { auto current_task_runner = fml::MessageLoop::GetCurrent().GetTaskRunner(); // Setup a single threaded test runner configuration. - const blink::TaskRunners task_runners(thread_label, // dart thread label - current_task_runner, // platform - current_task_runner, // gpu - current_task_runner, // ui - current_task_runner // io + const flutter::TaskRunners task_runners(thread_label, // dart thread label + current_task_runner, // platform + current_task_runner, // gpu + current_task_runner, // ui + current_task_runner // io ); Shell::CreateCallback on_create_platform_view = @@ -133,10 +133,10 @@ int RunTester(const blink::Settings& settings, bool run_forever) { "\"CN\",\"\",\"\"]}"; std::vector locale_bytes(locale_json, locale_json + std::strlen(locale_json)); - fml::RefPtr response; + fml::RefPtr response; shell->GetPlatformView()->DispatchPlatformMessage( - fml::MakeRefCounted("flutter/localization", - locale_bytes, response)); + fml::MakeRefCounted("flutter/localization", + locale_bytes, response)); std::initializer_list protection = { fml::FileMapping::Protection::kRead}; @@ -154,11 +154,11 @@ int RunTester(const blink::Settings& settings, bool run_forever) { return EXIT_FAILURE; } - auto asset_manager = std::make_shared(); - asset_manager->PushBack(std::make_unique( + auto asset_manager = std::make_shared(); + asset_manager->PushBack(std::make_unique( fml::Duplicate(settings.assets_dir))); asset_manager->PushBack( - std::make_unique(fml::OpenDirectory( + std::make_unique(fml::OpenDirectory( settings.assets_path.c_str(), false, fml::FilePermission::kRead))); RunConfiguration run_configuration(std::move(isolate_configuration), @@ -189,7 +189,7 @@ int RunTester(const blink::Settings& settings, bool run_forever) { shell::Engine::RunStatus::Failure) { engine_did_run = true; - blink::ViewportMetrics metrics; + flutter::ViewportMetrics metrics; metrics.device_pixel_ratio = 3.0; metrics.physical_width = 2400; // 800 at 3x resolution metrics.physical_height = 1800; // 600 at 3x resolution From d5880a609d30d56dfc6069af4cb836e3f67d7517 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 9 Apr 2019 16:03:24 -0400 Subject: [PATCH 0756/1117] Roll src/third_party/skia b5d8c634f95b..de8362c6f212 (14 commits) (#8519) https://skia.googlesource.com/skia.git/%2Blog/b5d8c634f95b..de8362c6f212 git log b5d8c634f95b008882710cb27b6094b3f69d1a85..de8362c6f212b42b03de66a58df29272cb3081be --date=short --no-merges --format=%ad %ae %s 2019-04-09 mtklein@google.com remove DMJsonWriter::AddTestFailure 2019-04-09 bsalomon@google.com Temporarily make TransferPixelsFromTest read BGRA as RGBA on ES. 2019-04-09 reed@google.com remove def of colorfilter flag 2019-04-09 reed@google.com New factories for SkShaders 2019-04-09 nifong@google.com full collection of externs 2019-04-08 herb@google.com Reland "Handle translating blob to origin in bulk" 2019-04-09 halcanary@google.com SkPDF: move annotations away from device. 2019-04-09 mtklein@google.com some refactoring ideas 2019-04-09 ethannicholas@google.com SkSL 'key' variables can now be controlled by 'when' expressions 2019-04-09 fmalita@chromium.org Revert "[skottie] More snug kTop Shaper alignment" 2019-04-09 halcanary@google.com SkPDF: remove unused field 2019-04-09 egdaniel@google.com Fix to barrier batching. 2019-04-09 mtklein@google.com --parameters -> --properties 2019-04-09 michaelludwig@google.com Detect simpler quad type when possible The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 26413a6e46c31..6475dda911644 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': 'b5d8c634f95b008882710cb27b6094b3f69d1a85', + 'skia_revision': 'de8362c6f212b42b03de66a58df29272cb3081be', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 67206df1a7d7d..a4a433248c1cb 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c209a0ed9657c1f2ec1912be3288138e +Signature: 293260562f31775ed60f21797690a327 UNUSED LICENSES: From 86ab45cd5cc4802f815fafc6de8da88d574a6f6f Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 9 Apr 2019 13:26:48 -0700 Subject: [PATCH 0757/1117] Remove the unused EnableBlink flag. (#8518) This used to be when we had two text shaping engines. --- shell/common/switches.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/shell/common/switches.h b/shell/common/switches.h index 44d886ef32f53..2939b92dacad3 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -90,9 +90,6 @@ DEF_SWITCH(SkiaDeterministicRendering, "Skips the call to SkGraphics::Init(), thus avoiding swapping out" "some Skia function pointers based on available CPU features. This" "is used to obtain 100% deterministic behavior in Skia rendering.") -DEF_SWITCH(EnableBlink, - "enable-blink", - "Enable Blink as the text shaping library instead of libtxt.") DEF_SWITCH(FLX, "flx", "Specify the FLX path.") DEF_SWITCH(FlutterAssetsDir, "flutter-assets-dir", From 5279132687d3dc2986d2230443af2ad03963a18d Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Tue, 9 Apr 2019 13:45:25 -0700 Subject: [PATCH 0758/1117] Android Embedding PR27: Fix SurfaceView flicker in Fragment transactions (#8504) --- .../embedding/android/FlutterActivity.java | 1 + .../embedding/android/FlutterFragment.java | 35 ++++++++- .../embedding/android/FlutterSurfaceView.java | 28 ++++++- .../embedding/android/FlutterView.java | 77 ++++++++++++++++--- 4 files changed, 126 insertions(+), 15 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java b/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java index fa26cf387d9e8..34a6aad3730fd 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java @@ -273,6 +273,7 @@ protected FlutterFragment createFlutterFragment() { .appBundlePath(getAppBundlePath()) .flutterShellArgs(FlutterShellArgs.fromIntent(getIntent())) .renderMode(FlutterView.RenderMode.surface) + .transparencyMode(FlutterView.TransparencyMode.opaque) .build(); } diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java index 3beb6d8ae2578..35ce809a4939d 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java @@ -65,6 +65,7 @@ public class FlutterFragment extends Fragment { private static final String ARG_APP_BUNDLE_PATH = "app_bundle_path"; private static final String ARG_FLUTTER_INITIALIZATION_ARGS = "initialization_args"; private static final String ARG_FLUTTERVIEW_RENDER_MODE = "flutterview_render_mode"; + private static final String ARG_FLUTTERVIEW_TRANSPARENCY_MODE = "flutterview_transparency_mode"; /** * Builder that creates a new {@code FlutterFragment} with {@code arguments} that correspond @@ -82,6 +83,7 @@ public static class Builder { private String appBundlePath = null; private FlutterShellArgs shellArgs = null; private FlutterView.RenderMode renderMode = FlutterView.RenderMode.surface; + private FlutterView.TransparencyMode transparencyMode = FlutterView.TransparencyMode.transparent; /** * The name of the initial Dart method to invoke, defaults to "main". @@ -135,6 +137,18 @@ public Builder renderMode(@NonNull FlutterView.RenderMode renderMode) { return this; } + /** + * Support a {@link FlutterView.TransparencyMode#transparent} background within {@link FlutterView}, + * or force an {@link FlutterView.TransparencyMode#opaque} background. + *

    + * See {@link FlutterView.TransparencyMode} for implications of this selection. + */ + @NonNull + public Builder transparencyMode(@NonNull FlutterView.TransparencyMode transparencyMode) { + this.transparencyMode = transparencyMode; + return this; + } + @NonNull public FlutterFragment build() { FlutterFragment frag = new FlutterFragment(); @@ -144,7 +158,8 @@ public FlutterFragment build() { initialRoute, appBundlePath, shellArgs, - renderMode + renderMode, + transparencyMode ); frag.setArguments(args); @@ -194,7 +209,8 @@ protected static Bundle createArgsBundle(@Nullable String dartEntrypoint, @Nullable String initialRoute, @Nullable String appBundlePath, @Nullable FlutterShellArgs flutterShellArgs, - @Nullable FlutterView.RenderMode renderMode) { + @Nullable FlutterView.RenderMode renderMode, + @Nullable FlutterView.TransparencyMode transparencyMode) { Bundle args = new Bundle(); args.putString(ARG_INITIAL_ROUTE, initialRoute); args.putString(ARG_APP_BUNDLE_PATH, appBundlePath); @@ -204,6 +220,7 @@ protected static Bundle createArgsBundle(@Nullable String dartEntrypoint, args.putStringArray(ARG_FLUTTER_INITIALIZATION_ARGS, flutterShellArgs.toArray()); } args.putString(ARG_FLUTTERVIEW_RENDER_MODE, renderMode != null ? renderMode.name() : FlutterView.RenderMode.surface.name()); + args.putString(ARG_FLUTTERVIEW_TRANSPARENCY_MODE, transparencyMode != null ? transparencyMode.name() : FlutterView.TransparencyMode.transparent.name()); return args; } @@ -315,7 +332,7 @@ protected void setupFlutterEngine() { @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - flutterView = new FlutterView(getContext(), getRenderMode()); + flutterView = new FlutterView(getContext(), getRenderMode(), getTransparencyMode()); flutterView.addOnFirstFrameRenderedListener(onFirstFrameRenderedListener); // We post() the code that attaches the FlutterEngine to our FlutterView because there is @@ -413,6 +430,18 @@ protected FlutterView.RenderMode getRenderMode() { return FlutterView.RenderMode.valueOf(renderModeName); } + /** + * Returns the desired {@link FlutterView.TransparencyMode} for the {@link FlutterView} displayed in + * this {@code FlutterFragment}. + *

    + * Defaults to {@link FlutterView.TransparencyMode#transparent}. + */ + @NonNull + protected FlutterView.TransparencyMode getTransparencyMode() { + String transparencyModeName = getArguments().getString(ARG_FLUTTERVIEW_TRANSPARENCY_MODE, FlutterView.TransparencyMode.transparent.name()); + return FlutterView.TransparencyMode.valueOf(transparencyModeName); + } + // TODO(mattcarroll): determine why this can't be in onResume(). Comment reason, or move if possible. public void onPostResume() { Log.d(TAG, "onPostResume()"); diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java b/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java index df78c06f9255e..60c3de4c1a4d9 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterSurfaceView.java @@ -5,6 +5,7 @@ package io.flutter.embedding.android; import android.content.Context; +import android.graphics.PixelFormat; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.AttributeSet; @@ -36,6 +37,7 @@ public class FlutterSurfaceView extends SurfaceView implements FlutterRenderer.RenderSurface { private static final String TAG = "FlutterSurfaceView"; + private final boolean renderTransparently; private boolean isSurfaceAvailableForRendering = false; private boolean isAttachedToFlutterRenderer = false; @Nullable @@ -80,19 +82,39 @@ public void surfaceDestroyed(SurfaceHolder holder) { /** * Constructs a {@code FlutterSurfaceView} programmatically, without any XML attributes. */ - public FlutterSurfaceView(Context context) { - this(context, null); + public FlutterSurfaceView(@NonNull Context context) { + this(context, null, false); + } + + /** + * Constructs a {@code FlutterSurfaceView} programmatically, without any XML attributes, and + * with control over whether or not this {@code FlutterSurfaceView} renders with transparency. + */ + public FlutterSurfaceView(@NonNull Context context, boolean renderTransparently) { + this(context, null, renderTransparently); } /** * Constructs a {@code FlutterSurfaceView} in an XML-inflation-compliant manner. */ - public FlutterSurfaceView(Context context, AttributeSet attrs) { + public FlutterSurfaceView(@NonNull Context context, @NonNull AttributeSet attrs) { + this(context, attrs, false); + } + + private FlutterSurfaceView(@NonNull Context context, @Nullable AttributeSet attrs, boolean renderTransparently) { super(context, attrs); + this.renderTransparently = renderTransparently; init(); } private void init() { + // If transparency is desired then we'll enable a transparent pixel format and place + // our Window above everything else to get transparent background rendering. + if (renderTransparently) { + getHolder().setFormat(PixelFormat.TRANSPARENT); + setZOrderOnTop(true); + } + // Grab a reference to our underlying Surface and register callbacks with that Surface so we // can monitor changes and forward those changes on to native Flutter code. getHolder().addCallback(surfaceCallback); diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/android/FlutterView.java index b3395b4d24273..8d4c7d3b186b5 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -62,6 +62,8 @@ public class FlutterView extends FrameLayout { // Behavior configuration of this FlutterView. @NonNull private RenderMode renderMode; + @Nullable + private TransparencyMode transparencyMode; // Internal view hierarchy references. @Nullable @@ -96,20 +98,41 @@ public void onAccessibilityChanged(boolean isAccessibilityEnabled, boolean isTou }; /** - * Constructs a {@code FlutterSurfaceView} programmatically, without any XML attributes. - * - * {@link #renderMode} defaults to {@link RenderMode#surface}. + * Constructs a {@code FlutterView} programmatically, without any XML attributes. + *

    + *

      + *
    • {@link #renderMode} defaults to {@link RenderMode#surface}.
    • + *
    • {@link #transparencyMode} defaults to {@link TransparencyMode#opaque}.
    • + *
    */ public FlutterView(@NonNull Context context) { - this(context, null, null); + this(context, null, null, null); } /** - * Constructs a {@code FlutterSurfaceView} programmatically, without any XML attributes, + * Constructs a {@code FlutterView} programmatically, without any XML attributes, * and allows selection of a {@link #renderMode}. + *

    + * {@link #transparencyMode} defaults to {@link TransparencyMode#opaque}. */ public FlutterView(@NonNull Context context, @NonNull RenderMode renderMode) { - this(context, null, renderMode); + this(context, null, renderMode, null); + } + + /** + * Constructs a {@code FlutterView} programmatically, without any XML attributes, + * assumes the use of {@link RenderMode#surface}, and allows selection of a {@link #transparencyMode}. + */ + public FlutterView(@NonNull Context context, @NonNull TransparencyMode transparencyMode) { + this(context, null, RenderMode.surface, transparencyMode); + } + + /** + * Constructs a {@code FlutterView} programmatically, without any XML attributes, and allows + * a selection of {@link #renderMode} and {@link #transparencyMode}. + */ + public FlutterView(@NonNull Context context, @NonNull RenderMode renderMode, @NonNull TransparencyMode transparencyMode) { + this(context, null, renderMode, transparencyMode); } /** @@ -118,13 +141,14 @@ public FlutterView(@NonNull Context context, @NonNull RenderMode renderMode) { * // TODO(mattcarroll): expose renderMode in XML when build system supports R.attr */ public FlutterView(@NonNull Context context, @Nullable AttributeSet attrs) { - this(context, attrs, null); + this(context, attrs, null, null); } - private FlutterView(@NonNull Context context, @Nullable AttributeSet attrs, @Nullable RenderMode renderMode) { + private FlutterView(@NonNull Context context, @Nullable AttributeSet attrs, @Nullable RenderMode renderMode, @Nullable TransparencyMode transparencyMode) { super(context, attrs); this.renderMode = renderMode == null ? RenderMode.surface : renderMode; + this.transparencyMode = transparencyMode != null ? transparencyMode : TransparencyMode.opaque; init(); } @@ -135,7 +159,7 @@ private void init() { switch (renderMode) { case surface: Log.d(TAG, "Internally creating a FlutterSurfaceView."); - FlutterSurfaceView flutterSurfaceView = new FlutterSurfaceView(getContext()); + FlutterSurfaceView flutterSurfaceView = new FlutterSurfaceView(getContext(), transparencyMode == TransparencyMode.transparent); renderSurface = flutterSurfaceView; addView(flutterSurfaceView); break; @@ -591,4 +615,39 @@ public enum RenderMode { */ texture } + + /** + * Transparency mode for a {@code FlutterView}. + *

    + * {@code TransparencyMode} impacts the visual behavior and performance of a {@link FlutterSurfaceView}, + * which is displayed when a {@code FlutterView} uses {@link RenderMode#surface}. + *

    + * {@code TransparencyMode} does not impact {@link FlutterTextureView}, which is displayed when + * a {@code FlutterView} uses {@link RenderMode#texture}, because a {@link FlutterTextureView} + * automatically comes with transparency. + */ + public enum TransparencyMode { + /** + * Renders a {@code FlutterView} without any transparency. This affects {@code FlutterView}s in + * {@link RenderMode#surface} by introducing a base color of black, and places the + * {@link FlutterSurfaceView}'s {@code Window} behind all other content. + *

    + * In {@link RenderMode#surface}, this mode is the most performant and is a good choice for + * fullscreen Flutter UIs that will not undergo {@code Fragment} transactions. If this mode is + * used within a {@code Fragment}, and that {@code Fragment} is replaced by another one, a + * brief black flicker may be visible during the switch. + */ + opaque, + /** + * Renders a {@code FlutterView} with transparency. This affects {@code FlutterView}s in + * {@link RenderMode#surface} by allowing background transparency, and places the + * {@link FlutterSurfaceView}'s {@code Window} on top of all other content. + *

    + * In {@link RenderMode#surface}, this mode is less performant than {@link #opaque}, but this + * mode avoids the black flicker problem that {@link #opaque} has when going through + * {@code Fragment} transactions. Consider using this {@code TransparencyMode} if you intend to + * switch {@code Fragment}s at runtime that contain a Flutter UI. + */ + transparent + } } From 2dbd981d389a7bed98c80fbd35c8bff12e7c85b5 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 9 Apr 2019 16:01:39 -0700 Subject: [PATCH 0759/1117] Roll src/third_party/dart 06ed3f598c..1490a90bc1 (8 commits) 1490a90bc1 Track guards using NullabilityNode rather than ConstraintVariable. 7f224d9fbe Track parameters that might need to be made optional/required using NullabilityNode. 6c063512ae Validate that nullability is propagated from optional/required named parameters. ed7f524afb Refactor more of the migration tool to use NullabilityNode rather than ConstraintVariable. 78c55022b1 [VM] - Fix for issue 36484 exposed when ExperimentalFlag.constantUpdate2018 is turned on in CFE a7175938c3 Remove use of package_root in analyzer/test/error_test 45a5349175 Track constant field initializers for field analysis. 91c042c066 Implement isCovariant for fields. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 6475dda911644..d0e87fb81dd7e 100644 --- a/DEPS +++ b/DEPS @@ -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': '06ed3f598c4baf48c7a09ff90240dae02d6d6df5', + 'dart_revision': '1490a90bc1c4cbbf13470af3408584e57d135fb2', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 06004ee215a85..05eaa5a85773c 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 4cf7ee38ae49da305ce5588b83b4c21b +Signature: 1ab2f2e559e655ad5cfe1e759d241b54 UNUSED LICENSES: From 8ae84ec3da6d592a741c1dcc46607ea5f45b7165 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 9 Apr 2019 19:27:24 -0400 Subject: [PATCH 0760/1117] Roll src/third_party/skia de8362c6f212..10bf7020aa15 (5 commits) (#8522) https://skia.googlesource.com/skia.git/%2Blog/de8362c6f212..10bf7020aa15 git log de8362c6f212b42b03de66a58df29272cb3081be..10bf7020aa154dfbd024df40a33c8f39e5264a47 --date=short --no-merges --format=%ad %ae %s 2019-04-09 jvanverth@google.com Add non-AA support to OvalFactoryOps. 2019-04-09 ethannicholas@google.com ComposeShader GPU implementations 2019-04-09 jvanverth@google.com Add RG format to Metal 2019-04-09 mtklein@google.com extract ToolUtils::colortype_depth() 2019-04-09 bungeman@google.com Build HarfBuzz with multi-thread support. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d0e87fb81dd7e..9b976d2724db7 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': 'de8362c6f212b42b03de66a58df29272cb3081be', + 'skia_revision': '10bf7020aa154dfbd024df40a33c8f39e5264a47', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a4a433248c1cb..f581d1ad52cb9 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 293260562f31775ed60f21797690a327 +Signature: b1495b48df1e7beb67be8faa3550c3b1 UNUSED LICENSES: @@ -5786,6 +5786,12 @@ FILE: ../../../third_party/skia/docs/examples/Typeface_Methods.cpp FILE: ../../../third_party/skia/docs/examples/Xor.cpp FILE: ../../../third_party/skia/gm/crbug_918512.cpp FILE: ../../../third_party/skia/src/gpu/GrPersistentCacheUtils.h +FILE: ../../../third_party/skia/src/gpu/effects/GrComposeLerpEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/GrComposeLerpEffect.fp +FILE: ../../../third_party/skia/src/gpu/effects/GrComposeLerpEffect.h +FILE: ../../../third_party/skia/src/gpu/effects/GrComposeLerpRedEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/GrComposeLerpRedEffect.fp +FILE: ../../../third_party/skia/src/gpu/effects/GrComposeLerpRedEffect.h ---------------------------------------------------------------------------------------------------- Copyright 2019 Google LLC. From ca1d163d450d4cf8d4ac5a626b7592cf1402dd1a Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 9 Apr 2019 17:03:41 -0700 Subject: [PATCH 0761/1117] Support message loops whose tasks are executed concurrently. (#8419) The number of workers depends on what the platform deem appropriate for the system at runtime. --- ci/licenses_golden/licenses_flutter | 2 + fml/BUILD.gn | 2 + fml/concurrent_message_loop.cc | 70 +++++++++++++++++++++++ fml/concurrent_message_loop.h | 55 ++++++++++++++++++ fml/message_loop.cc | 8 +++ fml/message_loop.h | 4 ++ fml/message_loop_impl.cc | 19 ++++-- fml/message_loop_impl.h | 16 +++++- fml/message_loop_unittests.cc | 17 ++++++ fml/platform/darwin/message_loop_darwin.h | 3 + fml/platform/linux/message_loop_linux.cc | 3 + fml/platform/linux/message_loop_linux.h | 3 + fml/thread.h | 4 +- 13 files changed, 195 insertions(+), 11 deletions(-) create mode 100644 fml/concurrent_message_loop.cc create mode 100644 fml/concurrent_message_loop.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index e5c04c4678a24..0ad1cf51ce12e 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -130,6 +130,8 @@ 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/concurrent_message_loop.cc +FILE: ../../../flutter/fml/concurrent_message_loop.h FILE: ../../../flutter/fml/eintr_wrapper.h FILE: ../../../flutter/fml/file.cc FILE: ../../../flutter/fml/file.h diff --git a/fml/BUILD.gn b/fml/BUILD.gn index ca0b9ad9fec77..629bb1c82290a 100644 --- a/fml/BUILD.gn +++ b/fml/BUILD.gn @@ -12,6 +12,8 @@ source_set("fml") { "command_line.cc", "command_line.h", "compiler_specific.h", + "concurrent_message_loop.cc", + "concurrent_message_loop.h", "eintr_wrapper.h", "file.cc", "file.h", diff --git a/fml/concurrent_message_loop.cc b/fml/concurrent_message_loop.cc new file mode 100644 index 0000000000000..23c820787faf9 --- /dev/null +++ b/fml/concurrent_message_loop.cc @@ -0,0 +1,70 @@ +// Copyright 2013 The Flutter 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/concurrent_message_loop.h" + +#include + +#include "flutter/fml/thread.h" +#include "flutter/fml/trace_event.h" + +namespace fml { + +ConcurrentMessageLoop::ConcurrentMessageLoop() + : worker_count_(std::max(std::thread::hardware_concurrency(), 1u)), + shutdown_latch_(worker_count_), + shutdown_(false) { + for (size_t i = 0; i < worker_count_; ++i) { + workers_.emplace_back([i, this]() { + fml::Thread::SetCurrentThreadName( + std::string{"io.flutter.worker." + std::to_string(i + 1)}); + WorkerMain(); + }); + } +} + +ConcurrentMessageLoop::~ConcurrentMessageLoop() { + Terminate(); + shutdown_latch_.Wait(); + for (auto& worker : workers_) { + worker.join(); + } +} + +// |fml::MessageLoopImpl| +void ConcurrentMessageLoop::Run() { + FML_CHECK(false); +} + +// |fml::MessageLoopImpl| +void ConcurrentMessageLoop::Terminate() { + std::lock_guard lock(wait_condition_mutex_); + shutdown_ = true; + wait_condition_.notify_all(); +} + +// |fml::MessageLoopImpl| +void ConcurrentMessageLoop::WakeUp(fml::TimePoint time_point) { + // Assume that the clocks are not the same. + const auto duration = std::chrono::nanoseconds( + (time_point - fml::TimePoint::Now()).ToNanoseconds()); + next_wake_ = std::chrono::high_resolution_clock::now() + duration; + wait_condition_.notify_all(); +} + +void ConcurrentMessageLoop::WorkerMain() { + while (!shutdown_) { + std::unique_lock lock(wait_condition_mutex_); + if (!shutdown_) { + wait_condition_.wait(lock); + } + TRACE_EVENT0("fml", "ConcurrentWorkerWake"); + RunSingleExpiredTaskNow(); + } + + RunExpiredTasksNow(); + shutdown_latch_.CountDown(); +} + +} // namespace fml diff --git a/fml/concurrent_message_loop.h b/fml/concurrent_message_loop.h new file mode 100644 index 0000000000000..7879d05239f83 --- /dev/null +++ b/fml/concurrent_message_loop.h @@ -0,0 +1,55 @@ +// Copyright 2013 The Flutter 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_CONCURRENT_MESSAGE_LOOP_H_ +#define FLUTTER_FML_CONCURRENT_MESSAGE_LOOP_H_ + +#include +#include +#include +#include +#include + +#include "flutter/fml/macros.h" +#include "flutter/fml/message_loop_impl.h" +#include "flutter/fml/synchronization/count_down_latch.h" +#include "flutter/fml/synchronization/thread_annotations.h" + +namespace fml { + +class ConcurrentMessageLoop : public MessageLoopImpl { + private: + const size_t worker_count_; + std::mutex wait_condition_mutex_; + std::condition_variable wait_condition_; + std::vector workers_; + CountDownLatch shutdown_latch_; + std::chrono::high_resolution_clock::time_point next_wake_; + std::atomic_bool shutdown_; + + ConcurrentMessageLoop(); + + ~ConcurrentMessageLoop(); + + // |fml::MessageLoopImpl| + void Run() override; + + // |fml::MessageLoopImpl| + void Terminate() override; + + // |fml::MessageLoopImpl| + void WakeUp(fml::TimePoint time_point) override; + + static void WorkerMain(ConcurrentMessageLoop* loop); + + void WorkerMain(); + + FML_FRIEND_MAKE_REF_COUNTED(ConcurrentMessageLoop); + FML_FRIEND_REF_COUNTED_THREAD_SAFE(ConcurrentMessageLoop); + FML_DISALLOW_COPY_AND_ASSIGN(ConcurrentMessageLoop); +}; + +} // namespace fml + +#endif // FLUTTER_FML_CONCURRENT_MESSAGE_LOOP_H_ diff --git a/fml/message_loop.cc b/fml/message_loop.cc index 469d47207566a..af3d73510281c 100644 --- a/fml/message_loop.cc +++ b/fml/message_loop.cc @@ -6,6 +6,7 @@ #include +#include "flutter/fml/concurrent_message_loop.h" #include "flutter/fml/memory/ref_counted.h" #include "flutter/fml/memory/ref_ptr.h" #include "flutter/fml/message_loop_impl.h" @@ -45,6 +46,13 @@ MessageLoop::MessageLoop() FML_CHECK(task_runner_); } +MessageLoop::MessageLoop(Type) + : loop_(fml::MakeRefCounted()), + task_runner_(fml::MakeRefCounted(loop_)) { + FML_CHECK(loop_); + FML_CHECK(task_runner_); +} + MessageLoop::~MessageLoop() = default; void MessageLoop::Run() { diff --git a/fml/message_loop.h b/fml/message_loop.h index 6ca54a94c18a3..3400bf47f592d 100644 --- a/fml/message_loop.h +++ b/fml/message_loop.h @@ -18,6 +18,10 @@ class MessageLoop { FML_EMBEDDER_ONLY static MessageLoop& GetCurrent(); + enum class Type { kConcurrent }; + + MessageLoop(Type type); + bool IsValid() const; void Run(); diff --git a/fml/message_loop_impl.cc b/fml/message_loop_impl.cc index 4d2c5bf4ff614..94474fd1af9e0 100644 --- a/fml/message_loop_impl.cc +++ b/fml/message_loop_impl.cc @@ -48,10 +48,6 @@ void MessageLoopImpl::PostTask(fml::closure task, fml::TimePoint target_time) { RegisterTask(task, target_time); } -void MessageLoopImpl::RunExpiredTasksNow() { - RunExpiredTasks(); -} - void MessageLoopImpl::AddTaskObserver(intptr_t key, fml::closure callback) { FML_DCHECK(callback != nullptr); FML_DCHECK(MessageLoop::GetCurrent().GetLoopImpl().get() == this) @@ -112,8 +108,8 @@ void MessageLoopImpl::RegisterTask(fml::closure task, WakeUp(delayed_tasks_.top().target_time); } -void MessageLoopImpl::RunExpiredTasks() { - TRACE_EVENT0("fml", "MessageLoop::RunExpiredTasks"); +void MessageLoopImpl::FlushTasks(FlushType type) { + TRACE_EVENT0("fml", "MessageLoop::FlushTasks"); std::vector invocations; { @@ -131,6 +127,9 @@ void MessageLoopImpl::RunExpiredTasks() { } invocations.emplace_back(std::move(top.task)); delayed_tasks_.pop(); + if (type == FlushType::kSingle) { + break; + } } WakeUp(delayed_tasks_.empty() ? fml::TimePoint::Max() @@ -145,6 +144,14 @@ void MessageLoopImpl::RunExpiredTasks() { } } +void MessageLoopImpl::RunExpiredTasksNow() { + FlushTasks(FlushType::kAll); +} + +void MessageLoopImpl::RunSingleExpiredTaskNow() { + FlushTasks(FlushType::kSingle); +} + MessageLoopImpl::DelayedTask::DelayedTask(size_t p_order, fml::closure p_task, fml::TimePoint p_target_time) diff --git a/fml/message_loop_impl.h b/fml/message_loop_impl.h index 9dab218d0d1db..4248061ad0d8d 100644 --- a/fml/message_loop_impl.h +++ b/fml/message_loop_impl.h @@ -16,6 +16,7 @@ #include "flutter/fml/macros.h" #include "flutter/fml/memory/ref_counted.h" #include "flutter/fml/message_loop.h" +#include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/time/time_point.h" namespace fml { @@ -42,10 +43,15 @@ class MessageLoopImpl : public fml::RefCountedThreadSafe { void DoTerminate(); + protected: // Exposed for the embedder shell which allows clients to poll for events // instead of dedicating a thread to the message loop. + friend class MessageLoop; + void RunExpiredTasksNow(); + void RunSingleExpiredTaskNow(); + protected: MessageLoopImpl(); @@ -76,13 +82,17 @@ class MessageLoopImpl : public fml::RefCountedThreadSafe { std::map task_observers_; std::mutex delayed_tasks_mutex_; - DelayedTaskQueue delayed_tasks_; - size_t order_; + DelayedTaskQueue delayed_tasks_ FML_GUARDED_BY(delayed_tasks_mutex_); + size_t order_ FML_GUARDED_BY(delayed_tasks_mutex_); std::atomic_bool terminated_; void RegisterTask(fml::closure task, fml::TimePoint target_time); - void RunExpiredTasks(); + enum class FlushType { + kSingle, + kAll, + }; + void FlushTasks(FlushType type); FML_DISALLOW_COPY_AND_ASSIGN(MessageLoopImpl); }; diff --git a/fml/message_loop_unittests.cc b/fml/message_loop_unittests.cc index d751071b9e8c8..55de92bb15e1a 100644 --- a/fml/message_loop_unittests.cc +++ b/fml/message_loop_unittests.cc @@ -4,9 +4,11 @@ #define FML_USED_ON_EMBEDDER +#include #include #include "flutter/fml/message_loop.h" +#include "flutter/fml/synchronization/count_down_latch.h" #include "flutter/fml/synchronization/waitable_event.h" #include "flutter/fml/task_runner.h" #include "gtest/gtest.h" @@ -278,3 +280,18 @@ TEST(MessageLoop, TaskObserverFire) { ASSERT_TRUE(started); ASSERT_TRUE(terminated); } + +TEST(MessageLoop, CanCreateConcurrentMessageLoop) { + fml::MessageLoop loop(fml::MessageLoop::Type::kConcurrent); + auto task_runner = loop.GetTaskRunner(); + const size_t kCount = 10; + fml::CountDownLatch latch(kCount); + for (size_t i = 0; i < kCount; ++i) { + task_runner->PostTask([&latch]() { + std::this_thread::sleep_for(std::chrono::milliseconds(5)); + std::cout << "Ran on thread: " << std::this_thread::get_id() << std::endl; + latch.CountDown(); + }); + } + latch.Wait(); +} diff --git a/fml/platform/darwin/message_loop_darwin.h b/fml/platform/darwin/message_loop_darwin.h index 94005ae4c931a..fb4c178c071ba 100644 --- a/fml/platform/darwin/message_loop_darwin.h +++ b/fml/platform/darwin/message_loop_darwin.h @@ -25,10 +25,13 @@ class MessageLoopDarwin : public MessageLoopImpl { ~MessageLoopDarwin() override; + // |fml::MessageLoopImpl| void Run() override; + // |fml::MessageLoopImpl| void Terminate() override; + // |fml::MessageLoopImpl| void WakeUp(fml::TimePoint time_point) override; static void OnTimerFire(CFRunLoopTimerRef timer, MessageLoopDarwin* loop); diff --git a/fml/platform/linux/message_loop_linux.cc b/fml/platform/linux/message_loop_linux.cc index 483efe59af348..5ed41aef8fa4e 100644 --- a/fml/platform/linux/message_loop_linux.cc +++ b/fml/platform/linux/message_loop_linux.cc @@ -43,6 +43,7 @@ bool MessageLoopLinux::AddOrRemoveTimerSource(bool add) { return ctl_result == 0; } +// |fml::MessageLoopImpl| void MessageLoopLinux::Run() { running_ = true; @@ -71,11 +72,13 @@ void MessageLoopLinux::Run() { } } +// |fml::MessageLoopImpl| void MessageLoopLinux::Terminate() { running_ = false; WakeUp(fml::TimePoint::Now()); } +// |fml::MessageLoopImpl| void MessageLoopLinux::WakeUp(fml::TimePoint time_point) { bool result = TimerRearm(timer_fd_.get(), time_point); FML_DCHECK(result); diff --git a/fml/platform/linux/message_loop_linux.h b/fml/platform/linux/message_loop_linux.h index 32bdb6442789e..5563328b2f5a3 100644 --- a/fml/platform/linux/message_loop_linux.h +++ b/fml/platform/linux/message_loop_linux.h @@ -23,10 +23,13 @@ class MessageLoopLinux : public MessageLoopImpl { ~MessageLoopLinux() override; + // |fml::MessageLoopImpl| void Run() override; + // |fml::MessageLoopImpl| void Terminate() override; + // |fml::MessageLoopImpl| void WakeUp(fml::TimePoint time_point) override; void OnEventFired(); diff --git a/fml/thread.h b/fml/thread.h index 19a6e5ec3ba43..9d297c2a5502d 100644 --- a/fml/thread.h +++ b/fml/thread.h @@ -24,13 +24,13 @@ class Thread { void Join(); + static void SetCurrentThreadName(const std::string& name); + private: std::unique_ptr thread_; fml::RefPtr task_runner_; std::atomic_bool joined_; - static void SetCurrentThreadName(const std::string& name); - FML_DISALLOW_COPY_AND_ASSIGN(Thread); }; From 56052c70afcbdff2d39d2af279fcc52666122dbf Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 9 Apr 2019 17:10:46 -0700 Subject: [PATCH 0762/1117] Rename the shell namespace to flutter. (#8520) --- ci/licenses_golden/licenses_flutter | 4 +- lib/ui/io_manager.h | 2 + shell/common/BUILD.gn | 4 +- shell/common/animator.cc | 4 +- shell/common/animator.h | 4 +- shell/common/engine.cc | 6 +- shell/common/engine.h | 6 +- shell/common/isolate_configuration.cc | 10 +- shell/common/isolate_configuration.h | 4 +- shell/common/persistent_cache.cc | 4 +- shell/common/persistent_cache.h | 4 +- shell/common/platform_view.cc | 4 +- shell/common/platform_view.h | 4 +- shell/common/rasterizer.cc | 4 +- shell/common/rasterizer.h | 4 +- shell/common/run_configuration.cc | 4 +- shell/common/run_configuration.h | 4 +- shell/common/shell.cc | 50 +++---- shell/common/shell.h | 48 +++---- shell/common/shell_benchmarks.cc | 4 +- .../{io_manager.cc => shell_io_manager.cc} | 25 ++-- .../{io_manager.h => shell_io_manager.h} | 24 ++-- shell/common/shell_test.cc | 4 +- shell/common/shell_test.h | 4 +- shell/common/shell_unittests.cc | 4 +- shell/common/skia_event_tracer_impl.cc | 11 +- shell/common/skia_event_tracer_impl.h | 4 + shell/common/surface.cc | 4 +- shell/common/surface.h | 4 +- shell/common/switches.cc | 12 +- shell/common/switches.h | 4 +- shell/common/thread_host.cc | 4 +- shell/common/thread_host.h | 4 +- shell/common/vsync_waiter.cc | 4 +- shell/common/vsync_waiter.h | 4 +- shell/common/vsync_waiter_fallback.cc | 6 +- shell/common/vsync_waiter_fallback.h | 6 +- shell/gpu/gpu_surface_gl.cc | 16 +-- shell/gpu/gpu_surface_gl.h | 16 +-- shell/gpu/gpu_surface_gl_delegate.cc | 8 +- shell/gpu/gpu_surface_gl_delegate.h | 4 +- shell/gpu/gpu_surface_software.cc | 14 +- shell/gpu/gpu_surface_software.h | 14 +- shell/gpu/gpu_surface_vulkan.cc | 12 +- shell/gpu/gpu_surface_vulkan.h | 12 +- shell/platform/android/android_context_gl.cc | 4 +- shell/platform/android/android_context_gl.h | 4 +- .../android/android_environment_gl.cc | 4 +- .../platform/android/android_environment_gl.h | 4 +- .../android/android_external_texture_gl.cc | 4 +- .../android/android_external_texture_gl.h | 4 +- .../platform/android/android_native_window.cc | 4 +- .../platform/android/android_native_window.h | 4 +- .../platform/android/android_shell_holder.cc | 8 +- shell/platform/android/android_shell_holder.h | 4 +- shell/platform/android/android_surface.cc | 4 +- shell/platform/android/android_surface.h | 4 +- shell/platform/android/android_surface_gl.cc | 4 +- shell/platform/android/android_surface_gl.h | 26 ++-- .../android/android_surface_software.cc | 4 +- .../android/android_surface_software.h | 22 ++-- .../android/android_surface_vulkan.cc | 16 +-- .../platform/android/android_surface_vulkan.h | 18 +-- shell/platform/android/flutter_main.cc | 4 +- shell/platform/android/flutter_main.h | 4 +- .../android/io/flutter/view/FlutterMain.java | 2 +- shell/platform/android/library_loader.cc | 6 +- .../platform_message_response_android.cc | 4 +- .../platform_message_response_android.h | 4 +- .../platform/android/platform_view_android.cc | 22 ++-- .../platform/android/platform_view_android.h | 20 +-- .../android/platform_view_android_jni.cc | 54 ++++---- .../android/platform_view_android_jni.h | 4 +- .../platform/android/vsync_waiter_android.cc | 6 +- shell/platform/android/vsync_waiter_android.h | 6 +- .../common/cpp/incoming_message_dispatcher.cc | 4 +- .../common/cpp/incoming_message_dispatcher.h | 4 +- shell/platform/common/cpp/text_input_model.cc | 4 +- shell/platform/common/cpp/text_input_model.h | 4 +- .../darwin/common/buffer_conversions.h | 4 +- .../darwin/common/buffer_conversions.mm | 4 +- shell/platform/darwin/common/command_line.h | 4 +- shell/platform/darwin/common/command_line.mm | 4 +- .../framework/Source/FlutterDartProject.mm | 14 +- .../Source/FlutterDartProject_Internal.h | 8 +- .../ios/framework/Source/FlutterEngine.mm | 73 +++++------ .../framework/Source/FlutterEngine_Internal.h | 10 +- .../ios/framework/Source/FlutterOverlayView.h | 6 +- .../framework/Source/FlutterOverlayView.mm | 10 +- .../framework/Source/FlutterPlatformPlugin.h | 4 +- .../framework/Source/FlutterPlatformPlugin.mm | 6 +- .../framework/Source/FlutterPlatformViews.mm | 4 +- .../Source/FlutterPlatformViews_Internal.h | 4 +- .../Source/FlutterPlatformViews_Internal.mm | 5 +- .../framework/Source/FlutterStandardCodec.mm | 2 +- .../Source/FlutterStandardCodec_Internal.h | 4 +- .../darwin/ios/framework/Source/FlutterView.h | 9 +- .../ios/framework/Source/FlutterView.mm | 15 ++- .../framework/Source/FlutterViewController.mm | 10 +- .../Source/FlutterViewController_Internal.h | 2 +- .../framework/Source/accessibility_bridge.h | 12 +- .../framework/Source/accessibility_bridge.mm | 16 +-- .../Source/accessibility_text_entry.mm | 2 +- .../Source/platform_message_response_darwin.h | 4 +- .../platform_message_response_darwin.mm | 6 +- .../Source/platform_message_router.h | 4 +- .../Source/platform_message_router.mm | 4 +- .../ios/framework/Source/vsync_waiter_ios.h | 6 +- .../ios/framework/Source/vsync_waiter_ios.mm | 10 +- .../darwin/ios/ios_external_texture_gl.h | 4 +- .../darwin/ios/ios_external_texture_gl.mm | 4 +- shell/platform/darwin/ios/ios_gl_context.h | 4 +- shell/platform/darwin/ios/ios_gl_context.mm | 4 +- .../darwin/ios/ios_gl_render_target.h | 4 +- .../darwin/ios/ios_gl_render_target.mm | 4 +- shell/platform/darwin/ios/ios_surface.h | 4 +- shell/platform/darwin/ios/ios_surface.mm | 4 +- shell/platform/darwin/ios/ios_surface_gl.h | 6 +- shell/platform/darwin/ios/ios_surface_gl.mm | 4 +- .../darwin/ios/ios_surface_software.h | 18 +-- .../darwin/ios/ios_surface_software.mm | 4 +- shell/platform/darwin/ios/platform_view_ios.h | 20 +-- .../platform/darwin/ios/platform_view_ios.mm | 20 +-- shell/platform/embedder/embedder.cc | 122 +++++++++--------- shell/platform/embedder/embedder_engine.cc | 6 +- shell/platform/embedder/embedder_engine.h | 4 +- .../embedder/embedder_external_texture_gl.cc | 4 +- .../embedder/embedder_external_texture_gl.h | 4 +- shell/platform/embedder/embedder_surface.cc | 4 +- shell/platform/embedder/embedder_surface.h | 4 +- .../platform/embedder/embedder_surface_gl.cc | 28 ++-- shell/platform/embedder/embedder_surface_gl.h | 24 ++-- .../embedder/embedder_surface_software.cc | 14 +- .../embedder/embedder_surface_software.h | 14 +- .../platform/embedder/embedder_task_runner.cc | 4 +- .../platform/embedder/embedder_task_runner.h | 4 +- .../platform/embedder/embedder_thread_host.cc | 4 +- .../platform/embedder/embedder_thread_host.h | 4 +- .../embedder/platform_view_embedder.cc | 10 +- .../embedder/platform_view_embedder.h | 14 +- .../embedder/tests/embedder_a11y_unittests.cc | 4 +- .../embedder/tests/embedder_config_builder.cc | 4 +- .../embedder/tests/embedder_config_builder.h | 4 +- .../embedder/tests/embedder_context.cc | 4 +- .../embedder/tests/embedder_context.h | 4 +- .../platform/embedder/tests/embedder_test.cc | 4 +- shell/platform/embedder/tests/embedder_test.h | 4 +- .../embedder/tests/embedder_unittests.cc | 4 +- .../embedder/vsync_waiter_embedder.cc | 6 +- .../platform/embedder/vsync_waiter_embedder.h | 6 +- shell/platform/glfw/flutter_glfw.cc | 12 +- shell/platform/glfw/key_event_handler.cc | 4 +- shell/platform/glfw/key_event_handler.h | 8 +- shell/platform/glfw/keyboard_hook_handler.h | 4 +- shell/platform/glfw/text_input_plugin.cc | 4 +- shell/platform/glfw/text_input_plugin.h | 8 +- shell/testing/tester_main.cc | 18 +-- 157 files changed, 723 insertions(+), 713 deletions(-) rename shell/common/{io_manager.cc => shell_io_manager.cc} (82%) rename shell/common/{io_manager.h => shell_io_manager.h} (76%) diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 0ad1cf51ce12e..c9288e4943282 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -413,8 +413,6 @@ FILE: ../../../flutter/shell/common/animator.h FILE: ../../../flutter/shell/common/engine.cc FILE: ../../../flutter/shell/common/engine.h FILE: ../../../flutter/shell/common/fixtures/main.dart -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 @@ -428,6 +426,8 @@ 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_io_manager.cc +FILE: ../../../flutter/shell/common/shell_io_manager.h FILE: ../../../flutter/shell/common/shell_test.cc FILE: ../../../flutter/shell/common/shell_test.h FILE: ../../../flutter/shell/common/shell_unittests.cc diff --git a/lib/ui/io_manager.h b/lib/ui/io_manager.h index 1b2a2370cbcd3..060f3e4ec8dbe 100644 --- a/lib/ui/io_manager.h +++ b/lib/ui/io_manager.h @@ -15,6 +15,8 @@ namespace flutter { // i.e. the shell's IOManager. class IOManager { public: + virtual ~IOManager() = default; + virtual fml::WeakPtr GetResourceContext() const = 0; virtual fml::RefPtr GetSkiaUnrefQueue() const = 0; diff --git a/shell/common/BUILD.gn b/shell/common/BUILD.gn index c8366f7bed089..fcfcd156d2a12 100644 --- a/shell/common/BUILD.gn +++ b/shell/common/BUILD.gn @@ -64,8 +64,6 @@ source_set("common") { "animator.h", "engine.cc", "engine.h", - "io_manager.cc", - "io_manager.h", "isolate_configuration.cc", "isolate_configuration.h", "persistent_cache.cc", @@ -78,6 +76,8 @@ source_set("common") { "run_configuration.h", "shell.cc", "shell.h", + "shell_io_manager.cc", + "shell_io_manager.h", "skia_event_tracer_impl.cc", "skia_event_tracer_impl.h", "surface.cc", diff --git a/shell/common/animator.cc b/shell/common/animator.cc index 785f28413aace..298aaff6cebd5 100644 --- a/shell/common/animator.cc +++ b/shell/common/animator.cc @@ -7,7 +7,7 @@ #include "flutter/fml/trace_event.h" #include "third_party/dart/runtime/include/dart_tools_api.h" -namespace shell { +namespace flutter { namespace { @@ -233,4 +233,4 @@ void Animator::AwaitVSync() { delegate_.OnAnimatorNotifyIdle(dart_frame_deadline_); } -} // namespace shell +} // namespace flutter diff --git a/shell/common/animator.h b/shell/common/animator.h index 4795d1267846b..c58c99d118f4b 100644 --- a/shell/common/animator.h +++ b/shell/common/animator.h @@ -16,7 +16,7 @@ #include "flutter/synchronization/pipeline.h" #include "flutter/synchronization/semaphore.h" -namespace shell { +namespace flutter { class Animator final { public: @@ -90,6 +90,6 @@ class Animator final { FML_DISALLOW_COPY_AND_ASSIGN(Animator); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_COMMON_ANIMATOR_H_ diff --git a/shell/common/engine.cc b/shell/common/engine.cc index dea021a5f009c..706ded70984b8 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -27,7 +27,7 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkPictureRecorder.h" -namespace shell { +namespace flutter { static constexpr char kAssetChannel[] = "flutter/assets"; static constexpr char kLifecycleChannel[] = "flutter/lifecycle"; @@ -150,7 +150,7 @@ Engine::RunStatus Engine::Run(RunConfiguration configuration) { : Engine::RunStatus::Failure; } -shell::Engine::RunStatus Engine::PrepareAndLaunchIsolate( +Engine::RunStatus Engine::PrepareAndLaunchIsolate( RunConfiguration configuration) { TRACE_EVENT0("flutter", "Engine::PrepareAndLaunchIsolate"); @@ -458,4 +458,4 @@ void Engine::HandleAssetPlatformMessage( response->CompleteEmpty(); } -} // namespace shell +} // namespace flutter diff --git a/shell/common/engine.h b/shell/common/engine.h index 68eee4ad9906e..ce4917e6b9d37 100644 --- a/shell/common/engine.h +++ b/shell/common/engine.h @@ -22,12 +22,12 @@ #include "flutter/runtime/runtime_controller.h" #include "flutter/runtime/runtime_delegate.h" #include "flutter/shell/common/animator.h" -#include "flutter/shell/common/io_manager.h" #include "flutter/shell/common/rasterizer.h" #include "flutter/shell/common/run_configuration.h" +#include "flutter/shell/common/shell_io_manager.h" #include "third_party/skia/include/core/SkPicture.h" -namespace shell { +namespace flutter { class Engine final : public flutter::RuntimeDelegate { public: @@ -175,6 +175,6 @@ class Engine final : public flutter::RuntimeDelegate { FML_DISALLOW_COPY_AND_ASSIGN(Engine); }; -} // namespace shell +} // namespace flutter #endif // SHELL_COMMON_ENGINE_H_ diff --git a/shell/common/isolate_configuration.cc b/shell/common/isolate_configuration.cc index 93ec0afac13a3..a11a060b3b53a 100644 --- a/shell/common/isolate_configuration.cc +++ b/shell/common/isolate_configuration.cc @@ -7,7 +7,7 @@ #include "flutter/fml/make_copyable.h" #include "flutter/runtime/dart_vm.h" -namespace shell { +namespace flutter { IsolateConfiguration::IsolateConfiguration() = default; @@ -27,7 +27,7 @@ class AppSnapshotIsolateConfiguration final : public IsolateConfiguration { public: AppSnapshotIsolateConfiguration() = default; - // |shell::IsolateConfiguration| + // |IsolateConfiguration| bool DoPrepareIsolate(flutter::DartIsolate& isolate) override { return isolate.PrepareForRunningFromPrecompiledCode(); } @@ -41,7 +41,7 @@ class KernelIsolateConfiguration : public IsolateConfiguration { KernelIsolateConfiguration(std::unique_ptr kernel) : kernel_(std::move(kernel)) {} - // |shell::IsolateConfiguration| + // |IsolateConfiguration| bool DoPrepareIsolate(flutter::DartIsolate& isolate) override { if (flutter::DartVM::IsRunningPrecompiledCode()) { return false; @@ -62,7 +62,7 @@ class KernelListIsolateConfiguration final : public IsolateConfiguration { kernel_pieces) : kernel_pieces_(std::move(kernel_pieces)) {} - // |shell::IsolateConfiguration| + // |IsolateConfiguration| bool DoPrepareIsolate(flutter::DartIsolate& isolate) override { if (flutter::DartVM::IsRunningPrecompiledCode()) { return false; @@ -219,4 +219,4 @@ std::unique_ptr IsolateConfiguration::CreateForKernelList( std::move(kernel_pieces)); } -} // namespace shell +} // namespace flutter diff --git a/shell/common/isolate_configuration.h b/shell/common/isolate_configuration.h index 8de0a8192b571..950a74910102d 100644 --- a/shell/common/isolate_configuration.h +++ b/shell/common/isolate_configuration.h @@ -17,7 +17,7 @@ #include "flutter/fml/memory/weak_ptr.h" #include "flutter/runtime/dart_isolate.h" -namespace shell { +namespace flutter { class IsolateConfiguration { public: @@ -51,6 +51,6 @@ class IsolateConfiguration { FML_DISALLOW_COPY_AND_ASSIGN(IsolateConfiguration); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_COMMON_ISOLATE_CONFIGURATION_H_ diff --git a/shell/common/persistent_cache.cc b/shell/common/persistent_cache.cc index fe9f6e48243e2..c9fcb420288da 100644 --- a/shell/common/persistent_cache.cc +++ b/shell/common/persistent_cache.cc @@ -15,7 +15,7 @@ #include "flutter/fml/paths.h" #include "flutter/fml/trace_event.h" -namespace shell { +namespace flutter { std::string PersistentCache::cache_base_path_; @@ -205,4 +205,4 @@ fml::RefPtr PersistentCache::GetWorkerTaskRunner() const { return worker; } -} // namespace shell +} // namespace flutter diff --git a/shell/common/persistent_cache.h b/shell/common/persistent_cache.h index 7b3310e849bae..f26e819e81aa7 100644 --- a/shell/common/persistent_cache.h +++ b/shell/common/persistent_cache.h @@ -15,7 +15,7 @@ #include "flutter/fml/unique_fd.h" #include "third_party/skia/include/gpu/GrContextOptions.h" -namespace shell { +namespace flutter { class PersistentCache : public GrContextOptions::PersistentCache { public: @@ -72,6 +72,6 @@ class PersistentCache : public GrContextOptions::PersistentCache { FML_DISALLOW_COPY_AND_ASSIGN(PersistentCache); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_COMMON_PERSISTENT_CACHE_H_ diff --git a/shell/common/platform_view.cc b/shell/common/platform_view.cc index f10d29941d54e..43063f742e86e 100644 --- a/shell/common/platform_view.cc +++ b/shell/common/platform_view.cc @@ -14,7 +14,7 @@ #include "third_party/skia/include/gpu/GrContextOptions.h" #include "third_party/skia/include/gpu/gl/GrGLInterface.h" -namespace shell { +namespace flutter { PlatformView::PlatformView(Delegate& delegate, flutter::TaskRunners task_runners) @@ -133,4 +133,4 @@ void PlatformView::SetNextFrameCallback(fml::closure closure) { delegate_.OnPlatformViewSetNextFrameCallback(std::move(closure)); } -} // namespace shell +} // namespace flutter diff --git a/shell/common/platform_view.h b/shell/common/platform_view.h index 07e92dd5377b3..32e40a981ad1a 100644 --- a/shell/common/platform_view.h +++ b/shell/common/platform_view.h @@ -21,7 +21,7 @@ #include "third_party/skia/include/core/SkSize.h" #include "third_party/skia/include/gpu/GrContext.h" -namespace shell { +namespace flutter { class Shell; @@ -132,6 +132,6 @@ class PlatformView { FML_DISALLOW_COPY_AND_ASSIGN(PlatformView); }; -} // namespace shell +} // namespace flutter #endif // COMMON_PLATFORM_VIEW_H_ diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index 6759ef974078f..24241f62e2d3a 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -16,7 +16,7 @@ #include "third_party/skia/include/core/SkSurfaceCharacterization.h" #include "third_party/skia/include/utils/SkBase64.h" -namespace shell { +namespace flutter { // The rasterizer will tell Skia to purge cached resources that have not been // used within this interval. @@ -389,4 +389,4 @@ Rasterizer::Screenshot::Screenshot(const Screenshot& other) = default; Rasterizer::Screenshot::~Screenshot() = default; -} // namespace shell +} // namespace flutter diff --git a/shell/common/rasterizer.h b/shell/common/rasterizer.h index 0319afe744b56..80faecfc5acf1 100644 --- a/shell/common/rasterizer.h +++ b/shell/common/rasterizer.h @@ -17,7 +17,7 @@ #include "flutter/shell/common/surface.h" #include "flutter/synchronization/pipeline.h" -namespace shell { +namespace flutter { class Rasterizer final : public flutter::SnapshotDelegate { public: @@ -96,6 +96,6 @@ class Rasterizer final : public flutter::SnapshotDelegate { FML_DISALLOW_COPY_AND_ASSIGN(Rasterizer); }; -} // namespace shell +} // namespace flutter #endif // SHELL_COMMON_RASTERIZER_H_ diff --git a/shell/common/run_configuration.cc b/shell/common/run_configuration.cc index d6cf5d75802f3..4d7f5c0fb248c 100644 --- a/shell/common/run_configuration.cc +++ b/shell/common/run_configuration.cc @@ -10,7 +10,7 @@ #include "flutter/fml/file.h" #include "flutter/runtime/dart_vm.h" -namespace shell { +namespace flutter { RunConfiguration RunConfiguration::InferFromSettings( const flutter::Settings& settings, @@ -86,4 +86,4 @@ RunConfiguration::TakeIsolateConfiguration() { return std::move(isolate_configuration_); } -} // namespace shell +} // namespace flutter diff --git a/shell/common/run_configuration.h b/shell/common/run_configuration.h index 9158813bff16b..f5494c10d7e3d 100644 --- a/shell/common/run_configuration.h +++ b/shell/common/run_configuration.h @@ -16,7 +16,7 @@ #include "flutter/fml/unique_fd.h" #include "flutter/shell/common/isolate_configuration.h" -namespace shell { +namespace flutter { class RunConfiguration { public: @@ -58,6 +58,6 @@ class RunConfiguration { FML_DISALLOW_COPY_AND_ASSIGN(RunConfiguration); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_COMMON_RUN_CONFIGURATION_H_ diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 84a879e4baf63..893a269601916 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -31,7 +31,7 @@ #include "third_party/skia/include/core/SkGraphics.h" #include "third_party/tonic/common/log.h" -namespace shell { +namespace flutter { constexpr char kSkiaChannel[] = "flutter/skia"; @@ -69,7 +69,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( // first be booted and the necessary references obtained to initialize the // other subsystems. fml::AutoResetWaitableEvent io_latch; - std::unique_ptr io_manager; + std::unique_ptr io_manager; auto io_task_runner = shell->GetTaskRunners().GetIOTaskRunner(); fml::TaskRunner::RunNowOrPostTask( io_task_runner, @@ -79,7 +79,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( io_task_runner // ]() { TRACE_EVENT0("flutter", "ShellSetupIOSubsystem"); - io_manager = std::make_unique( + io_manager = std::make_unique( platform_view->CreateResourceContext(), io_task_runner); io_latch.Signal(); }); @@ -378,7 +378,7 @@ bool Shell::IsSetup() const { bool Shell::Setup(std::unique_ptr platform_view, std::unique_ptr engine, std::unique_ptr rasterizer, - std::unique_ptr io_manager) { + std::unique_ptr io_manager) { if (is_setup_) { return false; } @@ -432,7 +432,7 @@ flutter::DartVM* Shell::GetDartVM() { return &vm_; } -// |shell::PlatformView::Delegate| +// |PlatformView::Delegate| void Shell::OnPlatformViewCreated(std::unique_ptr surface) { TRACE_EVENT0("flutter", "Shell::OnPlatformViewCreated"); FML_DCHECK(is_setup_); @@ -516,7 +516,7 @@ void Shell::OnPlatformViewCreated(std::unique_ptr surface) { } } -// |shell::PlatformView::Delegate| +// |PlatformView::Delegate| void Shell::OnPlatformViewDestroyed() { TRACE_EVENT0("flutter", "Shell::OnPlatformViewDestroyed"); FML_DCHECK(is_setup_); @@ -590,7 +590,7 @@ void Shell::OnPlatformViewDestroyed() { } } -// |shell::PlatformView::Delegate| +// |PlatformView::Delegate| void Shell::OnPlatformViewSetViewportMetrics( const flutter::ViewportMetrics& metrics) { FML_DCHECK(is_setup_); @@ -604,7 +604,7 @@ void Shell::OnPlatformViewSetViewportMetrics( }); } -// |shell::PlatformView::Delegate| +// |PlatformView::Delegate| void Shell::OnPlatformViewDispatchPlatformMessage( fml::RefPtr message) { FML_DCHECK(is_setup_); @@ -618,7 +618,7 @@ void Shell::OnPlatformViewDispatchPlatformMessage( }); } -// |shell::PlatformView::Delegate| +// |PlatformView::Delegate| void Shell::OnPlatformViewDispatchPointerDataPacket( std::unique_ptr packet) { TRACE_EVENT0("flutter", "Shell::OnPlatformViewDispatchPointerDataPacket"); @@ -635,7 +635,7 @@ void Shell::OnPlatformViewDispatchPointerDataPacket( next_pointer_flow_id_++; } -// |shell::PlatformView::Delegate| +// |PlatformView::Delegate| void Shell::OnPlatformViewDispatchSemanticsAction( int32_t id, flutter::SemanticsAction action, @@ -651,7 +651,7 @@ void Shell::OnPlatformViewDispatchSemanticsAction( }); } -// |shell::PlatformView::Delegate| +// |PlatformView::Delegate| void Shell::OnPlatformViewSetSemanticsEnabled(bool enabled) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -664,7 +664,7 @@ void Shell::OnPlatformViewSetSemanticsEnabled(bool enabled) { }); } -// |shell::PlatformView::Delegate| +// |PlatformView::Delegate| void Shell::OnPlatformViewSetAccessibilityFeatures(int32_t flags) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -677,7 +677,7 @@ void Shell::OnPlatformViewSetAccessibilityFeatures(int32_t flags) { }); } -// |shell::PlatformView::Delegate| +// |PlatformView::Delegate| void Shell::OnPlatformViewRegisterTexture( std::shared_ptr texture) { FML_DCHECK(is_setup_); @@ -693,7 +693,7 @@ void Shell::OnPlatformViewRegisterTexture( }); } -// |shell::PlatformView::Delegate| +// |PlatformView::Delegate| void Shell::OnPlatformViewUnregisterTexture(int64_t texture_id) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -708,7 +708,7 @@ void Shell::OnPlatformViewUnregisterTexture(int64_t texture_id) { }); } -// |shell::PlatformView::Delegate| +// |PlatformView::Delegate| void Shell::OnPlatformViewMarkTextureFrameAvailable(int64_t texture_id) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -739,7 +739,7 @@ void Shell::OnPlatformViewMarkTextureFrameAvailable(int64_t texture_id) { }); } -// |shell::PlatformView::Delegate| +// |PlatformView::Delegate| void Shell::OnPlatformViewSetNextFrameCallback(fml::closure closure) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -752,7 +752,7 @@ void Shell::OnPlatformViewSetNextFrameCallback(fml::closure closure) { }); } -// |shell::Animator::Delegate| +// |Animator::Delegate| void Shell::OnAnimatorBeginFrame(fml::TimePoint frame_time) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); @@ -762,7 +762,7 @@ void Shell::OnAnimatorBeginFrame(fml::TimePoint frame_time) { } } -// |shell::Animator::Delegate| +// |Animator::Delegate| void Shell::OnAnimatorNotifyIdle(int64_t deadline) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); @@ -772,7 +772,7 @@ void Shell::OnAnimatorNotifyIdle(int64_t deadline) { } } -// |shell::Animator::Delegate| +// |Animator::Delegate| void Shell::OnAnimatorDraw( fml::RefPtr> pipeline) { FML_DCHECK(is_setup_); @@ -786,7 +786,7 @@ void Shell::OnAnimatorDraw( }); } -// |shell::Animator::Delegate| +// |Animator::Delegate| void Shell::OnAnimatorDrawLastLayerTree() { FML_DCHECK(is_setup_); @@ -798,7 +798,7 @@ void Shell::OnAnimatorDrawLastLayerTree() { }); } -// |shell::Engine::Delegate| +// |Engine::Delegate| void Shell::OnEngineUpdateSemantics( flutter::SemanticsNodeUpdates update, flutter::CustomAccessibilityActionUpdates actions) { @@ -814,7 +814,7 @@ void Shell::OnEngineUpdateSemantics( }); } -// |shell::Engine::Delegate| +// |Engine::Delegate| void Shell::OnEngineHandlePlatformMessage( fml::RefPtr message) { FML_DCHECK(is_setup_); @@ -858,7 +858,7 @@ void Shell::HandleEngineSkiaMessage( }); } -// |shell::Engine::Delegate| +// |Engine::Delegate| void Shell::OnPreEngineRestart() { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); @@ -877,7 +877,7 @@ void Shell::OnPreEngineRestart() { latch.Wait(); } -// |shell::Engine::Delegate| +// |Engine::Delegate| void Shell::UpdateIsolateDescription(const std::string isolate_name, int64_t isolate_port) { Handler::Description description(isolate_port, isolate_name); @@ -1136,4 +1136,4 @@ Rasterizer::Screenshot Shell::Screenshot( return screenshot; } -} // namespace shell +} // namespace flutter diff --git a/shell/common/shell.h b/shell/common/shell.h index 01f166846d89f..63006e079543e 100644 --- a/shell/common/shell.h +++ b/shell/common/shell.h @@ -27,12 +27,12 @@ #include "flutter/runtime/service_protocol.h" #include "flutter/shell/common/animator.h" #include "flutter/shell/common/engine.h" -#include "flutter/shell/common/io_manager.h" #include "flutter/shell/common/platform_view.h" #include "flutter/shell/common/rasterizer.h" +#include "flutter/shell/common/shell_io_manager.h" #include "flutter/shell/common/surface.h" -namespace shell { +namespace flutter { class Shell final : public PlatformView::Delegate, public Animator::Delegate, @@ -91,7 +91,7 @@ class Shell final : public PlatformView::Delegate, std::unique_ptr platform_view_; // on platform task runner std::unique_ptr engine_; // on UI task runner std::unique_ptr rasterizer_; // on GPU task runner - std::unique_ptr io_manager_; // on IO task runner + std::unique_ptr io_manager_; // on IO task runner std::unordered_map, @@ -119,79 +119,79 @@ class Shell final : public PlatformView::Delegate, bool Setup(std::unique_ptr platform_view, std::unique_ptr engine, std::unique_ptr rasterizer, - std::unique_ptr io_manager); + std::unique_ptr io_manager); - // |shell::PlatformView::Delegate| + // |PlatformView::Delegate| void OnPlatformViewCreated(std::unique_ptr surface) override; - // |shell::PlatformView::Delegate| + // |PlatformView::Delegate| void OnPlatformViewDestroyed() override; - // |shell::PlatformView::Delegate| + // |PlatformView::Delegate| void OnPlatformViewSetViewportMetrics( const flutter::ViewportMetrics& metrics) override; - // |shell::PlatformView::Delegate| + // |PlatformView::Delegate| void OnPlatformViewDispatchPlatformMessage( fml::RefPtr message) override; - // |shell::PlatformView::Delegate| + // |PlatformView::Delegate| void OnPlatformViewDispatchPointerDataPacket( std::unique_ptr packet) override; - // |shell::PlatformView::Delegate| + // |PlatformView::Delegate| void OnPlatformViewDispatchSemanticsAction( int32_t id, flutter::SemanticsAction action, std::vector args) override; - // |shell::PlatformView::Delegate| + // |PlatformView::Delegate| void OnPlatformViewSetSemanticsEnabled(bool enabled) override; // |shell:PlatformView::Delegate| void OnPlatformViewSetAccessibilityFeatures(int32_t flags) override; - // |shell::PlatformView::Delegate| + // |PlatformView::Delegate| void OnPlatformViewRegisterTexture( std::shared_ptr texture) override; - // |shell::PlatformView::Delegate| + // |PlatformView::Delegate| void OnPlatformViewUnregisterTexture(int64_t texture_id) override; - // |shell::PlatformView::Delegate| + // |PlatformView::Delegate| void OnPlatformViewMarkTextureFrameAvailable(int64_t texture_id) override; - // |shell::PlatformView::Delegate| + // |PlatformView::Delegate| void OnPlatformViewSetNextFrameCallback(fml::closure closure) override; - // |shell::Animator::Delegate| + // |Animator::Delegate| void OnAnimatorBeginFrame(fml::TimePoint frame_time) override; - // |shell::Animator::Delegate| + // |Animator::Delegate| void OnAnimatorNotifyIdle(int64_t deadline) override; - // |shell::Animator::Delegate| + // |Animator::Delegate| void OnAnimatorDraw( fml::RefPtr> pipeline) override; - // |shell::Animator::Delegate| + // |Animator::Delegate| void OnAnimatorDrawLastLayerTree() override; - // |shell::Engine::Delegate| + // |Engine::Delegate| void OnEngineUpdateSemantics( flutter::SemanticsNodeUpdates update, flutter::CustomAccessibilityActionUpdates actions) override; - // |shell::Engine::Delegate| + // |Engine::Delegate| void OnEngineHandlePlatformMessage( fml::RefPtr message) override; void HandleEngineSkiaMessage(fml::RefPtr message); - // |shell::Engine::Delegate| + // |Engine::Delegate| void OnPreEngineRestart() override; - // |shell::Engine::Delegate| + // |Engine::Delegate| void UpdateIsolateDescription(const std::string isolate_name, int64_t isolate_port) override; @@ -242,6 +242,6 @@ class Shell final : public PlatformView::Delegate, FML_DISALLOW_COPY_AND_ASSIGN(Shell); }; -} // namespace shell +} // namespace flutter #endif // SHELL_COMMON_SHELL_H_ diff --git a/shell/common/shell_benchmarks.cc b/shell/common/shell_benchmarks.cc index 645344e37d3ff..80b255162eecc 100644 --- a/shell/common/shell_benchmarks.cc +++ b/shell/common/shell_benchmarks.cc @@ -7,7 +7,7 @@ #include "flutter/shell/common/shell.h" #include "flutter/shell/common/thread_host.h" -namespace shell { +namespace flutter { static void StartupAndShutdownShell(benchmark::State& state, bool measure_startup, @@ -77,4 +77,4 @@ static void BM_ShellInitializationAndShutdown(benchmark::State& state) { BENCHMARK(BM_ShellInitializationAndShutdown); -} // namespace shell +} // namespace flutter diff --git a/shell/common/io_manager.cc b/shell/common/shell_io_manager.cc similarity index 82% rename from shell/common/io_manager.cc rename to shell/common/shell_io_manager.cc index a0172e1084253..2ca9cb25a1f8b 100644 --- a/shell/common/io_manager.cc +++ b/shell/common/shell_io_manager.cc @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/shell/common/io_manager.h" +#include "flutter/shell/common/shell_io_manager.h" #include "flutter/fml/message_loop.h" #include "flutter/shell/common/persistent_cache.h" #include "third_party/skia/include/gpu/gl/GrGLInterface.h" -namespace shell { +namespace flutter { -sk_sp IOManager::CreateCompatibleResourceLoadingContext( +sk_sp ShellIOManager::CreateCompatibleResourceLoadingContext( GrBackend backend, sk_sp gl_interface) { if (backend != GrBackend::kOpenGL_GrBackend) { @@ -42,8 +42,9 @@ sk_sp IOManager::CreateCompatibleResourceLoadingContext( return nullptr; } -IOManager::IOManager(sk_sp resource_context, - fml::RefPtr unref_queue_task_runner) +ShellIOManager::ShellIOManager( + sk_sp resource_context, + fml::RefPtr unref_queue_task_runner) : resource_context_(std::move(resource_context)), resource_context_weak_factory_( resource_context_ ? std::make_unique>( @@ -62,19 +63,19 @@ IOManager::IOManager(sk_sp resource_context, } } -IOManager::~IOManager() { +ShellIOManager::~ShellIOManager() { // Last chance to drain the IO queue as the platform side reference to the // underlying OpenGL context may be going away. unref_queue_->Drain(); } -fml::WeakPtr IOManager::GetResourceContext() const { +fml::WeakPtr ShellIOManager::GetResourceContext() const { return resource_context_weak_factory_ ? resource_context_weak_factory_->GetWeakPtr() : fml::WeakPtr(); } -void IOManager::NotifyResourceContextAvailable( +void ShellIOManager::NotifyResourceContextAvailable( sk_sp resource_context) { // The resource context needs to survive as long as we have Dart objects // referencing. We shouldn't ever need to replace it if we have one - unless @@ -84,7 +85,7 @@ void IOManager::NotifyResourceContextAvailable( } } -void IOManager::UpdateResourceContext(sk_sp resource_context) { +void ShellIOManager::UpdateResourceContext(sk_sp resource_context) { resource_context_ = std::move(resource_context); resource_context_weak_factory_ = resource_context_ ? std::make_unique>( @@ -92,11 +93,11 @@ void IOManager::UpdateResourceContext(sk_sp resource_context) { : nullptr; } -fml::RefPtr IOManager::GetSkiaUnrefQueue() const { +fml::RefPtr ShellIOManager::GetSkiaUnrefQueue() const { return unref_queue_; } -fml::WeakPtr IOManager::GetWeakPtr() { +fml::WeakPtr ShellIOManager::GetWeakPtr() { return weak_factory_.GetWeakPtr(); } -} // namespace shell +} // namespace flutter diff --git a/shell/common/io_manager.h b/shell/common/shell_io_manager.h similarity index 76% rename from shell/common/io_manager.h rename to shell/common/shell_io_manager.h index ed6bbd0311e5a..49a93899c52ef 100644 --- a/shell/common/io_manager.h +++ b/shell/common/shell_io_manager.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_SHELL_COMMON_IO_MANAGER_H_ -#define FLUTTER_SHELL_COMMON_IO_MANAGER_H_ +#ifndef FLUTTER_SHELL_COMMON_SHELL_IO_MANAGER_H_ +#define FLUTTER_SHELL_COMMON_SHELL_IO_MANAGER_H_ #include @@ -13,9 +13,9 @@ #include "flutter/lib/ui/io_manager.h" #include "third_party/skia/include/gpu/GrContext.h" -namespace shell { +namespace flutter { -class IOManager : public flutter::IOManager { +class ShellIOManager final : public IOManager { public: // Convenience methods for platforms to create a GrContext used to supply to // the IOManager. The platforms may create the context themselves if they so @@ -24,10 +24,10 @@ class IOManager : public flutter::IOManager { GrBackend backend, sk_sp gl_interface); - IOManager(sk_sp resource_context, - fml::RefPtr unref_queue_task_runner); + ShellIOManager(sk_sp resource_context, + fml::RefPtr unref_queue_task_runner); - virtual ~IOManager(); + ~ShellIOManager() override; fml::WeakPtr GetResourceContext() const override; @@ -44,7 +44,7 @@ class IOManager : public flutter::IOManager { fml::RefPtr GetSkiaUnrefQueue() const override; - fml::WeakPtr GetWeakPtr(); + fml::WeakPtr GetWeakPtr(); private: // Resource context management. @@ -55,11 +55,11 @@ class IOManager : public flutter::IOManager { // Unref queue management. fml::RefPtr unref_queue_; - fml::WeakPtrFactory weak_factory_; + fml::WeakPtrFactory weak_factory_; - FML_DISALLOW_COPY_AND_ASSIGN(IOManager); + FML_DISALLOW_COPY_AND_ASSIGN(ShellIOManager); }; -} // namespace shell +} // namespace flutter -#endif // FLUTTER_SHELL_COMMON_IO_MANAGER_H_ +#endif // FLUTTER_SHELL_COMMON_SHELL_IO_MANAGER_H_ diff --git a/shell/common/shell_test.cc b/shell/common/shell_test.cc index a32a524428b39..94e6d8590859f 100644 --- a/shell/common/shell_test.cc +++ b/shell/common/shell_test.cc @@ -10,7 +10,7 @@ #include "flutter/runtime/dart_vm.h" #include "flutter/testing/testing.h" -namespace shell { +namespace flutter { namespace testing { ShellTest::ShellTest() @@ -130,4 +130,4 @@ void ShellTest::AddNativeCallback(std::string name, } } // namespace testing -} // namespace shell +} // namespace flutter diff --git a/shell/common/shell_test.h b/shell/common/shell_test.h index 38c28d1756c8b..a813049bc2c63 100644 --- a/shell/common/shell_test.h +++ b/shell/common/shell_test.h @@ -14,7 +14,7 @@ #include "flutter/testing/test_dart_native_resolver.h" #include "flutter/testing/thread_test.h" -namespace shell { +namespace flutter { namespace testing { class ShellTest : public ::testing::ThreadTest { @@ -45,6 +45,6 @@ class ShellTest : public ::testing::ThreadTest { }; } // namespace testing -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_COMMON_SHELL_TEST_H_ diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc index 333a8f3354173..5be39eea106fc 100644 --- a/shell/common/shell_unittests.cc +++ b/shell/common/shell_unittests.cc @@ -20,7 +20,7 @@ #include "flutter/testing/testing.h" #include "gtest/gtest.h" -namespace shell { +namespace flutter { namespace testing { class TestPlatformView : public PlatformView, @@ -244,4 +244,4 @@ TEST_F(ShellTest, FixturesAreFunctional) { } } // namespace testing -} // namespace shell +} // namespace flutter diff --git a/shell/common/skia_event_tracer_impl.cc b/shell/common/skia_event_tracer_impl.cc index b04bfb36bc4f5..a44a39b214e68 100644 --- a/shell/common/skia_event_tracer_impl.cc +++ b/shell/common/skia_event_tracer_impl.cc @@ -13,7 +13,7 @@ #include "third_party/skia/include/utils/SkEventTracer.h" #include "third_party/skia/include/utils/SkTraceEventPhase.h" -namespace skia { +namespace flutter { class FlutterEventTracer : public SkEventTracer { public: @@ -120,14 +120,15 @@ bool enableSkiaTracingCallback(const char* method, return true; } -} // namespace skia - void InitSkiaEventTracer(bool enabled) { - skia::FlutterEventTracer* tracer = new skia::FlutterEventTracer(enabled); + // TODO(chinmaygarde): Leaked https://github.com/flutter/flutter/issues/30808. + auto tracer = new FlutterEventTracer(enabled); Dart_RegisterRootServiceRequestCallback("_flutter.enableSkiaTracing", - skia::enableSkiaTracingCallback, + enableSkiaTracingCallback, static_cast(tracer)); // Initialize the binding to Skia's tracing events. Skia will // take ownership of and clean up the memory allocated here. SkEventTracer::SetInstance(tracer); } + +} // namespace flutter diff --git a/shell/common/skia_event_tracer_impl.h b/shell/common/skia_event_tracer_impl.h index 12e2fc41dee85..02f4e25d17a9f 100644 --- a/shell/common/skia_event_tracer_impl.h +++ b/shell/common/skia_event_tracer_impl.h @@ -5,6 +5,10 @@ #ifndef FLUTTER_SHELL_COMMON_SKIA_EVENT_TRACER_IMPL_H_ #define FLUTTER_SHELL_COMMON_SKIA_EVENT_TRACER_IMPL_H_ +namespace flutter { + void InitSkiaEventTracer(bool enabled); +} // namespace flutter + #endif // FLUTTER_SHELL_COMMON_SKIA_EVENT_TRACER_IMPL_H_ diff --git a/shell/common/surface.cc b/shell/common/surface.cc index b1134acc1b03b..ce33431100294 100644 --- a/shell/common/surface.cc +++ b/shell/common/surface.cc @@ -7,7 +7,7 @@ #include "flutter/fml/logging.h" #include "third_party/skia/include/core/SkSurface.h" -namespace shell { +namespace flutter { SurfaceFrame::SurfaceFrame(sk_sp surface, SubmitCallback submit_callback) @@ -64,4 +64,4 @@ bool Surface::MakeRenderContextCurrent() { return true; } -} // namespace shell +} // namespace flutter diff --git a/shell/common/surface.h b/shell/common/surface.h index dc37c803d9ce9..f3c5db8bb4fc3 100644 --- a/shell/common/surface.h +++ b/shell/common/surface.h @@ -12,7 +12,7 @@ #include "flutter/fml/macros.h" #include "third_party/skia/include/core/SkCanvas.h" -namespace shell { +namespace flutter { /// Represents a Frame that has been fully configured for the underlying client /// rendering API. A frame may only be submitted once. @@ -63,6 +63,6 @@ class Surface { FML_DISALLOW_COPY_AND_ASSIGN(Surface); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_COMMON_SURFACE_H_ diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 68c1c90f119b1..f3685c76decad 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -20,7 +20,7 @@ #undef SHELL_COMMON_SWITCHES_H_ struct SwitchDesc { - shell::Switch sw; + flutter::Switch sw; const fml::StringView flag; const char* help; }; @@ -32,14 +32,14 @@ struct SwitchDesc { // clang-format off #define DEF_SWITCHES_START static const struct SwitchDesc gSwitchDescs[] = { #define DEF_SWITCH(p_swtch, p_flag, p_help) \ - { shell::Switch:: p_swtch, p_flag, p_help }, + { flutter::Switch:: p_swtch, p_flag, p_help }, #define DEF_SWITCHES_END }; // clang-format on // Include again for struct definition. #include "flutter/shell/common/switches.h" -namespace shell { +namespace flutter { void PrintUsage(const std::string& executable_name) { std::cerr << std::endl << " " << executable_name << std::endl << std::endl; @@ -105,11 +105,11 @@ const fml::StringView FlagForSwitch(Switch swtch) { template static bool GetSwitchValue(const fml::CommandLine& command_line, - shell::Switch sw, + Switch sw, T* result) { std::string switch_string; - if (!command_line.GetOptionValue(shell::FlagForSwitch(sw), &switch_string)) { + if (!command_line.GetOptionValue(FlagForSwitch(sw), &switch_string)) { return false; } @@ -283,4 +283,4 @@ flutter::Settings SettingsFromCommandLine( return settings; } -} // namespace shell +} // namespace flutter diff --git a/shell/common/switches.h b/shell/common/switches.h index 2939b92dacad3..be7d887ad22b0 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -9,7 +9,7 @@ #ifndef SHELL_COMMON_SWITCHES_H_ #define SHELL_COMMON_SWITCHES_H_ -namespace shell { +namespace flutter { // clang-format off #ifndef DEF_SWITCHES_START @@ -150,6 +150,6 @@ const fml::StringView FlagForSwitch(Switch swtch); flutter::Settings SettingsFromCommandLine(const fml::CommandLine& command_line); -} // namespace shell +} // namespace flutter #endif // SHELL_COMMON_SWITCHES_H_ diff --git a/shell/common/thread_host.cc b/shell/common/thread_host.cc index d8a2a73006eb4..0ab677a76b7bd 100644 --- a/shell/common/thread_host.cc +++ b/shell/common/thread_host.cc @@ -4,7 +4,7 @@ #include "flutter/shell/common/thread_host.h" -namespace shell { +namespace flutter { ThreadHost::ThreadHost() = default; @@ -37,4 +37,4 @@ void ThreadHost::Reset() { io_thread.reset(); } -} // namespace shell +} // namespace flutter diff --git a/shell/common/thread_host.h b/shell/common/thread_host.h index 9e09603095644..93f42a90861e8 100644 --- a/shell/common/thread_host.h +++ b/shell/common/thread_host.h @@ -10,7 +10,7 @@ #include "flutter/fml/macros.h" #include "flutter/fml/thread.h" -namespace shell { +namespace flutter { struct ThreadHost { enum Type { @@ -38,6 +38,6 @@ struct ThreadHost { void Reset(); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_COMMON_THREAD_HOST_H_ diff --git a/shell/common/vsync_waiter.cc b/shell/common/vsync_waiter.cc index 49f45e9d6d8b6..1e01dfd57015e 100644 --- a/shell/common/vsync_waiter.cc +++ b/shell/common/vsync_waiter.cc @@ -7,7 +7,7 @@ #include "flutter/fml/task_runner.h" #include "flutter/fml/trace_event.h" -namespace shell { +namespace flutter { #if defined(OS_FUCHSIA) // In general, traces on Fuchsia are recorded across the whole system. @@ -94,4 +94,4 @@ float VsyncWaiter::GetDisplayRefreshRate() const { return kUnknownRefreshRateFPS; } -} // namespace shell +} // namespace flutter diff --git a/shell/common/vsync_waiter.h b/shell/common/vsync_waiter.h index 50fb6b275649e..08c5be14e9934 100644 --- a/shell/common/vsync_waiter.h +++ b/shell/common/vsync_waiter.h @@ -13,7 +13,7 @@ #include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/time/time_point.h" -namespace shell { +namespace flutter { class VsyncWaiter : public std::enable_shared_from_this { public: @@ -56,6 +56,6 @@ class VsyncWaiter : public std::enable_shared_from_this { FML_DISALLOW_COPY_AND_ASSIGN(VsyncWaiter); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_COMMON_VSYNC_WAITER_H_ diff --git a/shell/common/vsync_waiter_fallback.cc b/shell/common/vsync_waiter_fallback.cc index d8cbc6cdd4245..5805da0dc4945 100644 --- a/shell/common/vsync_waiter_fallback.cc +++ b/shell/common/vsync_waiter_fallback.cc @@ -6,7 +6,7 @@ #include "flutter/fml/logging.h" -namespace shell { +namespace flutter { namespace { static fml::TimePoint SnapToNextTick(fml::TimePoint value, @@ -25,7 +25,7 @@ VsyncWaiterFallback::VsyncWaiterFallback(flutter::TaskRunners task_runners) VsyncWaiterFallback::~VsyncWaiterFallback() = default; -// |shell::VsyncWaiter| +// |VsyncWaiter| void VsyncWaiterFallback::AwaitVSync() { constexpr fml::TimeDelta kSingleFrameInterval = fml::TimeDelta::FromSecondsF(1.0 / 60.0); @@ -36,4 +36,4 @@ void VsyncWaiterFallback::AwaitVSync() { FireCallback(next, next + kSingleFrameInterval); } -} // namespace shell +} // namespace flutter diff --git a/shell/common/vsync_waiter_fallback.h b/shell/common/vsync_waiter_fallback.h index 17ee2043e93c0..c17ee740487c3 100644 --- a/shell/common/vsync_waiter_fallback.h +++ b/shell/common/vsync_waiter_fallback.h @@ -10,7 +10,7 @@ #include "flutter/fml/time/time_point.h" #include "flutter/shell/common/vsync_waiter.h" -namespace shell { +namespace flutter { class VsyncWaiterFallback final : public VsyncWaiter { public: @@ -21,12 +21,12 @@ class VsyncWaiterFallback final : public VsyncWaiter { private: fml::TimePoint phase_; - // |shell::VsyncWaiter| + // |VsyncWaiter| void AwaitVSync() override; FML_DISALLOW_COPY_AND_ASSIGN(VsyncWaiterFallback); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_COMMON_VSYNC_WAITER_FALLBACK_H_ diff --git a/shell/gpu/gpu_surface_gl.cc b/shell/gpu/gpu_surface_gl.cc index b6248fda4c5f4..98011dfc72d4e 100644 --- a/shell/gpu/gpu_surface_gl.cc +++ b/shell/gpu/gpu_surface_gl.cc @@ -21,7 +21,7 @@ #define GPU_GL_RGBA4 0x8056 #define GPU_GL_RGB565 0x8D62 -namespace shell { +namespace flutter { // Default maximum number of budgeted resources in the cache. static const int kGrCacheMaxCount = 8192; @@ -104,7 +104,7 @@ GPUSurfaceGL::~GPUSurfaceGL() { delegate_->GLContextClearCurrent(); } -// |shell::Surface| +// |Surface| bool GPUSurfaceGL::IsValid() { return valid_; } @@ -216,12 +216,12 @@ bool GPUSurfaceGL::CreateOrUpdateSurfaces(const SkISize& size) { return true; } -// |shell::Surface| +// |Surface| SkMatrix GPUSurfaceGL::GetRootTransformation() const { return delegate_->GLContextSurfaceTransformation(); } -// |shell::Surface| +// |Surface| std::unique_ptr GPUSurfaceGL::AcquireFrame(const SkISize& size) { if (delegate_ == nullptr) { return nullptr; @@ -314,19 +314,19 @@ sk_sp GPUSurfaceGL::AcquireRenderSurface( return offscreen_surface_ != nullptr ? offscreen_surface_ : onscreen_surface_; } -// |shell::Surface| +// |Surface| GrContext* GPUSurfaceGL::GetContext() { return context_.get(); } -// |shell::Surface| +// |Surface| flow::ExternalViewEmbedder* GPUSurfaceGL::GetExternalViewEmbedder() { return delegate_->GetExternalViewEmbedder(); } -// |shell::Surface| +// |Surface| bool GPUSurfaceGL::MakeRenderContextCurrent() { return delegate_->GLContextMakeCurrent(); } -} // namespace shell +} // namespace flutter diff --git a/shell/gpu/gpu_surface_gl.h b/shell/gpu/gpu_surface_gl.h index d9f85acedd365..2c8e9afc6fe69 100644 --- a/shell/gpu/gpu_surface_gl.h +++ b/shell/gpu/gpu_surface_gl.h @@ -15,7 +15,7 @@ #include "flutter/shell/gpu/gpu_surface_gl_delegate.h" #include "third_party/skia/include/gpu/GrContext.h" -namespace shell { +namespace flutter { class GPUSurfaceGL : public Surface { public: @@ -26,22 +26,22 @@ class GPUSurfaceGL : public Surface { ~GPUSurfaceGL() override; - // |shell::Surface| + // |Surface| bool IsValid() override; - // |shell::Surface| + // |Surface| std::unique_ptr AcquireFrame(const SkISize& size) override; - // |shell::Surface| + // |Surface| SkMatrix GetRootTransformation() const override; - // |shell::Surface| + // |Surface| GrContext* GetContext() override; - // |shell::Surface| + // |Surface| flow::ExternalViewEmbedder* GetExternalViewEmbedder() override; - // |shell::Surface| + // |Surface| bool MakeRenderContextCurrent() override; private: @@ -64,6 +64,6 @@ class GPUSurfaceGL : public Surface { FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceGL); }; -} // namespace shell +} // namespace flutter #endif // SHELL_GPU_GPU_SURFACE_GL_H_ diff --git a/shell/gpu/gpu_surface_gl_delegate.cc b/shell/gpu/gpu_surface_gl_delegate.cc index 1447a3de72a50..92f30039aab95 100644 --- a/shell/gpu/gpu_surface_gl_delegate.cc +++ b/shell/gpu/gpu_surface_gl_delegate.cc @@ -6,7 +6,7 @@ #include "third_party/skia/include/gpu/gl/GrGLAssembleInterface.h" -namespace shell { +namespace flutter { bool GPUSurfaceGLDelegate::GLContextFBOResetAfterPresent() const { return false; @@ -66,9 +66,7 @@ static sk_sp CreateGLInterface( GPUSurfaceGLDelegate::GLProcResolver resolver; }; - ProcResolverContext context = { - proc_resolver - }; + ProcResolverContext context = {proc_resolver}; GrGLGetProc gl_get_proc = [](void* context, const char gl_proc_name[]) -> GrGLFuncPtr { @@ -101,4 +99,4 @@ GPUSurfaceGLDelegate::GetDefaultPlatformGLInterface() { return CreateGLInterface(nullptr); } -} // namespace shell +} // namespace flutter diff --git a/shell/gpu/gpu_surface_gl_delegate.h b/shell/gpu/gpu_surface_gl_delegate.h index b290ae63e5950..0a8b9d5eca80f 100644 --- a/shell/gpu/gpu_surface_gl_delegate.h +++ b/shell/gpu/gpu_surface_gl_delegate.h @@ -10,7 +10,7 @@ #include "third_party/skia/include/core/SkMatrix.h" #include "third_party/skia/include/gpu/gl/GrGLInterface.h" -namespace shell { +namespace flutter { class GPUSurfaceGLDelegate { public: @@ -64,6 +64,6 @@ class GPUSurfaceGLDelegate { virtual GLProcResolver GetGLProcResolver() const; }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_GPU_GPU_SURFACE_GL_DELEGATE_H_ diff --git a/shell/gpu/gpu_surface_software.cc b/shell/gpu/gpu_surface_software.cc index cea507c67bf01..78fba54919050 100644 --- a/shell/gpu/gpu_surface_software.cc +++ b/shell/gpu/gpu_surface_software.cc @@ -7,7 +7,7 @@ #include #include "flutter/fml/logging.h" -namespace shell { +namespace flutter { flow::ExternalViewEmbedder* GPUSurfaceSoftwareDelegate::GetExternalViewEmbedder() { @@ -19,12 +19,12 @@ GPUSurfaceSoftware::GPUSurfaceSoftware(GPUSurfaceSoftwareDelegate* delegate) GPUSurfaceSoftware::~GPUSurfaceSoftware() = default; -// |shell::Surface| +// |Surface| bool GPUSurfaceSoftware::IsValid() { return delegate_ != nullptr; } -// |shell::Surface| +// |Surface| std::unique_ptr GPUSurfaceSoftware::AcquireFrame( const SkISize& logical_size) { if (!IsValid()) { @@ -65,7 +65,7 @@ std::unique_ptr GPUSurfaceSoftware::AcquireFrame( return std::make_unique(backing_store, on_submit); } -// |shell::Surface| +// |Surface| SkMatrix GPUSurfaceSoftware::GetRootTransformation() const { // This backend does not currently support root surface transformations. Just // return identity. @@ -74,15 +74,15 @@ SkMatrix GPUSurfaceSoftware::GetRootTransformation() const { return matrix; } -// |shell::Surface| +// |Surface| GrContext* GPUSurfaceSoftware::GetContext() { // There is no GrContext associated with a software surface. return nullptr; } -// |shell::Surface| +// |Surface| flow::ExternalViewEmbedder* GPUSurfaceSoftware::GetExternalViewEmbedder() { return delegate_->GetExternalViewEmbedder(); } -} // namespace shell +} // namespace flutter diff --git a/shell/gpu/gpu_surface_software.h b/shell/gpu/gpu_surface_software.h index eb64920a33630..f544fd111da63 100644 --- a/shell/gpu/gpu_surface_software.h +++ b/shell/gpu/gpu_surface_software.h @@ -11,7 +11,7 @@ #include "flutter/shell/common/surface.h" #include "third_party/skia/include/core/SkSurface.h" -namespace shell { +namespace flutter { class GPUSurfaceSoftwareDelegate { public: @@ -28,19 +28,19 @@ class GPUSurfaceSoftware : public Surface { ~GPUSurfaceSoftware() override; - // |shell::Surface| + // |Surface| bool IsValid() override; - // |shell::Surface| + // |Surface| std::unique_ptr AcquireFrame(const SkISize& size) override; - // |shell::Surface| + // |Surface| SkMatrix GetRootTransformation() const override; - // |shell::Surface| + // |Surface| GrContext* GetContext() override; - // |shell::Surface| + // |Surface| flow::ExternalViewEmbedder* GetExternalViewEmbedder() override; private: @@ -50,6 +50,6 @@ class GPUSurfaceSoftware : public Surface { FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceSoftware); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_H_ diff --git a/shell/gpu/gpu_surface_vulkan.cc b/shell/gpu/gpu_surface_vulkan.cc index 3c42bf0876adc..fbc9696b15d52 100644 --- a/shell/gpu/gpu_surface_vulkan.cc +++ b/shell/gpu/gpu_surface_vulkan.cc @@ -5,7 +5,7 @@ #include "flutter/shell/gpu/gpu_surface_vulkan.h" #include "flutter/fml/logging.h" -namespace shell { +namespace flutter { GPUSurfaceVulkan::GPUSurfaceVulkan( fml::RefPtr proc_table, @@ -15,12 +15,12 @@ GPUSurfaceVulkan::GPUSurfaceVulkan( GPUSurfaceVulkan::~GPUSurfaceVulkan() = default; -// |shell::Surface| +// |Surface| bool GPUSurfaceVulkan::IsValid() { return window_.IsValid(); } -// |shell::Surface| +// |Surface| std::unique_ptr GPUSurfaceVulkan::AcquireFrame( const SkISize& size) { auto surface = window_.AcquireSurface(); @@ -44,7 +44,7 @@ std::unique_ptr GPUSurfaceVulkan::AcquireFrame( std::move(callback)); } -// |shell::Surface| +// |Surface| SkMatrix GPUSurfaceVulkan::GetRootTransformation() const { // This backend does not support delegating to the underlying platform to // query for root surface transformations. Just return identity. @@ -53,9 +53,9 @@ SkMatrix GPUSurfaceVulkan::GetRootTransformation() const { return matrix; } -// |shell::Surface| +// |Surface| GrContext* GPUSurfaceVulkan::GetContext() { return window_.GetSkiaGrContext(); } -} // namespace shell +} // namespace flutter diff --git a/shell/gpu/gpu_surface_vulkan.h b/shell/gpu/gpu_surface_vulkan.h index ece0cbb81b97c..7c410dd526cf7 100644 --- a/shell/gpu/gpu_surface_vulkan.h +++ b/shell/gpu/gpu_surface_vulkan.h @@ -13,7 +13,7 @@ #include "flutter/vulkan/vulkan_native_surface.h" #include "flutter/vulkan/vulkan_window.h" -namespace shell { +namespace flutter { class GPUSurfaceVulkan : public Surface { public: @@ -22,16 +22,16 @@ class GPUSurfaceVulkan : public Surface { ~GPUSurfaceVulkan() override; - // |shell::Surface| + // |Surface| bool IsValid() override; - // |shell::Surface| + // |Surface| std::unique_ptr AcquireFrame(const SkISize& size) override; - // |shell::Surface| + // |Surface| SkMatrix GetRootTransformation() const override; - // |shell::Surface| + // |Surface| GrContext* GetContext() override; private: @@ -41,6 +41,6 @@ class GPUSurfaceVulkan : public Surface { FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceVulkan); }; -} // namespace shell +} // namespace flutter #endif // SHELL_GPU_GPU_SURFACE_VULKAN_H_ diff --git a/shell/platform/android/android_context_gl.cc b/shell/platform/android/android_context_gl.cc index 8ac43b4031a48..d3fd715a38abc 100644 --- a/shell/platform/android/android_context_gl.cc +++ b/shell/platform/android/android_context_gl.cc @@ -10,7 +10,7 @@ #include "flutter/fml/trace_event.h" -namespace shell { +namespace flutter { template using EGLResult = std::pair; @@ -272,4 +272,4 @@ bool AndroidContextGL::Resize(const SkISize& size) { return true; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/android/android_context_gl.h b/shell/platform/android/android_context_gl.h index e29dc7ac4f69d..50e15aba2ed4f 100644 --- a/shell/platform/android/android_context_gl.h +++ b/shell/platform/android/android_context_gl.h @@ -13,7 +13,7 @@ #include "flutter/shell/platform/android/android_native_window.h" #include "third_party/skia/include/core/SkSize.h" -namespace shell { +namespace flutter { class AndroidContextGL : public fml::RefCountedThreadSafe { public: @@ -53,6 +53,6 @@ class AndroidContextGL : public fml::RefCountedThreadSafe { FML_DISALLOW_COPY_AND_ASSIGN(AndroidContextGL); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_CONTEXT_GL_H_ diff --git a/shell/platform/android/android_environment_gl.cc b/shell/platform/android/android_environment_gl.cc index 3d9f919bb0110..a3259f1dcc229 100644 --- a/shell/platform/android/android_environment_gl.cc +++ b/shell/platform/android/android_environment_gl.cc @@ -4,7 +4,7 @@ #include "flutter/shell/platform/android/android_environment_gl.h" -namespace shell { +namespace flutter { AndroidEnvironmentGL::AndroidEnvironmentGL() : display_(EGL_NO_DISPLAY), valid_(false) { @@ -38,4 +38,4 @@ EGLDisplay AndroidEnvironmentGL::Display() const { return display_; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/android/android_environment_gl.h b/shell/platform/android/android_environment_gl.h index 710064e75da12..23031a775d390 100644 --- a/shell/platform/android/android_environment_gl.h +++ b/shell/platform/android/android_environment_gl.h @@ -10,7 +10,7 @@ #include -namespace shell { +namespace flutter { class AndroidEnvironmentGL : public fml::RefCountedThreadSafe { @@ -35,6 +35,6 @@ class AndroidEnvironmentGL FML_DISALLOW_COPY_AND_ASSIGN(AndroidEnvironmentGL); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_ENVIRONMENT_GL_H_ diff --git a/shell/platform/android/android_external_texture_gl.cc b/shell/platform/android/android_external_texture_gl.cc index 0d21841338a37..bd38598b66bfb 100644 --- a/shell/platform/android/android_external_texture_gl.cc +++ b/shell/platform/android/android_external_texture_gl.cc @@ -9,7 +9,7 @@ #include "flutter/shell/platform/android/platform_view_android_jni.h" #include "third_party/skia/include/gpu/GrBackendSurface.h" -namespace shell { +namespace flutter { AndroidExternalTextureGL::AndroidExternalTextureGL( int64_t id, @@ -120,4 +120,4 @@ void AndroidExternalTextureGL::Detach() { } } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/android/android_external_texture_gl.h b/shell/platform/android/android_external_texture_gl.h index 09a56766e2a8f..7db744caae280 100644 --- a/shell/platform/android/android_external_texture_gl.h +++ b/shell/platform/android/android_external_texture_gl.h @@ -9,7 +9,7 @@ #include "flutter/flow/texture.h" #include "flutter/fml/platform/android/jni_weak_ref.h" -namespace shell { +namespace flutter { class AndroidExternalTextureGL : public flow::Texture { public: @@ -51,6 +51,6 @@ class AndroidExternalTextureGL : public flow::Texture { FML_DISALLOW_COPY_AND_ASSIGN(AndroidExternalTextureGL); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_ANDROID_EXTERNAL_TEXTURE_GL_H_ diff --git a/shell/platform/android/android_native_window.cc b/shell/platform/android/android_native_window.cc index af8b179d1b094..fac43fa89d45b 100644 --- a/shell/platform/android/android_native_window.cc +++ b/shell/platform/android/android_native_window.cc @@ -4,7 +4,7 @@ #include "flutter/shell/platform/android/android_native_window.h" -namespace shell { +namespace flutter { AndroidNativeWindow::AndroidNativeWindow(Handle window) : window_(window) {} @@ -29,4 +29,4 @@ SkISize AndroidNativeWindow::GetSize() const { ANativeWindow_getHeight(window_)); } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/android/android_native_window.h b/shell/platform/android/android_native_window.h index 04938c59630b8..7e9626d63d8ea 100644 --- a/shell/platform/android/android_native_window.h +++ b/shell/platform/android/android_native_window.h @@ -11,7 +11,7 @@ #include "flutter/fml/memory/ref_ptr.h" #include "third_party/skia/include/core/SkSize.h" -namespace shell { +namespace flutter { class AndroidNativeWindow : public fml::RefCountedThreadSafe { @@ -38,6 +38,6 @@ class AndroidNativeWindow FML_DISALLOW_COPY_AND_ASSIGN(AndroidNativeWindow); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_NATIVE_WINDOW_H_ diff --git a/shell/platform/android/android_shell_holder.cc b/shell/platform/android/android_shell_holder.cc index ca1dfd0ea7382..931d09b933fdc 100644 --- a/shell/platform/android/android_shell_holder.cc +++ b/shell/platform/android/android_shell_holder.cc @@ -19,7 +19,7 @@ #include "flutter/shell/common/rasterizer.h" #include "flutter/shell/platform/android/platform_view_android.h" -namespace shell { +namespace flutter { AndroidShellHolder::AndroidShellHolder( flutter::Settings settings, @@ -162,8 +162,8 @@ void AndroidShellHolder::Launch(RunConfiguration config) { config = std::move(config) // ]() mutable { FML_LOG(INFO) << "Attempting to launch engine configuration..."; - if (!engine || engine->Run(std::move(config)) == - shell::Engine::RunStatus::Failure) { + if (!engine || + engine->Run(std::move(config)) == Engine::RunStatus::Failure) { FML_LOG(ERROR) << "Could not launch engine in configuration."; } else { FML_LOG(INFO) << "Isolate for engine configuration successfully " @@ -220,4 +220,4 @@ fml::WeakPtr AndroidShellHolder::GetPlatformView() { return platform_view_; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/android/android_shell_holder.h b/shell/platform/android/android_shell_holder.h index 5e33dbc9724d0..6d123970fc89f 100644 --- a/shell/platform/android/android_shell_holder.h +++ b/shell/platform/android/android_shell_holder.h @@ -16,7 +16,7 @@ #include "flutter/shell/common/thread_host.h" #include "flutter/shell/platform/android/platform_view_android.h" -namespace shell { +namespace flutter { class AndroidShellHolder { public: @@ -59,6 +59,6 @@ class AndroidShellHolder { FML_DISALLOW_COPY_AND_ASSIGN(AndroidShellHolder); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SHELL_HOLDER_H_ diff --git a/shell/platform/android/android_surface.cc b/shell/platform/android/android_surface.cc index cb1ee518ab941..958570a822a8a 100644 --- a/shell/platform/android/android_surface.cc +++ b/shell/platform/android/android_surface.cc @@ -12,7 +12,7 @@ #include "flutter/shell/platform/android/android_surface_vulkan.h" #endif // SHELL_ENABLE_VULKAN -namespace shell { +namespace flutter { std::unique_ptr AndroidSurface::Create( bool use_software_rendering) { @@ -32,4 +32,4 @@ std::unique_ptr AndroidSurface::Create( AndroidSurface::~AndroidSurface() = default; -} // namespace shell +} // namespace flutter diff --git a/shell/platform/android/android_surface.h b/shell/platform/android/android_surface.h index 0ecc9ffc76bc1..43f4cf33d0d50 100644 --- a/shell/platform/android/android_surface.h +++ b/shell/platform/android/android_surface.h @@ -15,7 +15,7 @@ #include "flutter/shell/platform/android/android_native_window.h" #include "third_party/skia/include/core/SkSize.h" -namespace shell { +namespace flutter { class AndroidSurface { public: @@ -38,6 +38,6 @@ class AndroidSurface { virtual bool SetNativeWindow(fml::RefPtr window) = 0; }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_H_ diff --git a/shell/platform/android/android_surface_gl.cc b/shell/platform/android/android_surface_gl.cc index 83586b4030593..ff0e45fcef73c 100644 --- a/shell/platform/android/android_surface_gl.cc +++ b/shell/platform/android/android_surface_gl.cc @@ -9,7 +9,7 @@ #include "flutter/fml/logging.h" #include "flutter/fml/memory/ref_ptr.h" -namespace shell { +namespace flutter { static fml::RefPtr CreateResourceLoadingContext() { auto environment = fml::MakeRefCounted(); @@ -125,4 +125,4 @@ intptr_t AndroidSurfaceGL::GLContextFBO() const { return 0; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/android/android_surface_gl.h b/shell/platform/android/android_surface_gl.h index 5c6f4aa65eb73..7592ad5f8df3e 100644 --- a/shell/platform/android/android_surface_gl.h +++ b/shell/platform/android/android_surface_gl.h @@ -14,7 +14,7 @@ #include "flutter/shell/platform/android/android_environment_gl.h" #include "flutter/shell/platform/android/android_surface.h" -namespace shell { +namespace flutter { class AndroidSurfaceGL final : public GPUSurfaceGLDelegate, public AndroidSurface { @@ -25,37 +25,37 @@ class AndroidSurfaceGL final : public GPUSurfaceGLDelegate, bool IsOffscreenContextValid() const; - // |shell::AndroidSurface| + // |AndroidSurface| bool IsValid() const override; - // |shell::AndroidSurface| + // |AndroidSurface| std::unique_ptr CreateGPUSurface() override; - // |shell::AndroidSurface| + // |AndroidSurface| void TeardownOnScreenContext() override; - // |shell::AndroidSurface| + // |AndroidSurface| bool OnScreenSurfaceResize(const SkISize& size) const override; - // |shell::AndroidSurface| + // |AndroidSurface| bool ResourceContextMakeCurrent() override; - // |shell::AndroidSurface| + // |AndroidSurface| bool ResourceContextClearCurrent() override; - // |shell::AndroidSurface| + // |AndroidSurface| bool SetNativeWindow(fml::RefPtr window) override; - // |shell::GPUSurfaceGLDelegate| + // |GPUSurfaceGLDelegate| bool GLContextMakeCurrent() override; - // |shell::GPUSurfaceGLDelegate| + // |GPUSurfaceGLDelegate| bool GLContextClearCurrent() override; - // |shell::GPUSurfaceGLDelegate| + // |GPUSurfaceGLDelegate| bool GLContextPresent() override; - // |shell::GPUSurfaceGLDelegate| + // |GPUSurfaceGLDelegate| intptr_t GLContextFBO() const override; private: @@ -65,6 +65,6 @@ class AndroidSurfaceGL final : public GPUSurfaceGLDelegate, FML_DISALLOW_COPY_AND_ASSIGN(AndroidSurfaceGL); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_GL_H_ diff --git a/shell/platform/android/android_surface_software.cc b/shell/platform/android/android_surface_software.cc index c412e70f963d4..633b6091f0c15 100644 --- a/shell/platform/android/android_surface_software.cc +++ b/shell/platform/android/android_surface_software.cc @@ -13,7 +13,7 @@ #include "flutter/fml/trace_event.h" #include "flutter/shell/platform/android/platform_view_android_jni.h" -namespace shell { +namespace flutter { namespace { @@ -153,4 +153,4 @@ bool AndroidSurfaceSoftware::SetNativeWindow( return true; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/android/android_surface_software.h b/shell/platform/android/android_surface_software.h index c7410642cb22d..cf7fcb3e20f8e 100644 --- a/shell/platform/android/android_surface_software.h +++ b/shell/platform/android/android_surface_software.h @@ -11,7 +11,7 @@ #include "flutter/shell/gpu/gpu_surface_software.h" #include "flutter/shell/platform/android/android_surface.h" -namespace shell { +namespace flutter { class AndroidSurfaceSoftware final : public AndroidSurface, public GPUSurfaceSoftwareDelegate { @@ -20,31 +20,31 @@ class AndroidSurfaceSoftware final : public AndroidSurface, ~AndroidSurfaceSoftware() override; - // |shell::AndroidSurface| + // |AndroidSurface| bool IsValid() const override; - // |shell::AndroidSurface| + // |AndroidSurface| bool ResourceContextMakeCurrent() override; - // |shell::AndroidSurface| + // |AndroidSurface| bool ResourceContextClearCurrent() override; - // |shell::AndroidSurface| + // |AndroidSurface| std::unique_ptr CreateGPUSurface() override; - // |shell::AndroidSurface| + // |AndroidSurface| void TeardownOnScreenContext() override; - // |shell::AndroidSurface| + // |AndroidSurface| bool OnScreenSurfaceResize(const SkISize& size) const override; - // |shell::AndroidSurface| + // |AndroidSurface| bool SetNativeWindow(fml::RefPtr window) override; - // |shell::GPUSurfaceSoftwareDelegate| + // |GPUSurfaceSoftwareDelegate| sk_sp AcquireBackingStore(const SkISize& size) override; - // |shell::GPUSurfaceSoftwareDelegate| + // |GPUSurfaceSoftwareDelegate| bool PresentBackingStore(sk_sp backing_store) override; private: @@ -56,6 +56,6 @@ class AndroidSurfaceSoftware final : public AndroidSurface, FML_DISALLOW_COPY_AND_ASSIGN(AndroidSurfaceSoftware); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_SOFTWARE_H_ diff --git a/shell/platform/android/android_surface_vulkan.cc b/shell/platform/android/android_surface_vulkan.cc index 7753a42081550..66cde9731d5c1 100644 --- a/shell/platform/android/android_surface_vulkan.cc +++ b/shell/platform/android/android_surface_vulkan.cc @@ -10,7 +10,7 @@ #include "flutter/shell/gpu/gpu_surface_vulkan.h" #include "flutter/vulkan/vulkan_native_surface_android.h" -namespace shell { +namespace flutter { AndroidSurfaceVulkan::AndroidSurfaceVulkan() : proc_table_(fml::MakeRefCounted()) {} @@ -21,12 +21,12 @@ bool AndroidSurfaceVulkan::IsValid() const { return proc_table_->HasAcquiredMandatoryProcAddresses(); } -// |shell::AndroidSurface| +// |AndroidSurface| void AndroidSurfaceVulkan::TeardownOnScreenContext() { // Nothing to do. } -// |shell::AndroidSurface| +// |AndroidSurface| std::unique_ptr AndroidSurfaceVulkan::CreateGPUSurface() { if (!IsValid()) { return nullptr; @@ -54,28 +54,28 @@ std::unique_ptr AndroidSurfaceVulkan::CreateGPUSurface() { return gpu_surface; } -// |shell::AndroidSurface| +// |AndroidSurface| bool AndroidSurfaceVulkan::OnScreenSurfaceResize(const SkISize& size) const { return true; } -// |shell::AndroidSurface| +// |AndroidSurface| bool AndroidSurfaceVulkan::ResourceContextMakeCurrent() { FML_DLOG(ERROR) << "The vulkan backend does not support resource contexts."; return false; } -// |shell::AndroidSurface| +// |AndroidSurface| bool AndroidSurfaceVulkan::ResourceContextClearCurrent() { FML_DLOG(ERROR) << "The vulkan backend does not support resource contexts."; return false; } -// |shell::AndroidSurface| +// |AndroidSurface| bool AndroidSurfaceVulkan::SetNativeWindow( fml::RefPtr window) { native_window_ = std::move(window); return native_window_ && native_window_->IsValid(); } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/android/android_surface_vulkan.h b/shell/platform/android/android_surface_vulkan.h index ef6eec003a431..5c025b8e051c6 100644 --- a/shell/platform/android/android_surface_vulkan.h +++ b/shell/platform/android/android_surface_vulkan.h @@ -12,7 +12,7 @@ #include "flutter/shell/platform/android/android_surface.h" #include "flutter/vulkan/vulkan_window.h" -namespace shell { +namespace flutter { class AndroidSurfaceVulkan : public AndroidSurface { public: @@ -20,25 +20,25 @@ class AndroidSurfaceVulkan : public AndroidSurface { ~AndroidSurfaceVulkan() override; - // |shell::AndroidSurface| + // |AndroidSurface| bool IsValid() const override; - // |shell::AndroidSurface| + // |AndroidSurface| std::unique_ptr CreateGPUSurface() override; - // |shell::AndroidSurface| + // |AndroidSurface| void TeardownOnScreenContext() override; - // |shell::AndroidSurface| + // |AndroidSurface| bool OnScreenSurfaceResize(const SkISize& size) const override; - // |shell::AndroidSurface| + // |AndroidSurface| bool ResourceContextMakeCurrent() override; - // |shell::AndroidSurface| + // |AndroidSurface| bool ResourceContextClearCurrent() override; - // |shell::AndroidSurface| + // |AndroidSurface| bool SetNativeWindow(fml::RefPtr window) override; private: @@ -48,6 +48,6 @@ class AndroidSurfaceVulkan : public AndroidSurface { FML_DISALLOW_COPY_AND_ASSIGN(AndroidSurfaceVulkan); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_VULKAN_H_ diff --git a/shell/platform/android/flutter_main.cc b/shell/platform/android/flutter_main.cc index d1bdd20c01e48..16b1fbcff76fb 100644 --- a/shell/platform/android/flutter_main.cc +++ b/shell/platform/android/flutter_main.cc @@ -23,7 +23,7 @@ #include "flutter/shell/common/switches.h" #include "third_party/dart/runtime/include/dart_tools_api.h" -namespace shell { +namespace flutter { extern "C" { #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG @@ -148,4 +148,4 @@ bool FlutterMain::Register(JNIEnv* env) { return env->RegisterNatives(clazz, methods, arraysize(methods)) == 0; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/android/flutter_main.h b/shell/platform/android/flutter_main.h index f40438dfae7fd..5f6b3eb07559a 100644 --- a/shell/platform/android/flutter_main.h +++ b/shell/platform/android/flutter_main.h @@ -10,7 +10,7 @@ #include "flutter/common/settings.h" #include "flutter/fml/macros.h" -namespace shell { +namespace flutter { class FlutterMain { public: @@ -38,6 +38,6 @@ class FlutterMain { FML_DISALLOW_COPY_AND_ASSIGN(FlutterMain); }; -} // namespace shell +} // namespace flutter #endif // SHELL_PLATFORM_ANDROID_FLUTTER_MAIN_H_ diff --git a/shell/platform/android/io/flutter/view/FlutterMain.java b/shell/platform/android/io/flutter/view/FlutterMain.java index 504e7b32278eb..14b932061877e 100644 --- a/shell/platform/android/io/flutter/view/FlutterMain.java +++ b/shell/platform/android/io/flutter/view/FlutterMain.java @@ -28,7 +28,7 @@ public class FlutterMain { private static final String TAG = "FlutterMain"; - // Must match values in sky::shell::switches + // Must match values in sky::switches private static final String AOT_SHARED_LIBRARY_PATH = "aot-shared-library-path"; private static final String AOT_SNAPSHOT_PATH_KEY = "aot-snapshot-path"; private static final String AOT_VM_SNAPSHOT_DATA_KEY = "vm-snapshot-data"; diff --git a/shell/platform/android/library_loader.cc b/shell/platform/android/library_loader.cc index c625414470340..71725a3174baa 100644 --- a/shell/platform/android/library_loader.cc +++ b/shell/platform/android/library_loader.cc @@ -16,15 +16,15 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { bool result = false; // Register FlutterMain. - result = shell::FlutterMain::Register(env); + result = flutter::FlutterMain::Register(env); FML_CHECK(result); // Register PlatformView - result = shell::PlatformViewAndroid::Register(env); + result = flutter::PlatformViewAndroid::Register(env); FML_CHECK(result); // Register VSyncWaiter. - result = shell::VsyncWaiterAndroid::Register(env); + result = flutter::VsyncWaiterAndroid::Register(env); FML_CHECK(result); return JNI_VERSION_1_4; diff --git a/shell/platform/android/platform_message_response_android.cc b/shell/platform/android/platform_message_response_android.cc index b204d6db60289..f79f2b8c155a7 100644 --- a/shell/platform/android/platform_message_response_android.cc +++ b/shell/platform/android/platform_message_response_android.cc @@ -7,7 +7,7 @@ #include "flutter/fml/make_copyable.h" #include "flutter/shell/platform/android/platform_view_android_jni.h" -namespace shell { +namespace flutter { PlatformMessageResponseAndroid::PlatformMessageResponseAndroid( int response_id, @@ -72,4 +72,4 @@ void PlatformMessageResponseAndroid::CompleteEmpty() { response, nullptr); })); } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/android/platform_message_response_android.h b/shell/platform/android/platform_message_response_android.h index 83e58bf47d9d0..a93b4c802efe4 100644 --- a/shell/platform/android/platform_message_response_android.h +++ b/shell/platform/android/platform_message_response_android.h @@ -10,7 +10,7 @@ #include "flutter/fml/task_runner.h" #include "flutter/lib/ui/window/platform_message_response.h" -namespace shell { +namespace flutter { class PlatformMessageResponseAndroid : public flutter::PlatformMessageResponse { public: @@ -36,6 +36,6 @@ class PlatformMessageResponseAndroid : public flutter::PlatformMessageResponse { FML_DISALLOW_COPY_AND_ASSIGN(PlatformMessageResponseAndroid); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_ANDROID_PLATFORM_MESSAGE_RESPONSE_ANDROID_H_ diff --git a/shell/platform/android/platform_view_android.cc b/shell/platform/android/platform_view_android.cc index 11fb3c91b45a2..449a7e4571fba 100644 --- a/shell/platform/android/platform_view_android.cc +++ b/shell/platform/android/platform_view_android.cc @@ -8,7 +8,7 @@ #include #include "flutter/fml/synchronization/waitable_event.h" -#include "flutter/shell/common/io_manager.h" +#include "flutter/shell/common/shell_io_manager.h" #include "flutter/shell/gpu/gpu_surface_gl_delegate.h" #include "flutter/shell/platform/android/android_external_texture_gl.h" #include "flutter/shell/platform/android/android_surface_gl.h" @@ -16,7 +16,7 @@ #include "flutter/shell/platform/android/platform_view_android_jni.h" #include "flutter/shell/platform/android/vsync_waiter_android.h" -namespace shell { +namespace flutter { PlatformViewAndroid::PlatformViewAndroid( PlatformView::Delegate& delegate, @@ -157,7 +157,7 @@ void PlatformViewAndroid::InvokePlatformMessageEmptyResponseCallback( message_response->CompleteEmpty(); } -// |shell::PlatformView| +// |PlatformView| void PlatformViewAndroid::HandlePlatformMessage( fml::RefPtr message) { JNIEnv* env = fml::jni::AttachCurrentThread(); @@ -191,7 +191,7 @@ void PlatformViewAndroid::HandlePlatformMessage( } } -// |shell::PlatformView| +// |PlatformView| void PlatformViewAndroid::OnPreEngineRestart() const { JNIEnv* env = fml::jni::AttachCurrentThread(); fml::jni::ScopedJavaLocalRef view = java_object_.get(env); @@ -223,7 +223,7 @@ void PlatformViewAndroid::DispatchSemanticsAction(JNIEnv* env, std::move(args_vector)); } -// |shell::PlatformView| +// |PlatformView| void PlatformViewAndroid::UpdateSemantics( flutter::SemanticsNodeUpdates update, flutter::CustomAccessibilityActionUpdates actions) { @@ -376,12 +376,12 @@ void PlatformViewAndroid::RegisterExternalTexture( std::make_shared(texture_id, surface_texture)); } -// |shell::PlatformView| +// |PlatformView| std::unique_ptr PlatformViewAndroid::CreateVSyncWaiter() { return std::make_unique(task_runners_); } -// |shell::PlatformView| +// |PlatformView| std::unique_ptr PlatformViewAndroid::CreateRenderingSurface() { if (!android_surface_) { return nullptr; @@ -389,7 +389,7 @@ std::unique_ptr PlatformViewAndroid::CreateRenderingSurface() { return android_surface_->CreateGPUSurface(); } -// |shell::PlatformView| +// |PlatformView| sk_sp PlatformViewAndroid::CreateResourceContext() const { if (!android_surface_) { return nullptr; @@ -399,7 +399,7 @@ sk_sp PlatformViewAndroid::CreateResourceContext() const { // TODO(chinmaygarde): Currently, this code depends on the fact that only // the OpenGL surface will be able to make a resource context current. If // this changes, this assumption breaks. Handle the same. - resource_context = IOManager::CreateCompatibleResourceLoadingContext( + resource_context = ShellIOManager::CreateCompatibleResourceLoadingContext( GrBackend::kOpenGL_GrBackend, GPUSurfaceGLDelegate::GetDefaultPlatformGLInterface()); } else { @@ -409,7 +409,7 @@ sk_sp PlatformViewAndroid::CreateResourceContext() const { return resource_context; } -// |shell::PlatformView| +// |PlatformView| void PlatformViewAndroid::ReleaseResourceContext() const { if (android_surface_) { android_surface_->ResourceContextClearCurrent(); @@ -442,4 +442,4 @@ void PlatformViewAndroid::FireFirstFrameCallback() { FlutterViewOnFirstFrame(fml::jni::AttachCurrentThread(), view.obj()); } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/android/platform_view_android.h b/shell/platform/android/platform_view_android.h index 34cd55dad8b2f..74c0bbe6c26e7 100644 --- a/shell/platform/android/platform_view_android.h +++ b/shell/platform/android/platform_view_android.h @@ -18,7 +18,7 @@ #include "flutter/shell/platform/android/android_native_window.h" #include "flutter/shell/platform/android/android_surface.h" -namespace shell { +namespace flutter { class PlatformViewAndroid final : public PlatformView { public: @@ -42,7 +42,7 @@ class PlatformViewAndroid final : public PlatformView { void NotifyChanged(const SkISize& size); - // |shell::PlatformView| + // |PlatformView| void NotifyDestroyed() override; void DispatchPlatformMessage(JNIEnv* env, @@ -81,28 +81,28 @@ class PlatformViewAndroid final : public PlatformView { std::unordered_map> pending_responses_; - // |shell::PlatformView| + // |PlatformView| void UpdateSemantics( flutter::SemanticsNodeUpdates update, flutter::CustomAccessibilityActionUpdates actions) override; - // |shell::PlatformView| + // |PlatformView| void HandlePlatformMessage( fml::RefPtr message) override; - // |shell::PlatformView| + // |PlatformView| void OnPreEngineRestart() const override; - // |shell::PlatformView| + // |PlatformView| std::unique_ptr CreateVSyncWaiter() override; - // |shell::PlatformView| + // |PlatformView| std::unique_ptr CreateRenderingSurface() override; - // |shell::PlatformView| + // |PlatformView| sk_sp CreateResourceContext() const override; - // |shell::PlatformView| + // |PlatformView| void ReleaseResourceContext() const override; void InstallFirstFrameCallback(); @@ -112,6 +112,6 @@ class PlatformViewAndroid final : public PlatformView { FML_DISALLOW_COPY_AND_ASSIGN(PlatformViewAndroid); }; -} // namespace shell +} // namespace flutter #endif // SHELL_PLATFORM_ANDROID_PLATFORM_VIEW_ANDROID_H_ diff --git a/shell/platform/android/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index 2e972c7ecd7c5..38db3453cef00 100644 --- a/shell/platform/android/platform_view_android_jni.cc +++ b/shell/platform/android/platform_view_android_jni.cc @@ -25,9 +25,9 @@ #include "flutter/shell/platform/android/flutter_main.h" #define ANDROID_SHELL_HOLDER \ - (reinterpret_cast(shell_holder)) + (reinterpret_cast(shell_holder)) -namespace shell { +namespace flutter { namespace { @@ -540,114 +540,112 @@ bool RegisterApi(JNIEnv* env) { { .name = "nativeAttach", .signature = "(Lio/flutter/embedding/engine/FlutterJNI;Z)J", - .fnPtr = reinterpret_cast(&shell::AttachJNI), + .fnPtr = reinterpret_cast(&AttachJNI), }, { .name = "nativeDestroy", .signature = "(J)V", - .fnPtr = reinterpret_cast(&shell::DestroyJNI), + .fnPtr = reinterpret_cast(&DestroyJNI), }, { .name = "nativeRunBundleAndSnapshotFromLibrary", .signature = "(J[Ljava/lang/String;Ljava/lang/String;" "Ljava/lang/String;Landroid/content/res/AssetManager;)V", - .fnPtr = - reinterpret_cast(&shell::RunBundleAndSnapshotFromLibrary), + .fnPtr = reinterpret_cast(&RunBundleAndSnapshotFromLibrary), }, { .name = "nativeGetObservatoryUri", .signature = "()Ljava/lang/String;", - .fnPtr = reinterpret_cast(&shell::GetObservatoryUri), + .fnPtr = reinterpret_cast(&GetObservatoryUri), }, { .name = "nativeDispatchEmptyPlatformMessage", .signature = "(JLjava/lang/String;I)V", - .fnPtr = - reinterpret_cast(&shell::DispatchEmptyPlatformMessage), + .fnPtr = reinterpret_cast(&DispatchEmptyPlatformMessage), }, { .name = "nativeDispatchPlatformMessage", .signature = "(JLjava/lang/String;Ljava/nio/ByteBuffer;II)V", - .fnPtr = reinterpret_cast(&shell::DispatchPlatformMessage), + .fnPtr = reinterpret_cast(&DispatchPlatformMessage), }, { .name = "nativeInvokePlatformMessageResponseCallback", .signature = "(JILjava/nio/ByteBuffer;I)V", - .fnPtr = reinterpret_cast( - &shell::InvokePlatformMessageResponseCallback), + .fnPtr = + reinterpret_cast(&InvokePlatformMessageResponseCallback), }, { .name = "nativeInvokePlatformMessageEmptyResponseCallback", .signature = "(JI)V", .fnPtr = reinterpret_cast( - &shell::InvokePlatformMessageEmptyResponseCallback), + &InvokePlatformMessageEmptyResponseCallback), }, // Start of methods from FlutterView { .name = "nativeGetBitmap", .signature = "(J)Landroid/graphics/Bitmap;", - .fnPtr = reinterpret_cast(&shell::GetBitmap), + .fnPtr = reinterpret_cast(&GetBitmap), }, { .name = "nativeSurfaceCreated", .signature = "(JLandroid/view/Surface;)V", - .fnPtr = reinterpret_cast(&shell::SurfaceCreated), + .fnPtr = reinterpret_cast(&SurfaceCreated), }, { .name = "nativeSurfaceChanged", .signature = "(JII)V", - .fnPtr = reinterpret_cast(&shell::SurfaceChanged), + .fnPtr = reinterpret_cast(&SurfaceChanged), }, { .name = "nativeSurfaceDestroyed", .signature = "(J)V", - .fnPtr = reinterpret_cast(&shell::SurfaceDestroyed), + .fnPtr = reinterpret_cast(&SurfaceDestroyed), }, { .name = "nativeSetViewportMetrics", .signature = "(JFIIIIIIIIII)V", - .fnPtr = reinterpret_cast(&shell::SetViewportMetrics), + .fnPtr = reinterpret_cast(&SetViewportMetrics), }, { .name = "nativeDispatchPointerDataPacket", .signature = "(JLjava/nio/ByteBuffer;I)V", - .fnPtr = reinterpret_cast(&shell::DispatchPointerDataPacket), + .fnPtr = reinterpret_cast(&DispatchPointerDataPacket), }, { .name = "nativeDispatchSemanticsAction", .signature = "(JIILjava/nio/ByteBuffer;I)V", - .fnPtr = reinterpret_cast(&shell::DispatchSemanticsAction), + .fnPtr = reinterpret_cast(&DispatchSemanticsAction), }, { .name = "nativeSetSemanticsEnabled", .signature = "(JZ)V", - .fnPtr = reinterpret_cast(&shell::SetSemanticsEnabled), + .fnPtr = reinterpret_cast(&SetSemanticsEnabled), }, { .name = "nativeSetAccessibilityFeatures", .signature = "(JI)V", - .fnPtr = reinterpret_cast(&shell::SetAccessibilityFeatures), + .fnPtr = reinterpret_cast(&SetAccessibilityFeatures), }, { .name = "nativeGetIsSoftwareRenderingEnabled", .signature = "()Z", - .fnPtr = reinterpret_cast(&shell::GetIsSoftwareRendering), + .fnPtr = reinterpret_cast(&GetIsSoftwareRendering), }, { .name = "nativeRegisterTexture", .signature = "(JJLandroid/graphics/SurfaceTexture;)V", - .fnPtr = reinterpret_cast(&shell::RegisterTexture), + .fnPtr = reinterpret_cast(&RegisterTexture), }, { .name = "nativeMarkTextureFrameAvailable", .signature = "(JJ)V", - .fnPtr = reinterpret_cast(&shell::MarkTextureFrameAvailable), + .fnPtr = reinterpret_cast(&MarkTextureFrameAvailable), }, { .name = "nativeUnregisterTexture", .signature = "(JJ)V", - .fnPtr = reinterpret_cast(&shell::UnregisterTexture), + .fnPtr = reinterpret_cast(&UnregisterTexture), }, }; @@ -751,7 +749,7 @@ bool PlatformViewAndroid::Register(JNIEnv* env) { { .name = "nativeLookupCallbackInformation", .signature = "(J)Lio/flutter/view/FlutterCallbackInformation;", - .fnPtr = reinterpret_cast(&shell::LookupCallbackInformation), + .fnPtr = reinterpret_cast(&LookupCallbackInformation), }, }; @@ -797,4 +795,4 @@ bool PlatformViewAndroid::Register(JNIEnv* env) { return RegisterApi(env); } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/android/platform_view_android_jni.h b/shell/platform/android/platform_view_android_jni.h index 3423c745fd584..07c70b2a45b50 100644 --- a/shell/platform/android/platform_view_android_jni.h +++ b/shell/platform/android/platform_view_android_jni.h @@ -9,7 +9,7 @@ #include "flutter/fml/macros.h" #include "flutter/shell/platform/android/platform_view_android.h" -namespace shell { +namespace flutter { void FlutterViewHandlePlatformMessage(JNIEnv* env, jobject obj, @@ -46,6 +46,6 @@ void SurfaceTextureGetTransformMatrix(JNIEnv* env, void SurfaceTextureDetachFromGLContext(JNIEnv* env, jobject obj); -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_ANDROID_PLATFORM_VIEW_ANDROID_JNI_H_ diff --git a/shell/platform/android/vsync_waiter_android.cc b/shell/platform/android/vsync_waiter_android.cc index 9a9d79f6727cb..513cc6ff74034 100644 --- a/shell/platform/android/vsync_waiter_android.cc +++ b/shell/platform/android/vsync_waiter_android.cc @@ -14,7 +14,7 @@ #include "flutter/fml/platform/android/scoped_java_ref.h" #include "flutter/fml/trace_event.h" -namespace shell { +namespace flutter { static fml::jni::ScopedJavaGlobalRef* g_vsync_waiter_class = nullptr; static jmethodID g_async_wait_for_vsync_method_ = nullptr; @@ -24,7 +24,7 @@ VsyncWaiterAndroid::VsyncWaiterAndroid(flutter::TaskRunners task_runners) VsyncWaiterAndroid::~VsyncWaiterAndroid() = default; -// |shell::VsyncWaiter| +// |VsyncWaiter| void VsyncWaiterAndroid::AwaitVSync() { auto* weak_this = new std::weak_ptr(shared_from_this()); jlong java_baton = reinterpret_cast(weak_this); @@ -105,4 +105,4 @@ bool VsyncWaiterAndroid::Register(JNIEnv* env) { return env->RegisterNatives(clazz, methods, arraysize(methods)) == 0; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/android/vsync_waiter_android.h b/shell/platform/android/vsync_waiter_android.h index a3089cd074367..be086581bd506 100644 --- a/shell/platform/android/vsync_waiter_android.h +++ b/shell/platform/android/vsync_waiter_android.h @@ -12,7 +12,7 @@ #include "flutter/fml/macros.h" #include "flutter/shell/common/vsync_waiter.h" -namespace shell { +namespace flutter { class VsyncWaiterAndroid final : public VsyncWaiter { public: @@ -25,7 +25,7 @@ class VsyncWaiterAndroid final : public VsyncWaiter { float GetDisplayRefreshRate() const override; private: - // |shell::VsyncWaiter| + // |VsyncWaiter| void AwaitVSync() override; static void OnNativeVsync(JNIEnv* env, @@ -41,6 +41,6 @@ class VsyncWaiterAndroid final : public VsyncWaiter { FML_DISALLOW_COPY_AND_ASSIGN(VsyncWaiterAndroid); }; -} // namespace shell +} // namespace flutter #endif // SHELL_PLATFORM_ANDROID_ASYNC_WAITER_ANDROID_H_ diff --git a/shell/platform/common/cpp/incoming_message_dispatcher.cc b/shell/platform/common/cpp/incoming_message_dispatcher.cc index f766f7738135a..31eed6b559818 100644 --- a/shell/platform/common/cpp/incoming_message_dispatcher.cc +++ b/shell/platform/common/cpp/incoming_message_dispatcher.cc @@ -4,7 +4,7 @@ #include "flutter/shell/platform/common/cpp/incoming_message_dispatcher.h" -namespace shell { +namespace flutter { IncomingMessageDispatcher::IncomingMessageDispatcher( FlutterDesktopMessengerRef messenger) @@ -54,4 +54,4 @@ void IncomingMessageDispatcher::EnableInputBlockingForChannel( input_blocking_channels_.insert(channel); } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/common/cpp/incoming_message_dispatcher.h b/shell/platform/common/cpp/incoming_message_dispatcher.h index fced7db7a8e24..3eb874bc733e8 100644 --- a/shell/platform/common/cpp/incoming_message_dispatcher.h +++ b/shell/platform/common/cpp/incoming_message_dispatcher.h @@ -13,7 +13,7 @@ #include "flutter/shell/platform/common/cpp/public/flutter_messenger.h" -namespace shell { +namespace flutter { // Manages per-channel registration of callbacks for handling messages from the // Flutter engine, and dispatching incoming messages to those handlers. @@ -73,6 +73,6 @@ class IncomingMessageDispatcher { std::set input_blocking_channels_; }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_CPP_INCOMING_MESSAGE_DISPATCHER_H_ diff --git a/shell/platform/common/cpp/text_input_model.cc b/shell/platform/common/cpp/text_input_model.cc index 2f1c9b3741f1f..41231a6d611d4 100644 --- a/shell/platform/common/cpp/text_input_model.cc +++ b/shell/platform/common/cpp/text_input_model.cc @@ -26,7 +26,7 @@ static constexpr char kTextInputAction[] = "inputAction"; static constexpr char kTextInputType[] = "inputType"; static constexpr char kTextInputTypeName[] = "name"; -namespace shell { +namespace flutter { TextInputModel::TextInputModel(int client_id, const rapidjson::Value& config) : text_(""), @@ -178,4 +178,4 @@ std::unique_ptr TextInputModel::GetState() const { return args; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/common/cpp/text_input_model.h b/shell/platform/common/cpp/text_input_model.h index 3ae567c50c463..54afd05521646 100644 --- a/shell/platform/common/cpp/text_input_model.h +++ b/shell/platform/common/cpp/text_input_model.h @@ -9,7 +9,7 @@ #include "rapidjson/document.h" -namespace shell { +namespace flutter { // Handles underlying text input state, using a simple ASCII model. // // Ignores special states like "insert mode" for now. @@ -96,6 +96,6 @@ class TextInputModel { std::string::iterator selection_extent_; }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_CPP_TEXT_INPUT_MODEL_H_ diff --git a/shell/platform/darwin/common/buffer_conversions.h b/shell/platform/darwin/common/buffer_conversions.h index a5b166d2e3c08..60559b2dfe230 100644 --- a/shell/platform/darwin/common/buffer_conversions.h +++ b/shell/platform/darwin/common/buffer_conversions.h @@ -11,7 +11,7 @@ #include "flutter/fml/mapping.h" -namespace shell { +namespace flutter { std::vector GetVectorFromNSData(NSData* data); @@ -21,6 +21,6 @@ std::unique_ptr GetMappingFromNSData(NSData* data); NSData* GetNSDataFromMapping(std::unique_ptr mapping); -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_DARWIN_COMMON_BUFFER_CONVERSIONS_H_ diff --git a/shell/platform/darwin/common/buffer_conversions.mm b/shell/platform/darwin/common/buffer_conversions.mm index 237910b2cfbb4..943ff57c2b1a2 100644 --- a/shell/platform/darwin/common/buffer_conversions.mm +++ b/shell/platform/darwin/common/buffer_conversions.mm @@ -4,7 +4,7 @@ #include "flutter/shell/platform/darwin/common/buffer_conversions.h" -namespace shell { +namespace flutter { std::vector GetVectorFromNSData(NSData* data) { const uint8_t* bytes = reinterpret_cast(data.bytes); @@ -23,4 +23,4 @@ return [NSData dataWithBytes:mapping->GetMapping() length:mapping->GetSize()]; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/darwin/common/command_line.h b/shell/platform/darwin/common/command_line.h index fab7ff0aa21bf..e3c6eecb52125 100644 --- a/shell/platform/darwin/common/command_line.h +++ b/shell/platform/darwin/common/command_line.h @@ -8,10 +8,10 @@ #include "flutter/fml/command_line.h" #include "flutter/fml/macros.h" -namespace shell { +namespace flutter { fml::CommandLine CommandLineFromNSProcessInfo(); -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_DARWIN_COMMON_COMMAND_LINE_H_ diff --git a/shell/platform/darwin/common/command_line.mm b/shell/platform/darwin/common/command_line.mm index 84ab3ca432c77..6b601fae30260 100644 --- a/shell/platform/darwin/common/command_line.mm +++ b/shell/platform/darwin/common/command_line.mm @@ -6,7 +6,7 @@ #import -namespace shell { +namespace flutter { fml::CommandLine CommandLineFromNSProcessInfo() { std::vector args_vector; @@ -18,4 +18,4 @@ return fml::CommandLineFromIterators(args_vector.begin(), args_vector.end()); } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index 1af9fcdd9f171..47277007a97c3 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -26,7 +26,7 @@ static const char* kApplicationKernelSnapshotFileName = "kernel_blob.bin"; static flutter::Settings DefaultSettingsForProcess(NSBundle* bundle = nil) { - auto command_line = shell::CommandLineFromNSProcessInfo(); + auto command_line = flutter::CommandLineFromNSProcessInfo(); // Precedence: // 1. Settings from the specified NSBundle. @@ -45,7 +45,7 @@ bundle = mainBundle; } - auto settings = shell::SettingsFromCommandLine(command_line); + auto settings = flutter::SettingsFromCommandLine(command_line); settings.task_observer_add = [](intptr_t key, fml::closure callback) { fml::MessageLoop::GetCurrent().AddTaskObserver(key, std::move(callback)); @@ -175,17 +175,17 @@ - (instancetype)initWithPrecompiledDartBundle:(NSBundle*)bundle { return _settings; } -- (shell::RunConfiguration)runConfiguration { +- (flutter::RunConfiguration)runConfiguration { return [self runConfigurationForEntrypoint:nil]; } -- (shell::RunConfiguration)runConfigurationForEntrypoint:(NSString*)entrypointOrNil { +- (flutter::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); +- (flutter::RunConfiguration)runConfigurationForEntrypoint:(NSString*)entrypointOrNil + libraryOrNil:(NSString*)dartLibraryOrNil { + auto config = flutter::RunConfiguration::InferFromSettings(_settings); if (dartLibraryOrNil && entrypointOrNil) { config.SetEntrypointAndLibrary(std::string([entrypointOrNil UTF8String]), std::string([dartLibraryOrNil UTF8String])); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h index 3147b44ef8a45..2c67f094f710e 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h @@ -13,10 +13,10 @@ - (const flutter::Settings&)settings; -- (shell::RunConfiguration)runConfiguration; -- (shell::RunConfiguration)runConfigurationForEntrypoint:(NSString*)entrypointOrNil; -- (shell::RunConfiguration)runConfigurationForEntrypoint:(NSString*)entrypointOrNil - libraryOrNil:(NSString*)dartLibraryOrNil; +- (flutter::RunConfiguration)runConfiguration; +- (flutter::RunConfiguration)runConfigurationForEntrypoint:(NSString*)entrypointOrNil; +- (flutter::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 index 326b1867a3db7..50208e65a08d4 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -38,15 +38,15 @@ - (instancetype)initWithPlugin:(NSString*)pluginKey flutterEngine:(FlutterEngine @implementation FlutterEngine { fml::scoped_nsobject _dartProject; - shell::ThreadHost _threadHost; - std::unique_ptr _shell; + flutter::ThreadHost _threadHost; + std::unique_ptr _shell; NSString* _labelPrefix; std::unique_ptr> _weakFactory; fml::WeakPtr _viewController; fml::scoped_nsobject _publisher; - std::unique_ptr _platformViewsController; + std::unique_ptr _platformViewsController; // Channels fml::scoped_nsobject _platformPlugin; @@ -89,7 +89,7 @@ - (instancetype)initWithName:(NSString*)labelPrefix _dartProject.reset([projectOrNil retain]); _pluginPublications = [NSMutableDictionary new]; - _platformViewsController.reset(new shell::FlutterPlatformViewsController()); + _platformViewsController.reset(new flutter::FlutterPlatformViewsController()); [self setupChannels]; @@ -101,7 +101,7 @@ - (void)dealloc { [super dealloc]; } -- (shell::Shell&)shell { +- (flutter::Shell&)shell { FML_DCHECK(_shell); return *_shell; } @@ -131,14 +131,14 @@ - (void)dispatchPointerDataPacket:(std::unique_ptr)p _nextPointerFlowId++; } -- (fml::WeakPtr)platformView { +- (fml::WeakPtr)platformView { FML_DCHECK(_shell); return _shell->GetPlatformView(); } -- (shell::PlatformViewIOS*)iosPlatformView { +- (flutter::PlatformViewIOS*)iosPlatformView { FML_DCHECK(_shell); - return static_cast(_shell->GetPlatformView().get()); + return static_cast(_shell->GetPlatformView().get()); } - (fml::RefPtr)platformTaskRunner { @@ -179,7 +179,7 @@ - (FlutterViewController*)viewController { - (FlutterPlatformPlugin*)platformPlugin { return _platformPlugin.get(); } -- (shell::FlutterPlatformViewsController*)platformViewsController { +- (flutter::FlutterPlatformViewsController*)platformViewsController { return _platformViewsController.get(); } - (FlutterTextInputPlugin*)textInputPlugin { @@ -286,8 +286,8 @@ - (void)maybeSetupPlatformViewChannels { } } -- (shell::Rasterizer::Screenshot)screenshot:(shell::Rasterizer::ScreenshotType)type - base64Encode:(bool)base64Encode { +- (flutter::Rasterizer::Screenshot)screenshot:(flutter::Rasterizer::ScreenshotType)type + base64Encode:(bool)base64Encode { return self.shell.Screenshot(type, base64Encode); } @@ -300,7 +300,7 @@ - (void)launchEngine:(NSString*)entrypoint libraryURI:(NSString*)libraryOrNil { ]() mutable { if (engine) { auto result = engine->Run(std::move(config)); - if (result == shell::Engine::RunStatus::Failure) { + if (result == flutter::Engine::RunStatus::Failure) { FML_LOG(ERROR) << "Could not launch engine with configuration."; } } @@ -335,23 +335,24 @@ - (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI { // initialized. fml::MessageLoop::EnsureInitializedForCurrentThread(); - _threadHost = { - threadLabel.UTF8String, // label - shell::ThreadHost::Type::UI | shell::ThreadHost::Type::GPU | shell::ThreadHost::Type::IO}; + _threadHost = {threadLabel.UTF8String, // label + flutter::ThreadHost::Type::UI | flutter::ThreadHost::Type::GPU | + flutter::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()); + flutter::Shell::CreateCallback on_create_platform_view = + [](flutter::Shell& shell) { + return std::make_unique(shell, shell.GetTaskRunners()); }; - shell::Shell::CreateCallback on_create_rasterizer = [](shell::Shell& shell) { - return std::make_unique(shell.GetTaskRunners()); - }; + flutter::Shell::CreateCallback on_create_rasterizer = + [](flutter::Shell& shell) { + return std::make_unique(shell.GetTaskRunners()); + }; - if (shell::IsIosEmbeddedViewsPreviewEnabled()) { + if (flutter::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. @@ -367,10 +368,10 @@ - (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI { _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 + _shell = flutter::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 { flutter::TaskRunners task_runners(threadLabel.UTF8String, // label @@ -380,10 +381,10 @@ - (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI { _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 + _shell = flutter::Shell::Create(std::move(task_runners), // task runners + std::move(settings), // settings + on_create_platform_view, // platform view creation + on_create_rasterizer // rasterzier creation ); } @@ -393,7 +394,7 @@ - (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryURI { } else { [self setupChannels]; if (!_platformViewsController) { - _platformViewsController.reset(new shell::FlutterPlatformViewsController()); + _platformViewsController.reset(new flutter::FlutterPlatformViewsController()); } _publisher.reset([[FlutterObservatoryPublisher alloc] init]); [self maybeSetupPlatformViewChannels]; @@ -487,8 +488,8 @@ - (void)performAction:(FlutterTextInputAction)action withClient:(int)client { #pragma mark - Screenshot Delegate -- (shell::Rasterizer::Screenshot)takeScreenshot:(shell::Rasterizer::ScreenshotType)type - asBase64Encoded:(BOOL)base64Encode { +- (flutter::Rasterizer::Screenshot)takeScreenshot:(flutter::Rasterizer::ScreenshotType)type + asBase64Encoded:(BOOL)base64Encode { FML_DCHECK(_shell) << "Cannot takeScreenshot without a shell"; return _shell->Screenshot(type, base64Encode); } @@ -503,9 +504,9 @@ - (void)sendOnChannel:(NSString*)channel message:(NSData*)message binaryReply:(FlutterBinaryReply)callback { NSAssert(channel, @"The channel must not be null"); - fml::RefPtr response = + fml::RefPtr response = (callback == nil) ? nullptr - : fml::MakeRefCounted( + : fml::MakeRefCounted( ^(NSData* reply) { callback(reply); }, @@ -513,7 +514,7 @@ - (void)sendOnChannel:(NSString*)channel fml::RefPtr platformMessage = (message == nil) ? fml::MakeRefCounted(channel.UTF8String, response) : fml::MakeRefCounted( - channel.UTF8String, shell::GetVectorFromNSData(message), response); + channel.UTF8String, flutter::GetVectorFromNSData(message), response); _shell->GetPlatformView()->DispatchPlatformMessage(platformMessage); } diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h index f00f4dbd0161c..4994814d84415 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h @@ -26,20 +26,20 @@ @interface FlutterEngine () -- (shell::Shell&)shell; +- (flutter::Shell&)shell; - (void)updateViewportMetrics:(flutter::ViewportMetrics)viewportMetrics; - (void)dispatchPointerDataPacket:(std::unique_ptr)packet; - (fml::RefPtr)platformTaskRunner; -- (fml::WeakPtr)platformView; +- (fml::WeakPtr)platformView; -- (shell::Rasterizer::Screenshot)screenshot:(shell::Rasterizer::ScreenshotType)type - base64Encode:(bool)base64Encode; +- (flutter::Rasterizer::Screenshot)screenshot:(flutter::Rasterizer::ScreenshotType)type + base64Encode:(bool)base64Encode; - (FlutterPlatformPlugin*)platformPlugin; -- (shell::FlutterPlatformViewsController*)platformViewsController; +- (flutter::FlutterPlatformViewsController*)platformViewsController; - (FlutterTextInputPlugin*)textInputPlugin; - (void)launchEngine:(NSString*)entrypoint libraryURI:(NSString*)libraryOrNil; - (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryOrNil; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h b/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h index 7332e46115313..dddfd6ca87d01 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h @@ -24,9 +24,9 @@ - (instancetype)init NS_DESIGNATED_INITIALIZER; - (instancetype)initWithContentsScale:(CGFloat)contentsScale; -- (std::unique_ptr)createSoftwareSurface; -- (std::unique_ptr)createGLSurfaceWithContext: - (std::shared_ptr)gl_context; +- (std::unique_ptr)createSoftwareSurface; +- (std::unique_ptr)createGLSurfaceWithContext: + (std::shared_ptr)gl_context; @end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm b/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm index 394ae89550150..091b13e7063ea 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm @@ -64,20 +64,20 @@ + (Class)layerClass { #endif // TARGET_IPHONE_SIMULATOR } -- (std::unique_ptr)createSoftwareSurface { +- (std::unique_ptr)createSoftwareSurface { fml::scoped_nsobject layer(reinterpret_cast([self.layer retain])); - return std::make_unique(std::move(layer), nullptr); + return std::make_unique(std::move(layer), nullptr); } -- (std::unique_ptr)createGLSurfaceWithContext: - (std::shared_ptr)gl_context { +- (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)); + return std::make_unique(eagl_layer, std::move(gl_context)); } // TODO(amirh): implement drawLayer to suppoer snapshotting. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h index d1558a1cfdd51..3efcff16674d9 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h @@ -17,13 +17,13 @@ @end -namespace shell { +namespace flutter { extern const char* const kOrientationUpdateNotificationName; extern const char* const kOrientationUpdateNotificationKey; extern const char* const kOverlayStyleUpdateNotificationName; extern const char* const kOverlayStyleUpdateNotificationKey; -} // namespace shell +} // namespace flutter #endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMPLUGIN_H_ diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm index 5f43a026b571a..4fa0d46942854 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm @@ -17,7 +17,7 @@ } // namespaces -namespace shell { +namespace flutter { // TODO(abarth): Move these definitions from system_chrome_impl.cc to here. const char* const kOrientationUpdateNotificationName = @@ -29,9 +29,9 @@ const char* const kOverlayStyleUpdateNotificationKey = "io.flutter.plugin.platform.SystemChromeOverlayNotificationKey"; -} // namespace shell +} // namespace flutter -using namespace shell; +using namespace flutter; @implementation FlutterPlatformPlugin { fml::WeakPtr _engine; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm index f2f0550b8cece..0f4855d0d0ec8 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm @@ -16,7 +16,7 @@ #include "flutter/fml/platform/darwin/scoped_nsobject.h" #include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterChannels.h" -namespace shell { +namespace flutter { void FlutterPlatformViewsController::SetFlutterView(UIView* flutter_view) { flutter_view_.reset([flutter_view retain]); @@ -330,7 +330,7 @@ overlays_gr_context_ = gr_context; } -} // namespace shell +} // namespace flutter // This recognizers delays touch events from being dispatched to the responder chain until it failed // recognizing a gesture. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h index 0f2cfe3d57bad..62921aadbee35 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h @@ -27,7 +27,7 @@ - (void)blockGesture; @end -namespace shell { +namespace flutter { class IOSGLContext; class IOSSurface; @@ -120,6 +120,6 @@ class FlutterPlatformViewsController { FML_DISALLOW_COPY_AND_ASSIGN(FlutterPlatformViewsController); }; -} // namespace shell +} // namespace flutter #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 index b6c85c60974fb..7c2fb3e6ca5a2 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm @@ -6,7 +6,8 @@ #include "flutter/shell/platform/darwin/ios/ios_surface.h" -namespace shell { +namespace flutter { + FlutterPlatformViewLayer::FlutterPlatformViewLayer(fml::scoped_nsobject overlay_view, std::unique_ptr ios_surface, std::unique_ptr surface) @@ -20,4 +21,4 @@ FlutterPlatformViewsController::~FlutterPlatformViewsController() = default; -} // namespace shell +} // namespace flutter diff --git a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm index d7c151bfa7562..f4b174bb8408b 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm @@ -145,7 +145,7 @@ - (id)decodeEnvelope:(NSData*)envelope { } @end -using namespace shell; +using namespace flutter; #pragma mark - Standard serializable types diff --git a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h index c1eab20fa1ac3..186adce19d224 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h @@ -25,7 +25,7 @@ typedef NS_ENUM(NSInteger, FlutterStandardField) { FlutterStandardFieldMap, }; -namespace shell { +namespace flutter { FlutterStandardField FlutterStandardFieldForDataType(FlutterStandardDataType type) { return (FlutterStandardField)(type + FlutterStandardFieldUInt8Data); } @@ -44,6 +44,6 @@ UInt8 elementSizeForFlutterStandardDataType(FlutterStandardDataType type) { return 8; } } -} // namespace shell +} // namespace flutter #endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERSTANDARDCODECINTERNAL_H_ diff --git a/shell/platform/darwin/ios/framework/Source/FlutterView.h b/shell/platform/darwin/ios/framework/Source/FlutterView.h index ee7110446c2f6..0da2d5b0bc71d 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterView.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterView.h @@ -17,10 +17,10 @@ @protocol FlutterViewEngineDelegate -- (shell::Rasterizer::Screenshot)takeScreenshot:(shell::Rasterizer::ScreenshotType)type - asBase64Encoded:(BOOL)base64Encode; +- (flutter::Rasterizer::Screenshot)takeScreenshot:(flutter::Rasterizer::ScreenshotType)type + asBase64Encoded:(BOOL)base64Encode; -- (shell::FlutterPlatformViewsController*)platformViewsController; +- (flutter::FlutterPlatformViewsController*)platformViewsController; @end @@ -33,7 +33,8 @@ - (instancetype)initWithDelegate:(id)delegate opaque:(BOOL)opaque NS_DESIGNATED_INITIALIZER; -- (std::unique_ptr)createSurface:(std::shared_ptr)context; +- (std::unique_ptr)createSurface: + (std::shared_ptr)context; @end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterView.mm b/shell/platform/darwin/ios/framework/Source/FlutterView.mm index 17caee87ed31f..61b5db9c56f75 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterView.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterView.mm @@ -71,11 +71,12 @@ + (Class)layerClass { #endif // TARGET_IPHONE_SIMULATOR } -- (std::unique_ptr)createSurface:(std::shared_ptr)context { +- (std::unique_ptr)createSurface: + (std::shared_ptr)context { if ([self.layer isKindOfClass:[CAEAGLLayer class]]) { fml::scoped_nsobject eagl_layer( reinterpret_cast([self.layer retain])); - if (shell::IsIosEmbeddedViewsPreviewEnabled()) { + if (flutter::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, *)) { @@ -84,12 +85,12 @@ + (Class)layerClass { eagl_layer.get().presentsWithTransaction = YES; } } - return std::make_unique(context, std::move(eagl_layer), - [_delegate platformViewsController]); + return std::make_unique(context, std::move(eagl_layer), + [_delegate platformViewsController]); } else { fml::scoped_nsobject layer(reinterpret_cast([self.layer retain])); - return std::make_unique(std::move(layer), - [_delegate platformViewsController]); + return std::make_unique(std::move(layer), + [_delegate platformViewsController]); } } @@ -100,7 +101,7 @@ - (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context { return; } - auto screenshot = [_delegate takeScreenshot:shell::Rasterizer::ScreenshotType::UncompressedImage + auto screenshot = [_delegate takeScreenshot:flutter::Rasterizer::ScreenshotType::UncompressedImage asBase64Encoded:NO]; if (!screenshot.data || screenshot.data->isEmpty() || screenshot.frame_size.isEmpty()) { diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index bebfabbc7ee3c..0f987d42e40f7 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -135,12 +135,12 @@ - (void)setupNotificationCenterObservers { NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; [center addObserver:self selector:@selector(onOrientationPreferencesUpdated:) - name:@(shell::kOrientationUpdateNotificationName) + name:@(flutter::kOrientationUpdateNotificationName) object:nil]; [center addObserver:self selector:@selector(onPreferredStatusBarStyleUpdated:) - name:@(shell::kOverlayStyleUpdateNotificationName) + name:@(flutter::kOverlayStyleUpdateNotificationName) object:nil]; [center addObserver:self @@ -752,7 +752,7 @@ - (void)onOrientationPreferencesUpdated:(NSNotification*)notification { dispatch_async(dispatch_get_main_queue(), ^{ NSDictionary* info = notification.userInfo; - NSNumber* update = info[@(shell::kOrientationUpdateNotificationKey)]; + NSNumber* update = info[@(flutter::kOrientationUpdateNotificationKey)]; if (update == nil) { return; @@ -975,7 +975,7 @@ - (void)onPreferredStatusBarStyleUpdated:(NSNotification*)notification { dispatch_async(dispatch_get_main_queue(), ^{ NSDictionary* info = notification.userInfo; - NSNumber* update = info[@(shell::kOverlayStyleUpdateNotificationKey)]; + NSNumber* update = info[@(flutter::kOverlayStyleUpdateNotificationKey)]; if (update == nil) { return; @@ -992,7 +992,7 @@ - (void)onPreferredStatusBarStyleUpdated:(NSNotification*)notification { #pragma mark - Platform views -- (shell::FlutterPlatformViewsController*)platformViewsController { +- (flutter::FlutterPlatformViewsController*)platformViewsController { return [_engine.get() platformViewsController]; } diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h index 4908c7dc80638..5947a9327ff3d 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h @@ -15,7 +15,7 @@ @interface FlutterViewController () - (fml::WeakPtr)getWeakPtr; -- (shell::FlutterPlatformViewsController*)platformViewsController; +- (flutter::FlutterPlatformViewsController*)platformViewsController; @end diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h index c7f62b8890764..1f0193e6bdf46 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h +++ b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h @@ -23,9 +23,9 @@ #include "third_party/skia/include/core/SkMatrix44.h" #include "third_party/skia/include/core/SkRect.h" -namespace shell { +namespace flutter { class AccessibilityBridge; -} // namespace shell +} // namespace flutter @class FlutterPlatformViewSemanticsContainer; @@ -50,7 +50,7 @@ class AccessibilityBridge; * object may use the bridge to access contextual application information. A weak pointer is used * because the platform view owns the accessibility bridge. */ -@property(nonatomic, readonly) fml::WeakPtr bridge; +@property(nonatomic, readonly) fml::WeakPtr bridge; /** * The semantics node used to produce this semantics object. @@ -83,7 +83,7 @@ class AccessibilityBridge; #pragma mark - Designated initializers - (instancetype)init __attribute__((unavailable("Use initWithBridge instead"))); -- (instancetype)initWithBridge:(fml::WeakPtr)bridge +- (instancetype)initWithBridge:(fml::WeakPtr)bridge uid:(int32_t)uid NS_DESIGNATED_INITIALIZER; @end @@ -132,7 +132,7 @@ class AccessibilityBridge; @end -namespace shell { +namespace flutter { class PlatformViewIOS; class AccessibilityBridge final { @@ -180,6 +180,6 @@ class AccessibilityBridge final { FML_DISALLOW_COPY_AND_ASSIGN(AccessibilityBridge); }; -} // namespace shell +} // namespace flutter #endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_ACCESSIBILITY_BRIDGE_H_ diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm index 1c62c19eebe13..e9a083e224b9a 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm +++ b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm @@ -84,7 +84,7 @@ @implementation FlutterCustomAccessibilityAction { @interface SemanticsObjectContainer : NSObject - (instancetype)init __attribute__((unavailable("Use initWithSemanticsObject instead"))); - (instancetype)initWithSemanticsObject:(SemanticsObject*)semanticsObject - bridge:(fml::WeakPtr)bridge + bridge:(fml::WeakPtr)bridge NS_DESIGNATED_INITIALIZER; @property(nonatomic, weak) SemanticsObject* semanticsObject; @@ -106,7 +106,7 @@ - (instancetype)init { #pragma mark - Designated initializers -- (instancetype)initWithBridge:(fml::WeakPtr)bridge uid:(int32_t)uid { +- (instancetype)initWithBridge:(fml::WeakPtr)bridge uid:(int32_t)uid { FML_DCHECK(bridge) << "bridge must be set"; FML_DCHECK(uid >= kRootNodeId); self = [super init]; @@ -363,7 +363,7 @@ - (instancetype)init { #pragma mark - Designated initializers -- (instancetype)initWithBridge:(fml::WeakPtr)bridge uid:(int32_t)uid { +- (instancetype)initWithBridge:(fml::WeakPtr)bridge uid:(int32_t)uid { self = [super initWithBridge:bridge uid:uid]; return self; } @@ -424,7 +424,7 @@ - (instancetype)initWithAccessibilityContainer:(id)container { @implementation SemanticsObjectContainer { SemanticsObject* _semanticsObject; - fml::WeakPtr _bridge; + fml::WeakPtr _bridge; } #pragma mark - initializers @@ -437,7 +437,7 @@ - (instancetype)init { } - (instancetype)initWithSemanticsObject:(SemanticsObject*)semanticsObject - bridge:(fml::WeakPtr)bridge { + bridge:(fml::WeakPtr)bridge { FML_DCHECK(semanticsObject) << "semanticsObject must be set"; self = [super init]; @@ -529,7 +529,7 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { #pragma mark - AccessibilityBridge impl -namespace shell { +namespace flutter { AccessibilityBridge::AccessibilityBridge(UIView* view, PlatformViewIOS* platform_view, @@ -606,7 +606,7 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { } if (object.node.IsPlatformViewNode()) { - shell::FlutterPlatformViewsController* controller = GetPlatformViewsController(); + FlutterPlatformViewsController* controller = GetPlatformViewsController(); if (controller) { object.platformViewSemanticsContainer = [[FlutterPlatformViewSemanticsContainer alloc] initWithAccessibilityContainer:[object accessibilityContainer]]; @@ -753,4 +753,4 @@ - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction { previous_routes_.clear(); } -} // namespace shell +} // namespace flutter 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 35e50e1a13f7d..f6a620080b543 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.mm +++ b/shell/platform/darwin/ios/framework/Source/accessibility_text_entry.mm @@ -169,7 +169,7 @@ @implementation TextInputSemanticsObject { FlutterInactiveTextInput* _inactive_text_input; } -- (instancetype)initWithBridge:(fml::WeakPtr)bridge uid:(int32_t)uid { +- (instancetype)initWithBridge:(fml::WeakPtr)bridge uid:(int32_t)uid { self = [super initWithBridge:bridge uid:uid]; if (self) { 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 75660e3744976..ca18f6c4e6034 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 @@ -16,7 +16,7 @@ typedef void (^PlatformMessageResponseCallback)(NSData*); -namespace shell { +namespace flutter { class PlatformMessageResponseDarwin : public flutter::PlatformMessageResponse { public: @@ -36,6 +36,6 @@ class PlatformMessageResponseDarwin : public flutter::PlatformMessageResponse { FML_FRIEND_MAKE_REF_COUNTED(PlatformMessageResponseDarwin); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_PLATFORM_MESSAGE_RESPONSE_DARWIN_H_ 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 0d45e4e2ff4e1..89f0f2d580b57 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 @@ -4,7 +4,7 @@ #include "flutter/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h" -namespace shell { +namespace flutter { PlatformMessageResponseDarwin::PlatformMessageResponseDarwin( PlatformMessageResponseCallback callback, @@ -17,7 +17,7 @@ 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))); + self->callback_.get()(GetNSDataFromMapping(std::move(data))); })); } @@ -27,4 +27,4 @@ fml::MakeCopyable([self]() mutable { self->callback_.get()(nil); })); } -} // namespace shell +} // namespace flutter 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 d9c4cc2af7909..3447fb949504a 100644 --- a/shell/platform/darwin/ios/framework/Source/platform_message_router.h +++ b/shell/platform/darwin/ios/framework/Source/platform_message_router.h @@ -12,7 +12,7 @@ #include "flutter/lib/ui/window/platform_message.h" #include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterBinaryMessenger.h" -namespace shell { +namespace flutter { class PlatformMessageRouter { public: @@ -32,6 +32,6 @@ class PlatformMessageRouter { FML_DISALLOW_COPY_AND_ASSIGN(PlatformMessageRouter); }; -} // namespace shell +} // namespace flutter #endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_ACCESSIBILITY_BRIDGE_H_ 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 997a96ce8d79e..0f8d0979450fd 100644 --- a/shell/platform/darwin/ios/framework/Source/platform_message_router.mm +++ b/shell/platform/darwin/ios/framework/Source/platform_message_router.mm @@ -8,7 +8,7 @@ #include "flutter/shell/platform/darwin/common/buffer_conversions.h" -namespace shell { +namespace flutter { PlatformMessageRouter::PlatformMessageRouter() = default; @@ -49,4 +49,4 @@ } } -} // namespace shell +} // namespace flutter 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 81dbe8d737cea..29097da8f7ad9 100644 --- a/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h +++ b/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h @@ -12,7 +12,7 @@ @class VSyncClient; -namespace shell { +namespace flutter { class VsyncWaiterIOS final : public VsyncWaiter { public: @@ -23,12 +23,12 @@ class VsyncWaiterIOS final : public VsyncWaiter { private: fml::scoped_nsobject client_; - // |shell::VsyncWaiter| + // |VsyncWaiter| void AwaitVSync() override; FML_DISALLOW_COPY_AND_ASSIGN(VsyncWaiterIOS); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_VSYNC_WAITER_IOS_H_ 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 4f1486eeb897c..f16c656c075ef 100644 --- a/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm +++ b/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm @@ -17,7 +17,7 @@ @interface VSyncClient : NSObject - (instancetype)initWithTaskRunner:(fml::RefPtr)task_runner - callback:(shell::VsyncWaiter::Callback)callback; + callback:(flutter::VsyncWaiter::Callback)callback; - (void)await; @@ -25,7 +25,7 @@ - (void)invalidate; @end -namespace shell { +namespace flutter { VsyncWaiterIOS::VsyncWaiterIOS(flutter::TaskRunners task_runners) : VsyncWaiter(std::move(task_runners)), @@ -45,15 +45,15 @@ - (void)invalidate; [client_.get() await]; } -} // namespace shell +} // namespace flutter @implementation VSyncClient { - shell::VsyncWaiter::Callback callback_; + flutter::VsyncWaiter::Callback callback_; fml::scoped_nsobject display_link_; } - (instancetype)initWithTaskRunner:(fml::RefPtr)task_runner - callback:(shell::VsyncWaiter::Callback)callback { + callback:(flutter::VsyncWaiter::Callback)callback { self = [super init]; if (self) { diff --git a/shell/platform/darwin/ios/ios_external_texture_gl.h b/shell/platform/darwin/ios/ios_external_texture_gl.h index d258234708a0b..d583c85c0eca9 100644 --- a/shell/platform/darwin/ios/ios_external_texture_gl.h +++ b/shell/platform/darwin/ios/ios_external_texture_gl.h @@ -9,7 +9,7 @@ #include "flutter/fml/platform/darwin/cf_utils.h" #include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterTexture.h" -namespace shell { +namespace flutter { class IOSExternalTextureGL : public flow::Texture { public: @@ -33,6 +33,6 @@ class IOSExternalTextureGL : public flow::Texture { FML_DISALLOW_COPY_AND_ASSIGN(IOSExternalTextureGL); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_IOS_EXTERNAL_TEXTURE_GL_H_ diff --git a/shell/platform/darwin/ios/ios_external_texture_gl.mm b/shell/platform/darwin/ios/ios_external_texture_gl.mm index 543d2582e6310..3e0e2d2d73b66 100644 --- a/shell/platform/darwin/ios/ios_external_texture_gl.mm +++ b/shell/platform/darwin/ios/ios_external_texture_gl.mm @@ -12,7 +12,7 @@ #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/gpu/GrBackendSurface.h" -namespace shell { +namespace flutter { IOSExternalTextureGL::IOSExternalTextureGL(int64_t textureId, NSObject* externalTexture) @@ -74,4 +74,4 @@ void IOSExternalTextureGL::MarkNewFrameAvailable() {} -} // namespace shell +} // namespace flutter diff --git a/shell/platform/darwin/ios/ios_gl_context.h b/shell/platform/darwin/ios/ios_gl_context.h index 08778d21319a7..232645d9c8592 100644 --- a/shell/platform/darwin/ios/ios_gl_context.h +++ b/shell/platform/darwin/ios/ios_gl_context.h @@ -15,7 +15,7 @@ #include "flutter/shell/common/platform_view.h" #include "ios_gl_render_target.h" -namespace shell { +namespace flutter { class IOSGLContext { public: @@ -40,6 +40,6 @@ class IOSGLContext { FML_DISALLOW_COPY_AND_ASSIGN(IOSGLContext); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_GL_CONTEXT_H_ diff --git a/shell/platform/darwin/ios/ios_gl_context.mm b/shell/platform/darwin/ios/ios_gl_context.mm index 74e98b223aaf9..52fb85f8f19a9 100644 --- a/shell/platform/darwin/ios/ios_gl_context.mm +++ b/shell/platform/darwin/ios/ios_gl_context.mm @@ -10,7 +10,7 @@ #include "third_party/skia/include/gpu/GrContextOptions.h" #include "third_party/skia/include/gpu/gl/GrGLInterface.h" -namespace shell { +namespace flutter { IOSGLContext::IOSGLContext() { resource_context_.reset([[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]); @@ -60,4 +60,4 @@ return [EAGLContext setCurrentContext:resource_context_.get()]; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/darwin/ios/ios_gl_render_target.h b/shell/platform/darwin/ios/ios_gl_render_target.h index ce2a128bd3c48..b2eafe16e0950 100644 --- a/shell/platform/darwin/ios/ios_gl_render_target.h +++ b/shell/platform/darwin/ios/ios_gl_render_target.h @@ -14,7 +14,7 @@ #include "flutter/fml/platform/darwin/scoped_nsobject.h" #include "flutter/shell/common/platform_view.h" -namespace shell { +namespace flutter { class IOSGLRenderTarget { public: @@ -52,6 +52,6 @@ class IOSGLRenderTarget { FML_DISALLOW_COPY_AND_ASSIGN(IOSGLRenderTarget); }; -} // namespace shell +} // namespace flutter #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 index 210d9a9d8c684..1401707b28891 100644 --- a/shell/platform/darwin/ios/ios_gl_render_target.mm +++ b/shell/platform/darwin/ios/ios_gl_render_target.mm @@ -10,7 +10,7 @@ #include "third_party/skia/include/gpu/GrContextOptions.h" #include "third_party/skia/include/gpu/gl/GrGLInterface.h" -namespace shell { +namespace flutter { IOSGLRenderTarget::IOSGLRenderTarget(fml::scoped_nsobject layer, EAGLContext* context, @@ -138,4 +138,4 @@ return [EAGLContext setCurrentContext:resource_context_.get()]; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/darwin/ios/ios_surface.h b/shell/platform/darwin/ios/ios_surface.h index 1fc6a4218dc75..8b065bb9ef83e 100644 --- a/shell/platform/darwin/ios/ios_surface.h +++ b/shell/platform/darwin/ios/ios_surface.h @@ -13,7 +13,7 @@ #include "flutter/fml/platform/darwin/scoped_nsobject.h" #include "flutter/shell/common/surface.h" -namespace shell { +namespace flutter { // Returns true if the app explicitly specified to use the iOS view embedding // mechanism which is still in a release preview. @@ -43,6 +43,6 @@ class IOSSurface { FML_DISALLOW_COPY_AND_ASSIGN(IOSSurface); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_H_ diff --git a/shell/platform/darwin/ios/ios_surface.mm b/shell/platform/darwin/ios/ios_surface.mm index f9d2d4cfbd500..4c2b4efd85fa4 100644 --- a/shell/platform/darwin/ios/ios_surface.mm +++ b/shell/platform/darwin/ios/ios_surface.mm @@ -9,7 +9,7 @@ #include "flutter/shell/platform/darwin/ios/ios_surface_gl.h" #include "flutter/shell/platform/darwin/ios/ios_surface_software.h" -namespace shell { +namespace flutter { // The name of the Info.plist flag to enable the embedded iOS views preview. const char* const kEmbeddedViewsPreview = "io.flutter.embedded_views_preview"; @@ -26,4 +26,4 @@ bool IsIosEmbeddedViewsPreviewEnabled() { FlutterPlatformViewsController* IOSSurface::GetPlatformViewsController() { return platform_views_controller_; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/darwin/ios/ios_surface_gl.h b/shell/platform/darwin/ios/ios_surface_gl.h index 7de1e00a31ee5..116033fda19ad 100644 --- a/shell/platform/darwin/ios/ios_surface_gl.h +++ b/shell/platform/darwin/ios/ios_surface_gl.h @@ -14,7 +14,7 @@ @class CAEAGLLayer; -namespace shell { +namespace flutter { class IOSSurfaceGL : public IOSSurface, public GPUSurfaceGLDelegate, @@ -48,7 +48,7 @@ class IOSSurfaceGL : public IOSSurface, bool UseOffscreenSurface() const override; - // |shell::GPUSurfaceGLDelegate| + // |GPUSurfaceGLDelegate| flow::ExternalViewEmbedder* GetExternalViewEmbedder() override; // |flow::ExternalViewEmbedder| @@ -73,6 +73,6 @@ class IOSSurfaceGL : public IOSSurface, FML_DISALLOW_COPY_AND_ASSIGN(IOSSurfaceGL); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_GL_H_ diff --git a/shell/platform/darwin/ios/ios_surface_gl.mm b/shell/platform/darwin/ios/ios_surface_gl.mm index 2c7ab3a2d13bd..0973dbfeb4fbd 100644 --- a/shell/platform/darwin/ios/ios_surface_gl.mm +++ b/shell/platform/darwin/ios/ios_surface_gl.mm @@ -7,7 +7,7 @@ #include "flutter/fml/trace_event.h" #include "flutter/shell/gpu/gpu_surface_gl.h" -namespace shell { +namespace flutter { IOSSurfaceGL::IOSSurfaceGL(std::shared_ptr context, fml::scoped_nsobject layer, @@ -118,4 +118,4 @@ return submitted; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/darwin/ios/ios_surface_software.h b/shell/platform/darwin/ios/ios_surface_software.h index 79695b3a2767d..c45342a3dac6c 100644 --- a/shell/platform/darwin/ios/ios_surface_software.h +++ b/shell/platform/darwin/ios/ios_surface_software.h @@ -13,7 +13,7 @@ @class CALayer; -namespace shell { +namespace flutter { class IOSSurfaceSoftware final : public IOSSurface, public GPUSurfaceSoftwareDelegate, @@ -24,25 +24,25 @@ class IOSSurfaceSoftware final : public IOSSurface, ~IOSSurfaceSoftware() override; - // |shell::IOSSurface| + // |IOSSurface| bool IsValid() const override; - // |shell::IOSSurface| + // |IOSSurface| bool ResourceContextMakeCurrent() override; - // |shell::IOSSurface| + // |IOSSurface| void UpdateStorageSizeIfNecessary() override; - // |shell::IOSSurface| + // |IOSSurface| std::unique_ptr CreateGPUSurface() override; - // |shell::GPUSurfaceSoftwareDelegate| + // |GPUSurfaceSoftwareDelegate| sk_sp AcquireBackingStore(const SkISize& size) override; - // |shell::GPUSurfaceSoftwareDelegate| + // |GPUSurfaceSoftwareDelegate| bool PresentBackingStore(sk_sp backing_store) override; - // |shell::GPUSurfaceSoftwareDelegate| + // |GPUSurfaceSoftwareDelegate| flow::ExternalViewEmbedder* GetExternalViewEmbedder() override; // |flow::ExternalViewEmbedder| @@ -67,6 +67,6 @@ class IOSSurfaceSoftware final : public IOSSurface, FML_DISALLOW_COPY_AND_ASSIGN(IOSSurfaceSoftware); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_SOFTWARE_H_ diff --git a/shell/platform/darwin/ios/ios_surface_software.mm b/shell/platform/darwin/ios/ios_surface_software.mm index 714f5a56107fe..2731ad9c07dbb 100644 --- a/shell/platform/darwin/ios/ios_surface_software.mm +++ b/shell/platform/darwin/ios/ios_surface_software.mm @@ -13,7 +13,7 @@ #include "flutter/fml/trace_event.h" #include "third_party/skia/include/utils/mac/SkCGUtils.h" -namespace shell { +namespace flutter { IOSSurfaceSoftware::IOSSurfaceSoftware(fml::scoped_nsobject layer, FlutterPlatformViewsController* platform_views_controller) @@ -168,4 +168,4 @@ return platform_views_controller->SubmitFrame(false, nullptr, nullptr); } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/darwin/ios/platform_view_ios.h b/shell/platform/darwin/ios/platform_view_ios.h index 1b13055ee14b3..38fc2a9f30b28 100644 --- a/shell/platform/darwin/ios/platform_view_ios.h +++ b/shell/platform/darwin/ios/platform_view_ios.h @@ -22,7 +22,7 @@ @class FlutterViewController; -namespace shell { +namespace flutter { class PlatformViewIOS final : public PlatformView { public: @@ -41,7 +41,7 @@ class PlatformViewIOS final : public PlatformView { void SetTextInputPlugin(fml::scoped_nsprotocol plugin); - // |shell::PlatformView| + // |PlatformView| void SetSemanticsEnabled(bool enabled) override; private: @@ -53,31 +53,31 @@ class PlatformViewIOS final : public PlatformView { fml::scoped_nsprotocol text_input_plugin_; fml::closure firstFrameCallback_; - // |shell::PlatformView| + // |PlatformView| void HandlePlatformMessage(fml::RefPtr message) override; - // |shell::PlatformView| + // |PlatformView| std::unique_ptr CreateRenderingSurface() override; - // |shell::PlatformView| + // |PlatformView| sk_sp CreateResourceContext() const override; - // |shell::PlatformView| + // |PlatformView| void SetAccessibilityFeatures(int32_t flags) override; - // |shell::PlatformView| + // |PlatformView| void UpdateSemantics(flutter::SemanticsNodeUpdates update, flutter::CustomAccessibilityActionUpdates actions) override; - // |shell::PlatformView| + // |PlatformView| std::unique_ptr CreateVSyncWaiter() override; - // |shell::PlatformView| + // |PlatformView| void OnPreEngineRestart() const override; FML_DISALLOW_COPY_AND_ASSIGN(PlatformViewIOS); }; -} // namespace shell +} // namespace flutter #endif // SHELL_PLATFORM_IOS_PLATFORM_VIEW_IOS_H_ diff --git a/shell/platform/darwin/ios/platform_view_ios.mm b/shell/platform/darwin/ios/platform_view_ios.mm index d2a24ffce0725..c80ae377c03a1 100644 --- a/shell/platform/darwin/ios/platform_view_ios.mm +++ b/shell/platform/darwin/ios/platform_view_ios.mm @@ -11,13 +11,13 @@ #include "flutter/common/task_runners.h" #include "flutter/fml/synchronization/waitable_event.h" #include "flutter/fml/trace_event.h" -#include "flutter/shell/common/io_manager.h" +#include "flutter/shell/common/shell_io_manager.h" #include "flutter/shell/gpu/gpu_surface_gl_delegate.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 { +namespace flutter { PlatformViewIOS::PlatformViewIOS(PlatformView::Delegate& delegate, flutter::TaskRunners task_runners) @@ -33,7 +33,7 @@ return platform_message_router_; } -// |shell::PlatformView| +// |PlatformView| void PlatformViewIOS::HandlePlatformMessage(fml::RefPtr message) { platform_message_router_.HandlePlatformMessage(std::move(message)); } @@ -71,7 +71,7 @@ new AccessibilityBridge(static_cast(owner_controller_.get().view), RegisterTexture(std::make_shared(texture_id, texture)); } -// |shell::PlatformView| +// |PlatformView| std::unique_ptr PlatformViewIOS::CreateRenderingSurface() { if (!ios_surface_) { FML_DLOG(INFO) << "Could not CreateRenderingSurface, this PlatformViewIOS " @@ -81,7 +81,7 @@ new AccessibilityBridge(static_cast(owner_controller_.get().view), return ios_surface_->CreateGPUSurface(); } -// |shell::PlatformView| +// |PlatformView| sk_sp PlatformViewIOS::CreateResourceContext() const { if (!gl_context_ || !gl_context_->ResourceMakeCurrent()) { FML_DLOG(INFO) << "Could not make resource context current on IO thread. " @@ -90,11 +90,11 @@ new AccessibilityBridge(static_cast(owner_controller_.get().view), return nullptr; } - return IOManager::CreateCompatibleResourceLoadingContext( + return ShellIOManager::CreateCompatibleResourceLoadingContext( GrBackend::kOpenGL_GrBackend, GPUSurfaceGLDelegate::GetDefaultPlatformGLInterface()); } -// |shell::PlatformView| +// |PlatformView| void PlatformViewIOS::SetSemanticsEnabled(bool enabled) { if (!owner_controller_) { FML_LOG(WARNING) << "Could not set semantics to enabled, this " @@ -116,7 +116,7 @@ new AccessibilityBridge(static_cast(owner_controller_.get().view), PlatformView::SetAccessibilityFeatures(flags); } -// |shell::PlatformView| +// |PlatformView| void PlatformViewIOS::UpdateSemantics(flutter::SemanticsNodeUpdates update, flutter::CustomAccessibilityActionUpdates actions) { FML_DCHECK(owner_controller_); @@ -127,7 +127,7 @@ new AccessibilityBridge(static_cast(owner_controller_.get().view), } } -// |shell::PlatformView| +// |PlatformView| std::unique_ptr PlatformViewIOS::CreateVSyncWaiter() { return std::make_unique(task_runners_); } @@ -150,4 +150,4 @@ new AccessibilityBridge(static_cast(owner_controller_.get().view), text_input_plugin_ = plugin; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index ba48329a49c37..ee9e05282e57a 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -115,11 +115,11 @@ static void* DefaultGLProcResolver(const char* name) { } #endif // OS_LINUX || OS_WIN -static shell::Shell::CreateCallback +static flutter::Shell::CreateCallback InferOpenGLPlatformViewCreationCallback( const FlutterRendererConfig* config, void* user_data, - shell::PlatformViewEmbedder::PlatformDispatchTable + flutter::PlatformViewEmbedder::PlatformDispatchTable platform_dispatch_table) { if (config->type != kOpenGL) { return nullptr; @@ -165,7 +165,7 @@ InferOpenGLPlatformViewCreationCallback( }; } - shell::GPUSurfaceGLDelegate::GLProcResolver gl_proc_resolver = nullptr; + flutter::GPUSurfaceGLDelegate::GLProcResolver gl_proc_resolver = nullptr; if (SAFE_ACCESS(open_gl_config, gl_proc_resolver, nullptr) != nullptr) { gl_proc_resolver = [ptr = config->open_gl.gl_proc_resolver, user_data](const char* gl_proc_name) { @@ -180,7 +180,7 @@ InferOpenGLPlatformViewCreationCallback( bool fbo_reset_after_present = SAFE_ACCESS(open_gl_config, fbo_reset_after_present, false); - shell::EmbedderSurfaceGL::GLDispatchTable gl_dispatch_table = { + flutter::EmbedderSurfaceGL::GLDispatchTable gl_dispatch_table = { gl_make_current, // gl_make_current_callback gl_clear_current, // gl_clear_current_callback gl_present, // gl_present_callback @@ -191,8 +191,8 @@ InferOpenGLPlatformViewCreationCallback( }; return [gl_dispatch_table, fbo_reset_after_present, - platform_dispatch_table](shell::Shell& shell) { - return std::make_unique( + platform_dispatch_table](flutter::Shell& shell) { + return std::make_unique( shell, // delegate shell.GetTaskRunners(), // task runners gl_dispatch_table, // embedder GL dispatch table @@ -202,11 +202,11 @@ InferOpenGLPlatformViewCreationCallback( }; } -static shell::Shell::CreateCallback +static flutter::Shell::CreateCallback InferSoftwarePlatformViewCreationCallback( const FlutterRendererConfig* config, void* user_data, - shell::PlatformViewEmbedder::PlatformDispatchTable + flutter::PlatformViewEmbedder::PlatformDispatchTable platform_dispatch_table) { if (config->type != kSoftware) { return nullptr; @@ -218,27 +218,27 @@ InferSoftwarePlatformViewCreationCallback( return ptr(user_data, allocation, row_bytes, height); }; - shell::EmbedderSurfaceSoftware::SoftwareDispatchTable + flutter::EmbedderSurfaceSoftware::SoftwareDispatchTable software_dispatch_table = { software_present_backing_store, // required }; - return - [software_dispatch_table, platform_dispatch_table](shell::Shell& shell) { - return std::make_unique( - shell, // delegate - shell.GetTaskRunners(), // task runners - software_dispatch_table, // software dispatch table - platform_dispatch_table // platform dispatch table - ); - }; + return [software_dispatch_table, + platform_dispatch_table](flutter::Shell& shell) { + return std::make_unique( + shell, // delegate + shell.GetTaskRunners(), // task runners + software_dispatch_table, // software dispatch table + platform_dispatch_table // platform dispatch table + ); + }; } -static shell::Shell::CreateCallback +static flutter::Shell::CreateCallback InferPlatformViewCreationCallback( const FlutterRendererConfig* config, void* user_data, - shell::PlatformViewEmbedder::PlatformDispatchTable + flutter::PlatformViewEmbedder::PlatformDispatchTable platform_dispatch_table) { if (config == nullptr) { return nullptr; @@ -348,11 +348,11 @@ FlutterEngineResult FlutterEngineRun(size_t version, if (SAFE_ACCESS(args, persistent_cache_path, nullptr) != nullptr) { std::string persistent_cache_path = SAFE_ACCESS(args, persistent_cache_path, nullptr); - shell::PersistentCache::SetCacheDirectoryPath(persistent_cache_path); + flutter::PersistentCache::SetCacheDirectoryPath(persistent_cache_path); } if (SAFE_ACCESS(args, is_persistent_cache_read_only, false)) { - shell::PersistentCache::gIsReadOnly = true; + flutter::PersistentCache::gIsReadOnly = true; } fml::CommandLine command_line; @@ -363,7 +363,7 @@ FlutterEngineResult FlutterEngineRun(size_t version, SAFE_ACCESS(args, command_line_argv, nullptr)); } - flutter::Settings settings = shell::SettingsFromCommandLine(command_line); + flutter::Settings settings = flutter::SettingsFromCommandLine(command_line); PopulateSnapshotMappingCallbacks(args, settings); @@ -397,7 +397,7 @@ FlutterEngineResult FlutterEngineRun(size_t version, }; } - shell::PlatformViewEmbedder::UpdateSemanticsNodesCallback + flutter::PlatformViewEmbedder::UpdateSemanticsNodesCallback update_semantics_nodes_callback = nullptr; if (SAFE_ACCESS(args, update_semantics_node_callback, nullptr) != nullptr) { update_semantics_nodes_callback = @@ -455,7 +455,7 @@ FlutterEngineResult FlutterEngineRun(size_t version, }; } - shell::PlatformViewEmbedder::UpdateSemanticsCustomActionsCallback + flutter::PlatformViewEmbedder::UpdateSemanticsCustomActionsCallback update_semantics_custom_actions_callback = nullptr; if (SAFE_ACCESS(args, update_semantics_custom_action_callback, nullptr) != nullptr) { @@ -481,7 +481,7 @@ FlutterEngineResult FlutterEngineRun(size_t version, }; } - shell::PlatformViewEmbedder::PlatformMessageResponseCallback + flutter::PlatformViewEmbedder::PlatformMessageResponseCallback platform_message_response_callback = nullptr; if (SAFE_ACCESS(args, platform_message_callback, nullptr) != nullptr) { platform_message_response_callback = @@ -500,19 +500,20 @@ FlutterEngineResult FlutterEngineRun(size_t version, }; } - shell::VsyncWaiterEmbedder::VsyncCallback vsync_callback = nullptr; + flutter::VsyncWaiterEmbedder::VsyncCallback vsync_callback = nullptr; if (SAFE_ACCESS(args, vsync_callback, nullptr) != nullptr) { vsync_callback = [ptr = args->vsync_callback, user_data](intptr_t baton) { return ptr(user_data, baton); }; } - shell::PlatformViewEmbedder::PlatformDispatchTable platform_dispatch_table = { - update_semantics_nodes_callback, // - update_semantics_custom_actions_callback, // - platform_message_response_callback, // - vsync_callback, // - }; + flutter::PlatformViewEmbedder::PlatformDispatchTable platform_dispatch_table = + { + update_semantics_nodes_callback, // + update_semantics_custom_actions_callback, // + platform_message_response_callback, // + vsync_callback, // + }; auto on_create_platform_view = InferPlatformViewCreationCallback( config, user_data, platform_dispatch_table); @@ -521,14 +522,14 @@ FlutterEngineResult FlutterEngineRun(size_t version, return LOG_EMBEDDER_ERROR(kInvalidArguments); } - shell::Shell::CreateCallback on_create_rasterizer = - [](shell::Shell& shell) { - return std::make_unique(shell.GetTaskRunners()); + flutter::Shell::CreateCallback on_create_rasterizer = + [](flutter::Shell& shell) { + return std::make_unique(shell.GetTaskRunners()); }; // TODO(chinmaygarde): This is the wrong spot for this. It belongs in the // platform view jump table. - shell::EmbedderExternalTextureGL::ExternalTextureCallback + flutter::EmbedderExternalTextureGL::ExternalTextureCallback external_texture_callback; if (config->type == kOpenGL) { const FlutterOpenGLRendererConfig* open_gl_config = &config->open_gl; @@ -578,7 +579,7 @@ FlutterEngineResult FlutterEngineRun(size_t version, } auto thread_host = - shell::EmbedderThreadHost::CreateEmbedderOrEngineManagedThreadHost( + flutter::EmbedderThreadHost::CreateEmbedderOrEngineManagedThreadHost( SAFE_ACCESS(args, custom_task_runners, nullptr)); if (!thread_host || !thread_host->IsValid()) { @@ -596,12 +597,12 @@ FlutterEngineResult FlutterEngineRun(size_t version, // Step 1: Create the engine. auto embedder_engine = - std::make_unique(std::move(thread_host), // - std::move(task_runners), // - settings, // - on_create_platform_view, // - on_create_rasterizer, // - external_texture_callback // + std::make_unique(std::move(thread_host), // + std::move(task_runners), // + settings, // + on_create_platform_view, // + on_create_rasterizer, // + external_texture_callback // ); if (!embedder_engine->IsValid()) { @@ -614,7 +615,8 @@ FlutterEngineResult FlutterEngineRun(size_t version, } // Step 3: Run the engine. - auto run_configuration = shell::RunConfiguration::InferFromSettings(settings); + auto run_configuration = + flutter::RunConfiguration::InferFromSettings(settings); if (SAFE_ACCESS(args, custom_dart_entrypoint, nullptr) != nullptr) { auto dart_entrypoint = std::string{args->custom_dart_entrypoint}; @@ -647,7 +649,7 @@ FlutterEngineResult FlutterEngineShutdown(FlutterEngine engine) { if (engine == nullptr) { return LOG_EMBEDDER_ERROR(kInvalidArguments); } - auto embedder_engine = reinterpret_cast(engine); + auto embedder_engine = reinterpret_cast(engine); embedder_engine->NotifyDestroyed(); delete embedder_engine; return kSuccess; @@ -666,7 +668,7 @@ FlutterEngineResult FlutterEngineSendWindowMetricsEvent( metrics.physical_height = SAFE_ACCESS(flutter_metrics, height, 0.0); metrics.device_pixel_ratio = SAFE_ACCESS(flutter_metrics, pixel_ratio, 1.0); - return reinterpret_cast(engine)->SetViewportMetrics( + return reinterpret_cast(engine)->SetViewportMetrics( std::move(metrics)) ? kSuccess : LOG_EMBEDDER_ERROR(kInvalidArguments); @@ -738,7 +740,7 @@ FlutterEngineResult FlutterEngineSendPointerEvent( reinterpret_cast(current) + current->struct_size); } - return reinterpret_cast(engine) + return reinterpret_cast(engine) ->DispatchPointerDataPacket(std::move(packet)) ? kSuccess : LOG_EMBEDDER_ERROR(kInvalidArguments); @@ -763,8 +765,8 @@ FlutterEngineResult FlutterEngineSendPlatformMessage( flutter_message->message + flutter_message->message_size), nullptr); - return reinterpret_cast(engine)->SendPlatformMessage( - std::move(message)) + return reinterpret_cast(engine) + ->SendPlatformMessage(std::move(message)) ? kSuccess : LOG_EMBEDDER_ERROR(kInvalidArguments); } @@ -803,7 +805,7 @@ FlutterEngineResult FlutterEngineRegisterExternalTexture( if (engine == nullptr || texture_identifier == 0) { return LOG_EMBEDDER_ERROR(kInvalidArguments); } - if (!reinterpret_cast(engine)->RegisterTexture( + if (!reinterpret_cast(engine)->RegisterTexture( texture_identifier)) { return LOG_EMBEDDER_ERROR(kInternalInconsistency); } @@ -817,7 +819,7 @@ FlutterEngineResult FlutterEngineUnregisterExternalTexture( return kInvalidArguments; } - if (!reinterpret_cast(engine)->UnregisterTexture( + if (!reinterpret_cast(engine)->UnregisterTexture( texture_identifier)) { return LOG_EMBEDDER_ERROR(kInternalInconsistency); } @@ -831,7 +833,7 @@ FlutterEngineResult FlutterEngineMarkExternalTextureFrameAvailable( if (engine == nullptr || texture_identifier == 0) { return LOG_EMBEDDER_ERROR(kInvalidArguments); } - if (!reinterpret_cast(engine) + if (!reinterpret_cast(engine) ->MarkTextureFrameAvailable(texture_identifier)) { return LOG_EMBEDDER_ERROR(kInternalInconsistency); } @@ -843,7 +845,7 @@ FlutterEngineResult FlutterEngineUpdateSemanticsEnabled(FlutterEngine engine, if (engine == nullptr) { return LOG_EMBEDDER_ERROR(kInvalidArguments); } - if (!reinterpret_cast(engine)->SetSemanticsEnabled( + if (!reinterpret_cast(engine)->SetSemanticsEnabled( enabled)) { return LOG_EMBEDDER_ERROR(kInternalInconsistency); } @@ -856,7 +858,7 @@ FlutterEngineResult FlutterEngineUpdateAccessibilityFeatures( if (engine == nullptr) { return LOG_EMBEDDER_ERROR(kInvalidArguments); } - if (!reinterpret_cast(engine) + if (!reinterpret_cast(engine) ->SetAccessibilityFeatures(flags)) { return LOG_EMBEDDER_ERROR(kInternalInconsistency); } @@ -873,7 +875,7 @@ FlutterEngineResult FlutterEngineDispatchSemanticsAction( return LOG_EMBEDDER_ERROR(kInvalidArguments); } auto engine_action = static_cast(action); - if (!reinterpret_cast(engine) + if (!reinterpret_cast(engine) ->DispatchSemanticsAction( id, engine_action, std::vector({data, data + data_length}))) { @@ -898,7 +900,7 @@ FlutterEngineResult FlutterEngineOnVsync(FlutterEngine engine, auto target_time = fml::TimePoint::FromEpochDelta( fml::TimeDelta::FromNanoseconds(frame_target_time_nanos)); - if (!reinterpret_cast(engine)->OnVsyncEvent( + if (!reinterpret_cast(engine)->OnVsyncEvent( baton, start_time, target_time)) { return LOG_EMBEDDER_ERROR(kInternalInconsistency); } @@ -927,8 +929,8 @@ FlutterEngineResult FlutterEnginePostRenderThreadTask(FlutterEngine engine, auto task = [callback, baton]() { callback(baton); }; - return reinterpret_cast(engine)->PostRenderThreadTask( - task) + return reinterpret_cast(engine) + ->PostRenderThreadTask(task) ? kSuccess : LOG_EMBEDDER_ERROR(kInternalInconsistency); } @@ -943,7 +945,7 @@ FlutterEngineResult FlutterEngineRunTask(FlutterEngine engine, return LOG_EMBEDDER_ERROR(kInvalidArguments); } - return reinterpret_cast(engine)->RunTask(task) + return reinterpret_cast(engine)->RunTask(task) ? kSuccess : LOG_EMBEDDER_ERROR(kInvalidArguments); } diff --git a/shell/platform/embedder/embedder_engine.cc b/shell/platform/embedder/embedder_engine.cc index ad48b52802a1c..79c8cf2f8b672 100644 --- a/shell/platform/embedder/embedder_engine.cc +++ b/shell/platform/embedder/embedder_engine.cc @@ -7,7 +7,7 @@ #include "flutter/fml/make_copyable.h" #include "flutter/shell/platform/embedder/vsync_waiter_embedder.h" -namespace shell { +namespace flutter { EmbedderEngine::EmbedderEngine( std::unique_ptr thread_host, @@ -65,7 +65,7 @@ bool EmbedderEngine::Run(RunConfiguration run_configuration) { ]() mutable { if (engine) { auto result = engine->Run(std::move(config)); - if (result == shell::Engine::RunStatus::Failure) { + if (result == Engine::RunStatus::Failure) { FML_LOG(ERROR) << "Could not launch the engine with configuration."; } } @@ -224,4 +224,4 @@ bool EmbedderEngine::RunTask(const FlutterTask* task) { task->task); } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/embedder/embedder_engine.h b/shell/platform/embedder/embedder_engine.h index c6ea8d55ea9c2..124f829fd1906 100644 --- a/shell/platform/embedder/embedder_engine.h +++ b/shell/platform/embedder/embedder_engine.h @@ -16,7 +16,7 @@ #include "flutter/shell/platform/embedder/embedder_external_texture_gl.h" #include "flutter/shell/platform/embedder/embedder_thread_host.h" -namespace shell { +namespace flutter { // The object that is returned to the embedder as an opaque pointer to the // instance of the Flutter engine. @@ -80,6 +80,6 @@ class EmbedderEngine { FML_DISALLOW_COPY_AND_ASSIGN(EmbedderEngine); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_ENGINE_H_ diff --git a/shell/platform/embedder/embedder_external_texture_gl.cc b/shell/platform/embedder/embedder_external_texture_gl.cc index d4c863c3766ca..80a49ee5db06d 100644 --- a/shell/platform/embedder/embedder_external_texture_gl.cc +++ b/shell/platform/embedder/embedder_external_texture_gl.cc @@ -6,7 +6,7 @@ #include "flutter/fml/logging.h" -namespace shell { +namespace flutter { EmbedderExternalTextureGL::EmbedderExternalTextureGL( int64_t texture_identifier, @@ -43,4 +43,4 @@ void EmbedderExternalTextureGL::OnGrContextDestroyed() {} // |flow::Texture| void EmbedderExternalTextureGL::MarkNewFrameAvailable() {} -} // namespace shell +} // namespace flutter diff --git a/shell/platform/embedder/embedder_external_texture_gl.h b/shell/platform/embedder/embedder_external_texture_gl.h index 73017daf195ff..c99b165236027 100644 --- a/shell/platform/embedder/embedder_external_texture_gl.h +++ b/shell/platform/embedder/embedder_external_texture_gl.h @@ -10,7 +10,7 @@ #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkSize.h" -namespace shell { +namespace flutter { class EmbedderExternalTextureGL : public flow::Texture { public: @@ -41,6 +41,6 @@ class EmbedderExternalTextureGL : public flow::Texture { FML_DISALLOW_COPY_AND_ASSIGN(EmbedderExternalTextureGL); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_EXTERNAL_TEXTURE_GL_H_ diff --git a/shell/platform/embedder/embedder_surface.cc b/shell/platform/embedder/embedder_surface.cc index b61802cbce9ac..dbe619b8e0fa7 100644 --- a/shell/platform/embedder/embedder_surface.cc +++ b/shell/platform/embedder/embedder_surface.cc @@ -4,10 +4,10 @@ #include "flutter/shell/platform/embedder/embedder_surface.h" -namespace shell { +namespace flutter { EmbedderSurface::EmbedderSurface() = default; EmbedderSurface::~EmbedderSurface() = default; -} // namespace shell +} // namespace flutter diff --git a/shell/platform/embedder/embedder_surface.h b/shell/platform/embedder/embedder_surface.h index 74af9462b1af4..a6d11e3e29c90 100644 --- a/shell/platform/embedder/embedder_surface.h +++ b/shell/platform/embedder/embedder_surface.h @@ -8,7 +8,7 @@ #include "flutter/fml/macros.h" #include "flutter/shell/common/surface.h" -namespace shell { +namespace flutter { class EmbedderSurface { public: @@ -26,6 +26,6 @@ class EmbedderSurface { FML_DISALLOW_COPY_AND_ASSIGN(EmbedderSurface); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_H_ diff --git a/shell/platform/embedder/embedder_surface_gl.cc b/shell/platform/embedder/embedder_surface_gl.cc index 487111d698423..f006ca0fdad7d 100644 --- a/shell/platform/embedder/embedder_surface_gl.cc +++ b/shell/platform/embedder/embedder_surface_gl.cc @@ -4,9 +4,9 @@ #include "flutter/shell/platform/embedder/embedder_surface_gl.h" -#include "flutter/shell/common/io_manager.h" +#include "flutter/shell/common/shell_io_manager.h" -namespace shell { +namespace flutter { EmbedderSurfaceGL::EmbedderSurfaceGL(GLDispatchTable gl_dispatch_table, bool fbo_reset_after_present) @@ -25,37 +25,37 @@ EmbedderSurfaceGL::EmbedderSurfaceGL(GLDispatchTable gl_dispatch_table, EmbedderSurfaceGL::~EmbedderSurfaceGL() = default; -// |shell::EmbedderSurface| +// |EmbedderSurface| bool EmbedderSurfaceGL::IsValid() const { return valid_; } -// |shell::GPUSurfaceGLDelegate| +// |GPUSurfaceGLDelegate| bool EmbedderSurfaceGL::GLContextMakeCurrent() { return gl_dispatch_table_.gl_make_current_callback(); } -// |shell::GPUSurfaceGLDelegate| +// |GPUSurfaceGLDelegate| bool EmbedderSurfaceGL::GLContextClearCurrent() { return gl_dispatch_table_.gl_clear_current_callback(); } -// |shell::GPUSurfaceGLDelegate| +// |GPUSurfaceGLDelegate| bool EmbedderSurfaceGL::GLContextPresent() { return gl_dispatch_table_.gl_present_callback(); } -// |shell::GPUSurfaceGLDelegate| +// |GPUSurfaceGLDelegate| intptr_t EmbedderSurfaceGL::GLContextFBO() const { return gl_dispatch_table_.gl_fbo_callback(); } -// |shell::GPUSurfaceGLDelegate| +// |GPUSurfaceGLDelegate| bool EmbedderSurfaceGL::GLContextFBOResetAfterPresent() const { return fbo_reset_after_present_; } -// |shell::GPUSurfaceGLDelegate| +// |GPUSurfaceGLDelegate| SkMatrix EmbedderSurfaceGL::GLContextSurfaceTransformation() const { auto callback = gl_dispatch_table_.gl_surface_transformation_callback; if (!callback) { @@ -66,21 +66,21 @@ SkMatrix EmbedderSurfaceGL::GLContextSurfaceTransformation() const { return callback(); } -// |shell::GPUSurfaceGLDelegate| +// |GPUSurfaceGLDelegate| EmbedderSurfaceGL::GLProcResolver EmbedderSurfaceGL::GetGLProcResolver() const { return gl_dispatch_table_.gl_proc_resolver; } -// |shell::EmbedderSurface| +// |EmbedderSurface| std::unique_ptr EmbedderSurfaceGL::CreateGPUSurface() { return std::make_unique(this); } -// |shell::EmbedderSurface| +// |EmbedderSurface| sk_sp EmbedderSurfaceGL::CreateResourceContext() const { auto callback = gl_dispatch_table_.gl_make_resource_current_callback; if (callback && callback()) { - if (auto context = IOManager::CreateCompatibleResourceLoadingContext( + if (auto context = ShellIOManager::CreateCompatibleResourceLoadingContext( GrBackend::kOpenGL_GrBackend, GetGLInterface())) { return context; } else { @@ -99,4 +99,4 @@ sk_sp EmbedderSurfaceGL::CreateResourceContext() const { return nullptr; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/embedder/embedder_surface_gl.h b/shell/platform/embedder/embedder_surface_gl.h index 949997b687ac4..faf3dfba171fd 100644 --- a/shell/platform/embedder/embedder_surface_gl.h +++ b/shell/platform/embedder/embedder_surface_gl.h @@ -9,7 +9,7 @@ #include "flutter/shell/gpu/gpu_surface_gl.h" #include "flutter/shell/platform/embedder/embedder_surface.h" -namespace shell { +namespace flutter { class EmbedderSurfaceGL final : public EmbedderSurface, public GPUSurfaceGLDelegate { @@ -35,39 +35,39 @@ class EmbedderSurfaceGL final : public EmbedderSurface, GLDispatchTable gl_dispatch_table_; bool fbo_reset_after_present_; - // |shell::EmbedderSurface| + // |EmbedderSurface| bool IsValid() const override; - // |shell::EmbedderSurface| + // |EmbedderSurface| std::unique_ptr CreateGPUSurface() override; - // |shell::EmbedderSurface| + // |EmbedderSurface| sk_sp CreateResourceContext() const override; - // |shell::GPUSurfaceGLDelegate| + // |GPUSurfaceGLDelegate| bool GLContextMakeCurrent() override; - // |shell::GPUSurfaceGLDelegate| + // |GPUSurfaceGLDelegate| bool GLContextClearCurrent() override; - // |shell::GPUSurfaceGLDelegate| + // |GPUSurfaceGLDelegate| bool GLContextPresent() override; - // |shell::GPUSurfaceGLDelegate| + // |GPUSurfaceGLDelegate| intptr_t GLContextFBO() const override; - // |shell::GPUSurfaceGLDelegate| + // |GPUSurfaceGLDelegate| bool GLContextFBOResetAfterPresent() const override; - // |shell::GPUSurfaceGLDelegate| + // |GPUSurfaceGLDelegate| SkMatrix GLContextSurfaceTransformation() const override; - // |shell::GPUSurfaceGLDelegate| + // |GPUSurfaceGLDelegate| GLProcResolver GetGLProcResolver() const override; FML_DISALLOW_COPY_AND_ASSIGN(EmbedderSurfaceGL); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_GL_H_ diff --git a/shell/platform/embedder/embedder_surface_software.cc b/shell/platform/embedder/embedder_surface_software.cc index 7b7192dc99a56..0d24933cf5e3d 100644 --- a/shell/platform/embedder/embedder_surface_software.cc +++ b/shell/platform/embedder/embedder_surface_software.cc @@ -7,7 +7,7 @@ #include "flutter/fml/trace_event.h" #include "third_party/skia/include/gpu/GrContext.h" -namespace shell { +namespace flutter { EmbedderSurfaceSoftware::EmbedderSurfaceSoftware( SoftwareDispatchTable software_dispatch_table) @@ -20,12 +20,12 @@ EmbedderSurfaceSoftware::EmbedderSurfaceSoftware( EmbedderSurfaceSoftware::~EmbedderSurfaceSoftware() = default; -// |shell::EmbedderSurface| +// |EmbedderSurface| bool EmbedderSurfaceSoftware::IsValid() const { return valid_; } -// |shell::EmbedderSurface| +// |EmbedderSurface| std::unique_ptr EmbedderSurfaceSoftware::CreateGPUSurface() { if (!IsValid()) { return nullptr; @@ -40,12 +40,12 @@ std::unique_ptr EmbedderSurfaceSoftware::CreateGPUSurface() { return surface; } -// |shell::EmbedderSurface| +// |EmbedderSurface| sk_sp EmbedderSurfaceSoftware::CreateResourceContext() const { return nullptr; } -// |shell::GPUSurfaceSoftwareDelegate| +// |GPUSurfaceSoftwareDelegate| sk_sp EmbedderSurfaceSoftware::AcquireBackingStore( const SkISize& size) { TRACE_EVENT0("flutter", "EmbedderSurfaceSoftware::AcquireBackingStore"); @@ -73,7 +73,7 @@ sk_sp EmbedderSurfaceSoftware::AcquireBackingStore( return sk_surface_; } -// |shell::GPUSurfaceSoftwareDelegate| +// |GPUSurfaceSoftwareDelegate| bool EmbedderSurfaceSoftware::PresentBackingStore( sk_sp backing_store) { if (!IsValid()) { @@ -104,4 +104,4 @@ bool EmbedderSurfaceSoftware::PresentBackingStore( ); } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/embedder/embedder_surface_software.h b/shell/platform/embedder/embedder_surface_software.h index 6bc5d98f89247..6e49f1dc003ac 100644 --- a/shell/platform/embedder/embedder_surface_software.h +++ b/shell/platform/embedder/embedder_surface_software.h @@ -9,7 +9,7 @@ #include "flutter/shell/gpu/gpu_surface_software.h" #include "flutter/shell/platform/embedder/embedder_surface.h" -namespace shell { +namespace flutter { class EmbedderSurfaceSoftware final : public EmbedderSurface, public GPUSurfaceSoftwareDelegate { @@ -28,24 +28,24 @@ class EmbedderSurfaceSoftware final : public EmbedderSurface, SoftwareDispatchTable software_dispatch_table_; sk_sp sk_surface_; - // |shell::EmbedderSurface| + // |EmbedderSurface| bool IsValid() const override; - // |shell::EmbedderSurface| + // |EmbedderSurface| std::unique_ptr CreateGPUSurface() override; - // |shell::EmbedderSurface| + // |EmbedderSurface| sk_sp CreateResourceContext() const override; - // |shell::GPUSurfaceSoftwareDelegate| + // |GPUSurfaceSoftwareDelegate| sk_sp AcquireBackingStore(const SkISize& size) override; - // |shell::GPUSurfaceSoftwareDelegate| + // |GPUSurfaceSoftwareDelegate| bool PresentBackingStore(sk_sp backing_store) override; FML_DISALLOW_COPY_AND_ASSIGN(EmbedderSurfaceSoftware); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_SOFTWARE_H_ diff --git a/shell/platform/embedder/embedder_task_runner.cc b/shell/platform/embedder/embedder_task_runner.cc index c0b5ab862bdf4..9a772f47a9907 100644 --- a/shell/platform/embedder/embedder_task_runner.cc +++ b/shell/platform/embedder/embedder_task_runner.cc @@ -6,7 +6,7 @@ #include "flutter/fml/message_loop_impl.h" -namespace shell { +namespace flutter { EmbedderTaskRunner::EmbedderTaskRunner(DispatchTable table) : TaskRunner(nullptr /* loop implemenation*/), @@ -69,4 +69,4 @@ bool EmbedderTaskRunner::PostTask(uint64_t baton) { return true; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/embedder/embedder_task_runner.h b/shell/platform/embedder/embedder_task_runner.h index 084efbf148a45..507648e652a65 100644 --- a/shell/platform/embedder/embedder_task_runner.h +++ b/shell/platform/embedder/embedder_task_runner.h @@ -12,7 +12,7 @@ #include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/task_runner.h" -namespace shell { +namespace flutter { class EmbedderTaskRunner final : public fml::TaskRunner { public: @@ -52,6 +52,6 @@ class EmbedderTaskRunner final : public fml::TaskRunner { FML_DISALLOW_COPY_AND_ASSIGN(EmbedderTaskRunner); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_TASK_RUNNER_H_ diff --git a/shell/platform/embedder/embedder_thread_host.cc b/shell/platform/embedder/embedder_thread_host.cc index 8cf8515914be1..5c2a1f3ae27ea 100644 --- a/shell/platform/embedder/embedder_thread_host.cc +++ b/shell/platform/embedder/embedder_thread_host.cc @@ -10,7 +10,7 @@ #include "flutter/fml/message_loop.h" #include "flutter/shell/platform/embedder/embedder_safe_access.h" -namespace shell { +namespace flutter { static fml::RefPtr CreateEmbedderTaskRunner( const FlutterTaskRunnerDescription* description) { @@ -203,4 +203,4 @@ bool EmbedderThreadHost::PostTask(int64_t runner, uint64_t task) const { return found->second->PostTask(task); } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/embedder/embedder_thread_host.h b/shell/platform/embedder/embedder_thread_host.h index eb2b5a5eaeced..fc28037f35750 100644 --- a/shell/platform/embedder/embedder_thread_host.h +++ b/shell/platform/embedder/embedder_thread_host.h @@ -15,7 +15,7 @@ #include "flutter/shell/platform/embedder/embedder.h" #include "flutter/shell/platform/embedder/embedder_task_runner.h" -namespace shell { +namespace flutter { class EmbedderThreadHost { public: @@ -49,6 +49,6 @@ class EmbedderThreadHost { FML_DISALLOW_COPY_AND_ASSIGN(EmbedderThreadHost); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_THREAD_HOST_H_ diff --git a/shell/platform/embedder/platform_view_embedder.cc b/shell/platform/embedder/platform_view_embedder.cc index 8a5d6b32830cc..449612417f8cf 100644 --- a/shell/platform/embedder/platform_view_embedder.cc +++ b/shell/platform/embedder/platform_view_embedder.cc @@ -4,7 +4,7 @@ #include "flutter/shell/platform/embedder/platform_view_embedder.h" -namespace shell { +namespace flutter { PlatformViewEmbedder::PlatformViewEmbedder( PlatformView::Delegate& delegate, @@ -62,7 +62,7 @@ void PlatformViewEmbedder::HandlePlatformMessage( std::move(message)); } -// |shell::PlatformView| +// |PlatformView| std::unique_ptr PlatformViewEmbedder::CreateRenderingSurface() { if (embedder_surface_ == nullptr) { FML_LOG(ERROR) << "Embedder surface was null."; @@ -71,7 +71,7 @@ std::unique_ptr PlatformViewEmbedder::CreateRenderingSurface() { return embedder_surface_->CreateGPUSurface(); } -// |shell::PlatformView| +// |PlatformView| sk_sp PlatformViewEmbedder::CreateResourceContext() const { if (embedder_surface_ == nullptr) { FML_LOG(ERROR) << "Embedder surface was null."; @@ -80,7 +80,7 @@ sk_sp PlatformViewEmbedder::CreateResourceContext() const { return embedder_surface_->CreateResourceContext(); } -// |shell::PlatformView| +// |PlatformView| std::unique_ptr PlatformViewEmbedder::CreateVSyncWaiter() { if (!platform_dispatch_table_.vsync_callback) { // Superclass implementation creates a timer based fallback. @@ -91,4 +91,4 @@ std::unique_ptr PlatformViewEmbedder::CreateVSyncWaiter() { platform_dispatch_table_.vsync_callback, task_runners_); } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/embedder/platform_view_embedder.h b/shell/platform/embedder/platform_view_embedder.h index e0d885db4e709..6e40dc5808214 100644 --- a/shell/platform/embedder/platform_view_embedder.h +++ b/shell/platform/embedder/platform_view_embedder.h @@ -15,7 +15,7 @@ #include "flutter/shell/platform/embedder/embedder_surface_software.h" #include "flutter/shell/platform/embedder/vsync_waiter_embedder.h" -namespace shell { +namespace flutter { class PlatformViewEmbedder final : public PlatformView { public: @@ -51,12 +51,12 @@ class PlatformViewEmbedder final : public PlatformView { ~PlatformViewEmbedder() override; - // |shell::PlatformView| + // |PlatformView| void UpdateSemantics( flutter::SemanticsNodeUpdates update, flutter::CustomAccessibilityActionUpdates actions) override; - // |shell::PlatformView| + // |PlatformView| void HandlePlatformMessage( fml::RefPtr message) override; @@ -64,18 +64,18 @@ class PlatformViewEmbedder final : public PlatformView { std::unique_ptr embedder_surface_; PlatformDispatchTable platform_dispatch_table_; - // |shell::PlatformView| + // |PlatformView| std::unique_ptr CreateRenderingSurface() override; - // |shell::PlatformView| + // |PlatformView| sk_sp CreateResourceContext() const override; - // |shell::PlatformView| + // |PlatformView| std::unique_ptr CreateVSyncWaiter() override; FML_DISALLOW_COPY_AND_ASSIGN(PlatformViewEmbedder); }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_PLATFORM_VIEW_EMBEDDER_H_ diff --git a/shell/platform/embedder/tests/embedder_a11y_unittests.cc b/shell/platform/embedder/tests/embedder_a11y_unittests.cc index 326a6bdac0068..5da4938175bfb 100644 --- a/shell/platform/embedder/tests/embedder_a11y_unittests.cc +++ b/shell/platform/embedder/tests/embedder_a11y_unittests.cc @@ -16,7 +16,7 @@ #include "flutter/shell/platform/embedder/tests/embedder_config_builder.h" #include "flutter/testing/testing.h" -namespace shell { +namespace flutter { namespace testing { using Embedder11yTest = testing::EmbedderTest; @@ -168,4 +168,4 @@ TEST_F(Embedder11yTest, A11yTreeIsConsistent) { } } // namespace testing -} // namespace shell +} // namespace flutter diff --git a/shell/platform/embedder/tests/embedder_config_builder.cc b/shell/platform/embedder/tests/embedder_config_builder.cc index 7a43162770d50..d172650357608 100644 --- a/shell/platform/embedder/tests/embedder_config_builder.cc +++ b/shell/platform/embedder/tests/embedder_config_builder.cc @@ -4,7 +4,7 @@ #include "flutter/shell/platform/embedder/tests/embedder_config_builder.h" -namespace shell { +namespace flutter { namespace testing { EmbedderConfigBuilder::EmbedderConfigBuilder( @@ -128,4 +128,4 @@ UniqueEngine EmbedderConfigBuilder::LaunchEngine() { } } // namespace testing -} // namespace shell +} // namespace flutter diff --git a/shell/platform/embedder/tests/embedder_config_builder.h b/shell/platform/embedder/tests/embedder_config_builder.h index 9e0f3fcf62af4..b416278f1a31c 100644 --- a/shell/platform/embedder/tests/embedder_config_builder.h +++ b/shell/platform/embedder/tests/embedder_config_builder.h @@ -11,7 +11,7 @@ #include "flutter/shell/platform/embedder/tests/embedder_context.h" #include "flutter/shell/platform/embedder/tests/embedder_test.h" -namespace shell { +namespace flutter { namespace testing { struct UniqueEngineTraits { @@ -71,6 +71,6 @@ class EmbedderConfigBuilder { }; } // namespace testing -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_CONFIG_BUILDER_H_ diff --git a/shell/platform/embedder/tests/embedder_context.cc b/shell/platform/embedder/tests/embedder_context.cc index 779c50f6329ba..870c18d4d8a13 100644 --- a/shell/platform/embedder/tests/embedder_context.cc +++ b/shell/platform/embedder/tests/embedder_context.cc @@ -6,7 +6,7 @@ #include "flutter/runtime/dart_vm.h" -namespace shell { +namespace flutter { namespace testing { static std::unique_ptr GetMapping(const fml::UniqueFD& directory, @@ -137,4 +137,4 @@ EmbedderContext::GetUpdateSemanticsCustomActionCallbackHook() { } } // namespace testing -} // namespace shell +} // namespace flutter diff --git a/shell/platform/embedder/tests/embedder_context.h b/shell/platform/embedder/tests/embedder_context.h index c1b65a38650da..3ca774ae54c59 100644 --- a/shell/platform/embedder/tests/embedder_context.h +++ b/shell/platform/embedder/tests/embedder_context.h @@ -16,7 +16,7 @@ #include "flutter/shell/platform/embedder/embedder.h" #include "flutter/testing/test_dart_native_resolver.h" -namespace shell { +namespace flutter { namespace testing { using SemanticsNodeCallback = std::function; @@ -78,6 +78,6 @@ class EmbedderContext { }; } // namespace testing -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_CONTEXT_H_ diff --git a/shell/platform/embedder/tests/embedder_test.cc b/shell/platform/embedder/tests/embedder_test.cc index b23e79596745f..06ae0d21cfcfa 100644 --- a/shell/platform/embedder/tests/embedder_test.cc +++ b/shell/platform/embedder/tests/embedder_test.cc @@ -4,7 +4,7 @@ #include "flutter/shell/platform/embedder/tests/embedder_test.h" -namespace shell { +namespace flutter { namespace testing { EmbedderTest::EmbedderTest() = default; @@ -36,4 +36,4 @@ void EmbedderTest::TearDown() { } } // namespace testing -} // namespace shell +} // namespace flutter diff --git a/shell/platform/embedder/tests/embedder_test.h b/shell/platform/embedder/tests/embedder_test.h index f0850bf6f8a7d..1112c8339b75b 100644 --- a/shell/platform/embedder/tests/embedder_test.h +++ b/shell/platform/embedder/tests/embedder_test.h @@ -11,7 +11,7 @@ #include "flutter/shell/platform/embedder/tests/embedder_context.h" #include "flutter/testing/testing.h" -namespace shell { +namespace flutter { namespace testing { class EmbedderTest : public ::testing::Test { @@ -37,6 +37,6 @@ class EmbedderTest : public ::testing::Test { }; } // namespace testing -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_H_ diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc index 25f4ed95a9c8d..f762594820a44 100644 --- a/shell/platform/embedder/tests/embedder_unittests.cc +++ b/shell/platform/embedder/tests/embedder_unittests.cc @@ -17,7 +17,7 @@ #include "flutter/shell/platform/embedder/tests/embedder_test.h" #include "flutter/testing/testing.h" -namespace shell { +namespace flutter { namespace testing { using EmbedderTest = testing::EmbedderTest; @@ -210,4 +210,4 @@ TEST(EmbedderTestNoFixture, CanGetCurrentTimeInNanoseconds) { } } // namespace testing -} // namespace shell +} // namespace flutter diff --git a/shell/platform/embedder/vsync_waiter_embedder.cc b/shell/platform/embedder/vsync_waiter_embedder.cc index c7662b4105e04..64f1cf08e1e1a 100644 --- a/shell/platform/embedder/vsync_waiter_embedder.cc +++ b/shell/platform/embedder/vsync_waiter_embedder.cc @@ -4,7 +4,7 @@ #include "flutter/shell/platform/embedder/vsync_waiter_embedder.h" -namespace shell { +namespace flutter { VsyncWaiterEmbedder::VsyncWaiterEmbedder(VsyncCallback vsync_callback, flutter::TaskRunners task_runners) @@ -14,7 +14,7 @@ VsyncWaiterEmbedder::VsyncWaiterEmbedder(VsyncCallback vsync_callback, VsyncWaiterEmbedder::~VsyncWaiterEmbedder() = default; -// |shell::VsyncWaiter| +// |VsyncWaiter| void VsyncWaiterEmbedder::AwaitVSync() { auto* weak_waiter = new std::weak_ptr(shared_from_this()); vsync_callback_(reinterpret_cast(weak_waiter)); @@ -40,4 +40,4 @@ bool VsyncWaiterEmbedder::OnEmbedderVsync(intptr_t baton, return true; } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/embedder/vsync_waiter_embedder.h b/shell/platform/embedder/vsync_waiter_embedder.h index 84b7f4eeeaacb..9c361e158a061 100644 --- a/shell/platform/embedder/vsync_waiter_embedder.h +++ b/shell/platform/embedder/vsync_waiter_embedder.h @@ -8,7 +8,7 @@ #include "flutter/fml/macros.h" #include "flutter/shell/common/vsync_waiter.h" -namespace shell { +namespace flutter { class VsyncWaiterEmbedder final : public VsyncWaiter { public: @@ -26,12 +26,12 @@ class VsyncWaiterEmbedder final : public VsyncWaiter { private: const VsyncCallback vsync_callback_; - // |shell::VsyncWaiter| + // |VsyncWaiter| void AwaitVSync() override; FML_DISALLOW_COPY_AND_ASSIGN(VsyncWaiterEmbedder); }; -} // namespace shell +} // namespace flutter #endif // SHELL_PLATFORM_EMBEDDER_VSYNC_WAITER_EMBEDDER_H_ diff --git a/shell/platform/glfw/flutter_glfw.cc b/shell/platform/glfw/flutter_glfw.cc index 77a3d40e6a66b..12354f46679c6 100644 --- a/shell/platform/glfw/flutter_glfw.cc +++ b/shell/platform/glfw/flutter_glfw.cc @@ -50,13 +50,13 @@ struct FlutterDesktopWindowState { std::unique_ptr plugin_registrar; // Message dispatch manager for messages from the Flutter engine. - std::unique_ptr message_dispatcher; + std::unique_ptr message_dispatcher; // The plugin registrar managing internal plugins. std::unique_ptr internal_plugin_registrar; // Handlers for keyboard events from GLFW. - std::vector> + std::vector> keyboard_hook_handlers; // Whether or not to track mouse movements to send kHover events. @@ -91,7 +91,7 @@ struct FlutterDesktopMessenger { FlutterEngine engine; // The message dispatcher for handling incoming messages. - shell::IncomingMessageDispatcher* dispatcher; + flutter::IncomingMessageDispatcher* dispatcher; }; // Retrieves state bag for the window in question from the GLFWWindow. @@ -505,7 +505,7 @@ FlutterDesktopWindowRef FlutterDesktopCreateWindow(int initial_width, // that this isn't a tangle of references. auto messenger = std::make_unique(); state->message_dispatcher = - std::make_unique(messenger.get()); + std::make_unique(messenger.get()); messenger->engine = engine; messenger->dispatcher = state->message_dispatcher.get(); @@ -519,9 +519,9 @@ FlutterDesktopWindowRef FlutterDesktopCreateWindow(int initial_width, auto internal_plugin_messenger = state->internal_plugin_registrar->messenger(); state->keyboard_hook_handlers.push_back( - std::make_unique(internal_plugin_messenger)); + std::make_unique(internal_plugin_messenger)); state->keyboard_hook_handlers.push_back( - std::make_unique(internal_plugin_messenger)); + std::make_unique(internal_plugin_messenger)); // Trigger an initial size callback to send size information to Flutter. state->monitor_screen_coordinates_per_inch = GetScreenCoordinatesPerInch(); diff --git a/shell/platform/glfw/key_event_handler.cc b/shell/platform/glfw/key_event_handler.cc index 7e370d0cdc76e..c193fda8a911e 100644 --- a/shell/platform/glfw/key_event_handler.cc +++ b/shell/platform/glfw/key_event_handler.cc @@ -18,7 +18,7 @@ static constexpr char kAndroidKeyMap[] = "android"; static constexpr char kKeyUp[] = "keyup"; static constexpr char kKeyDown[] = "keydown"; -namespace shell { +namespace flutter { KeyEventHandler::KeyEventHandler(flutter::BinaryMessenger* messenger) : channel_( @@ -57,4 +57,4 @@ void KeyEventHandler::KeyboardHook(GLFWwindow* window, channel_->Send(event); } -} // namespace shell \ No newline at end of file +} // namespace flutter \ No newline at end of file diff --git a/shell/platform/glfw/key_event_handler.h b/shell/platform/glfw/key_event_handler.h index 171a17b6208cc..19b0ffa316591 100644 --- a/shell/platform/glfw/key_event_handler.h +++ b/shell/platform/glfw/key_event_handler.h @@ -13,7 +13,7 @@ #include "flutter/shell/platform/glfw/public/flutter_glfw.h" #include "rapidjson/document.h" -namespace shell { +namespace flutter { // Implements a KeyboardHookHandler // @@ -24,14 +24,14 @@ class KeyEventHandler : public KeyboardHookHandler { virtual ~KeyEventHandler(); - // |shell::KeyboardHookHandler| + // |KeyboardHookHandler| void KeyboardHook(GLFWwindow* window, int key, int scancode, int action, int mods) override; - // |shell::KeyboardHookHandler| + // |KeyboardHookHandler| void CharHook(GLFWwindow* window, unsigned int code_point) override; private: @@ -39,6 +39,6 @@ class KeyEventHandler : public KeyboardHookHandler { std::unique_ptr> channel_; }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_GLFW_KEY_EVENT_HANDLER_H_ diff --git a/shell/platform/glfw/keyboard_hook_handler.h b/shell/platform/glfw/keyboard_hook_handler.h index 5415105161e14..8769bd5f7d1a8 100644 --- a/shell/platform/glfw/keyboard_hook_handler.h +++ b/shell/platform/glfw/keyboard_hook_handler.h @@ -9,7 +9,7 @@ #include "flutter/shell/platform/glfw/public/flutter_glfw.h" -namespace shell { +namespace flutter { // Abstract class for handling keyboard input events. class KeyboardHookHandler { @@ -27,6 +27,6 @@ class KeyboardHookHandler { virtual void CharHook(GLFWwindow* window, unsigned int code_point) = 0; }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_GLFW_KEYBOARD_HOOK_HANDLER_H_ diff --git a/shell/platform/glfw/text_input_plugin.cc b/shell/platform/glfw/text_input_plugin.cc index 76dbf8d118798..87706de85129b 100644 --- a/shell/platform/glfw/text_input_plugin.cc +++ b/shell/platform/glfw/text_input_plugin.cc @@ -34,7 +34,7 @@ static constexpr char kInternalConsistencyError[] = static constexpr uint32_t kInputModelLimit = 256; -namespace shell { +namespace flutter { void TextInputPlugin::CharHook(GLFWwindow* window, unsigned int code_point) { if (active_model_ == nullptr) { @@ -207,4 +207,4 @@ void TextInputPlugin::EnterPressed(TextInputModel* model) { channel_->InvokeMethod(kPerformActionMethod, std::move(args)); } -} // namespace shell +} // namespace flutter diff --git a/shell/platform/glfw/text_input_plugin.h b/shell/platform/glfw/text_input_plugin.h index a6d8a4ed5686d..daf2fa7d22f05 100644 --- a/shell/platform/glfw/text_input_plugin.h +++ b/shell/platform/glfw/text_input_plugin.h @@ -14,7 +14,7 @@ #include "flutter/shell/platform/glfw/keyboard_hook_handler.h" #include "flutter/shell/platform/glfw/public/flutter_glfw.h" -namespace shell { +namespace flutter { // Implements a text input plugin. // @@ -25,14 +25,14 @@ class TextInputPlugin : public KeyboardHookHandler { virtual ~TextInputPlugin(); - // |shell::KeyboardHookHandler| + // |KeyboardHookHandler| void KeyboardHook(GLFWwindow* window, int key, int scancode, int action, int mods) override; - // |shell::KeyboardHookHandler| + // |KeyboardHookHandler| void CharHook(GLFWwindow* window, unsigned int code_point) override; private: @@ -57,6 +57,6 @@ class TextInputPlugin : public KeyboardHookHandler { TextInputModel* active_model_; }; -} // namespace shell +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_GLFW_TEXT_INPUT_PLUGIN_H_ diff --git a/shell/testing/tester_main.cc b/shell/testing/tester_main.cc index d3fe5616ff354..fd729d1f434d2 100644 --- a/shell/testing/tester_main.cc +++ b/shell/testing/tester_main.cc @@ -21,7 +21,7 @@ #include "flutter/shell/common/thread_host.h" #include "third_party/dart/runtime/include/bin/dart_io_api.h" -namespace shell { +namespace flutter { // Checks whether the engine's main Dart isolate has no pending work. If so, // then exit the given message loop. @@ -186,7 +186,7 @@ int RunTester(const flutter::Settings& settings, bool run_forever) { reinterpret_cast(&completion_observer), [&completion_observer]() { completion_observer.DidProcessTask(); }); if (engine->Run(std::move(config)) != - shell::Engine::RunStatus::Failure) { + flutter::Engine::RunStatus::Failure) { engine_did_run = true; flutter::ViewportMetrics metrics; @@ -226,7 +226,7 @@ int RunTester(const flutter::Settings& settings, bool run_forever) { return completion_observer.GetExitCodeForLastError(); } -} // namespace shell +} // namespace flutter int main(int argc, char* argv[]) { dart::bin::SetExecutableName(argv[0]); @@ -234,12 +234,12 @@ int main(int argc, char* argv[]) { auto command_line = fml::CommandLineFromArgcArgv(argc, argv); - if (command_line.HasOption(shell::FlagForSwitch(shell::Switch::Help))) { - shell::PrintUsage("flutter_tester"); + if (command_line.HasOption(flutter::FlagForSwitch(flutter::Switch::Help))) { + flutter::PrintUsage("flutter_tester"); return EXIT_SUCCESS; } - auto settings = shell::SettingsFromCommandLine(command_line); + auto settings = flutter::SettingsFromCommandLine(command_line); 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. @@ -266,7 +266,7 @@ int main(int argc, char* argv[]) { fml::MessageLoop::GetCurrent().RemoveTaskObserver(key); }; - return shell::RunTester( - settings, - command_line.HasOption(shell::FlagForSwitch(shell::Switch::RunForever))); + return flutter::RunTester( + settings, command_line.HasOption( + flutter::FlagForSwitch(flutter::Switch::RunForever))); } From 39e1d00f39ffd256f138d7b6f3a79350f880199a Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 9 Apr 2019 17:50:06 -0700 Subject: [PATCH 0763/1117] Remove redundant specification of the |flutter| namespace in the engine. (#8523) --- assets/asset_manager.cc | 4 +- assets/asset_manager.h | 4 +- assets/directory_asset_bundle.cc | 4 +- assets/directory_asset_bundle.h | 4 +- assets/zip_asset_store.cc | 4 +- assets/zip_asset_store.h | 4 +- lib/ui/compositing/scene_host.cc | 8 +- lib/ui/painting/rrect.cc | 8 +- lib/ui/text/asset_manager_font_provider.cc | 4 +- lib/ui/text/asset_manager_font_provider.h | 8 +- lib/ui/text/paragraph_impl_txt.cc | 3 +- lib/ui/text/text_box.cc | 5 +- lib/ui/window/window.h | 2 +- runtime/dart_isolate.cc | 9 +- runtime/dart_isolate_unittests.cc | 6 +- runtime/dart_vm.cc | 17 ++- runtime/embedder_resources.cc | 2 +- runtime/embedder_resources.h | 6 +- runtime/runtime_controller.h | 14 +-- runtime/runtime_delegate.h | 5 +- shell/common/animator.cc | 2 +- shell/common/animator.h | 10 +- shell/common/engine.cc | 59 ++++----- shell/common/engine.h | 76 ++++++------ shell/common/isolate_configuration.cc | 22 ++-- shell/common/isolate_configuration.h | 8 +- shell/common/persistent_cache.cc | 11 +- shell/common/platform_view.cc | 19 ++- shell/common/platform_view.h | 29 ++--- shell/common/rasterizer.cc | 14 +-- shell/common/rasterizer.h | 14 +-- shell/common/run_configuration.cc | 17 ++- shell/common/run_configuration.h | 10 +- shell/common/shell.cc | 138 ++++++++++----------- shell/common/shell.h | 89 +++++++------ shell/common/shell_benchmarks.cc | 12 +- shell/common/shell_test.cc | 12 +- shell/common/shell_test.h | 6 +- shell/common/shell_unittests.cc | 46 ++++--- shell/common/switches.cc | 12 +- shell/common/switches.h | 2 +- shell/common/vsync_waiter.cc | 2 +- shell/common/vsync_waiter.h | 4 +- shell/common/vsync_waiter_fallback.cc | 2 +- shell/common/vsync_waiter_fallback.h | 2 +- 45 files changed, 350 insertions(+), 389 deletions(-) diff --git a/assets/asset_manager.cc b/assets/asset_manager.cc index 002c5b77a8e88..60d169a31ebb2 100644 --- a/assets/asset_manager.cc +++ b/assets/asset_manager.cc @@ -29,7 +29,7 @@ void AssetManager::PushBack(std::unique_ptr resolver) { resolvers_.push_back(std::move(resolver)); } -// |flutter::AssetResolver| +// |AssetResolver| std::unique_ptr AssetManager::GetAsMapping( const std::string& asset_name) const { if (asset_name.size() == 0) { @@ -47,7 +47,7 @@ std::unique_ptr AssetManager::GetAsMapping( return nullptr; } -// |flutter::AssetResolver| +// |AssetResolver| bool AssetManager::IsValid() const { return resolvers_.size() > 0; } diff --git a/assets/asset_manager.h b/assets/asset_manager.h index d19bbb799a234..2278742f50113 100644 --- a/assets/asset_manager.h +++ b/assets/asset_manager.h @@ -25,10 +25,10 @@ class AssetManager final : public AssetResolver { void PushBack(std::unique_ptr resolver); - // |flutter::AssetResolver| + // |AssetResolver| bool IsValid() const override; - // |flutter::AssetResolver| + // |AssetResolver| std::unique_ptr GetAsMapping( const std::string& asset_name) const override; diff --git a/assets/directory_asset_bundle.cc b/assets/directory_asset_bundle.cc index ceb42447f8486..734e678bd3904 100644 --- a/assets/directory_asset_bundle.cc +++ b/assets/directory_asset_bundle.cc @@ -22,12 +22,12 @@ DirectoryAssetBundle::DirectoryAssetBundle(fml::UniqueFD descriptor) DirectoryAssetBundle::~DirectoryAssetBundle() = default; -// |flutter::AssetResolver| +// |AssetResolver| bool DirectoryAssetBundle::IsValid() const { return is_valid_; } -// |flutter::AssetResolver| +// |AssetResolver| std::unique_ptr DirectoryAssetBundle::GetAsMapping( const std::string& asset_name) const { if (!is_valid_) { diff --git a/assets/directory_asset_bundle.h b/assets/directory_asset_bundle.h index 660d8df04dff7..0a0a94c7aba15 100644 --- a/assets/directory_asset_bundle.h +++ b/assets/directory_asset_bundle.h @@ -22,10 +22,10 @@ class DirectoryAssetBundle : public AssetResolver { const fml::UniqueFD descriptor_; bool is_valid_ = false; - // |flutter::AssetResolver| + // |AssetResolver| bool IsValid() const override; - // |flutter::AssetResolver| + // |AssetResolver| std::unique_ptr GetAsMapping( const std::string& asset_name) const override; diff --git a/assets/zip_asset_store.cc b/assets/zip_asset_store.cc index 2c3a576452ad9..44815a96b5c17 100644 --- a/assets/zip_asset_store.cc +++ b/assets/zip_asset_store.cc @@ -33,12 +33,12 @@ UniqueUnzipper ZipAssetStore::CreateUnzipper() const { return UniqueUnzipper{::unzOpen2(file_path_.c_str(), nullptr)}; } -// |flutter::AssetResolver| +// |AssetResolver| bool ZipAssetStore::IsValid() const { return stat_cache_.size() > 0; } -// |flutter::AssetResolver| +// |AssetResolver| std::unique_ptr ZipAssetStore::GetAsMapping( const std::string& asset_name) const { TRACE_EVENT1("flutter", "ZipAssetStore::GetAsMapping", "name", diff --git a/assets/zip_asset_store.h b/assets/zip_asset_store.h index b80f5432a0de7..c3bba3f412c34 100644 --- a/assets/zip_asset_store.h +++ b/assets/zip_asset_store.h @@ -40,10 +40,10 @@ class ZipAssetStore final : public AssetResolver { mutable std::map stat_cache_; - // |flutter::AssetResolver| + // |AssetResolver| bool IsValid() const override; - // |flutter::AssetResolver| + // |AssetResolver| std::unique_ptr GetAsMapping( const std::string& asset_name) const override; diff --git a/lib/ui/compositing/scene_host.cc b/lib/ui/compositing/scene_host.cc index 4247fc247cb44..b3a9bc99147d9 100644 --- a/lib/ui/compositing/scene_host.cc +++ b/lib/ui/compositing/scene_host.cc @@ -18,14 +18,14 @@ namespace { -using SceneHostBindings = std::unordered_map; +using SceneHostBindings = std::unordered_map; FML_THREAD_LOCAL fml::ThreadLocal tls_scene_host_bindings([](intptr_t value) { delete reinterpret_cast(value); }); void SceneHost_constructor(Dart_NativeArguments args) { - tonic::DartCallConstructor(&flutter::SceneHost::Create, args); + tonic::DartCallConstructor(&SceneHost::Create, args); } void SceneHost_constructorViewHolderToken(Dart_NativeArguments args) { @@ -36,10 +36,10 @@ void SceneHost_constructorViewHolderToken(Dart_NativeArguments args) { reinterpret_cast(new SceneHostBindings())); } - tonic::DartCallConstructor(&flutter::SceneHost::CreateViewHolder, args); + tonic::DartCallConstructor(&SceneHost::CreateViewHolder, args); } -flutter::SceneHost* GetSceneHost(scenic::ResourceId id) { +SceneHost* GetSceneHost(scenic::ResourceId id) { auto* bindings = reinterpret_cast(tls_scene_host_bindings.Get()); FML_DCHECK(bindings); diff --git a/lib/ui/painting/rrect.cc b/lib/ui/painting/rrect.cc index d47ea9b7b633f..60435b51b444f 100644 --- a/lib/ui/painting/rrect.cc +++ b/lib/ui/painting/rrect.cc @@ -15,7 +15,7 @@ namespace tonic { // Construct an SkRRect from a Dart RRect object. // The Dart RRect is a Float32List containing // [left, top, right, bottom, xRadius, yRadius] -RRect DartConverter::FromDart(Dart_Handle value) { +RRect DartConverter::FromDart(Dart_Handle value) { Float32List buffer(value); RRect result; @@ -35,9 +35,9 @@ RRect DartConverter::FromDart(Dart_Handle value) { return result; } -RRect DartConverter::FromArguments(Dart_NativeArguments args, - int index, - Dart_Handle& exception) { +RRect DartConverter::FromArguments(Dart_NativeArguments args, + int index, + Dart_Handle& exception) { Dart_Handle value = Dart_GetNativeArgument(args, index); FML_DCHECK(!LogIfError(value)); return FromDart(value); diff --git a/lib/ui/text/asset_manager_font_provider.cc b/lib/ui/text/asset_manager_font_provider.cc index 619798c13bda7..c86b900609f66 100644 --- a/lib/ui/text/asset_manager_font_provider.cc +++ b/lib/ui/text/asset_manager_font_provider.cc @@ -21,7 +21,7 @@ void MappingReleaseProc(const void* ptr, void* context) { } // anonymous namespace AssetManagerFontProvider::AssetManagerFontProvider( - std::shared_ptr asset_manager) + std::shared_ptr asset_manager) : asset_manager_(asset_manager) {} AssetManagerFontProvider::~AssetManagerFontProvider() = default; @@ -65,7 +65,7 @@ void AssetManagerFontProvider::RegisterAsset(std::string family_name, } AssetManagerFontStyleSet::AssetManagerFontStyleSet( - std::shared_ptr asset_manager) + std::shared_ptr asset_manager) : asset_manager_(asset_manager) {} AssetManagerFontStyleSet::~AssetManagerFontStyleSet() = default; diff --git a/lib/ui/text/asset_manager_font_provider.h b/lib/ui/text/asset_manager_font_provider.h index d287ba7634fb8..0e51f19100002 100644 --- a/lib/ui/text/asset_manager_font_provider.h +++ b/lib/ui/text/asset_manager_font_provider.h @@ -20,8 +20,7 @@ namespace flutter { class AssetManagerFontStyleSet : public SkFontStyleSet { public: - AssetManagerFontStyleSet( - std::shared_ptr asset_manager); + AssetManagerFontStyleSet(std::shared_ptr asset_manager); ~AssetManagerFontStyleSet() override; @@ -40,7 +39,7 @@ class AssetManagerFontStyleSet : public SkFontStyleSet { SkTypeface* matchStyle(const SkFontStyle& pattern) override; private: - std::shared_ptr asset_manager_; + std::shared_ptr asset_manager_; struct TypefaceAsset { TypefaceAsset(std::string a); @@ -59,8 +58,7 @@ class AssetManagerFontStyleSet : public SkFontStyleSet { class AssetManagerFontProvider : public txt::FontAssetProvider { public: - AssetManagerFontProvider( - std::shared_ptr asset_manager); + AssetManagerFontProvider(std::shared_ptr asset_manager); ~AssetManagerFontProvider() override; diff --git a/lib/ui/text/paragraph_impl_txt.cc b/lib/ui/text/paragraph_impl_txt.cc index 666a2b2c89c0b..a875cd9a51a60 100644 --- a/lib/ui/text/paragraph_impl_txt.cc +++ b/lib/ui/text/paragraph_impl_txt.cc @@ -70,8 +70,7 @@ std::vector ParagraphImplTxt::getRectsForRange( 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)); + result.emplace_back(box.rect, static_cast(box.direction)); } return result; } diff --git a/lib/ui/text/text_box.cc b/lib/ui/text/text_box.cc index 421bf16376a09..99438cf4b87cb 100644 --- a/lib/ui/text/text_box.cc +++ b/lib/ui/text/text_box.cc @@ -25,7 +25,8 @@ Dart_Handle GetTextBoxType() { } // anonymous namespace -Dart_Handle DartConverter::ToDart(const TextBox& val) { +Dart_Handle DartConverter::ToDart( + const flutter::TextBox& val) { constexpr int argc = 5; Dart_Handle argv[argc] = { tonic::ToDart(val.rect.fLeft), @@ -37,7 +38,7 @@ Dart_Handle DartConverter::ToDart(const TextBox& val) { return Dart_New(GetTextBoxType(), tonic::ToDart("_"), argc, argv); } -Dart_Handle DartListFactory::NewList(intptr_t length) { +Dart_Handle DartListFactory::NewList(intptr_t length) { return Dart_NewListOfType(GetTextBoxType(), length); } diff --git a/lib/ui/window/window.h b/lib/ui/window/window.h index ab4d27e2f035d..cb92bd1997396 100644 --- a/lib/ui/window/window.h +++ b/lib/ui/window/window.h @@ -88,7 +88,7 @@ class Window final { // We use id 0 to mean that no response is expected. int next_response_id_ = 1; - std::unordered_map> + std::unordered_map> pending_responses_; }; diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index eb8097f119fb1..adf5655272167 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -547,9 +547,8 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( return nullptr; } - flutter::TaskRunners null_task_runners( - "io.flutter." DART_VM_SERVICE_ISOLATE_NAME, nullptr, nullptr, nullptr, - nullptr); + TaskRunners null_task_runners("io.flutter." DART_VM_SERVICE_ISOLATE_NAME, + nullptr, nullptr, nullptr, nullptr); flags->load_vmservice_library = true; @@ -659,8 +658,8 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( if (!is_root_isolate) { auto* raw_embedder_isolate = embedder_isolate.release(); - flutter::TaskRunners null_task_runners(advisory_script_uri, nullptr, - nullptr, nullptr, nullptr); + TaskRunners null_task_runners(advisory_script_uri, nullptr, nullptr, + nullptr, nullptr); embedder_isolate = std::make_unique>( std::make_shared( diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc index de5b5ff629734..9a6aa8218f14e 100644 --- a/runtime/dart_isolate_unittests.cc +++ b/runtime/dart_isolate_unittests.cc @@ -88,7 +88,7 @@ class AutoIsolateShutdown { public: AutoIsolateShutdown() = default; - AutoIsolateShutdown(std::shared_ptr isolate, + AutoIsolateShutdown(std::shared_ptr isolate, fml::RefPtr runner) : isolate_(std::move(isolate)), runner_(std::move(runner)) {} @@ -131,13 +131,13 @@ class AutoIsolateShutdown { return true; } - flutter::DartIsolate* get() { + DartIsolate* get() { FML_CHECK(isolate_); return isolate_.get(); } private: - std::shared_ptr isolate_; + std::shared_ptr isolate_; fml::RefPtr runner_; FML_DISALLOW_COPY_AND_ASSIGN(AutoIsolateShutdown); diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index af5086660fc34..1abf8171c58b9 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -385,15 +385,14 @@ DartVM::DartVM(std::shared_ptr vm_data, // the very first frame gives us a good idea about Flutter's startup time. // Use a duration event so about:tracing will consider this event when // deciding the earliest event to use as time 0. - if (flutter::engine_main_enter_ts != 0) { - Dart_TimelineEvent( - "FlutterEngineMainEnter", // label - flutter::engine_main_enter_ts, // timestamp0 - flutter::engine_main_enter_ts, // timestamp1_or_async_id - Dart_Timeline_Event_Duration, // event type - 0, // argument_count - nullptr, // argument_names - nullptr // argument_values + if (engine_main_enter_ts != 0) { + Dart_TimelineEvent("FlutterEngineMainEnter", // label + engine_main_enter_ts, // timestamp0 + engine_main_enter_ts, // timestamp1_or_async_id + Dart_Timeline_Event_Duration, // event type + 0, // argument_count + nullptr, // argument_names + nullptr // argument_values ); } } diff --git a/runtime/embedder_resources.cc b/runtime/embedder_resources.cc index e9d869a28aa41..2b2f84318f771 100644 --- a/runtime/embedder_resources.cc +++ b/runtime/embedder_resources.cc @@ -10,7 +10,7 @@ namespace flutter { -using flutter::runtime::ResourcesEntry; +using runtime::ResourcesEntry; EmbedderResources::EmbedderResources(ResourcesEntry* resources_table) : resources_table_(resources_table) {} diff --git a/runtime/embedder_resources.h b/runtime/embedder_resources.h index 7b5b38ac88d5f..859268d9dccb9 100644 --- a/runtime/embedder_resources.h +++ b/runtime/embedder_resources.h @@ -21,7 +21,7 @@ namespace flutter { class EmbedderResources { public: - EmbedderResources(flutter::runtime::ResourcesEntry* resources_table); + EmbedderResources(runtime::ResourcesEntry* resources_table); static const int kNoSuchInstance; @@ -29,9 +29,9 @@ class EmbedderResources { const char* Path(int idx); private: - flutter::runtime::ResourcesEntry* At(int idx); + runtime::ResourcesEntry* At(int idx); - flutter::runtime::ResourcesEntry* resources_table_; + runtime::ResourcesEntry* resources_table_; }; } // namespace flutter diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h index 7d06b9f2337d0..fbc92aeb60f22 100644 --- a/runtime/runtime_controller.h +++ b/runtime/runtime_controller.h @@ -149,25 +149,25 @@ class RuntimeController final : public WindowClient { bool FlushRuntimeStateToIsolate(); - // |flutter::WindowClient| + // |WindowClient| std::string DefaultRouteName() override; - // |flutter::WindowClient| + // |WindowClient| void ScheduleFrame() override; - // |flutter::WindowClient| + // |WindowClient| void Render(Scene* scene) override; - // |flutter::WindowClient| + // |WindowClient| void UpdateSemantics(SemanticsUpdate* update) override; - // |flutter::WindowClient| + // |WindowClient| void HandlePlatformMessage(fml::RefPtr message) override; - // |flutter::WindowClient| + // |WindowClient| FontCollection& GetFontCollection() override; - // |flutter::WindowClient| + // |WindowClient| void UpdateIsolateDescription(const std::string isolate_name, int64_t isolate_port) override; diff --git a/runtime/runtime_delegate.h b/runtime/runtime_delegate.h index 355b34888df78..b62d39a0ed7ae 100644 --- a/runtime/runtime_delegate.h +++ b/runtime/runtime_delegate.h @@ -25,9 +25,8 @@ class RuntimeDelegate { virtual void Render(std::unique_ptr layer_tree) = 0; - virtual void UpdateSemantics( - flutter::SemanticsNodeUpdates update, - flutter::CustomAccessibilityActionUpdates actions) = 0; + virtual void UpdateSemantics(SemanticsNodeUpdates update, + CustomAccessibilityActionUpdates actions) = 0; virtual void HandlePlatformMessage(fml::RefPtr message) = 0; diff --git a/shell/common/animator.cc b/shell/common/animator.cc index 298aaff6cebd5..0926599e9187a 100644 --- a/shell/common/animator.cc +++ b/shell/common/animator.cc @@ -20,7 +20,7 @@ constexpr fml::TimeDelta kNotifyIdleTaskWaitTime = } // namespace Animator::Animator(Delegate& delegate, - flutter::TaskRunners task_runners, + TaskRunners task_runners, std::unique_ptr waiter) : delegate_(delegate), task_runners_(std::move(task_runners)), diff --git a/shell/common/animator.h b/shell/common/animator.h index c58c99d118f4b..c8397befab97c 100644 --- a/shell/common/animator.h +++ b/shell/common/animator.h @@ -27,13 +27,13 @@ class Animator final { virtual void OnAnimatorNotifyIdle(int64_t deadline) = 0; virtual void OnAnimatorDraw( - fml::RefPtr> pipeline) = 0; + fml::RefPtr> pipeline) = 0; virtual void OnAnimatorDrawLastLayerTree() = 0; }; Animator(Delegate& delegate, - flutter::TaskRunners task_runners, + TaskRunners task_runners, std::unique_ptr waiter); ~Animator(); @@ -55,7 +55,7 @@ class Animator final { void EnqueueTraceFlowId(uint64_t trace_flow_id); private: - using LayerTreePipeline = flutter::Pipeline; + using LayerTreePipeline = Pipeline; void BeginFrame(fml::TimePoint frame_start_time, fml::TimePoint frame_target_time); @@ -68,13 +68,13 @@ class Animator final { const char* FrameParity(); Delegate& delegate_; - flutter::TaskRunners task_runners_; + TaskRunners task_runners_; std::shared_ptr waiter_; fml::TimePoint last_begin_frame_time_; int64_t dart_frame_deadline_; fml::RefPtr layer_tree_pipeline_; - flutter::Semaphore pending_frame_semaphore_; + Semaphore pending_frame_semaphore_; LayerTreePipeline::ProducerContinuation producer_continuation_; int64_t frame_number_; bool paused_; diff --git a/shell/common/engine.cc b/shell/common/engine.cc index 706ded70984b8..1fe0cfe0295df 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -36,14 +36,14 @@ static constexpr char kLocalizationChannel[] = "flutter/localization"; static constexpr char kSettingsChannel[] = "flutter/settings"; Engine::Engine(Delegate& delegate, - flutter::DartVM& vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, - flutter::TaskRunners task_runners, - flutter::Settings settings, + DartVM& vm, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, + TaskRunners task_runners, + Settings settings, std::unique_ptr animator, - fml::WeakPtr snapshot_delegate, - fml::WeakPtr io_manager) + fml::WeakPtr snapshot_delegate, + fml::WeakPtr io_manager) : delegate_(delegate), settings_(std::move(settings)), animator_(std::move(animator)), @@ -53,7 +53,7 @@ Engine::Engine(Delegate& delegate, // Runtime controller is initialized here because it takes a reference to this // object as its delegate. The delegate may be called in the constructor and // we want to be fully initilazed by that point. - runtime_controller_ = std::make_unique( + runtime_controller_ = std::make_unique( *this, // runtime delegate &vm, // VM std::move(isolate_snapshot), // isolate snapshot @@ -78,7 +78,7 @@ fml::WeakPtr Engine::GetWeakPtr() const { } bool Engine::UpdateAssetManager( - std::shared_ptr new_asset_manager) { + std::shared_ptr new_asset_manager) { if (asset_manager_ == new_asset_manager) { return false; } @@ -127,11 +127,11 @@ Engine::RunStatus Engine::Run(RunConfiguration configuration) { return isolate_launch_status; } - std::shared_ptr isolate = + std::shared_ptr isolate = runtime_controller_->GetRootIsolate().lock(); bool isolate_running = - isolate && isolate->GetPhase() == flutter::DartIsolate::Phase::Running; + isolate && isolate->GetPhase() == DartIsolate::Phase::Running; if (isolate_running) { tonic::DartState::Scope scope(isolate.get()); @@ -158,7 +158,7 @@ Engine::RunStatus Engine::PrepareAndLaunchIsolate( auto isolate_configuration = configuration.TakeIsolateConfiguration(); - std::shared_ptr isolate = + std::shared_ptr isolate = runtime_controller_->GetRootIsolate().lock(); if (!isolate) { @@ -167,7 +167,7 @@ Engine::RunStatus Engine::PrepareAndLaunchIsolate( // This can happen on iOS after a plugin shows a native window and returns to // the Flutter ViewController. - if (isolate->GetPhase() == flutter::DartIsolate::Phase::Running) { + if (isolate->GetPhase() == DartIsolate::Phase::Running) { FML_DLOG(WARNING) << "Isolate was already running!"; return RunStatus::FailureAlreadyRunning; } @@ -235,7 +235,7 @@ void Engine::OnOutputSurfaceDestroyed() { StopAnimator(); } -void Engine::SetViewportMetrics(const flutter::ViewportMetrics& metrics) { +void Engine::SetViewportMetrics(const ViewportMetrics& metrics) { bool dimensions_changed = viewport_metrics_.physical_height != metrics.physical_height || viewport_metrics_.physical_width != metrics.physical_width; @@ -249,8 +249,7 @@ void Engine::SetViewportMetrics(const flutter::ViewportMetrics& metrics) { } } -void Engine::DispatchPlatformMessage( - fml::RefPtr message) { +void Engine::DispatchPlatformMessage(fml::RefPtr message) { if (message->channel() == kLifecycleChannel) { if (HandleLifecyclePlatformMessage(message.get())) return; @@ -272,7 +271,7 @@ void Engine::DispatchPlatformMessage( HandleNavigationPlatformMessage(std::move(message)); } -bool Engine::HandleLifecyclePlatformMessage(flutter::PlatformMessage* message) { +bool Engine::HandleLifecyclePlatformMessage(PlatformMessage* message) { const auto& data = message->data(); std::string state(reinterpret_cast(data.data()), data.size()); if (state == "AppLifecycleState.paused" || @@ -297,7 +296,7 @@ bool Engine::HandleLifecyclePlatformMessage(flutter::PlatformMessage* message) { } bool Engine::HandleNavigationPlatformMessage( - fml::RefPtr message) { + fml::RefPtr message) { const auto& data = message->data(); rapidjson::Document document; @@ -313,8 +312,7 @@ bool Engine::HandleNavigationPlatformMessage( return true; } -bool Engine::HandleLocalizationPlatformMessage( - flutter::PlatformMessage* message) { +bool Engine::HandleLocalizationPlatformMessage(PlatformMessage* message) { const auto& data = message->data(); rapidjson::Document document; @@ -348,7 +346,7 @@ bool Engine::HandleLocalizationPlatformMessage( return runtime_controller_->SetLocales(locale_data); } -void Engine::HandleSettingsPlatformMessage(flutter::PlatformMessage* message) { +void Engine::HandleSettingsPlatformMessage(PlatformMessage* message) { const auto& data = message->data(); std::string jsonData(reinterpret_cast(data.data()), data.size()); if (runtime_controller_->SetUserSettingsData(std::move(jsonData)) && @@ -357,7 +355,7 @@ void Engine::HandleSettingsPlatformMessage(flutter::PlatformMessage* message) { } } -void Engine::DispatchPointerDataPacket(const flutter::PointerDataPacket& packet, +void Engine::DispatchPointerDataPacket(const PointerDataPacket& packet, uint64_t trace_flow_id) { TRACE_EVENT0("flutter", "Engine::DispatchPointerDataPacket"); TRACE_FLOW_STEP("flutter", "PointerEvent", trace_flow_id); @@ -366,7 +364,7 @@ void Engine::DispatchPointerDataPacket(const flutter::PointerDataPacket& packet, } void Engine::DispatchSemanticsAction(int id, - flutter::SemanticsAction action, + SemanticsAction action, std::vector args) { runtime_controller_->DispatchSemanticsAction(id, action, std::move(args)); } @@ -412,14 +410,12 @@ void Engine::Render(std::unique_ptr layer_tree) { animator_->Render(std::move(layer_tree)); } -void Engine::UpdateSemantics( - flutter::SemanticsNodeUpdates update, - flutter::CustomAccessibilityActionUpdates actions) { +void Engine::UpdateSemantics(SemanticsNodeUpdates update, + CustomAccessibilityActionUpdates actions) { delegate_.OnEngineUpdateSemantics(std::move(update), std::move(actions)); } -void Engine::HandlePlatformMessage( - fml::RefPtr message) { +void Engine::HandlePlatformMessage(fml::RefPtr message) { if (message->channel() == kAssetChannel) { HandleAssetPlatformMessage(std::move(message)); } else { @@ -432,13 +428,12 @@ void Engine::UpdateIsolateDescription(const std::string isolate_name, delegate_.UpdateIsolateDescription(isolate_name, isolate_port); } -flutter::FontCollection& Engine::GetFontCollection() { +FontCollection& Engine::GetFontCollection() { return font_collection_; } -void Engine::HandleAssetPlatformMessage( - fml::RefPtr message) { - fml::RefPtr response = message->response(); +void Engine::HandleAssetPlatformMessage(fml::RefPtr message) { + fml::RefPtr response = message->response(); if (!response) { return; } diff --git a/shell/common/engine.h b/shell/common/engine.h index ce4917e6b9d37..cd2c32b8403cd 100644 --- a/shell/common/engine.h +++ b/shell/common/engine.h @@ -29,7 +29,7 @@ namespace flutter { -class Engine final : public flutter::RuntimeDelegate { +class Engine final : public RuntimeDelegate { public: // Used by Engine::Run enum class RunStatus { @@ -42,11 +42,11 @@ class Engine final : public flutter::RuntimeDelegate { class Delegate { public: virtual void OnEngineUpdateSemantics( - flutter::SemanticsNodeUpdates update, - flutter::CustomAccessibilityActionUpdates actions) = 0; + SemanticsNodeUpdates update, + CustomAccessibilityActionUpdates actions) = 0; virtual void OnEngineHandlePlatformMessage( - fml::RefPtr message) = 0; + fml::RefPtr message) = 0; virtual void OnPreEngineRestart() = 0; @@ -55,14 +55,14 @@ class Engine final : public flutter::RuntimeDelegate { }; Engine(Delegate& delegate, - flutter::DartVM& vm, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, - flutter::TaskRunners task_runners, - flutter::Settings settings, + DartVM& vm, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, + TaskRunners task_runners, + Settings settings, std::unique_ptr animator, - fml::WeakPtr snapshot_delegate, - fml::WeakPtr io_manager); + fml::WeakPtr snapshot_delegate, + fml::WeakPtr io_manager); ~Engine() override; @@ -80,7 +80,7 @@ class Engine final : public flutter::RuntimeDelegate { FML_WARN_UNUSED_RESULT bool Restart(RunConfiguration configuration); - bool UpdateAssetManager(std::shared_ptr asset_manager); + bool UpdateAssetManager(std::shared_ptr asset_manager); void BeginFrame(fml::TimePoint frame_time); @@ -100,15 +100,15 @@ class Engine final : public flutter::RuntimeDelegate { void OnOutputSurfaceDestroyed(); - void SetViewportMetrics(const flutter::ViewportMetrics& metrics); + void SetViewportMetrics(const ViewportMetrics& metrics); - void DispatchPlatformMessage(fml::RefPtr message); + void DispatchPlatformMessage(fml::RefPtr message); - void DispatchPointerDataPacket(const flutter::PointerDataPacket& packet, + void DispatchPointerDataPacket(const PointerDataPacket& packet, uint64_t trace_flow_id); void DispatchSemanticsAction(int id, - flutter::SemanticsAction action, + SemanticsAction action, std::vector args); void SetSemanticsEnabled(bool enabled); @@ -117,38 +117,36 @@ class Engine final : public flutter::RuntimeDelegate { void ScheduleFrame(bool regenerate_layer_tree = true) override; - // |flutter::RuntimeDelegate| - flutter::FontCollection& GetFontCollection() override; + // |RuntimeDelegate| + FontCollection& GetFontCollection() override; private: Engine::Delegate& delegate_; - const flutter::Settings settings_; + const Settings settings_; std::unique_ptr animator_; - std::unique_ptr runtime_controller_; + std::unique_ptr runtime_controller_; std::string initial_route_; - flutter::ViewportMetrics viewport_metrics_; - std::shared_ptr asset_manager_; + ViewportMetrics viewport_metrics_; + std::shared_ptr asset_manager_; bool activity_running_; bool have_surface_; - flutter::FontCollection font_collection_; + FontCollection font_collection_; fml::WeakPtrFactory weak_factory_; - // |flutter::RuntimeDelegate| + // |RuntimeDelegate| std::string DefaultRouteName() override; - // |flutter::RuntimeDelegate| + // |RuntimeDelegate| void Render(std::unique_ptr layer_tree) override; - // |flutter::RuntimeDelegate| - void UpdateSemantics( - flutter::SemanticsNodeUpdates update, - flutter::CustomAccessibilityActionUpdates actions) override; + // |RuntimeDelegate| + void UpdateSemantics(SemanticsNodeUpdates update, + CustomAccessibilityActionUpdates actions) override; - // |flutter::RuntimeDelegate| - void HandlePlatformMessage( - fml::RefPtr message) override; + // |RuntimeDelegate| + void HandlePlatformMessage(fml::RefPtr message) override; - // |flutter::RuntimeDelegate| + // |RuntimeDelegate| void UpdateIsolateDescription(const std::string isolate_name, int64_t isolate_port) override; @@ -156,17 +154,15 @@ class Engine final : public flutter::RuntimeDelegate { void StartAnimatorIfPossible(); - bool HandleLifecyclePlatformMessage(flutter::PlatformMessage* message); + bool HandleLifecyclePlatformMessage(PlatformMessage* message); - bool HandleNavigationPlatformMessage( - fml::RefPtr message); + bool HandleNavigationPlatformMessage(fml::RefPtr message); - bool HandleLocalizationPlatformMessage(flutter::PlatformMessage* message); + bool HandleLocalizationPlatformMessage(PlatformMessage* message); - void HandleSettingsPlatformMessage(flutter::PlatformMessage* message); + void HandleSettingsPlatformMessage(PlatformMessage* message); - void HandleAssetPlatformMessage( - fml::RefPtr message); + void HandleAssetPlatformMessage(fml::RefPtr message); bool GetAssetAsBuffer(const std::string& name, std::vector* data); diff --git a/shell/common/isolate_configuration.cc b/shell/common/isolate_configuration.cc index a11a060b3b53a..4d83bc1de6ca9 100644 --- a/shell/common/isolate_configuration.cc +++ b/shell/common/isolate_configuration.cc @@ -13,8 +13,8 @@ IsolateConfiguration::IsolateConfiguration() = default; IsolateConfiguration::~IsolateConfiguration() = default; -bool IsolateConfiguration::PrepareIsolate(flutter::DartIsolate& isolate) { - if (isolate.GetPhase() != flutter::DartIsolate::Phase::LibrariesSetup) { +bool IsolateConfiguration::PrepareIsolate(DartIsolate& isolate) { + if (isolate.GetPhase() != DartIsolate::Phase::LibrariesSetup) { FML_DLOG(ERROR) << "Isolate was in incorrect phase to be prepared for running."; return false; @@ -28,7 +28,7 @@ class AppSnapshotIsolateConfiguration final : public IsolateConfiguration { AppSnapshotIsolateConfiguration() = default; // |IsolateConfiguration| - bool DoPrepareIsolate(flutter::DartIsolate& isolate) override { + bool DoPrepareIsolate(DartIsolate& isolate) override { return isolate.PrepareForRunningFromPrecompiledCode(); } @@ -42,8 +42,8 @@ class KernelIsolateConfiguration : public IsolateConfiguration { : kernel_(std::move(kernel)) {} // |IsolateConfiguration| - bool DoPrepareIsolate(flutter::DartIsolate& isolate) override { - if (flutter::DartVM::IsRunningPrecompiledCode()) { + bool DoPrepareIsolate(DartIsolate& isolate) override { + if (DartVM::IsRunningPrecompiledCode()) { return false; } return isolate.PrepareForRunningFromKernel(std::move(kernel_)); @@ -63,8 +63,8 @@ class KernelListIsolateConfiguration final : public IsolateConfiguration { : kernel_pieces_(std::move(kernel_pieces)) {} // |IsolateConfiguration| - bool DoPrepareIsolate(flutter::DartIsolate& isolate) override { - if (flutter::DartVM::IsRunningPrecompiledCode()) { + bool DoPrepareIsolate(DartIsolate& isolate) override { + if (DartVM::IsRunningPrecompiledCode()) { return false; } @@ -115,7 +115,7 @@ static std::vector ParseKernelListPaths( static std::vector>> PrepareKernelMappings(std::vector kernel_pieces_paths, - std::shared_ptr asset_manager, + std::shared_ptr asset_manager, fml::RefPtr io_worker) { FML_DCHECK(asset_manager); std::vector>> fetch_futures; @@ -142,11 +142,11 @@ PrepareKernelMappings(std::vector kernel_pieces_paths, } std::unique_ptr IsolateConfiguration::InferFromSettings( - const flutter::Settings& settings, - std::shared_ptr asset_manager, + const Settings& settings, + std::shared_ptr asset_manager, fml::RefPtr io_worker) { // Running in AOT mode. - if (flutter::DartVM::IsRunningPrecompiledCode()) { + if (DartVM::IsRunningPrecompiledCode()) { return CreateForAppSnapshot(); } diff --git a/shell/common/isolate_configuration.h b/shell/common/isolate_configuration.h index 950a74910102d..a6db9edb69f43 100644 --- a/shell/common/isolate_configuration.h +++ b/shell/common/isolate_configuration.h @@ -22,8 +22,8 @@ namespace flutter { class IsolateConfiguration { public: static std::unique_ptr InferFromSettings( - const flutter::Settings& settings, - std::shared_ptr asset_manager, + const Settings& settings, + std::shared_ptr asset_manager, fml::RefPtr io_worker); static std::unique_ptr CreateForAppSnapshot(); @@ -42,10 +42,10 @@ class IsolateConfiguration { virtual ~IsolateConfiguration(); - bool PrepareIsolate(flutter::DartIsolate& isolate); + bool PrepareIsolate(DartIsolate& isolate); protected: - virtual bool DoPrepareIsolate(flutter::DartIsolate& isolate) = 0; + virtual bool DoPrepareIsolate(DartIsolate& isolate) = 0; private: FML_DISALLOW_COPY_AND_ASSIGN(IsolateConfiguration); diff --git a/shell/common/persistent_cache.cc b/shell/common/persistent_cache.cc index c9fcb420288da..4c110970e05de 100644 --- a/shell/common/persistent_cache.cc +++ b/shell/common/persistent_cache.cc @@ -59,12 +59,11 @@ PersistentCache::PersistentCache(bool read_only) : is_read_only_(read_only) { } if (cache_base_dir.is_valid()) { - cache_directory_ = std::make_shared( - CreateDirectory(cache_base_dir, - {"flutter_engine", flutter::GetFlutterEngineVersion(), - "skia", flutter::GetSkiaVersion()}, - read_only ? fml::FilePermission::kRead - : fml::FilePermission::kReadWrite)); + cache_directory_ = std::make_shared(CreateDirectory( + cache_base_dir, + {"flutter_engine", GetFlutterEngineVersion(), "skia", GetSkiaVersion()}, + read_only ? fml::FilePermission::kRead + : fml::FilePermission::kReadWrite)); } if (!IsValid()) { FML_LOG(WARNING) << "Could not acquire the persistent cache directory. " diff --git a/shell/common/platform_view.cc b/shell/common/platform_view.cc index 43063f742e86e..5de50e3d9b46b 100644 --- a/shell/common/platform_view.cc +++ b/shell/common/platform_view.cc @@ -16,8 +16,7 @@ namespace flutter { -PlatformView::PlatformView(Delegate& delegate, - flutter::TaskRunners task_runners) +PlatformView::PlatformView(Delegate& delegate, TaskRunners task_runners) : delegate_(delegate), task_runners_(std::move(task_runners)), size_(SkISize::Make(0, 0)), @@ -33,17 +32,17 @@ std::unique_ptr PlatformView::CreateVSyncWaiter() { } void PlatformView::DispatchPlatformMessage( - fml::RefPtr message) { + fml::RefPtr message) { delegate_.OnPlatformViewDispatchPlatformMessage(std::move(message)); } void PlatformView::DispatchPointerDataPacket( - std::unique_ptr packet) { + std::unique_ptr packet) { delegate_.OnPlatformViewDispatchPointerDataPacket(std::move(packet)); } void PlatformView::DispatchSemanticsAction(int32_t id, - flutter::SemanticsAction action, + SemanticsAction action, std::vector args) { delegate_.OnPlatformViewDispatchSemanticsAction(id, action, std::move(args)); } @@ -56,7 +55,7 @@ void PlatformView::SetAccessibilityFeatures(int32_t flags) { delegate_.OnPlatformViewSetAccessibilityFeatures(flags); } -void PlatformView::SetViewportMetrics(const flutter::ViewportMetrics& metrics) { +void PlatformView::SetViewportMetrics(const ViewportMetrics& metrics) { delegate_.OnPlatformViewSetViewportMetrics(metrics); } @@ -93,12 +92,10 @@ fml::WeakPtr PlatformView::GetWeakPtr() const { return weak_factory_.GetWeakPtr(); } -void PlatformView::UpdateSemantics( - flutter::SemanticsNodeUpdates update, - flutter::CustomAccessibilityActionUpdates actions) {} +void PlatformView::UpdateSemantics(SemanticsNodeUpdates update, + CustomAccessibilityActionUpdates actions) {} -void PlatformView::HandlePlatformMessage( - fml::RefPtr message) { +void PlatformView::HandlePlatformMessage(fml::RefPtr message) { if (auto response = message->response()) response->CompleteEmpty(); } diff --git a/shell/common/platform_view.h b/shell/common/platform_view.h index 32e40a981ad1a..d76e8fbb0eb44 100644 --- a/shell/common/platform_view.h +++ b/shell/common/platform_view.h @@ -36,17 +36,17 @@ class PlatformView { virtual void OnPlatformViewSetNextFrameCallback(fml::closure closure) = 0; virtual void OnPlatformViewSetViewportMetrics( - const flutter::ViewportMetrics& metrics) = 0; + const ViewportMetrics& metrics) = 0; virtual void OnPlatformViewDispatchPlatformMessage( - fml::RefPtr message) = 0; + fml::RefPtr message) = 0; virtual void OnPlatformViewDispatchPointerDataPacket( - std::unique_ptr packet) = 0; + std::unique_ptr packet) = 0; virtual void OnPlatformViewDispatchSemanticsAction( int32_t id, - flutter::SemanticsAction action, + SemanticsAction action, std::vector args) = 0; virtual void OnPlatformViewSetSemanticsEnabled(bool enabled) = 0; @@ -62,23 +62,23 @@ class PlatformView { int64_t texture_id) = 0; }; - explicit PlatformView(Delegate& delegate, flutter::TaskRunners task_runners); + explicit PlatformView(Delegate& delegate, TaskRunners task_runners); virtual ~PlatformView(); virtual std::unique_ptr CreateVSyncWaiter(); - void DispatchPlatformMessage(fml::RefPtr message); + void DispatchPlatformMessage(fml::RefPtr message); void DispatchSemanticsAction(int32_t id, - flutter::SemanticsAction action, + SemanticsAction action, std::vector args); virtual void SetSemanticsEnabled(bool enabled); virtual void SetAccessibilityFeatures(int32_t flags); - void SetViewportMetrics(const flutter::ViewportMetrics& metrics); + void SetViewportMetrics(const ViewportMetrics& metrics); void NotifyCreated(); @@ -94,19 +94,16 @@ class PlatformView { fml::WeakPtr GetWeakPtr() const; - virtual void UpdateSemantics( - flutter::SemanticsNodeUpdates updates, - flutter::CustomAccessibilityActionUpdates actions); + virtual void UpdateSemantics(SemanticsNodeUpdates updates, + CustomAccessibilityActionUpdates actions); - virtual void HandlePlatformMessage( - fml::RefPtr message); + virtual void HandlePlatformMessage(fml::RefPtr message); virtual void OnPreEngineRestart() const; void SetNextFrameCallback(fml::closure closure); - void DispatchPointerDataPacket( - std::unique_ptr packet); + void DispatchPointerDataPacket(std::unique_ptr packet); // Called once per texture, on the platform thread. void RegisterTexture(std::shared_ptr texture); @@ -119,7 +116,7 @@ class PlatformView { protected: PlatformView::Delegate& delegate_; - const flutter::TaskRunners task_runners_; + const TaskRunners task_runners_; SkISize size_; fml::WeakPtrFactory weak_factory_; diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index 24241f62e2d3a..80a93ad3d87ce 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -22,12 +22,12 @@ namespace flutter { // used within this interval. static constexpr std::chrono::milliseconds kSkiaCleanupExpiration(15000); -Rasterizer::Rasterizer(flutter::TaskRunners task_runners) +Rasterizer::Rasterizer(TaskRunners task_runners) : Rasterizer(std::move(task_runners), std::make_unique()) {} Rasterizer::Rasterizer( - flutter::TaskRunners task_runners, + TaskRunners task_runners, std::unique_ptr compositor_context) : task_runners_(std::move(task_runners)), compositor_context_(std::move(compositor_context)), @@ -41,8 +41,7 @@ fml::WeakPtr Rasterizer::GetWeakPtr() const { return weak_factory_.GetWeakPtr(); } -fml::WeakPtr Rasterizer::GetSnapshotDelegate() - const { +fml::WeakPtr Rasterizer::GetSnapshotDelegate() const { return weak_factory_.GetWeakPtr(); } @@ -72,17 +71,16 @@ void Rasterizer::DrawLastLayerTree() { DrawToSurface(*last_layer_tree_); } -void Rasterizer::Draw( - fml::RefPtr> pipeline) { +void Rasterizer::Draw(fml::RefPtr> pipeline) { TRACE_EVENT0("flutter", "GPURasterizer::Draw"); - flutter::Pipeline::Consumer consumer = + Pipeline::Consumer consumer = std::bind(&Rasterizer::DoDraw, this, std::placeholders::_1); // Consume as many pipeline items as possible. But yield the event loop // between successive tries. switch (pipeline->Consume(consumer)) { - case flutter::PipelineConsumeResult::MoreAvailable: { + case PipelineConsumeResult::MoreAvailable: { task_runners_.GetGPUTaskRunner()->PostTask( [weak_this = weak_factory_.GetWeakPtr(), pipeline]() { if (weak_this) { diff --git a/shell/common/rasterizer.h b/shell/common/rasterizer.h index 80faecfc5acf1..f3df4819e334d 100644 --- a/shell/common/rasterizer.h +++ b/shell/common/rasterizer.h @@ -19,11 +19,11 @@ namespace flutter { -class Rasterizer final : public flutter::SnapshotDelegate { +class Rasterizer final : public SnapshotDelegate { public: - Rasterizer(flutter::TaskRunners task_runners); + Rasterizer(TaskRunners task_runners); - Rasterizer(flutter::TaskRunners task_runners, + Rasterizer(TaskRunners task_runners, std::unique_ptr compositor_context); ~Rasterizer(); @@ -34,7 +34,7 @@ class Rasterizer final : public flutter::SnapshotDelegate { fml::WeakPtr GetWeakPtr() const; - fml::WeakPtr GetSnapshotDelegate() const; + fml::WeakPtr GetSnapshotDelegate() const; flow::LayerTree* GetLastLayerTree(); @@ -42,7 +42,7 @@ class Rasterizer final : public flutter::SnapshotDelegate { flow::TextureRegistry* GetTextureRegistry(); - void Draw(fml::RefPtr> pipeline); + void Draw(fml::RefPtr> pipeline); enum class ScreenshotType { SkiaPicture, @@ -76,14 +76,14 @@ class Rasterizer final : public flutter::SnapshotDelegate { void SetResourceCacheMaxBytes(int max_bytes); private: - flutter::TaskRunners task_runners_; + TaskRunners task_runners_; std::unique_ptr surface_; std::unique_ptr compositor_context_; std::unique_ptr last_layer_tree_; fml::closure next_frame_callback_; fml::WeakPtrFactory weak_factory_; - // |flutter::SnapshotDelegate| + // |SnapshotDelegate| sk_sp MakeRasterSnapshot(sk_sp picture, SkISize picture_size) override; diff --git a/shell/common/run_configuration.cc b/shell/common/run_configuration.cc index 4d7f5c0fb248c..902002dcf9c50 100644 --- a/shell/common/run_configuration.cc +++ b/shell/common/run_configuration.cc @@ -13,15 +13,15 @@ namespace flutter { RunConfiguration RunConfiguration::InferFromSettings( - const flutter::Settings& settings, + const Settings& settings, fml::RefPtr io_worker) { - auto asset_manager = std::make_shared(); + auto asset_manager = std::make_shared(); - asset_manager->PushBack(std::make_unique( + asset_manager->PushBack(std::make_unique( fml::Duplicate(settings.assets_dir))); asset_manager->PushBack( - std::make_unique(fml::OpenDirectory( + std::make_unique(fml::OpenDirectory( settings.assets_path.c_str(), false, fml::FilePermission::kRead))); return {IsolateConfiguration::InferFromSettings(settings, asset_manager, @@ -32,11 +32,11 @@ RunConfiguration RunConfiguration::InferFromSettings( RunConfiguration::RunConfiguration( std::unique_ptr configuration) : RunConfiguration(std::move(configuration), - std::make_shared()) {} + std::make_shared()) {} RunConfiguration::RunConfiguration( std::unique_ptr configuration, - std::shared_ptr asset_manager) + std::shared_ptr asset_manager) : isolate_configuration_(std::move(configuration)), asset_manager_(std::move(asset_manager)) {} @@ -49,7 +49,7 @@ bool RunConfiguration::IsValid() const { } bool RunConfiguration::AddAssetResolver( - std::unique_ptr resolver) { + std::unique_ptr resolver) { if (!resolver || !resolver->IsValid()) { return false; } @@ -68,8 +68,7 @@ void RunConfiguration::SetEntrypointAndLibrary(std::string entrypoint, entrypoint_library_ = std::move(library); } -std::shared_ptr 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 f5494c10d7e3d..a8b3a8b6e72f1 100644 --- a/shell/common/run_configuration.h +++ b/shell/common/run_configuration.h @@ -21,13 +21,13 @@ namespace flutter { class RunConfiguration { public: static RunConfiguration InferFromSettings( - const flutter::Settings& settings, + const Settings& settings, fml::RefPtr io_worker = nullptr); RunConfiguration(std::unique_ptr configuration); RunConfiguration(std::unique_ptr configuration, - std::shared_ptr asset_manager); + std::shared_ptr asset_manager); RunConfiguration(RunConfiguration&&); @@ -35,13 +35,13 @@ class RunConfiguration { bool IsValid() const; - bool AddAssetResolver(std::unique_ptr resolver); + bool AddAssetResolver(std::unique_ptr resolver); void SetEntrypoint(std::string entrypoint); void SetEntrypointAndLibrary(std::string entrypoint, std::string library); - std::shared_ptr GetAssetManager() const; + std::shared_ptr GetAssetManager() const; const std::string& GetEntrypoint() const; @@ -51,7 +51,7 @@ class RunConfiguration { private: std::unique_ptr isolate_configuration_; - std::shared_ptr 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 893a269601916..e62dd13a2e8e3 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -36,11 +36,11 @@ namespace flutter { constexpr char kSkiaChannel[] = "flutter/skia"; std::unique_ptr Shell::CreateShellOnPlatformThread( - flutter::DartVMRef vm, - flutter::TaskRunners task_runners, - flutter::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + DartVMRef vm, + TaskRunners task_runners, + Settings settings, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, Shell::CreateCallback on_create_platform_view, Shell::CreateCallback on_create_rasterizer) { if (!task_runners.IsValid()) { @@ -88,7 +88,7 @@ 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::WeakPtr snapshot_delegate; fml::TaskRunner::RunNowOrPostTask( task_runners.GetGPUTaskRunner(), [&gpu_latch, // &rasterizer, // @@ -157,8 +157,8 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( } static void RecordStartupTimestamp() { - if (flutter::engine_main_enter_ts == 0) { - flutter::engine_main_enter_ts = Dart_TimelineGetMicros(); + if (engine_main_enter_ts == 0) { + engine_main_enter_ts = Dart_TimelineGetMicros(); } } @@ -168,7 +168,7 @@ static void RecordStartupTimestamp() { // TODO(chinmaygarde): The unfortunate side effect of this call is that settings // that cause shell initialization failures will still lead to some of their // settings being applied. -static void PerformInitializationTasks(const flutter::Settings& settings) { +static void PerformInitializationTasks(const Settings& settings) { { fml::LogSettings log_settings; log_settings.min_log_level = @@ -206,15 +206,15 @@ static void PerformInitializationTasks(const flutter::Settings& settings) { } std::unique_ptr Shell::Create( - flutter::TaskRunners task_runners, - flutter::Settings settings, + TaskRunners task_runners, + Settings settings, Shell::CreateCallback on_create_platform_view, Shell::CreateCallback on_create_rasterizer) { PerformInitializationTasks(settings); TRACE_EVENT0("flutter", "Shell::Create"); - auto vm = flutter::DartVMRef::Create(settings); + auto vm = DartVMRef::Create(settings); FML_CHECK(vm) << "Must be able to initialize the VM."; auto vm_data = vm->GetVMData(); @@ -222,7 +222,7 @@ std::unique_ptr Shell::Create( return Shell::Create(std::move(task_runners), // std::move(settings), // vm_data->GetIsolateSnapshot(), // isolate snapshot - flutter::DartSnapshot::Empty(), // shared snapshot + DartSnapshot::Empty(), // shared snapshot std::move(on_create_platform_view), // std::move(on_create_rasterizer), // std::move(vm) // @@ -230,13 +230,13 @@ std::unique_ptr Shell::Create( } std::unique_ptr Shell::Create( - flutter::TaskRunners task_runners, - flutter::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + TaskRunners task_runners, + Settings settings, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, Shell::CreateCallback on_create_platform_view, Shell::CreateCallback on_create_rasterizer, - flutter::DartVMRef vm) { + DartVMRef vm) { PerformInitializationTasks(settings); TRACE_EVENT0("flutter", "Shell::CreateWithSnapshots"); @@ -274,9 +274,7 @@ std::unique_ptr Shell::Create( return shell; } -Shell::Shell(flutter::DartVMRef vm, - flutter::TaskRunners task_runners, - flutter::Settings settings) +Shell::Shell(DartVMRef vm, TaskRunners task_runners, Settings settings) : task_runners_(std::move(task_runners)), settings_(std::move(settings)), vm_(std::move(vm)) { @@ -286,34 +284,33 @@ Shell::Shell(flutter::DartVMRef vm, // Install service protocol handlers. - service_protocol_handlers_[flutter::ServiceProtocol::kScreenshotExtensionName + service_protocol_handlers_[ServiceProtocol::kScreenshotExtensionName .ToString()] = { task_runners_.GetGPUTaskRunner(), std::bind(&Shell::OnServiceProtocolScreenshot, this, std::placeholders::_1, std::placeholders::_2)}; - service_protocol_handlers_ - [flutter::ServiceProtocol::kScreenshotSkpExtensionName.ToString()] = { - task_runners_.GetGPUTaskRunner(), - std::bind(&Shell::OnServiceProtocolScreenshotSKP, this, - std::placeholders::_1, std::placeholders::_2)}; - service_protocol_handlers_[flutter::ServiceProtocol::kRunInViewExtensionName + service_protocol_handlers_[ServiceProtocol::kScreenshotSkpExtensionName + .ToString()] = { + task_runners_.GetGPUTaskRunner(), + std::bind(&Shell::OnServiceProtocolScreenshotSKP, this, + std::placeholders::_1, std::placeholders::_2)}; + service_protocol_handlers_[ServiceProtocol::kRunInViewExtensionName .ToString()] = { task_runners_.GetUITaskRunner(), std::bind(&Shell::OnServiceProtocolRunInView, this, std::placeholders::_1, std::placeholders::_2)}; + service_protocol_handlers_[ServiceProtocol::kFlushUIThreadTasksExtensionName + .ToString()] = { + task_runners_.GetUITaskRunner(), + std::bind(&Shell::OnServiceProtocolFlushUIThreadTasks, this, + std::placeholders::_1, std::placeholders::_2)}; + service_protocol_handlers_[ServiceProtocol::kSetAssetBundlePathExtensionName + .ToString()] = { + task_runners_.GetUITaskRunner(), + std::bind(&Shell::OnServiceProtocolSetAssetBundlePath, this, + std::placeholders::_1, std::placeholders::_2)}; service_protocol_handlers_ - [flutter::ServiceProtocol::kFlushUIThreadTasksExtensionName.ToString()] = - {task_runners_.GetUITaskRunner(), - std::bind(&Shell::OnServiceProtocolFlushUIThreadTasks, this, - std::placeholders::_1, std::placeholders::_2)}; - service_protocol_handlers_ - [flutter::ServiceProtocol::kSetAssetBundlePathExtensionName.ToString()] = - {task_runners_.GetUITaskRunner(), - std::bind(&Shell::OnServiceProtocolSetAssetBundlePath, this, - std::placeholders::_1, std::placeholders::_2)}; - service_protocol_handlers_ - [flutter::ServiceProtocol::kGetDisplayRefreshRateExtensionName - .ToString()] = { + [ServiceProtocol::kGetDisplayRefreshRateExtensionName.ToString()] = { task_runners_.GetUITaskRunner(), std::bind(&Shell::OnServiceProtocolGetDisplayRefreshRate, this, std::placeholders::_1, std::placeholders::_2)}; @@ -405,11 +402,11 @@ bool Shell::Setup(std::unique_ptr platform_view, return true; } -const flutter::Settings& Shell::GetSettings() const { +const Settings& Shell::GetSettings() const { return settings_; } -const flutter::TaskRunners& Shell::GetTaskRunners() const { +const TaskRunners& Shell::GetTaskRunners() const { return task_runners_; } @@ -428,7 +425,7 @@ fml::WeakPtr Shell::GetPlatformView() { return platform_view_->GetWeakPtr(); } -flutter::DartVM* Shell::GetDartVM() { +DartVM* Shell::GetDartVM() { return &vm_; } @@ -591,8 +588,7 @@ void Shell::OnPlatformViewDestroyed() { } // |PlatformView::Delegate| -void Shell::OnPlatformViewSetViewportMetrics( - const flutter::ViewportMetrics& metrics) { +void Shell::OnPlatformViewSetViewportMetrics(const ViewportMetrics& metrics) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -606,7 +602,7 @@ void Shell::OnPlatformViewSetViewportMetrics( // |PlatformView::Delegate| void Shell::OnPlatformViewDispatchPlatformMessage( - fml::RefPtr message) { + fml::RefPtr message) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -620,7 +616,7 @@ void Shell::OnPlatformViewDispatchPlatformMessage( // |PlatformView::Delegate| void Shell::OnPlatformViewDispatchPointerDataPacket( - std::unique_ptr packet) { + std::unique_ptr packet) { TRACE_EVENT0("flutter", "Shell::OnPlatformViewDispatchPointerDataPacket"); TRACE_FLOW_BEGIN("flutter", "PointerEvent", next_pointer_flow_id_); FML_DCHECK(is_setup_); @@ -636,10 +632,9 @@ void Shell::OnPlatformViewDispatchPointerDataPacket( } // |PlatformView::Delegate| -void Shell::OnPlatformViewDispatchSemanticsAction( - int32_t id, - flutter::SemanticsAction action, - std::vector args) { +void Shell::OnPlatformViewDispatchSemanticsAction(int32_t id, + SemanticsAction action, + std::vector args) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -773,8 +768,7 @@ void Shell::OnAnimatorNotifyIdle(int64_t deadline) { } // |Animator::Delegate| -void Shell::OnAnimatorDraw( - fml::RefPtr> pipeline) { +void Shell::OnAnimatorDraw(fml::RefPtr> pipeline) { FML_DCHECK(is_setup_); task_runners_.GetGPUTaskRunner()->PostTask( @@ -799,9 +793,8 @@ void Shell::OnAnimatorDrawLastLayerTree() { } // |Engine::Delegate| -void Shell::OnEngineUpdateSemantics( - flutter::SemanticsNodeUpdates update, - flutter::CustomAccessibilityActionUpdates actions) { +void Shell::OnEngineUpdateSemantics(SemanticsNodeUpdates update, + CustomAccessibilityActionUpdates actions) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); @@ -816,7 +809,7 @@ void Shell::OnEngineUpdateSemantics( // |Engine::Delegate| void Shell::OnEngineHandlePlatformMessage( - fml::RefPtr message) { + fml::RefPtr message) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); @@ -833,8 +826,7 @@ void Shell::OnEngineHandlePlatformMessage( }); } -void Shell::HandleEngineSkiaMessage( - fml::RefPtr message) { +void Shell::HandleEngineSkiaMessage(fml::RefPtr message) { const auto& data = message->data(); rapidjson::Document document; @@ -884,7 +876,7 @@ void Shell::UpdateIsolateDescription(const std::string isolate_name, vm_->GetServiceProtocol()->SetHandlerDescription(this, description); } -// |flutter::ServiceProtocol::Handler| +// |ServiceProtocol::Handler| fml::RefPtr Shell::GetServiceProtocolHandlerTaskRunner( fml::StringView method) const { FML_DCHECK(is_setup_); @@ -895,7 +887,7 @@ fml::RefPtr Shell::GetServiceProtocolHandlerTaskRunner( return task_runners_.GetUITaskRunner(); } -// |flutter::ServiceProtocol::Handler| +// |ServiceProtocol::Handler| bool Shell::HandleServiceProtocolMessage( fml::StringView method, // one if the extension names specified above. const ServiceProtocolMap& params, @@ -907,9 +899,9 @@ bool Shell::HandleServiceProtocolMessage( return false; } -// |flutter::ServiceProtocol::Handler| -flutter::ServiceProtocol::Handler::Description -Shell::GetServiceProtocolDescription() const { +// |ServiceProtocol::Handler| +ServiceProtocol::Handler::Description Shell::GetServiceProtocolDescription() + const { return { engine_->GetUIIsolateMainPort(), engine_->GetUIIsolateName(), @@ -941,7 +933,7 @@ static void ServiceProtocolFailureError(rapidjson::Document& response, // Service protocol handler bool Shell::OnServiceProtocolScreenshot( - const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, + const ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response) { FML_DCHECK(task_runners_.GetGPUTaskRunner()->RunsTasksOnCurrentThread()); auto screenshot = rasterizer_->ScreenshotLastLayerTree( @@ -962,7 +954,7 @@ bool Shell::OnServiceProtocolScreenshot( // Service protocol handler bool Shell::OnServiceProtocolScreenshotSKP( - const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, + const ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response) { FML_DCHECK(task_runners_.GetGPUTaskRunner()->RunsTasksOnCurrentThread()); auto screenshot = rasterizer_->ScreenshotLastLayerTree( @@ -983,7 +975,7 @@ bool Shell::OnServiceProtocolScreenshotSKP( // Service protocol handler bool Shell::OnServiceProtocolRunInView( - const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, + const ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response) { FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); @@ -1026,7 +1018,7 @@ bool Shell::OnServiceProtocolRunInView( RunConfiguration configuration(std::move(isolate_configuration)); configuration.AddAssetResolver( - std::make_unique(fml::OpenDirectory( + std::make_unique(fml::OpenDirectory( asset_directory_path.c_str(), false, fml::FilePermission::kRead))); auto& allocator = response.GetAllocator(); @@ -1051,7 +1043,7 @@ bool Shell::OnServiceProtocolRunInView( // Service protocol handler bool Shell::OnServiceProtocolFlushUIThreadTasks( - const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, + const ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response) { FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); // This API should not be invoked by production code. @@ -1066,7 +1058,7 @@ bool Shell::OnServiceProtocolFlushUIThreadTasks( } bool Shell::OnServiceProtocolGetDisplayRefreshRate( - const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, + const ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response) { FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); response.SetObject(); @@ -1077,7 +1069,7 @@ bool Shell::OnServiceProtocolGetDisplayRefreshRate( // Service protocol handler bool Shell::OnServiceProtocolSetAssetBundlePath( - const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, + const ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response) { FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); @@ -1090,9 +1082,9 @@ bool Shell::OnServiceProtocolSetAssetBundlePath( auto& allocator = response.GetAllocator(); response.SetObject(); - auto asset_manager = std::make_shared(); + auto asset_manager = std::make_shared(); - asset_manager->PushFront(std::make_unique( + asset_manager->PushFront(std::make_unique( fml::OpenDirectory(params.at("assetDirectory").ToString().c_str(), false, fml::FilePermission::kRead))); diff --git a/shell/common/shell.h b/shell/common/shell.h index 63006e079543e..09614b6941cda 100644 --- a/shell/common/shell.h +++ b/shell/common/shell.h @@ -37,7 +37,7 @@ namespace flutter { class Shell final : public PlatformView::Delegate, public Animator::Delegate, public Engine::Delegate, - public flutter::ServiceProtocol::Handler { + public ServiceProtocol::Handler { public: template using CreateCallback = std::function(Shell&)>; @@ -45,27 +45,27 @@ class Shell final : public PlatformView::Delegate, // Create a shell with the given task runners and settings. The isolate // snapshot will be shared with the snapshot of the service isolate. static std::unique_ptr Create( - flutter::TaskRunners task_runners, - flutter::Settings settings, + TaskRunners task_runners, + Settings settings, CreateCallback on_create_platform_view, CreateCallback on_create_rasterizer); // Creates a shell with the given task runners and settings. The isolate // snapshot is specified upfront. static std::unique_ptr Create( - flutter::TaskRunners task_runners, - flutter::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + TaskRunners task_runners, + Settings settings, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, CreateCallback on_create_platform_view, CreateCallback on_create_rasterizer, - flutter::DartVMRef vm); + DartVMRef vm); ~Shell(); - const flutter::Settings& GetSettings() const; + const Settings& GetSettings() const; - const flutter::TaskRunners& GetTaskRunners() const; + const TaskRunners& GetTaskRunners() const; fml::WeakPtr GetRasterizer(); @@ -73,7 +73,7 @@ class Shell final : public PlatformView::Delegate, fml::WeakPtr GetPlatformView(); - flutter::DartVM* GetDartVM(); + DartVM* GetDartVM(); bool IsSetup() const; @@ -81,13 +81,13 @@ class Shell final : public PlatformView::Delegate, bool base64_encode); private: - using ServiceProtocolHandler = std::function; + using ServiceProtocolHandler = + std::function; - const flutter::TaskRunners task_runners_; - const flutter::Settings settings_; - flutter::DartVMRef vm_; + const TaskRunners task_runners_; + const Settings settings_; + DartVMRef vm_; std::unique_ptr platform_view_; // on platform task runner std::unique_ptr engine_; // on UI task runner std::unique_ptr rasterizer_; // on GPU task runner @@ -102,17 +102,15 @@ class Shell final : public PlatformView::Delegate, bool is_setup_ = false; uint64_t next_pointer_flow_id_ = 0; - Shell(flutter::TaskRunners task_runners, flutter::Settings settings); - Shell(flutter::DartVMRef vm, - flutter::TaskRunners task_runners, - flutter::Settings settings); + Shell(TaskRunners task_runners, Settings settings); + Shell(DartVMRef vm, TaskRunners task_runners, Settings settings); static std::unique_ptr CreateShellOnPlatformThread( - flutter::DartVMRef vm, - flutter::TaskRunners task_runners, - flutter::Settings settings, - fml::RefPtr isolate_snapshot, - fml::RefPtr shared_snapshot, + DartVMRef vm, + TaskRunners task_runners, + Settings settings, + fml::RefPtr isolate_snapshot, + fml::RefPtr shared_snapshot, Shell::CreateCallback on_create_platform_view, Shell::CreateCallback on_create_rasterizer); @@ -129,20 +127,20 @@ class Shell final : public PlatformView::Delegate, // |PlatformView::Delegate| void OnPlatformViewSetViewportMetrics( - const flutter::ViewportMetrics& metrics) override; + const ViewportMetrics& metrics) override; // |PlatformView::Delegate| void OnPlatformViewDispatchPlatformMessage( - fml::RefPtr message) override; + fml::RefPtr message) override; // |PlatformView::Delegate| void OnPlatformViewDispatchPointerDataPacket( - std::unique_ptr packet) override; + std::unique_ptr packet) override; // |PlatformView::Delegate| void OnPlatformViewDispatchSemanticsAction( int32_t id, - flutter::SemanticsAction action, + SemanticsAction action, std::vector args) override; // |PlatformView::Delegate| @@ -171,22 +169,21 @@ class Shell final : public PlatformView::Delegate, void OnAnimatorNotifyIdle(int64_t deadline) override; // |Animator::Delegate| - void OnAnimatorDraw( - fml::RefPtr> pipeline) override; + void OnAnimatorDraw(fml::RefPtr> pipeline) override; // |Animator::Delegate| void OnAnimatorDrawLastLayerTree() override; // |Engine::Delegate| void OnEngineUpdateSemantics( - flutter::SemanticsNodeUpdates update, - flutter::CustomAccessibilityActionUpdates actions) override; + SemanticsNodeUpdates update, + CustomAccessibilityActionUpdates actions) override; // |Engine::Delegate| void OnEngineHandlePlatformMessage( - fml::RefPtr message) override; + fml::RefPtr message) override; - void HandleEngineSkiaMessage(fml::RefPtr message); + void HandleEngineSkiaMessage(fml::RefPtr message); // |Engine::Delegate| void OnPreEngineRestart() override; @@ -195,48 +192,48 @@ class Shell final : public PlatformView::Delegate, void UpdateIsolateDescription(const std::string isolate_name, int64_t isolate_port) override; - // |flutter::ServiceProtocol::Handler| + // |ServiceProtocol::Handler| fml::RefPtr GetServiceProtocolHandlerTaskRunner( fml::StringView method) const override; - // |flutter::ServiceProtocol::Handler| + // |ServiceProtocol::Handler| bool HandleServiceProtocolMessage( fml::StringView method, // one if the extension names specified above. const ServiceProtocolMap& params, rapidjson::Document& response) override; - // |flutter::ServiceProtocol::Handler| - flutter::ServiceProtocol::Handler::Description GetServiceProtocolDescription() + // |ServiceProtocol::Handler| + ServiceProtocol::Handler::Description GetServiceProtocolDescription() const override; // Service protocol handler bool OnServiceProtocolScreenshot( - const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, + const ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response); // Service protocol handler bool OnServiceProtocolScreenshotSKP( - const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, + const ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response); // Service protocol handler bool OnServiceProtocolRunInView( - const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, + const ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response); // Service protocol handler bool OnServiceProtocolFlushUIThreadTasks( - const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, + const ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response); // Service protocol handler bool OnServiceProtocolSetAssetBundlePath( - const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, + const ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response); // Service protocol handler bool OnServiceProtocolGetDisplayRefreshRate( - const flutter::ServiceProtocol::Handler::ServiceProtocolMap& params, + const ServiceProtocol::Handler::ServiceProtocolMap& params, rapidjson::Document& response); FML_DISALLOW_COPY_AND_ASSIGN(Shell); diff --git a/shell/common/shell_benchmarks.cc b/shell/common/shell_benchmarks.cc index 80b255162eecc..dd344abd54568 100644 --- a/shell/common/shell_benchmarks.cc +++ b/shell/common/shell_benchmarks.cc @@ -16,7 +16,7 @@ static void StartupAndShutdownShell(benchmark::State& state, std::unique_ptr thread_host; { benchmarking::ScopedPauseTiming pause(state, !measure_startup); - flutter::Settings settings = {}; + Settings settings = {}; settings.task_observer_add = [](intptr_t, fml::closure) {}; settings.task_observer_remove = [](intptr_t) {}; @@ -26,11 +26,11 @@ static void StartupAndShutdownShell(benchmark::State& state, ThreadHost::Type::GPU | ThreadHost::Type::IO | ThreadHost::Type::UI); - flutter::TaskRunners task_runners( - "test", thread_host->platform_thread->GetTaskRunner(), - thread_host->gpu_thread->GetTaskRunner(), - thread_host->ui_thread->GetTaskRunner(), - thread_host->io_thread->GetTaskRunner()); + 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, diff --git a/shell/common/shell_test.cc b/shell/common/shell_test.cc index 94e6d8590859f..d1dc5c406c856 100644 --- a/shell/common/shell_test.cc +++ b/shell/common/shell_test.cc @@ -44,7 +44,7 @@ static std::unique_ptr GetMapping(const fml::UniqueFD& directory, return mapping; } -void ShellTest::SetSnapshotsAndAssets(flutter::Settings& settings) { +void ShellTest::SetSnapshotsAndAssets(Settings& settings) { if (!assets_dir_.is_valid()) { return; } @@ -53,7 +53,7 @@ void ShellTest::SetSnapshotsAndAssets(flutter::Settings& settings) { // In JIT execution, all snapshots are present within the binary itself and // don't need to be explicitly suppiled by the embedder. - if (flutter::DartVM::IsRunningPrecompiledCode()) { + if (DartVM::IsRunningPrecompiledCode()) { settings.vm_snapshot_data = [this]() { return GetMapping(assets_dir_, "vm_snapshot_data", false); }; @@ -62,7 +62,7 @@ void ShellTest::SetSnapshotsAndAssets(flutter::Settings& settings) { return GetMapping(assets_dir_, "isolate_snapshot_data", false); }; - if (flutter::DartVM::IsRunningPrecompiledCode()) { + if (DartVM::IsRunningPrecompiledCode()) { settings.vm_snapshot_instr = [this]() { return GetMapping(assets_dir_, "vm_snapshot_instr", true); }; @@ -81,8 +81,8 @@ void ShellTest::SetSnapshotsAndAssets(flutter::Settings& settings) { } } -flutter::Settings ShellTest::CreateSettingsForFixture() { - flutter::Settings settings; +Settings ShellTest::CreateSettingsForFixture() { + Settings settings; settings.task_observer_add = [](intptr_t key, fml::closure handler) { fml::MessageLoop::GetCurrent().AddTaskObserver(key, handler); }; @@ -96,7 +96,7 @@ flutter::Settings ShellTest::CreateSettingsForFixture() { return settings; } -flutter::TaskRunners ShellTest::GetTaskRunnersForFixture() { +TaskRunners ShellTest::GetTaskRunnersForFixture() { return { "test", thread_host_->platform_thread->GetTaskRunner(), // platform diff --git a/shell/common/shell_test.h b/shell/common/shell_test.h index a813049bc2c63..c88fde85aa812 100644 --- a/shell/common/shell_test.h +++ b/shell/common/shell_test.h @@ -23,9 +23,9 @@ class ShellTest : public ::testing::ThreadTest { ~ShellTest(); - flutter::Settings CreateSettingsForFixture(); + Settings CreateSettingsForFixture(); - flutter::TaskRunners GetTaskRunnersForFixture(); + TaskRunners GetTaskRunnersForFixture(); void AddNativeCallback(std::string name, Dart_NativeFunction callback); @@ -41,7 +41,7 @@ class ShellTest : public ::testing::ThreadTest { std::shared_ptr<::testing::TestDartNativeResolver> native_resolver_; std::unique_ptr thread_host_; - void SetSnapshotsAndAssets(flutter::Settings& settings); + void SetSnapshotsAndAssets(Settings& settings); }; } // namespace testing diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc index 5be39eea106fc..e4ba61e2b8ebb 100644 --- a/shell/common/shell_unittests.cc +++ b/shell/common/shell_unittests.cc @@ -26,8 +26,7 @@ namespace testing { class TestPlatformView : public PlatformView, public GPUSurfaceSoftwareDelegate { public: - TestPlatformView(PlatformView::Delegate& delegate, - flutter::TaskRunners task_runners) + TestPlatformView(PlatformView::Delegate& delegate, TaskRunners task_runners) : PlatformView(delegate, std::move(task_runners)) {} private: @@ -84,8 +83,8 @@ static bool ValidateShell(Shell* shell) { } TEST_F(ShellTest, InitializeWithInvalidThreads) { - flutter::Settings settings = CreateSettingsForFixture(); - flutter::TaskRunners task_runners("test", nullptr, nullptr, nullptr, nullptr); + Settings settings = CreateSettingsForFixture(); + TaskRunners task_runners("test", nullptr, nullptr, nullptr, nullptr); auto shell = Shell::Create( std::move(task_runners), settings, [](Shell& shell) { @@ -99,16 +98,15 @@ TEST_F(ShellTest, InitializeWithInvalidThreads) { } TEST_F(ShellTest, InitializeWithDifferentThreads) { - flutter::Settings settings = CreateSettingsForFixture(); + Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( "io.flutter.test." + ::testing::GetCurrentTestName() + ".", ThreadHost::Type::Platform | ThreadHost::Type::GPU | ThreadHost::Type::IO | ThreadHost::Type::UI); - flutter::TaskRunners task_runners( - "test", thread_host.platform_thread->GetTaskRunner(), - thread_host.gpu_thread->GetTaskRunner(), - thread_host.ui_thread->GetTaskRunner(), - thread_host.io_thread->GetTaskRunner()); + TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(), + thread_host.gpu_thread->GetTaskRunner(), + thread_host.ui_thread->GetTaskRunner(), + thread_host.io_thread->GetTaskRunner()); auto shell = Shell::Create( std::move(task_runners), settings, [](Shell& shell) { @@ -122,13 +120,13 @@ TEST_F(ShellTest, InitializeWithDifferentThreads) { } TEST_F(ShellTest, InitializeWithSingleThread) { - flutter::Settings settings = CreateSettingsForFixture(); + Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( "io.flutter.test." + ::testing::GetCurrentTestName() + ".", ThreadHost::Type::Platform); auto task_runner = thread_host.platform_thread->GetTaskRunner(); - flutter::TaskRunners task_runners("test", task_runner, task_runner, - task_runner, task_runner); + TaskRunners task_runners("test", task_runner, task_runner, task_runner, + task_runner); auto shell = Shell::Create( std::move(task_runners), settings, [](Shell& shell) { @@ -142,11 +140,11 @@ TEST_F(ShellTest, InitializeWithSingleThread) { } TEST_F(ShellTest, InitializeWithSingleThreadWhichIsTheCallingThread) { - flutter::Settings settings = CreateSettingsForFixture(); + Settings settings = CreateSettingsForFixture(); fml::MessageLoop::EnsureInitializedForCurrentThread(); auto task_runner = fml::MessageLoop::GetCurrent().GetTaskRunner(); - flutter::TaskRunners task_runners("test", task_runner, task_runner, - task_runner, task_runner); + TaskRunners task_runners("test", task_runner, task_runner, task_runner, + task_runner); auto shell = Shell::Create( std::move(task_runners), settings, [](Shell& shell) { @@ -161,16 +159,16 @@ TEST_F(ShellTest, InitializeWithSingleThreadWhichIsTheCallingThread) { TEST_F(ShellTest, InitializeWithMultipleThreadButCallingThreadAsPlatformThread) { - flutter::Settings settings = CreateSettingsForFixture(); + Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( "io.flutter.test." + ::testing::GetCurrentTestName() + ".", ThreadHost::Type::GPU | ThreadHost::Type::IO | ThreadHost::Type::UI); fml::MessageLoop::EnsureInitializedForCurrentThread(); - flutter::TaskRunners task_runners( - "test", fml::MessageLoop::GetCurrent().GetTaskRunner(), - thread_host.gpu_thread->GetTaskRunner(), - thread_host.ui_thread->GetTaskRunner(), - thread_host.io_thread->GetTaskRunner()); + TaskRunners task_runners("test", + fml::MessageLoop::GetCurrent().GetTaskRunner(), + thread_host.gpu_thread->GetTaskRunner(), + thread_host.ui_thread->GetTaskRunner(), + thread_host.io_thread->GetTaskRunner()); auto shell = Shell::Create( std::move(task_runners), settings, [](Shell& shell) { @@ -184,11 +182,11 @@ TEST_F(ShellTest, } TEST_F(ShellTest, InitializeWithGPUAndPlatformThreadsTheSame) { - flutter::Settings settings = CreateSettingsForFixture(); + Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( "io.flutter.test." + ::testing::GetCurrentTestName() + ".", ThreadHost::Type::Platform | ThreadHost::Type::IO | ThreadHost::Type::UI); - flutter::TaskRunners task_runners( + TaskRunners task_runners( "test", thread_host.platform_thread->GetTaskRunner(), // platform thread_host.platform_thread->GetTaskRunner(), // gpu diff --git a/shell/common/switches.cc b/shell/common/switches.cc index f3685c76decad..916f91e48e905 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -46,12 +46,11 @@ void PrintUsage(const std::string& executable_name) { std::cerr << "Versions: " << std::endl << std::endl; - std::cerr << "Flutter Engine Version: " << flutter::GetFlutterEngineVersion() + std::cerr << "Flutter Engine Version: " << GetFlutterEngineVersion() << std::endl; - std::cerr << "Skia Version: " << flutter::GetSkiaVersion() << std::endl; + std::cerr << "Skia Version: " << GetSkiaVersion() << std::endl; - std::cerr << "Dart Version: " << flutter::GetDartVersion() << std::endl - << std::endl; + std::cerr << "Dart Version: " << GetDartVersion() << std::endl << std::endl; std::cerr << "Available Flags:" << std::endl; @@ -150,9 +149,8 @@ std::unique_ptr GetSymbolMapping(std::string symbol_prefix, return std::make_unique(mapping, size); } -flutter::Settings SettingsFromCommandLine( - const fml::CommandLine& command_line) { - flutter::Settings settings = {}; +Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { + Settings settings = {}; // Enable Observatory settings.enable_observatory = diff --git a/shell/common/switches.h b/shell/common/switches.h index be7d887ad22b0..ac9b5e829ef70 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -148,7 +148,7 @@ void PrintUsage(const std::string& executable_name); const fml::StringView FlagForSwitch(Switch swtch); -flutter::Settings SettingsFromCommandLine(const fml::CommandLine& command_line); +Settings SettingsFromCommandLine(const fml::CommandLine& command_line); } // namespace flutter diff --git a/shell/common/vsync_waiter.cc b/shell/common/vsync_waiter.cc index 1e01dfd57015e..97364c581d2ee 100644 --- a/shell/common/vsync_waiter.cc +++ b/shell/common/vsync_waiter.cc @@ -23,7 +23,7 @@ static constexpr const char* kVsyncTraceName = "VSYNC"; static constexpr const char* kVsyncFlowName = "VsyncFlow"; -VsyncWaiter::VsyncWaiter(flutter::TaskRunners task_runners) +VsyncWaiter::VsyncWaiter(TaskRunners task_runners) : task_runners_(std::move(task_runners)) {} VsyncWaiter::~VsyncWaiter() = default; diff --git a/shell/common/vsync_waiter.h b/shell/common/vsync_waiter.h index 08c5be14e9934..54fbf827bfcd4 100644 --- a/shell/common/vsync_waiter.h +++ b/shell/common/vsync_waiter.h @@ -36,9 +36,9 @@ class VsyncWaiter : public std::enable_shared_from_this { friend class VsyncWaiterAndroid; friend class VsyncWaiterEmbedder; - const flutter::TaskRunners task_runners_; + const TaskRunners task_runners_; - VsyncWaiter(flutter::TaskRunners task_runners); + VsyncWaiter(TaskRunners task_runners); // Implementations are meant to override this method and arm their vsync // latches when in response to this invocation. On vsync, they are meant to diff --git a/shell/common/vsync_waiter_fallback.cc b/shell/common/vsync_waiter_fallback.cc index 5805da0dc4945..fc23c6180a4ff 100644 --- a/shell/common/vsync_waiter_fallback.cc +++ b/shell/common/vsync_waiter_fallback.cc @@ -20,7 +20,7 @@ static fml::TimePoint SnapToNextTick(fml::TimePoint value, } // namespace -VsyncWaiterFallback::VsyncWaiterFallback(flutter::TaskRunners task_runners) +VsyncWaiterFallback::VsyncWaiterFallback(TaskRunners task_runners) : VsyncWaiter(std::move(task_runners)), phase_(fml::TimePoint::Now()) {} VsyncWaiterFallback::~VsyncWaiterFallback() = default; diff --git a/shell/common/vsync_waiter_fallback.h b/shell/common/vsync_waiter_fallback.h index c17ee740487c3..bda070e778911 100644 --- a/shell/common/vsync_waiter_fallback.h +++ b/shell/common/vsync_waiter_fallback.h @@ -14,7 +14,7 @@ namespace flutter { class VsyncWaiterFallback final : public VsyncWaiter { public: - VsyncWaiterFallback(flutter::TaskRunners task_runners); + VsyncWaiterFallback(TaskRunners task_runners); ~VsyncWaiterFallback() override; From 905c571db50d5eb3b10eaa4d3c43c99321032223 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Tue, 9 Apr 2019 18:49:02 -0700 Subject: [PATCH 0764/1117] Add windows host_debug_unopt build (#8515) The issue with gn --unoptimized seems to be solved in the ToT engine, buildroot, or depot_tools. The added test makes sure that it won't be broken again for non-Google windows machines. --- .cirrus.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 136c255a6e936..dde481e948196 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -62,7 +62,7 @@ task: format_script: cd $ENGINE_PATH/src/flutter && ./ci/format.sh build_script: cd $ENGINE_PATH/src/flutter && ./ci/build.sh -build_windows_task: +task: gce_instance: image_project: flutter-cirrus image_name: flutter-engine-windows-server-2016-core @@ -86,8 +86,16 @@ build_windows_task: robocopy %CIRRUS_WORKING_DIR% %ENGINE_PATH%/src/flutter /MIR || (cmd /s /c exit /b 0) cd %ENGINE_PATH%/src gclient sync - # Currently there's a problem with `flutter/tools/gn --unoptimized` so we omit --unoptimized for now - compile_host_script: | - cd %ENGINE_PATH%/src - python flutter/tools/gn - ninja -C out/host_debug + + matrix: + - name: build_windows_debug + compile_host_script: | + cd %ENGINE_PATH%/src + python flutter/tools/gn --runtime-mode debug --unoptimized + ninja -C out/host_debug_unopt + + - name: build_windows_debug_unopt + compile_host_script: | + cd %ENGINE_PATH%/src + python flutter/tools/gn --runtime-mode debug + ninja -C out/host_debug From e356dbca2c442ed751cf0d27fcf883e0279c4a87 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 9 Apr 2019 19:18:51 -0700 Subject: [PATCH 0765/1117] Merge flutter/synchronization contents into fml. (#8525) When flutter/synchronization was first authored, we did not own fml (it was called fxl then). Now we do, so use a single spot for such utilities. The pipeline was meant to be a general purpose utility that was only ever used by the animator (it even has animator specific tracing), so move that to shell instead (where the animator resides). --- BUILD.gn | 1 - ci/licenses_golden/licenses_flutter | 10 +++--- flow/BUILD.gn | 1 - fml/BUILD.gn | 3 ++ .../synchronization}/semaphore.cc | 18 +++++------ .../synchronization}/semaphore.h | 10 +++--- .../synchronization}/semaphore_unittest.cc | 8 ++--- shell/common/BUILD.gn | 3 +- shell/common/animator.h | 6 ++-- {synchronization => shell/common}/pipeline.cc | 2 +- {synchronization => shell/common}/pipeline.h | 13 ++++---- shell/common/rasterizer.h | 2 +- shell/gpu/BUILD.gn | 1 - synchronization/BUILD.gn | 32 ------------------- testing/run_tests.sh | 3 -- 15 files changed, 39 insertions(+), 74 deletions(-) rename {synchronization => fml/synchronization}/semaphore.cc (92%) rename {synchronization => fml/synchronization}/semaphore.h (75%) rename {synchronization => fml/synchronization}/semaphore_unittest.cc (80%) rename {synchronization => shell/common}/pipeline.cc (87%) rename {synchronization => shell/common}/pipeline.h (94%) delete mode 100644 synchronization/BUILD.gn diff --git a/BUILD.gn b/BUILD.gn index 2766d1b986f44..2e7cc0fa71e5e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -50,7 +50,6 @@ group("flutter") { "$flutter_root/runtime:runtime_unittests", "$flutter_root/shell/common:shell_unittests", "$flutter_root/shell/platform/embedder:embedder_unittests", - "$flutter_root/synchronization:synchronization_unittests", "$flutter_root/third_party/txt:txt_unittests", ] diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index c9288e4943282..fcca26c69d678 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -219,6 +219,9 @@ 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/semaphore.cc +FILE: ../../../flutter/fml/synchronization/semaphore.h +FILE: ../../../flutter/fml/synchronization/semaphore_unittest.cc FILE: ../../../flutter/fml/synchronization/shared_mutex.h FILE: ../../../flutter/fml/synchronization/shared_mutex_std.cc FILE: ../../../flutter/fml/synchronization/shared_mutex_std.h @@ -417,6 +420,8 @@ 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/pipeline.cc +FILE: ../../../flutter/shell/common/pipeline.h FILE: ../../../flutter/shell/common/platform_view.cc FILE: ../../../flutter/shell/common/platform_view.h FILE: ../../../flutter/shell/common/rasterizer.cc @@ -717,11 +722,6 @@ FILE: ../../../flutter/shell/platform/glfw/text_input_plugin.cc FILE: ../../../flutter/shell/platform/glfw/text_input_plugin.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 diff --git a/flow/BUILD.gn b/flow/BUILD.gn index 23fc36d3a8b84..756861f5e79ff 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -65,7 +65,6 @@ source_set("flow") { deps = [ "$flutter_root/common", "$flutter_root/fml", - "$flutter_root/synchronization", "//third_party/skia", ] diff --git a/fml/BUILD.gn b/fml/BUILD.gn index 629bb1c82290a..614f1b1d5decb 100644 --- a/fml/BUILD.gn +++ b/fml/BUILD.gn @@ -50,6 +50,8 @@ source_set("fml") { "synchronization/atomic_object.h", "synchronization/count_down_latch.cc", "synchronization/count_down_latch.h", + "synchronization/semaphore.cc", + "synchronization/semaphore.h", "synchronization/shared_mutex.h", "synchronization/thread_annotations.h", "synchronization/waitable_event.cc", @@ -188,6 +190,7 @@ executable("fml_unittests") { "paths_unittests.cc", "string_view_unittest.cc", "synchronization/count_down_latch_unittests.cc", + "synchronization/semaphore_unittest.cc", "synchronization/thread_annotations_unittest.cc", "synchronization/waitable_event_unittest.cc", "thread_local_unittests.cc", diff --git a/synchronization/semaphore.cc b/fml/synchronization/semaphore.cc similarity index 92% rename from synchronization/semaphore.cc rename to fml/synchronization/semaphore.cc index 4d8e5003d5921..9dff734603aa0 100644 --- a/synchronization/semaphore.cc +++ b/fml/synchronization/semaphore.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/synchronization/semaphore.h" +#include "flutter/fml/synchronization/semaphore.h" #include "flutter/fml/build_config.h" #include "flutter/fml/logging.h" @@ -10,7 +10,7 @@ #if OS_MACOSX #include -namespace flutter { +namespace fml { class PlatformSemaphore { public: @@ -50,12 +50,12 @@ class PlatformSemaphore { FML_DISALLOW_COPY_AND_ASSIGN(PlatformSemaphore); }; -} // namespace flutter +} // namespace fml #elif OS_WIN #include -namespace flutter { +namespace fml { class PlatformSemaphore { public: @@ -91,13 +91,13 @@ class PlatformSemaphore { FML_DISALLOW_COPY_AND_ASSIGN(PlatformSemaphore); }; -} // namespace flutter +} // namespace fml #else #include #include "flutter/fml/eintr_wrapper.h" -namespace flutter { +namespace fml { class PlatformSemaphore { public: @@ -140,11 +140,11 @@ class PlatformSemaphore { FML_DISALLOW_COPY_AND_ASSIGN(PlatformSemaphore); }; -} // namespace flutter +} // namespace fml #endif -namespace flutter { +namespace fml { Semaphore::Semaphore(uint32_t count) : _impl(new PlatformSemaphore(count)) {} @@ -162,4 +162,4 @@ void Semaphore::Signal() { return _impl->Signal(); } -} // namespace flutter +} // namespace fml diff --git a/synchronization/semaphore.h b/fml/synchronization/semaphore.h similarity index 75% rename from synchronization/semaphore.h rename to fml/synchronization/semaphore.h index 594b0a559bc04..b5871017b1330 100644 --- a/synchronization/semaphore.h +++ b/fml/synchronization/semaphore.h @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SYNCHRONIZATION_SEMAPHORE_H_ -#define SYNCHRONIZATION_SEMAPHORE_H_ +#ifndef FLUTTER_FML_SYNCHRONIZATION_SEMAPHORE_H_ +#define FLUTTER_FML_SYNCHRONIZATION_SEMAPHORE_H_ #include #include "flutter/fml/compiler_specific.h" #include "flutter/fml/macros.h" -namespace flutter { +namespace fml { class PlatformSemaphore; @@ -33,6 +33,6 @@ class Semaphore { FML_DISALLOW_COPY_AND_ASSIGN(Semaphore); }; -} // namespace flutter +} // namespace fml -#endif // SYNCHRONIZATION_SEMAPHORE_H_ +#endif // FLUTTER_FML_SYNCHRONIZATION_SEMAPHORE_H_ diff --git a/synchronization/semaphore_unittest.cc b/fml/synchronization/semaphore_unittest.cc similarity index 80% rename from synchronization/semaphore_unittest.cc rename to fml/synchronization/semaphore_unittest.cc index 61810b641bee8..e109c6deb1819 100644 --- a/synchronization/semaphore_unittest.cc +++ b/fml/synchronization/semaphore_unittest.cc @@ -4,21 +4,21 @@ #include -#include "flutter/synchronization/semaphore.h" +#include "flutter/fml/synchronization/semaphore.h" #include "gtest/gtest.h" TEST(SemaphoreTest, SimpleValidity) { - flutter::Semaphore sem(100); + fml::Semaphore sem(100); ASSERT_TRUE(sem.IsValid()); } TEST(SemaphoreTest, WaitOnZero) { - flutter::Semaphore sem(0); + fml::Semaphore sem(0); ASSERT_FALSE(sem.TryWait()); } TEST(SemaphoreTest, WaitOnZeroSignalThenWait) { - flutter::Semaphore sem(0); + fml::Semaphore sem(0); ASSERT_FALSE(sem.TryWait()); std::thread thread([&sem]() { sem.Signal(); }); thread.join(); diff --git a/shell/common/BUILD.gn b/shell/common/BUILD.gn index fcfcd156d2a12..0e5c5b90d71d2 100644 --- a/shell/common/BUILD.gn +++ b/shell/common/BUILD.gn @@ -68,6 +68,8 @@ source_set("common") { "isolate_configuration.h", "persistent_cache.cc", "persistent_cache.h", + "pipeline.cc", + "pipeline.h", "platform_view.cc", "platform_view.h", "rasterizer.cc", @@ -99,7 +101,6 @@ source_set("common") { "$flutter_root/fml", "$flutter_root/lib/ui", "$flutter_root/runtime", - "$flutter_root/synchronization", "//third_party/dart/runtime:dart_api", "//third_party/skia", ] diff --git a/shell/common/animator.h b/shell/common/animator.h index c8397befab97c..e0cd52bf7bc4f 100644 --- a/shell/common/animator.h +++ b/shell/common/animator.h @@ -10,11 +10,11 @@ #include "flutter/common/task_runners.h" #include "flutter/fml/memory/ref_ptr.h" #include "flutter/fml/memory/weak_ptr.h" +#include "flutter/fml/synchronization/semaphore.h" #include "flutter/fml/time/time_point.h" +#include "flutter/shell/common/pipeline.h" #include "flutter/shell/common/rasterizer.h" #include "flutter/shell/common/vsync_waiter.h" -#include "flutter/synchronization/pipeline.h" -#include "flutter/synchronization/semaphore.h" namespace flutter { @@ -74,7 +74,7 @@ class Animator final { fml::TimePoint last_begin_frame_time_; int64_t dart_frame_deadline_; fml::RefPtr layer_tree_pipeline_; - Semaphore pending_frame_semaphore_; + fml::Semaphore pending_frame_semaphore_; LayerTreePipeline::ProducerContinuation producer_continuation_; int64_t frame_number_; bool paused_; diff --git a/synchronization/pipeline.cc b/shell/common/pipeline.cc similarity index 87% rename from synchronization/pipeline.cc rename to shell/common/pipeline.cc index 2baede8dfbd1f..fb80c187181fd 100644 --- a/synchronization/pipeline.cc +++ b/shell/common/pipeline.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/synchronization/pipeline.h" +#include "flutter/shell/common/pipeline.h" namespace flutter { diff --git a/synchronization/pipeline.h b/shell/common/pipeline.h similarity index 94% rename from synchronization/pipeline.h rename to shell/common/pipeline.h index 3aafc1767a702..b9aa1d89c6cb5 100644 --- a/synchronization/pipeline.h +++ b/shell/common/pipeline.h @@ -2,14 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SYNCHRONIZATION_PIPELINE_H_ -#define SYNCHRONIZATION_PIPELINE_H_ +#ifndef FLUTTER_SHELL_COMMON_PIPELINE_H_ +#define FLUTTER_SHELL_COMMON_PIPELINE_H_ #include "flutter/fml/macros.h" #include "flutter/fml/memory/ref_counted.h" +#include "flutter/fml/synchronization/semaphore.h" #include "flutter/fml/trace_event.h" -#include "flutter/synchronization/pipeline.h" -#include "flutter/synchronization/semaphore.h" #include #include @@ -142,8 +141,8 @@ class Pipeline : public fml::RefCountedThreadSafe> { } private: - Semaphore empty_; - Semaphore available_; + fml::Semaphore empty_; + fml::Semaphore available_; std::mutex queue_mutex_; std::queue> queue_; @@ -162,4 +161,4 @@ class Pipeline : public fml::RefCountedThreadSafe> { } // namespace flutter -#endif // SYNCHRONIZATION_PIPELINE_H_ +#endif // FLUTTER_SHELL_COMMON_PIPELINE_H_ diff --git a/shell/common/rasterizer.h b/shell/common/rasterizer.h index f3df4819e334d..f9d472b380862 100644 --- a/shell/common/rasterizer.h +++ b/shell/common/rasterizer.h @@ -14,8 +14,8 @@ #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/pipeline.h" #include "flutter/shell/common/surface.h" -#include "flutter/synchronization/pipeline.h" namespace flutter { diff --git a/shell/gpu/BUILD.gn b/shell/gpu/BUILD.gn index 02130c85e186c..93e9442968432 100644 --- a/shell/gpu/BUILD.gn +++ b/shell/gpu/BUILD.gn @@ -11,7 +11,6 @@ gpu_common_deps = [ "$flutter_root/flow", "$flutter_root/fml", "$flutter_root/shell/common", - "$flutter_root/synchronization", "//third_party/skia", ] diff --git a/synchronization/BUILD.gn b/synchronization/BUILD.gn deleted file mode 100644 index 95b8655964b53..0000000000000 --- a/synchronization/BUILD.gn +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2013 The Flutter Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -source_set("synchronization") { - sources = [ - "pipeline.cc", - "pipeline.h", - "semaphore.cc", - "semaphore.h", - ] - - public_configs = [ "$flutter_root:config" ] - - public_deps = [ - "$flutter_root/fml", - ] -} - -executable("synchronization_unittests") { - testonly = true - - sources = [ - "semaphore_unittest.cc", - ] - - deps = [ - ":synchronization", - "$flutter_root/testing", - "//third_party/dart/runtime:libdart_jit", - ] -} diff --git a/testing/run_tests.sh b/testing/run_tests.sh index ea491b4bb720a..66126634646d1 100755 --- a/testing/run_tests.sh +++ b/testing/run_tests.sh @@ -38,9 +38,6 @@ echo "Running runtime_unittests..." echo "Running shell_unittests..." "$HOST_DIR/shell_unittests" -echo "Running synchronization_unittests..." -"$HOST_DIR/synchronization_unittests" - echo "Running txt_unittests..." "$HOST_DIR/txt_unittests" --font-directory="$BUILDROOT_DIR/flutter/third_party/txt/third_party/fonts" From 72986c39ea3669ef26d4d7d7cd0c44f513fcd117 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 10 Apr 2019 10:03:10 -0700 Subject: [PATCH 0766/1117] Move constant definitions out embedder.h (#8498) --- shell/platform/embedder/embedder.cc | 3 +++ shell/platform/embedder/embedder.h | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index ee9e05282e57a..e9b50852bb1e5 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -39,6 +39,9 @@ extern const intptr_t kPlatformStrongDillSize; #include "flutter/shell/platform/embedder/embedder_thread_host.h" #include "flutter/shell/platform/embedder/platform_view_embedder.h" +const int32_t kFlutterSemanticsNodeIdBatchEnd = -1; +const int32_t kFlutterSemanticsCustomActionIdBatchEnd = -1; + static FlutterEngineResult LogEmbedderError(FlutterEngineResult code, const char* name, const char* function, diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index ae0348e7e0e19..9b6bd2478c07e 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -343,7 +343,7 @@ typedef struct { // |FlutterSemanticsNode| ID used as a sentinel to signal the end of a batch of // semantics node updates. -const int32_t kFlutterSemanticsNodeIdBatchEnd = -1; +extern const int32_t kFlutterSemanticsNodeIdBatchEnd; // A node that represents some semantic data. // @@ -414,7 +414,7 @@ typedef struct { // |FlutterSemanticsCustomAction| ID used as a sentinel to signal the end of a // batch of semantics custom action updates. -const int32_t kFlutterSemanticsCustomActionIdBatchEnd = -1; +extern const int32_t kFlutterSemanticsCustomActionIdBatchEnd; // A custom semantics action, or action override. // From b1ae0ccb7c35fe6ee206254518d3f88f446f32eb Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 10 Apr 2019 13:35:24 -0400 Subject: [PATCH 0767/1117] Roll src/third_party/skia 10bf7020aa15..b5c685991faa (3 commits) (#8526) https://skia.googlesource.com/skia.git/%2Blog/10bf7020aa15..b5c685991faa git log 10bf7020aa154dfbd024df40a33c8f39e5264a47..b5c685991faa79d6ac5caeacd48644eca4954426 --date=short --no-merges --format=%ad %ae %s 2019-04-09 reed@google.com remove shader factory guard define 2019-04-10 egdaniel@google.com Revert "Add non-AA support to OvalFactoryOps." 2019-04-09 kjlubick@google.com Move common canvas/pathkit dockerfiles to more intuitive location The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/DEPS b/DEPS index 9b976d2724db7..4249fdbe195a0 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': '10bf7020aa154dfbd024df40a33c8f39e5264a47', + 'skia_revision': 'b5c685991faa79d6ac5caeacd48644eca4954426', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index f581d1ad52cb9..d5f288b427a86 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b1495b48df1e7beb67be8faa3550c3b1 +Signature: 5eb2f5708f3faf3dd3d52c3bf7025f17 UNUSED LICENSES: @@ -2336,14 +2336,14 @@ FILE: ../../../third_party/skia/infra/cross-compile/docker/cross-linux-arm64/Doc FILE: ../../../third_party/skia/infra/cts/whitelist_devices.json FILE: ../../../third_party/skia/infra/lottiecap/docker/gold-lottie-web-puppeteer/Dockerfile FILE: ../../../third_party/skia/infra/lottiecap/docker/lottie-web-puppeteer/Dockerfile -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/infra/wasm-common/docker/emsdk-base/Dockerfile +FILE: ../../../third_party/skia/infra/wasm-common/docker/gold-karma-chrome-tests/Dockerfile +FILE: ../../../third_party/skia/infra/wasm-common/docker/karma-chrome-tests/Dockerfile +FILE: ../../../third_party/skia/infra/wasm-common/docker/perf-karma-chrome-tests/Dockerfile FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/NotoSerif-Regular.ttf FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/Roboto-Regular.ttf FILE: ../../../third_party/skia/modules/canvaskit/canvaskit/Roboto-Regular.woff @@ -6587,8 +6587,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/wasm_gold_aggregator.go -FILE: ../../../third_party/skia/infra/pathkit/perf/wasm_perf_aggregator.go +FILE: ../../../third_party/skia/infra/wasm-common/gold/wasm_gold_aggregator.go +FILE: ../../../third_party/skia/infra/wasm-common/perf/wasm_perf_aggregator.go ---------------------------------------------------------------------------------------------------- Copyright 2018 The Chromium Authors. All rights reserved. From 0b36d3e2f0235f25dc5b5657bd2e594fe7414aee Mon Sep 17 00:00:00 2001 From: Hans Muller Date: Wed, 10 Apr 2019 10:39:29 -0700 Subject: [PATCH 0768/1117] Change Rect internal representation from Float32List to Float64List (#8524) --- lib/ui/compositing.dart | 2 +- lib/ui/geometry.dart | 8 ++++++-- lib/ui/painting.dart | 12 ++++++------ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/ui/compositing.dart b/lib/ui/compositing.dart index 8b3f98c821106..06906ed50b972 100644 --- a/lib/ui/compositing.dart +++ b/lib/ui/compositing.dart @@ -98,7 +98,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 { EngineLayer pushClipRRect(RRect rrect, {Clip clipBehavior = Clip.antiAlias}) { assert(clipBehavior != null); assert(clipBehavior != Clip.none); - return _pushClipRRect(rrect._value, clipBehavior.index); + return _pushClipRRect(rrect._value32, clipBehavior.index); } EngineLayer _pushClipRRect(Float32List rrect, int clipBehavior) native 'SceneBuilder_pushClipRRect'; diff --git a/lib/ui/geometry.dart b/lib/ui/geometry.dart index 2e8a79980c2dc..f326c1ecbdc74 100644 --- a/lib/ui/geometry.dart +++ b/lib/ui/geometry.dart @@ -666,7 +666,9 @@ class Rect { } static const int _kDataSize = 4; - final Float32List _value = new Float32List(_kDataSize); + final Float64List _value = new Float64List(_kDataSize); + + Float32List get _value32 => Float32List.fromList(_value); /// The offset of the left edge of this rectangle from the x axis. double get left => _value[0]; @@ -1157,9 +1159,11 @@ class RRect { } static const int _kDataSize = 12; - final Float32List _value = new Float32List(_kDataSize); + final Float64List _value = new Float64List(_kDataSize); RRect _scaled; // same RRect with scaled radii per side + Float32List get _value32 => Float32List.fromList(_value); + /// The offset of the left edge of this rectangle from the x axis. double get left => _value[0]; diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index 6703dfd01083e..79adb4f818d46 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -2028,7 +2028,7 @@ class Path extends NativeFieldWrapperClass2 { /// argument. void addRRect(RRect rrect) { assert(_rrectIsValid(rrect)); - _addRRect(rrect._value); + _addRRect(rrect._value32); } void _addRRect(Float32List rrect) native 'Path_addRRect'; @@ -3259,7 +3259,7 @@ class Canvas extends NativeFieldWrapperClass2 { void clipRRect(RRect rrect, {bool doAntiAlias = true}) { assert(_rrectIsValid(rrect)); assert(doAntiAlias != null); - _clipRRect(rrect._value, doAntiAlias); + _clipRRect(rrect._value32, doAntiAlias); } void _clipRRect(Float32List rrect, bool doAntiAlias) native 'Canvas_clipRRect'; @@ -3336,7 +3336,7 @@ class Canvas extends NativeFieldWrapperClass2 { void drawRRect(RRect rrect, Paint paint) { assert(_rrectIsValid(rrect)); assert(paint != null); - _drawRRect(rrect._value, paint._objects, paint._data); + _drawRRect(rrect._value32, paint._objects, paint._data); } void _drawRRect(Float32List rrect, List paintObjects, @@ -3351,7 +3351,7 @@ class Canvas extends NativeFieldWrapperClass2 { assert(_rrectIsValid(outer)); assert(_rrectIsValid(inner)); assert(paint != null); - _drawDRRect(outer._value, inner._value, paint._objects, paint._data); + _drawDRRect(outer._value32, inner._value32, paint._objects, paint._data); } void _drawDRRect(Float32List outer, Float32List inner, @@ -3651,7 +3651,7 @@ class Canvas extends NativeFieldWrapperClass2 { } final Int32List colorBuffer = colors.isEmpty ? null : _encodeColorList(colors); - final Float32List cullRectBuffer = cullRect?._value; + final Float32List cullRectBuffer = cullRect?._value32; _drawAtlas( paint._objects, paint._data, atlas, rstTransformBuffer, rectBuffer, @@ -3698,7 +3698,7 @@ class Canvas extends NativeFieldWrapperClass2 { _drawAtlas( paint._objects, paint._data, atlas, rstTransforms, rects, - colors, blendMode.index, cullRect?._value + colors, blendMode.index, cullRect?._value32 ); } From 36d2135ad03bbc5b5cf49ed542f9ba1032a6cf5d Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 10 Apr 2019 13:00:05 -0700 Subject: [PATCH 0769/1117] Redo a fix for cull rect calculation on TransformLayers with a perspective transform (#8528) This was originally implemented in https://github.com/flutter/engine/commit/d217a951262df45a9e874403267b9d4bb0d9016c but was not retained when cull rects were removed from the SceneBuilder. Fixes https://github.com/flutter/flutter/issues/30819 --- flow/layers/transform_layer.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flow/layers/transform_layer.cc b/flow/layers/transform_layer.cc index 8abb550b95935..b3b259db9e652 100644 --- a/flow/layers/transform_layer.cc +++ b/flow/layers/transform_layer.cc @@ -16,7 +16,9 @@ void TransformLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { SkRect previous_cull_rect = context->cull_rect; SkMatrix inverse_transform_; - if (transform_.invert(&inverse_transform_)) { + // Perspective projections don't produce rectangles that are useful for + // culling for some reason. + if (!transform_.hasPerspective() && transform_.invert(&inverse_transform_)) { inverse_transform_.mapRect(&context->cull_rect); } else { context->cull_rect = kGiantRect; From 0a2869e5c3dc9b46f1aec27aa2393db079f0bfde Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 10 Apr 2019 14:38:58 -0700 Subject: [PATCH 0770/1117] Added support for authentication codes for the VM service (#8527) --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- common/settings.h | 4 ++++ runtime/dart_isolate.cc | 3 ++- runtime/dart_service_isolate.cc | 5 +++++ runtime/dart_service_isolate.h | 1 + runtime/dart_vm.cc | 9 +++++++++ shell/common/switches.cc | 7 +++++++ shell/common/switches.h | 6 ++++++ .../android/io/flutter/app/FlutterActivityDelegate.java | 3 +++ .../io/flutter/embedding/engine/FlutterShellArgs.java | 9 ++++++++- 11 files changed, 47 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index 4249fdbe195a0..9d5772ace6266 100644 --- a/DEPS +++ b/DEPS @@ -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': '1490a90bc1c4cbbf13470af3408584e57d135fb2', + 'dart_revision': '15b11b018364ce032eae50d78fc8a52b541e2bce', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 05eaa5a85773c..ea4c2e9ba7287 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 1ab2f2e559e655ad5cfe1e759d241b54 +Signature: 866085660a05bb407caffc09636cbd32 UNUSED LICENSES: diff --git a/common/settings.h b/common/settings.h index ab47a559ffe8e..96a1f8f92c122 100644 --- a/common/settings.h +++ b/common/settings.h @@ -86,6 +86,10 @@ struct Settings { uint32_t observatory_port = 0; bool ipv6 = false; + // Determines whether an authentication code is required to communicate with + // the VM service. + bool disable_service_auth_codes = true; + // Font settings bool use_test_fonts = false; diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index adf5655272167..3c888887d9847 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -579,7 +579,8 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( settings.observatory_port, // server observatory port tonic::DartState::HandleLibraryTag, // embedder library tag handler false, // disable websocket origin check - error // error (out) + settings.disable_service_auth_codes, // disable VM service auth codes + error // error (out) )) { // Error is populated by call to startup. FML_DLOG(ERROR) << *error; diff --git a/runtime/dart_service_isolate.cc b/runtime/dart_service_isolate.cc index 530af43d147d2..966a31bea8edd 100644 --- a/runtime/dart_service_isolate.cc +++ b/runtime/dart_service_isolate.cc @@ -134,6 +134,7 @@ bool DartServiceIsolate::Startup(std::string server_ip, intptr_t server_port, Dart_LibraryTagHandler embedder_tag_handler, bool disable_origin_check, + bool disable_service_auth_codes, char** error) { Dart_Isolate isolate = Dart_CurrentIsolate(); FML_CHECK(isolate); @@ -196,6 +197,10 @@ bool DartServiceIsolate::Startup(std::string server_ip, Dart_SetField(library, Dart_NewStringFromCString("_originCheckDisabled"), Dart_NewBoolean(disable_origin_check)); SHUTDOWN_ON_ERROR(result); + result = + Dart_SetField(library, Dart_NewStringFromCString("_authCodesDisabled"), + Dart_NewBoolean(disable_service_auth_codes)); + SHUTDOWN_ON_ERROR(result); return true; } diff --git a/runtime/dart_service_isolate.h b/runtime/dart_service_isolate.h index 4b98e83607c56..c042a07715e58 100644 --- a/runtime/dart_service_isolate.h +++ b/runtime/dart_service_isolate.h @@ -26,6 +26,7 @@ class DartServiceIsolate { intptr_t server_port, Dart_LibraryTagHandler embedder_tag_handler, bool disable_origin_check, + bool disable_service_auth_codes, char** error); static std::string GetObservatoryUri(); diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 1abf8171c58b9..476d05f2fc651 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -84,6 +84,10 @@ static const char* kDartStartPausedArgs[]{ "--pause_isolates_on_start", }; +static const char* kDartDisableServiceAuthCodesArgs[]{ + "--disable-service-auth-codes", +}; + static const char* kDartTraceStartupArgs[]{ "--timeline_streams=Compiler,Dart,Debugger,Embedder,GC,Isolate,VM", }; @@ -325,6 +329,11 @@ DartVM::DartVM(std::shared_ptr vm_data, PushBackAll(&args, kDartStartPausedArgs, arraysize(kDartStartPausedArgs)); } + if (settings_.disable_service_auth_codes) { + PushBackAll(&args, kDartDisableServiceAuthCodesArgs, + arraysize(kDartDisableServiceAuthCodesArgs)); + } + if (settings_.endless_trace_buffer || settings_.trace_startup) { // If we are tracing startup, make sure the trace buffer is endless so we // don't lose early traces. diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 916f91e48e905..366923614b3bc 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -166,6 +166,13 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { } } + // Enable need for authentication codes for VM service communication, if + // specified. + // TODO(bkonyi): when authentication codes are enabled by default, change + // to 'DisableServiceAuthCodes' and un-negate. + settings.disable_service_auth_codes = + !command_line.HasOption(FlagForSwitch(Switch::EnableServiceAuthCodes)); + // Checked mode overrides. settings.disable_dart_asserts = command_line.HasOption(FlagForSwitch(Switch::DisableDartAsserts)); diff --git a/shell/common/switches.h b/shell/common/switches.h index ac9b5e829ef70..b0ff32d9b45c1 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -96,6 +96,12 @@ DEF_SWITCH(FlutterAssetsDir, "Path to the Flutter assets directory.") DEF_SWITCH(Help, "help", "Display this help text.") DEF_SWITCH(LogTag, "log-tag", "Tag associated with log messages.") +// TODO(bkonyi): when authentication codes are enabled by default, change +// to 'disable-service-auth-codes' instead of 'enable-service-auth-codes'. +DEF_SWITCH(EnableServiceAuthCodes, + "enable-service-auth-codes", + "Enable the requirement for authentication codes for communicating" + " with the VM service.") DEF_SWITCH(StartPaused, "start-paused", "Start the application paused in the Dart debugger.") diff --git a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java index c56908db643b3..467bfdbce240b 100644 --- a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java +++ b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java @@ -297,6 +297,9 @@ private static String[] getArgsFromIntent(Intent intent) { if (intent.getBooleanExtra("start-paused", false)) { args.add("--start-paused"); } + if (intent.getBooleanExtra("enable-service-auth-codes", false)) { + args.add("--enable-service-auth-codes"); + } if (intent.getBooleanExtra("use-test-fonts", false)) { args.add("--use-test-fonts"); } diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java b/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java index 6e5ec8c7ba7bc..8a65a1430bb05 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java @@ -27,6 +27,8 @@ public class FlutterShellArgs { public static final String ARG_TRACE_STARTUP = "--trace-startup"; public static final String ARG_KEY_START_PAUSED = "start-paused"; public static final String ARG_START_PAUSED = "--start-paused"; + public static final String ARG_KEY_ENABLE_SERVICE_AUTH_CODES = "enable-service-auth-codes"; + public static final String ARG_ENABLE_SERVICE_AUTH_CODES = "--enable-service-auth-codes"; public static final String ARG_KEY_USE_TEST_FONTS = "use-test-fonts"; public static final String ARG_USE_TEST_FONTS = "--use-test-fonts"; public static final String ARG_KEY_ENABLE_DART_PROFILING = "enable-dart-profiling"; @@ -56,6 +58,11 @@ public static FlutterShellArgs fromIntent(@NonNull Intent intent) { if (intent.getBooleanExtra(ARG_KEY_START_PAUSED, false)) { args.add(ARG_START_PAUSED); } + // TODO(bkonyi): when authentication codes are enabled by default, change + // to 'disable-service-auth-codes' instead of 'enable-service-auth-codes'. + if (intent.getBooleanExtra(ARG_KEY_ENABLE_SERVICE_AUTH_CODES, false)) { + args.add(ARG_ENABLE_SERVICE_AUTH_CODES); + } if (intent.getBooleanExtra(ARG_KEY_USE_TEST_FONTS, false)) { args.add(ARG_USE_TEST_FONTS); } @@ -133,4 +140,4 @@ public String[] toArray() { String[] argsArray = new String[args.size()]; return args.toArray(argsArray); } -} \ No newline at end of file +} From 29aa5fca0f25e5b7649b458d9a7642239fa84a1d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 10 Apr 2019 17:42:24 -0400 Subject: [PATCH 0771/1117] Roll src/third_party/skia b5c685991faa..42280f8961fa (32 commits) (#8535) https://skia.googlesource.com/skia.git/%2Blog/b5c685991faa..42280f8961fa git log b5c685991faa79d6ac5caeacd48644eca4954426..42280f8961fa90f5829b561f7925be3354e5991e --date=short --no-merges --format=%ad %ae %s 2019-04-10 brianosman@google.com Add Shared library Windows builds 2019-04-10 brianosman@google.com Even more DLL build fixes 2019-04-10 reed@google.com remove SkMixer, since we have explicit lerps/blends in SkShader 2019-04-10 egdaniel@google.com Reland "Remove unnecessary flush in RenderYUVAToRGBA (take 2)" 2019-04-10 fmalita@chromium.org [skottie] Initial "Levels" effect support 2019-04-10 fmalita@chromium.org Reland "[skottie] More snug kTop Shaper alignment" 2019-04-10 jvanverth@google.com Add mipmap generation for Metal 2019-04-10 halcanary@google.com SkPDF: narrow layer bbox 2019-04-10 egdaniel@google.com Revert "Remove unnecessary flush in RenderYUVAToRGBA (take 2)" 2019-04-10 mtklein@google.com make to_vec template parameters explicit 2019-04-10 mtklein@google.com tweak SkVx to play nicely with others 2019-04-08 herb@google.com Add an index to SkGlyphPos 2019-04-10 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-04-10 brianosman@google.com Make SkShaper's GN setup more DLL friendly 2019-04-10 brianosman@google.com Make Skottie's GN setup more DLL friendly 2019-04-10 ethannicholas@google.com moved files generated from .fp files into generated/ directories 2019-04-08 herb@google.com Reland "Do not use sub-pixel positioning for source space" 2019-04-10 robertphillips@google.com Remove unnecessary flush in RenderYUVAToRGBA (take 2) 2019-04-10 brianosman@google.com Delete SkSL::Compiler copy constructor and assignment operator 2019-04-10 bungeman@google.com Make path in Sk1DPathEffect thread safe. 2019-04-10 halcanary@google.com SkPDF: split GraphicStateStack out 2019-04-10 halcanary@google.com SkPDF: simplify device drawRect 2019-04-10 ethannicholas@google.com regenerated FP files to make bot happy 2019-04-09 bsalomon@google.com Add Vulkan implementation of transfering from GrSurface to a GrGpuBuffer 2019-04-10 brianosman@google.com Define all ImageSetEntry members out of line 2019-04-09 robertphillips@google.com Skip flush in GrDrawingManager if the specifed proxy doesn't have any work (take 2) 2019-04-09 rmistry@google.com [Android compile bot] Also build frameworks/base/libs/hwui 2019-04-09 nifong@google.com externs needed for cpu/gpu switch 2019-04-10 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-04-10 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 82418c821689..f39b4f0280ef (12 commits) 2019-04-10 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader eba396cc66d3..f0aa9d5ab738 (14 commits) 2019-04-10 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 79154509c679..1b121674f584 (400 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 288 +++++++++++++++---------------- 2 files changed, 143 insertions(+), 147 deletions(-) diff --git a/DEPS b/DEPS index 9d5772ace6266..44e48a3b45a55 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': 'b5c685991faa79d6ac5caeacd48644eca4954426', + 'skia_revision': '42280f8961fa90f5829b561f7925be3354e5991e', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index d5f288b427a86..ba39c493a9171 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 5eb2f5708f3faf3dd3d52c3bf7025f17 +Signature: 33cde79edb8f35f77d8b871b39c8ca91 UNUSED LICENSES: @@ -1739,74 +1739,74 @@ FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCStrokeGeometry.cpp FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCStrokeGeometry.h FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCStroker.cpp FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCStroker.h -FILE: ../../../third_party/skia/src/gpu/effects/GrAARectEffect.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrAARectEffect.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrAARectEffect.h -FILE: ../../../third_party/skia/src/gpu/effects/GrAlphaThresholdFragmentProcessor.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrAlphaThresholdFragmentProcessor.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrAlphaThresholdFragmentProcessor.h -FILE: ../../../third_party/skia/src/gpu/effects/GrCircleBlurFragmentProcessor.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrCircleBlurFragmentProcessor.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrCircleBlurFragmentProcessor.h -FILE: ../../../third_party/skia/src/gpu/effects/GrConfigConversionEffect.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrConfigConversionEffect.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrConfigConversionEffect.h -FILE: ../../../third_party/skia/src/gpu/effects/GrConstColorProcessor.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrConstColorProcessor.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrConstColorProcessor.h -FILE: ../../../third_party/skia/src/gpu/effects/GrLumaColorFilterEffect.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrLumaColorFilterEffect.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrLumaColorFilterEffect.h -FILE: ../../../third_party/skia/src/gpu/effects/GrMagnifierEffect.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrMagnifierEffect.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrMagnifierEffect.h -FILE: ../../../third_party/skia/src/gpu/effects/GrPremulInputFragmentProcessor.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrPremulInputFragmentProcessor.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrPremulInputFragmentProcessor.h -FILE: ../../../third_party/skia/src/gpu/effects/GrRRectBlurEffect.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrRRectBlurEffect.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrRRectBlurEffect.h -FILE: ../../../third_party/skia/src/gpu/effects/GrRectBlurEffect.cpp 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/GrYUVtoRGBEffect.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrYUVtoRGBEffect.h -FILE: ../../../third_party/skia/src/gpu/gradients/GrClampedGradientEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrAARectEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrAARectEffect.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrAlphaThresholdFragmentProcessor.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrAlphaThresholdFragmentProcessor.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrConfigConversionEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrConfigConversionEffect.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrConstColorProcessor.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrConstColorProcessor.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrLumaColorFilterEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrLumaColorFilterEffect.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrMagnifierEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrMagnifierEffect.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrPremulInputFragmentProcessor.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrPremulInputFragmentProcessor.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrRRectBlurEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrRRectBlurEffect.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrRectBlurEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrRectBlurEffect.h FILE: ../../../third_party/skia/src/gpu/gradients/GrClampedGradientEffect.fp -FILE: ../../../third_party/skia/src/gpu/gradients/GrClampedGradientEffect.h -FILE: ../../../third_party/skia/src/gpu/gradients/GrDualIntervalGradientColorizer.cpp FILE: ../../../third_party/skia/src/gpu/gradients/GrDualIntervalGradientColorizer.fp -FILE: ../../../third_party/skia/src/gpu/gradients/GrDualIntervalGradientColorizer.h FILE: ../../../third_party/skia/src/gpu/gradients/GrGradientBitmapCache.cpp FILE: ../../../third_party/skia/src/gpu/gradients/GrGradientBitmapCache.h FILE: ../../../third_party/skia/src/gpu/gradients/GrGradientShader.cpp FILE: ../../../third_party/skia/src/gpu/gradients/GrGradientShader.h -FILE: ../../../third_party/skia/src/gpu/gradients/GrLinearGradientLayout.cpp FILE: ../../../third_party/skia/src/gpu/gradients/GrLinearGradientLayout.fp -FILE: ../../../third_party/skia/src/gpu/gradients/GrLinearGradientLayout.h -FILE: ../../../third_party/skia/src/gpu/gradients/GrRadialGradientLayout.cpp FILE: ../../../third_party/skia/src/gpu/gradients/GrRadialGradientLayout.fp -FILE: ../../../third_party/skia/src/gpu/gradients/GrRadialGradientLayout.h -FILE: ../../../third_party/skia/src/gpu/gradients/GrSingleIntervalGradientColorizer.cpp FILE: ../../../third_party/skia/src/gpu/gradients/GrSingleIntervalGradientColorizer.fp -FILE: ../../../third_party/skia/src/gpu/gradients/GrSingleIntervalGradientColorizer.h -FILE: ../../../third_party/skia/src/gpu/gradients/GrSweepGradientLayout.cpp FILE: ../../../third_party/skia/src/gpu/gradients/GrSweepGradientLayout.fp -FILE: ../../../third_party/skia/src/gpu/gradients/GrSweepGradientLayout.h -FILE: ../../../third_party/skia/src/gpu/gradients/GrTextureGradientColorizer.cpp FILE: ../../../third_party/skia/src/gpu/gradients/GrTextureGradientColorizer.fp -FILE: ../../../third_party/skia/src/gpu/gradients/GrTextureGradientColorizer.h -FILE: ../../../third_party/skia/src/gpu/gradients/GrTiledGradientEffect.cpp FILE: ../../../third_party/skia/src/gpu/gradients/GrTiledGradientEffect.fp -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/gradients/generated/GrClampedGradientEffect.cpp +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrClampedGradientEffect.h +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrDualIntervalGradientColorizer.cpp +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrDualIntervalGradientColorizer.h +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrLinearGradientLayout.cpp +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrLinearGradientLayout.h +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrRadialGradientLayout.cpp +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrRadialGradientLayout.h +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrSingleIntervalGradientColorizer.cpp +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrSingleIntervalGradientColorizer.h +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrSweepGradientLayout.cpp +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrSweepGradientLayout.h +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrTextureGradientColorizer.cpp +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrTextureGradientColorizer.h +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrTiledGradientEffect.cpp +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrTiledGradientEffect.h +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrTwoPointConicalGradientLayout.cpp +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrTwoPointConicalGradientLayout.h +FILE: ../../../third_party/skia/src/gpu/gradients/generated/GrUnrolledBinaryGradientColorizer.cpp +FILE: ../../../third_party/skia/src/gpu/gradients/generated/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 @@ -4416,18 +4416,20 @@ FILE: ../../../third_party/skia/src/gpu/ccpr/GrCoverageCountingPathRenderer.h FILE: ../../../third_party/skia/src/gpu/ccpr/GrGSCoverageProcessor.cpp FILE: ../../../third_party/skia/src/gpu/ccpr/GrVSCoverageProcessor.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrAtlasedShaderHelpers.h -FILE: ../../../third_party/skia/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrBlurredEdgeFragmentProcessor.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrBlurredEdgeFragmentProcessor.h FILE: ../../../third_party/skia/src/gpu/effects/GrCircleEffect.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrCircleEffect.fp FILE: ../../../third_party/skia/src/gpu/effects/GrCircleEffect.h -FILE: ../../../third_party/skia/src/gpu/effects/GrEllipseEffect.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrEllipseEffect.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrEllipseEffect.h -FILE: ../../../third_party/skia/src/gpu/effects/GrSimpleTextureEffect.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrSimpleTextureEffect.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrSimpleTextureEffect.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrCircleEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrCircleEffect.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrEllipseEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrEllipseEffect.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrSimpleTextureEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrSimpleTextureEffect.h FILE: ../../../third_party/skia/src/gpu/gl/GrGLGpuCommandBuffer.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLSemaphore.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLSemaphore.h @@ -4549,101 +4551,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/bench/MixerBench.cpp + ../../../third_party/skia/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../third_party/skia/bench/MixerBench.cpp -FILE: ../../../third_party/skia/gm/backdrop.cpp -FILE: ../../../third_party/skia/gm/compositor_quads.cpp -FILE: ../../../third_party/skia/gm/crbug_938592.cpp -FILE: ../../../third_party/skia/gm/crbug_947055.cpp -FILE: ../../../third_party/skia/gm/mac_aa_explorer.cpp -FILE: ../../../third_party/skia/gm/mixercolorfilter.cpp -FILE: ../../../third_party/skia/gm/overdrawcanvas.cpp -FILE: ../../../third_party/skia/gm/samplelocations.cpp -FILE: ../../../third_party/skia/gm/skbug_8664.cpp -FILE: ../../../third_party/skia/gm/skbug_8955.cpp -FILE: ../../../third_party/skia/include/core/SkMixer.h -FILE: ../../../third_party/skia/include/core/SkTileMode.h -FILE: ../../../third_party/skia/include/gpu/GrContextThreadSafeProxy.h -FILE: ../../../third_party/skia/include/private/GrContext_Base.h -FILE: ../../../third_party/skia/include/private/GrImageContext.h -FILE: ../../../third_party/skia/include/private/GrRecordingContext.h -FILE: ../../../third_party/skia/include/private/SkVx.h -FILE: ../../../third_party/skia/modules/skottie/src/SkottieShaper.cpp -FILE: ../../../third_party/skia/modules/skottie/src/SkottieShaper.h -FILE: ../../../third_party/skia/modules/sksg/include/SkSGRenderEffect.h -FILE: ../../../third_party/skia/modules/sksg/src/SkSGRenderEffect.cpp -FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h -FILE: ../../../third_party/skia/samplecode/SampleDegenerateQuads.cpp -FILE: ../../../third_party/skia/samplecode/SampleSG.cpp -FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp -FILE: ../../../third_party/skia/src/codec/SkScalingCodec.h -FILE: ../../../third_party/skia/src/core/SkColorFilter_Mixer.cpp -FILE: ../../../third_party/skia/src/core/SkColorFilter_Mixer.h -FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp -FILE: ../../../third_party/skia/src/core/SkEffectPriv.h -FILE: ../../../third_party/skia/src/core/SkMixer.cpp -FILE: ../../../third_party/skia/src/core/SkMixerBase.h -FILE: ../../../third_party/skia/src/core/SkStrikeInterface.h -FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.cpp -FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.h -FILE: ../../../third_party/skia/src/gpu/GrBaseContextPriv.h -FILE: ../../../third_party/skia/src/gpu/GrBuffer.h -FILE: ../../../third_party/skia/src/gpu/GrContextPriv.cpp -FILE: ../../../third_party/skia/src/gpu/GrContextThreadSafeProxy.cpp -FILE: ../../../third_party/skia/src/gpu/GrContext_Base.cpp -FILE: ../../../third_party/skia/src/gpu/GrCpuBuffer.h -FILE: ../../../third_party/skia/src/gpu/GrGpuBuffer.cpp -FILE: ../../../third_party/skia/src/gpu/GrGpuBuffer.h -FILE: ../../../third_party/skia/src/gpu/GrImageContext.cpp -FILE: ../../../third_party/skia/src/gpu/GrImageContextPriv.h -FILE: ../../../third_party/skia/src/gpu/GrRecordingContext.cpp -FILE: ../../../third_party/skia/src/gpu/GrRecordingContextPriv.h -FILE: ../../../third_party/skia/src/gpu/GrSamplePatternDictionary.cpp -FILE: ../../../third_party/skia/src/gpu/GrSamplePatternDictionary.h -FILE: ../../../third_party/skia/src/gpu/ccpr/GrGSCoverageProcessor.h -FILE: ../../../third_party/skia/src/gpu/ccpr/GrVSCoverageProcessor.h -FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.cpp -FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.h -FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp -FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.h -FILE: ../../../third_party/skia/src/shaders/SkMixerShader.cpp -FILE: ../../../third_party/skia/src/shaders/SkMixerShader.h -FILE: ../../../third_party/skia/src/sksl/SkSLDefines.h -FILE: ../../../third_party/skia/src/sksl/SkSLOutputStream.cpp ----------------------------------------------------------------------------------------------------- -Copyright 2019 Google Inc. - -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/bench/ReadPixBench.cpp + ../../../third_party/skia/LICENSE @@ -5786,12 +5693,14 @@ FILE: ../../../third_party/skia/docs/examples/Typeface_Methods.cpp FILE: ../../../third_party/skia/docs/examples/Xor.cpp FILE: ../../../third_party/skia/gm/crbug_918512.cpp FILE: ../../../third_party/skia/src/gpu/GrPersistentCacheUtils.h -FILE: ../../../third_party/skia/src/gpu/effects/GrComposeLerpEffect.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrComposeLerpEffect.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrComposeLerpEffect.h -FILE: ../../../third_party/skia/src/gpu/effects/GrComposeLerpRedEffect.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrComposeLerpRedEffect.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrComposeLerpRedEffect.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrComposeLerpEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrComposeLerpEffect.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrComposeLerpRedEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrComposeLerpRedEffect.h +FILE: ../../../third_party/skia/src/pdf/SkPDFGraphicStackState.cpp +FILE: ../../../third_party/skia/src/pdf/SkPDFGraphicStackState.h ---------------------------------------------------------------------------------------------------- Copyright 2019 Google LLC. @@ -6050,6 +5959,93 @@ 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/gm/backdrop.cpp + ../../../third_party/skia/LICENSE +TYPE: LicenseType.bsd +FILE: ../../../third_party/skia/gm/backdrop.cpp +FILE: ../../../third_party/skia/gm/compositor_quads.cpp +FILE: ../../../third_party/skia/gm/crbug_938592.cpp +FILE: ../../../third_party/skia/gm/crbug_947055.cpp +FILE: ../../../third_party/skia/gm/mac_aa_explorer.cpp +FILE: ../../../third_party/skia/gm/mixercolorfilter.cpp +FILE: ../../../third_party/skia/gm/overdrawcanvas.cpp +FILE: ../../../third_party/skia/gm/samplelocations.cpp +FILE: ../../../third_party/skia/gm/skbug_8664.cpp +FILE: ../../../third_party/skia/gm/skbug_8955.cpp +FILE: ../../../third_party/skia/include/core/SkTileMode.h +FILE: ../../../third_party/skia/include/gpu/GrContextThreadSafeProxy.h +FILE: ../../../third_party/skia/include/private/GrContext_Base.h +FILE: ../../../third_party/skia/include/private/GrImageContext.h +FILE: ../../../third_party/skia/include/private/GrRecordingContext.h +FILE: ../../../third_party/skia/include/private/SkVx.h +FILE: ../../../third_party/skia/modules/skottie/src/SkottieShaper.cpp +FILE: ../../../third_party/skia/modules/skottie/src/SkottieShaper.h +FILE: ../../../third_party/skia/modules/sksg/include/SkSGRenderEffect.h +FILE: ../../../third_party/skia/modules/sksg/src/SkSGRenderEffect.cpp +FILE: ../../../third_party/skia/modules/sksg/src/SkSGTransformPriv.h +FILE: ../../../third_party/skia/samplecode/SampleDegenerateQuads.cpp +FILE: ../../../third_party/skia/samplecode/SampleSG.cpp +FILE: ../../../third_party/skia/samplecode/SampleThinAA.cpp +FILE: ../../../third_party/skia/src/codec/SkScalingCodec.h +FILE: ../../../third_party/skia/src/core/SkDescriptor.cpp +FILE: ../../../third_party/skia/src/core/SkEffectPriv.h +FILE: ../../../third_party/skia/src/core/SkStrikeInterface.h +FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.cpp +FILE: ../../../third_party/skia/src/gpu/GrAHardwareBufferUtils.h +FILE: ../../../third_party/skia/src/gpu/GrBaseContextPriv.h +FILE: ../../../third_party/skia/src/gpu/GrBuffer.h +FILE: ../../../third_party/skia/src/gpu/GrContextPriv.cpp +FILE: ../../../third_party/skia/src/gpu/GrContextThreadSafeProxy.cpp +FILE: ../../../third_party/skia/src/gpu/GrContext_Base.cpp +FILE: ../../../third_party/skia/src/gpu/GrCpuBuffer.h +FILE: ../../../third_party/skia/src/gpu/GrGpuBuffer.cpp +FILE: ../../../third_party/skia/src/gpu/GrGpuBuffer.h +FILE: ../../../third_party/skia/src/gpu/GrImageContext.cpp +FILE: ../../../third_party/skia/src/gpu/GrImageContextPriv.h +FILE: ../../../third_party/skia/src/gpu/GrRecordingContext.cpp +FILE: ../../../third_party/skia/src/gpu/GrRecordingContextPriv.h +FILE: ../../../third_party/skia/src/gpu/GrSamplePatternDictionary.cpp +FILE: ../../../third_party/skia/src/gpu/GrSamplePatternDictionary.h +FILE: ../../../third_party/skia/src/gpu/ccpr/GrGSCoverageProcessor.h +FILE: ../../../third_party/skia/src/gpu/ccpr/GrVSCoverageProcessor.h +FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.fp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrMixerEffect.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrMixerEffect.h +FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp +FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.h +FILE: ../../../third_party/skia/src/sksl/SkSLDefines.h +FILE: ../../../third_party/skia/src/sksl/SkSLOutputStream.cpp +---------------------------------------------------------------------------------------------------- +Copyright 2019 Google Inc. + +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/gm/circles.cpp + ../../../third_party/skia/LICENSE From c10ae2be26b193a23b2d67a9a742e40d13165ab1 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 10 Apr 2019 15:18:34 -0700 Subject: [PATCH 0772/1117] Add an option to build the GLFW shell on macOS (#8531) Since the GLFW shell is likely to continue to exist in at least the medium term, it is useful for maintenance to be able to build and use it on any desktop platform. Includes a buildroot roll to pick up the macOS build suppport for third_party/glfw. --- DEPS | 2 +- shell/platform/darwin/BUILD.gn | 2 +- shell/platform/darwin/macos/BUILD.gn | 25 +++++++++++++++++++++++++ shell/platform/glfw/config.gni | 13 +++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 shell/platform/glfw/config.gni diff --git a/DEPS b/DEPS index 44e48a3b45a55..738b8ba79607a 100644 --- a/DEPS +++ b/DEPS @@ -120,7 +120,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '5311c632822d0d2d4e4cf8cba3053cde5183c89c', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '94695026d9a1d8963089a470eef26470312c5b00', # Fuchsia compatibility # diff --git a/shell/platform/darwin/BUILD.gn b/shell/platform/darwin/BUILD.gn index 672ea4537eda3..71cccb6932005 100644 --- a/shell/platform/darwin/BUILD.gn +++ b/shell/platform/darwin/BUILD.gn @@ -14,7 +14,7 @@ group("darwin") { } if (is_mac) { deps = [ - "macos:flutter_framework", + "macos", ] } } diff --git a/shell/platform/darwin/macos/BUILD.gn b/shell/platform/darwin/macos/BUILD.gn index 87c055bbdae7e..5a9547639e838 100644 --- a/shell/platform/darwin/macos/BUILD.gn +++ b/shell/platform/darwin/macos/BUILD.gn @@ -7,6 +7,21 @@ assert(is_mac) import("//build/config/mac/mac_sdk.gni") import("$flutter_root/common/config.gni") import("$flutter_root/shell/platform/darwin/framework_shared.gni") +import("$flutter_root/shell/platform/glfw/config.gni") + +group("macos") { + deps = [ + ":flutter_framework", + ] + if (build_glfw_shell) { + deps += [ + ":flutter_macos_glfw", + "$flutter_root/shell/platform/common/cpp/client_wrapper:publish_wrapper", + "$flutter_root/shell/platform/glfw:publish_headers_glfw", + "$flutter_root/shell/platform/glfw/client_wrapper:publish_wrapper_glfw", + ] + } +} _flutter_framework_name = "FlutterMacOS" _flutter_framework_filename = "$_flutter_framework_name.framework" @@ -194,3 +209,13 @@ group("flutter_framework") { ":_generate_symlinks", ] } + +if (build_glfw_shell) { + shared_library("flutter_macos_glfw") { + deps = [ + "$flutter_root/shell/platform/glfw:flutter_glfw", + ] + + public_configs = [ "$flutter_root:config" ] + } +} diff --git a/shell/platform/glfw/config.gni b/shell/platform/glfw/config.gni new file mode 100644 index 0000000000000..8ac933d8dc1e3 --- /dev/null +++ b/shell/platform/glfw/config.gni @@ -0,0 +1,13 @@ +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +declare_args() { + # Whether to build the GLFW shell for the host platform, if available. + # + # By default, the GLFW shell is not built if there is a native toolkit shell, + # but it can be enabled for supported platforms (Windows, macOS, and Linux) + # as an extra build artifact with this flag. The native toolkit shell will + # still be built as well. + build_glfw_shell = is_linux || is_win +} From 330c6c168ce761af17c4f6576c40597180a945c1 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 10 Apr 2019 15:32:31 -0700 Subject: [PATCH 0773/1117] Use code cache dir for engine cache on API >= 21 (#14704). (#8534) --- shell/platform/android/io/flutter/util/PathUtils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shell/platform/android/io/flutter/util/PathUtils.java b/shell/platform/android/io/flutter/util/PathUtils.java index 94cf131916af2..63600c93d4a1f 100644 --- a/shell/platform/android/io/flutter/util/PathUtils.java +++ b/shell/platform/android/io/flutter/util/PathUtils.java @@ -5,6 +5,7 @@ package io.flutter.util; import android.content.Context; +import android.os.Build; public final class PathUtils { public static String getFilesDir(Context applicationContext) { @@ -16,6 +17,10 @@ public static String getDataDirectory(Context applicationContext) { } public static String getCacheDirectory(Context applicationContext) { - return applicationContext.getCacheDir().getPath(); + if (Build.VERSION.SDK_INT >= 21) { + return applicationContext.getCodeCacheDir().getPath(); + } else { + return applicationContext.getCacheDir().getPath(); + } } } From 892591da8835510066b25e28df899af76180aa3a Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 10 Apr 2019 17:47:56 -0700 Subject: [PATCH 0774/1117] Android Embedding PR28: Report app is active to Flutter in FlutterFragment.onResume() instead of onPostResume() forwarded from Activity. (#8536) --- .../io/flutter/embedding/android/FlutterFragment.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java index 35ce809a4939d..57b25707bf340 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java @@ -442,12 +442,16 @@ protected FlutterView.TransparencyMode getTransparencyMode() { return FlutterView.TransparencyMode.valueOf(transparencyModeName); } + @Override + public void onResume() { + super.onResume(); + flutterEngine.getLifecycleChannel().appIsResumed(); + } + // TODO(mattcarroll): determine why this can't be in onResume(). Comment reason, or move if possible. public void onPostResume() { Log.d(TAG, "onPostResume()"); if (flutterEngine != null) { - flutterEngine.getLifecycleChannel().appIsResumed(); - // TODO(mattcarroll): find a better way to handle the update of UI overlays than calling through // to platformPlugin. We're implicitly entangling the Window, Activity, Fragment, // and engine all with this one call. From 18816c50f127359b5972eb9d69500424d86d6f43 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 10 Apr 2019 21:12:24 -0400 Subject: [PATCH 0775/1117] Roll src/third_party/skia 42280f8961fa..99d792276740 (8 commits) (#8539) https://skia.googlesource.com/skia.git/%2Blog/42280f8961fa..99d792276740 git log 42280f8961fa90f5829b561f7925be3354e5991e..99d792276740293109edb22a26fea50490e7eeaf --date=short --no-merges --format=%ad %ae %s 2019-04-10 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-04-10 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-04-10 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-04-10 reed@google.com oops, remove the rest of SkMixer 2019-04-10 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-04-10 herb@google.com Return a span from getMetrics 2019-04-10 egdaniel@google.com Add more general flush call to GrContext. 2019-04-10 ethannicholas@google.com removed duplicate GrCircleEffect.cpp The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 738b8ba79607a..3e01df1462d24 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': '42280f8961fa90f5829b561f7925be3354e5991e', + 'skia_revision': '99d792276740293109edb22a26fea50490e7eeaf', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index ba39c493a9171..503f98ac08638 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 33cde79edb8f35f77d8b871b39c8ca91 +Signature: 694d7fba29996869dade20431a948972 UNUSED LICENSES: @@ -4417,7 +4417,6 @@ FILE: ../../../third_party/skia/src/gpu/ccpr/GrGSCoverageProcessor.cpp FILE: ../../../third_party/skia/src/gpu/ccpr/GrVSCoverageProcessor.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrAtlasedShaderHelpers.h FILE: ../../../third_party/skia/src/gpu/effects/GrBlurredEdgeFragmentProcessor.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrCircleEffect.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrCircleEffect.fp FILE: ../../../third_party/skia/src/gpu/effects/GrCircleEffect.h FILE: ../../../third_party/skia/src/gpu/effects/GrEllipseEffect.fp From ee462ff685303eea6067343f3d82a135f011caf3 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 11 Apr 2019 01:11:24 -0400 Subject: [PATCH 0776/1117] Roll src/third_party/skia 99d792276740..4d657d5e894a (1 commits) (#8542) https://skia.googlesource.com/skia.git/%2Blog/99d792276740..4d657d5e894a git log 99d792276740293109edb22a26fea50490e7eeaf..4d657d5e894a7f89da68b5c41ae8e31128253e21 --date=short --no-merges --format=%ad %ae %s 2019-04-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader f0aa9d5ab738..3954a0bafb8a (42 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 3e01df1462d24..c1eab67133731 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': '99d792276740293109edb22a26fea50490e7eeaf', + 'skia_revision': '4d657d5e894a7f89da68b5c41ae8e31128253e21', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 503f98ac08638..f3c9b8aab1eeb 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 694d7fba29996869dade20431a948972 +Signature: 2c16cb44a8168a40836cfd5d7609b129 UNUSED LICENSES: From 5ac728eb6002a8fcdcce3b754771525fcca4741d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 11 Apr 2019 04:42:25 -0400 Subject: [PATCH 0777/1117] Roll src/third_party/skia 4d657d5e894a..6d60534e95d8 (3 commits) (#8543) https://skia.googlesource.com/skia.git/%2Blog/4d657d5e894a..6d60534e95d8 git log 4d657d5e894a7f89da68b5c41ae8e31128253e21..6d60534e95d89d86068f0ea0ce00abf241b5b5e1 --date=short --no-merges --format=%ad %ae %s 2019-04-11 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-04-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 f39b4f0280ef..e6b23e45b380 (7 commits) 2019-04-11 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 1b121674f584..f8764798ff0e (366 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c1eab67133731..6514848e66418 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': '4d657d5e894a7f89da68b5c41ae8e31128253e21', + 'skia_revision': '6d60534e95d89d86068f0ea0ce00abf241b5b5e1', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index f3c9b8aab1eeb..23cbc4990896b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2c16cb44a8168a40836cfd5d7609b129 +Signature: 5f7fdd9bab270790e9572824f09bb8b9 UNUSED LICENSES: From ffdddb07ef19f71e6bedecae5cefdf7121e89df6 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 11 Apr 2019 10:08:24 -0400 Subject: [PATCH 0778/1117] Roll src/third_party/skia 6d60534e95d8..76e626d9bb55 (1 commits) (#8544) https://skia.googlesource.com/skia.git/%2Blog/6d60534e95d8..76e626d9bb55 git log 6d60534e95d89d86068f0ea0ce00abf241b5b5e1..76e626d9bb555d2a831b1f91b37e93649bfbd71d --date=short --no-merges --format=%ad %ae %s 2019-04-10 halcanary@google.com SkQP: remove bad tests from future branches. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 6514848e66418..f708a9327716f 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': '6d60534e95d89d86068f0ea0ce00abf241b5b5e1', + 'skia_revision': '76e626d9bb555d2a831b1f91b37e93649bfbd71d', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the From ae4df6fd189219fc35b27cd5e014bd8445c4e59d Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 11 Apr 2019 09:16:36 -0700 Subject: [PATCH 0779/1117] Revert "Change Rect internal representation from Float32List to Float64List (#8524)" (#8545) This reverts commit 0b36d3e2f0235f25dc5b5657bd2e594fe7414aee. --- lib/ui/compositing.dart | 2 +- lib/ui/geometry.dart | 8 ++------ lib/ui/painting.dart | 12 ++++++------ 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/ui/compositing.dart b/lib/ui/compositing.dart index 06906ed50b972..8b3f98c821106 100644 --- a/lib/ui/compositing.dart +++ b/lib/ui/compositing.dart @@ -98,7 +98,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 { EngineLayer pushClipRRect(RRect rrect, {Clip clipBehavior = Clip.antiAlias}) { assert(clipBehavior != null); assert(clipBehavior != Clip.none); - return _pushClipRRect(rrect._value32, clipBehavior.index); + return _pushClipRRect(rrect._value, clipBehavior.index); } EngineLayer _pushClipRRect(Float32List rrect, int clipBehavior) native 'SceneBuilder_pushClipRRect'; diff --git a/lib/ui/geometry.dart b/lib/ui/geometry.dart index f326c1ecbdc74..2e8a79980c2dc 100644 --- a/lib/ui/geometry.dart +++ b/lib/ui/geometry.dart @@ -666,9 +666,7 @@ class Rect { } static const int _kDataSize = 4; - final Float64List _value = new Float64List(_kDataSize); - - Float32List get _value32 => Float32List.fromList(_value); + final Float32List _value = new Float32List(_kDataSize); /// The offset of the left edge of this rectangle from the x axis. double get left => _value[0]; @@ -1159,11 +1157,9 @@ class RRect { } static const int _kDataSize = 12; - final Float64List _value = new Float64List(_kDataSize); + final Float32List _value = new Float32List(_kDataSize); RRect _scaled; // same RRect with scaled radii per side - Float32List get _value32 => Float32List.fromList(_value); - /// The offset of the left edge of this rectangle from the x axis. double get left => _value[0]; diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index 79adb4f818d46..6703dfd01083e 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -2028,7 +2028,7 @@ class Path extends NativeFieldWrapperClass2 { /// argument. void addRRect(RRect rrect) { assert(_rrectIsValid(rrect)); - _addRRect(rrect._value32); + _addRRect(rrect._value); } void _addRRect(Float32List rrect) native 'Path_addRRect'; @@ -3259,7 +3259,7 @@ class Canvas extends NativeFieldWrapperClass2 { void clipRRect(RRect rrect, {bool doAntiAlias = true}) { assert(_rrectIsValid(rrect)); assert(doAntiAlias != null); - _clipRRect(rrect._value32, doAntiAlias); + _clipRRect(rrect._value, doAntiAlias); } void _clipRRect(Float32List rrect, bool doAntiAlias) native 'Canvas_clipRRect'; @@ -3336,7 +3336,7 @@ class Canvas extends NativeFieldWrapperClass2 { void drawRRect(RRect rrect, Paint paint) { assert(_rrectIsValid(rrect)); assert(paint != null); - _drawRRect(rrect._value32, paint._objects, paint._data); + _drawRRect(rrect._value, paint._objects, paint._data); } void _drawRRect(Float32List rrect, List paintObjects, @@ -3351,7 +3351,7 @@ class Canvas extends NativeFieldWrapperClass2 { assert(_rrectIsValid(outer)); assert(_rrectIsValid(inner)); assert(paint != null); - _drawDRRect(outer._value32, inner._value32, paint._objects, paint._data); + _drawDRRect(outer._value, inner._value, paint._objects, paint._data); } void _drawDRRect(Float32List outer, Float32List inner, @@ -3651,7 +3651,7 @@ class Canvas extends NativeFieldWrapperClass2 { } final Int32List colorBuffer = colors.isEmpty ? null : _encodeColorList(colors); - final Float32List cullRectBuffer = cullRect?._value32; + final Float32List cullRectBuffer = cullRect?._value; _drawAtlas( paint._objects, paint._data, atlas, rstTransformBuffer, rectBuffer, @@ -3698,7 +3698,7 @@ class Canvas extends NativeFieldWrapperClass2 { _drawAtlas( paint._objects, paint._data, atlas, rstTransforms, rects, - colors, blendMode.index, cullRect?._value32 + colors, blendMode.index, cullRect?._value ); } From c00364a6c8be49abed0c7cdee65cb0b94b2c0f3c Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Thu, 11 Apr 2019 09:45:24 -0700 Subject: [PATCH 0780/1117] [font_collection] Add missing semicolon (#8546) --- third_party/txt/src/txt/font_collection.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/txt/src/txt/font_collection.cc b/third_party/txt/src/txt/font_collection.cc index 2872af08c0e65..99be0100957d1 100644 --- a/third_party/txt/src/txt/font_collection.cc +++ b/third_party/txt/src/txt/font_collection.cc @@ -212,7 +212,7 @@ std::shared_ptr FontCollection::CreateMinikinFontFamily( // Add fonts to the Minikin font family. for (int i = 0; i < font_style_set->count(); ++i) { - TRACE_EVENT0("flutter", "CreateMinikinFont") + TRACE_EVENT0("flutter", "CreateMinikinFont"); // Create the skia typeface. sk_sp skia_typeface( sk_sp(font_style_set->createTypeface(i))); From f53e477a658c64e2f1d317ca37c52ba9aea9bf34 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Thu, 11 Apr 2019 09:59:08 -0700 Subject: [PATCH 0781/1117] Correct nullability for FlutterStandardReader (#8537) FlutterStandardReader's `readValueOfType:` method returns nil when called with `FlutterStandardFieldNil`. By extension, `readValue` can also return nil values. --- shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h | 4 ++-- .../darwin/ios/framework/Source/FlutterStandardCodec.mm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h b/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h index 0034a0709a09b..96c1f5cf0c9b7 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h @@ -116,8 +116,8 @@ FLUTTER_EXPORT - (UInt32)readSize; - (void)readAlignment:(UInt8)alignment; - (NSString*)readUTF8; -- (id)readValue; -- (id)readValueOfType:(UInt8)type; +- (nullable id)readValue; +- (nullable id)readValueOfType:(UInt8)type; @end /** diff --git a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm index f4b174bb8408b..f4678d67762fe 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm @@ -408,11 +408,11 @@ - (FlutterStandardTypedData*)readTypedDataOfType:(FlutterStandardDataType)type { return [FlutterStandardTypedData typedDataWithData:data type:type]; } -- (id)readValue { +- (nullable id)readValue { return [self readValueOfType:[self readByte]]; } -- (id)readValueOfType:(UInt8)type { +- (nullable id)readValueOfType:(UInt8)type { FlutterStandardField field = (FlutterStandardField)type; switch (field) { case FlutterStandardFieldNil: From 82e6d689943519e8d11cd6f9c809ff354b5077a7 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Thu, 11 Apr 2019 09:59:20 -0700 Subject: [PATCH 0782/1117] Eliminate unused write to local (#8541) In GraphemeBreak::isGraphemeBreak() p0 is never read and tailoredGraphemeClusterBreak() has no side-effects, so the call can be eliminated. --- third_party/txt/src/minikin/GraphemeBreak.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/third_party/txt/src/minikin/GraphemeBreak.cpp b/third_party/txt/src/minikin/GraphemeBreak.cpp index 7e907352537c9..b711fae9aab7b 100644 --- a/third_party/txt/src/minikin/GraphemeBreak.cpp +++ b/third_party/txt/src/minikin/GraphemeBreak.cpp @@ -150,7 +150,6 @@ bool GraphemeBreak::isGraphemeBreak(const float* advances, if (p0 == U_GCB_EXTEND && offset_backback > start) { // skip over emoji variation selector U16_PREV(buf, start, offset_backback, c0); - p0 = tailoredGraphemeClusterBreak(c0); } if (isEmojiBase(c0)) { return false; From 711d8431da47256262bca95757d68ad2d2dfcd42 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 11 Apr 2019 13:35:24 -0400 Subject: [PATCH 0783/1117] Roll src/third_party/skia 76e626d9bb55..c33e6dcc700b (4 commits) (#8547) https://skia.googlesource.com/skia.git/%2Blog/76e626d9bb55..c33e6dcc700b git log 76e626d9bb555d2a831b1f91b37e93649bfbd71d..c33e6dcc700bae9a1bbcbc9ebc32709a1c0d5c21 --date=short --no-merges --format=%ad %ae %s 2019-04-10 mtklein@google.com restore SkOpts::blit_row_color32 2019-04-05 bungeman@google.com Make SkFontMgr_fontconfig respect the sysroot. 2019-04-10 jvanverth@google.com Enable all Mtl tests 2019-04-11 ethannicholas@google.com removed redundant GrCircleEffect.h The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index f708a9327716f..73214cdd22c04 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': '76e626d9bb555d2a831b1f91b37e93649bfbd71d', + 'skia_revision': 'c33e6dcc700bae9a1bbcbc9ebc32709a1c0d5c21', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 23cbc4990896b..3edf0a61bbd40 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 5f7fdd9bab270790e9572824f09bb8b9 +Signature: d8912b05ae5ac462d5b7a163eb36768f UNUSED LICENSES: @@ -4418,7 +4418,6 @@ FILE: ../../../third_party/skia/src/gpu/ccpr/GrVSCoverageProcessor.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrAtlasedShaderHelpers.h FILE: ../../../third_party/skia/src/gpu/effects/GrBlurredEdgeFragmentProcessor.fp FILE: ../../../third_party/skia/src/gpu/effects/GrCircleEffect.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrCircleEffect.h FILE: ../../../third_party/skia/src/gpu/effects/GrEllipseEffect.fp FILE: ../../../third_party/skia/src/gpu/effects/GrSimpleTextureEffect.fp FILE: ../../../third_party/skia/src/gpu/effects/generated/GrBlurredEdgeFragmentProcessor.cpp From a344015e9abb5f0e7e1f8e2bf2d43620cf96fd19 Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Thu, 11 Apr 2019 13:36:49 -0700 Subject: [PATCH 0784/1117] [fuchsia] Add flutter:: to scene_host.cc (#8549) --- lib/ui/compositing/scene_host.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ui/compositing/scene_host.cc b/lib/ui/compositing/scene_host.cc index b3a9bc99147d9..4247fc247cb44 100644 --- a/lib/ui/compositing/scene_host.cc +++ b/lib/ui/compositing/scene_host.cc @@ -18,14 +18,14 @@ namespace { -using SceneHostBindings = std::unordered_map; +using SceneHostBindings = std::unordered_map; FML_THREAD_LOCAL fml::ThreadLocal tls_scene_host_bindings([](intptr_t value) { delete reinterpret_cast(value); }); void SceneHost_constructor(Dart_NativeArguments args) { - tonic::DartCallConstructor(&SceneHost::Create, args); + tonic::DartCallConstructor(&flutter::SceneHost::Create, args); } void SceneHost_constructorViewHolderToken(Dart_NativeArguments args) { @@ -36,10 +36,10 @@ void SceneHost_constructorViewHolderToken(Dart_NativeArguments args) { reinterpret_cast(new SceneHostBindings())); } - tonic::DartCallConstructor(&SceneHost::CreateViewHolder, args); + tonic::DartCallConstructor(&flutter::SceneHost::CreateViewHolder, args); } -SceneHost* GetSceneHost(scenic::ResourceId id) { +flutter::SceneHost* GetSceneHost(scenic::ResourceId id) { auto* bindings = reinterpret_cast(tls_scene_host_bindings.Get()); FML_DCHECK(bindings); From d84d204c764c3fe11f4ed28916814030377067df Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 11 Apr 2019 13:50:42 -0700 Subject: [PATCH 0785/1117] Android Embedding PR30: Make FlutterView focusable so that the keyboard can interact with it. (#8551) --- .../android/io/flutter/embedding/android/FlutterView.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/shell/platform/android/io/flutter/embedding/android/FlutterView.java index 8d4c7d3b186b5..21b40575a7280 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -170,6 +170,10 @@ private void init() { addView(flutterTextureView); break; } + + // FlutterView needs to be focusable so that the InputMethodManager can interact with it. + setFocusable(true); + setFocusableInTouchMode(true); } /** From f37220d40f54d835bfcf7e7fc6ec2e66154a414b Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 11 Apr 2019 17:01:30 -0400 Subject: [PATCH 0786/1117] Roll src/third_party/skia c33e6dcc700b..36477b49c2ef (8 commits) (#8552) https://skia.googlesource.com/skia.git/%2Blog/c33e6dcc700b..36477b49c2ef git log c33e6dcc700bae9a1bbcbc9ebc32709a1c0d5c21..36477b49c2ef4c4dc23f8c53df4d51d141407ba8 --date=short --no-merges --format=%ad %ae %s 2019-04-11 jvanverth@google.com Fix GrFillRRectOp rendering in Metal. 2019-04-11 mtklein@google.com rewrite new SkVx unit test 2019-04-11 mtklein@google.com clean up SK_SUPPORT_LEGACY_A8_MASKBLITTER 2019-04-11 mtklein@google.com simplify and centralize SK_API 2019-04-10 lsalzman@mozilla.com limit mask drawing to clip bounds 2019-04-11 mtklein@google.com add SkVx helpers for working with unorm8 2019-04-10 herb@google.com Change getMetrics to the final API prepareForDrawing 2019-04-11 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 73214cdd22c04..db965c6f8d129 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': 'c33e6dcc700bae9a1bbcbc9ebc32709a1c0d5c21', + 'skia_revision': '36477b49c2ef4c4dc23f8c53df4d51d141407ba8', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3edf0a61bbd40..415975573753f 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: d8912b05ae5ac462d5b7a163eb36768f +Signature: c7c3f4acec439edec1b7b44324cca267 UNUSED LICENSES: @@ -5971,6 +5971,7 @@ FILE: ../../../third_party/skia/gm/overdrawcanvas.cpp FILE: ../../../third_party/skia/gm/samplelocations.cpp FILE: ../../../third_party/skia/gm/skbug_8664.cpp FILE: ../../../third_party/skia/gm/skbug_8955.cpp +FILE: ../../../third_party/skia/include/core/SkApi.h FILE: ../../../third_party/skia/include/core/SkTileMode.h FILE: ../../../third_party/skia/include/gpu/GrContextThreadSafeProxy.h FILE: ../../../third_party/skia/include/private/GrContext_Base.h From 99259aef59b7f26b7fc20abef7d13752fce7dc3a Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 11 Apr 2019 22:07:04 -0400 Subject: [PATCH 0787/1117] Roll src/third_party/skia 36477b49c2ef..3b60397fd35d (6 commits) (#8554) https://skia.googlesource.com/skia.git/%2Blog/36477b49c2ef..3b60397fd35d git log 36477b49c2ef4c4dc23f8c53df4d51d141407ba8..3b60397fd35df09823b0c64fbf00ffc99ffe8c8c --date=short --no-merges --format=%ad %ae %s 2019-04-11 herb@google.com Convert GPU SDF handling to use prepareForDrawing 2018-08-27 bungeman@google.com Make SkPaintFilterCanvas paints no longer COW. 2019-04-11 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-04-11 mtklein@google.com Revert "simplify and centralize SK_API" 2019-04-11 herb@google.com Convert GPU path handling to using prepareForDrawing 2019-04-11 mtklein@google.com use __builtin_shufflevector when available The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index db965c6f8d129..830ed5def9ef7 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': '36477b49c2ef4c4dc23f8c53df4d51d141407ba8', + 'skia_revision': '3b60397fd35df09823b0c64fbf00ffc99ffe8c8c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 415975573753f..5511ddb940bd7 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c7c3f4acec439edec1b7b44324cca267 +Signature: 14c51d7f77a6feb3f3c406f5f1f0bc84 UNUSED LICENSES: @@ -5971,7 +5971,6 @@ FILE: ../../../third_party/skia/gm/overdrawcanvas.cpp FILE: ../../../third_party/skia/gm/samplelocations.cpp FILE: ../../../third_party/skia/gm/skbug_8664.cpp FILE: ../../../third_party/skia/gm/skbug_8955.cpp -FILE: ../../../third_party/skia/include/core/SkApi.h FILE: ../../../third_party/skia/include/core/SkTileMode.h FILE: ../../../third_party/skia/include/gpu/GrContextThreadSafeProxy.h FILE: ../../../third_party/skia/include/private/GrContext_Base.h From 1b448e555f282e6de8d1154f3c90af478ad72506 Mon Sep 17 00:00:00 2001 From: Siva Date: Thu, 11 Apr 2019 20:09:10 -0700 Subject: [PATCH 0788/1117] Roll Dart 15b11b018364ce032eae50d78fc8a52b541e2bce...a8f3a5dae6203d1064726a5953cf06a7d484249c (#8555) a8f3a5dae6 [VM] Ensure a class is type finalized before finalizing it. fe6897ab7f [dartdevc] fix #36252, export private name symbols b3e5be7a0a Remove from WATCHLISTS. e129b201e5 Fix for absent names of parameters in GenericFunctionType. 98fc8ac7ff [ VM / Service ] Temporarily disable VM service auth codes by default ed280a98a2 Instantiate to bounds when resolving type names. 5d6beb754e Bump http package to fix gclient f657371972 Change dev_dependencies to any 04ee9b9336 Add support for the manifest checks in analyzer_cli 72fca58a11 [infra] Update d8 to 7.5.149 a91381ab07 Build local elements in initializer expressions, so support closures. 850d56c681 Fix an error in the manifest file test framework 4be9357966 [vm] Harden function_stress_test.dart 561dc79a7b Bring in the latest test and stream_channel d4fee0a85e Issue 36576. Add returnType to constructor in available declarations. 32f120c1e9 Resolve default values in AST summaries. d5bbf25197 [vm/compiler] Eliminate Redefinitions based on the reaching type. 5dd89ef9a0 fix invalid var init parser recovery b9cbb679f3 [dart2js] Add `--experiment-new-rti` flag. 35e6c16c9c Make download_abi_dills.py check that each ABI version exists 7943e50cfd Compute simply bounded types. dc173036ee DEPS: update csslib and html to latest e104054059 Rework storing type parameters and function types. 2723835b18 dont fall back on the wrapped file system when the uri is the multi-u ri scheme b857d53e7e Re-work collection literal strict-raw-type to strict-inference 229e00d97b [vm/frontend_server] Ensure incremental compiler gets vm environment defines set. 88c8d0c5ac Make download_abi_dills.py handle multiple abi verions not existing a437160328 [vm/ffi] Fix bug in AllocateArgument caused by relying on order of ar gument evaluation. 54caf5c950 Dart deps_pruning: track summary dependencies during analysis phase. 3dc29819c8 [vm] Don't emit graph body when intrinsification is complete. f7ad0c4de8 [CFE] Avoid spurious circularity error when an error is evaluated aga in. a9f8248bfb Add support for computing fixes in pubspec and manifest files 1555594ddb Include a per-library index of owned sources in kernel 88068ebfe3 Add missing _getLocationInEnclosingFile on Typedef f919c3985b Proper offstes on mixin classes 7f3ced4333 Set proper startCharOffset on enum classes 6609ea21e2 Proper endoffset on enum classes a7a87df513 [vm/ffi] Replicate transition to/from native code around FFI calls. 460d00616c Better printing of imports fe535ac27c Add missing offset to yield produced by await for a190a2762b Allow debugger to stop on comparison to null 462e03d01e Reland "[vm] Refactor Location to use either dart::Register or dart:: host::Register" aa9ce0f122 Revert "[vm] Repair the resolver abstraction, take 2." 7cdba2e711 Revert "[vm] Cache method resolution." 51433e65cc Compile flutter tests via the sdk 318967456c Resolve constructor initializers. bed1bab2cd [vm/interpreter] remove assumptions about alignment of bytecode instr uctions. 2f0dfd6124 [vm] Cache method resolution. 1685ac3683 [vm] Reimplement COMPILE_ASSERT with static_assert for nicer error me ssages from the C++ compiler. b6f8c717f0 update lint error code associations 5cc9455b65 scanner-tool: add explicit command-line arguments to enable printing tokens 9e279a5054 [vm] Dart_Cleanup: wait for outstanding vm-service and kernel isolate spawns. 385129e2fa bump to linter 0.1.86 d79787771e [vm] Repair the resolver abstraction, take 2. ebd13e891f [vm/bytecode] Add UncheckedInterfaceCall instruction 1dd820158b [vm/bytecode] Avoid crashes when trying to collect token positions wi thout AST ab66a3808b Add more JS subtyping semantics to CFE constant evaluator. 585debbb2e [dart/fuzzer] Exclude process info from API table 2cde9c05ee [VM] Better error messages when unexpected constant tags are seen in the kernel reader. 17f5d2d757 Add assists to inline add and addAll 8bffea0fa4 [infra] Ensure all message are written before exiting test.py 72b7e95c74 [vm/service] Give service isolate name. 92c9f124c3 [ VM / Service ] Fixed HTTP requests to the VM service not working co rrectly with authentication codes 9876e92c7d [dart/vm] Support OSR on non-empty expression stack dc606ef02f [dart/fuzzer] Exclude 'pid' from API table f819c866e7 [vm, interpreter] Handle method extractors as a bytecode. 5735bde143 Fix a test to fix the windows bot 75a529f115 [vm/tests] Improve usability of pkg/vm tests ac02811081 [cfe] Allow expression compilation with constant-update-2018 5ed4cdac5d Remove unused import f4e63990cb [vm/ffi] Support FFI on ARM32. 409b68a4ce [vm] Mark type_feedback_test as Slow. 773bea1774 [vm] Mark compilation_trace_test as Slow. 741b1f501f [vm/dbc] Implement CheckNull for DBC and enable optimizations 4ab4545ff7 [cfe] Add type and file offset to constant expressions 66477b9fcf [co19] DEPS file updated edc6f88168 Use compiler context when serializing components and performing trans formations. 523e3789e0 Add support for providing fixes in analysis options files b76694386a [dart/fuzzer] Exclude Platform from API table 919461badd Ensure boolified SSA nodes are non-null first. 1bc1e483e0 Fix a typo in the service protocol docs. --- DEPS | 18 +++++++++++------- ci/licenses_golden/licenses_third_party | 3 ++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/DEPS b/DEPS index 830ed5def9ef7..4bf3e86d693ee 100644 --- a/DEPS +++ b/DEPS @@ -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': '15b11b018364ce032eae50d78fc8a52b541e2bce', + 'dart_revision': 'a8f3a5dae6203d1064726a5953cf06a7d484249c', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -46,21 +46,21 @@ vars = { 'dart_collection_tag': '1.14.11', 'dart_convert_tag': '2.0.2', 'dart_crypto_tag': '2.0.6', - 'dart_csslib_tag': '0.14.4+1', + 'dart_csslib_tag': '0.15.0', 'dart_dart2js_info_tag': '0.6.0', 'dart_dart_style_tag': '1.2.7', 'dart_dartdoc_tag': 'v0.28.2', 'dart_fixnum_tag': '0.10.9', 'dart_glob_tag': '1.1.7', - 'dart_html_tag': '0.14.0', + 'dart_html_tag': '0.14.0+1', 'dart_http_multi_server_tag': '2.0.5', 'dart_http_parser_tag': '3.1.3', 'dart_http_retry_tag': '0.1.1', - 'dart_http_tag': '0.12.0', + 'dart_http_tag': '0.12.0+2', 'dart_http_throttle_tag': '1.0.2', 'dart_intl_tag': '0.15.7', 'dart_json_rpc_2_tag': '2.0.9', - 'dart_linter_tag': '0.1.85', + 'dart_linter_tag': '0.1.86', 'dart_logging_tag': '0.11.3+2', 'dart_markdown_tag': '2.0.2', 'dart_matcher_tag': '0.12.3', @@ -72,6 +72,7 @@ vars = { 'dart_package_config_tag': '1.0.5', 'dart_package_resolver_tag': '1.0.10', 'dart_path_tag': '1.6.2', + 'dart_pedantic_tag': 'v1.5.0', 'dart_pool_tag': '1.3.6', 'dart_protobuf_rev': '0c77167b16d00b561a6055bfe26690af7f26ae88', 'dart_pub_rev': '8c363fe26f059c3063f1129adbb3c4e22a8ce954', @@ -87,11 +88,11 @@ vars = { 'dart_source_maps_tag': '8af7cc1a1c3a193c1fba5993ce22a546a319c40e', 'dart_source_span_tag': '1.5.5', 'dart_stack_trace_tag': '1.9.3', - 'dart_stream_channel_tag': '1.6.8', + 'dart_stream_channel_tag': '2.0.0', '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.3.4', + 'dart_test_tag': 'test-v1.6.1', 'dart_typed_data_tag': '1.1.6', 'dart_usage_tag': '3.4.0', 'dart_watcher_rev': '0.9.7+12', @@ -277,6 +278,9 @@ deps = { 'src/third_party/dart/third_party/pkg/path': Var('dart_git') + '/path.git' + '@' + Var('dart_path_tag'), + 'src/third_party/dart/third_party/pkg/pedantic': + Var('dart_git') + '/pedantic.git' + '@' + Var('dart_pedantic_tag'), + 'src/third_party/dart/third_party/pkg/pool': Var('dart_git') + '/pool.git' + '@' + Var('dart_pool_tag'), diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index ea4c2e9ba7287..93d45caaff651 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 866085660a05bb407caffc09636cbd32 +Signature: 0b5f95400c9ee9dddb24d60108d1f4f3 UNUSED LICENSES: @@ -5174,6 +5174,7 @@ FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_arm64.cc FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_dbc.cc FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_ia32.cc FILE: ../../../third_party/dart/runtime/vm/compiler/stub_code_compiler_x64.cc +FILE: ../../../third_party/dart/runtime/vm/constants_arm.cc FILE: ../../../third_party/dart/runtime/vm/constants_arm64.cc FILE: ../../../third_party/dart/runtime/vm/constants_ia32.cc FILE: ../../../third_party/dart/runtime/vm/constants_x64.cc From f804c293f3baaec9ccec1e251293f6a3509223b8 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 12 Apr 2019 01:35:24 -0400 Subject: [PATCH 0789/1117] Roll src/third_party/skia 3b60397fd35d..f74fff660084 (3 commits) (#8556) https://skia.googlesource.com/skia.git/%2Blog/3b60397fd35d..f74fff660084 git log 3b60397fd35df09823b0c64fbf00ffc99ffe8c8c..f74fff66008417b661e3410f81a903e2f912480c --date=short --no-merges --format=%ad %ae %s 2019-04-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 e6b23e45b380..cfc73cc1af5e (5 commits) 2019-04-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3954a0bafb8a..13f230772370 (11 commits) 2019-04-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src f8764798ff0e..6506f553b36c (417 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4bf3e86d693ee..795824906d259 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': '3b60397fd35df09823b0c64fbf00ffc99ffe8c8c', + 'skia_revision': 'f74fff66008417b661e3410f81a903e2f912480c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 5511ddb940bd7..35ffee458adfc 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 14c51d7f77a6feb3f3c406f5f1f0bc84 +Signature: c40861a2d729af36055a8b36c8e12c1e UNUSED LICENSES: From 9aa7c9a48e9342a450c3078e15c8d7923a338ede Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Thu, 11 Apr 2019 23:32:29 -0700 Subject: [PATCH 0790/1117] Export extern constants in embedder.h (#8550) PR #8498 made these constants extern, but forgot to export them so they would be public symbols. --- shell/platform/embedder/embedder.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 9b6bd2478c07e..3068a30befe20 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -343,6 +343,7 @@ typedef struct { // |FlutterSemanticsNode| ID used as a sentinel to signal the end of a batch of // semantics node updates. +FLUTTER_EXPORT extern const int32_t kFlutterSemanticsNodeIdBatchEnd; // A node that represents some semantic data. @@ -414,6 +415,7 @@ typedef struct { // |FlutterSemanticsCustomAction| ID used as a sentinel to signal the end of a // batch of semantics custom action updates. +FLUTTER_EXPORT extern const int32_t kFlutterSemanticsCustomActionIdBatchEnd; // A custom semantics action, or action override. From a88cd8032937a79d47e73b3b117af168598f94cf Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 12 Apr 2019 05:04:24 -0400 Subject: [PATCH 0791/1117] Roll src/third_party/skia f74fff660084..41476708db86 (1 commits) (#8558) https://skia.googlesource.com/skia.git/%2Blog/f74fff660084..41476708db86 git log f74fff66008417b661e3410f81a903e2f912480c..41476708db864c82dcd0442ccaa18395b6affa19 --date=short --no-merges --format=%ad %ae %s 2019-04-12 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 795824906d259..9021975743c63 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': 'f74fff66008417b661e3410f81a903e2f912480c', + 'skia_revision': '41476708db864c82dcd0442ccaa18395b6affa19', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 35ffee458adfc..75a43be570923 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c40861a2d729af36055a8b36c8e12c1e +Signature: 44035bda3b6bc251b433c4d16a33d5a0 UNUSED LICENSES: From db99c86ab0234f2865b8603bd8c8926ad9a09909 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 12 Apr 2019 08:33:26 -0400 Subject: [PATCH 0792/1117] Roll src/third_party/skia 41476708db86..35f1c154c5e5 (1 commits) (#8559) https://skia.googlesource.com/skia.git/%2Blog/41476708db86..35f1c154c5e5 git log 41476708db864c82dcd0442ccaa18395b6affa19..35f1c154c5e5a39d48ed94f068445d195513a920 --date=short --no-merges --format=%ad %ae %s 2019-04-12 egdaniel@google.com Revert "limit mask drawing to clip bounds" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 9021975743c63..56941f95d18b8 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': '41476708db864c82dcd0442ccaa18395b6affa19', + 'skia_revision': '35f1c154c5e5a39d48ed94f068445d195513a920', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 75a43be570923..c5f61c839a2ad 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 44035bda3b6bc251b433c4d16a33d5a0 +Signature: d1bcb43769a590ff484f9aa516c611e3 UNUSED LICENSES: From 501892a9235d6ed52511c7c8818a0dd48c68d542 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 12 Apr 2019 12:03:24 -0400 Subject: [PATCH 0793/1117] Roll src/third_party/skia 35f1c154c5e5..25071cc52b4b (7 commits) (#8560) https://skia.googlesource.com/skia.git/%2Blog/35f1c154c5e5..25071cc52b4b git log 35f1c154c5e5a39d48ed94f068445d195513a920..25071cc52b4bc5858d812d2aa10983bdbe3b9eef --date=short --no-merges --format=%ad %ae %s 2019-04-12 michaelludwig@google.com Always initialize geometry domain if it's written to the GPU 2019-04-12 egdaniel@google.com Reland "limit mask drawing to clip bounds" 2019-04-12 brianosman@google.com Include particles in shared Windows builds 2019-04-11 herb@google.com Convert the fallback source case to use prepareForDrawing 2019-04-11 brianosman@google.com Make the persistent cache utility functions operate on SkData 2019-04-12 mtklein@google.com Revert "clean up SK_SUPPORT_LEGACY_A8_MASKBLITTER" 2019-04-11 ccameron@chromium.org Null-initialize pointer The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 56941f95d18b8..94cfa99b6b542 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': '35f1c154c5e5a39d48ed94f068445d195513a920', + 'skia_revision': '25071cc52b4bc5858d812d2aa10983bdbe3b9eef', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index c5f61c839a2ad..f5fdf518b943d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: d1bcb43769a590ff484f9aa516c611e3 +Signature: 34f939e02258658541e37722715ed008 UNUSED LICENSES: From fcd717e28df83038055084d2ed0d737cd8863b72 Mon Sep 17 00:00:00 2001 From: Michael Thomsen Date: Fri, 12 Apr 2019 19:36:16 +0200 Subject: [PATCH 0794/1117] Update README.md to point to flutter.dev (#8557) Update from flutter.io to flutter.dev domain. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8eedc223a79fb..00187bd4c4ba9 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Flutter is optimized for today's, and tomorrow's, mobile devices. We are focused on low-latency input and high frame rates on Android and iOS. The Flutter Engine is a portable runtime for hosting -[Flutter](https://flutter.io) applications. It implements Flutter's core +[Flutter](https://flutter.dev) applications. It implements Flutter's core libraries, including animation and graphics, file and network I/O, accessibility support, plugin architecture, and a Dart runtime and compile toolchain. Most developers will interact with Flutter via the [Flutter @@ -16,9 +16,9 @@ reactive framework, and a rich set of platform, layout and foundation widgets. 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 +site at [Flutter.dev](https://flutter.dev). For specific information about Flutter's APIs, consider our API reference which can be found at -the [docs.flutter.io](https://docs.flutter.io/). +the [docs.flutter.dev](https://docs.flutter.dev/). If you intend to contribute to Flutter, welcome! You are encouraged to start with [our contributor From ad04340e52f87b97c6c8de2c703f762da5593749 Mon Sep 17 00:00:00 2001 From: Diego Ballesteros Villamizar Date: Fri, 12 Apr 2019 19:48:11 +0200 Subject: [PATCH 0795/1117] Add missing include to text_input_model.h (#8562) text_input_model.h uses std::unique_ptr but does not include the memory header. --- shell/platform/common/cpp/text_input_model.h | 1 + 1 file changed, 1 insertion(+) diff --git a/shell/platform/common/cpp/text_input_model.h b/shell/platform/common/cpp/text_input_model.h index 54afd05521646..e3ea19bae9010 100644 --- a/shell/platform/common/cpp/text_input_model.h +++ b/shell/platform/common/cpp/text_input_model.h @@ -5,6 +5,7 @@ #ifndef FLUTTER_SHELL_PLATFORM_CPP_TEXT_INPUT_MODEL_H_ #define FLUTTER_SHELL_PLATFORM_CPP_TEXT_INPUT_MODEL_H_ +#include #include #include "rapidjson/document.h" From 1bb2c0cf06977f0aed2190347a08f58c71871e6b Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Fri, 12 Apr 2019 11:17:57 -0700 Subject: [PATCH 0796/1117] Remove unused import in FlutterActivityDelegate (#8563) android.app.UiModeManager is unused in FlutterActivityDelegate. --- .../platform/android/io/flutter/app/FlutterActivityDelegate.java | 1 - 1 file changed, 1 deletion(-) diff --git a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java index 467bfdbce240b..7e4cb402eb02f 100644 --- a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java +++ b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java @@ -8,7 +8,6 @@ import android.animation.AnimatorListenerAdapter; import android.app.Activity; import android.app.Application; -import android.app.UiModeManager; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; From e6c822db9c1912f61e9e1b964f554bcb23b20231 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 12 Apr 2019 15:34:24 -0400 Subject: [PATCH 0797/1117] Roll src/third_party/skia 25071cc52b4b..8be917af4313 (6 commits) (#8564) https://skia.googlesource.com/skia.git/%2Blog/25071cc52b4b..8be917af4313 git log 25071cc52b4bc5858d812d2aa10983bdbe3b9eef..8be917af4313f6021b9b8e5d2b3f4d5712967aa9 --date=short --no-merges --format=%ad %ae %s 2019-04-11 herb@google.com Convert the CPU path case to use prepareForDrawing 2019-04-12 benjaminwagner@google.com Factor common SSH logic into a new flavor. 2019-04-12 reed@google.com remove dead code from old factories, enum 2019-04-11 mtklein@google.com replace Sk4px with SkVx in SkBlitter_ARGB32 2019-04-12 brianosman@google.com GLSL editing in Viewer 2019-04-12 michaelludwig@google.com Make sure local rects are sorted post-clipping The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 94cfa99b6b542..f607b9911edd6 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': '25071cc52b4bc5858d812d2aa10983bdbe3b9eef', + 'skia_revision': '8be917af4313f6021b9b8e5d2b3f4d5712967aa9', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index f5fdf518b943d..7c27737827b0f 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 34f939e02258658541e37722715ed008 +Signature: 0f615c414aeea570c36bdf3addef58eb UNUSED LICENSES: From 23b0e02ec0b8e7730c7d9644c549adf69a4a21f2 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Fri, 12 Apr 2019 13:19:05 -0700 Subject: [PATCH 0798/1117] Android Embedding PR29: Improve FlutterFragment construction API + engine config API. (#8540) --- .../embedding/android/FlutterFragment.java | 228 +++++++++++------- 1 file changed, 136 insertions(+), 92 deletions(-) diff --git a/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java index 57b25707bf340..cf71acf0c2fd3 100644 --- a/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java +++ b/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java @@ -60,24 +60,58 @@ public class FlutterFragment extends Fragment { private static final String TAG = "FlutterFragment"; - private static final String ARG_DART_ENTRYPOINT = "dart_entrypoint"; - private static final String ARG_INITIAL_ROUTE = "initial_route"; - private static final String ARG_APP_BUNDLE_PATH = "app_bundle_path"; - private static final String ARG_FLUTTER_INITIALIZATION_ARGS = "initialization_args"; - private static final String ARG_FLUTTERVIEW_RENDER_MODE = "flutterview_render_mode"; - private static final String ARG_FLUTTERVIEW_TRANSPARENCY_MODE = "flutterview_transparency_mode"; + protected static final String ARG_DART_ENTRYPOINT = "dart_entrypoint"; + protected static final String ARG_INITIAL_ROUTE = "initial_route"; + protected static final String ARG_APP_BUNDLE_PATH = "app_bundle_path"; + protected static final String ARG_FLUTTER_INITIALIZATION_ARGS = "initialization_args"; + protected static final String ARG_FLUTTERVIEW_RENDER_MODE = "flutterview_render_mode"; + protected static final String ARG_FLUTTERVIEW_TRANSPARENCY_MODE = "flutterview_transparency_mode"; /** * Builder that creates a new {@code FlutterFragment} with {@code arguments} that correspond * to the values set on this {@code Builder}. *

    * To create a {@code FlutterFragment} with default {@code arguments}, invoke {@code build()} - * immeidately: + * without setting any builder properties: * {@code * FlutterFragment fragment = new FlutterFragment.Builder().build(); * } + *

    + * Subclasses of {@code FlutterFragment} that do not introduce any new arguments can use this + * {@code Builder} to construct instances of the subclass without subclassing this {@code Builder}. + * {@code + * MyFlutterFragment f = new FlutterFragment.Builder(MyFlutterFragment.class) + * .someProperty(...) + * .someOtherProperty(...) + * .build(); + * } + *

    + * Subclasses of {@code FlutterFragment} that introduce new arguments should subclass this + * {@code Builder} to add the new properties: + *

      + *
    1. Ensure the {@code FlutterFragment} subclass has a no-arg constructor.
    2. + *
    3. Subclass this {@code Builder}.
    4. + *
    5. Override the new {@code Builder}'s no-arg constructor and invoke the super constructor + * to set the {@code FlutterFragment} subclass: {@code + * public MyBuilder() { + * super(MyFlutterFragment.class); + * } + * }
    6. + *
    7. Add appropriate property methods for the new properties.
    8. + *
    9. Override {@link Builder#createArgs()}, call through to the super method, then add + * the new properties as arguments in the {@link Bundle}.
    10. + *
    + * Once a {@code Builder} subclass is defined, the {@code FlutterFragment} subclass can be + * instantiated as follows. + * {@code + * MyFlutterFragment f = new MyBuilder() + * .someExistingProperty(...) + * .someNewProperty(...) + * .build(); + * } */ public static class Builder { + private final Class fragmentClass; private String dartEntrypoint = "main"; private String initialRoute = "/"; private String appBundlePath = null; @@ -85,6 +119,22 @@ public static class Builder { private FlutterView.RenderMode renderMode = FlutterView.RenderMode.surface; private FlutterView.TransparencyMode transparencyMode = FlutterView.TransparencyMode.transparent; + /** + * Constructs a {@code Builder} that is configured to construct an instance of + * {@code FlutterFragment}. + */ + public Builder() { + fragmentClass = FlutterFragment.class; + } + + /** + * Constructs a {@code Builder} that is configured to construct an instance of + * {@code subclass}, which extends {@code FlutterFragment}. + */ + public Builder(@NonNull Class subclass) { + fragmentClass = subclass; + } + /** * The name of the initial Dart method to invoke, defaults to "main". */ @@ -149,79 +199,49 @@ public Builder transparencyMode(@NonNull FlutterView.TransparencyMode transparen return this; } + /** + * Creates a {@link Bundle} of arguments that are assigned to the new {@code FlutterFragment}. + *

    + * Subclasses should override this method to add new properties to the {@link Bundle}. Subclasses + * must call through to the super method to collect all existing property values. + */ @NonNull - public FlutterFragment build() { - FlutterFragment frag = new FlutterFragment(); - - Bundle args = createArgsBundle( - dartEntrypoint, - initialRoute, - appBundlePath, - shellArgs, - renderMode, - transparencyMode - ); - frag.setArguments(args); - - return frag; + protected Bundle createArgs() { + Bundle args = new Bundle(); + args.putString(ARG_INITIAL_ROUTE, initialRoute); + args.putString(ARG_APP_BUNDLE_PATH, appBundlePath); + args.putString(ARG_DART_ENTRYPOINT, dartEntrypoint); + // TODO(mattcarroll): determine if we should have an explicit FlutterTestFragment instead of conflating. + if (null != shellArgs) { + args.putStringArray(ARG_FLUTTER_INITIALIZATION_ARGS, shellArgs.toArray()); + } + args.putString(ARG_FLUTTERVIEW_RENDER_MODE, renderMode != null ? renderMode.name() : FlutterView.RenderMode.surface.name()); + args.putString(ARG_FLUTTERVIEW_TRANSPARENCY_MODE, transparencyMode != null ? transparencyMode.name() : FlutterView.TransparencyMode.transparent.name()); + return args; } - } - /** - * Creates a {@link Bundle} of arguments that can be used to configure a {@link FlutterFragment}. - * This method is exposed so that developers can create subclasses of {@link FlutterFragment}. - * Subclasses should declare static factories that use this method to create arguments that will - * be understood by the base class, and then the subclass can add any additional arguments it - * wants to this {@link Bundle}. Example: - *

    {@code
    -   * public static MyFlutterFragment newInstance(String myNewArg) {
    -   *   // Create an instance of your subclass Fragment.
    -   *   MyFlutterFragment myFrag = new MyFlutterFragment();
    -   *
    -   *   // Create the Bundle or args that FlutterFragment understands.
    -   *   Bundle args = FlutterFragment.createArgsBundle(...);
    -   *
    -   *   // Add your new args to the bundle.
    -   *   args.putString(ARG_MY_NEW_ARG, myNewArg);
    -   *
    -   *   // Give the args to your subclass Fragment.
    -   *   myFrag.setArguments(args);
    -   *
    -   *   // Return the newly created subclass Fragment.
    -   *   return myFrag;
    -   * }
    -   * }
    - * - * @param dartEntrypoint the name of the initial Dart method to invoke, defaults to "main" - * @param initialRoute the first route that a Flutter app will render in this {@link FlutterFragment}, defaults to "/" - * @param appBundlePath the path to the app bundle which contains the Dart app to execute - * @param flutterShellArgs any special configuration arguments for the Flutter engine - * @param renderMode render Flutter either as a {@link FlutterView.RenderMode#surface} or a - * {@link FlutterView.RenderMode#texture}. You should use {@code surface} unless - * you have a specific reason to use {@code texture}. {@code texture} comes with - * a significant performance impact, but {@code texture} can be displayed - * beneath other Android {@code View}s and animated, whereas {@code surface} - * cannot. - * - * @return Bundle of arguments that configure a {@link FlutterFragment} - */ - protected static Bundle createArgsBundle(@Nullable String dartEntrypoint, - @Nullable String initialRoute, - @Nullable String appBundlePath, - @Nullable FlutterShellArgs flutterShellArgs, - @Nullable FlutterView.RenderMode renderMode, - @Nullable FlutterView.TransparencyMode transparencyMode) { - Bundle args = new Bundle(); - args.putString(ARG_INITIAL_ROUTE, initialRoute); - args.putString(ARG_APP_BUNDLE_PATH, appBundlePath); - args.putString(ARG_DART_ENTRYPOINT, dartEntrypoint); - // TODO(mattcarroll): determine if we should have an explicit FlutterTestFragment instead of conflating. - if (null != flutterShellArgs) { - args.putStringArray(ARG_FLUTTER_INITIALIZATION_ARGS, flutterShellArgs.toArray()); + /** + * Constructs a new {@code FlutterFragment} (or a subclass) that is configured based on + * properties set on this {@code Builder}. + */ + @NonNull + public T build() { + try { + @SuppressWarnings("unchecked") + T frag = (T) fragmentClass.newInstance(); + if (frag == null) { + throw new RuntimeException("The FlutterFragment subclass sent in the constructor (" + + fragmentClass.getCanonicalName() + ") does not match the expected return type."); + } + + Bundle args = createArgs(); + frag.setArguments(args); + + return frag; + } catch (Exception e) { + throw new RuntimeException("Could not instantiate FlutterFragment subclass (" + fragmentClass.getName() + ")", e); + } } - args.putString(ARG_FLUTTERVIEW_RENDER_MODE, renderMode != null ? renderMode.name() : FlutterView.RenderMode.surface.name()); - args.putString(ARG_FLUTTERVIEW_TRANSPARENCY_MODE, transparencyMode != null ? transparencyMode.name() : FlutterView.TransparencyMode.transparent.name()); - return args; } @Nullable @@ -296,15 +316,24 @@ private void initializeFlutter(@NonNull Context context) { /** * Obtains a reference to a FlutterEngine to back this {@code FlutterFragment}. *

    - * First, the {@link FragmentActivity} that owns this {@code FlutterFragment} is + * First, {@code FlutterFragment} subclasses are given an opportunity to provide a + * {@link FlutterEngine} by overriding {@link #createFlutterEngine(Context)}. + *

    + * Second, the {@link FragmentActivity} that owns this {@code FlutterFragment} is * given the opportunity to provide a {@link FlutterEngine} as a {@link FlutterEngineProvider}. *

    - * If the owning {@link FragmentActivity} does not implement {@link FlutterEngineProvider}, or - * chooses to return {@code null}, then a new {@link FlutterEngine} is instantiated. Subclasses - * may override this method to provide a {@link FlutterEngine} of choice. + * If subclasses do not provide a {@link FlutterEngine}, and the owning {@link FragmentActivity} + * does not implement {@link FlutterEngineProvider} or chooses to return {@code null}, then a new + * {@link FlutterEngine} is instantiated. */ - protected void setupFlutterEngine() { - // First, defer to the FragmentActivity that owns us to see if it wants to provide a + private void setupFlutterEngine() { + // First, defer to subclasses for a custom FlutterEngine. + flutterEngine = createFlutterEngine(getContextCompat()); + if (flutterEngine != null) { + return; + } + + // Second, defer to the FragmentActivity that owns us to see if it wants to provide a // FlutterEngine. FragmentActivity attachedActivity = getActivity(); if (attachedActivity instanceof FlutterEngineProvider) { @@ -315,18 +344,33 @@ protected void setupFlutterEngine() { if (flutterEngine != null) { isFlutterEngineFromActivity = true; } + return; } - // If flutterEngine is null then either our Activity is not a FlutterEngineProvider, - // or our Activity decided that it didn't want to provide a FlutterEngine. Either way, - // we will now create a FlutterEngine for this FlutterFragment. - if (flutterEngine == null) { - // Create a FlutterEngine to back our FlutterView. - Log.d(TAG, "Our attached Activity did not want to provide a FlutterEngine. Creating a " - + "new FlutterEngine for this FlutterFragment."); - flutterEngine = new FlutterEngine(getContext()); - isFlutterEngineFromActivity = false; - } + // Neither our subclass, nor our owning Activity wanted to provide a custom FlutterEngine. + // Create a FlutterEngine to back our FlutterView. + Log.d(TAG, "No subclass or our attached Activity provided a custom FlutterEngine. Creating a " + + "new FlutterEngine for this FlutterFragment."); + flutterEngine = new FlutterEngine(getContext()); + isFlutterEngineFromActivity = false; + } + + /** + * Hook for subclasses to return a {@link FlutterEngine} with whatever configuration + * is desired. + *

    + * This method takes precedence for creation of a {@link FlutterEngine} over any owning + * {@code Activity} that may implement {@link FlutterEngineProvider}. + *

    + * Consider returning a cached {@link FlutterEngine} instance from this method to avoid the + * typical warm-up time that a new {@link FlutterEngine} instance requires. + *

    + * If null is returned then a new default {@link FlutterEngine} will be created to back this + * {@code FlutterFragment}. + */ + @Nullable + protected FlutterEngine createFlutterEngine(@NonNull Context context) { + return null; } @Nullable From a54354349ef2a687675e006fd1991e2322044b76 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 12 Apr 2019 13:04:23 -0700 Subject: [PATCH 0799/1117] Roll src/third_party/dart a8f3a5dae6..c2eb9a9860 (8 commits) c2eb9a9860 Add support to the element model for both lazy variables and required parameters 4ed24862ee [CFE] Extra dummy SDK classes that the constant evaluator needs. ce9a1e2b54 [vm/compiler] Fix write-barrier elimination issue a3d13fbf54 [CFE] Option to report error on unevaluated constants. 394f88d5cf Create source information from ConstantExpression b7b7a63407 Fix relative import from pkg/kernel/test to pkg/kernel/lib. 0136d96a96 [dartdevc] fix #36532, adds DDC support for CFE constant flag 022400eecb Fix several small issues with AST based summaries. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f607b9911edd6..c4b2f21f8aff2 100644 --- a/DEPS +++ b/DEPS @@ -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': 'a8f3a5dae6203d1064726a5953cf06a7d484249c', + 'dart_revision': 'c2eb9a9860a31e573f0a36bd672e340ae3a654ce', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 93d45caaff651..0eab90d46cd73 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 0b5f95400c9ee9dddb24d60108d1f4f3 +Signature: a55c2075aa6674deb4b999c5fe9f47ee UNUSED LICENSES: From 9336671a80b767d4ce91f89666c90475765d752f Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 12 Apr 2019 13:47:15 -0700 Subject: [PATCH 0800/1117] Revert "Roll src/third_party/dart a8f3a5dae6..c2eb9a9860 (8 commits)" (#8567) This reverts commit a54354349ef2a687675e006fd1991e2322044b76. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c4b2f21f8aff2..f607b9911edd6 100644 --- a/DEPS +++ b/DEPS @@ -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': 'c2eb9a9860a31e573f0a36bd672e340ae3a654ce', + 'dart_revision': 'a8f3a5dae6203d1064726a5953cf06a7d484249c', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 0eab90d46cd73..93d45caaff651 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: a55c2075aa6674deb4b999c5fe9f47ee +Signature: 0b5f95400c9ee9dddb24d60108d1f4f3 UNUSED LICENSES: From 7292d62ef8d9da572776a44bc853bf4191137168 Mon Sep 17 00:00:00 2001 From: Kaushik Iska Date: Fri, 12 Apr 2019 14:23:13 -0700 Subject: [PATCH 0801/1117] Revert Versions API (#7828) * Revert "Fix versions implementation (#7726)" This reverts commit 3c38dd342f53d39603d1c5b138b5e4d36d93720f. * Revert "Expose the Flutter engine, Dart and Skia versions to Dart. (#7634)" This reverts commit b94e759b256819fb33cb9d2b41565fc137cac733. * remove namespace shell stuff * fix format * fix licenses --- ci/licenses_golden/licenses_flutter | 7 ++--- lib/ui/BUILD.gn | 3 --- lib/ui/dart_ui.cc | 2 -- lib/ui/dart_ui.gni | 1 - lib/ui/ui.dart | 1 - lib/ui/versions.cc | 31 ---------------------- lib/ui/versions.dart | 37 --------------------------- lib/ui/versions.h | 21 --------------- shell/common/BUILD.gn | 2 +- shell/common/engine.cc | 1 - shell/common/persistent_cache.cc | 2 +- shell/common/switches.cc | 2 +- {common => shell}/version/BUILD.gn | 0 {common => shell}/version/version.cc | 2 +- {common => shell}/version/version.gni | 0 {common => shell}/version/version.h | 6 ++--- testing/dart/versions_test.dart | 32 ----------------------- 17 files changed, 9 insertions(+), 141 deletions(-) delete mode 100644 lib/ui/versions.cc delete mode 100644 lib/ui/versions.dart delete mode 100644 lib/ui/versions.h rename {common => shell}/version/BUILD.gn (100%) rename {common => shell}/version/version.cc (90%) rename {common => shell}/version/version.gni (100%) rename {common => shell}/version/version.h (70%) delete mode 100644 testing/dart/versions_test.dart diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index fcca26c69d678..30bbd785e603f 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -54,8 +54,6 @@ FILE: ../../../flutter/common/settings.cc FILE: ../../../flutter/common/settings.h FILE: ../../../flutter/common/task_runners.cc FILE: ../../../flutter/common/task_runners.h -FILE: ../../../flutter/common/version/version.cc -FILE: ../../../flutter/common/version/version.h FILE: ../../../flutter/flow/compositor_context.cc FILE: ../../../flutter/flow/compositor_context.h FILE: ../../../flutter/flow/debug_print.cc @@ -360,9 +358,6 @@ 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/versions.cc -FILE: ../../../flutter/lib/ui/versions.dart -FILE: ../../../flutter/lib/ui/versions.h FILE: ../../../flutter/lib/ui/window.dart FILE: ../../../flutter/lib/ui/window/platform_message.cc FILE: ../../../flutter/lib/ui/window/platform_message.h @@ -720,6 +715,8 @@ FILE: ../../../flutter/shell/platform/glfw/keyboard_hook_handler.h FILE: ../../../flutter/shell/platform/glfw/public/flutter_glfw.h FILE: ../../../flutter/shell/platform/glfw/text_input_plugin.cc FILE: ../../../flutter/shell/platform/glfw/text_input_plugin.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/third_party/txt/src/txt/platform.cc diff --git a/lib/ui/BUILD.gn b/lib/ui/BUILD.gn index 51dd35ccfbea8..bef50753a4b9e 100644 --- a/lib/ui/BUILD.gn +++ b/lib/ui/BUILD.gn @@ -81,8 +81,6 @@ source_set("ui") { "text/text_box.h", "ui_dart_state.cc", "ui_dart_state.h", - "versions.cc", - "versions.h", "window/platform_message.cc", "window/platform_message.h", "window/platform_message_response.cc", @@ -104,7 +102,6 @@ source_set("ui") { deps = [ "$flutter_root/assets", "$flutter_root/common", - "$flutter_root/common/version", "$flutter_root/flow", "$flutter_root/fml", "$flutter_root/runtime:test_font", diff --git a/lib/ui/dart_ui.cc b/lib/ui/dart_ui.cc index a434db2b95baa..8605d7a960095 100644 --- a/lib/ui/dart_ui.cc +++ b/lib/ui/dart_ui.cc @@ -27,7 +27,6 @@ #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/versions.h" #include "flutter/lib/ui/window/window.h" #include "third_party/tonic/converter/dart_converter.h" #include "third_party/tonic/logging/dart_error.h" @@ -91,7 +90,6 @@ void DartUI::InitForGlobal() { SceneBuilder::RegisterNatives(g_natives); SemanticsUpdate::RegisterNatives(g_natives); SemanticsUpdateBuilder::RegisterNatives(g_natives); - Versions::RegisterNatives(g_natives); Vertices::RegisterNatives(g_natives); Window::RegisterNatives(g_natives); #if defined(OS_FUCHSIA) diff --git a/lib/ui/dart_ui.gni b/lib/ui/dart_ui.gni index 67246f6ef8498..c52a9f025f231 100644 --- a/lib/ui/dart_ui.gni +++ b/lib/ui/dart_ui.gni @@ -16,7 +16,6 @@ dart_ui_files = [ "$flutter_root/lib/ui/semantics.dart", "$flutter_root/lib/ui/text.dart", "$flutter_root/lib/ui/ui.dart", - "$flutter_root/lib/ui/versions.dart", "$flutter_root/lib/ui/window.dart", ] diff --git a/lib/ui/ui.dart b/lib/ui/ui.dart index 5730f4e1378fa..cef4db81cee0e 100644 --- a/lib/ui/ui.dart +++ b/lib/ui/ui.dart @@ -34,5 +34,4 @@ part 'plugins.dart'; part 'pointer.dart'; part 'semantics.dart'; part 'text.dart'; -part 'versions.dart'; part 'window.dart'; diff --git a/lib/ui/versions.cc b/lib/ui/versions.cc deleted file mode 100644 index 0398eccf2963c..0000000000000 --- a/lib/ui/versions.cc +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2013 The Flutter 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/versions.h" -#include "flutter/common/version/version.h" -#include "third_party/tonic/converter/dart_converter.h" -#include "third_party/tonic/dart_library_natives.h" - -#include -#include - -using tonic::DartConverter; - -namespace flutter { - -// returns a vector with 3 versions. -// Dart, Skia and Flutter engine versions in this order. -void GetVersions(Dart_NativeArguments args) { - const std::vector versions_list = { - GetDartVersion(), GetSkiaVersion(), GetFlutterEngineVersion()}; - Dart_Handle dart_val = - DartConverter>::ToDart(versions_list); - Dart_SetReturnValue(args, dart_val); -} - -void Versions::RegisterNatives(tonic::DartLibraryNatives* natives) { - natives->Register({{"Versions_getVersions", GetVersions, 0, true}}); -} - -} // namespace flutter diff --git a/lib/ui/versions.dart b/lib/ui/versions.dart deleted file mode 100644 index 9121234856082..0000000000000 --- a/lib/ui/versions.dart +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -part of dart.ui; - -/// Wraps version information for Dart, Skia and Flutter. -class Versions { - - /// Builds a versions object using the information - /// we get from calling the native getVersions. - factory Versions._internal() { - final List versions = _getVersions(); - return Versions._(versions[0], versions[1], versions[2]); - } - - /// Private constructor to capture the versions. - Versions._( - this.dartVersion, - this.skiaVersion, - this.flutterEngineVersion - ) : assert(dartVersion != null), - assert(skiaVersion != null), - assert(flutterEngineVersion != null); - - /// returns a vector with 3 versions. - /// Dart, Skia and Flutter engine versions in this order. - static List _getVersions() native 'Versions_getVersions'; - - final String dartVersion; - final String skiaVersion; - final String flutterEngineVersion; -} - -/// [Versions] singleton. This object exposes Dart, Skia and -/// Flutter engine versions. -final Versions versions = Versions._internal(); diff --git a/lib/ui/versions.h b/lib/ui/versions.h deleted file mode 100644 index eb18ce380ca64..0000000000000 --- a/lib/ui/versions.h +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Flutter 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_VERSIONS_H_ -#define FLUTTER_LIB_UI_VERSIONS_H_ - -namespace tonic { -class DartLibraryNatives; -} // namespace tonic - -namespace flutter { - -class Versions final { - public: - static void RegisterNatives(tonic::DartLibraryNatives* natives); -}; - -} // namespace flutter - -#endif // FLUTTER_LIB_UI_VERSIONS_H_ diff --git a/shell/common/BUILD.gn b/shell/common/BUILD.gn index 0e5c5b90d71d2..48d949e227e1e 100644 --- a/shell/common/BUILD.gn +++ b/shell/common/BUILD.gn @@ -106,7 +106,7 @@ source_set("common") { ] public_deps = [ - "$flutter_root/common/version", + "$flutter_root/shell/version", "$flutter_root/third_party/txt", "//third_party/rapidjson", "//third_party/tonic", diff --git a/shell/common/engine.cc b/shell/common/engine.cc index 1fe0cfe0295df..4d7da77e85b6b 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -10,7 +10,6 @@ #include #include "flutter/common/settings.h" -#include "flutter/common/version/version.h" #include "flutter/fml/eintr_wrapper.h" #include "flutter/fml/file.h" #include "flutter/fml/make_copyable.h" diff --git a/shell/common/persistent_cache.cc b/shell/common/persistent_cache.cc index 4c110970e05de..ce2b380cd1adc 100644 --- a/shell/common/persistent_cache.cc +++ b/shell/common/persistent_cache.cc @@ -7,13 +7,13 @@ #include #include -#include "flutter/common/version/version.h" #include "flutter/fml/base32.h" #include "flutter/fml/file.h" #include "flutter/fml/make_copyable.h" #include "flutter/fml/mapping.h" #include "flutter/fml/paths.h" #include "flutter/fml/trace_event.h" +#include "flutter/shell/version/version.h" namespace flutter { diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 366923614b3bc..6298772af988f 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -9,10 +9,10 @@ #include #include -#include "flutter/common/version/version.h" #include "flutter/fml/native_library.h" #include "flutter/fml/paths.h" #include "flutter/fml/string_view.h" +#include "flutter/shell/version/version.h" // Include once for the default enum definition. #include "flutter/shell/common/switches.h" diff --git a/common/version/BUILD.gn b/shell/version/BUILD.gn similarity index 100% rename from common/version/BUILD.gn rename to shell/version/BUILD.gn diff --git a/common/version/version.cc b/shell/version/version.cc similarity index 90% rename from common/version/version.cc rename to shell/version/version.cc index db5fb0608001e..72c989381b4ac 100644 --- a/common/version/version.cc +++ b/shell/version/version.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/common/version/version.h" +#include "flutter/shell/version/version.h" namespace flutter { diff --git a/common/version/version.gni b/shell/version/version.gni similarity index 100% rename from common/version/version.gni rename to shell/version/version.gni diff --git a/common/version/version.h b/shell/version/version.h similarity index 70% rename from common/version/version.h rename to shell/version/version.h index 00ab5031db419..cbf3357d6a1ea 100644 --- a/common/version/version.h +++ b/shell/version/version.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_COMMON_VERSION_VERSION_H_ -#define FLUTTER_COMMON_VERSION_VERSION_H_ +#ifndef FLUTTER_SHELL_COMMON_VERSION_H_ +#define FLUTTER_SHELL_COMMON_VERSION_H_ namespace flutter { @@ -15,4 +15,4 @@ const char* GetDartVersion(); } // namespace flutter -#endif // FLUTTER_COMMON_VERSION_VERSION_H_ +#endif // FLUTTER_SHELL_COMMON_VERSION_H_ diff --git a/testing/dart/versions_test.dart b/testing/dart/versions_test.dart deleted file mode 100644 index 91935c76a58bc..0000000000000 --- a/testing/dart/versions_test.dart +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2013 The Flutter 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 'dart:ui'; - -import 'package:test/test.dart'; - -bool _isNotEmpty(String s) { - if (s == null || s.isEmpty) { - return false; - } else { - return true; - } -} - -void main() { - test('dartVersion should not be empty', () { - final String dartVersion = versions.dartVersion; - expect(_isNotEmpty(dartVersion), equals(true)); - }); - - test('skiaVersion should not be empty', () { - final String skiaVersion = versions.skiaVersion; - expect(_isNotEmpty(skiaVersion), equals(true)); - }); - - test('flutterEngineVersion should not be empty', () { - final String flutterEngineVersion = versions.flutterEngineVersion; - expect(_isNotEmpty(flutterEngineVersion), equals(true)); - }); -} From 49a72e1e41c9b252bc8eaa8fec996ca75067f6ee Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 12 Apr 2019 19:03:24 -0400 Subject: [PATCH 0802/1117] Roll src/third_party/skia 8be917af4313..e62bf561638c (5 commits) (#8568) https://skia.googlesource.com/skia.git/%2Blog/8be917af4313..e62bf561638c git log 8be917af4313f6021b9b8e5d2b3f4d5712967aa9..e62bf561638c60550c35e81b1606843ed74bcfef --date=short --no-merges --format=%ad %ae %s 2019-04-12 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-04-11 herb@google.com Convert the CPU mask case to use prepareForDrawing 2019-04-12 herb@google.com Revert "Convert the CPU path case to use prepareForDrawing" 2019-04-12 michaelludwig@google.com Remove debug quadType() checks 2019-04-12 michaelludwig@google.com Support domain clamping and transform matrices in YUVToRGB effects The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f607b9911edd6..b787f5d3ff9e6 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': '8be917af4313f6021b9b8e5d2b3f4d5712967aa9', + 'skia_revision': 'e62bf561638c60550c35e81b1606843ed74bcfef', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 7c27737827b0f..6a06d55e79833 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 0f615c414aeea570c36bdf3addef58eb +Signature: 6b8c1bcb82a7bb982213a08e24bfb734 UNUSED LICENSES: From c3824f06933af54b54d1094594c0159828dd1a45 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 12 Apr 2019 22:33:24 -0400 Subject: [PATCH 0803/1117] Roll src/third_party/skia e62bf561638c..990bfc785891 (2 commits) (#8569) https://skia.googlesource.com/skia.git/%2Blog/e62bf561638c..990bfc785891 git log e62bf561638c60550c35e81b1606843ed74bcfef..990bfc78589117325ce56d18afdfab303c830492 --date=short --no-merges --format=%ad %ae %s 2019-04-12 herb@google.com Convert SkGlyph::toMask() to SkGlyph::mask() 2019-04-11 reed@google.com add utility for caching char2glyph The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index b787f5d3ff9e6..d0e793f2aee86 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': 'e62bf561638c60550c35e81b1606843ed74bcfef', + 'skia_revision': '990bfc78589117325ce56d18afdfab303c830492', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6a06d55e79833..bcc1b966487d1 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 6b8c1bcb82a7bb982213a08e24bfb734 +Signature: f040b5acfcf16a2b7650e7378e70a485 UNUSED LICENSES: @@ -6014,6 +6014,8 @@ FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.h FILE: ../../../third_party/skia/src/sksl/SkSLDefines.h FILE: ../../../third_party/skia/src/sksl/SkSLOutputStream.cpp +FILE: ../../../third_party/skia/src/utils/SkCharToGlyphCache.cpp +FILE: ../../../third_party/skia/src/utils/SkCharToGlyphCache.h ---------------------------------------------------------------------------------------------------- Copyright 2019 Google Inc. From 7c7df0d58b8b6c95eae8c13b397ac7e1e557271a Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Fri, 12 Apr 2019 21:10:23 -0700 Subject: [PATCH 0804/1117] Add null check in FLETextInputPlugin (#8538) Adds a guard on `_activeClientID` in `insertNewline:`. The conditional around the `insertText:replacementRange:` call already catches this, but we then unconditionally pack `_activeClientID` into an `NSArray`, which disallows nil. --- .../macos/framework/Source/FLETextInputPlugin.mm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/shell/platform/darwin/macos/framework/Source/FLETextInputPlugin.mm b/shell/platform/darwin/macos/framework/Source/FLETextInputPlugin.mm index 25079d565c07f..9a2226054f25f 100644 --- a/shell/platform/darwin/macos/framework/Source/FLETextInputPlugin.mm +++ b/shell/platform/darwin/macos/framework/Source/FLETextInputPlugin.mm @@ -242,11 +242,13 @@ - (void)doCommandBySelector:(SEL)selector { } - (void)insertNewline:(id)sender { - if ([self.activeModel.inputType isEqualToString:kMultilineInputType]) { - [self insertText:@"\n" replacementRange:self.activeModel.selectedRange]; + if (self.activeModel != nil) { + if ([self.activeModel.inputType isEqualToString:kMultilineInputType]) { + [self insertText:@"\n" replacementRange:self.activeModel.selectedRange]; + } + [_channel invokeMethod:kPerformAction + arguments:@[ _activeClientID, self.activeModel.inputAction ]]; } - [_channel invokeMethod:kPerformAction - arguments:@[ _activeClientID, self.activeModel.inputAction ]]; } - (void)setMarkedText:(id)string From 9f9d5d6da4202a320dace9e5c18fd3f52e05603b Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 13 Apr 2019 02:17:24 -0400 Subject: [PATCH 0805/1117] Roll src/third_party/skia 990bfc785891..69f54f8f0f22 (1 commits) (#8570) https://skia.googlesource.com/skia.git/%2Blog/990bfc785891..69f54f8f0f22 git log 990bfc78589117325ce56d18afdfab303c830492..69f54f8f0f22a88567ef1a602e1c3beec69972e4 --date=short --no-merges --format=%ad %ae %s 2019-04-13 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d0e793f2aee86..3ea41c3a350ef 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': '990bfc78589117325ce56d18afdfab303c830492', + 'skia_revision': '69f54f8f0f22a88567ef1a602e1c3beec69972e4', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index bcc1b966487d1..9657b9d080caf 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f040b5acfcf16a2b7650e7378e70a485 +Signature: ca9387190ea5df680ce447adc255465f UNUSED LICENSES: From e0b9bc18fe061bae3d193b6b41845b4136041638 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 13 Apr 2019 09:26:24 -0400 Subject: [PATCH 0806/1117] Roll src/third_party/skia 69f54f8f0f22..33233a09fef8 (1 commits) (#8571) https://skia.googlesource.com/skia.git/%2Blog/69f54f8f0f22..33233a09fef8 git log 69f54f8f0f22a88567ef1a602e1c3beec69972e4..33233a09fef8f848164895d66e7f7731265239da --date=short --no-merges --format=%ad %ae %s 2019-04-11 herb@google.com Reland "Convert the CPU path case to use prepareForDrawing" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 3ea41c3a350ef..dd3144c2d95a7 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': '69f54f8f0f22a88567ef1a602e1c3beec69972e4', + 'skia_revision': '33233a09fef8f848164895d66e7f7731265239da', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 9657b9d080caf..8fc29793d9e69 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ca9387190ea5df680ce447adc255465f +Signature: 18619cdde77cc204090abd271a9599df UNUSED LICENSES: From dcd0209bda617fc83e2f784e059f436045abdca3 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 13 Apr 2019 20:50:24 -0400 Subject: [PATCH 0807/1117] Roll src/third_party/skia 33233a09fef8..12cf258193dc (1 commits) (#8572) https://skia.googlesource.com/skia.git/%2Blog/33233a09fef8..12cf258193dc git log 33233a09fef8f848164895d66e7f7731265239da..12cf258193dc2b92c19fafefde28265f1201f578 --date=short --no-merges --format=%ad %ae %s 2019-04-13 herb@google.com Revert "Convert the CPU mask case to use prepareForDrawing" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (egdaniel@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index dd3144c2d95a7..45333d50b627d 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': '33233a09fef8f848164895d66e7f7731265239da', + 'skia_revision': '12cf258193dc2b92c19fafefde28265f1201f578', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 8fc29793d9e69..1f04243f124ad 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 18619cdde77cc204090abd271a9599df +Signature: 07be22e4d9f7d35ff45e105de581e6a9 UNUSED LICENSES: From 14a1db2b65e3126402b68aebfec719edec703e34 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 14 Apr 2019 02:15:07 -0400 Subject: [PATCH 0808/1117] Roll src/third_party/skia 12cf258193dc..5c6b565bdfb9 (1 commits) (#8573) https://skia.googlesource.com/skia.git/%2Blog/12cf258193dc..5c6b565bdfb9 git log 12cf258193dc2b92c19fafefde28265f1201f578..5c6b565bdfb90f0ad0309de09947cb3234f43835 --date=short --no-merges --format=%ad %ae %s 2019-04-14 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 45333d50b627d..1be055c97b54c 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': '12cf258193dc2b92c19fafefde28265f1201f578', + 'skia_revision': '5c6b565bdfb90f0ad0309de09947cb3234f43835', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 1f04243f124ad..525a6e15b0d92 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 07be22e4d9f7d35ff45e105de581e6a9 +Signature: 47d9510e10de921bc25fcfd088f51a60 UNUSED LICENSES: From dc952bcd4f9f8cc0de9539c318b0493d09d1d107 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 14 Apr 2019 05:43:24 -0400 Subject: [PATCH 0809/1117] Roll src/third_party/skia 5c6b565bdfb9..b5e57e9a3d0f (1 commits) (#8575) https://skia.googlesource.com/skia.git/%2Blog/5c6b565bdfb9..b5e57e9a3d0f git log 5c6b565bdfb90f0ad0309de09947cb3234f43835..b5e57e9a3d0f94c0376b44a9ebc6b09b8a3771e8 --date=short --no-merges --format=%ad %ae %s 2019-04-14 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update SKP version The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 1be055c97b54c..dce5bad76f232 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': '5c6b565bdfb90f0ad0309de09947cb3234f43835', + 'skia_revision': 'b5e57e9a3d0f94c0376b44a9ebc6b09b8a3771e8', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 525a6e15b0d92..61ddaa8cd2683 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 47d9510e10de921bc25fcfd088f51a60 +Signature: c1def521e289d751a19a82887e2dce09 UNUSED LICENSES: From 40473d39a8e3df0e138947c669891dae2746c85e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 14 Apr 2019 15:34:24 -0400 Subject: [PATCH 0810/1117] Roll src/third_party/skia b5e57e9a3d0f..c9f55de2ed39 (1 commits) (#8576) https://skia.googlesource.com/skia.git/%2Blog/b5e57e9a3d0f..c9f55de2ed39 git log b5e57e9a3d0f94c0376b44a9ebc6b09b8a3771e8..c9f55de2ed394b278b29c3b9bf686e3c30493734 --date=short --no-merges --format=%ad %ae %s 2019-04-13 herb@google.com Inline computeHinting The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index dce5bad76f232..dc336800699dd 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': 'b5e57e9a3d0f94c0376b44a9ebc6b09b8a3771e8', + 'skia_revision': 'c9f55de2ed394b278b29c3b9bf686e3c30493734', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 61ddaa8cd2683..050ced0c8520d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c1def521e289d751a19a82887e2dce09 +Signature: 96fbf0f0f96f0968ed79fb4e1e5befbc UNUSED LICENSES: From eb575e24abe1fd9e65a6fd11d2d79056c66ed482 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 15 Apr 2019 01:04:24 -0400 Subject: [PATCH 0811/1117] Roll src/third_party/skia c9f55de2ed39..3611ee1bb157 (1 commits) (#8577) https://skia.googlesource.com/skia.git/%2Blog/c9f55de2ed39..3611ee1bb157 git log c9f55de2ed394b278b29c3b9bf686e3c30493734..3611ee1bb157469ab8f4904cd2261dfdc7dee6b6 --date=short --no-merges --format=%ad %ae %s 2019-04-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 13f230772370..64b761a8af9b (23 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index dc336800699dd..b4768b3c12f9c 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': 'c9f55de2ed394b278b29c3b9bf686e3c30493734', + 'skia_revision': '3611ee1bb157469ab8f4904cd2261dfdc7dee6b6', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 050ced0c8520d..a9484932daf00 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 96fbf0f0f96f0968ed79fb4e1e5befbc +Signature: fa8fc30feda951d7f5c45e648e058a72 UNUSED LICENSES: From 42d06b37060aa8e5cd5fbd0f11814f4037675084 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 15 Apr 2019 04:33:24 -0400 Subject: [PATCH 0812/1117] Roll src/third_party/skia 3611ee1bb157..e1c5ea6779f4 (3 commits) (#8578) https://skia.googlesource.com/skia.git/%2Blog/3611ee1bb157..e1c5ea6779f4 git log 3611ee1bb157469ab8f4904cd2261dfdc7dee6b6..e1c5ea6779f431023c54e801c662723b3547381a --date=short --no-merges --format=%ad %ae %s 2019-04-15 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-04-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 cfc73cc1af5e..065f8dc35f9d (12 commits) 2019-04-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 6506f553b36c..b2d31144d9af (500 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index b4768b3c12f9c..5918e0deab030 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': '3611ee1bb157469ab8f4904cd2261dfdc7dee6b6', + 'skia_revision': 'e1c5ea6779f431023c54e801c662723b3547381a', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a9484932daf00..50bc7ecea70d5 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: fa8fc30feda951d7f5c45e648e058a72 +Signature: 220bcafa093e41505fc52fafc5573d3d UNUSED LICENSES: From 73f455a3c1d31680db459dc9650e285676d9f19d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 15 Apr 2019 08:46:24 -0400 Subject: [PATCH 0813/1117] Roll src/third_party/skia e1c5ea6779f4..1fe0b86f17f3 (1 commits) (#8579) https://skia.googlesource.com/skia.git/%2Blog/e1c5ea6779f4..1fe0b86f17f3 git log e1c5ea6779f431023c54e801c662723b3547381a..1fe0b86f17f3bd20fb4ecbf04df6b4ded785255f --date=short --no-merges --format=%ad %ae %s 2019-04-12 robertphillips@google.com Remove some unused GrSurfaceProxy methods The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 5918e0deab030..6d5da5da159ad 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': 'e1c5ea6779f431023c54e801c662723b3547381a', + 'skia_revision': '1fe0b86f17f3bd20fb4ecbf04df6b4ded785255f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 50bc7ecea70d5..3f2fdb0915bb0 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 220bcafa093e41505fc52fafc5573d3d +Signature: bfef4767269d4c89ee39d518ed577b1b UNUSED LICENSES: From b7d484e4f5f8e4738d0b97e8783b78a81526af90 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 15 Apr 2019 12:17:25 -0400 Subject: [PATCH 0814/1117] Roll src/third_party/skia 1fe0b86f17f3..1875353110d1 (5 commits) (#8580) https://skia.googlesource.com/skia.git/%2Blog/1fe0b86f17f3..1875353110d1 git log 1fe0b86f17f3bd20fb4ecbf04df6b4ded785255f..1875353110d12bda6374d099a159937fad48de72 --date=short --no-merges --format=%ad %ae %s 2019-04-15 benjaminwagner@google.com Add LenovoYogaC630 (Win arm64 bot) 2019-04-15 reed@google.com removed localmatrix getter 2019-04-15 brianosman@google.com Extend --writeShaders to output SPIR-V 2019-04-12 egdaniel@google.com Add callback to flush for knowing when gpu is finished work. 2019-04-12 robertphillips@google.com Plumb sk_sp through the GrOpList class hierarchy The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 6d5da5da159ad..c43222e5b990a 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': '1fe0b86f17f3bd20fb4ecbf04df6b4ded785255f', + 'skia_revision': '1875353110d12bda6374d099a159937fad48de72', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3f2fdb0915bb0..2d799e702c55f 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: bfef4767269d4c89ee39d518ed577b1b +Signature: 2b75b64230cb03a20539d4bcf9269748 UNUSED LICENSES: @@ -2165,6 +2165,7 @@ FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.e FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/Test-Mac10.13-Clang-MacBookPro11.5-CPU-AVX2-x86_64-Debug-All-ASAN.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/Test-Ubuntu17-GCC-Golo-GPU-QuadroP400-x86_64-Release-All-Valgrind_AbandonGpuContext_SK_CPU_LIMIT_SSE41.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-Vulkan_ProcDump.json +FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/Test-Win10-MSVC-LenovoYogaC630-GPU-Adreno630-arm64-Debug-All-ANGLE.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/cpu_scale_failed.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/cpu_scale_failed_golo.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/flavor/examples/full.expected/cpu_scale_failed_once.json @@ -2288,6 +2289,7 @@ FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clan 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 +FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-MSVC-LenovoYogaC630-GPU-Adreno630-arm64-Debug-All-ANGLE.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win2016-Clang-GCE-CPU-AVX2-x86_64-Debug-All-FAAA.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win2016-Clang-GCE-CPU-AVX2-x86_64-Debug-All-FSAA.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win2016-MSVC-GCE-CPU-AVX2-x86_64-Debug-All-MSRTC.json From 571ce945bb9aed46b4c1c9b394ab18565e407200 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 15 Apr 2019 15:46:25 -0400 Subject: [PATCH 0815/1117] Roll src/third_party/skia 1875353110d1..bf15b6676843 (8 commits) (#8582) https://skia.googlesource.com/skia.git/%2Blog/1875353110d1..bf15b6676843 git log 1875353110d12bda6374d099a159937fad48de72..bf15b6676843625cf68b9df44705d808cf8236c7 --date=short --no-merges --format=%ad %ae %s 2019-04-15 mtklein@google.com dump stack trace in FM on failure 2019-04-15 scroggo@google.com Implement SkHeifCodec::onRewind 2019-04-15 mtklein@google.com restore vmull_u8() in color32() 2019-04-15 brianosman@google.com Guard GrRadialGradientLayout::TestCreate against Empty shaders 2019-04-15 fmalita@chromium.org [skottie] 'Add' layer blend mode support 2019-04-13 mtklein@google.com step carefully in decal_nofilter_scale 2019-04-15 skia-autoroll@skia-public.iam.gserviceaccount.com Roll skia/third_party/skcms 0da672fc2c69..668026c511f3 (1 commits) 2019-04-12 mtklein@google.com always zero SkMallocPixelRefs The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c43222e5b990a..dd9c2785de902 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': '1875353110d12bda6374d099a159937fad48de72', + 'skia_revision': 'bf15b6676843625cf68b9df44705d808cf8236c7', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2d799e702c55f..7e8bc10f78de5 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2b75b64230cb03a20539d4bcf9269748 +Signature: c3dc0e107b8c4e016760548925328356 UNUSED LICENSES: From 324b8403e8a67db7376f85ed29e0a5792174cca0 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 15 Apr 2019 12:57:45 -0700 Subject: [PATCH 0816/1117] Remove the flutter_aot GN argument. (#8581) This argument has been defunct for a while. It was originally added as a means of testing the AOT machinery in debug modes. --- common/config.gni | 7 ------- tools/gn | 6 ------ 2 files changed, 13 deletions(-) diff --git a/common/config.gni b/common/config.gni index f81be4aac0e7a..315621ccf4a67 100644 --- a/common/config.gni +++ b/common/config.gni @@ -11,9 +11,6 @@ if (target_cpu == "arm" || target_cpu == "arm64") { } declare_args() { - # Enable ahead-of-time compilation on platforms where AOT is optional. - flutter_aot = false - # The runtime mode ("debug", "profile", "release", "dynamic_profile", or "dynamic_release") flutter_runtime_mode = "debug" } @@ -41,7 +38,3 @@ if (flutter_runtime_mode == "debug") { } else { feature_defines_list += [ "FLUTTER_RUNTIME_MODE=0" ] } - -if (flutter_aot) { - feature_defines_list += [ "FLUTTER_AOT=1" ] -} diff --git a/tools/gn b/tools/gn index 7dacacf0651a4..c589e82e09320 100755 --- a/tools/gn +++ b/tools/gn @@ -110,18 +110,13 @@ def to_gn_args(args): # The GN arg is not available in the windows toolchain. gn_args['enable_lto'] = enable_lto - aot = not runtime_mode in ['debug', 'dynamic_profile', 'dynamic_release'] if args.target_os == 'android': gn_args['target_os'] = 'android' elif args.target_os == 'ios': gn_args['target_os'] = 'ios' 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 gn_args['dart_lib_export_symbols'] = False @@ -189,7 +184,6 @@ def to_gn_args(args): gn_args["host_cpu"] = "x86" gn_args['flutter_runtime_mode'] = runtime_mode - gn_args['flutter_aot'] = aot if args.target_sysroot: gn_args['target_sysroot'] = args.target_sysroot From 0575a9b46e994170ce1290f0025623138411dd13 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 15 Apr 2019 19:14:59 -0400 Subject: [PATCH 0817/1117] Roll src/third_party/skia bf15b6676843..d51d00745b1d (6 commits) (#8584) https://skia.googlesource.com/skia.git/%2Blog/bf15b6676843..d51d00745b1d git log bf15b6676843625cf68b9df44705d808cf8236c7..d51d00745b1ddad78b777973c9df56d351ff5e02 --date=short --no-merges --format=%ad %ae %s 2019-04-15 mtklein@google.com add _M_ARM64 support 2019-04-15 csmartdalton@google.com Support multisample in GrProxyProvider::MakeFullyLazyProxy 2019-04-15 mtklein@google.com add retries to fm_bot 2019-04-15 jvanverth@google.com Fix fontcache GMs on Metal. 2019-04-15 reed@google.com use slope-guess for faster charToGlyph 2019-04-11 herb@google.com Reland "Convert the CPU mask case to use prepareForDrawing" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index dd9c2785de902..045a5f7b5ad44 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': 'bf15b6676843625cf68b9df44705d808cf8236c7', + 'skia_revision': 'd51d00745b1ddad78b777973c9df56d351ff5e02', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 7e8bc10f78de5..40bba3785825d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c3dc0e107b8c4e016760548925328356 +Signature: c15d1d88a20c0b676e6b7fe141f0272a UNUSED LICENSES: From 9970fb5500710471c031cb86f899bfc3f4a6bafd Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 15 Apr 2019 22:43:24 -0400 Subject: [PATCH 0818/1117] Roll src/third_party/skia d51d00745b1d..9d10206b7add (1 commits) (#8586) https://skia.googlesource.com/skia.git/%2Blog/d51d00745b1d..9d10206b7add git log d51d00745b1ddad78b777973c9df56d351ff5e02..9d10206b7add9da6a7e34cf0262cc3cf2e7cba41 --date=short --no-merges --format=%ad %ae %s 2019-04-15 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 045a5f7b5ad44..8f8ff51275bdd 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': 'd51d00745b1ddad78b777973c9df56d351ff5e02', + 'skia_revision': '9d10206b7add9da6a7e34cf0262cc3cf2e7cba41', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 40bba3785825d..fa6c60012f0e0 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c15d1d88a20c0b676e6b7fe141f0272a +Signature: 8788173c372eabf66dd7de61ce4f0d0c UNUSED LICENSES: From d8a2a55a647cc03ed141851a0f89bb298c7c748b Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 16 Apr 2019 02:11:24 -0400 Subject: [PATCH 0819/1117] Roll src/third_party/skia 9d10206b7add..5bee533ef3a3 (4 commits) (#8587) https://skia.googlesource.com/skia.git/%2Blog/9d10206b7add..5bee533ef3a3 git log 9d10206b7add9da6a7e34cf0262cc3cf2e7cba41..5bee533ef3a37c952ed227263be1b6fa508310c7 --date=short --no-merges --format=%ad %ae %s 2019-04-16 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-04-16 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 065f8dc35f9d..e7da32f1c73e (7 commits) 2019-04-16 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src b2d31144d9af..95629c4c410f (449 commits) 2019-04-16 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 64b761a8af9b..25be5bb97518 (11 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 8f8ff51275bdd..7c82805529e86 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': '9d10206b7add9da6a7e34cf0262cc3cf2e7cba41', + 'skia_revision': '5bee533ef3a37c952ed227263be1b6fa508310c7', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index fa6c60012f0e0..6e350daf1a971 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8788173c372eabf66dd7de61ce4f0d0c +Signature: 64d47f2cbf610933aed9ede1b13495e9 UNUSED LICENSES: From 7d1da567434a820853ed6fae1f6ed65b9de5ba4f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 16 Apr 2019 10:27:27 -0400 Subject: [PATCH 0820/1117] Roll src/third_party/skia 5bee533ef3a3..6c431d52020c (1 commits) (#8589) https://skia.googlesource.com/skia.git/%2Blog/5bee533ef3a3..6c431d52020c git log 5bee533ef3a37c952ed227263be1b6fa508310c7..6c431d52020c6ed8d48681c9443ec3131fd0ed34 --date=short --no-merges --format=%ad %ae %s 2019-04-15 brianosman@google.com Towards a simpler SkSL -> GLSL pipeline (and better shader reflection) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 7c82805529e86..18fb66a261446 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': '5bee533ef3a37c952ed227263be1b6fa508310c7', + 'skia_revision': '6c431d52020c6ed8d48681c9443ec3131fd0ed34', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6e350daf1a971..b2f006c0c2889 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 64d47f2cbf610933aed9ede1b13495e9 +Signature: 92d0339ce145006f8f1f584f35c38078 UNUSED LICENSES: From d2eeceb949f828f970c40849cbba608493a8b45b Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 16 Apr 2019 13:57:24 -0400 Subject: [PATCH 0821/1117] Roll src/third_party/skia 6c431d52020c..68aeec07de4a (7 commits) (#8590) https://skia.googlesource.com/skia.git/%2Blog/6c431d52020c..68aeec07de4a git log 6c431d52020c6ed8d48681c9443ec3131fd0ed34..68aeec07de4a1894a5cefde405abcb5a49801df6 --date=short --no-merges --format=%ad %ae %s 2019-04-16 bsalomon@google.com Clarify that buffers of type GrGpuBufferType::kXferGpuToCpu are mapped for reading. 2019-04-16 jvanverth@google.com Convert 565 and 4444 bitmaps to 8888 for Mac Metal. 2019-04-15 csmartdalton@google.com Don't flush pipeline state when querying sample locations in GL 2019-04-15 mtklein@google.com just some refactoring for fm_bot.go 2019-04-15 egdaniel@google.com Remove deprecated SkSurface::prepareForExternalIO and related uses of the name. 2019-04-10 bsalomon@google.com GrSurface -> GrGpuBuffer transfer improvements: 2019-04-10 bsalomon@google.com Avoid multiplication by alpha in fragment shader when known to be 1. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 18fb66a261446..bd1ac0c3412bb 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': '6c431d52020c6ed8d48681c9443ec3131fd0ed34', + 'skia_revision': '68aeec07de4a1894a5cefde405abcb5a49801df6', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b2f006c0c2889..cbcc4e3eff4a3 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 92d0339ce145006f8f1f584f35c38078 +Signature: 1f1d4e10470c3d2050811a5a9e0f9e1a UNUSED LICENSES: @@ -6010,8 +6010,11 @@ FILE: ../../../third_party/skia/src/gpu/GrSamplePatternDictionary.h FILE: ../../../third_party/skia/src/gpu/ccpr/GrGSCoverageProcessor.h FILE: ../../../third_party/skia/src/gpu/ccpr/GrVSCoverageProcessor.h FILE: ../../../third_party/skia/src/gpu/effects/GrMixerEffect.fp +FILE: ../../../third_party/skia/src/gpu/effects/GrOverrideInputFragmentProcessor.fp FILE: ../../../third_party/skia/src/gpu/effects/generated/GrMixerEffect.cpp FILE: ../../../third_party/skia/src/gpu/effects/generated/GrMixerEffect.h +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrOverrideInputFragmentProcessor.cpp +FILE: ../../../third_party/skia/src/gpu/effects/generated/GrOverrideInputFragmentProcessor.h FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.cpp FILE: ../../../third_party/skia/src/gpu/vk/GrVkSecondaryCBDrawContext.h FILE: ../../../third_party/skia/src/sksl/SkSLDefines.h From 7af3f2b9e7c5f911ef4b1cff37aa5088fad6dbf5 Mon Sep 17 00:00:00 2001 From: Vyacheslav Egorov Date: Tue, 16 Apr 2019 22:43:59 +0200 Subject: [PATCH 0822/1117] Roll buildroot to ce7b5c786a12927c9e0b4543af267d48c52e0b3a (#8593) ce7b5c7 Don't assume anything above SSE2 when compiling X64 code (e.g. dart binary) (#233) --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index bd1ac0c3412bb..be525020c43bc 100644 --- a/DEPS +++ b/DEPS @@ -121,7 +121,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '94695026d9a1d8963089a470eef26470312c5b00', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'ce7b5c786a12927c9e0b4543af267d48c52e0b3a', # Fuchsia compatibility # From 28a46d51a072eeba6b4c5b8ac5372b5552b3dd95 Mon Sep 17 00:00:00 2001 From: Qxyat Date: Wed, 17 Apr 2019 05:13:34 +0800 Subject: [PATCH 0823/1117] Composite Embedded Views with the correct GrContext PaintRecorder Canvases are not associated with GrContexts. --- flow/layers/layer.h | 1 + flow/layers/layer_tree.cc | 2 ++ flow/layers/performance_overlay_layer_unittests.cc | 2 +- flow/layers/texture_layer.cc | 3 ++- flow/raster_cache.cc | 1 + flow/texture.h | 5 ++++- shell/platform/android/android_external_texture_gl.cc | 3 ++- shell/platform/android/android_external_texture_gl.h | 5 ++++- shell/platform/darwin/ios/ios_external_texture_gl.h | 2 +- shell/platform/darwin/ios/ios_external_texture_gl.mm | 8 ++++++-- shell/platform/embedder/embedder_external_texture_gl.cc | 3 ++- shell/platform/embedder/embedder_external_texture_gl.h | 5 ++++- 12 files changed, 30 insertions(+), 10 deletions(-) diff --git a/flow/layers/layer.h b/flow/layers/layer.h index e846d353e52e9..8cb9b6710cce7 100644 --- a/flow/layers/layer.h +++ b/flow/layers/layer.h @@ -80,6 +80,7 @@ class Layer { // layers. SkCanvas* internal_nodes_canvas; SkCanvas* leaf_nodes_canvas; + GrContext* gr_context; ExternalViewEmbedder* view_embedder; const Stopwatch& frame_time; const Stopwatch& engine_time; diff --git a/flow/layers/layer_tree.cc b/flow/layers/layer_tree.cc index fbe3c2178e75f..08a1990da12d8 100644 --- a/flow/layers/layer_tree.cc +++ b/flow/layers/layer_tree.cc @@ -81,6 +81,7 @@ void LayerTree::Paint(CompositorContext::ScopedFrame& frame, Layer::PaintContext context = { (SkCanvas*)&internal_nodes_canvas, frame.canvas(), + frame.gr_context(), frame.view_embedder(), frame.context().frame_time(), frame.context().engine_time(), @@ -128,6 +129,7 @@ sk_sp LayerTree::Flatten(const SkRect& bounds) { (SkCanvas*)&internal_nodes_canvas, canvas, // canvas nullptr, + nullptr, unused_stopwatch, // frame time (dont care) unused_stopwatch, // engine time (dont care) unused_texture_registry, // texture registry (not supported) diff --git a/flow/layers/performance_overlay_layer_unittests.cc b/flow/layers/performance_overlay_layer_unittests.cc index cee659f925bbd..db7e2c4c67b24 100644 --- a/flow/layers/performance_overlay_layer_unittests.cc +++ b/flow/layers/performance_overlay_layer_unittests.cc @@ -48,7 +48,7 @@ TEST(PerformanceOverlayLayer, Gold) { flow::TextureRegistry unused_texture_registry; flow::Layer::PaintContext paintContext = { - nullptr, surface->getCanvas(), nullptr, mock_stopwatch, + nullptr, surface->getCanvas(), nullptr, nullptr, mock_stopwatch, mock_stopwatch, unused_texture_registry, nullptr, false}; // Specify font file to ensure the same font across different operation diff --git a/flow/layers/texture_layer.cc b/flow/layers/texture_layer.cc index df845caf80215..0b121d8a208e7 100644 --- a/flow/layers/texture_layer.cc +++ b/flow/layers/texture_layer.cc @@ -23,7 +23,8 @@ void TextureLayer::Paint(PaintContext& context) const { if (!texture) { return; } - texture->Paint(*context.leaf_nodes_canvas, paint_bounds(), freeze_); + texture->Paint(*context.leaf_nodes_canvas, paint_bounds(), freeze_, + context.gr_context); } } // namespace flow diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index 73271ea6bafc0..004934a88dbea 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -166,6 +166,7 @@ void RasterCache::Prepare(PrerollContext* context, Layer::PaintContext paintContext = { (SkCanvas*)&internal_nodes_canvas, canvas, + context->gr_context, nullptr, context->frame_time, context->engine_time, diff --git a/flow/texture.h b/flow/texture.h index 414a11dc820e8..6573b88618c8d 100644 --- a/flow/texture.h +++ b/flow/texture.h @@ -22,7 +22,10 @@ class Texture { virtual ~Texture(); // Called from GPU thread. - virtual void Paint(SkCanvas& canvas, const SkRect& bounds, bool freeze) = 0; + virtual void Paint(SkCanvas& canvas, + const SkRect& bounds, + bool freeze, + GrContext* context) = 0; // Called from GPU thread. virtual void OnGrContextCreated() = 0; diff --git a/shell/platform/android/android_external_texture_gl.cc b/shell/platform/android/android_external_texture_gl.cc index bd38598b66bfb..0acd0c8337d25 100644 --- a/shell/platform/android/android_external_texture_gl.cc +++ b/shell/platform/android/android_external_texture_gl.cc @@ -32,7 +32,8 @@ void AndroidExternalTextureGL::MarkNewFrameAvailable() { void AndroidExternalTextureGL::Paint(SkCanvas& canvas, const SkRect& bounds, - bool freeze) { + bool freeze, + GrContext* context) { if (state_ == AttachmentState::detached) { return; } diff --git a/shell/platform/android/android_external_texture_gl.h b/shell/platform/android/android_external_texture_gl.h index 7db744caae280..4f2514a2d51ba 100644 --- a/shell/platform/android/android_external_texture_gl.h +++ b/shell/platform/android/android_external_texture_gl.h @@ -19,7 +19,10 @@ class AndroidExternalTextureGL : public flow::Texture { ~AndroidExternalTextureGL() override; - void Paint(SkCanvas& canvas, const SkRect& bounds, bool freeze) override; + void Paint(SkCanvas& canvas, + const SkRect& bounds, + bool freeze, + GrContext* context) override; void OnGrContextCreated() override; diff --git a/shell/platform/darwin/ios/ios_external_texture_gl.h b/shell/platform/darwin/ios/ios_external_texture_gl.h index d583c85c0eca9..360de25a1ce73 100644 --- a/shell/platform/darwin/ios/ios_external_texture_gl.h +++ b/shell/platform/darwin/ios/ios_external_texture_gl.h @@ -18,7 +18,7 @@ class IOSExternalTextureGL : public flow::Texture { ~IOSExternalTextureGL() override; // Called from GPU thread. - void Paint(SkCanvas& canvas, const SkRect& bounds, bool freeze) override; + void Paint(SkCanvas& canvas, const SkRect& bounds, bool freeze, GrContext* context) override; void OnGrContextCreated() override; diff --git a/shell/platform/darwin/ios/ios_external_texture_gl.mm b/shell/platform/darwin/ios/ios_external_texture_gl.mm index 3e0e2d2d73b66..ff0be31447d40 100644 --- a/shell/platform/darwin/ios/ios_external_texture_gl.mm +++ b/shell/platform/darwin/ios/ios_external_texture_gl.mm @@ -22,7 +22,10 @@ IOSExternalTextureGL::~IOSExternalTextureGL() = default; -void IOSExternalTextureGL::Paint(SkCanvas& canvas, const SkRect& bounds, bool freeze) { +void IOSExternalTextureGL::Paint(SkCanvas& canvas, + const SkRect& bounds, + bool freeze, + GrContext* context) { if (!cache_ref_) { CVOpenGLESTextureCacheRef cache; CVReturn err = CVOpenGLESTextureCacheCreate(kCFAllocatorDefault, NULL, @@ -58,8 +61,9 @@ CVOpenGLESTextureGetName(texture_ref_), GL_RGBA8_OES}; GrBackendTexture backendTexture(bounds.width(), bounds.height(), GrMipMapped::kNo, textureInfo); sk_sp image = - SkImage::MakeFromTexture(canvas.getGrContext(), backendTexture, kTopLeft_GrSurfaceOrigin, + SkImage::MakeFromTexture(context, backendTexture, kTopLeft_GrSurfaceOrigin, kRGBA_8888_SkColorType, kPremul_SkAlphaType, nullptr); + FML_DCHECK(image) << "Failed to create SkImage from Texture."; if (image) { canvas.drawImage(image, bounds.x(), bounds.y()); } diff --git a/shell/platform/embedder/embedder_external_texture_gl.cc b/shell/platform/embedder/embedder_external_texture_gl.cc index 80a49ee5db06d..d4cdd88f3aea8 100644 --- a/shell/platform/embedder/embedder_external_texture_gl.cc +++ b/shell/platform/embedder/embedder_external_texture_gl.cc @@ -20,7 +20,8 @@ EmbedderExternalTextureGL::~EmbedderExternalTextureGL() = default; // |flow::Texture| void EmbedderExternalTextureGL::Paint(SkCanvas& canvas, const SkRect& bounds, - bool freeze) { + bool freeze, + GrContext* context) { if (auto image = external_texture_callback_( Id(), // canvas.getGrContext(), // diff --git a/shell/platform/embedder/embedder_external_texture_gl.h b/shell/platform/embedder/embedder_external_texture_gl.h index c99b165236027..3381bc6969b74 100644 --- a/shell/platform/embedder/embedder_external_texture_gl.h +++ b/shell/platform/embedder/embedder_external_texture_gl.h @@ -27,7 +27,10 @@ class EmbedderExternalTextureGL : public flow::Texture { sk_sp last_image_; // |flow::Texture| - void Paint(SkCanvas& canvas, const SkRect& bounds, bool freeze) override; + void Paint(SkCanvas& canvas, + const SkRect& bounds, + bool freeze, + GrContext* context) override; // |flow::Texture| void OnGrContextCreated() override; From c0ee647ca4226fcb38a5af178a97ce8ba9129184 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 16 Apr 2019 17:30:04 -0400 Subject: [PATCH 0824/1117] Roll src/third_party/skia 68aeec07de4a..db13d3874846 (16 commits) (#8595) https://skia.googlesource.com/skia.git/%2Blog/68aeec07de4a..db13d3874846 git log 68aeec07de4a1894a5cefde405abcb5a49801df6..db13d38748462b713beeeed33fb0eb9d95c1270e --date=short --no-merges --format=%ad %ae %s 2019-04-16 bungeman@google.com Move SkTLazy.h to src/ 2019-04-16 mtklein@google.com Reland "align skvx::Vec<N,T> to N*sizeof(T)" 2019-04-16 borenet@google.com [infra] Add chrome_release_branch script 2019-04-16 mtklein@google.com roll libpng to 1.6.37 2019-04-16 mtklein@google.com pass SkVx::Vec arguments as const& 2019-04-16 egdaniel@google.com Revert "Add GrDisableColorXPFactory::makeXferProcessor()" 2019-04-16 bungeman@google.com Remove generateCharFromGlyph and charToGlyphID. 2019-04-16 ethannicholas@google.com added more SPIR-V RelaxedPrecision decorations 2019-04-16 mtklein@google.com Revert "align skvx::Vec<N,T> to N*sizeof(T)" 2019-04-16 herb@google.com Reduce use of path generation 2019-04-16 mtklein@google.com align skvx::Vec<N,T> to N*sizeof(T) 2019-04-16 csmartdalton@google.com Add GrDisableColorXPFactory::makeXferProcessor() 2019-04-16 bsalomon@google.com Ensure that insetting for blur texture domain doesn't invert domain rect. 2019-04-16 bungeman@google.com Remove deprecated SkPaintFilterCanvas::onFilter. 2019-04-16 kjlubick@google.com WASM build cleanups 2019-04-16 herb@google.com Remove non-canonical font color The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index be525020c43bc..a7d945dc22e4c 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': '68aeec07de4a1894a5cefde405abcb5a49801df6', + 'skia_revision': 'db13d38748462b713beeeed33fb0eb9d95c1270e', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index cbcc4e3eff4a3..9297cf25e3f3a 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 1f1d4e10470c3d2050811a5a9e0f9e1a +Signature: e4826915478bc70bedc3991b23ebc9bd UNUSED LICENSES: @@ -2806,7 +2806,6 @@ FILE: ../../../third_party/skia/include/core/SkImageEncoder.h FILE: ../../../third_party/skia/include/core/SkImageFilter.h FILE: ../../../third_party/skia/include/core/SkMatrix44.h FILE: ../../../third_party/skia/include/core/SkSize.h -FILE: ../../../third_party/skia/include/core/SkTLazy.h FILE: ../../../third_party/skia/include/effects/SkLayerDrawLooper.h FILE: ../../../third_party/skia/include/gpu/GrRenderTarget.h FILE: ../../../third_party/skia/include/gpu/GrTexture.h @@ -2897,6 +2896,7 @@ FILE: ../../../third_party/skia/src/core/SkPictureRecord.h FILE: ../../../third_party/skia/src/core/SkPixelRef.cpp FILE: ../../../third_party/skia/src/core/SkPtrRecorder.cpp FILE: ../../../third_party/skia/src/core/SkReadBuffer.h +FILE: ../../../third_party/skia/src/core/SkTLazy.h FILE: ../../../third_party/skia/src/core/SkTypefaceCache.cpp FILE: ../../../third_party/skia/src/core/SkTypefaceCache.h FILE: ../../../third_party/skia/src/core/SkUnPreMultiply.cpp From db36d28ed074b8b4f018ce6f7cb93b4e8ffcf456 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 16 Apr 2019 15:20:08 -0700 Subject: [PATCH 0825/1117] Roll src/third_party/dart a8f3a5dae6..8e73b3c006 (92 commits) 8e73b3c006 Enable ui-as-code features. 698800a902 [ VM / Service ] Initialize ThreadInterrupter state even if profiler isn't enabled. e7f75e11ae Add more checks for manifest 4b7d256a06 Revert "Enable constant-update-2018 by default." and "Update .expect files in pkg/front_end after e9ca6a53" ecdbdf00b8 [dartdevc] Retry ddc incremental compile on crash 6dc209e858 [tests] UI-as-Code in const collections is a compile time error f175b0baf8 Report errors for using control-flow and spread features in a const context 73d99df7e0 Report when a potentially nullable type is used in an on clause 80dd5ca3d4 new "modifier out of order" error code 9070d6ae61 [dart/vm] Inspect shift constant in absence of range analysis 49607d13e2 Bump markdown to 2.0.3 1642934663 [vm, interpreter] Emit only one copy of exception processing. 41e9878348 Unbreak two tests that were failing on Windows. cef1e31284 Rewrite AST for implicit instance creation. 6e28c24a01 [vm/compiler/bytecode] Ensure CheckStackOverflow is in the join block 5af34ea93d [CFE] Handle invalid constant string interpolation in unevaluated constant expressions 457a781bd7 Reland "Do not append `!` to type names in tests that exercise NullabilitySuffix.none." 2b4d27bf6f Fix test_unresolved_annotation_instanceCreation_argument_super. c3428c9342 Disallow UI-as-code in constants if constant-update-2018 is disabled. a8e8b2c426 [vm/compiler] Elide DebugStepCheck instructions in PRODUCT mode 4b19ca1489 Add language_2 tests for NNBD null-assertion operator (!) 2768cce4bf Revert "Do not append `!` to type names in tests that exercise NullabilitySuffix.none." 8188e02661 Create ConstFieldElementImpl for final instance fields in classes with const constructors. 6761015e30 Fixes for unresolved and invalid URIs. 890d12fa47 Do not append `!` to type names in tests that exercise NullabilitySuffix.none. 2f77be6dc7 Fix overzealous rename. 58ff41ad33 Add test for static tear-off e0bb1c8a58 [dartdevc] switch DDC tests to use Kernel files 32f5223119 Search all directories when attempting to analyze manifest files 5319d76b5a Run ddc worker tests a63bf3c846 [vm] Don't call the debug step check stub or bytecode in PRODUCT mode. f8c1cc7c24 Update the output for the generated Outline.java to compile. Outline.java has a special fromJson() method special cased in codegen_java_types.dart that was not updated when fields were added to the protocol. 144bfdfce6 [vm] Use a separate kind tag for static field initializers. 92c14cb7ef [fuchsia] Mark subprocess images as executable f0ae4de9a7 [ VM / Service ] Fixed GetCpuProfileTimeline which was attempting to parse 64-bit values as if they were 32 bits. bd4576174e Remove the nullability variants of dynamic, bottom, and void. a82a35af71 Rework _checkForDeadNullCoalesce using `isNonNullable`. fa5440a568 Fix a typo in the comments 77d096ca94 Add AST representation of the required keyword f315727b79 Add basic resolution semantics for null-assertion operator 067293b7fc Update the copyright year to 2019 before pushing DAS 1.26.0 version to the Dart plugin 3937751b94 Switch AST summaries tests from the hardcoded SDK to MockSdk. 369c9653c6 Store 'definingType' for next to raw Element references. b9eb7c312c Add nullability testing methods to TypeSystem 55ff0abde5 Rework building types for type annotations and declarations. 76e62d83e3 [vm/precompiler,const eval] Properly handle constant closures with delayed type args. 0b6c61dbd3 tests for issue 36055 ae05bc6ec5 Add support for the type Never 92b4f78148 Fix warnings discovered during Apr 15 analyzer/front_end roll. 79974bb026 Rename Nullability enum to avoid confusion with spec. e42a8032fb [cfe] Remove uninferred initializers from outlines 4b42f87971 Remove unused import 193458abaa Return the keyword from childEntities for import and export directives d3e00fd35e Update .expect files in pkg/front_end after e9ca6a53 b997b59c09 Include manifest in the list of files to analyze ec0447db5d Add support for using ExpectedError and convert a couple of tests over to use it ea8d6e6fa9 Rename some error checking methods 3e6fd64a8a Dependencies based type inference with AST summaries. c18c1f4bfb [fuchsia] Use Unmap() instead of zx_vmar_unmap() 0aa5547de1 Add missed tests and fix bug 22a843a23d Fix precedence of postfix "!" operator f3dbfee467 Fix the error message template for EXPERIMENT_NOT_ENABLED. 2e7bd1359d parse dart language version comment e89850f95d Move STRICT_RAW_TYPE on constructors to INFERENCE_FAILURE_ON_INSTANCE_CREATION 381f94522c [fuchsia] Fix vmo leak 61bb30822b Revert "[VM-debugger] resolve column breakpoint tokenposition into a single value" 0314d86af4 Add errors when a nullable type is used as a supertype 9cc008e49c [vm/bytecode] Add bytecode instructions for double operations 734c50cbf2 [vm/bytecode] Update expectations for bytecode generator unit test 3714658d0f [vm] Fix Win32 build broken by 2a237327b220d54f64469484d35a02b641914053 1ca57fc729 Update cfe_constant_evaluation_test and remove old constant-expression tests now that constant-update-2018 is on by default 2d1440b848 [VM-debugger] resolve column breakpoint tokenposition into a single value 0d65bb9ab3 [VM] Adjust the expected results for get_source_report_test.dart 7b893ce825 Check return value from Dart_PostCObject() in sample extension 47520b1856 test.py plumbing for ABI versions 25cb45c02f [vm/aot/tfa] Update TFA tests after front-end starts evaluating constants 6c5709c44a Remove the URI of types until we can produce better URIs 2a237327b2 [vm/compiler] Take into account all redefinitions when computing aliasing. bc5cc91fef Fix the command line for getting the Git head short hash 85f623374a Triage and fix some more tests. 5746227588 Support for configurations in import/export directives. e9ca6a5335 Enable constant-update-2018 by default. 125ee3b719 [vm/compiler/aot] Avoid using EnterCallRuntimeFrame/LeaveCallRuntimeFrame due to code size of register spilling d81783ff5f Begin writing language_2 tests for NNBD. c2eb9a9860 Add support to the element model for both lazy variables and required parameters 4ed24862ee [CFE] Extra dummy SDK classes that the constant evaluator needs. ce9a1e2b54 [vm/compiler] Fix write-barrier elimination issue a3d13fbf54 [CFE] Option to report error on unevaluated constants. 394f88d5cf Create source information from ConstantExpression b7b7a63407 Fix relative import from pkg/kernel/test to pkg/kernel/lib. 0136d96a96 [dartdevc] fix #36532, adds DDC support for CFE constant flag 022400eecb Fix several small issues with AST based summaries. --- DEPS | 4 ++-- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index a7d945dc22e4c..8803f499da96c 100644 --- a/DEPS +++ b/DEPS @@ -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': 'a8f3a5dae6203d1064726a5953cf06a7d484249c', + 'dart_revision': '8e73b3c006468c234675d5cb753f9537cd310bd5', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py @@ -62,7 +62,7 @@ vars = { 'dart_json_rpc_2_tag': '2.0.9', 'dart_linter_tag': '0.1.86', 'dart_logging_tag': '0.11.3+2', - 'dart_markdown_tag': '2.0.2', + 'dart_markdown_tag': '2.0.3', 'dart_matcher_tag': '0.12.3', 'dart_mime_tag': '0.9.6+2', 'dart_mockito_tag': 'd39ac507483b9891165e422ec98d9fb480037c8b', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 93d45caaff651..d6919e361071d 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 0b5f95400c9ee9dddb24d60108d1f4f3 +Signature: 78817383b5866c29157d2ebca6d4fb40 UNUSED LICENSES: From b819b62bed3ffedf729ac1daddcc8bf7885e9982 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Tue, 16 Apr 2019 16:33:07 -0700 Subject: [PATCH 0826/1117] Variant type for C++ client wrapper (#8592) Adds a type that can hold any of the types corresponding to the Dart types that are supported by the standard message channel codec. This provides the foundation for adding standard message codec support for the C++ desktop shells (flutter/flutter#30670). --- ci/licenses_golden/licenses_flutter | 2 + .../common/cpp/client_wrapper/BUILD.gn | 2 + .../encodable_value_unittests.cc | 329 ++++++++++ .../include/flutter/encodable_value.h | 569 ++++++++++++++++++ 4 files changed, 902 insertions(+) create mode 100644 shell/platform/common/cpp/client_wrapper/encodable_value_unittests.cc create mode 100644 shell/platform/common/cpp/client_wrapper/include/flutter/encodable_value.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 30bbd785e603f..2a1050540b923 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -560,9 +560,11 @@ 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/common/cpp/client_wrapper/encodable_value_unittests.cc FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/engine_method_result.cc FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/basic_message_channel.h FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/binary_messenger.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/encodable_value.h FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/engine_method_result.h FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/json_message_codec.h FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/json_method_codec.h diff --git a/shell/platform/common/cpp/client_wrapper/BUILD.gn b/shell/platform/common/cpp/client_wrapper/BUILD.gn index 1aacc758abea3..f226c85a9635c 100644 --- a/shell/platform/common/cpp/client_wrapper/BUILD.gn +++ b/shell/platform/common/cpp/client_wrapper/BUILD.gn @@ -7,6 +7,7 @@ import("publish.gni") _wrapper_includes = [ "include/flutter/basic_message_channel.h", "include/flutter/binary_messenger.h", + "include/flutter/encodable_value.h", "include/flutter/engine_method_result.h", "include/flutter/json_message_codec.h", "include/flutter/json_method_codec.h", @@ -72,6 +73,7 @@ executable("client_wrapper_unittests") { # TODO: Add more unit tests. sources = [ + "encodable_value_unittests.cc", "method_call_unittests.cc", "plugin_registrar_unittests.cc", ] diff --git a/shell/platform/common/cpp/client_wrapper/encodable_value_unittests.cc b/shell/platform/common/cpp/client_wrapper/encodable_value_unittests.cc new file mode 100644 index 0000000000000..6784fa4b775f2 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/encodable_value_unittests.cc @@ -0,0 +1,329 @@ +// Copyright 2013 The Flutter 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/common/cpp/client_wrapper/include/flutter/encodable_value.h" + +#include + +#include "gtest/gtest.h" + +namespace flutter { + +// Verifies that value.type() is |type|, and that of all the Is* methods, only +// the one that matches the type is true. +void VerifyType(EncodableValue& value, + EncodableValue::EncodableValue::Type type) { + EXPECT_EQ(value.type(), type); + + EXPECT_EQ(value.IsNull(), type == EncodableValue::Type::kNull); + EXPECT_EQ(value.IsBool(), type == EncodableValue::Type::kBool); + EXPECT_EQ(value.IsInt(), type == EncodableValue::Type::kInt); + EXPECT_EQ(value.IsLong(), type == EncodableValue::Type::kLong); + EXPECT_EQ(value.IsDouble(), type == EncodableValue::Type::kDouble); + EXPECT_EQ(value.IsString(), type == EncodableValue::Type::kString); + EXPECT_EQ(value.IsByteList(), type == EncodableValue::Type::kByteList); + EXPECT_EQ(value.IsIntList(), type == EncodableValue::Type::kIntList); + EXPECT_EQ(value.IsLongList(), type == EncodableValue::Type::kLongList); + EXPECT_EQ(value.IsDoubleList(), type == EncodableValue::Type::kDoubleList); + EXPECT_EQ(value.IsList(), type == EncodableValue::Type::kList); + EXPECT_EQ(value.IsMap(), type == EncodableValue::Type::kMap); +} + +TEST(EncodableValueTest, Null) { + EncodableValue value; + VerifyType(value, EncodableValue::Type::kNull); +} + +TEST(EncodableValueTest, Bool) { + EncodableValue value(false); + VerifyType(value, EncodableValue::Type::kBool); + + EXPECT_FALSE(value.BoolValue()); + value = true; + EXPECT_TRUE(value.BoolValue()); +} + +TEST(EncodableValueTest, Int) { + EncodableValue value(42); + VerifyType(value, EncodableValue::Type::kInt); + + EXPECT_EQ(value.IntValue(), 42); + value = std::numeric_limits::max(); + EXPECT_EQ(value.IntValue(), std::numeric_limits::max()); +} + +TEST(EncodableValueTest, LongValueFromInt) { + EncodableValue value(std::numeric_limits::max()); + EXPECT_EQ(value.LongValue(), std::numeric_limits::max()); +} + +TEST(EncodableValueTest, Long) { + EncodableValue value(42l); + VerifyType(value, EncodableValue::Type::kLong); + + EXPECT_EQ(value.LongValue(), 42); + value = std::numeric_limits::max(); + EXPECT_EQ(value.LongValue(), std::numeric_limits::max()); +} + +TEST(EncodableValueTest, Double) { + EncodableValue value(3.14); + VerifyType(value, EncodableValue::Type::kDouble); + + EXPECT_EQ(value.DoubleValue(), 3.14); + value = std::numeric_limits::max(); + EXPECT_EQ(value.DoubleValue(), std::numeric_limits::max()); +} + +TEST(EncodableValueTest, String) { + std::string hello("Hello, world!"); + EncodableValue value(hello); + VerifyType(value, EncodableValue::Type::kString); + + EXPECT_EQ(value.StringValue(), hello); + value = "Goodbye"; + EXPECT_EQ(value.StringValue(), "Goodbye"); +} + +TEST(EncodableValueTest, UInt8List) { + std::vector data = {0, 2}; + EncodableValue value(data); + VerifyType(value, EncodableValue::Type::kByteList); + + std::vector& list_value = value.ByteListValue(); + list_value.push_back(std::numeric_limits::max()); + EXPECT_EQ(list_value[0], 0); + EXPECT_EQ(list_value[1], 2); + + ASSERT_EQ(list_value.size(), 3u); + EXPECT_EQ(data.size(), 2u); + EXPECT_EQ(list_value[2], std::numeric_limits::max()); +} + +TEST(EncodableValueTest, Int32List) { + std::vector data = {-10, 2}; + EncodableValue value(data); + VerifyType(value, EncodableValue::Type::kIntList); + + std::vector& list_value = value.IntListValue(); + list_value.push_back(std::numeric_limits::max()); + EXPECT_EQ(list_value[0], -10); + EXPECT_EQ(list_value[1], 2); + + ASSERT_EQ(list_value.size(), 3u); + EXPECT_EQ(data.size(), 2u); + EXPECT_EQ(list_value[2], std::numeric_limits::max()); +} + +TEST(EncodableValueTest, Int64List) { + std::vector data = {-10, 2}; + EncodableValue value(data); + VerifyType(value, EncodableValue::Type::kLongList); + + std::vector& list_value = value.LongListValue(); + list_value.push_back(std::numeric_limits::max()); + EXPECT_EQ(list_value[0], -10); + EXPECT_EQ(list_value[1], 2); + + ASSERT_EQ(list_value.size(), 3u); + EXPECT_EQ(data.size(), 2u); + EXPECT_EQ(list_value[2], std::numeric_limits::max()); +} + +TEST(EncodableValueTest, DoubleList) { + std::vector data = {-10.0, 2.0}; + EncodableValue value(data); + VerifyType(value, EncodableValue::Type::kDoubleList); + + std::vector& list_value = value.DoubleListValue(); + list_value.push_back(std::numeric_limits::max()); + EXPECT_EQ(list_value[0], -10.0); + EXPECT_EQ(list_value[1], 2.0); + + ASSERT_EQ(list_value.size(), 3u); + EXPECT_EQ(data.size(), 2u); + EXPECT_EQ(list_value[2], std::numeric_limits::max()); +} + +TEST(EncodableValueTest, List) { + EncodableList encodables = { + EncodableValue(1), + EncodableValue(2.0), + EncodableValue("Three"), + }; + EncodableValue value(encodables); + VerifyType(value, EncodableValue::Type::kList); + + EncodableList& list_value = value.ListValue(); + EXPECT_EQ(list_value[0].IntValue(), 1); + EXPECT_EQ(list_value[1].DoubleValue(), 2.0); + EXPECT_EQ(list_value[2].StringValue(), "Three"); + + // Ensure that it's a modifiable copy of the original array. + list_value.push_back(EncodableValue(true)); + ASSERT_EQ(list_value.size(), 4u); + EXPECT_EQ(encodables.size(), 3u); + EXPECT_EQ(value.ListValue()[3].BoolValue(), true); +} + +TEST(EncodableValueTest, Map) { + EncodableMap encodables = { + {EncodableValue(), EncodableValue(std::vector{1, 2, 3})}, + {EncodableValue(1), EncodableValue(10000l)}, + {EncodableValue("two"), EncodableValue(7)}, + }; + EncodableValue value(encodables); + VerifyType(value, EncodableValue::Type::kMap); + + EncodableMap& map_value = value.MapValue(); + EXPECT_EQ(map_value[EncodableValue()].IsIntList(), true); + EXPECT_EQ(map_value[EncodableValue(1)].LongValue(), 10000l); + EXPECT_EQ(map_value[EncodableValue("two")].IntValue(), 7); + + // Ensure that it's a modifiable copy of the original map. + map_value[EncodableValue(true)] = EncodableValue(false); + ASSERT_EQ(map_value.size(), 4u); + EXPECT_EQ(encodables.size(), 3u); + EXPECT_EQ(map_value[EncodableValue(true)].BoolValue(), false); +} + +TEST(EncodableValueTest, EmptyTypeConstructor) { + EXPECT_TRUE(EncodableValue(EncodableValue::Type::kNull).IsNull()); + EXPECT_EQ(EncodableValue(EncodableValue::Type::kBool).BoolValue(), false); + EXPECT_EQ(EncodableValue(EncodableValue::Type::kInt).IntValue(), 0); + EXPECT_EQ(EncodableValue(EncodableValue::Type::kLong).LongValue(), 0l); + EXPECT_EQ(EncodableValue(EncodableValue::Type::kDouble).DoubleValue(), 0.0); + EXPECT_EQ(EncodableValue(EncodableValue::Type::kString).StringValue().size(), + 0u); + EXPECT_EQ( + EncodableValue(EncodableValue::Type::kByteList).ByteListValue().size(), + 0u); + EXPECT_EQ( + EncodableValue(EncodableValue::Type::kIntList).IntListValue().size(), 0u); + EXPECT_EQ( + EncodableValue(EncodableValue::Type::kLongList).LongListValue().size(), + 0u); + EXPECT_EQ(EncodableValue(EncodableValue::Type::kDoubleList) + .DoubleListValue() + .size(), + 0u); + EXPECT_EQ(EncodableValue(EncodableValue::Type::kList).ListValue().size(), 0u); + EXPECT_EQ(EncodableValue(EncodableValue::Type::kMap).MapValue().size(), 0u); +} + +// Tests that the < operator meets the requirements of using EncodableValue as +// a map key. +TEST(EncodableValueTest, Comparison) { + EncodableList values = { + // Null + EncodableValue(), + // Bool + EncodableValue(true), + EncodableValue(false), + // Int + EncodableValue(-7), + EncodableValue(0), + EncodableValue(100), + // Long + EncodableValue(-7l), + EncodableValue(0l), + EncodableValue(100l), + // Double + EncodableValue(-7.0), + EncodableValue(0.0), + EncodableValue(100.0), + // String + EncodableValue("one"), + EncodableValue("two"), + // ByteList + EncodableValue(std::vector{0, 1}), + EncodableValue(std::vector{0, 10}), + // IntList + EncodableValue(std::vector{0, 1}), + EncodableValue(std::vector{0, 100}), + // LongList + EncodableValue(std::vector{0, 1l}), + EncodableValue(std::vector{0, 100l}), + // DoubleList + EncodableValue(std::vector{0, 1l}), + EncodableValue(std::vector{0, 100l}), + // List + EncodableValue(EncodableList{EncodableValue(), EncodableValue(true)}), + EncodableValue(EncodableList{EncodableValue(), EncodableValue(1.0)}), + // Map + EncodableValue(EncodableMap{{EncodableValue(), EncodableValue(true)}, + {EncodableValue(7), EncodableValue(7.0)}}), + EncodableValue( + EncodableMap{{EncodableValue(), EncodableValue(1.0)}, + {EncodableValue("key"), EncodableValue("value")}}), + }; + + for (size_t i = 0; i < values.size(); ++i) { + const auto& a = values[i]; + for (size_t j = 0; j < values.size(); ++j) { + const auto& b = values[j]; + if (i == j) { + // Identical objects should always be equal. + EXPECT_FALSE(a < b); + EXPECT_FALSE(b < a); + } else { + // All other comparisons should be consistent, but the direction doesn't + // matter. + EXPECT_NE(a < b, b < a); + } + } + + // Different non-collection objects with the same value should be equal; + // different collections should always be unequal regardless of contents. + bool is_collection = a.IsByteList() || a.IsIntList() || a.IsLongList() || + a.IsDoubleList() || a.IsList() || a.IsMap(); + EncodableValue copy(a); + bool is_equal = !(a < copy || copy < a); + EXPECT_EQ(is_equal, !is_collection); + } +} + +// Tests that structures are deep-copied. +TEST(EncodableValueTest, DeepCopy) { + EncodableList encodables = { + EncodableValue(EncodableMap{ + {EncodableValue(), EncodableValue(std::vector{1, 2, 3})}, + {EncodableValue(1), EncodableValue(10000l)}, + {EncodableValue("two"), EncodableValue(7)}, + }), + EncodableValue(EncodableList{ + EncodableValue(), + EncodableValue(), + EncodableValue( + EncodableMap{{EncodableValue("a"), EncodableValue("b")}}), + }), + }; + + EncodableValue value(encodables); + ASSERT_TRUE(value.IsList()); + + // Spot-check innermost collection values. + EXPECT_EQ(value.ListValue()[0].MapValue()[EncodableValue("two")].IntValue(), + 7); + EXPECT_EQ(value.ListValue()[1] + .ListValue()[2] + .MapValue()[EncodableValue("a")] + .StringValue(), + "b"); + + // Modify those values in the original structure. + encodables[0].MapValue()[EncodableValue("two")] = EncodableValue(); + encodables[1].ListValue()[2].MapValue()[EncodableValue("a")] = 99; + + // Re-check innermost collection values to ensure that they haven't changed. + EXPECT_EQ(value.ListValue()[0].MapValue()[EncodableValue("two")].IntValue(), + 7); + EXPECT_EQ(value.ListValue()[1] + .ListValue()[2] + .MapValue()[EncodableValue("a")] + .StringValue(), + "b"); +} + +} // namespace flutter diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/encodable_value.h b/shell/platform/common/cpp/client_wrapper/include/flutter/encodable_value.h new file mode 100644 index 0000000000000..03d9803fe14c9 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/encodable_value.h @@ -0,0 +1,569 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_ENCODABLE_VALUE_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_ENCODABLE_VALUE_H_ + +#include +#include +#include +#include +#include +#include + +namespace flutter { + +static_assert(sizeof(double) == 8, "EncodableValue requires a 64-bit double"); + +class EncodableValue; +// Convenience type aliases for list and map EncodableValue types. +using EncodableList = std::vector; +using EncodableMap = std::map; + +// An object that can contain any value or collection type supported by +// Flutter's standard method codec. +// +// For details, see: +// https://api.flutter.dev/flutter/services/StandardMessageCodec-class.html +// +// As an example, the following Dart structure: +// { +// 'flag': true, +// 'name': 'Thing', +// 'values': [1, 2.0, 4], +// } +// would correspond to: +// EncodableValue(EncodableMap{ +// {EncodableValue("flag"), EncodableValue(true)}, +// {EncodableValue("name"), EncodableValue("Thing")}, +// {EncodableValue("values"), EncodableValue(EncodableList{ +// EncodableValue(1), +// EncodableValue(2.0), +// EncodableValue(4), +// })}, +// }) +class EncodableValue { + public: + // Possible types for an EncodableValue to reperesent. + enum class Type { + kNull, // A null value. + kBool, // A boolean value. + kInt, // A 32-bit integer. + kLong, // A 64-bit integer. + kDouble, // A 64-bit floating point number. + kString, // A string. + kByteList, // A list of bytes. + kIntList, // A list of 32-bit integers. + kLongList, // A list of 64-bit integers. + kDoubleList, // A list of 64-bit floating point numbers. + kList, // A list of EncodableValues. + kMap, // A mapping from EncodableValues to EncodableValues. + }; + + // Creates an instance representing a null value. + EncodableValue() {} + + // Creates an instance representing a bool value. + explicit EncodableValue(bool value) : bool_(value), type_(Type::kBool) {} + + // Creates an instance representing a 32-bit integer value. + explicit EncodableValue(int32_t value) : int_(value), type_(Type::kInt) {} + + // Creates an instance representing a 64-bit integer value. + explicit EncodableValue(int64_t value) : long_(value), type_(Type::kLong) {} + + // Creates an instance representing a 64-bit floating point value. + explicit EncodableValue(double value) + : double_(value), type_(Type::kDouble) {} + + // Creates an instance representing a string value. + explicit EncodableValue(const char* value) + : string_(new std::string(value)), type_(Type::kString) {} + + // Creates an instance representing a string value. + explicit EncodableValue(const std::string& value) + : string_(new std::string(value)), type_(Type::kString) {} + + // Creates an instance representing a list of bytes. + explicit EncodableValue(std::vector list) + : byte_list_(new std::vector(std::move(list))), + type_(Type::kByteList) {} + + // Creates an instance representing a list of 32-bit integers. + explicit EncodableValue(std::vector list) + : int_list_(new std::vector(std::move(list))), + type_(Type::kIntList) {} + + // Creates an instance representing a list of 64-bit integers. + explicit EncodableValue(std::vector list) + : long_list_(new std::vector(std::move(list))), + type_(Type::kLongList) {} + + // Creates an instance representing a list of 64-bit floating point values. + explicit EncodableValue(std::vector list) + : double_list_(new std::vector(std::move(list))), + type_(Type::kDoubleList) {} + + // Creates an instance representing a list of EncodableValues. + explicit EncodableValue(EncodableList list) + : list_(new EncodableList(std::move(list))), type_(Type::kList) {} + + // Creates an instance representing a map from EncodableValues to + // EncodableValues. + explicit EncodableValue(EncodableMap map) + : map_(new EncodableMap(std::move(map))), type_(Type::kMap) {} + + // Convience constructor for creating default value of the given type. + // + // Collections types will be empty, numeric types will be 0, strings will be + // empty, and booleans will be false. For non-collection types, prefer using + // the value-based constructor with an explicit value for clarity. + explicit EncodableValue(Type type) : type_(type) { + switch (type_) { + case Type::kNull: + break; + case Type::kBool: + bool_ = false; + break; + case Type::kInt: + int_ = 0; + break; + case Type::kLong: + long_ = 0; + break; + case Type::kDouble: + double_ = 0.0; + break; + case Type::kString: + string_ = new std::string(); + break; + case Type::kByteList: + byte_list_ = new std::vector(); + break; + case Type::kIntList: + int_list_ = new std::vector(); + break; + case Type::kLongList: + long_list_ = new std::vector(); + break; + case Type::kDoubleList: + double_list_ = new std::vector(); + break; + case Type::kList: + list_ = new std::vector(); + break; + case Type::kMap: + map_ = new std::map(); + break; + } + } + + ~EncodableValue() { DestroyValue(); } + + EncodableValue(const EncodableValue& other) { + DestroyValue(); + + type_ = other.type_; + switch (type_) { + case Type::kNull: + break; + case Type::kBool: + bool_ = other.bool_; + break; + case Type::kInt: + int_ = other.int_; + break; + case Type::kLong: + long_ = other.long_; + break; + case Type::kDouble: + double_ = other.double_; + break; + case Type::kString: + string_ = new std::string(*other.string_); + break; + case Type::kByteList: + byte_list_ = new std::vector(*other.byte_list_); + break; + case Type::kIntList: + int_list_ = new std::vector(*other.int_list_); + break; + case Type::kLongList: + long_list_ = new std::vector(*other.long_list_); + break; + case Type::kDoubleList: + double_list_ = new std::vector(*other.double_list_); + break; + case Type::kList: + list_ = new std::vector(*other.list_); + break; + case Type::kMap: + map_ = new std::map(*other.map_); + break; + } + } + + EncodableValue(EncodableValue&& other) { *this = std::move(other); } + + EncodableValue& operator=(const EncodableValue& other) { + if (&other == this) { + return *this; + } + using std::swap; + EncodableValue temp(other); + swap(*this, temp); + return *this; + } + + EncodableValue& operator=(EncodableValue&& other) { + if (&other == this) { + return *this; + } + DestroyValue(); + + type_ = other.type_; + switch (type_) { + case Type::kNull: + break; + case Type::kBool: + bool_ = other.bool_; + break; + case Type::kInt: + int_ = other.int_; + break; + case Type::kLong: + long_ = other.long_; + break; + case Type::kDouble: + double_ = other.double_; + break; + case Type::kString: + string_ = other.string_; + break; + case Type::kByteList: + byte_list_ = other.byte_list_; + break; + case Type::kIntList: + int_list_ = other.int_list_; + break; + case Type::kLongList: + long_list_ = other.long_list_; + break; + case Type::kDoubleList: + double_list_ = other.double_list_; + break; + case Type::kList: + list_ = other.list_; + break; + case Type::kMap: + map_ = other.map_; + break; + } + // Ensure that destruction doesn't run on the source of the move. + other.type_ = Type::kNull; + return *this; + } + + // Allow assigning any value type that can be used for a constructor. + template + EncodableValue& operator=(const T& value) { + *this = EncodableValue(value); + return *this; + } + + // This operator exists only to provide a stable ordering for use as a + // std::map key. It does not attempt to provide useful ordering semantics. + // Notably: + // - Numeric values are not guaranteed any ordering across numeric types. + // E.g., 1 as a Long may sort after 100 as an Int. + // - Collection types use pointer equality, rather than value. This means that + // multiple collections with the same values will end up as separate keys + // in a map (consistent with default Dart Map behavior). + bool operator<(const EncodableValue& other) const { + if (type_ != other.type_) { + return type_ < other.type_; + } + switch (type_) { + case Type::kNull: + return false; + case Type::kBool: + return bool_ < other.bool_; + case Type::kInt: + return int_ < other.int_; + case Type::kLong: + return long_ < other.long_; + case Type::kDouble: + return double_ < other.double_; + case Type::kString: + return *string_ < *other.string_; + case Type::kByteList: + case Type::kIntList: + case Type::kLongList: + case Type::kDoubleList: + case Type::kList: + case Type::kMap: + return this < &other; + } + assert(false); + return false; + } + + // Returns the bool value this object represents. + // + // It is a programming error to call this unless IsBool() is true. + bool BoolValue() const { + assert(IsBool()); + return bool_; + } + + // Returns the 32-bit integer value this object represents. + // + // It is a programming error to call this unless IsInt() is true. + int32_t IntValue() const { + assert(IsInt()); + return int_; + } + + // Returns the 64-bit integer value this object represents. + // + // It is a programming error to call this unless IsLong() or IsInt() is true. + // + // Note that calling this function on an Int value is the only case where + // a *Value() function can be called without the corresponding Is*() being + // true. This is to simplify handling objects received from Flutter where the + // values may be larger than 32-bit, since they have the same type on the Dart + // side, but will be either 32-bit or 64-bit here depending on the value. + int64_t LongValue() const { + assert(IsLong() || IsInt()); + if (IsLong()) { + return long_; + } + return int_; + } + + // Returns the double value this object represents. + // + // It is a programming error to call this unless IsDouble() is true. + double DoubleValue() const { + assert(IsDouble()); + return double_; + } + + // Returns the string value this object represents. + // + // It is a programming error to call this unless IsString() is true. + const std::string& StringValue() const { + assert(IsString()); + return *string_; + } + + // Returns the byte list this object represents. + // + // It is a programming error to call this unless IsByteList() is true. + const std::vector& ByteListValue() const { + assert(IsByteList()); + return *byte_list_; + } + + // Returns the byte list this object represents. + // + // It is a programming error to call this unless IsByteList() is true. + std::vector& ByteListValue() { + assert(IsByteList()); + return *byte_list_; + } + + // Returns the 32-bit integer list this object represents. + // + // It is a programming error to call this unless IsIntList() is true. + const std::vector& IntListValue() const { + assert(IsIntList()); + return *int_list_; + } + + // Returns the 32-bit integer list this object represents. + // + // It is a programming error to call this unless IsIntList() is true. + std::vector& IntListValue() { + assert(IsIntList()); + return *int_list_; + } + + // Returns the 64-bit integer list this object represents. + // + // It is a programming error to call this unless IsLongList() is true. + const std::vector& LongListValue() const { + assert(IsLongList()); + return *long_list_; + } + + // Returns the 64-bit integer list this object represents. + // + // It is a programming error to call this unless IsLongList() is true. + std::vector& LongListValue() { + assert(IsLongList()); + return *long_list_; + } + + // Returns the double list this object represents. + // + // It is a programming error to call this unless IsDoubleList() is true. + const std::vector& DoubleListValue() const { + assert(IsDoubleList()); + return *double_list_; + } + + // Returns the double list this object represents. + // + // It is a programming error to call this unless IsDoubleList() is true. + std::vector& DoubleListValue() { + assert(IsDoubleList()); + return *double_list_; + } + + // Returns the list of EncodableValues this object represents. + // + // It is a programming error to call this unless IsList() is true. + const EncodableList& ListValue() const { + assert(IsList()); + return *list_; + } + + // Returns the list of EncodableValues this object represents. + // + // It is a programming error to call this unless IsList() is true. + EncodableList& ListValue() { + assert(IsList()); + return *list_; + } + + // Returns the map of EncodableValue : EncodableValue pairs this object + // represent. + // + // It is a programming error to call this unless IsMap() is true. + const EncodableMap& MapValue() const { + assert(IsMap()); + return *map_; + } + + // Returns the map of EncodableValue : EncodableValue pairs this object + // represent. + // + // It is a programming error to call this unless IsMap() is true. + EncodableMap& MapValue() { + assert(IsMap()); + return *map_; + } + + // Returns true if this represents a null value. + bool IsNull() const { return type_ == Type::kNull; } + + // Returns true if this represents a bool value. + bool IsBool() const { return type_ == Type::kBool; } + + // Returns true if this represents a 32-bit integer value. + bool IsInt() const { return type_ == Type::kInt; } + + // Returns true if this represents a 64-bit integer value. + bool IsLong() const { return type_ == Type::kLong; } + + // Returns true if this represents a double value. + bool IsDouble() const { return type_ == Type::kDouble; } + + // Returns true if this represents a string value. + bool IsString() const { return type_ == Type::kString; } + + // Returns true if this represents a list of bytes. + bool IsByteList() const { return type_ == Type::kByteList; } + + // Returns true if this represents a list of 32-bit integers. + bool IsIntList() const { return type_ == Type::kIntList; } + + // Returns true if this represents a list of 64-bit integers. + bool IsLongList() const { return type_ == Type::kLongList; } + + // Returns true if this represents a list of doubles. + bool IsDoubleList() const { return type_ == Type::kDoubleList; } + + // Returns true if this represents a list of EncodableValues. + bool IsList() const { return type_ == Type::kList; } + + // Returns true if this represents a map of EncodableValue : EncodableValue + // pairs. + bool IsMap() const { return type_ == Type::kMap; } + + // Returns the type this value represents. + // + // This is primarily intended for use with switch(); for individual checks, + // prefer an Is*() call. + Type type() const { return type_; } + + private: + // Performs any cleanup necessary for the active union value. This must be + // called before assigning a new value, and on object destruction. + // + // After calling this, type_ will alway be kNull. + void DestroyValue() { + switch (type_) { + case Type::kNull: + case Type::kBool: + case Type::kInt: + case Type::kLong: + case Type::kDouble: + break; + case Type::kString: + delete string_; + break; + case Type::kByteList: + delete byte_list_; + break; + case Type::kIntList: + delete int_list_; + break; + case Type::kLongList: + delete long_list_; + break; + case Type::kDoubleList: + delete double_list_; + break; + case Type::kList: + delete list_; + break; + case Type::kMap: + delete map_; + break; + } + + type_ = Type::kNull; + } + + // The anonymous union that stores the represented value. Accessing any of + // these entries other than the one that corresponds to the current value of + // |type_| has undefined behavior. + // + // Pointers are used for the non-POD types to avoid making the overall size + // of the union unnecessarily large. + // + // TODO: Replace this with std::variant once c++17 is available. + union { + bool bool_; + int32_t int_; + int64_t long_; + double double_; + std::string* string_; + std::vector* byte_list_; + std::vector* int_list_; + std::vector* long_list_; + std::vector* double_list_; + std::vector* list_; + std::map* map_; + }; + + // The currently active union entry. + Type type_ = Type::kNull; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_ENCODABLE_VALUE_H_ From 388124f948e685fd545c4363bcecbaeae911b4c5 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 16 Apr 2019 20:56:24 -0400 Subject: [PATCH 0827/1117] Roll src/third_party/skia db13d3874846..70ed05e53ad2 (6 commits) (#8599) https://skia.googlesource.com/skia.git/%2Blog/db13d3874846..70ed05e53ad2 git log db13d38748462b713beeeed33fb0eb9d95c1270e..70ed05e53ad244b3234415b447e5fcd53fb40e3b --date=short --no-merges --format=%ad %ae %s 2019-04-16 reed@google.com Revert "Simplify SkTypeface::charsToGlyphs API to require UTF32 input" 2019-04-17 reed@google.com Revert "Remove includes from SkFontTypes.h" 2019-04-16 csmartdalton@google.com Reland "Add GrDisableColorXPFactory::makeXferProcessor()" 2019-04-16 bungeman@google.com Remove includes from SkFontTypes.h 2019-04-16 reed@google.com Simplify SkTypeface::charsToGlyphs API to require UTF32 input 2019-04-16 bungeman@google.com IWYU for SkCanvas.h The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 8803f499da96c..06a412edee768 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': 'db13d38748462b713beeeed33fb0eb9d95c1270e', + 'skia_revision': '70ed05e53ad244b3234415b447e5fcd53fb40e3b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 9297cf25e3f3a..6151facf80b35 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: e4826915478bc70bedc3991b23ebc9bd +Signature: 7e986723b35e27a14d9131c9199c83c4 UNUSED LICENSES: From 4805d72a492fbad5b22fecddf4f6529d3e1d6c04 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Tue, 16 Apr 2019 19:49:09 -0700 Subject: [PATCH 0828/1117] Implement StandardMethodCodec for C++ shells (#8598) Adds StandardMethodCodec support to the C++ client wrapper. This makes it substantially easier to add Windows and Linux support for existing plugins, as StandardMethodCodec is the default plugin protocol. Fixes flutter/flutter#30670 Does not include extensibility for the codec, which will be added later. --- ci/licenses_golden/licenses_flutter | 7 + .../common/cpp/client_wrapper/BUILD.gn | 13 +- .../cpp/client_wrapper/byte_stream_wrappers.h | 105 +++++ .../include/flutter/basic_message_channel.h | 2 - .../include/flutter/message_codec.h | 10 +- .../include/flutter/method_channel.h | 2 - .../include/flutter/method_codec.h | 10 +- .../include/flutter/standard_message_codec.h | 42 ++ .../include/flutter/standard_method_codec.h | 52 +++ .../cpp/client_wrapper/standard_codec.cc | 378 ++++++++++++++++++ .../standard_codec_serializer.h | 54 +++ .../standard_message_codec_unittests.cc | 163 ++++++++ .../standard_method_codec_unittests.cc | 105 +++++ .../testing/encodable_value_utils.cc | 89 +++++ .../testing/encodable_value_utils.h | 22 + 15 files changed, 1046 insertions(+), 8 deletions(-) create mode 100644 shell/platform/common/cpp/client_wrapper/byte_stream_wrappers.h create mode 100644 shell/platform/common/cpp/client_wrapper/include/flutter/standard_message_codec.h create mode 100644 shell/platform/common/cpp/client_wrapper/include/flutter/standard_method_codec.h create mode 100644 shell/platform/common/cpp/client_wrapper/standard_codec.cc create mode 100644 shell/platform/common/cpp/client_wrapper/standard_codec_serializer.h create mode 100644 shell/platform/common/cpp/client_wrapper/standard_message_codec_unittests.cc create mode 100644 shell/platform/common/cpp/client_wrapper/standard_method_codec_unittests.cc create mode 100644 shell/platform/common/cpp/client_wrapper/testing/encodable_value_utils.cc create mode 100644 shell/platform/common/cpp/client_wrapper/testing/encodable_value_utils.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 2a1050540b923..4f82601d8ffe8 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -560,6 +560,7 @@ 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/common/cpp/client_wrapper/byte_stream_wrappers.h FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/encodable_value_unittests.cc FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/engine_method_result.cc FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/basic_message_channel.h @@ -575,11 +576,17 @@ FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/ FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/method_codec.h FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/method_result.h FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/plugin_registrar.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/standard_message_codec.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/include/flutter/standard_method_codec.h FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/json_message_codec.cc FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/json_method_codec.cc FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/method_call_unittests.cc FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/plugin_registrar.cc FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/plugin_registrar_unittests.cc +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/standard_codec.cc +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/standard_codec_serializer.h +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/standard_message_codec_unittests.cc +FILE: ../../../flutter/shell/platform/common/cpp/client_wrapper/standard_method_codec_unittests.cc FILE: ../../../flutter/shell/platform/common/cpp/incoming_message_dispatcher.cc FILE: ../../../flutter/shell/platform/common/cpp/incoming_message_dispatcher.h FILE: ../../../flutter/shell/platform/common/cpp/public/flutter_export.h diff --git a/shell/platform/common/cpp/client_wrapper/BUILD.gn b/shell/platform/common/cpp/client_wrapper/BUILD.gn index f226c85a9635c..095877364b346 100644 --- a/shell/platform/common/cpp/client_wrapper/BUILD.gn +++ b/shell/platform/common/cpp/client_wrapper/BUILD.gn @@ -18,16 +18,21 @@ _wrapper_includes = [ "include/flutter/method_codec.h", "include/flutter/method_result.h", "include/flutter/plugin_registrar.h", + "include/flutter/standard_message_codec.h", + "include/flutter/standard_method_codec.h", ] # TODO: Once the wrapper API is more stable, consolidate to as few files as is # reasonable (without forcing different kinds of clients to take unnecessary # code) to simplify use. _wrapper_sources = [ + "byte_stream_wrappers.h", "engine_method_result.cc", - "json_message_codec.cc", - "json_method_codec.cc", + "json_message_codec.cc", # TODO combine into a single json_codec.cc. + "json_method_codec.cc", # TODO combine into a single json_codec.cc. "plugin_registrar.cc", + "standard_codec_serializer.h", + "standard_codec.cc", ] # Client library build for internal use by the shell implementation. @@ -76,6 +81,10 @@ executable("client_wrapper_unittests") { "encodable_value_unittests.cc", "method_call_unittests.cc", "plugin_registrar_unittests.cc", + "standard_message_codec_unittests.cc", + "standard_method_codec_unittests.cc", + "testing/encodable_value_utils.cc", + "testing/encodable_value_utils.h", ] deps = [ diff --git a/shell/platform/common/cpp/client_wrapper/byte_stream_wrappers.h b/shell/platform/common/cpp/client_wrapper/byte_stream_wrappers.h new file mode 100644 index 0000000000000..96ab0b0d06210 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/byte_stream_wrappers.h @@ -0,0 +1,105 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_CLIENT_WRAPPER_BYTE_STREAM_WRAPPERS_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_BYTE_STREAM_WRAPPERS_H_ + +// Utility classes for interacting with a buffer of bytes as a stream, for use +// in message channel codecs. + +#include +#include +#include +#include + +namespace flutter { + +// Wraps an array of bytes with utility methods for treating it as a readable +// stream. +class ByteBufferStreamReader { + public: + // Createa a reader reading from |bytes|, which must have a length of |size|. + // |bytes| must remain valid for the lifetime of this object. + explicit ByteBufferStreamReader(const uint8_t* bytes, size_t size) + : bytes_(bytes), size_(size) {} + + // Reads and returns the next byte from the stream. + uint8_t ReadByte() { + if (location_ >= size_) { + std::cerr << "Invalid read in StandardCodecByteStreamReader" << std::endl; + return 0; + } + return bytes_[location_++]; + } + + // Reads the next |length| bytes from the stream into |buffer|. The caller + // is responsible for ensuring that |buffer| is large enough. + void ReadBytes(uint8_t* buffer, size_t length) { + if (location_ + length > size_) { + std::cerr << "Invalid read in StandardCodecByteStreamReader" << std::endl; + return; + } + std::memcpy(buffer, &bytes_[location_], length); + location_ += length; + } + + // Advances the read cursor to the next multiple of |alignment| relative to + // the start of the wrapped byte buffer, unless it is already aligned. + void ReadAlignment(uint8_t alignment) { + uint8_t mod = location_ % alignment; + if (mod) { + location_ += alignment - mod; + } + } + + private: + // The buffer to read from. + const uint8_t* bytes_; + // The total size of the buffer. + size_t size_; + // The current read location. + size_t location_ = 0; +}; + +// Wraps an array of bytes with utility methods for treating it as a writable +// stream. +class ByteBufferStreamWriter { + public: + // Createa a writter that writes into |buffer|. + // |buffer| must remain valid for the lifetime of this object. + explicit ByteBufferStreamWriter(std::vector* buffer) + : bytes_(buffer) { + assert(buffer); + } + + // Writes |byte| to the wrapped buffer. + void WriteByte(uint8_t byte) { bytes_->push_back(byte); } + + // Writes the next |length| bytes from |bytes| into the wrapped buffer. + // The caller is responsible for ensuring that |buffer| is large enough. + void WriteBytes(const uint8_t* bytes, size_t length) { + assert(length > 0); + bytes_->insert(bytes_->end(), bytes, bytes + length); + } + + // Writes 0s until the next multiple of |alignment| relative to + // the start of the wrapped byte buffer, unless the write positition is + // already aligned. + void WriteAlignment(uint8_t alignment) { + uint8_t mod = bytes_->size() % alignment; + if (mod) { + for (int i = 0; i < alignment - mod; ++i) { + WriteByte(0); + } + } + } + + private: + // The buffer to write to. + std::vector* bytes_; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_BYTE_STREAM_WRAPPERS_H_ diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/basic_message_channel.h b/shell/platform/common/cpp/client_wrapper/include/flutter/basic_message_channel.h index a864a36343d4e..df0371436b179 100644 --- a/shell/platform/common/cpp/client_wrapper/include/flutter/basic_message_channel.h +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/basic_message_channel.h @@ -34,8 +34,6 @@ class BasicMessageChannel { public: // Creates an instance that sends and receives method calls on the channel // named |name|, encoded with |codec| and dispatched via |messenger|. - // - // TODO: Make codec optional once the standard codec is supported (Issue #67). BasicMessageChannel(BinaryMessenger* messenger, const std::string& name, const MessageCodec* codec) diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/message_codec.h b/shell/platform/common/cpp/client_wrapper/include/flutter/message_codec.h index fb012e7a535d4..386d0d024c564 100644 --- a/shell/platform/common/cpp/client_wrapper/include/flutter/message_codec.h +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/message_codec.h @@ -26,12 +26,20 @@ class MessageCodec { // Returns the message encoded in |binary_message|, or nullptr if it cannot be // decoded by this codec. - // TODO: Consider adding absl as a dependency and using absl::Span. std::unique_ptr DecodeMessage(const uint8_t* binary_message, const size_t message_size) const { return std::move(DecodeMessageInternal(binary_message, message_size)); } + // Returns the message encoded in |binary_message|, or nullptr if it cannot be + // decoded by this codec. + std::unique_ptr DecodeMessage( + const std::vector& binary_message) const { + size_t size = binary_message.size(); + const uint8_t* data = size > 0 ? &binary_message[0] : nullptr; + return std::move(DecodeMessageInternal(data, size)); + } + // Returns a binary encoding of the given |message|, or nullptr if the // message cannot be serialized by this codec. std::unique_ptr> EncodeMessage(const T& message) const { diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/method_channel.h b/shell/platform/common/cpp/client_wrapper/include/flutter/method_channel.h index 9e28f9b3812e5..e1f164076aebb 100644 --- a/shell/platform/common/cpp/client_wrapper/include/flutter/method_channel.h +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/method_channel.h @@ -32,8 +32,6 @@ class MethodChannel { public: // Creates an instance that sends and receives method calls on the channel // named |name|, encoded with |codec| and dispatched via |messenger|. - // - // TODO: Make codec optional once the standard codec is supported (Issue #67). MethodChannel(BinaryMessenger* messenger, const std::string& name, const MethodCodec* codec) diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/method_codec.h b/shell/platform/common/cpp/client_wrapper/include/flutter/method_codec.h index 3d45e59c0a8f3..6f9e09ac24775 100644 --- a/shell/platform/common/cpp/client_wrapper/include/flutter/method_codec.h +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/method_codec.h @@ -28,13 +28,21 @@ class MethodCodec { // Returns the MethodCall encoded in |message|, or nullptr if it cannot be // decoded. - // TODO: Consider adding absl as a dependency and using absl::Span. std::unique_ptr> DecodeMethodCall( const uint8_t* message, const size_t message_size) const { return std::move(DecodeMethodCallInternal(message, message_size)); } + // Returns the MethodCall encoded in |message|, or nullptr if it cannot be + // decoded. + std::unique_ptr> DecodeMethodCall( + const std::vector& message) const { + size_t size = message.size(); + const uint8_t* data = size > 0 ? &message[0] : nullptr; + return std::move(DecodeMethodCallInternal(data, size)); + } + // Returns a binary encoding of the given |method_call|, or nullptr if the // method call cannot be serialized by this codec. std::unique_ptr> EncodeMethodCall( diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/standard_message_codec.h b/shell/platform/common/cpp/client_wrapper/include/flutter/standard_message_codec.h new file mode 100644 index 0000000000000..75644c7a85f31 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/standard_message_codec.h @@ -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. + +#ifndef FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_STANDARD_MESSAGE_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_STANDARD_MESSAGE_CODEC_H_ + +#include "encodable_value.h" +#include "message_codec.h" + +namespace flutter { + +// A binary message encoding/decoding mechanism for communications to/from the +// Flutter engine via message channels. +class StandardMessageCodec : public MessageCodec { + public: + // Returns the shared instance of the codec. + static const StandardMessageCodec& GetInstance(); + + ~StandardMessageCodec(); + + // Prevent copying. + StandardMessageCodec(StandardMessageCodec const&) = delete; + StandardMessageCodec& operator=(StandardMessageCodec const&) = delete; + + protected: + // Instances should be obtained via GetInstance. + StandardMessageCodec(); + + // |flutter::MessageCodec| + std::unique_ptr DecodeMessageInternal( + const uint8_t* binary_message, + const size_t message_size) const override; + + // |flutter::MessageCodec| + std::unique_ptr> EncodeMessageInternal( + const EncodableValue& message) const override; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_STANDARD_MESSAGE_CODEC_H_ diff --git a/shell/platform/common/cpp/client_wrapper/include/flutter/standard_method_codec.h b/shell/platform/common/cpp/client_wrapper/include/flutter/standard_method_codec.h new file mode 100644 index 0000000000000..3b474110613cb --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/include/flutter/standard_method_codec.h @@ -0,0 +1,52 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_STANDARD_METHOD_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_STANDARD_METHOD_CODEC_H_ + +#include "encodable_value.h" +#include "method_call.h" +#include "method_codec.h" + +namespace flutter { + +// An implementation of MethodCodec that uses a binary serialization. +class StandardMethodCodec : public MethodCodec { + public: + // Returns the shared instance of the codec. + static const StandardMethodCodec& GetInstance(); + + ~StandardMethodCodec() = default; + + // Prevent copying. + StandardMethodCodec(StandardMethodCodec const&) = delete; + StandardMethodCodec& operator=(StandardMethodCodec const&) = delete; + + protected: + // Instances should be obtained via GetInstance. + StandardMethodCodec() = default; + + // |flutter::MethodCodec| + std::unique_ptr> DecodeMethodCallInternal( + const uint8_t* message, + const size_t message_size) const override; + + // |flutter::MethodCodec| + std::unique_ptr> EncodeMethodCallInternal( + const MethodCall& method_call) const override; + + // |flutter::MethodCodec| + std::unique_ptr> EncodeSuccessEnvelopeInternal( + const EncodableValue* result) const override; + + // |flutter::MethodCodec| + std::unique_ptr> EncodeErrorEnvelopeInternal( + const std::string& error_code, + const std::string& error_message, + const EncodableValue* error_details) const override; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_INCLUDE_FLUTTER_STANDARD_METHOD_CODEC_H_ diff --git a/shell/platform/common/cpp/client_wrapper/standard_codec.cc b/shell/platform/common/cpp/client_wrapper/standard_codec.cc new file mode 100644 index 0000000000000..6fbb63ebd9abc --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/standard_codec.cc @@ -0,0 +1,378 @@ +// Copyright 2013 The Flutter 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 file contains what would normally be standard_codec_serializer.cc, +// standard_message_codec.cc, and standard_method_codec.cc. They are grouped +// together to simplify use of the client wrapper, since the common case is +// that any client that needs one of these files needs all three. + +#include "include/flutter/standard_message_codec.h" +#include "include/flutter/standard_method_codec.h" +#include "standard_codec_serializer.h" + +#include +#include +#include +#include +#include +#include + +namespace flutter { + +// ===== standard_codec_serializer.h ===== + +namespace { + +// The order/values here must match the constants in message_codecs.dart. +enum class EncodedType { + kNull = 0, + kTrue, + kFalse, + kInt32, + kInt64, + kLargeInt, // No longer used. If encountered, treat as kString. + kFloat64, + kString, + kUInt8List, + kInt32List, + kInt64List, + kFloat64List, + kList, + kMap, +}; + +// Returns the encoded type that should be written when serializing |value|. +EncodedType EncodedTypeForValue(const EncodableValue& value) { + switch (value.type()) { + case EncodableValue::Type::kNull: + return EncodedType::kNull; + case EncodableValue::Type::kBool: + return value.BoolValue() ? EncodedType::kTrue : EncodedType::kFalse; + case EncodableValue::Type::kInt: + return EncodedType::kInt32; + case EncodableValue::Type::kLong: + return EncodedType::kInt64; + case EncodableValue::Type::kDouble: + return EncodedType::kFloat64; + case EncodableValue::Type::kString: + return EncodedType::kString; + case EncodableValue::Type::kByteList: + return EncodedType::kUInt8List; + case EncodableValue::Type::kIntList: + return EncodedType::kInt32List; + case EncodableValue::Type::kLongList: + return EncodedType::kInt64List; + case EncodableValue::Type::kDoubleList: + return EncodedType::kFloat64List; + case EncodableValue::Type::kList: + return EncodedType::kList; + case EncodableValue::Type::kMap: + return EncodedType::kMap; + } + assert(false); + return EncodedType::kNull; +} + +} // namespace + +StandardCodecSerializer::StandardCodecSerializer() = default; + +StandardCodecSerializer::~StandardCodecSerializer() = default; + +EncodableValue StandardCodecSerializer::ReadValue( + ByteBufferStreamReader* stream) const { + EncodedType type = static_cast(stream->ReadByte()); + ; + switch (type) { + case EncodedType::kNull: + return EncodableValue(); + case EncodedType::kTrue: + return EncodableValue(true); + case EncodedType::kFalse: + return EncodableValue(false); + case EncodedType::kInt32: { + int32_t int_value = 0; + stream->ReadBytes(reinterpret_cast(&int_value), 4); + return EncodableValue(int_value); + } + case EncodedType::kInt64: { + int64_t long_value = 0; + stream->ReadBytes(reinterpret_cast(&long_value), 8); + return EncodableValue(long_value); + } + case EncodedType::kFloat64: { + double double_value = 0; + stream->ReadAlignment(8); + stream->ReadBytes(reinterpret_cast(&double_value), 8); + return EncodableValue(double_value); + } + case EncodedType::kLargeInt: + case EncodedType::kString: { + int32_t size = ReadSize(stream); + std::string string_value; + string_value.resize(size); + stream->ReadBytes(reinterpret_cast(&string_value[0]), size); + return EncodableValue(string_value); + } + case EncodedType::kUInt8List: + return ReadVector(stream); + case EncodedType::kInt32List: + return ReadVector(stream); + case EncodedType::kInt64List: + return ReadVector(stream); + case EncodedType::kFloat64List: + return ReadVector(stream); + case EncodedType::kList: { + int32_t length = ReadSize(stream); + EncodableList list_value; + list_value.reserve(length); + for (int32_t i = 0; i < length; ++i) { + list_value.push_back(ReadValue(stream)); + } + return EncodableValue(list_value); + } + case EncodedType::kMap: { + int32_t length = ReadSize(stream); + EncodableMap map_value; + for (int32_t i = 0; i < length; ++i) { + EncodableValue key = ReadValue(stream); + EncodableValue value = ReadValue(stream); + map_value.emplace(std::move(key), std::move(value)); + } + return EncodableValue(map_value); + } + } + std::cerr << "Unknown type in StandardCodecSerializer::ReadValue: " + << static_cast(type) << std::endl; + return EncodableValue(); +} + +void StandardCodecSerializer::WriteValue(const EncodableValue& value, + ByteBufferStreamWriter* stream) const { + stream->WriteByte(static_cast(EncodedTypeForValue(value))); + switch (value.type()) { + case EncodableValue::Type::kNull: + case EncodableValue::Type::kBool: + // Null and bool are encoded directly in the type. + break; + case EncodableValue::Type::kInt: { + int32_t int_value = value.IntValue(); + stream->WriteBytes(reinterpret_cast(&int_value), 4); + break; + } + case EncodableValue::Type::kLong: { + int64_t long_value = value.LongValue(); + stream->WriteBytes(reinterpret_cast(&long_value), 8); + break; + } + case EncodableValue::Type::kDouble: { + stream->WriteAlignment(8); + double double_value = value.DoubleValue(); + stream->WriteBytes(reinterpret_cast(&double_value), 8); + break; + } + case EncodableValue::Type::kString: { + const auto& string_value = value.StringValue(); + size_t size = string_value.size(); + WriteSize(size, stream); + stream->WriteBytes(reinterpret_cast(string_value.data()), + size); + break; + } + case EncodableValue::Type::kByteList: + WriteVector(value.ByteListValue(), stream); + break; + case EncodableValue::Type::kIntList: + WriteVector(value.IntListValue(), stream); + break; + case EncodableValue::Type::kLongList: + WriteVector(value.LongListValue(), stream); + break; + case EncodableValue::Type::kDoubleList: + WriteVector(value.DoubleListValue(), stream); + break; + case EncodableValue::Type::kList: + WriteSize(value.ListValue().size(), stream); + for (const auto& item : value.ListValue()) { + WriteValue(item, stream); + } + break; + case EncodableValue::Type::kMap: + WriteSize(value.MapValue().size(), stream); + for (const auto& pair : value.MapValue()) { + WriteValue(pair.first, stream); + WriteValue(pair.second, stream); + } + break; + } +} + +uint32_t StandardCodecSerializer::ReadSize( + ByteBufferStreamReader* stream) const { + uint8_t byte = stream->ReadByte(); + if (byte < 254) { + return byte; + } else if (byte == 254) { + uint16_t value; + stream->ReadBytes(reinterpret_cast(&value), 2); + return value; + } else { + uint32_t value; + stream->ReadBytes(reinterpret_cast(&value), 4); + return value; + } +} + +void StandardCodecSerializer::WriteSize(uint32_t size, + ByteBufferStreamWriter* stream) const { + if (size < 254) { + stream->WriteByte(static_cast(size)); + } else if (size <= 0xffff) { + stream->WriteByte(254); + uint16_t value = static_cast(size); + stream->WriteBytes(reinterpret_cast(&value), 2); + } else { + stream->WriteByte(255); + stream->WriteBytes(reinterpret_cast(&size), 4); + } +} + +template +EncodableValue StandardCodecSerializer::ReadVector( + ByteBufferStreamReader* stream) const { + int32_t count = ReadSize(stream); + std::vector vector; + vector.resize(count); + size_t type_size = sizeof(T); + if (type_size > 1) { + stream->ReadAlignment(type_size); + } + stream->ReadBytes(reinterpret_cast(vector.data()), + count * type_size); + return EncodableValue(vector); +} + +template +void StandardCodecSerializer::WriteVector( + const std::vector vector, + ByteBufferStreamWriter* stream) const { + size_t count = vector.size(); + WriteSize(count, stream); + size_t type_size = sizeof(T); + if (type_size > 1) { + stream->WriteAlignment(type_size); + } + stream->WriteBytes(reinterpret_cast(vector.data()), + count * type_size); +} + +// ===== standard_message_codec.h ===== + +// static +const StandardMessageCodec& StandardMessageCodec::GetInstance() { + static StandardMessageCodec sInstance; + return sInstance; +} + +StandardMessageCodec::StandardMessageCodec() = default; + +StandardMessageCodec::~StandardMessageCodec() = default; + +std::unique_ptr StandardMessageCodec::DecodeMessageInternal( + const uint8_t* binary_message, + const size_t message_size) const { + StandardCodecSerializer serializer; + ByteBufferStreamReader stream(binary_message, message_size); + return std::make_unique(serializer.ReadValue(&stream)); +} + +std::unique_ptr> +StandardMessageCodec::EncodeMessageInternal( + const EncodableValue& message) const { + StandardCodecSerializer serializer; + auto encoded = std::make_unique>(); + ByteBufferStreamWriter stream(encoded.get()); + serializer.WriteValue(message, &stream); + return encoded; +} + +// ===== standard_method_codec.h ===== + +// static +const StandardMethodCodec& StandardMethodCodec::GetInstance() { + static StandardMethodCodec sInstance; + return sInstance; +} + +std::unique_ptr> +StandardMethodCodec::DecodeMethodCallInternal(const uint8_t* message, + const size_t message_size) const { + StandardCodecSerializer serializer; + ByteBufferStreamReader stream(message, message_size); + EncodableValue method_name = serializer.ReadValue(&stream); + if (!method_name.IsString()) { + std::cerr << "Invalid method call; method name is not a string." + << std::endl; + return nullptr; + } + auto arguments = + std::make_unique(serializer.ReadValue(&stream)); + return std::make_unique>(method_name.StringValue(), + std::move(arguments)); +} + +std::unique_ptr> +StandardMethodCodec::EncodeMethodCallInternal( + const MethodCall& method_call) const { + StandardCodecSerializer serializer; + auto encoded = std::make_unique>(); + ByteBufferStreamWriter stream(encoded.get()); + serializer.WriteValue(EncodableValue(method_call.method_name()), &stream); + if (method_call.arguments()) { + serializer.WriteValue(*method_call.arguments(), &stream); + } else { + serializer.WriteValue(EncodableValue(), &stream); + } + return encoded; +} + +std::unique_ptr> +StandardMethodCodec::EncodeSuccessEnvelopeInternal( + const EncodableValue* result) const { + StandardCodecSerializer serializer; + auto encoded = std::make_unique>(); + ByteBufferStreamWriter stream(encoded.get()); + stream.WriteByte(0); + if (result) { + serializer.WriteValue(*result, &stream); + } else { + serializer.WriteValue(EncodableValue(), &stream); + } + return encoded; +} + +std::unique_ptr> +StandardMethodCodec::EncodeErrorEnvelopeInternal( + const std::string& error_code, + const std::string& error_message, + const EncodableValue* error_details) const { + StandardCodecSerializer serializer; + auto encoded = std::make_unique>(); + ByteBufferStreamWriter stream(encoded.get()); + stream.WriteByte(1); + serializer.WriteValue(EncodableValue(error_code), &stream); + if (error_message.empty()) { + serializer.WriteValue(EncodableValue(), &stream); + } else { + serializer.WriteValue(EncodableValue(error_message), &stream); + } + if (error_details) { + serializer.WriteValue(*error_details, &stream); + } else { + serializer.WriteValue(EncodableValue(), &stream); + } + return encoded; +} + +} // namespace flutter diff --git a/shell/platform/common/cpp/client_wrapper/standard_codec_serializer.h b/shell/platform/common/cpp/client_wrapper/standard_codec_serializer.h new file mode 100644 index 0000000000000..07499fd795540 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/standard_codec_serializer.h @@ -0,0 +1,54 @@ +// Copyright 2013 The Flutter 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_COMMON_CPP_CLIENT_WRAPPER_ENCODABLE_VALUE_SERIALIZER_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_ENCODABLE_VALUE_SERIALIZER_H_ + +#include "byte_stream_wrappers.h" +#include "include/flutter/encodable_value.h" + +namespace flutter { + +// Encapsulates the logic for encoding/decoding EncodableValues to/from the +// standard codec binary representation. +class StandardCodecSerializer { + public: + StandardCodecSerializer(); + ~StandardCodecSerializer(); + + // Prevent copying. + StandardCodecSerializer(StandardCodecSerializer const&) = delete; + StandardCodecSerializer& operator=(StandardCodecSerializer const&) = delete; + + // Reads and returns the next value from |stream|. + EncodableValue ReadValue(ByteBufferStreamReader* stream) const; + + // Writes the encoding of |value| to |stream|. + void WriteValue(const EncodableValue& value, + ByteBufferStreamWriter* stream) const; + + protected: + // Reads the variable-length size from the current position in |stream|. + uint32_t ReadSize(ByteBufferStreamReader* stream) const; + + // Writes the variable-length size encoding to |stream|. + void WriteSize(uint32_t size, ByteBufferStreamWriter* stream) const; + + // Reads a fixed-type list whose values are of type T from the current + // position in |stream|, and returns it as the corresponding EncodableValue. + // |T| must correspond to one of the support list value types of + // EncodableValue. + template + EncodableValue ReadVector(ByteBufferStreamReader* stream) const; + + // Writes |vector| to |stream| as a fixed-type list. |T| must correspond to + // one of the support list value types of EncodableValue. + template + void WriteVector(const std::vector vector, + ByteBufferStreamWriter* stream) const; +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_ENCODABLE_VALUE_SERIALIZER_H_ diff --git a/shell/platform/common/cpp/client_wrapper/standard_message_codec_unittests.cc b/shell/platform/common/cpp/client_wrapper/standard_message_codec_unittests.cc new file mode 100644 index 0000000000000..08f90e54d3899 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/standard_message_codec_unittests.cc @@ -0,0 +1,163 @@ +// Copyright 2013 The Flutter 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/common/cpp/client_wrapper/include/flutter/standard_message_codec.h" + +#include +#include + +#include "flutter/shell/platform/common/cpp/client_wrapper/testing/encodable_value_utils.h" +#include "gtest/gtest.h" + +namespace flutter { + +// Validates round-trip encoding and decoding of |value|, and checks that the +// encoded value matches |expected_encoding|. +static void CheckEncodeDecode(const EncodableValue& value, + const std::vector& expected_encoding) { + const StandardMessageCodec& codec = StandardMessageCodec::GetInstance(); + auto encoded = codec.EncodeMessage(value); + ASSERT_TRUE(encoded); + EXPECT_EQ(*encoded, expected_encoding); + + auto decoded = codec.DecodeMessage(*encoded); + EXPECT_TRUE(testing::EncodableValuesAreEqual(value, *decoded)); +} + +// Validates round-trip encoding and decoding of |value|, and checks that the +// encoded value has the given prefix and length. +// +// This should be used only for Map, where asserting the order of the elements +// in a test is undesirable. +static void CheckEncodeDecodeWithEncodePrefix( + const EncodableValue& value, + const std::vector& expected_encoding_prefix, + size_t expected_encoding_length) { + EXPECT_TRUE(value.IsMap()); + const StandardMessageCodec& codec = StandardMessageCodec::GetInstance(); + auto encoded = codec.EncodeMessage(value); + ASSERT_TRUE(encoded); + + EXPECT_EQ(encoded->size(), expected_encoding_length); + ASSERT_GT(encoded->size(), expected_encoding_prefix.size()); + EXPECT_TRUE(std::equal( + encoded->begin(), encoded->begin() + expected_encoding_prefix.size(), + expected_encoding_prefix.begin(), expected_encoding_prefix.end())); + + auto decoded = codec.DecodeMessage(*encoded); + EXPECT_TRUE(testing::EncodableValuesAreEqual(value, *decoded)); +} + +TEST(StandardMessageCodec, CanEncodeAndDecodeNull) { + std::vector bytes = {0x00}; + CheckEncodeDecode(EncodableValue(), bytes); +} + +TEST(StandardMessageCodec, CanEncodeAndDecodeTrue) { + std::vector bytes = {0x01}; + CheckEncodeDecode(EncodableValue(true), bytes); +} + +TEST(StandardMessageCodec, CanEncodeAndDecodeFalse) { + std::vector bytes = {0x02}; + CheckEncodeDecode(EncodableValue(false), bytes); +} + +TEST(StandardMessageCodec, CanEncodeAndDecodeInt32) { + std::vector bytes = {0x03, 0x78, 0x56, 0x34, 0x12}; + CheckEncodeDecode(EncodableValue(0x12345678), bytes); +} + +TEST(StandardMessageCodec, CanEncodeAndDecodeInt64) { + std::vector bytes = {0x04, 0xef, 0xcd, 0xab, 0x90, + 0x78, 0x56, 0x34, 0x12}; + CheckEncodeDecode(EncodableValue(0x1234567890abcdef), bytes); +} + +TEST(StandardMessageCodec, CanEncodeAndDecodeDouble) { + std::vector bytes = {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x2d, 0x44, 0x54, 0xfb, 0x21, 0x09, 0x40}; + CheckEncodeDecode(EncodableValue(3.14159265358979311599796346854), bytes); +} + +TEST(StandardMessageCodec, CanEncodeAndDecodeString) { + std::vector bytes = {0x07, 0x0b, 0x68, 0x65, 0x6c, 0x6c, 0x6f, + 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64}; + CheckEncodeDecode(EncodableValue(u8"hello world"), bytes); +} + +TEST(StandardMessageCodec, CanEncodeAndDecodeStringWithNonAsciiCodePoint) { + std::vector bytes = {0x07, 0x05, 0x68, 0xe2, 0x98, 0xba, 0x77}; + CheckEncodeDecode(EncodableValue(u8"h\u263Aw"), bytes); +} + +TEST(StandardMessageCodec, CanEncodeAndDecodeStringWithNonBMPCodePoint) { + std::vector bytes = {0x07, 0x06, 0x68, 0xf0, 0x9f, 0x98, 0x82, 0x77}; + CheckEncodeDecode(EncodableValue(u8"h\U0001F602w"), bytes); +} + +TEST(StandardMessageCodec, CanEncodeAndDecodeList) { + std::vector bytes = { + 0x0c, 0x05, 0x00, 0x07, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x06, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x85, 0xeb, 0x51, 0xb8, 0x1e, + 0x09, 0x40, 0x03, 0x2f, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x03, 0x2a, + 0x00, 0x00, 0x00, 0x07, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, + }; + EncodableValue value(EncodableList{ + EncodableValue(), + EncodableValue("hello"), + EncodableValue(3.14), + EncodableValue(47), + EncodableValue(EncodableList{ + EncodableValue(42), + EncodableValue("nested"), + }), + }); + CheckEncodeDecode(value, bytes); +} + +TEST(StandardMessageCodec, CanEncodeAndDecodeMap) { + std::vector bytes_prefix = {0x0d, 0x04}; + EncodableValue value(EncodableMap{ + {EncodableValue("a"), EncodableValue(3.14)}, + {EncodableValue("b"), EncodableValue(47)}, + {EncodableValue(), EncodableValue()}, + {EncodableValue(3.14), EncodableValue(EncodableList{ + EncodableValue("nested"), + })}, + }); + CheckEncodeDecodeWithEncodePrefix(value, bytes_prefix, 48); +} + +TEST(StandardMessageCodec, CanEncodeAndDecodeByteArray) { + std::vector bytes = {0x08, 0x04, 0xba, 0x5e, 0xba, 0x11}; + EncodableValue value(std::vector{0xba, 0x5e, 0xba, 0x11}); + CheckEncodeDecode(value, bytes); +} + +TEST(StandardMessageCodec, CanEncodeAndDecodeInt32Array) { + std::vector bytes = {0x09, 0x03, 0x00, 0x00, 0x78, 0x56, 0x34, 0x12, + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00}; + EncodableValue value(std::vector{0x12345678, -1, 0}); + CheckEncodeDecode(value, bytes); +} + +TEST(StandardMessageCodec, CanEncodeAndDecodeInt64Array) { + std::vector bytes = {0x0a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xef, 0xcd, 0xab, 0x90, 0x78, 0x56, 0x34, 0x12, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + EncodableValue value(std::vector{0x1234567890abcdef, -1}); + CheckEncodeDecode(value, bytes); +} + +TEST(StandardMessageCodec, CanEncodeAndDecodeFloat64Array) { + std::vector bytes = {0x0b, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x2d, 0x44, 0x54, 0xfb, 0x21, 0x09, 0x40, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x8f, 0x40}; + EncodableValue value( + std::vector{3.14159265358979311599796346854, 1000.0}); + CheckEncodeDecode(value, bytes); +} + +} // namespace flutter diff --git a/shell/platform/common/cpp/client_wrapper/standard_method_codec_unittests.cc b/shell/platform/common/cpp/client_wrapper/standard_method_codec_unittests.cc new file mode 100644 index 0000000000000..e3f4b15de77a8 --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/standard_method_codec_unittests.cc @@ -0,0 +1,105 @@ +// Copyright 2013 The Flutter 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/common/cpp/client_wrapper/include/flutter/standard_method_codec.h" + +#include "flutter/shell/platform/common/cpp/client_wrapper/testing/encodable_value_utils.h" +#include "gtest/gtest.h" + +namespace flutter { + +namespace { + +// Returns true if the given method calls have the same method name, and their +// arguments have equivalent values. +bool MethodCallsAreEqual(const MethodCall& a, + const MethodCall& b) { + if (a.method_name() != b.method_name()) { + return false; + } + // Treat nullptr and Null as equivalent. + if ((!a.arguments() || a.arguments()->IsNull()) && + (!b.arguments() || b.arguments()->IsNull())) { + return true; + } + return testing::EncodableValuesAreEqual(*a.arguments(), *b.arguments()); +} + +} // namespace + +TEST(StandardMethodCodec, HandlesMethodCallsWithNullArguments) { + const StandardMethodCodec& codec = StandardMethodCodec::GetInstance(); + MethodCall call("hello", nullptr); + auto encoded = codec.EncodeMethodCall(call); + ASSERT_NE(encoded.get(), nullptr); + std::unique_ptr> decoded = + codec.DecodeMethodCall(*encoded); + ASSERT_NE(decoded.get(), nullptr); + EXPECT_TRUE(MethodCallsAreEqual(call, *decoded)); +} + +TEST(StandardMethodCodec, HandlesMethodCallsWithArgument) { + const StandardMethodCodec& codec = StandardMethodCodec::GetInstance(); + MethodCall call( + "hello", std::make_unique(EncodableList{ + EncodableValue(42), + EncodableValue("world"), + })); + auto encoded = codec.EncodeMethodCall(call); + ASSERT_NE(encoded.get(), nullptr); + std::unique_ptr> decoded = + codec.DecodeMethodCall(*encoded); + ASSERT_NE(decoded.get(), nullptr); + EXPECT_TRUE(MethodCallsAreEqual(call, *decoded)); +} + +TEST(StandardMethodCodec, HandlesSuccessEnvelopesWithNullResult) { + const StandardMethodCodec& codec = StandardMethodCodec::GetInstance(); + auto encoded = codec.EncodeSuccessEnvelope(); + ASSERT_NE(encoded.get(), nullptr); + std::vector bytes = {0x00, 0x00}; + EXPECT_EQ(*encoded, bytes); + // TODO: Add round-trip check once decoding replies is implemented. +} + +TEST(StandardMethodCodec, HandlesSuccessEnvelopesWithResult) { + const StandardMethodCodec& codec = StandardMethodCodec::GetInstance(); + EncodableValue result(42); + auto encoded = codec.EncodeSuccessEnvelope(&result); + ASSERT_NE(encoded.get(), nullptr); + std::vector bytes = {0x00, 0x03, 0x2a, 0x00, 0x00, 0x00}; + EXPECT_EQ(*encoded, bytes); + // TODO: Add round-trip check once decoding replies is implemented. +} + +TEST(StandardMethodCodec, HandlesErrorEnvelopesWithNulls) { + const StandardMethodCodec& codec = StandardMethodCodec::GetInstance(); + auto encoded = codec.EncodeErrorEnvelope("errorCode"); + ASSERT_NE(encoded.get(), nullptr); + std::vector bytes = {0x01, 0x07, 0x09, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x43, 0x6f, 0x64, 0x65, 0x00, 0x00}; + EXPECT_EQ(*encoded, bytes); + // TODO: Add round-trip check once decoding replies is implemented. +} + +TEST(StandardMethodCodec, HandlesErrorEnvelopesWithDetails) { + const StandardMethodCodec& codec = StandardMethodCodec::GetInstance(); + EncodableValue details(EncodableList{ + EncodableValue("a"), + EncodableValue(42), + }); + auto encoded = + codec.EncodeErrorEnvelope("errorCode", "something failed", &details); + ASSERT_NE(encoded.get(), nullptr); + std::vector bytes = { + 0x01, 0x07, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, + 0x64, 0x65, 0x07, 0x10, 0x73, 0x6f, 0x6d, 0x65, 0x74, 0x68, + 0x69, 0x6e, 0x67, 0x20, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, + 0x0c, 0x02, 0x07, 0x01, 0x61, 0x03, 0x2a, 0x00, 0x00, 0x00, + }; + EXPECT_EQ(*encoded, bytes); + // TODO: Add round-trip check once decoding replies is implemented. +} + +} // namespace flutter diff --git a/shell/platform/common/cpp/client_wrapper/testing/encodable_value_utils.cc b/shell/platform/common/cpp/client_wrapper/testing/encodable_value_utils.cc new file mode 100644 index 0000000000000..c9ae7ad1859fb --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/testing/encodable_value_utils.cc @@ -0,0 +1,89 @@ +// Copyright 2013 The Flutter 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/common/cpp/client_wrapper/testing/encodable_value_utils.h" + +#include + +namespace flutter { +namespace testing { + +bool EncodableValuesAreEqual(const EncodableValue& a, const EncodableValue& b) { + if (a.type() != b.type()) { + return false; + } + + switch (a.type()) { + case EncodableValue::Type::kNull: + return true; + case EncodableValue::Type::kBool: + return a.BoolValue() == b.BoolValue(); + case EncodableValue::Type::kInt: + return a.IntValue() == b.IntValue(); + case EncodableValue::Type::kLong: + return a.LongValue() == b.LongValue(); + case EncodableValue::Type::kDouble: + // This is a crude epsilon, but fine for the values in the the unit tests. + return std::abs(a.DoubleValue() - b.DoubleValue()) < 0.0001l; + case EncodableValue::Type::kString: + return a.StringValue() == b.StringValue(); + case EncodableValue::Type::kByteList: + return a.ByteListValue() == b.ByteListValue(); + case EncodableValue::Type::kIntList: + return a.IntListValue() == b.IntListValue(); + case EncodableValue::Type::kLongList: + return a.LongListValue() == b.LongListValue(); + case EncodableValue::Type::kDoubleList: + return a.DoubleListValue() == b.DoubleListValue(); + case EncodableValue::Type::kList: { + const auto& a_list = a.ListValue(); + const auto& b_list = b.ListValue(); + if (a_list.size() != b_list.size()) { + return false; + } + for (size_t i = 0; i < a_list.size(); ++i) { + if (!EncodableValuesAreEqual(a_list[0], b_list[0])) { + return false; + } + } + return true; + } + case EncodableValue::Type::kMap: { + const auto& a_map = a.MapValue(); + const auto& b_map = b.MapValue(); + if (a_map.size() != b_map.size()) { + return false; + } + // Store references to all the keys in |b|. + std::vector unmatched_b_keys; + for (auto& pair : b_map) { + unmatched_b_keys.push_back(&pair.first); + } + // For each key,value in |a|, see if any of the not-yet-matched key,value + // pairs in |b| match by value; if so, remove that match and continue. + for (const auto& pair : a_map) { + bool found_match = false; + for (size_t i = 0; i < unmatched_b_keys.size(); ++i) { + const EncodableValue& b_key = *unmatched_b_keys[i]; + if (EncodableValuesAreEqual(pair.first, b_key) && + EncodableValuesAreEqual(pair.second, b_map.at(b_key))) { + found_match = true; + unmatched_b_keys.erase(unmatched_b_keys.begin() + i); + break; + } + } + if (!found_match) { + return false; + } + } + // If all entries had matches, consider the maps equal. + return true; + } + } + assert(false); + return false; +} + +} // namespace testing +} // namespace flutter diff --git a/shell/platform/common/cpp/client_wrapper/testing/encodable_value_utils.h b/shell/platform/common/cpp/client_wrapper/testing/encodable_value_utils.h new file mode 100644 index 0000000000000..465afb0e96efd --- /dev/null +++ b/shell/platform/common/cpp/client_wrapper/testing/encodable_value_utils.h @@ -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. + +#ifndef FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_TESTING_ENCODABLE_VALUE_UTILS_H_ +#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_TESTING_ENCODABLE_VALUE_UTILS_H_ + +#include "flutter/shell/platform/common/cpp/client_wrapper/include/flutter/encodable_value.h" + +namespace flutter { +namespace testing { + +// Returns true if |a| and |b| have equivalent values, recursively comparing +// the contents of collections (unlike the < operator defined on EncodableValue, +// which doesn't consider different collections with the same contents to be +// the same). +bool EncodableValuesAreEqual(const EncodableValue& a, const EncodableValue& b); + +} // namespace testing +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_CLIENT_WRAPPER_TESTING_ENCODABLE_VALUE_UTILS_H_ From 3b016106c744878f63914213d84da0358c8df129 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Tue, 16 Apr 2019 20:36:25 -0700 Subject: [PATCH 0829/1117] Check that TransformLayer has a finite matrix (#8585) To catch issues like https://github.com/flutter/flutter/issues/30586 https://github.com/flutter/flutter/pull/31097 will trigger this CHECK if https://github.com/flutter/engine/pull/8467 were reverted and the transform_ were not initialized in this PR. --- flow/layers/transform_layer.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/flow/layers/transform_layer.cc b/flow/layers/transform_layer.cc index b3b259db9e652..7a41312fe6899 100644 --- a/flow/layers/transform_layer.cc +++ b/flow/layers/transform_layer.cc @@ -6,11 +6,27 @@ namespace flow { -TransformLayer::TransformLayer() = default; +TransformLayer::TransformLayer() { + transform_.setIdentity(); +} TransformLayer::~TransformLayer() = default; void TransformLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { + // Checks (in some degree) that SkMatrix transform_ is valid and initialized. + // + // We need this even if is_set_ is true since one can call set_transform with + // an uninitialized SkMatrix. + // + // If transform_ is uninitialized, this assert may look flaky as it doesn't + // fail all the time, and some rerun may make it pass. But don't ignore it and + // just rerun the test if this is triggered, since even a flaky failure here + // may signify a potentially big problem in the code. + // + // We have to write this flaky test because there is no reliable way to test + // whether a variable is initialized or not in C++. + FML_CHECK(transform_.isFinite()); + SkMatrix child_matrix; child_matrix.setConcat(matrix, transform_); From fdd427241b7790a1ad86794725b311245ed3b470 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 17 Apr 2019 00:26:24 -0400 Subject: [PATCH 0830/1117] Roll src/third_party/skia 70ed05e53ad2..652b007a4cbb (1 commits) (#8601) https://skia.googlesource.com/skia.git/%2Blog/70ed05e53ad2..652b007a4cbb git log 70ed05e53ad244b3234415b447e5fcd53fb40e3b..652b007a4cbb0b8c716510949456243573129ff4 --date=short --no-merges --format=%ad %ae %s 2019-04-16 reed@google.com Revert "Revert "Simplify SkTypeface::charsToGlyphs API to require UTF32 input"" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 06a412edee768..fef38d353d233 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': '70ed05e53ad244b3234415b447e5fcd53fb40e3b', + 'skia_revision': '652b007a4cbb0b8c716510949456243573129ff4', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6151facf80b35..c7b08c6ea8bce 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 7e986723b35e27a14d9131c9199c83c4 +Signature: 38aaae83d27283f1b6b21cb6db0b331a UNUSED LICENSES: From 8156268f098ab6ccadad78de6296675d48adefc0 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 16 Apr 2019 21:44:05 -0700 Subject: [PATCH 0831/1117] Roll src/third_party/dart 8e73b3c006..d9c40462c2 (4 commits) d9c40462c2 [vm] Rename kImplicitStaticFinalGetter to kImplicitStaticGetter. 9a5a720413 Remove dead/outdated lints from pkg/dev_compiler/README.md 9d15138c91 [tests] Revert the previous deletion of UI-as-Code const tests 523666a97a Fix messages_test. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index fef38d353d233..87ffb7380fd4a 100644 --- a/DEPS +++ b/DEPS @@ -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': '8e73b3c006468c234675d5cb753f9537cd310bd5', + 'dart_revision': 'd9c40462c21a9888820f5ac298c43d0fa9a5831c', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index d6919e361071d..a299f404f314c 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 78817383b5866c29157d2ebca6d4fb40 +Signature: dda549e1b08005c8cbc373c44630c238 UNUSED LICENSES: From 4266f8583f87e1e4f35dcb006cf0145655c04404 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Tue, 16 Apr 2019 22:37:39 -0700 Subject: [PATCH 0832/1117] Add desktop shell unittests to test script (#8600) Builds the unit test on all platforms, and adds them to the aggregate test script. --- BUILD.gn | 9 ++----- .../common/cpp/client_wrapper/BUILD.gn | 2 ++ .../encodable_value_unittests.cc | 25 ++++++++++--------- .../standard_message_codec_unittests.cc | 2 +- shell/platform/glfw/client_wrapper/BUILD.gn | 2 ++ testing/run_tests.sh | 6 +++++ 6 files changed, 26 insertions(+), 20 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 2e7cc0fa71e5e..1ae4a19c64803 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -49,20 +49,15 @@ group("flutter") { "$flutter_root/fml:fml_unittests", "$flutter_root/runtime:runtime_unittests", "$flutter_root/shell/common:shell_unittests", + "$flutter_root/shell/platform/common/cpp/client_wrapper:client_wrapper_unittests", "$flutter_root/shell/platform/embedder:embedder_unittests", + "$flutter_root/shell/platform/glfw/client_wrapper:client_wrapper_glfw_unittests", "$flutter_root/third_party/txt:txt_unittests", ] if (!is_win) { public_deps += [ "$flutter_root/shell/common:shell_benchmarks" ] } - - if (is_linux) { - public_deps += [ - "$flutter_root/shell/platform/common/cpp/client_wrapper:client_wrapper_unittests", - "$flutter_root/shell/platform/glfw/client_wrapper:client_wrapper_glfw_unittests", - ] - } } } diff --git a/shell/platform/common/cpp/client_wrapper/BUILD.gn b/shell/platform/common/cpp/client_wrapper/BUILD.gn index 095877364b346..4028b76650ef0 100644 --- a/shell/platform/common/cpp/client_wrapper/BUILD.gn +++ b/shell/platform/common/cpp/client_wrapper/BUILD.gn @@ -68,6 +68,8 @@ source_set("client_wrapper_library_stubs") { "testing/stub_flutter_api.h", ] + defines = [ "FLUTTER_DESKTOP_LIBRARY" ] + public_deps = [ "$flutter_root/shell/platform/common/cpp:common_cpp_library_headers", ] diff --git a/shell/platform/common/cpp/client_wrapper/encodable_value_unittests.cc b/shell/platform/common/cpp/client_wrapper/encodable_value_unittests.cc index 6784fa4b775f2..82ec96d0f8852 100644 --- a/shell/platform/common/cpp/client_wrapper/encodable_value_unittests.cc +++ b/shell/platform/common/cpp/client_wrapper/encodable_value_unittests.cc @@ -59,7 +59,7 @@ TEST(EncodableValueTest, LongValueFromInt) { } TEST(EncodableValueTest, Long) { - EncodableValue value(42l); + EncodableValue value(INT64_C(42)); VerifyType(value, EncodableValue::Type::kLong); EXPECT_EQ(value.LongValue(), 42); @@ -170,7 +170,7 @@ TEST(EncodableValueTest, List) { TEST(EncodableValueTest, Map) { EncodableMap encodables = { {EncodableValue(), EncodableValue(std::vector{1, 2, 3})}, - {EncodableValue(1), EncodableValue(10000l)}, + {EncodableValue(1), EncodableValue(INT64_C(10000))}, {EncodableValue("two"), EncodableValue(7)}, }; EncodableValue value(encodables); @@ -178,7 +178,7 @@ TEST(EncodableValueTest, Map) { EncodableMap& map_value = value.MapValue(); EXPECT_EQ(map_value[EncodableValue()].IsIntList(), true); - EXPECT_EQ(map_value[EncodableValue(1)].LongValue(), 10000l); + EXPECT_EQ(map_value[EncodableValue(1)].LongValue(), INT64_C(10000)); EXPECT_EQ(map_value[EncodableValue("two")].IntValue(), 7); // Ensure that it's a modifiable copy of the original map. @@ -192,7 +192,8 @@ TEST(EncodableValueTest, EmptyTypeConstructor) { EXPECT_TRUE(EncodableValue(EncodableValue::Type::kNull).IsNull()); EXPECT_EQ(EncodableValue(EncodableValue::Type::kBool).BoolValue(), false); EXPECT_EQ(EncodableValue(EncodableValue::Type::kInt).IntValue(), 0); - EXPECT_EQ(EncodableValue(EncodableValue::Type::kLong).LongValue(), 0l); + EXPECT_EQ(EncodableValue(EncodableValue::Type::kLong).LongValue(), + INT64_C(0)); EXPECT_EQ(EncodableValue(EncodableValue::Type::kDouble).DoubleValue(), 0.0); EXPECT_EQ(EncodableValue(EncodableValue::Type::kString).StringValue().size(), 0u); @@ -226,9 +227,9 @@ TEST(EncodableValueTest, Comparison) { EncodableValue(0), EncodableValue(100), // Long - EncodableValue(-7l), - EncodableValue(0l), - EncodableValue(100l), + EncodableValue(INT64_C(-7)), + EncodableValue(INT64_C(0)), + EncodableValue(INT64_C(100)), // Double EncodableValue(-7.0), EncodableValue(0.0), @@ -243,11 +244,11 @@ TEST(EncodableValueTest, Comparison) { EncodableValue(std::vector{0, 1}), EncodableValue(std::vector{0, 100}), // LongList - EncodableValue(std::vector{0, 1l}), - EncodableValue(std::vector{0, 100l}), + EncodableValue(std::vector{0, INT64_C(1)}), + EncodableValue(std::vector{0, INT64_C(100)}), // DoubleList - EncodableValue(std::vector{0, 1l}), - EncodableValue(std::vector{0, 100l}), + EncodableValue(std::vector{0, INT64_C(1)}), + EncodableValue(std::vector{0, INT64_C(100)}), // List EncodableValue(EncodableList{EncodableValue(), EncodableValue(true)}), EncodableValue(EncodableList{EncodableValue(), EncodableValue(1.0)}), @@ -289,7 +290,7 @@ TEST(EncodableValueTest, DeepCopy) { EncodableList encodables = { EncodableValue(EncodableMap{ {EncodableValue(), EncodableValue(std::vector{1, 2, 3})}, - {EncodableValue(1), EncodableValue(10000l)}, + {EncodableValue(1), EncodableValue(INT64_C(0000))}, {EncodableValue("two"), EncodableValue(7)}, }), EncodableValue(EncodableList{ diff --git a/shell/platform/common/cpp/client_wrapper/standard_message_codec_unittests.cc b/shell/platform/common/cpp/client_wrapper/standard_message_codec_unittests.cc index 08f90e54d3899..e56a44d62bebe 100644 --- a/shell/platform/common/cpp/client_wrapper/standard_message_codec_unittests.cc +++ b/shell/platform/common/cpp/client_wrapper/standard_message_codec_unittests.cc @@ -72,7 +72,7 @@ TEST(StandardMessageCodec, CanEncodeAndDecodeInt32) { TEST(StandardMessageCodec, CanEncodeAndDecodeInt64) { std::vector bytes = {0x04, 0xef, 0xcd, 0xab, 0x90, 0x78, 0x56, 0x34, 0x12}; - CheckEncodeDecode(EncodableValue(0x1234567890abcdef), bytes); + CheckEncodeDecode(EncodableValue(INT64_C(0x1234567890abcdef)), bytes); } TEST(StandardMessageCodec, CanEncodeAndDecodeDouble) { diff --git a/shell/platform/glfw/client_wrapper/BUILD.gn b/shell/platform/glfw/client_wrapper/BUILD.gn index d9e1b482dbaf6..4a59ee8f4aae7 100644 --- a/shell/platform/glfw/client_wrapper/BUILD.gn +++ b/shell/platform/glfw/client_wrapper/BUILD.gn @@ -52,6 +52,8 @@ source_set("client_wrapper_library_stubs_glfw") { "testing/stub_flutter_glfw_api.h", ] + defines = [ "FLUTTER_DESKTOP_LIBRARY" ] + public_deps = [ "$flutter_root/shell/platform/glfw:flutter_glfw_headers", ] diff --git a/testing/run_tests.sh b/testing/run_tests.sh index 66126634646d1..621743aa809cc 100755 --- a/testing/run_tests.sh +++ b/testing/run_tests.sh @@ -38,6 +38,12 @@ echo "Running runtime_unittests..." echo "Running shell_unittests..." "$HOST_DIR/shell_unittests" +echo "Running client_wrapper_unittests..." +"$HOST_DIR/client_wrapper_unittests" + +echo "Running client_wrapper_glfw_unittests..." +"$HOST_DIR/client_wrapper_glfw_unittests" + echo "Running txt_unittests..." "$HOST_DIR/txt_unittests" --font-directory="$BUILDROOT_DIR/flutter/third_party/txt/third_party/fonts" From 53c0905b1a32c812095479d448069c5e3cff6c2e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 17 Apr 2019 03:56:24 -0400 Subject: [PATCH 0833/1117] Roll src/third_party/skia 652b007a4cbb..e88d4382e1cf (4 commits) (#8603) https://skia.googlesource.com/skia.git/%2Blog/652b007a4cbb..e88d4382e1cf git log 652b007a4cbb0b8c716510949456243573129ff4..e88d4382e1cf0041ecc1f148e05fbf3b7d0fb7b1 --date=short --no-merges --format=%ad %ae %s 2019-04-17 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-04-17 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 e7da32f1c73e..c832cdd75f75 (7 commits) 2019-04-17 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 25be5bb97518..84c3a94e1450 (6 commits) 2019-04-17 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src 95629c4c410f..a3585f70a100 (459 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 87ffb7380fd4a..23a086034d967 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': '652b007a4cbb0b8c716510949456243573129ff4', + 'skia_revision': 'e88d4382e1cf0041ecc1f148e05fbf3b7d0fb7b1', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index c7b08c6ea8bce..1b5ff6216ea3e 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 38aaae83d27283f1b6b21cb6db0b331a +Signature: d72968a69a1939edde6ccc453836d86d UNUSED LICENSES: From f88ba6e435dffe7e7b4f9ea927a613bd265d2362 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 17 Apr 2019 08:31:39 -0400 Subject: [PATCH 0834/1117] Roll src/third_party/skia e88d4382e1cf..33906ad1e26f (1 commits) (#8604) https://skia.googlesource.com/skia.git/%2Blog/e88d4382e1cf..33906ad1e26f git log e88d4382e1cf0041ecc1f148e05fbf3b7d0fb7b1..33906ad1e26fd36430a70712382b3edc3970213c --date=short --no-merges --format=%ad %ae %s 2019-04-17 robertphillips@google.com Reland "Revert "Simplify SkTypeface::charsToGlyphs API to require UTF32 input"" The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 23a086034d967..e6bb5b071292f 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': 'e88d4382e1cf0041ecc1f148e05fbf3b7d0fb7b1', + 'skia_revision': '33906ad1e26fd36430a70712382b3edc3970213c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 1b5ff6216ea3e..2c5fcf6f7a74d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: d72968a69a1939edde6ccc453836d86d +Signature: 4ff43bfef26c9c9ec9fc2bfdaa59a636 UNUSED LICENSES: From b0dedbd605bff2e505f32c92b57c4465bb2fb5b8 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 17 Apr 2019 06:43:43 -0700 Subject: [PATCH 0835/1117] Roll src/third_party/dart d9c40462c2..f0da03ca36 (1 commits) f0da03ca36 [vm/compiler] Do not include FPU registers on ARM if VFP is not supported --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index e6bb5b071292f..84ec265908324 100644 --- a/DEPS +++ b/DEPS @@ -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': 'd9c40462c21a9888820f5ac298c43d0fa9a5831c', + 'dart_revision': 'f0da03ca367b15bf132b259acac42ed658f7b70d', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index a299f404f314c..62957332ff643 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: dda549e1b08005c8cbc373c44630c238 +Signature: 3ea8eaf2d73434b50c81b323a6e6ef43 UNUSED LICENSES: From 7b38aef03d2c25d18bb7006527fb48879727a878 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 17 Apr 2019 12:00:53 -0400 Subject: [PATCH 0836/1117] Roll src/third_party/skia 33906ad1e26f..5155e09d1466 (4 commits) (#8609) https://skia.googlesource.com/skia.git/%2Blog/33906ad1e26f..5155e09d1466 git log 33906ad1e26fd36430a70712382b3edc3970213c..5155e09d146665be078494247092fa990d5ae4a7 --date=short --no-merges --format=%ad %ae %s 2019-04-17 egdaniel@google.com Revert "added more SPIR-V RelaxedPrecision decorations" 2019-04-17 jvanverth@google.com Make Metal render loop more stable 2019-04-17 mtklein@google.com roll clang_win 2019-04-17 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 84ec265908324..b766c965f526f 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': '33906ad1e26fd36430a70712382b3edc3970213c', + 'skia_revision': '5155e09d146665be078494247092fa990d5ae4a7', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2c5fcf6f7a74d..e670e77a650e9 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 4ff43bfef26c9c9ec9fc2bfdaa59a636 +Signature: 770af3555f04d7151714ce4c8c7c3ce7 UNUSED LICENSES: From f62ab83bae34690998eb2c8de13ec7397294078f Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 17 Apr 2019 09:34:46 -0700 Subject: [PATCH 0837/1117] Roll src/third_party/dart f0da03ca36..bc99f1ca28 (1 commits) bc99f1ca28 Test a few more uses of the nullable type decorator --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index b766c965f526f..2ced113e0ab17 100644 --- a/DEPS +++ b/DEPS @@ -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': 'f0da03ca367b15bf132b259acac42ed658f7b70d', + 'dart_revision': 'bc99f1ca2819c67a5260929b03c3d7ed24943b58', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py From 0e27e0fc38d15c33198e1f200f0cf8d0c1910bb4 Mon Sep 17 00:00:00 2001 From: Michael Klimushyn Date: Wed, 17 Apr 2019 09:56:46 -0700 Subject: [PATCH 0838/1117] Pipe Z bounds from ViewportMetrics to Flow (#8583) This is the first step in making Flutter aware of and responsive to Z bound overflow. On its own this patch shouldn't result in any changes in behavior. This will need to be followed up with a patch in Fuchsia's Flutter runner to set the Z bounds after this lands, and another patch in the engine actually implementing the desired overflow behavior. This Z bound info is routed through the engine itself to make sure the bounds in flow are truly consistent from the Fuchsia runner. However these values should eventually be exposed to the framework as well. --- flow/layers/layer.h | 1 + flow/layers/layer_tree.cc | 2 +- flow/layers/physical_shape_layer.cc | 4 +++- flow/layers/physical_shape_layer.h | 11 +++++++++-- flow/scene_update_context.cc | 15 ++++++++++++--- flow/scene_update_context.h | 4 +++- lib/ui/compositing/scene_builder.cc | 2 ++ lib/ui/window/viewport_metrics.cc | 29 +++++++++++++++++++++++++++++ lib/ui/window/viewport_metrics.h | 26 ++++++++++++++++++++++++++ shell/common/engine.cc | 3 ++- 10 files changed, 88 insertions(+), 9 deletions(-) diff --git a/flow/layers/layer.h b/flow/layers/layer.h index 8cb9b6710cce7..dc1242f0f7680 100644 --- a/flow/layers/layer.h +++ b/flow/layers/layer.h @@ -56,6 +56,7 @@ struct PrerollContext { const Stopwatch& engine_time; TextureRegistry& texture_registry; const bool checkerboard_offscreen_layers; + float total_elevation = 0.0f; }; // Represents a single composited layer. Created on the UI thread but then diff --git a/flow/layers/layer_tree.cc b/flow/layers/layer_tree.cc index 08a1990da12d8..0b24b52fd8d16 100644 --- a/flow/layers/layer_tree.cc +++ b/flow/layers/layer_tree.cc @@ -54,7 +54,7 @@ void LayerTree::UpdateScene(SceneUpdateContext& context, context, SkRRect::MakeRect( SkRect::MakeWH(frame_size_.width(), frame_size_.height())), - SK_ColorTRANSPARENT, 0.f); + SK_ColorTRANSPARENT); if (root_layer_->needs_system_composite()) { root_layer_->UpdateScene(context); } diff --git a/flow/layers/physical_shape_layer.cc b/flow/layers/physical_shape_layer.cc index 93bd2664a916c..5f573ad0d3e10 100644 --- a/flow/layers/physical_shape_layer.cc +++ b/flow/layers/physical_shape_layer.cc @@ -43,6 +43,8 @@ void PhysicalShapeLayer::set_path(const SkPath& path) { void PhysicalShapeLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { + context->total_elevation += elevation_; + total_elevation_ = context->total_elevation; SkRect child_paint_bounds; PrerollChildren(context, matrix, &child_paint_bounds); @@ -118,7 +120,7 @@ void PhysicalShapeLayer::UpdateScene(SceneUpdateContext& context) { // If we can't find an existing retained surface, create one. SceneUpdateContext::Frame frame(context, frameRRect_, color_, elevation_, - this); + total_elevation_, viewport_depth_, this); for (auto& layer : layers()) { if (layer->needs_painting()) { frame.AddPaintLayer(layer.get()); diff --git a/flow/layers/physical_shape_layer.h b/flow/layers/physical_shape_layer.h index 45ba68e86d9b3..46885c902bbe1 100644 --- a/flow/layers/physical_shape_layer.h +++ b/flow/layers/physical_shape_layer.h @@ -16,10 +16,15 @@ class PhysicalShapeLayer : public ContainerLayer { void set_path(const SkPath& path); - void set_elevation(float elevation) { elevation_ = elevation; } void set_color(SkColor color) { color_ = color; } void set_shadow_color(SkColor shadow_color) { shadow_color_ = shadow_color; } void set_device_pixel_ratio(SkScalar dpr) { device_pixel_ratio_ = dpr; } + void set_viewport_depth(float depth) { viewport_depth_ = depth; } + + // Sets the elevation. This needs to be set before preroll because it's then + // cached by any children of this layer. Setting it after preroll will break + // their elevation calculations. + void set_elevation(float elevation) { elevation_ = elevation; } static void DrawShadow(SkCanvas* canvas, const SkPath& path, @@ -37,7 +42,9 @@ class PhysicalShapeLayer : public ContainerLayer { #endif // defined(OS_FUCHSIA) private: - float elevation_; + float elevation_ = 0.0f; + float total_elevation_ = 0.0f; + float viewport_depth_; SkColor color_; SkColor shadow_color_; SkScalar device_pixel_ratio_; diff --git a/flow/scene_update_context.cc b/flow/scene_update_context.cc index 07ff4d876a887..3c2834a8ffa5d 100644 --- a/flow/scene_update_context.cc +++ b/flow/scene_update_context.cc @@ -7,6 +7,7 @@ #include "flutter/flow/layers/layer.h" #include "flutter/flow/matrix_decomposition.h" #include "flutter/fml/trace_event.h" +#include "flutter/lib/ui/window/viewport_metrics.h" namespace flow { @@ -285,15 +286,23 @@ SceneUpdateContext::Transform::~Transform() { SceneUpdateContext::Frame::Frame(SceneUpdateContext& context, const SkRRect& rrect, SkColor color, - float elevation, + float local_elevation, + float world_elevation, + float depth, Layer* layer) : Entity(context), rrect_(rrect), color_(color), paint_bounds_(SkRect::MakeEmpty()), layer_(layer) { - if (elevation != 0.0) - entity_node().SetTranslation(0.f, 0.f, -elevation); + if (local_elevation != 0.0) { + if (depth > flutter::kUnsetDepth && world_elevation >= depth) { + // TODO(mklim): Deal with bounds overflow correctly. + FML_LOG(ERROR) << "Elevation " << world_elevation << " is outside of " + << depth; + } + entity_node().SetTranslation(0.f, 0.f, -local_elevation); + } } SceneUpdateContext::Frame::~Frame() { diff --git a/flow/scene_update_context.h b/flow/scene_update_context.h index f19c5b8f76e4e..925fc9493510f 100644 --- a/flow/scene_update_context.h +++ b/flow/scene_update_context.h @@ -112,7 +112,9 @@ class SceneUpdateContext { Frame(SceneUpdateContext& context, const SkRRect& rrect, SkColor color, - float elevation, + float local_elevation = 0.0f, + float parent_elevation = 0.0f, + float depth = 0.0f, Layer* layer = nullptr); ~Frame(); diff --git a/lib/ui/compositing/scene_builder.cc b/lib/ui/compositing/scene_builder.cc index e504529559b6a..447119594f39b 100644 --- a/lib/ui/compositing/scene_builder.cc +++ b/lib/ui/compositing/scene_builder.cc @@ -190,6 +190,8 @@ fml::RefPtr SceneBuilder::pushPhysicalShape(const CanvasPath* path, layer->set_shadow_color(static_cast(shadow_color)); layer->set_device_pixel_ratio( UIDartState::Current()->window()->viewport_metrics().device_pixel_ratio); + layer->set_viewport_depth( + UIDartState::Current()->window()->viewport_metrics().physical_depth); PushLayer(layer); return EngineLayer::MakeRetained(layer); } diff --git a/lib/ui/window/viewport_metrics.cc b/lib/ui/window/viewport_metrics.cc index 88a9eb8434955..3dabeeb1ed8c1 100644 --- a/lib/ui/window/viewport_metrics.cc +++ b/lib/ui/window/viewport_metrics.cc @@ -30,6 +30,35 @@ ViewportMetrics::ViewportMetrics(double p_device_pixel_ratio, physical_view_inset_bottom(p_physical_view_inset_bottom), physical_view_inset_left(p_physical_view_inset_left) {} +ViewportMetrics::ViewportMetrics(double p_device_pixel_ratio, + double p_physical_width, + double p_physical_height, + double p_physical_depth, + 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_front, + double p_physical_view_inset_back, + 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_depth(p_physical_depth), + 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), + physical_view_inset_front(p_physical_view_inset_front), + physical_view_inset_back(p_physical_view_inset_back) {} + ViewportMetrics::ViewportMetrics(const ViewportMetrics& other) = default; } // namespace flutter diff --git a/lib/ui/window/viewport_metrics.h b/lib/ui/window/viewport_metrics.h index 3a40505ba329e..aa0d7dc8ea714 100644 --- a/lib/ui/window/viewport_metrics.h +++ b/lib/ui/window/viewport_metrics.h @@ -9,16 +9,35 @@ namespace flutter { +static const double kUnsetDepth = -1; + struct ViewportMetrics { ViewportMetrics(); + // Create a 2D ViewportMetrics instance. + 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); + + // Create a ViewportMetrics instance that contains z information. ViewportMetrics(double p_device_pixel_ratio, double p_physical_width, double p_physical_height, + double p_physical_depth, 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_front, + double p_physical_view_inset_back, double p_physical_view_inset_top, double p_physical_view_inset_right, double p_physical_view_inset_bottom, @@ -29,6 +48,7 @@ struct ViewportMetrics { double device_pixel_ratio = 1.0; double physical_width = 0; double physical_height = 0; + double physical_depth = kUnsetDepth; double physical_padding_top = 0; double physical_padding_right = 0; double physical_padding_bottom = 0; @@ -37,11 +57,14 @@ struct ViewportMetrics { double physical_view_inset_right = 0; double physical_view_inset_bottom = 0; double physical_view_inset_left = 0; + double physical_view_inset_front = kUnsetDepth; + double physical_view_inset_back = kUnsetDepth; }; struct LogicalSize { double width = 0.0; double height = 0.0; + double depth = kUnsetDepth; }; struct LogicalInset { @@ -49,11 +72,14 @@ struct LogicalInset { double top = 0.0; double right = 0.0; double bottom = 0.0; + double front = kUnsetDepth; + double back = kUnsetDepth; }; struct LogicalMetrics { LogicalSize size; double scale = 1.0; + double scale_z = 1.0; LogicalInset padding; LogicalInset view_inset; }; diff --git a/shell/common/engine.cc b/shell/common/engine.cc index 4d7da77e85b6b..fdbd6bf7a8fde 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -237,7 +237,8 @@ void Engine::OnOutputSurfaceDestroyed() { void Engine::SetViewportMetrics(const ViewportMetrics& metrics) { bool dimensions_changed = viewport_metrics_.physical_height != metrics.physical_height || - viewport_metrics_.physical_width != metrics.physical_width; + viewport_metrics_.physical_width != metrics.physical_width || + viewport_metrics_.physical_depth != metrics.physical_depth; viewport_metrics_ = metrics; runtime_controller_->SetViewportMetrics(viewport_metrics_); if (animator_) { From dd9dcaf9a534c9cec5daba238e1d2cf9a62999b2 Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Wed, 17 Apr 2019 09:58:58 -0700 Subject: [PATCH 0839/1117] [fuchsia] Fix SceneUpdateContext for new PaintContext field (#8608) --- flow/scene_update_context.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/flow/scene_update_context.cc b/flow/scene_update_context.cc index 3c2834a8ffa5d..ab8b0fe30781a 100644 --- a/flow/scene_update_context.cc +++ b/flow/scene_update_context.cc @@ -197,6 +197,7 @@ SceneUpdateContext::ExecutePaintTasks(CompositorContext::ScopedFrame& frame) { SkCanvas* canvas = task.surface->GetSkiaSurface()->getCanvas(); Layer::PaintContext context = {canvas, canvas, + frame.gr_context(), nullptr, frame.context().frame_time(), frame.context().engine_time(), From 523a9a9adde96d22c801eac59f9f6db3d2a79a30 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Wed, 17 Apr 2019 10:53:59 -0700 Subject: [PATCH 0840/1117] Add FLEPluginRegistry for macOS (#8611) Creates a minimal FLEPluginRegistry protocol, which is a subset of the FlutterPluginRegistry. This is a small step toward eventually merging the APIs, but allows changing the example project structure to better reflect what a future template will look like. --- .../framework/Headers/FLEPluginRegistrar.h | 30 +++++++++++++++++++ .../framework/Headers/FLEViewController.h | 11 +++---- .../framework/Source/FLEViewController.mm | 15 +++++----- 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/shell/platform/darwin/macos/framework/Headers/FLEPluginRegistrar.h b/shell/platform/darwin/macos/framework/Headers/FLEPluginRegistrar.h index b9f7ac99b2a2a..b15a659136fb9 100644 --- a/shell/platform/darwin/macos/framework/Headers/FLEPluginRegistrar.h +++ b/shell/platform/darwin/macos/framework/Headers/FLEPluginRegistrar.h @@ -16,6 +16,9 @@ #import "FlutterMacros.h" #endif +// TODO: Merge this file and FLEPlugin.h with FlutterPlugin.h, sharing all but +// the platform-specific methods. + /** * The protocol for an object managing registration for a plugin. It provides access to application * context, as as allowing registering for callbacks for handling various conditions. @@ -46,3 +49,30 @@ FLUTTER_EXPORT channel:(nonnull FlutterMethodChannel*)channel; @end + +/** + * A registry of Flutter macOS plugins. + * + * Plugins are identified by unique string keys, typically the name of the + * plugin's main class. + * + * 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 FLEPluginRegistry + +/** + * Returns a registrar for registering a plugin. + * + * @param pluginKey The unique key identifying the plugin. + */ +- (nonnull id)registrarForPlugin:(nonnull NSString*)pluginKey; + +@end diff --git a/shell/platform/darwin/macos/framework/Headers/FLEViewController.h b/shell/platform/darwin/macos/framework/Headers/FLEViewController.h index e831934cd1911..c66cba2130a3d 100644 --- a/shell/platform/darwin/macos/framework/Headers/FLEViewController.h +++ b/shell/platform/darwin/macos/framework/Headers/FLEViewController.h @@ -35,8 +35,10 @@ typedef NS_ENUM(NSInteger, FlutterMouseTrackingMode) { * Flutter engine in non-interactive mode, or with a drawable Flutter canvas. */ FLUTTER_EXPORT -@interface FLEViewController - : NSViewController +@interface FLEViewController : NSViewController /** * The view this controller manages when launched in interactive mode (headless set to false). Must @@ -73,9 +75,4 @@ FLUTTER_EXPORT - (BOOL)launchHeadlessEngineWithAssetsPath:(nonnull NSURL*)assets commandLineArguments:(nullable NSArray*)arguments; -/** - * Returns the FLEPluginRegistrar that should be used to register the plugin with the given name. - */ -- (nonnull id)registrarForPlugin:(nonnull NSString*)pluginName; - @end diff --git a/shell/platform/darwin/macos/framework/Source/FLEViewController.mm b/shell/platform/darwin/macos/framework/Source/FLEViewController.mm index b0f732e31015b..d094170375219 100644 --- a/shell/platform/darwin/macos/framework/Source/FLEViewController.mm +++ b/shell/platform/darwin/macos/framework/Source/FLEViewController.mm @@ -251,13 +251,6 @@ - (BOOL)launchHeadlessEngineWithAssetsPath:(NSURL*)assets commandLineArguments:arguments]; } -- (id)registrarForPlugin:(NSString*)pluginName { - // Currently, the view controller acts as the registrar for all plugins, so the - // name is ignored. It is part of the API to reduce churn in the future when - // aligning more closely with the Flutter registrar system. - return self; -} - #pragma mark - Framework-internal methods - (void)addKeyResponder:(NSResponder*)responder { @@ -529,6 +522,14 @@ - (void)addMethodCallDelegate:(nonnull id)delegate }]; } +#pragma mark - FLEPluginRegistry + +- (id)registrarForPlugin:(NSString*)pluginName { + // Currently, the view controller acts as the registrar for all plugins, so the + // name is ignored. + return self; +} + #pragma mark - NSResponder - (BOOL)acceptsFirstResponder { From c5d1ba916cc938ebb1a122fcec26fb86b96d6aec Mon Sep 17 00:00:00 2001 From: bungeman Date: Wed, 17 Apr 2019 15:13:19 -0400 Subject: [PATCH 0841/1117] Remove call to SkFont::setLinearMetrics (#8612) This particular call doesn't do anything since the default is false anyway. In addition Skia is looking to remove this flag since setting it to true is now synonymous with setting the hinting to none. --- flow/layers/performance_overlay_layer.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/flow/layers/performance_overlay_layer.cc b/flow/layers/performance_overlay_layer.cc index e7f40058c3bfb..2d3c4166c936a 100644 --- a/flow/layers/performance_overlay_layer.cc +++ b/flow/layers/performance_overlay_layer.cc @@ -22,7 +22,6 @@ void DrawStatisticsText(SkCanvas& canvas, font = SkFont(SkTypeface::MakeFromFile(font_path.c_str())); } font.setSize(15); - font.setLinearMetrics(false); SkPaint paint; paint.setColor(SK_ColorGRAY); canvas.drawSimpleText(string.c_str(), string.size(), kUTF8_SkTextEncoding, x, From b767e4d3c36276e7eb7299a62566f5db42de15f2 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 17 Apr 2019 15:30:06 -0400 Subject: [PATCH 0842/1117] Roll src/third_party/skia 5155e09d1466..6f9047027be3 (5 commits) (#8613) https://skia.googlesource.com/skia.git/%2Blog/5155e09d1466..6f9047027be3 git log 5155e09d146665be078494247092fa990d5ae4a7..6f9047027be329719bb9fe79e6f892724e6a0fa2 --date=short --no-merges --format=%ad %ae %s 2019-04-17 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-04-16 reed@google.com Reland "Simplify SkTypeface::charsToGlyphs API to require UTF32 input" 2019-04-16 bsalomon@google.com Add flag to map buffer flags in GrCaps to indicate whether mapping a GrGpuBuffer for reading is synchronous or not. 2019-04-17 borenet@google.com [infra] More work on chrome_release_branch 2019-04-17 mtklein@google.com Add clang-cl arm64 builds The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 2ced113e0ab17..1f08f43f35757 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': '5155e09d146665be078494247092fa990d5ae4a7', + 'skia_revision': '6f9047027be329719bb9fe79e6f892724e6a0fa2', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index e670e77a650e9..d12bb50f7c6b0 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 770af3555f04d7151714ce4c8c7c3ce7 +Signature: 11a62db81fc2e5de87424264c609fcc2 UNUSED LICENSES: From 0534b6ae5579cacc13cc14dc5f9a646de410d84e Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 17 Apr 2019 12:37:03 -0700 Subject: [PATCH 0843/1117] Roll src/third_party/dart bc99f1ca28..7b9ab9f353 (5 commits) 7b9ab9f353 Add error ranges to more diagnostic tests 3782197e95 Sort summary_common.dart 37285467db Improvements to null_assertion_ambiguous_test b0c98d57fa Add the new manifest error codes to error codes list ebdefa3f5f add new "late" and "required" modifiers --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 1f08f43f35757..f9528a08ac801 100644 --- a/DEPS +++ b/DEPS @@ -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': 'bc99f1ca2819c67a5260929b03c3d7ed24943b58', + 'dart_revision': '7b9ab9f35390d36d32c405a807be31ae3ed0ddb7', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py From 8ff631f3dfb5ef8c0893113ea2860dce268ecb89 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Wed, 17 Apr 2019 14:38:45 -0700 Subject: [PATCH 0844/1117] Rename flow namespace to flutter (#8615) This follows our namespace change from shell to flutter: https://github.com/flutter/engine/pull/8520. --- flow/compositor_context.cc | 6 +-- flow/compositor_context.h | 4 +- flow/debug_print.cc | 5 ++- flow/debug_print.h | 4 +- flow/embedded_views.cc | 4 +- flow/embedded_views.h | 4 +- flow/export_node.cc | 6 +-- flow/export_node.h | 4 +- flow/flow_run_all_unittests.cc | 4 +- flow/flow_test_utils.cc | 4 +- flow/flow_test_utils.h | 4 +- flow/instrumentation.cc | 4 +- flow/instrumentation.h | 4 +- flow/layers/backdrop_filter_layer.cc | 4 +- flow/layers/backdrop_filter_layer.h | 4 +- flow/layers/child_scene_layer.cc | 4 +- flow/layers/child_scene_layer.h | 4 +- flow/layers/clip_path_layer.cc | 4 +- flow/layers/clip_path_layer.h | 4 +- flow/layers/clip_rect_layer.cc | 4 +- flow/layers/clip_rect_layer.h | 4 +- flow/layers/clip_rrect_layer.cc | 4 +- flow/layers/clip_rrect_layer.h | 4 +- flow/layers/color_filter_layer.cc | 4 +- flow/layers/color_filter_layer.h | 4 +- flow/layers/container_layer.cc | 4 +- flow/layers/container_layer.h | 4 +- flow/layers/layer.cc | 4 +- flow/layers/layer.h | 4 +- flow/layers/layer_tree.cc | 4 +- flow/layers/layer_tree.h | 4 +- flow/layers/opacity_layer.cc | 6 +-- flow/layers/opacity_layer.h | 4 +- flow/layers/performance_overlay_layer.cc | 4 +- flow/layers/performance_overlay_layer.h | 4 +- .../performance_overlay_layer_unittests.cc | 19 ++++---- flow/layers/physical_shape_layer.cc | 4 +- flow/layers/physical_shape_layer.h | 4 +- flow/layers/picture_layer.cc | 4 +- flow/layers/picture_layer.h | 4 +- flow/layers/platform_view_layer.cc | 4 +- flow/layers/platform_view_layer.h | 4 +- flow/layers/shader_mask_layer.cc | 4 +- flow/layers/shader_mask_layer.h | 4 +- flow/layers/texture_layer.cc | 4 +- flow/layers/texture_layer.h | 4 +- flow/layers/transform_layer.cc | 4 +- flow/layers/transform_layer.h | 4 +- flow/matrix_decomposition.cc | 4 +- flow/matrix_decomposition.h | 4 +- flow/matrix_decomposition_unittests.cc | 16 +++---- flow/paint_utils.cc | 4 +- flow/paint_utils.h | 4 +- flow/raster_cache.cc | 4 +- flow/raster_cache.h | 4 +- flow/raster_cache_key.cc | 4 +- flow/raster_cache_key.h | 4 +- flow/raster_cache_unittests.cc | 8 ++-- flow/scene_update_context.cc | 7 +-- flow/scene_update_context.h | 4 +- flow/skia_gpu_object.cc | 4 +- flow/skia_gpu_object.h | 4 +- flow/texture.cc | 4 +- flow/texture.h | 4 +- flow/view_holder.cc | 6 +-- flow/view_holder.h | 4 +- lib/ui/compositing/scene.cc | 8 ++-- lib/ui/compositing/scene.h | 8 ++-- lib/ui/compositing/scene_builder.cc | 45 ++++++++++--------- lib/ui/compositing/scene_builder.h | 6 +-- lib/ui/compositing/scene_host.cc | 16 ++++--- lib/ui/io_manager.h | 2 +- lib/ui/painting/canvas.cc | 4 +- lib/ui/painting/codec.cc | 8 ++-- lib/ui/painting/codec.h | 2 +- lib/ui/painting/engine_layer.cc | 2 +- lib/ui/painting/engine_layer.h | 8 ++-- lib/ui/painting/image.h | 4 +- lib/ui/painting/picture.cc | 5 ++- lib/ui/painting/picture.h | 6 +-- lib/ui/painting/shader.cc | 2 +- lib/ui/painting/shader.h | 6 +-- lib/ui/ui_dart_state.cc | 2 +- lib/ui/ui_dart_state.h | 4 +- runtime/runtime_delegate.h | 2 +- shell/common/animator.cc | 2 +- shell/common/animator.h | 6 +-- shell/common/engine.cc | 2 +- shell/common/engine.h | 2 +- shell/common/platform_view.cc | 2 +- shell/common/platform_view.h | 4 +- shell/common/rasterizer.cc | 24 +++++----- shell/common/rasterizer.h | 18 ++++---- shell/common/shell.cc | 4 +- shell/common/shell.h | 5 ++- shell/common/shell_io_manager.cc | 4 +- shell/common/shell_io_manager.h | 4 +- shell/common/surface.cc | 2 +- shell/common/surface.h | 2 +- shell/gpu/gpu_surface_gl.cc | 2 +- shell/gpu/gpu_surface_gl.h | 2 +- shell/gpu/gpu_surface_gl_delegate.cc | 2 +- shell/gpu/gpu_surface_gl_delegate.h | 2 +- shell/gpu/gpu_surface_software.cc | 4 +- shell/gpu/gpu_surface_software.h | 4 +- .../android/android_external_texture_gl.h | 2 +- .../framework/Source/FlutterPlatformViews.mm | 2 +- .../Source/FlutterPlatformViews_Internal.h | 2 +- .../darwin/ios/ios_external_texture_gl.h | 2 +- shell/platform/darwin/ios/ios_surface_gl.h | 16 +++---- shell/platform/darwin/ios/ios_surface_gl.mm | 5 ++- .../darwin/ios/ios_surface_software.h | 16 +++---- .../darwin/ios/ios_surface_software.mm | 4 +- .../embedder/embedder_external_texture_gl.cc | 8 ++-- .../embedder/embedder_external_texture_gl.h | 10 ++--- 115 files changed, 310 insertions(+), 301 deletions(-) diff --git a/flow/compositor_context.cc b/flow/compositor_context.cc index 30f1132818b2c..363696fa5674e 100644 --- a/flow/compositor_context.cc +++ b/flow/compositor_context.cc @@ -7,7 +7,7 @@ #include "flutter/flow/layers/layer_tree.h" #include "third_party/skia/include/core/SkCanvas.h" -namespace flow { +namespace flutter { CompositorContext::CompositorContext() = default; @@ -60,7 +60,7 @@ CompositorContext::ScopedFrame::~ScopedFrame() { context_.EndFrame(*this, instrumentation_enabled_); } -bool CompositorContext::ScopedFrame::Raster(flow::LayerTree& layer_tree, +bool CompositorContext::ScopedFrame::Raster(flutter::LayerTree& layer_tree, bool ignore_raster_cache) { layer_tree.Preroll(*this, ignore_raster_cache); // Clearing canvas after preroll reduces one render target switch when preroll @@ -82,4 +82,4 @@ void CompositorContext::OnGrContextDestroyed() { raster_cache_.Clear(); } -} // namespace flow +} // namespace flutter diff --git a/flow/compositor_context.h b/flow/compositor_context.h index f3a885ccedd3c..ec5e685718c91 100644 --- a/flow/compositor_context.h +++ b/flow/compositor_context.h @@ -16,7 +16,7 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkPictureRecorder.h" -namespace flow { +namespace flutter { class LayerTree; @@ -97,6 +97,6 @@ class CompositorContext { FML_DISALLOW_COPY_AND_ASSIGN(CompositorContext); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_COMPOSITOR_CONTEXT_H_ diff --git a/flow/debug_print.cc b/flow/debug_print.cc index a41171313540d..965c3c2c78614 100644 --- a/flow/debug_print.cc +++ b/flow/debug_print.cc @@ -8,7 +8,8 @@ #include "third_party/skia/include/core/SkString.h" -std::ostream& operator<<(std::ostream& os, const flow::MatrixDecomposition& m) { +std::ostream& operator<<(std::ostream& os, + const flutter::MatrixDecomposition& m) { if (!m.IsValid()) { os << "Invalid Matrix!" << std::endl; return os; @@ -72,7 +73,7 @@ std::ostream& operator<<(std::ostream& os, const SkPoint& r) { } std::ostream& operator<<(std::ostream& os, - const flow::PictureRasterCacheKey& k) { + const flutter::PictureRasterCacheKey& k) { os << "Picture: " << k.id() << " matrix: " << k.matrix(); return os; } diff --git a/flow/debug_print.h b/flow/debug_print.h index 34621e314ad2a..f8e0d239c8c86 100644 --- a/flow/debug_print.h +++ b/flow/debug_print.h @@ -15,8 +15,8 @@ #define DEF_PRINTER(x) std::ostream& operator<<(std::ostream&, const x&); -DEF_PRINTER(flow::MatrixDecomposition); -DEF_PRINTER(flow::PictureRasterCacheKey); +DEF_PRINTER(flutter::MatrixDecomposition); +DEF_PRINTER(flutter::PictureRasterCacheKey); DEF_PRINTER(SkISize); DEF_PRINTER(SkMatrix); DEF_PRINTER(SkMatrix44); diff --git a/flow/embedded_views.cc b/flow/embedded_views.cc index 8dc634ecdd62d..e37a837deec0e 100644 --- a/flow/embedded_views.cc +++ b/flow/embedded_views.cc @@ -4,9 +4,9 @@ #include "flutter/flow/embedded_views.h" -namespace flow { +namespace flutter { bool ExternalViewEmbedder::SubmitFrame(GrContext* context) { return false; }; -} // namespace flow +} // namespace flutter diff --git a/flow/embedded_views.h b/flow/embedded_views.h index 0fd474adb0812..e7b34f753bc38 100644 --- a/flow/embedded_views.h +++ b/flow/embedded_views.h @@ -12,7 +12,7 @@ #include "third_party/skia/include/core/SkPoint.h" #include "third_party/skia/include/core/SkSize.h" -namespace flow { +namespace flutter { class EmbeddedViewParams { public: @@ -44,6 +44,6 @@ class ExternalViewEmbedder { FML_DISALLOW_COPY_AND_ASSIGN(ExternalViewEmbedder); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_EMBEDDED_VIEWS_H_ diff --git a/flow/export_node.cc b/flow/export_node.cc index 9895369f4d250..f5440f5473ff2 100644 --- a/flow/export_node.cc +++ b/flow/export_node.cc @@ -9,7 +9,7 @@ namespace { using ExportNodeBindings = - std::unordered_map>; + std::unordered_map>; FML_THREAD_LOCAL fml::ThreadLocal tls_export_node_bindings([](intptr_t value) { delete reinterpret_cast(value); @@ -17,7 +17,7 @@ FML_THREAD_LOCAL fml::ThreadLocal tls_export_node_bindings([](intptr_t value) { } // namespace -namespace flow { +namespace flutter { ExportNode::ExportNode(zx::eventpair export_token) : pending_export_token_(std::move(export_token)) { @@ -82,4 +82,4 @@ void ExportNode::UpdateScene(SceneUpdateContext& context, : fuchsia::ui::gfx::HitTestBehavior::kSuppress); } -} // namespace flow +} // namespace flutter diff --git a/flow/export_node.h b/flow/export_node.h index 3b232abdcf18d..dfc72052d65fd 100644 --- a/flow/export_node.h +++ b/flow/export_node.h @@ -17,7 +17,7 @@ #include "flutter/flow/scene_update_context.h" #include "flutter/fml/macros.h" -namespace flow { +namespace flutter { // Represents a Scenic |ExportNode| resource that exports an |EntityNode| to // another session. @@ -45,6 +45,6 @@ class ExportNode { FML_DISALLOW_COPY_AND_ASSIGN(ExportNode); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_EXPORT_NODE_H_ diff --git a/flow/flow_run_all_unittests.cc b/flow/flow_run_all_unittests.cc index c1755e639b037..4cf0ba3d7fcdf 100644 --- a/flow/flow_run_all_unittests.cc +++ b/flow/flow_run_all_unittests.cc @@ -23,9 +23,9 @@ int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); fml::CommandLine cmd = fml::CommandLineFromArgcArgv(argc, argv); - flow::SetGoldenDir( + flutter::SetGoldenDir( cmd.GetOptionValueWithDefault("golden-dir", "flutter/testing/resources")); - flow::SetFontFile(cmd.GetOptionValueWithDefault( + flutter::SetFontFile(cmd.GetOptionValueWithDefault( "font-file", "flutter/third_party/txt/third_party/fonts/Roboto-Regular.ttf")); return RUN_ALL_TESTS(); diff --git a/flow/flow_test_utils.cc b/flow/flow_test_utils.cc index 0bf6d4c31d4d9..bde6d9b46776a 100644 --- a/flow/flow_test_utils.cc +++ b/flow/flow_test_utils.cc @@ -16,7 +16,7 @@ #include -namespace flow { +namespace flutter { static std::string gGoldenDir; static std::string gFontFile; @@ -37,4 +37,4 @@ void SetFontFile(const std::string& file) { gFontFile = file; } -} // namespace flow +} // namespace flutter diff --git a/flow/flow_test_utils.h b/flow/flow_test_utils.h index 58da75b3f4dde..1e5e5cddb842a 100644 --- a/flow/flow_test_utils.h +++ b/flow/flow_test_utils.h @@ -16,7 +16,7 @@ #include -namespace flow { +namespace flutter { const std::string& GetGoldenDir(); @@ -26,4 +26,4 @@ const std::string& GetFontFile(); void SetFontFile(const std::string& dir); -} // namespace flow +} // namespace flutter diff --git a/flow/instrumentation.cc b/flow/instrumentation.cc index ae9846c557f4c..ae07bbabc1758 100644 --- a/flow/instrumentation.cc +++ b/flow/instrumentation.cc @@ -10,7 +10,7 @@ #include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/core/SkSurface.h" -namespace flow { +namespace flutter { static const size_t kMaxSamples = 120; static const size_t kMaxFrameMarkers = 8; @@ -311,4 +311,4 @@ int64_t CounterValues::GetMinValue() const { return min; } -} // namespace flow +} // namespace flutter diff --git a/flow/instrumentation.h b/flow/instrumentation.h index a991af5b583da..aae76cc81989c 100644 --- a/flow/instrumentation.h +++ b/flow/instrumentation.h @@ -12,7 +12,7 @@ #include "flutter/fml/time/time_point.h" #include "third_party/skia/include/core/SkCanvas.h" -namespace flow { +namespace flutter { // DEPRECATED // The frame per second FPS could be different than 60 (e.g., 120). @@ -94,6 +94,6 @@ class CounterValues { FML_DISALLOW_COPY_AND_ASSIGN(CounterValues); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_INSTRUMENTATION_H_ diff --git a/flow/layers/backdrop_filter_layer.cc b/flow/layers/backdrop_filter_layer.cc index f45c28b7d2381..cfa678e39ef53 100644 --- a/flow/layers/backdrop_filter_layer.cc +++ b/flow/layers/backdrop_filter_layer.cc @@ -4,7 +4,7 @@ #include "flutter/flow/layers/backdrop_filter_layer.h" -namespace flow { +namespace flutter { BackdropFilterLayer::BackdropFilterLayer() = default; @@ -20,4 +20,4 @@ void BackdropFilterLayer::Paint(PaintContext& context) const { PaintChildren(context); } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/backdrop_filter_layer.h b/flow/layers/backdrop_filter_layer.h index 39bd64c33b23e..b273427371634 100644 --- a/flow/layers/backdrop_filter_layer.h +++ b/flow/layers/backdrop_filter_layer.h @@ -9,7 +9,7 @@ #include "third_party/skia/include/core/SkImageFilter.h" -namespace flow { +namespace flutter { class BackdropFilterLayer : public ContainerLayer { public: @@ -26,6 +26,6 @@ class BackdropFilterLayer : public ContainerLayer { FML_DISALLOW_COPY_AND_ASSIGN(BackdropFilterLayer); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_BACKDROP_FILTER_LAYER_H_ diff --git a/flow/layers/child_scene_layer.cc b/flow/layers/child_scene_layer.cc index a1391da09e18d..37937f1af71b3 100644 --- a/flow/layers/child_scene_layer.cc +++ b/flow/layers/child_scene_layer.cc @@ -7,7 +7,7 @@ #include "flutter/flow/export_node.h" #include "flutter/flow/view_holder.h" -namespace flow { +namespace flutter { ChildSceneLayer::ChildSceneLayer(zx_koid_t layer_id, bool use_view_holder, @@ -44,4 +44,4 @@ void ChildSceneLayer::UpdateScene(SceneUpdateContext& context) { } } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/child_scene_layer.h b/flow/layers/child_scene_layer.h index da7caa4086db5..d3639850da4f6 100644 --- a/flow/layers/child_scene_layer.h +++ b/flow/layers/child_scene_layer.h @@ -12,7 +12,7 @@ #include "flutter/flow/layers/layer.h" #include "flutter/flow/scene_update_context.h" -namespace flow { +namespace flutter { // Layer that represents an embedded child. class ChildSceneLayer : public Layer { @@ -40,6 +40,6 @@ class ChildSceneLayer : public Layer { FML_DISALLOW_COPY_AND_ASSIGN(ChildSceneLayer); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_CHILD_SCENE_LAYER_H_ diff --git a/flow/layers/clip_path_layer.cc b/flow/layers/clip_path_layer.cc index d119ea606d758..77397d9147680 100644 --- a/flow/layers/clip_path_layer.cc +++ b/flow/layers/clip_path_layer.cc @@ -10,7 +10,7 @@ #endif // defined(OS_FUCHSIA) -namespace flow { +namespace flutter { ClipPathLayer::ClipPathLayer(Clip clip_behavior) : clip_behavior_(clip_behavior) { @@ -69,4 +69,4 @@ void ClipPathLayer::Paint(PaintContext& context) const { } } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/clip_path_layer.h b/flow/layers/clip_path_layer.h index 7b6de1f60f516..814e6c2bd2002 100644 --- a/flow/layers/clip_path_layer.h +++ b/flow/layers/clip_path_layer.h @@ -7,7 +7,7 @@ #include "flutter/flow/layers/container_layer.h" -namespace flow { +namespace flutter { class ClipPathLayer : public ContainerLayer { public: @@ -31,6 +31,6 @@ class ClipPathLayer : public ContainerLayer { FML_DISALLOW_COPY_AND_ASSIGN(ClipPathLayer); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_CLIP_PATH_LAYER_H_ diff --git a/flow/layers/clip_rect_layer.cc b/flow/layers/clip_rect_layer.cc index 73c76bff33118..3f41d8768c6b3 100644 --- a/flow/layers/clip_rect_layer.cc +++ b/flow/layers/clip_rect_layer.cc @@ -4,7 +4,7 @@ #include "flutter/flow/layers/clip_rect_layer.h" -namespace flow { +namespace flutter { ClipRectLayer::ClipRectLayer(Clip clip_behavior) : clip_behavior_(clip_behavior) { @@ -59,4 +59,4 @@ void ClipRectLayer::Paint(PaintContext& context) const { } } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/clip_rect_layer.h b/flow/layers/clip_rect_layer.h index 76e10e49bb7ea..56f3d1a826cfe 100644 --- a/flow/layers/clip_rect_layer.h +++ b/flow/layers/clip_rect_layer.h @@ -7,7 +7,7 @@ #include "flutter/flow/layers/container_layer.h" -namespace flow { +namespace flutter { class ClipRectLayer : public ContainerLayer { public: @@ -30,6 +30,6 @@ class ClipRectLayer : public ContainerLayer { FML_DISALLOW_COPY_AND_ASSIGN(ClipRectLayer); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_CLIP_RECT_LAYER_H_ diff --git a/flow/layers/clip_rrect_layer.cc b/flow/layers/clip_rrect_layer.cc index 72092110cf789..d387f58b1dc72 100644 --- a/flow/layers/clip_rrect_layer.cc +++ b/flow/layers/clip_rrect_layer.cc @@ -4,7 +4,7 @@ #include "flutter/flow/layers/clip_rrect_layer.h" -namespace flow { +namespace flutter { ClipRRectLayer::ClipRRectLayer(Clip clip_behavior) : clip_behavior_(clip_behavior) { @@ -67,4 +67,4 @@ void ClipRRectLayer::Paint(PaintContext& context) const { } } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/clip_rrect_layer.h b/flow/layers/clip_rrect_layer.h index 7b3ac85beb65b..66bae7cf374b7 100644 --- a/flow/layers/clip_rrect_layer.h +++ b/flow/layers/clip_rrect_layer.h @@ -7,7 +7,7 @@ #include "flutter/flow/layers/container_layer.h" -namespace flow { +namespace flutter { class ClipRRectLayer : public ContainerLayer { public: @@ -31,6 +31,6 @@ class ClipRRectLayer : public ContainerLayer { FML_DISALLOW_COPY_AND_ASSIGN(ClipRRectLayer); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_CLIP_RRECT_LAYER_H_ diff --git a/flow/layers/color_filter_layer.cc b/flow/layers/color_filter_layer.cc index 40732be5a7323..c52bcdc28f407 100644 --- a/flow/layers/color_filter_layer.cc +++ b/flow/layers/color_filter_layer.cc @@ -4,7 +4,7 @@ #include "flutter/flow/layers/color_filter_layer.h" -namespace flow { +namespace flutter { ColorFilterLayer::ColorFilterLayer() = default; @@ -22,4 +22,4 @@ void ColorFilterLayer::Paint(PaintContext& context) const { PaintChildren(context); } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/color_filter_layer.h b/flow/layers/color_filter_layer.h index 358788fdd4486..eec7dae0257c6 100644 --- a/flow/layers/color_filter_layer.h +++ b/flow/layers/color_filter_layer.h @@ -7,7 +7,7 @@ #include "flutter/flow/layers/container_layer.h" -namespace flow { +namespace flutter { class ColorFilterLayer : public ContainerLayer { public: @@ -27,6 +27,6 @@ class ColorFilterLayer : public ContainerLayer { FML_DISALLOW_COPY_AND_ASSIGN(ColorFilterLayer); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_COLOR_FILTER_LAYER_H_ diff --git a/flow/layers/container_layer.cc b/flow/layers/container_layer.cc index f6ca64005fe6b..40d600e1c3e08 100644 --- a/flow/layers/container_layer.cc +++ b/flow/layers/container_layer.cc @@ -4,7 +4,7 @@ #include "flutter/flow/layers/container_layer.h" -namespace flow { +namespace flutter { ContainerLayer::ContainerLayer() {} @@ -69,4 +69,4 @@ void ContainerLayer::UpdateSceneChildren(SceneUpdateContext& context) { #endif // defined(OS_FUCHSIA) -} // namespace flow +} // namespace flutter diff --git a/flow/layers/container_layer.h b/flow/layers/container_layer.h index 9bac25d9633cf..ef1c03328d1df 100644 --- a/flow/layers/container_layer.h +++ b/flow/layers/container_layer.h @@ -8,7 +8,7 @@ #include #include "flutter/flow/layers/layer.h" -namespace flow { +namespace flutter { class ContainerLayer : public Layer { public: @@ -44,6 +44,6 @@ class ContainerLayer : public Layer { FML_DISALLOW_COPY_AND_ASSIGN(ContainerLayer); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_CONTAINER_LAYER_H_ diff --git a/flow/layers/layer.cc b/flow/layers/layer.cc index c3653ed52d0cf..45f1a08bcd094 100644 --- a/flow/layers/layer.cc +++ b/flow/layers/layer.cc @@ -7,7 +7,7 @@ #include "flutter/flow/paint_utils.h" #include "third_party/skia/include/core/SkColorFilter.h" -namespace flow { +namespace flutter { Layer::Layer() : parent_(nullptr), @@ -55,4 +55,4 @@ Layer::AutoSaveLayer::~AutoSaveLayer() { paint_context_.internal_nodes_canvas->restore(); } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/layer.h b/flow/layers/layer.h index dc1242f0f7680..1880ff064e7ca 100644 --- a/flow/layers/layer.h +++ b/flow/layers/layer.h @@ -35,7 +35,7 @@ #endif // defined(OS_FUCHSIA) -namespace flow { +namespace flutter { static constexpr SkRect kGiantRect = SkRect::MakeLTRB(-1E9F, -1E9F, 1E9F, 1E9F); @@ -151,6 +151,6 @@ class Layer { FML_DISALLOW_COPY_AND_ASSIGN(Layer); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_LAYER_H_ diff --git a/flow/layers/layer_tree.cc b/flow/layers/layer_tree.cc index 0b24b52fd8d16..5550824238c77 100644 --- a/flow/layers/layer_tree.cc +++ b/flow/layers/layer_tree.cc @@ -9,7 +9,7 @@ #include "third_party/skia/include/core/SkPictureRecorder.h" #include "third_party/skia/include/utils/SkNWayCanvas.h" -namespace flow { +namespace flutter { LayerTree::LayerTree() : frame_size_{}, @@ -150,4 +150,4 @@ sk_sp LayerTree::Flatten(const SkRect& bounds) { return recorder.finishRecordingAsPicture(); } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/layer_tree.h b/flow/layers/layer_tree.h index f3bfe3a322594..641948bcf77ff 100644 --- a/flow/layers/layer_tree.h +++ b/flow/layers/layer_tree.h @@ -16,7 +16,7 @@ #include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/core/SkSize.h" -namespace flow { +namespace flutter { class LayerTree { public: @@ -83,6 +83,6 @@ class LayerTree { FML_DISALLOW_COPY_AND_ASSIGN(LayerTree); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_LAYER_TREE_H_ diff --git a/flow/layers/opacity_layer.cc b/flow/layers/opacity_layer.cc index 99c705d8d5440..2af6cb29be3f1 100644 --- a/flow/layers/opacity_layer.cc +++ b/flow/layers/opacity_layer.cc @@ -6,7 +6,7 @@ #include "flutter/flow/layers/transform_layer.h" -namespace flow { +namespace flutter { OpacityLayer::OpacityLayer() = default; @@ -19,7 +19,7 @@ void OpacityLayer::EnsureSingleChild() { return; } - auto new_child = std::make_shared(); + auto new_child = std::make_shared(); // Be careful: SkMatrix's default constructor doesn't initialize the matrix to // identity. Hence we have to explicitly call SkMatrix::setIdentity. @@ -104,4 +104,4 @@ void OpacityLayer::Paint(PaintContext& context) const { PaintChildren(context); } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/opacity_layer.h b/flow/layers/opacity_layer.h index d33240f48786f..e437041c21fde 100644 --- a/flow/layers/opacity_layer.h +++ b/flow/layers/opacity_layer.h @@ -7,7 +7,7 @@ #include "flutter/flow/layers/container_layer.h" -namespace flow { +namespace flutter { class OpacityLayer : public ContainerLayer { public: @@ -41,6 +41,6 @@ class OpacityLayer : public ContainerLayer { FML_DISALLOW_COPY_AND_ASSIGN(OpacityLayer); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_OPACITY_LAYER_H_ diff --git a/flow/layers/performance_overlay_layer.cc b/flow/layers/performance_overlay_layer.cc index 2d3c4166c936a..3ef48527be2b8 100644 --- a/flow/layers/performance_overlay_layer.cc +++ b/flow/layers/performance_overlay_layer.cc @@ -9,7 +9,7 @@ #include "flutter/flow/layers/performance_overlay_layer.h" #include "third_party/skia/include/core/SkFont.h" -namespace flow { +namespace flutter { namespace { void DrawStatisticsText(SkCanvas& canvas, @@ -94,4 +94,4 @@ void PerformanceOverlayLayer::Paint(PaintContext& context) const { options_ & kDisplayEngineStatistics, "UI", font_path_); } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/performance_overlay_layer.h b/flow/layers/performance_overlay_layer.h index a47b836c49f3a..b5c3370d2055a 100644 --- a/flow/layers/performance_overlay_layer.h +++ b/flow/layers/performance_overlay_layer.h @@ -10,7 +10,7 @@ #include "flutter/flow/layers/layer.h" #include "flutter/fml/macros.h" -namespace flow { +namespace flutter { const int kDisplayRasterizerStatistics = 1 << 0; const int kVisualizeRasterizerStatistics = 1 << 1; @@ -31,6 +31,6 @@ class PerformanceOverlayLayer : public Layer { FML_DISALLOW_COPY_AND_ASSIGN(PerformanceOverlayLayer); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ diff --git a/flow/layers/performance_overlay_layer_unittests.cc b/flow/layers/performance_overlay_layer_unittests.cc index db7e2c4c67b24..6f9ba14610d99 100644 --- a/flow/layers/performance_overlay_layer_unittests.cc +++ b/flow/layers/performance_overlay_layer_unittests.cc @@ -28,13 +28,13 @@ const char* kGoldenFileName = "performance_overlay_gold.png"; const char* kNewGoldenFileName = "performance_overlay_gold_new.png"; TEST(PerformanceOverlayLayer, Gold) { - const std::string& golden_dir = flow::GetGoldenDir(); + const std::string& golden_dir = flutter::GetGoldenDir(); // This unit test should only be run on Linux (not even on Mac since it's a // golden test). Hence we don't have to worry about the "/" vs. "\". std::string golden_file_path = golden_dir + "/" + kGoldenFileName; std::string new_golden_file_path = golden_dir + "/" + kNewGoldenFileName; - flow::Stopwatch mock_stopwatch; + flutter::Stopwatch mock_stopwatch; for (int i = 0; i < size(kMockedTimes); ++i) { mock_stopwatch.SetLapTime( fml::TimeDelta::FromMilliseconds(kMockedTimes[i])); @@ -45,19 +45,20 @@ TEST(PerformanceOverlayLayer, Gold) { ASSERT_TRUE(surface != nullptr); - flow::TextureRegistry unused_texture_registry; + flutter::TextureRegistry unused_texture_registry; - flow::Layer::PaintContext paintContext = { + flutter::Layer::PaintContext paintContext = { nullptr, surface->getCanvas(), nullptr, nullptr, mock_stopwatch, mock_stopwatch, unused_texture_registry, nullptr, false}; // Specify font file to ensure the same font across different operation // systems. - flow::PerformanceOverlayLayer layer(flow::kDisplayRasterizerStatistics | - flow::kVisualizeRasterizerStatistics | - flow::kDisplayEngineStatistics | - flow::kVisualizeEngineStatistics, - flow::GetFontFile().c_str()); + flutter::PerformanceOverlayLayer layer( + flutter::kDisplayRasterizerStatistics | + flutter::kVisualizeRasterizerStatistics | + flutter::kDisplayEngineStatistics | + flutter::kVisualizeEngineStatistics, + flutter::GetFontFile().c_str()); layer.set_paint_bounds(SkRect::MakeWH(1000, 400)); surface->getCanvas()->clear(SK_ColorTRANSPARENT); layer.Paint(paintContext); diff --git a/flow/layers/physical_shape_layer.cc b/flow/layers/physical_shape_layer.cc index 5f573ad0d3e10..2bf45ea763052 100644 --- a/flow/layers/physical_shape_layer.cc +++ b/flow/layers/physical_shape_layer.cc @@ -7,7 +7,7 @@ #include "flutter/flow/paint_utils.h" #include "third_party/skia/include/utils/SkShadowUtils.h" -namespace flow { +namespace flutter { const SkScalar kLightHeight = 600; const SkScalar kLightRadius = 800; @@ -204,4 +204,4 @@ void PhysicalShapeLayer::DrawShadow(SkCanvas* canvas, dpr * kLightRadius, ambientColor, spotColor, flags); } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/physical_shape_layer.h b/flow/layers/physical_shape_layer.h index 46885c902bbe1..e345102ba6589 100644 --- a/flow/layers/physical_shape_layer.h +++ b/flow/layers/physical_shape_layer.h @@ -7,7 +7,7 @@ #include "flutter/flow/layers/container_layer.h" -namespace flow { +namespace flutter { class PhysicalShapeLayer : public ContainerLayer { public: @@ -54,6 +54,6 @@ class PhysicalShapeLayer : public ContainerLayer { Clip clip_behavior_; }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_PHYSICAL_SHAPE_LAYER_H_ diff --git a/flow/layers/picture_layer.cc b/flow/layers/picture_layer.cc index cef3321df4d19..fc932a5351997 100644 --- a/flow/layers/picture_layer.cc +++ b/flow/layers/picture_layer.cc @@ -6,7 +6,7 @@ #include "flutter/fml/logging.h" -namespace flow { +namespace flutter { PictureLayer::PictureLayer() = default; @@ -52,4 +52,4 @@ void PictureLayer::Paint(PaintContext& context) const { context.leaf_nodes_canvas->drawPicture(picture()); } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/picture_layer.h b/flow/layers/picture_layer.h index fc50e8f3bf6dd..88ea2f78df5e5 100644 --- a/flow/layers/picture_layer.h +++ b/flow/layers/picture_layer.h @@ -11,7 +11,7 @@ #include "flutter/flow/raster_cache.h" #include "flutter/flow/skia_gpu_object.h" -namespace flow { +namespace flutter { class PictureLayer : public Layer { public: @@ -43,6 +43,6 @@ class PictureLayer : public Layer { FML_DISALLOW_COPY_AND_ASSIGN(PictureLayer); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_PICTURE_LAYER_H_ diff --git a/flow/layers/platform_view_layer.cc b/flow/layers/platform_view_layer.cc index d10bd2ac4f309..0c9741c474cdf 100644 --- a/flow/layers/platform_view_layer.cc +++ b/flow/layers/platform_view_layer.cc @@ -4,7 +4,7 @@ #include "flutter/flow/layers/platform_view_layer.h" -namespace flow { +namespace flutter { PlatformViewLayer::PlatformViewLayer() = default; @@ -39,4 +39,4 @@ void PlatformViewLayer::Paint(PaintContext& context) const { context.view_embedder->CompositeEmbeddedView(view_id_, params); context.leaf_nodes_canvas = canvas; } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/platform_view_layer.h b/flow/layers/platform_view_layer.h index f3e0c48449caf..02309f7fbc2d9 100644 --- a/flow/layers/platform_view_layer.h +++ b/flow/layers/platform_view_layer.h @@ -9,7 +9,7 @@ #include "third_party/skia/include/core/SkPoint.h" #include "third_party/skia/include/core/SkSize.h" -namespace flow { +namespace flutter { class PlatformViewLayer : public Layer { public: @@ -31,6 +31,6 @@ class PlatformViewLayer : public Layer { FML_DISALLOW_COPY_AND_ASSIGN(PlatformViewLayer); }; -} // namespace flow +} // namespace flutter #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 5c13f56e8b9a1..d73a65f8a4ebe 100644 --- a/flow/layers/shader_mask_layer.cc +++ b/flow/layers/shader_mask_layer.cc @@ -4,7 +4,7 @@ #include "flutter/flow/layers/shader_mask_layer.h" -namespace flow { +namespace flutter { ShaderMaskLayer::ShaderMaskLayer() = default; @@ -26,4 +26,4 @@ void ShaderMaskLayer::Paint(PaintContext& context) const { SkRect::MakeWH(mask_rect_.width(), mask_rect_.height()), paint); } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/shader_mask_layer.h b/flow/layers/shader_mask_layer.h index 2b4b3f052ae7b..12f5439be5740 100644 --- a/flow/layers/shader_mask_layer.h +++ b/flow/layers/shader_mask_layer.h @@ -9,7 +9,7 @@ #include "third_party/skia/include/core/SkShader.h" -namespace flow { +namespace flutter { class ShaderMaskLayer : public ContainerLayer { public: @@ -32,6 +32,6 @@ class ShaderMaskLayer : public ContainerLayer { FML_DISALLOW_COPY_AND_ASSIGN(ShaderMaskLayer); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_SHADER_MASK_LAYER_H_ diff --git a/flow/layers/texture_layer.cc b/flow/layers/texture_layer.cc index 0b121d8a208e7..2703940f5fbc2 100644 --- a/flow/layers/texture_layer.cc +++ b/flow/layers/texture_layer.cc @@ -6,7 +6,7 @@ #include "flutter/flow/texture.h" -namespace flow { +namespace flutter { TextureLayer::TextureLayer() = default; @@ -27,4 +27,4 @@ void TextureLayer::Paint(PaintContext& context) const { context.gr_context); } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/texture_layer.h b/flow/layers/texture_layer.h index f761b5d02d053..dd77630e2f971 100644 --- a/flow/layers/texture_layer.h +++ b/flow/layers/texture_layer.h @@ -9,7 +9,7 @@ #include "third_party/skia/include/core/SkPoint.h" #include "third_party/skia/include/core/SkSize.h" -namespace flow { +namespace flutter { class TextureLayer : public Layer { public: @@ -33,6 +33,6 @@ class TextureLayer : public Layer { FML_DISALLOW_COPY_AND_ASSIGN(TextureLayer); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_TEXTURE_LAYER_H_ diff --git a/flow/layers/transform_layer.cc b/flow/layers/transform_layer.cc index 7a41312fe6899..9a9a7d4866c65 100644 --- a/flow/layers/transform_layer.cc +++ b/flow/layers/transform_layer.cc @@ -4,7 +4,7 @@ #include "flutter/flow/layers/transform_layer.h" -namespace flow { +namespace flutter { TransformLayer::TransformLayer() { transform_.setIdentity(); @@ -69,4 +69,4 @@ void TransformLayer::Paint(PaintContext& context) const { PaintChildren(context); } -} // namespace flow +} // namespace flutter diff --git a/flow/layers/transform_layer.h b/flow/layers/transform_layer.h index ea5250662b361..ef72f969d8f29 100644 --- a/flow/layers/transform_layer.h +++ b/flow/layers/transform_layer.h @@ -7,7 +7,7 @@ #include "flutter/flow/layers/container_layer.h" -namespace flow { +namespace flutter { // Be careful that SkMatrix's default constructor doesn't initialize the matrix // at all. Hence |set_transform| must be called with an initialized SkMatrix. @@ -32,6 +32,6 @@ class TransformLayer : public ContainerLayer { FML_DISALLOW_COPY_AND_ASSIGN(TransformLayer); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_LAYERS_TRANSFORM_LAYER_H_ diff --git a/flow/matrix_decomposition.cc b/flow/matrix_decomposition.cc index c710908dc651c..1935393906513 100644 --- a/flow/matrix_decomposition.cc +++ b/flow/matrix_decomposition.cc @@ -4,7 +4,7 @@ #include "flutter/flow/matrix_decomposition.h" -namespace flow { +namespace flutter { static inline SkVector3 SkVector3Combine(const SkVector3& a, float a_scale, @@ -151,4 +151,4 @@ bool MatrixDecomposition::IsValid() const { return valid_; } -} // namespace flow +} // namespace flutter diff --git a/flow/matrix_decomposition.h b/flow/matrix_decomposition.h index 2cf3c0faa4298..81794c2fe589f 100644 --- a/flow/matrix_decomposition.h +++ b/flow/matrix_decomposition.h @@ -10,7 +10,7 @@ #include "third_party/skia/include/core/SkMatrix44.h" #include "third_party/skia/include/core/SkPoint3.h" -namespace flow { +namespace flutter { /// Decomposes a given non-degenerate transformation matrix into a sequence of /// operations that produced it. The validity of the decomposition must always @@ -46,6 +46,6 @@ class MatrixDecomposition { FML_DISALLOW_COPY_AND_ASSIGN(MatrixDecomposition); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_MATRIX_DECOMPOSITION_H_ diff --git a/flow/matrix_decomposition_unittests.cc b/flow/matrix_decomposition_unittests.cc index b47af613c084d..cf96025276737 100644 --- a/flow/matrix_decomposition_unittests.cc +++ b/flow/matrix_decomposition_unittests.cc @@ -18,7 +18,7 @@ TEST(MatrixDecomposition, Rotation) { const auto angle = M_PI_4; matrix.setRotateAbout(0.0, 0.0, 1.0, angle); - flow::MatrixDecomposition decomposition(matrix); + flutter::MatrixDecomposition decomposition(matrix); ASSERT_TRUE(decomposition.IsValid()); const auto sine = sin(angle * 0.5); @@ -35,7 +35,7 @@ TEST(MatrixDecomposition, Scale) { const auto scale = 5.0; matrix.setScale(scale + 0, scale + 1, scale + 2); - flow::MatrixDecomposition decomposition(matrix); + flutter::MatrixDecomposition decomposition(matrix); ASSERT_TRUE(decomposition.IsValid()); ASSERT_FLOAT_EQ(scale + 0, decomposition.scale().fX); @@ -49,7 +49,7 @@ TEST(MatrixDecomposition, Translate) { const auto translate = 125.0; matrix.setTranslate(translate + 0, translate + 1, translate + 2); - flow::MatrixDecomposition decomposition(matrix); + flutter::MatrixDecomposition decomposition(matrix); ASSERT_TRUE(decomposition.IsValid()); ASSERT_FLOAT_EQ(translate + 0, decomposition.translation().fX); @@ -73,7 +73,7 @@ TEST(MatrixDecomposition, Combination) { SkMatrix44 combined = m3 * m2 * m1; - flow::MatrixDecomposition decomposition(combined); + flutter::MatrixDecomposition decomposition(combined); ASSERT_TRUE(decomposition.IsValid()); ASSERT_FLOAT_EQ(translate, decomposition.translation().fX); @@ -97,7 +97,7 @@ TEST(MatrixDecomposition, ScaleFloatError) { SkMatrix44 matrix = SkMatrix44::I(); matrix.setScale(scale, scale, 1.0f); - flow::MatrixDecomposition decomposition3(matrix); + flutter::MatrixDecomposition decomposition3(matrix); ASSERT_TRUE(decomposition3.IsValid()); ASSERT_FLOAT_EQ(scale, decomposition3.scale().fX); @@ -122,13 +122,13 @@ TEST(MatrixDecomposition, ScaleFloatError) { SkMatrix44 matrix3 = SkMatrix44::I(); matrix3.setScale(scale3, scale3, 1.f); - flow::MatrixDecomposition decomposition(matrix); + flutter::MatrixDecomposition decomposition(matrix); ASSERT_TRUE(decomposition.IsValid()); - flow::MatrixDecomposition decomposition2(matrix2); + flutter::MatrixDecomposition decomposition2(matrix2); ASSERT_TRUE(decomposition2.IsValid()); - flow::MatrixDecomposition decomposition3(matrix3); + flutter::MatrixDecomposition decomposition3(matrix3); ASSERT_TRUE(decomposition3.IsValid()); ASSERT_FLOAT_EQ(scale, decomposition.scale().fX); diff --git a/flow/paint_utils.cc b/flow/paint_utils.cc index b8ceddd48928c..38fc17979a0c3 100644 --- a/flow/paint_utils.cc +++ b/flow/paint_utils.cc @@ -10,7 +10,7 @@ #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkShader.h" -namespace flow { +namespace flutter { namespace { @@ -50,4 +50,4 @@ void DrawCheckerboard(SkCanvas* canvas, const SkRect& rect) { canvas->drawRect(rect, debugPaint); } -} // namespace flow +} // namespace flutter diff --git a/flow/paint_utils.h b/flow/paint_utils.h index 352dee124fc91..c6bfccedbd317 100644 --- a/flow/paint_utils.h +++ b/flow/paint_utils.h @@ -9,12 +9,12 @@ #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkRect.h" -namespace flow { +namespace flutter { void DrawCheckerboard(SkCanvas* canvas, SkColor c1, SkColor c2, int size); void DrawCheckerboard(SkCanvas* canvas, const SkRect& rect); -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_PAINT_UTILS_H_ diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index 004934a88dbea..2cd03473f0d74 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -15,7 +15,7 @@ #include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/core/SkSurface.h" -namespace flow { +namespace flutter { RasterCacheResult::RasterCacheResult() {} @@ -292,4 +292,4 @@ void RasterCache::TraceStatsToTimeline() const { #endif // FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_RELEASE } -} // namespace flow +} // namespace flutter diff --git a/flow/raster_cache.h b/flow/raster_cache.h index 1042e2cd7d464..f008f2459cc30 100644 --- a/flow/raster_cache.h +++ b/flow/raster_cache.h @@ -15,7 +15,7 @@ #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkSize.h" -namespace flow { +namespace flutter { class RasterCacheResult { public: @@ -137,6 +137,6 @@ class RasterCache { FML_DISALLOW_COPY_AND_ASSIGN(RasterCache); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_RASTER_CACHE_H_ diff --git a/flow/raster_cache_key.cc b/flow/raster_cache_key.cc index 4dfef752f6974..0a20cde72dcc6 100644 --- a/flow/raster_cache_key.cc +++ b/flow/raster_cache_key.cc @@ -4,8 +4,8 @@ #include "flutter/flow/raster_cache_key.h" -namespace flow { +namespace flutter { // -} // namespace flow +} // namespace flutter diff --git a/flow/raster_cache_key.h b/flow/raster_cache_key.h index 5fb6cc279c511..a64cabe182076 100644 --- a/flow/raster_cache_key.h +++ b/flow/raster_cache_key.h @@ -9,7 +9,7 @@ #include "flutter/flow/matrix_decomposition.h" #include "flutter/fml/logging.h" -namespace flow { +namespace flutter { template class RasterCacheKey { @@ -58,6 +58,6 @@ class Layer; using LayerRasterCacheKey = RasterCacheKey; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_RASTER_CACHE_KEY_H_ diff --git a/flow/raster_cache_unittests.cc b/flow/raster_cache_unittests.cc index 3fd73d5bca55e..64f4405ebe5a0 100644 --- a/flow/raster_cache_unittests.cc +++ b/flow/raster_cache_unittests.cc @@ -18,13 +18,13 @@ sk_sp GetSamplePicture() { } TEST(RasterCache, SimpleInitialization) { - flow::RasterCache cache; + flutter::RasterCache cache; ASSERT_TRUE(true); } TEST(RasterCache, ThresholdIsRespected) { size_t threshold = 3; - flow::RasterCache cache(threshold); + flutter::RasterCache cache(threshold); SkMatrix matrix = SkMatrix::I(); @@ -46,7 +46,7 @@ TEST(RasterCache, ThresholdIsRespected) { TEST(RasterCache, ThresholdIsRespectedWhenZero) { size_t threshold = 0; - flow::RasterCache cache(threshold); + flutter::RasterCache cache(threshold); SkMatrix matrix = SkMatrix::I(); @@ -68,7 +68,7 @@ TEST(RasterCache, ThresholdIsRespectedWhenZero) { TEST(RasterCache, SweepsRemoveUnusedFrames) { size_t threshold = 3; - flow::RasterCache cache(threshold); + flutter::RasterCache cache(threshold); SkMatrix matrix = SkMatrix::I(); diff --git a/flow/scene_update_context.cc b/flow/scene_update_context.cc index ab8b0fe30781a..d1d33450772e7 100644 --- a/flow/scene_update_context.cc +++ b/flow/scene_update_context.cc @@ -9,7 +9,7 @@ #include "flutter/fml/trace_event.h" #include "flutter/lib/ui/window/viewport_metrics.h" -namespace flow { +namespace flutter { // Helper function to generate clip planes for a scenic::EntityNode. static void SetEntityNodeClipPlanes(scenic::EntityNode* entity_node, @@ -188,7 +188,8 @@ scenic::Image* SceneUpdateContext::GenerateImageIfNeeded( return image; } -std::vector> +std::vector< + std::unique_ptr> SceneUpdateContext::ExecutePaintTasks(CompositorContext::ScopedFrame& frame) { TRACE_EVENT0("flutter", "SceneUpdateContext::ExecutePaintTasks"); std::vector> surfaces_to_submit; @@ -331,4 +332,4 @@ SceneUpdateContext::Clip::Clip(SceneUpdateContext& context, SetEntityNodeClipPlanes(&entity_node(), shape_bounds); } -} // namespace flow +} // namespace flutter diff --git a/flow/scene_update_context.h b/flow/scene_update_context.h index 925fc9493510f..ca66004735f32 100644 --- a/flow/scene_update_context.h +++ b/flow/scene_update_context.h @@ -18,7 +18,7 @@ #include "third_party/skia/include/core/SkRect.h" #include "third_party/skia/include/core/SkSurface.h" -namespace flow { +namespace flutter { class Layer; @@ -232,6 +232,6 @@ class SceneUpdateContext { FML_DISALLOW_COPY_AND_ASSIGN(SceneUpdateContext); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_SCENE_UPDATE_CONTEXT_H_ diff --git a/flow/skia_gpu_object.cc b/flow/skia_gpu_object.cc index 1f789212e6ba9..bf1b0a1d2a779 100644 --- a/flow/skia_gpu_object.cc +++ b/flow/skia_gpu_object.cc @@ -6,7 +6,7 @@ #include "flutter/fml/message_loop.h" -namespace flow { +namespace flutter { SkiaUnrefQueue::SkiaUnrefQueue(fml::RefPtr task_runner, fml::TimeDelta delay) @@ -41,4 +41,4 @@ void SkiaUnrefQueue::Drain() { } } -} // namespace flow +} // namespace flutter diff --git a/flow/skia_gpu_object.h b/flow/skia_gpu_object.h index c7d814bfcb5fc..4c079af96ee95 100644 --- a/flow/skia_gpu_object.h +++ b/flow/skia_gpu_object.h @@ -13,7 +13,7 @@ #include "flutter/fml/task_runner.h" #include "third_party/skia/include/core/SkRefCnt.h" -namespace flow { +namespace flutter { // A queue that holds Skia objects that must be destructed on the the given task // runner. @@ -83,6 +83,6 @@ class SkiaGPUObject { FML_DISALLOW_COPY_AND_ASSIGN(SkiaGPUObject); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_SKIA_GPU_OBJECT_H_ diff --git a/flow/texture.cc b/flow/texture.cc index bef0de01b1cbd..7bc40f0c1d43b 100644 --- a/flow/texture.cc +++ b/flow/texture.cc @@ -4,7 +4,7 @@ #include "flutter/flow/texture.h" -namespace flow { +namespace flutter { TextureRegistry::TextureRegistry() = default; @@ -39,4 +39,4 @@ Texture::Texture(int64_t id) : id_(id) {} Texture::~Texture() = default; -} // namespace flow +} // namespace flutter diff --git a/flow/texture.h b/flow/texture.h index 6573b88618c8d..749e3835b236a 100644 --- a/flow/texture.h +++ b/flow/texture.h @@ -11,7 +11,7 @@ #include "flutter/fml/synchronization/waitable_event.h" #include "third_party/skia/include/core/SkCanvas.h" -namespace flow { +namespace flutter { class Texture { protected: @@ -70,6 +70,6 @@ class TextureRegistry { FML_DISALLOW_COPY_AND_ASSIGN(TextureRegistry); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_TEXTURE_H_ diff --git a/flow/view_holder.cc b/flow/view_holder.cc index 129f843724da5..f7c5de93b198f 100644 --- a/flow/view_holder.cc +++ b/flow/view_holder.cc @@ -9,7 +9,7 @@ namespace { using ViewHolderBindings = - std::unordered_map>; + std::unordered_map>; FML_THREAD_LOCAL fml::ThreadLocal tls_view_holder_bindings([](intptr_t value) { delete reinterpret_cast(value); @@ -47,7 +47,7 @@ fuchsia::ui::gfx::ViewProperties ToViewProperties(float width, } // namespace -namespace flow { +namespace flutter { ViewHolder::ViewHolder(fml::RefPtr ui_task_runner, fuchsia::ui::views::ViewHolderToken view_holder_token, @@ -148,4 +148,4 @@ void ViewHolder::SetProperties(double width, has_pending_properties_ = true; } -} // namespace flow +} // namespace flutter diff --git a/flow/view_holder.h b/flow/view_holder.h index 2695ab86c6695..2f0e216c47b77 100644 --- a/flow/view_holder.h +++ b/flow/view_holder.h @@ -21,7 +21,7 @@ #include "flutter/fml/memory/ref_counted.h" #include "flutter/fml/task_runner.h" -namespace flow { +namespace flutter { // Represents a Scenic |ViewHolder| resource that imports a |View| from another // session. @@ -70,6 +70,6 @@ class ViewHolder { FML_DISALLOW_COPY_AND_ASSIGN(ViewHolder); }; -} // namespace flow +} // namespace flutter #endif // FLUTTER_FLOW_VIEW_HOLDER_H_ diff --git a/lib/ui/compositing/scene.cc b/lib/ui/compositing/scene.cc index 4bf30e92aa474..fd3e86c7e5176 100644 --- a/lib/ui/compositing/scene.cc +++ b/lib/ui/compositing/scene.cc @@ -24,7 +24,7 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, Scene); DART_BIND_ALL(Scene, FOR_EACH_BINDING) -fml::RefPtr Scene::create(std::shared_ptr rootLayer, +fml::RefPtr Scene::create(std::shared_ptr rootLayer, uint32_t rasterizerTracingThreshold, bool checkerboardRasterCacheImages, bool checkerboardOffscreenLayers) { @@ -33,11 +33,11 @@ fml::RefPtr Scene::create(std::shared_ptr rootLayer, checkerboardRasterCacheImages, checkerboardOffscreenLayers); } -Scene::Scene(std::shared_ptr rootLayer, +Scene::Scene(std::shared_ptr rootLayer, uint32_t rasterizerTracingThreshold, bool checkerboardRasterCacheImages, bool checkerboardOffscreenLayers) - : m_layerTree(new flow::LayerTree()) { + : m_layerTree(new flutter::LayerTree()) { m_layerTree->set_root_layer(std::move(rootLayer)); m_layerTree->set_rasterizer_tracing_threshold(rasterizerTracingThreshold); m_layerTree->set_checkerboard_raster_cache_images( @@ -68,7 +68,7 @@ Dart_Handle Scene::toImage(uint32_t width, return Picture::RasterizeToImage(picture, width, height, raw_image_callback); } -std::unique_ptr Scene::takeLayerTree() { +std::unique_ptr Scene::takeLayerTree() { return std::move(m_layerTree); } diff --git a/lib/ui/compositing/scene.h b/lib/ui/compositing/scene.h index 7bec8f7e58ea1..2d280a534db63 100644 --- a/lib/ui/compositing/scene.h +++ b/lib/ui/compositing/scene.h @@ -24,12 +24,12 @@ class Scene : public RefCountedDartWrappable { public: ~Scene() override; - static fml::RefPtr create(std::shared_ptr rootLayer, + static fml::RefPtr create(std::shared_ptr rootLayer, uint32_t rasterizerTracingThreshold, bool checkerboardRasterCacheImages, bool checkerboardOffscreenLayers); - std::unique_ptr takeLayerTree(); + std::unique_ptr takeLayerTree(); Dart_Handle toImage(uint32_t width, uint32_t height, @@ -40,12 +40,12 @@ class Scene : public RefCountedDartWrappable { static void RegisterNatives(tonic::DartLibraryNatives* natives); private: - explicit Scene(std::shared_ptr rootLayer, + explicit Scene(std::shared_ptr rootLayer, uint32_t rasterizerTracingThreshold, bool checkerboardRasterCacheImages, bool checkerboardOffscreenLayers); - std::unique_ptr m_layerTree; + std::unique_ptr m_layerTree; }; } // namespace flutter diff --git a/lib/ui/compositing/scene_builder.cc b/lib/ui/compositing/scene_builder.cc index 447119594f39b..e442e176db58f 100644 --- a/lib/ui/compositing/scene_builder.cc +++ b/lib/ui/compositing/scene_builder.cc @@ -86,7 +86,7 @@ SceneBuilder::~SceneBuilder() = default; fml::RefPtr SceneBuilder::pushTransform( tonic::Float64List& matrix4) { SkMatrix sk_matrix = ToSkMatrix(matrix4); - auto layer = std::make_shared(); + auto layer = std::make_shared(); layer->set_transform(sk_matrix); PushLayer(layer); // matrix4 has to be released before we can return another Dart object @@ -96,7 +96,7 @@ fml::RefPtr SceneBuilder::pushTransform( fml::RefPtr SceneBuilder::pushOffset(double dx, double dy) { SkMatrix sk_matrix = SkMatrix::MakeTrans(dx, dy); - auto layer = std::make_shared(); + auto layer = std::make_shared(); layer->set_transform(sk_matrix); PushLayer(layer); return EngineLayer::MakeRetained(layer); @@ -108,8 +108,8 @@ fml::RefPtr SceneBuilder::pushClipRect(double left, double bottom, int clipBehavior) { SkRect clipRect = SkRect::MakeLTRB(left, top, right, bottom); - flow::Clip clip_behavior = static_cast(clipBehavior); - auto layer = std::make_shared(clip_behavior); + flutter::Clip clip_behavior = static_cast(clipBehavior); + auto layer = std::make_shared(clip_behavior); layer->set_clip_rect(clipRect); PushLayer(layer); return EngineLayer::MakeRetained(layer); @@ -117,8 +117,8 @@ fml::RefPtr SceneBuilder::pushClipRect(double left, fml::RefPtr SceneBuilder::pushClipRRect(const RRect& rrect, int clipBehavior) { - flow::Clip clip_behavior = static_cast(clipBehavior); - auto layer = std::make_shared(clip_behavior); + flutter::Clip clip_behavior = static_cast(clipBehavior); + auto layer = std::make_shared(clip_behavior); layer->set_clip_rrect(rrect.sk_rrect); PushLayer(layer); return EngineLayer::MakeRetained(layer); @@ -126,9 +126,9 @@ fml::RefPtr SceneBuilder::pushClipRRect(const RRect& rrect, 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_shared(clip_behavior); + flutter::Clip clip_behavior = static_cast(clipBehavior); + FML_DCHECK(clip_behavior != flutter::Clip::none); + auto layer = std::make_shared(clip_behavior); layer->set_clip_path(path->path()); PushLayer(layer); return EngineLayer::MakeRetained(layer); @@ -137,7 +137,7 @@ fml::RefPtr SceneBuilder::pushClipPath(const CanvasPath* path, fml::RefPtr SceneBuilder::pushOpacity(int alpha, double dx, double dy) { - auto layer = std::make_shared(); + auto layer = std::make_shared(); layer->set_alpha(alpha); layer->set_offset(SkPoint::Make(dx, dy)); PushLayer(layer); @@ -146,7 +146,7 @@ fml::RefPtr SceneBuilder::pushOpacity(int alpha, fml::RefPtr SceneBuilder::pushColorFilter(int color, int blendMode) { - auto layer = std::make_shared(); + auto layer = std::make_shared(); layer->set_color(static_cast(color)); layer->set_blend_mode(static_cast(blendMode)); PushLayer(layer); @@ -154,7 +154,7 @@ fml::RefPtr SceneBuilder::pushColorFilter(int color, } fml::RefPtr SceneBuilder::pushBackdropFilter(ImageFilter* filter) { - auto layer = std::make_shared(); + auto layer = std::make_shared(); layer->set_filter(filter->filter()); PushLayer(layer); return EngineLayer::MakeRetained(layer); @@ -168,7 +168,7 @@ fml::RefPtr SceneBuilder::pushShaderMask(Shader* shader, int blendMode) { SkRect rect = SkRect::MakeLTRB(maskRectLeft, maskRectTop, maskRectRight, maskRectBottom); - auto layer = std::make_shared(); + auto layer = std::make_shared(); layer->set_shader(shader->shader()); layer->set_mask_rect(rect); layer->set_blend_mode(static_cast(blendMode)); @@ -182,8 +182,8 @@ fml::RefPtr SceneBuilder::pushPhysicalShape(const CanvasPath* path, int shadow_color, int clipBehavior) { const SkPath& sk_path = path->path(); - flow::Clip clip_behavior = static_cast(clipBehavior); - auto layer = std::make_shared(clip_behavior); + flutter::Clip clip_behavior = static_cast(clipBehavior); + auto layer = std::make_shared(clip_behavior); layer->set_path(sk_path); layer->set_elevation(elevation); layer->set_color(static_cast(color)); @@ -220,7 +220,7 @@ void SceneBuilder::addPicture(double dx, SkPoint offset = SkPoint::Make(dx, dy); SkRect pictureRect = picture->picture()->cullRect(); pictureRect.offset(offset.x(), offset.y()); - auto layer = std::make_unique(); + auto layer = std::make_unique(); layer->set_offset(offset); layer->set_picture(UIDartState::CreateGPUObject(picture->picture())); layer->set_is_complex(!!(hints & 1)); @@ -237,7 +237,7 @@ void SceneBuilder::addTexture(double dx, if (!current_layer_) { return; } - auto layer = std::make_unique(); + auto layer = std::make_unique(); layer->set_offset(SkPoint::Make(dx, dy)); layer->set_size(SkSize::Make(width, height)); layer->set_texture_id(textureId); @@ -253,7 +253,7 @@ void SceneBuilder::addPlatformView(double dx, if (!current_layer_) { return; } - auto layer = std::make_unique(); + auto layer = std::make_unique(); layer->set_offset(SkPoint::Make(dx, dy)); layer->set_size(SkSize::Make(width, height)); layer->set_view_id(viewId); @@ -270,7 +270,7 @@ void SceneBuilder::addChildScene(double dx, if (!current_layer_) { return; } - auto layer = std::make_unique( + auto layer = std::make_unique( sceneHost->id(), sceneHost->use_view_holder(), SkPoint::Make(dx, dy), SkSize::Make(width, height), hitTestable); current_layer_->Add(std::move(layer)); @@ -286,7 +286,8 @@ void SceneBuilder::addPerformanceOverlay(uint64_t enabledOptions, return; } SkRect rect = SkRect::MakeLTRB(left, top, right, bottom); - auto layer = std::make_unique(enabledOptions); + auto layer = + std::make_unique(enabledOptions); layer->set_paint_bounds(rect); current_layer_->Add(std::move(layer)); } @@ -311,7 +312,7 @@ fml::RefPtr SceneBuilder::build() { return scene; } -void SceneBuilder::PushLayer(std::shared_ptr layer) { +void SceneBuilder::PushLayer(std::shared_ptr layer) { FML_DCHECK(layer); if (!root_layer_) { @@ -324,7 +325,7 @@ void SceneBuilder::PushLayer(std::shared_ptr layer) { return; } - flow::ContainerLayer* newLayer = layer.get(); + flutter::ContainerLayer* newLayer = layer.get(); current_layer_->Add(std::move(layer)); current_layer_ = newLayer; } diff --git a/lib/ui/compositing/scene_builder.h b/lib/ui/compositing/scene_builder.h index 3f33d17c435e5..601ca5afb290f 100644 --- a/lib/ui/compositing/scene_builder.h +++ b/lib/ui/compositing/scene_builder.h @@ -108,14 +108,14 @@ class SceneBuilder : public RefCountedDartWrappable { private: SceneBuilder(); - std::shared_ptr root_layer_; - flow::ContainerLayer* current_layer_ = nullptr; + std::shared_ptr root_layer_; + flutter::ContainerLayer* current_layer_ = nullptr; int rasterizer_tracing_threshold_ = 0; bool checkerboard_raster_cache_images_ = false; bool checkerboard_offscreen_layers_ = false; - void PushLayer(std::shared_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 4247fc247cb44..84decb9a61f76 100644 --- a/lib/ui/compositing/scene_host.cc +++ b/lib/ui/compositing/scene_host.cc @@ -121,7 +121,7 @@ SceneHost::SceneHost(fml::RefPtr exportTokenHandle) gpu_task_runner_->PostTask( [id = id_, handle = std::move(exportTokenHandle)]() { auto export_token = zx::eventpair(handle->ReleaseHandle()); - flow::ExportNode::Create(id, std::move(export_token)); + flutter::ExportNode::Create(id, std::move(export_token)); }); } @@ -163,9 +163,9 @@ SceneHost::SceneHost(fml::RefPtr viewHolderTokenHandle, bind_callback = std::move(bind_callback)]() { auto view_holder_token = scenic::ToViewHolderToken(zx::eventpair(handle->ReleaseHandle())); - flow::ViewHolder::Create(id, std::move(ui_task_runner), - std::move(view_holder_token), - std::move(bind_callback)); + flutter::ViewHolder::Create(id, std::move(ui_task_runner), + std::move(view_holder_token), + std::move(bind_callback)); }); } @@ -176,9 +176,11 @@ SceneHost::~SceneHost() { FML_DCHECK(bindings); bindings->erase(id_); - gpu_task_runner_->PostTask([id = id_]() { flow::ViewHolder::Destroy(id); }); + gpu_task_runner_->PostTask( + [id = id_]() { flutter::ViewHolder::Destroy(id); }); } else { - gpu_task_runner_->PostTask([id = id_]() { flow::ExportNode::Destroy(id); }); + gpu_task_runner_->PostTask( + [id = id_]() { flutter::ExportNode::Destroy(id); }); } } @@ -217,7 +219,7 @@ void SceneHost::setProperties(double width, gpu_task_runner_->PostTask([id = id_, width, height, insetTop, insetRight, insetBottom, insetLeft, focusable]() { - auto* view_holder = flow::ViewHolder::FromId(id); + auto* view_holder = flutter::ViewHolder::FromId(id); FML_DCHECK(view_holder); view_holder->SetProperties(width, height, insetTop, insetRight, insetBottom, diff --git a/lib/ui/io_manager.h b/lib/ui/io_manager.h index 060f3e4ec8dbe..28cf4f908806e 100644 --- a/lib/ui/io_manager.h +++ b/lib/ui/io_manager.h @@ -19,7 +19,7 @@ class IOManager { virtual fml::WeakPtr GetResourceContext() const = 0; - virtual fml::RefPtr GetSkiaUnrefQueue() const = 0; + virtual fml::RefPtr GetSkiaUnrefQueue() const = 0; }; } // namespace flutter diff --git a/lib/ui/painting/canvas.cc b/lib/ui/painting/canvas.cc index 803ae8735bef6..2fc9f901f84ca 100644 --- a/lib/ui/painting/canvas.cc +++ b/lib/ui/painting/canvas.cc @@ -419,8 +419,8 @@ void Canvas::drawShadow(const CanvasPath* path, ToDart("Canvas.drawShader called with non-genuine Path.")); SkScalar dpr = UIDartState::Current()->window()->viewport_metrics().device_pixel_ratio; - flow::PhysicalShapeLayer::DrawShadow(canvas_, path->path(), color, elevation, - transparentOccluder, dpr); + flutter::PhysicalShapeLayer::DrawShadow(canvas_, path->path(), color, + elevation, transparentOccluder, dpr); } void Canvas::Clear() { diff --git a/lib/ui/painting/codec.cc b/lib/ui/painting/codec.cc index 600d9ad26e193..bf327739a6794 100644 --- a/lib/ui/painting/codec.cc +++ b/lib/ui/painting/codec.cc @@ -81,7 +81,7 @@ static sk_sp DecodeImage(fml::WeakPtr context, fml::RefPtr InitCodec(fml::WeakPtr context, sk_sp buffer, - fml::RefPtr unref_queue, + fml::RefPtr unref_queue, const float decodedCacheRatioCap, size_t trace_id) { TRACE_FLOW_STEP("flutter", kInitCodecTraceTag, trace_id); @@ -117,7 +117,7 @@ fml::RefPtr InitCodecUncompressed( fml::WeakPtr context, sk_sp buffer, ImageInfo image_info, - fml::RefPtr unref_queue, + fml::RefPtr unref_queue, const float decodedCacheRatioCap, size_t trace_id) { TRACE_FLOW_STEP("flutter", kInitCodecTraceTag, trace_id); @@ -147,7 +147,7 @@ fml::RefPtr InitCodecUncompressed( void InitCodecAndInvokeCodecCallback( fml::RefPtr ui_task_runner, fml::WeakPtr context, - fml::RefPtr unref_queue, + fml::RefPtr unref_queue, std::unique_ptr callback, sk_sp buffer, std::unique_ptr image_info, @@ -468,7 +468,7 @@ void MultiFrameCodec::GetNextFrameAndInvokeCallback( std::unique_ptr callback, fml::RefPtr ui_task_runner, fml::WeakPtr resourceContext, - fml::RefPtr unref_queue, + fml::RefPtr unref_queue, size_t trace_id) { fml::RefPtr frameInfo = NULL; sk_sp skImage = GetNextFrameImage(resourceContext); diff --git a/lib/ui/painting/codec.h b/lib/ui/painting/codec.h index 777b77ea9a818..fa14cd63cae72 100644 --- a/lib/ui/painting/codec.h +++ b/lib/ui/painting/codec.h @@ -52,7 +52,7 @@ class MultiFrameCodec : public Codec { std::unique_ptr callback, fml::RefPtr ui_task_runner, fml::WeakPtr resourceContext, - fml::RefPtr unref_queue, + fml::RefPtr unref_queue, size_t trace_id); const std::unique_ptr codec_; diff --git a/lib/ui/painting/engine_layer.cc b/lib/ui/painting/engine_layer.cc index 98b8b0ae3b238..7ac9c98497f41 100644 --- a/lib/ui/painting/engine_layer.cc +++ b/lib/ui/painting/engine_layer.cc @@ -15,7 +15,7 @@ using tonic::ToDart; namespace flutter { -EngineLayer::EngineLayer(std::shared_ptr layer) +EngineLayer::EngineLayer(std::shared_ptr layer) : layer_(layer) {} EngineLayer::~EngineLayer() = default; diff --git a/lib/ui/painting/engine_layer.h b/lib/ui/painting/engine_layer.h index 653d559b9c0c6..1dc565c5193c2 100644 --- a/lib/ui/painting/engine_layer.h +++ b/lib/ui/painting/engine_layer.h @@ -26,17 +26,17 @@ class EngineLayer : public RefCountedDartWrappable { size_t GetAllocationSize() override; static fml::RefPtr MakeRetained( - std::shared_ptr layer) { + std::shared_ptr layer) { return fml::MakeRefCounted(layer); } static void RegisterNatives(tonic::DartLibraryNatives* natives); - std::shared_ptr Layer() const { return layer_; } + std::shared_ptr Layer() const { return layer_; } private: - explicit EngineLayer(std::shared_ptr layer); - std::shared_ptr layer_; + explicit EngineLayer(std::shared_ptr layer); + std::shared_ptr layer_; FML_FRIEND_MAKE_REF_COUNTED(EngineLayer); }; diff --git a/lib/ui/painting/image.h b/lib/ui/painting/image.h index aef394b71312c..516a2e5d59c49 100644 --- a/lib/ui/painting/image.h +++ b/lib/ui/painting/image.h @@ -35,7 +35,7 @@ class CanvasImage final : public RefCountedDartWrappable { void dispose(); sk_sp image() const { return image_.get(); } - void set_image(flow::SkiaGPUObject image) { + void set_image(flutter::SkiaGPUObject image) { image_ = std::move(image); } @@ -46,7 +46,7 @@ class CanvasImage final : public RefCountedDartWrappable { private: CanvasImage(); - flow::SkiaGPUObject image_; + flutter::SkiaGPUObject image_; }; } // namespace flutter diff --git a/lib/ui/painting/picture.cc b/lib/ui/painting/picture.cc index 442b2c1702c25..98c37edc115f7 100644 --- a/lib/ui/painting/picture.cc +++ b/lib/ui/painting/picture.cc @@ -26,11 +26,12 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, Picture); DART_BIND_ALL(Picture, FOR_EACH_BINDING) -fml::RefPtr Picture::Create(flow::SkiaGPUObject picture) { +fml::RefPtr Picture::Create( + flutter::SkiaGPUObject picture) { return fml::MakeRefCounted(std::move(picture)); } -Picture::Picture(flow::SkiaGPUObject picture) +Picture::Picture(flutter::SkiaGPUObject picture) : picture_(std::move(picture)) {} Picture::~Picture() = default; diff --git a/lib/ui/painting/picture.h b/lib/ui/painting/picture.h index b5c329537de74..a800f920c48a0 100644 --- a/lib/ui/painting/picture.h +++ b/lib/ui/painting/picture.h @@ -23,7 +23,7 @@ class Picture : public RefCountedDartWrappable { public: ~Picture() override; - static fml::RefPtr Create(flow::SkiaGPUObject picture); + static fml::RefPtr Create(flutter::SkiaGPUObject picture); sk_sp picture() const { return picture_.get(); } @@ -43,9 +43,9 @@ class Picture : public RefCountedDartWrappable { Dart_Handle raw_image_callback); private: - explicit Picture(flow::SkiaGPUObject picture); + explicit Picture(flutter::SkiaGPUObject picture); - flow::SkiaGPUObject picture_; + flutter::SkiaGPUObject picture_; }; } // namespace flutter diff --git a/lib/ui/painting/shader.cc b/lib/ui/painting/shader.cc index c426e09b8b5c1..c6f0e6b5617d5 100644 --- a/lib/ui/painting/shader.cc +++ b/lib/ui/painting/shader.cc @@ -10,7 +10,7 @@ namespace flutter { IMPLEMENT_WRAPPERTYPEINFO(ui, Shader); -Shader::Shader(flow::SkiaGPUObject shader) +Shader::Shader(flutter::SkiaGPUObject shader) : shader_(std::move(shader)) {} Shader::~Shader() = default; diff --git a/lib/ui/painting/shader.h b/lib/ui/painting/shader.h index 8e268c1ac7499..cb9043ae0b4da 100644 --- a/lib/ui/painting/shader.h +++ b/lib/ui/painting/shader.h @@ -21,15 +21,15 @@ class Shader : public RefCountedDartWrappable { sk_sp shader() { return shader_.get(); } - void set_shader(flow::SkiaGPUObject shader) { + void set_shader(flutter::SkiaGPUObject shader) { shader_ = std::move(shader); } protected: - Shader(flow::SkiaGPUObject shader = {}); + Shader(flutter::SkiaGPUObject shader = {}); private: - flow::SkiaGPUObject shader_; + flutter::SkiaGPUObject shader_; }; } // namespace flutter diff --git a/lib/ui/ui_dart_state.cc b/lib/ui/ui_dart_state.cc index 58f9b77a4bf52..b26e01afb1625 100644 --- a/lib/ui/ui_dart_state.cc +++ b/lib/ui/ui_dart_state.cc @@ -78,7 +78,7 @@ const TaskRunners& UIDartState::GetTaskRunners() const { return task_runners_; } -fml::RefPtr UIDartState::GetSkiaUnrefQueue() const { +fml::RefPtr UIDartState::GetSkiaUnrefQueue() const { if (!io_manager_) { return nullptr; } diff --git a/lib/ui/ui_dart_state.h b/lib/ui/ui_dart_state.h index b32cf6588e758..4f9c33387ec13 100644 --- a/lib/ui/ui_dart_state.h +++ b/lib/ui/ui_dart_state.h @@ -47,7 +47,7 @@ class UIDartState : public tonic::DartState { void FlushMicrotasksNow(); - fml::RefPtr GetSkiaUnrefQueue() const; + fml::RefPtr GetSkiaUnrefQueue() const; fml::WeakPtr GetSnapshotDelegate() const; @@ -61,7 +61,7 @@ class UIDartState : public tonic::DartState { const std::string& stack_trace); template - static flow::SkiaGPUObject CreateGPUObject(sk_sp object) { + static flutter::SkiaGPUObject CreateGPUObject(sk_sp object) { if (!object) { return {}; } diff --git a/runtime/runtime_delegate.h b/runtime/runtime_delegate.h index b62d39a0ed7ae..8dd69dbefb6c6 100644 --- a/runtime/runtime_delegate.h +++ b/runtime/runtime_delegate.h @@ -23,7 +23,7 @@ class RuntimeDelegate { virtual void ScheduleFrame(bool regenerate_layer_tree = true) = 0; - virtual void Render(std::unique_ptr layer_tree) = 0; + virtual void Render(std::unique_ptr layer_tree) = 0; virtual void UpdateSemantics(SemanticsNodeUpdates update, CustomAccessibilityActionUpdates actions) = 0; diff --git a/shell/common/animator.cc b/shell/common/animator.cc index 0926599e9187a..cbf16e8b3ba57 100644 --- a/shell/common/animator.cc +++ b/shell/common/animator.cc @@ -157,7 +157,7 @@ void Animator::BeginFrame(fml::TimePoint frame_start_time, } } -void Animator::Render(std::unique_ptr layer_tree) { +void Animator::Render(std::unique_ptr layer_tree) { if (dimension_change_pending_ && layer_tree->frame_size() != last_layer_tree_size_) { dimension_change_pending_ = false; diff --git a/shell/common/animator.h b/shell/common/animator.h index e0cd52bf7bc4f..c5bd8b5b147e0 100644 --- a/shell/common/animator.h +++ b/shell/common/animator.h @@ -27,7 +27,7 @@ class Animator final { virtual void OnAnimatorNotifyIdle(int64_t deadline) = 0; virtual void OnAnimatorDraw( - fml::RefPtr> pipeline) = 0; + fml::RefPtr> pipeline) = 0; virtual void OnAnimatorDrawLastLayerTree() = 0; }; @@ -42,7 +42,7 @@ class Animator final { void RequestFrame(bool regenerate_layer_tree = true); - void Render(std::unique_ptr layer_tree); + void Render(std::unique_ptr layer_tree); void Start(); @@ -55,7 +55,7 @@ class Animator final { void EnqueueTraceFlowId(uint64_t trace_flow_id); private: - using LayerTreePipeline = Pipeline; + using LayerTreePipeline = Pipeline; void BeginFrame(fml::TimePoint frame_start_time, fml::TimePoint frame_target_time); diff --git a/shell/common/engine.cc b/shell/common/engine.cc index fdbd6bf7a8fde..a427df24dae85 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -397,7 +397,7 @@ void Engine::ScheduleFrame(bool regenerate_layer_tree) { animator_->RequestFrame(regenerate_layer_tree); } -void Engine::Render(std::unique_ptr layer_tree) { +void Engine::Render(std::unique_ptr layer_tree) { if (!layer_tree) return; diff --git a/shell/common/engine.h b/shell/common/engine.h index cd2c32b8403cd..e32ed11b65f6e 100644 --- a/shell/common/engine.h +++ b/shell/common/engine.h @@ -137,7 +137,7 @@ class Engine final : public RuntimeDelegate { std::string DefaultRouteName() override; // |RuntimeDelegate| - void Render(std::unique_ptr layer_tree) override; + void Render(std::unique_ptr layer_tree) override; // |RuntimeDelegate| void UpdateSemantics(SemanticsNodeUpdates update, diff --git a/shell/common/platform_view.cc b/shell/common/platform_view.cc index 5de50e3d9b46b..4a84f27f4e456 100644 --- a/shell/common/platform_view.cc +++ b/shell/common/platform_view.cc @@ -102,7 +102,7 @@ void PlatformView::HandlePlatformMessage(fml::RefPtr message) { void PlatformView::OnPreEngineRestart() const {} -void PlatformView::RegisterTexture(std::shared_ptr texture) { +void PlatformView::RegisterTexture(std::shared_ptr texture) { delegate_.OnPlatformViewRegisterTexture(std::move(texture)); } diff --git a/shell/common/platform_view.h b/shell/common/platform_view.h index d76e8fbb0eb44..c8e44836afec9 100644 --- a/shell/common/platform_view.h +++ b/shell/common/platform_view.h @@ -54,7 +54,7 @@ class PlatformView { virtual void OnPlatformViewSetAccessibilityFeatures(int32_t flags) = 0; virtual void OnPlatformViewRegisterTexture( - std::shared_ptr texture) = 0; + std::shared_ptr texture) = 0; virtual void OnPlatformViewUnregisterTexture(int64_t texture_id) = 0; @@ -106,7 +106,7 @@ class PlatformView { void DispatchPointerDataPacket(std::unique_ptr packet); // Called once per texture, on the platform thread. - void RegisterTexture(std::shared_ptr texture); + void RegisterTexture(std::shared_ptr texture); // Called once per texture, on the platform thread. void UnregisterTexture(int64_t texture_id); diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index 80a93ad3d87ce..07c518c971d8b 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -24,11 +24,11 @@ static constexpr std::chrono::milliseconds kSkiaCleanupExpiration(15000); Rasterizer::Rasterizer(TaskRunners task_runners) : Rasterizer(std::move(task_runners), - std::make_unique()) {} + std::make_unique()) {} Rasterizer::Rasterizer( TaskRunners task_runners, - std::unique_ptr compositor_context) + std::unique_ptr compositor_context) : task_runners_(std::move(task_runners)), compositor_context_(std::move(compositor_context)), weak_factory_(this) { @@ -56,11 +56,11 @@ void Rasterizer::Teardown() { last_layer_tree_.reset(); } -flow::TextureRegistry* Rasterizer::GetTextureRegistry() { +flutter::TextureRegistry* Rasterizer::GetTextureRegistry() { return &compositor_context_->texture_registry(); } -flow::LayerTree* Rasterizer::GetLastLayerTree() { +flutter::LayerTree* Rasterizer::GetLastLayerTree() { return last_layer_tree_.get(); } @@ -71,10 +71,10 @@ void Rasterizer::DrawLastLayerTree() { DrawToSurface(*last_layer_tree_); } -void Rasterizer::Draw(fml::RefPtr> pipeline) { +void Rasterizer::Draw(fml::RefPtr> pipeline) { TRACE_EVENT0("flutter", "GPURasterizer::Draw"); - Pipeline::Consumer consumer = + Pipeline::Consumer consumer = std::bind(&Rasterizer::DoDraw, this, std::placeholders::_1); // Consume as many pipeline items as possible. But yield the event loop @@ -146,7 +146,7 @@ sk_sp Rasterizer::MakeRasterSnapshot(sk_sp picture, return nullptr; } -void Rasterizer::DoDraw(std::unique_ptr layer_tree) { +void Rasterizer::DoDraw(std::unique_ptr layer_tree) { if (!layer_tree || !surface_) { return; } @@ -166,7 +166,7 @@ void Rasterizer::DoDraw(std::unique_ptr layer_tree) { } } -bool Rasterizer::DrawToSurface(flow::LayerTree& layer_tree) { +bool Rasterizer::DrawToSurface(flutter::LayerTree& layer_tree) { FML_DCHECK(surface_); auto frame = surface_->AcquireFrame(layer_tree.frame_size()); @@ -213,8 +213,8 @@ static sk_sp SerializeTypeface(SkTypeface* typeface, void* ctx) { } static sk_sp ScreenshotLayerTreeAsPicture( - flow::LayerTree* tree, - flow::CompositorContext& compositor_context) { + flutter::LayerTree* tree, + flutter::CompositorContext& compositor_context) { FML_DCHECK(tree != nullptr); SkPictureRecorder recorder; recorder.beginRecording( @@ -256,8 +256,8 @@ static sk_sp CreateSnapshotSurface(GrContext* surface_context, } static sk_sp ScreenshotLayerTreeAsImage( - flow::LayerTree* tree, - flow::CompositorContext& compositor_context, + flutter::LayerTree* tree, + flutter::CompositorContext& compositor_context, GrContext* surface_context, bool compressed) { // Attempt to create a snapshot surface depending on whether we have access to diff --git a/shell/common/rasterizer.h b/shell/common/rasterizer.h index f9d472b380862..a34e511d51cc0 100644 --- a/shell/common/rasterizer.h +++ b/shell/common/rasterizer.h @@ -24,7 +24,7 @@ class Rasterizer final : public SnapshotDelegate { Rasterizer(TaskRunners task_runners); Rasterizer(TaskRunners task_runners, - std::unique_ptr compositor_context); + std::unique_ptr compositor_context); ~Rasterizer(); @@ -36,13 +36,13 @@ class Rasterizer final : public SnapshotDelegate { fml::WeakPtr GetSnapshotDelegate() const; - flow::LayerTree* GetLastLayerTree(); + flutter::LayerTree* GetLastLayerTree(); void DrawLastLayerTree(); - flow::TextureRegistry* GetTextureRegistry(); + flutter::TextureRegistry* GetTextureRegistry(); - void Draw(fml::RefPtr> pipeline); + void Draw(fml::RefPtr> pipeline); enum class ScreenshotType { SkiaPicture, @@ -69,7 +69,7 @@ class Rasterizer final : public SnapshotDelegate { // the surface on the GPU task runner. void SetNextFrameCallback(fml::closure callback); - flow::CompositorContext* compositor_context() { + flutter::CompositorContext* compositor_context() { return compositor_context_.get(); } @@ -78,8 +78,8 @@ class Rasterizer final : public SnapshotDelegate { private: TaskRunners task_runners_; std::unique_ptr surface_; - std::unique_ptr compositor_context_; - std::unique_ptr last_layer_tree_; + std::unique_ptr compositor_context_; + std::unique_ptr last_layer_tree_; fml::closure next_frame_callback_; fml::WeakPtrFactory weak_factory_; @@ -87,9 +87,9 @@ class Rasterizer final : public SnapshotDelegate { sk_sp MakeRasterSnapshot(sk_sp picture, SkISize picture_size) override; - void DoDraw(std::unique_ptr layer_tree); + void DoDraw(std::unique_ptr layer_tree); - bool DrawToSurface(flow::LayerTree& layer_tree); + bool DrawToSurface(flutter::LayerTree& layer_tree); void FireNextFrameCallbackIfPresent(); diff --git a/shell/common/shell.cc b/shell/common/shell.cc index e62dd13a2e8e3..5a33f0d388eed 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -674,7 +674,7 @@ void Shell::OnPlatformViewSetAccessibilityFeatures(int32_t flags) { // |PlatformView::Delegate| void Shell::OnPlatformViewRegisterTexture( - std::shared_ptr texture) { + std::shared_ptr texture) { FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -768,7 +768,7 @@ void Shell::OnAnimatorNotifyIdle(int64_t deadline) { } // |Animator::Delegate| -void Shell::OnAnimatorDraw(fml::RefPtr> pipeline) { +void Shell::OnAnimatorDraw(fml::RefPtr> pipeline) { FML_DCHECK(is_setup_); task_runners_.GetGPUTaskRunner()->PostTask( diff --git a/shell/common/shell.h b/shell/common/shell.h index 09614b6941cda..948afb1e31891 100644 --- a/shell/common/shell.h +++ b/shell/common/shell.h @@ -151,7 +151,7 @@ class Shell final : public PlatformView::Delegate, // |PlatformView::Delegate| void OnPlatformViewRegisterTexture( - std::shared_ptr texture) override; + std::shared_ptr texture) override; // |PlatformView::Delegate| void OnPlatformViewUnregisterTexture(int64_t texture_id) override; @@ -169,7 +169,8 @@ class Shell final : public PlatformView::Delegate, void OnAnimatorNotifyIdle(int64_t deadline) override; // |Animator::Delegate| - void OnAnimatorDraw(fml::RefPtr> pipeline) override; + void OnAnimatorDraw( + fml::RefPtr> pipeline) override; // |Animator::Delegate| void OnAnimatorDrawLastLayerTree() override; diff --git a/shell/common/shell_io_manager.cc b/shell/common/shell_io_manager.cc index 2ca9cb25a1f8b..f1155c2e883a0 100644 --- a/shell/common/shell_io_manager.cc +++ b/shell/common/shell_io_manager.cc @@ -50,7 +50,7 @@ ShellIOManager::ShellIOManager( resource_context_ ? std::make_unique>( resource_context_.get()) : nullptr), - unref_queue_(fml::MakeRefCounted( + unref_queue_(fml::MakeRefCounted( std::move(unref_queue_task_runner), fml::TimeDelta::FromMilliseconds(250))), weak_factory_(this) { @@ -93,7 +93,7 @@ void ShellIOManager::UpdateResourceContext(sk_sp resource_context) { : nullptr; } -fml::RefPtr ShellIOManager::GetSkiaUnrefQueue() const { +fml::RefPtr ShellIOManager::GetSkiaUnrefQueue() const { return unref_queue_; } diff --git a/shell/common/shell_io_manager.h b/shell/common/shell_io_manager.h index 49a93899c52ef..11efd343437b7 100644 --- a/shell/common/shell_io_manager.h +++ b/shell/common/shell_io_manager.h @@ -42,7 +42,7 @@ class ShellIOManager final : public IOManager { // resource context, but may be called if the Dart VM is restarted. void UpdateResourceContext(sk_sp resource_context); - fml::RefPtr GetSkiaUnrefQueue() const override; + fml::RefPtr GetSkiaUnrefQueue() const override; fml::WeakPtr GetWeakPtr(); @@ -53,7 +53,7 @@ class ShellIOManager final : public IOManager { resource_context_weak_factory_; // Unref queue management. - fml::RefPtr unref_queue_; + fml::RefPtr unref_queue_; fml::WeakPtrFactory weak_factory_; diff --git a/shell/common/surface.cc b/shell/common/surface.cc index ce33431100294..b8a77ca1811d4 100644 --- a/shell/common/surface.cc +++ b/shell/common/surface.cc @@ -56,7 +56,7 @@ Surface::Surface() = default; Surface::~Surface() = default; -flow::ExternalViewEmbedder* Surface::GetExternalViewEmbedder() { +flutter::ExternalViewEmbedder* Surface::GetExternalViewEmbedder() { return nullptr; } diff --git a/shell/common/surface.h b/shell/common/surface.h index f3c5db8bb4fc3..06bebed09c51f 100644 --- a/shell/common/surface.h +++ b/shell/common/surface.h @@ -55,7 +55,7 @@ class Surface { virtual GrContext* GetContext() = 0; - virtual flow::ExternalViewEmbedder* GetExternalViewEmbedder(); + virtual flutter::ExternalViewEmbedder* GetExternalViewEmbedder(); virtual bool MakeRenderContextCurrent(); diff --git a/shell/gpu/gpu_surface_gl.cc b/shell/gpu/gpu_surface_gl.cc index 98011dfc72d4e..f92c34cad7641 100644 --- a/shell/gpu/gpu_surface_gl.cc +++ b/shell/gpu/gpu_surface_gl.cc @@ -320,7 +320,7 @@ GrContext* GPUSurfaceGL::GetContext() { } // |Surface| -flow::ExternalViewEmbedder* GPUSurfaceGL::GetExternalViewEmbedder() { +flutter::ExternalViewEmbedder* GPUSurfaceGL::GetExternalViewEmbedder() { return delegate_->GetExternalViewEmbedder(); } diff --git a/shell/gpu/gpu_surface_gl.h b/shell/gpu/gpu_surface_gl.h index 2c8e9afc6fe69..9ad53f6228f73 100644 --- a/shell/gpu/gpu_surface_gl.h +++ b/shell/gpu/gpu_surface_gl.h @@ -39,7 +39,7 @@ class GPUSurfaceGL : public Surface { GrContext* GetContext() override; // |Surface| - flow::ExternalViewEmbedder* GetExternalViewEmbedder() override; + flutter::ExternalViewEmbedder* GetExternalViewEmbedder() override; // |Surface| bool MakeRenderContextCurrent() override; diff --git a/shell/gpu/gpu_surface_gl_delegate.cc b/shell/gpu/gpu_surface_gl_delegate.cc index 92f30039aab95..4511141bbb833 100644 --- a/shell/gpu/gpu_surface_gl_delegate.cc +++ b/shell/gpu/gpu_surface_gl_delegate.cc @@ -22,7 +22,7 @@ SkMatrix GPUSurfaceGLDelegate::GLContextSurfaceTransformation() const { return matrix; } -flow::ExternalViewEmbedder* GPUSurfaceGLDelegate::GetExternalViewEmbedder() { +flutter::ExternalViewEmbedder* GPUSurfaceGLDelegate::GetExternalViewEmbedder() { return nullptr; } diff --git a/shell/gpu/gpu_surface_gl_delegate.h b/shell/gpu/gpu_surface_gl_delegate.h index 0a8b9d5eca80f..0a6b33d22487d 100644 --- a/shell/gpu/gpu_surface_gl_delegate.h +++ b/shell/gpu/gpu_surface_gl_delegate.h @@ -44,7 +44,7 @@ class GPUSurfaceGLDelegate { // Get a reference to the external views embedder. This happens on the same // thread that the renderer is operating on. - virtual flow::ExternalViewEmbedder* GetExternalViewEmbedder(); + virtual flutter::ExternalViewEmbedder* GetExternalViewEmbedder(); sk_sp GetGLInterface() const; diff --git a/shell/gpu/gpu_surface_software.cc b/shell/gpu/gpu_surface_software.cc index 78fba54919050..399a9a46c529c 100644 --- a/shell/gpu/gpu_surface_software.cc +++ b/shell/gpu/gpu_surface_software.cc @@ -9,7 +9,7 @@ namespace flutter { -flow::ExternalViewEmbedder* +flutter::ExternalViewEmbedder* GPUSurfaceSoftwareDelegate::GetExternalViewEmbedder() { return nullptr; } @@ -81,7 +81,7 @@ GrContext* GPUSurfaceSoftware::GetContext() { } // |Surface| -flow::ExternalViewEmbedder* GPUSurfaceSoftware::GetExternalViewEmbedder() { +flutter::ExternalViewEmbedder* GPUSurfaceSoftware::GetExternalViewEmbedder() { return delegate_->GetExternalViewEmbedder(); } diff --git a/shell/gpu/gpu_surface_software.h b/shell/gpu/gpu_surface_software.h index f544fd111da63..ccf2ef11b5c13 100644 --- a/shell/gpu/gpu_surface_software.h +++ b/shell/gpu/gpu_surface_software.h @@ -19,7 +19,7 @@ class GPUSurfaceSoftwareDelegate { virtual bool PresentBackingStore(sk_sp backing_store) = 0; - virtual flow::ExternalViewEmbedder* GetExternalViewEmbedder(); + virtual flutter::ExternalViewEmbedder* GetExternalViewEmbedder(); }; class GPUSurfaceSoftware : public Surface { @@ -41,7 +41,7 @@ class GPUSurfaceSoftware : public Surface { GrContext* GetContext() override; // |Surface| - flow::ExternalViewEmbedder* GetExternalViewEmbedder() override; + flutter::ExternalViewEmbedder* GetExternalViewEmbedder() override; private: GPUSurfaceSoftwareDelegate* delegate_; diff --git a/shell/platform/android/android_external_texture_gl.h b/shell/platform/android/android_external_texture_gl.h index 4f2514a2d51ba..9ce87b3255bd1 100644 --- a/shell/platform/android/android_external_texture_gl.h +++ b/shell/platform/android/android_external_texture_gl.h @@ -11,7 +11,7 @@ namespace flutter { -class AndroidExternalTextureGL : public flow::Texture { +class AndroidExternalTextureGL : public flutter::Texture { public: AndroidExternalTextureGL( int64_t id, diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm index 0f4855d0d0ec8..0c89e580311b8 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm @@ -179,7 +179,7 @@ SkCanvas* FlutterPlatformViewsController::CompositeEmbeddedView( int view_id, - const flow::EmbeddedViewParams& params) { + const flutter::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. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h index 62921aadbee35..aaab1720b7648 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h @@ -67,7 +67,7 @@ class FlutterPlatformViewsController { std::vector GetCurrentCanvases(); - SkCanvas* CompositeEmbeddedView(int view_id, const flow::EmbeddedViewParams& params); + SkCanvas* CompositeEmbeddedView(int view_id, const flutter::EmbeddedViewParams& params); // Discards all platform views instances and auxiliary resources. void Reset(); diff --git a/shell/platform/darwin/ios/ios_external_texture_gl.h b/shell/platform/darwin/ios/ios_external_texture_gl.h index 360de25a1ce73..3c15ac91482f3 100644 --- a/shell/platform/darwin/ios/ios_external_texture_gl.h +++ b/shell/platform/darwin/ios/ios_external_texture_gl.h @@ -11,7 +11,7 @@ namespace flutter { -class IOSExternalTextureGL : public flow::Texture { +class IOSExternalTextureGL : public flutter::Texture { public: IOSExternalTextureGL(int64_t textureId, NSObject* externalTexture); diff --git a/shell/platform/darwin/ios/ios_surface_gl.h b/shell/platform/darwin/ios/ios_surface_gl.h index 116033fda19ad..e0a2f52e2d927 100644 --- a/shell/platform/darwin/ios/ios_surface_gl.h +++ b/shell/platform/darwin/ios/ios_surface_gl.h @@ -18,7 +18,7 @@ namespace flutter { class IOSSurfaceGL : public IOSSurface, public GPUSurfaceGLDelegate, - public flow::ExternalViewEmbedder { + public flutter::ExternalViewEmbedder { public: IOSSurfaceGL(std::shared_ptr context, fml::scoped_nsobject layer, @@ -49,21 +49,21 @@ class IOSSurfaceGL : public IOSSurface, bool UseOffscreenSurface() const override; // |GPUSurfaceGLDelegate| - flow::ExternalViewEmbedder* GetExternalViewEmbedder() override; + flutter::ExternalViewEmbedder* GetExternalViewEmbedder() override; - // |flow::ExternalViewEmbedder| + // |flutter::ExternalViewEmbedder| void BeginFrame(SkISize frame_size) override; - // |flow::ExternalViewEmbedder| + // |flutter::ExternalViewEmbedder| void PrerollCompositeEmbeddedView(int view_id) override; - // |flow::ExternalViewEmbedder| + // |flutter::ExternalViewEmbedder| std::vector GetCurrentCanvases() override; - // |flow::ExternalViewEmbedder| - SkCanvas* CompositeEmbeddedView(int view_id, const flow::EmbeddedViewParams& params) override; + // |flutter::ExternalViewEmbedder| + SkCanvas* CompositeEmbeddedView(int view_id, const flutter::EmbeddedViewParams& params) override; - // |flow::ExternalViewEmbedder| + // |flutter::ExternalViewEmbedder| bool SubmitFrame(GrContext* context) override; private: diff --git a/shell/platform/darwin/ios/ios_surface_gl.mm b/shell/platform/darwin/ios/ios_surface_gl.mm index 0973dbfeb4fbd..f9279cc5116fe 100644 --- a/shell/platform/darwin/ios/ios_surface_gl.mm +++ b/shell/platform/darwin/ios/ios_surface_gl.mm @@ -74,7 +74,7 @@ return IsValid() && render_target_->PresentRenderBuffer(); } -flow::ExternalViewEmbedder* IOSSurfaceGL::GetExternalViewEmbedder() { +flutter::ExternalViewEmbedder* IOSSurfaceGL::GetExternalViewEmbedder() { if (IsIosEmbeddedViewsPreviewEnabled()) { return this; } else { @@ -101,7 +101,8 @@ return platform_views_controller->GetCurrentCanvases(); } -SkCanvas* IOSSurfaceGL::CompositeEmbeddedView(int view_id, const flow::EmbeddedViewParams& params) { +SkCanvas* IOSSurfaceGL::CompositeEmbeddedView(int view_id, + const flutter::EmbeddedViewParams& params) { FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController(); FML_CHECK(platform_views_controller != nullptr); return platform_views_controller->CompositeEmbeddedView(view_id, params); diff --git a/shell/platform/darwin/ios/ios_surface_software.h b/shell/platform/darwin/ios/ios_surface_software.h index c45342a3dac6c..bcb5b6210bf6b 100644 --- a/shell/platform/darwin/ios/ios_surface_software.h +++ b/shell/platform/darwin/ios/ios_surface_software.h @@ -17,7 +17,7 @@ namespace flutter { class IOSSurfaceSoftware final : public IOSSurface, public GPUSurfaceSoftwareDelegate, - public flow::ExternalViewEmbedder { + public flutter::ExternalViewEmbedder { public: IOSSurfaceSoftware(fml::scoped_nsobject layer, FlutterPlatformViewsController* platform_views_controller); @@ -43,21 +43,21 @@ class IOSSurfaceSoftware final : public IOSSurface, bool PresentBackingStore(sk_sp backing_store) override; // |GPUSurfaceSoftwareDelegate| - flow::ExternalViewEmbedder* GetExternalViewEmbedder() override; + flutter::ExternalViewEmbedder* GetExternalViewEmbedder() override; - // |flow::ExternalViewEmbedder| + // |flutter::ExternalViewEmbedder| void BeginFrame(SkISize frame_size) override; - // |flow::ExternalViewEmbedder| + // |flutter::ExternalViewEmbedder| void PrerollCompositeEmbeddedView(int view_id) override; - // |flow::ExternalViewEmbedder| + // |flutter::ExternalViewEmbedder| std::vector GetCurrentCanvases() override; - // |flow::ExternalViewEmbedder| - SkCanvas* CompositeEmbeddedView(int view_id, const flow::EmbeddedViewParams& params) override; + // |flutter::ExternalViewEmbedder| + SkCanvas* CompositeEmbeddedView(int view_id, const flutter::EmbeddedViewParams& params) override; - // |flow::ExternalViewEmbedder| + // |flutter::ExternalViewEmbedder| bool SubmitFrame(GrContext* context) override; private: diff --git a/shell/platform/darwin/ios/ios_surface_software.mm b/shell/platform/darwin/ios/ios_surface_software.mm index 2731ad9c07dbb..32cb5a2bbeef1 100644 --- a/shell/platform/darwin/ios/ios_surface_software.mm +++ b/shell/platform/darwin/ios/ios_surface_software.mm @@ -127,7 +127,7 @@ return true; } -flow::ExternalViewEmbedder* IOSSurfaceSoftware::GetExternalViewEmbedder() { +flutter::ExternalViewEmbedder* IOSSurfaceSoftware::GetExternalViewEmbedder() { if (IsIosEmbeddedViewsPreviewEnabled()) { return this; } else { @@ -154,7 +154,7 @@ } SkCanvas* IOSSurfaceSoftware::CompositeEmbeddedView(int view_id, - const flow::EmbeddedViewParams& params) { + const flutter::EmbeddedViewParams& params) { FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController(); FML_CHECK(platform_views_controller != nullptr); return platform_views_controller->CompositeEmbeddedView(view_id, params); diff --git a/shell/platform/embedder/embedder_external_texture_gl.cc b/shell/platform/embedder/embedder_external_texture_gl.cc index d4cdd88f3aea8..b9857ae4ee363 100644 --- a/shell/platform/embedder/embedder_external_texture_gl.cc +++ b/shell/platform/embedder/embedder_external_texture_gl.cc @@ -17,7 +17,7 @@ EmbedderExternalTextureGL::EmbedderExternalTextureGL( EmbedderExternalTextureGL::~EmbedderExternalTextureGL() = default; -// |flow::Texture| +// |flutter::Texture| void EmbedderExternalTextureGL::Paint(SkCanvas& canvas, const SkRect& bounds, bool freeze, @@ -35,13 +35,13 @@ void EmbedderExternalTextureGL::Paint(SkCanvas& canvas, } } -// |flow::Texture| +// |flutter::Texture| void EmbedderExternalTextureGL::OnGrContextCreated() {} -// |flow::Texture| +// |flutter::Texture| void EmbedderExternalTextureGL::OnGrContextDestroyed() {} -// |flow::Texture| +// |flutter::Texture| void EmbedderExternalTextureGL::MarkNewFrameAvailable() {} } // namespace flutter diff --git a/shell/platform/embedder/embedder_external_texture_gl.h b/shell/platform/embedder/embedder_external_texture_gl.h index 3381bc6969b74..e1cd383c72f5a 100644 --- a/shell/platform/embedder/embedder_external_texture_gl.h +++ b/shell/platform/embedder/embedder_external_texture_gl.h @@ -12,7 +12,7 @@ namespace flutter { -class EmbedderExternalTextureGL : public flow::Texture { +class EmbedderExternalTextureGL : public flutter::Texture { public: using ExternalTextureCallback = std::function< sk_sp(int64_t texture_identifier, GrContext*, const SkISize&)>; @@ -26,19 +26,19 @@ class EmbedderExternalTextureGL : public flow::Texture { ExternalTextureCallback external_texture_callback_; sk_sp last_image_; - // |flow::Texture| + // |flutter::Texture| void Paint(SkCanvas& canvas, const SkRect& bounds, bool freeze, GrContext* context) override; - // |flow::Texture| + // |flutter::Texture| void OnGrContextCreated() override; - // |flow::Texture| + // |flutter::Texture| void OnGrContextDestroyed() override; - // |flow::Texture| + // |flutter::Texture| void MarkNewFrameAvailable() override; FML_DISALLOW_COPY_AND_ASSIGN(EmbedderExternalTextureGL); From d8aa6bca161cba79153c383bee4fd3606bfdcad0 Mon Sep 17 00:00:00 2001 From: Shi-Hao Hong Date: Wed, 17 Apr 2019 15:03:50 -0700 Subject: [PATCH 0845/1117] Fix typo in comment (#8617) --- .../common/cpp/client_wrapper/testing/encodable_value_utils.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/common/cpp/client_wrapper/testing/encodable_value_utils.cc b/shell/platform/common/cpp/client_wrapper/testing/encodable_value_utils.cc index c9ae7ad1859fb..607d69b18f599 100644 --- a/shell/platform/common/cpp/client_wrapper/testing/encodable_value_utils.cc +++ b/shell/platform/common/cpp/client_wrapper/testing/encodable_value_utils.cc @@ -24,7 +24,7 @@ bool EncodableValuesAreEqual(const EncodableValue& a, const EncodableValue& b) { case EncodableValue::Type::kLong: return a.LongValue() == b.LongValue(); case EncodableValue::Type::kDouble: - // This is a crude epsilon, but fine for the values in the the unit tests. + // This is a crude epsilon, but fine for the values in the unit tests. return std::abs(a.DoubleValue() - b.DoubleValue()) < 0.0001l; case EncodableValue::Type::kString: return a.StringValue() == b.StringValue(); From 76794745b6764246cffafb237182f7fafeac41f8 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 17 Apr 2019 18:58:24 -0400 Subject: [PATCH 0846/1117] Roll src/third_party/skia 6f9047027be3..14c90c1ca218 (5 commits) (#8619) https://skia.googlesource.com/skia.git/%2Blog/6f9047027be3..14c90c1ca218 git log 6f9047027be329719bb9fe79e6f892724e6a0fa2..14c90c1ca218428418b82be5684bb71f13e81f60 --date=short --no-merges --format=%ad %ae %s 2019-04-16 bungeman@google.com Reland "Remove includes from SkFontTypes.h" 2019-04-17 benjaminwagner@google.com Add __init__.py to page_sets 2019-04-17 robertphillips@google.com Non-substantive changes 2019-04-17 halcanary@google.com SkQP: fix model colorspace (16-bit gold images) 2019-04-17 egdaniel@google.com Add struct to wrap all the gpu flush options. The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f9528a08ac801..4166659d099ec 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': '6f9047027be329719bb9fe79e6f892724e6a0fa2', + 'skia_revision': '14c90c1ca218428418b82be5684bb71f13e81f60', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index d12bb50f7c6b0..5e96446d74342 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 11a62db81fc2e5de87424264c609fcc2 +Signature: d8a18a9fdd79e2059c52ee457cbff607 UNUSED LICENSES: From 80e934e3241fa8b177beea5a6af5f06cc2939923 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 17 Apr 2019 15:43:30 -0700 Subject: [PATCH 0847/1117] Roll src/third_party/dart 7b9ab9f353..714a082a5d (7 commits) 714a082a5d Minimal integration of summary2 into AnalysisDriver. dd3530450d make "late" and "required" builtin keywords 836efd6520 Add a language_2 test for having an invalid type in an on clause 81e554ea43 parse "required" modifier for NNBD 1eab04ed3f Reland "[VM-debugger] resolve column breakpoint tokenposition into a single value" ec27b09e68 [vm, service] Fix deferral of service extension invocation to not be mislead by other OOB messages. 1e30bb90dc [vm/dbc] Support unboxed Int64 on DBC --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4166659d099ec..1b2e0aa646b30 100644 --- a/DEPS +++ b/DEPS @@ -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': '7b9ab9f35390d36d32c405a807be31ae3ed0ddb7', + 'dart_revision': '714a082a5dffd369abbe7052ac0e5c82415fb11f', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 62957332ff643..9d63d31a0711d 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 3ea8eaf2d73434b50c81b323a6e6ef43 +Signature: 31f79457e926e77f5462729ec7d64ce2 UNUSED LICENSES: From f017fe74aa78ee5465e6a8c55d23fcde1e4d2f74 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 17 Apr 2019 16:11:47 -0700 Subject: [PATCH 0848/1117] Avoid manually shutting down engine managed isolates. (#8621) These are now shutdown by the VM and cleanup waits for their shutdown. --- BUILD.gn | 1 + runtime/dart_isolate.cc | 4 -- runtime/dart_lifecycle_unittests.cc | 71 +++++++++++++++-------------- runtime/dart_vm.cc | 50 -------------------- runtime/dart_vm.h | 13 ------ testing/run_tests.sh | 3 ++ 6 files changed, 40 insertions(+), 102 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 1ae4a19c64803..a3c33e6fef6ce 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -47,6 +47,7 @@ group("flutter") { public_deps += [ "$flutter_root/flow:flow_unittests", "$flutter_root/fml:fml_unittests", + "$flutter_root/runtime:runtime_lifecycle_unittests", "$flutter_root/runtime:runtime_unittests", "$flutter_root/shell/common:shell_unittests", "$flutter_root/shell/platform/common/cpp/client_wrapper:client_wrapper_unittests", diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 3c888887d9847..20b7c960ee26e 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -721,8 +721,6 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( } } - DartVMRef::GetRunningVM()->RegisterActiveIsolate(*embedder_isolate); - // The ownership of the embedder object is controlled by the Dart VM. So the // only reference returned to the caller is weak. embedder_isolate.release(); @@ -760,8 +758,6 @@ void DartIsolate::AddIsolateShutdownCallback(fml::closure closure) { void DartIsolate::OnShutdownCallback() { shutdown_callbacks_.clear(); - DartVMRef::GetRunningVM()->UnregisterActiveIsolate( - std::static_pointer_cast(shared_from_this())); } DartIsolate::AutoFireClosure::AutoFireClosure(fml::closure closure) diff --git a/runtime/dart_lifecycle_unittests.cc b/runtime/dart_lifecycle_unittests.cc index b51734deb1cb9..f50de29089092 100644 --- a/runtime/dart_lifecycle_unittests.cc +++ b/runtime/dart_lifecycle_unittests.cc @@ -4,6 +4,7 @@ #include "flutter/common/task_runners.h" #include "flutter/fml/paths.h" +#include "flutter/fml/synchronization/count_down_latch.h" #include "flutter/fml/synchronization/waitable_event.h" #include "flutter/runtime/dart_vm.h" #include "flutter/runtime/dart_vm_lifecycle.h" @@ -41,8 +42,7 @@ TEST_F(DartLifecycleTest, CanStartAndShutdownVMOverAndOver) { ASSERT_FALSE(DartVMRef::IsInstanceRunning()); } -static void CreateAndRunRootIsolate( - std::shared_ptr& isolate_result, +static std::shared_ptr CreateAndRunRootIsolate( const Settings& settings, const DartVMData& vm, fml::RefPtr task_runner, @@ -67,73 +67,74 @@ static void CreateAndRunRootIsolate( if (!isolate) { FML_LOG(ERROR) << "Could not create valid isolate."; - return; + return nullptr; } if (DartVM::IsRunningPrecompiledCode()) { if (!isolate->PrepareForRunningFromPrecompiledCode()) { FML_LOG(ERROR) << "Could not prepare to run the isolate from precompiled code."; - return; + return nullptr; } } else { if (!isolate->PrepareForRunningFromKernels( settings.application_kernels())) { FML_LOG(ERROR) << "Could not prepare isolate from application kernels."; - return; + return nullptr; } } if (isolate->GetPhase() != DartIsolate::Phase::Ready) { FML_LOG(ERROR) << "Isolate was not ready."; - return; + return nullptr; } if (!isolate->Run(entrypoint, settings.root_isolate_create_callback)) { FML_LOG(ERROR) << "Could not run entrypoint: " << entrypoint << "."; - return; + return nullptr; } if (isolate->GetPhase() != DartIsolate::Phase::Running) { FML_LOG(ERROR) << "Isolate was not Running."; - return; + return nullptr; } - isolate_result = isolate; -} - -static std::shared_ptr CreateAndRunRootIsolate( - const Settings& settings, - const DartVMData& vm, - fml::RefPtr task_runner, - std::string entrypoint) { - fml::AutoResetWaitableEvent latch; - std::shared_ptr isolate; - fml::TaskRunner::RunNowOrPostTask(task_runner, [&]() { - CreateAndRunRootIsolate(isolate, settings, vm, task_runner, entrypoint); - latch.Signal(); - }); - latch.Wait(); return isolate; } -TEST_F(DartLifecycleTest, ShuttingDownTheVMShutsDownTheIsolate) { +TEST_F(DartLifecycleTest, ShuttingDownTheVMShutsDownAllIsolates) { auto settings = CreateSettingsForFixture(); settings.leak_vm = false; - settings.enable_observatory = false; - ASSERT_FALSE(DartVMRef::IsInstanceRunning()); - { + // Make sure the service protocol launches + settings.enable_observatory = true; + + for (size_t i = 0; i < 3; i++) { + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); + + const auto last_launch_count = DartVM::GetVMLaunchCount(); + auto vm_ref = DartVMRef::Create(settings); + ASSERT_TRUE(DartVMRef::IsInstanceRunning()); - ASSERT_EQ(vm_ref->GetIsolateCount(), 0u); - auto isolate = - CreateAndRunRootIsolate(settings, *vm_ref.GetVMData(), - GetThreadTaskRunner(), "testIsolateShutdown"); - ASSERT_TRUE(isolate); - ASSERT_EQ(vm_ref->GetIsolateCount(), 1u); - vm_ref->ShutdownAllIsolates(); - ASSERT_EQ(vm_ref->GetIsolateCount(), 0u); + ASSERT_EQ(last_launch_count + 1, DartVM::GetVMLaunchCount()); + + const size_t isolate_count = 100; + + fml::CountDownLatch latch(isolate_count); + auto vm_data = vm_ref.GetVMData(); + auto thread_task_runner = GetThreadTaskRunner(); + for (size_t i = 0; i < isolate_count; ++i) { + thread_task_runner->PostTask( + [vm_data, &settings, &latch, thread_task_runner]() { + ASSERT_TRUE(CreateAndRunRootIsolate(settings, *vm_data.get(), + thread_task_runner, + "testIsolateShutdown")); + latch.CountDown(); + }); + } + + latch.Wait(); } ASSERT_FALSE(DartVMRef::IsInstanceRunning()); } diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 476d05f2fc651..973d5d8e86eb0 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -460,54 +460,4 @@ std::shared_ptr DartVM::GetIsolateNameServer() const { return isolate_name_server_; } -size_t DartVM::GetIsolateCount() const { - std::lock_guard lock(active_isolates_mutex_); - return active_isolates_.size(); -} - -void DartVM::ShutdownAllIsolates() { - std::set> isolates_to_shutdown; - // We may be shutting down isolates on the current thread. Shutting down the - // isolate calls the shutdown callback which removes the entry from the - // active isolate. The lock must be obtained to mutate that entry. To avoid a - // deadlock, collect the isolate is a seprate collection. - { - std::lock_guard lock(active_isolates_mutex_); - for (const auto& active_isolate : active_isolates_) { - if (auto task_runner = active_isolate->GetMessageHandlingTaskRunner()) { - isolates_to_shutdown.insert(active_isolate); - } - } - } - - fml::CountDownLatch latch(isolates_to_shutdown.size()); - - for (const auto& isolate : isolates_to_shutdown) { - fml::TaskRunner::RunNowOrPostTask( - isolate->GetMessageHandlingTaskRunner(), [&latch, isolate]() { - if (!isolate || !isolate->Shutdown()) { - FML_LOG(ERROR) << "Could not shutdown isolate."; - } - latch.CountDown(); - }); - } - latch.Wait(); -} - -void DartVM::RegisterActiveIsolate(std::shared_ptr isolate) { - if (!isolate) { - return; - } - std::lock_guard lock(active_isolates_mutex_); - active_isolates_.insert(isolate); -} - -void DartVM::UnregisterActiveIsolate(std::shared_ptr isolate) { - if (!isolate) { - return; - } - std::lock_guard lock(active_isolates_mutex_); - active_isolates_.erase(isolate); -} - } // namespace flutter diff --git a/runtime/dart_vm.h b/runtime/dart_vm.h index 690130984a54f..b88c033b6ef02 100644 --- a/runtime/dart_vm.h +++ b/runtime/dart_vm.h @@ -36,24 +36,15 @@ class DartVM { std::shared_ptr GetVMData() const; - // This accessor is racy and only meant to the used in tests where there is a - // consistent threading mode. - size_t GetIsolateCount() const; - std::shared_ptr GetServiceProtocol() const; std::shared_ptr GetIsolateNameServer() const; - void ShutdownAllIsolates(); - private: const Settings settings_; std::shared_ptr vm_data_; const std::shared_ptr isolate_name_server_; const std::shared_ptr service_protocol_; - mutable std::mutex active_isolates_mutex_; - std::set> active_isolates_ - FML_GUARDED_BY(active_isolates_mutex_); friend class DartVMRef; friend class DartIsolate; @@ -68,10 +59,6 @@ class DartVM { DartVM(std::shared_ptr data, std::shared_ptr isolate_name_server); - void RegisterActiveIsolate(std::shared_ptr isolate); - - void UnregisterActiveIsolate(std::shared_ptr isolate); - FML_DISALLOW_COPY_AND_ASSIGN(DartVM); }; diff --git a/testing/run_tests.sh b/testing/run_tests.sh index 621743aa809cc..87f68897055ea 100755 --- a/testing/run_tests.sh +++ b/testing/run_tests.sh @@ -35,6 +35,9 @@ echo "Running fml_unittests..." echo "Running runtime_unittests..." "$HOST_DIR/runtime_unittests" +echo "Running runtime_lifecycle_unittests..." +"$HOST_DIR/runtime_lifecycle_unittests" + echo "Running shell_unittests..." "$HOST_DIR/shell_unittests" From 72c84c287de16100ff8b3de1dc6bf9a6e69fbfec Mon Sep 17 00:00:00 2001 From: liyuqian Date: Wed, 17 Apr 2019 16:33:08 -0700 Subject: [PATCH 0849/1117] Revert "Roll src/third_party/dart 7b9ab9f353..714a082a5d (7 commits)" (#8624) This reverts commit 80e934e3241fa8b177beea5a6af5f06cc2939923. Reason for the revert: breaks the post-submit Mac iOS build bot. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 1b2e0aa646b30..4166659d099ec 100644 --- a/DEPS +++ b/DEPS @@ -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': '714a082a5dffd369abbe7052ac0e5c82415fb11f', + 'dart_revision': '7b9ab9f35390d36d32c405a807be31ae3ed0ddb7', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 9d63d31a0711d..62957332ff643 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 31f79457e926e77f5462729ec7d64ce2 +Signature: 3ea8eaf2d73434b50c81b323a6e6ef43 UNUSED LICENSES: From 876c4c339064ed321f37fba61422194d84cbfdb7 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 17 Apr 2019 17:25:16 -0700 Subject: [PATCH 0850/1117] Assert that all VM launches in the process have the same opinion on whether the VM should be leaked in the process. (#8622) There is a possibility for a VM launch to not have a requisite shutdown if a previous launch asked to leak the VM instance in the process. Embedders have to ensure (via their Embedding APIs) that all instances of VM launch use consistent settings. --- runtime/dart_vm_lifecycle.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/runtime/dart_vm_lifecycle.cc b/runtime/dart_vm_lifecycle.cc index ba6debf5d407e..fc0721a30a20f 100644 --- a/runtime/dart_vm_lifecycle.cc +++ b/runtime/dart_vm_lifecycle.cc @@ -50,6 +50,14 @@ DartVMRef DartVMRef::Create(Settings settings, fml::RefPtr shared_snapshot) { std::lock_guard lifecycle_lock(gVMMutex); + if (!settings.leak_vm) { + FML_CHECK(!gVMLeak) + << "Launch settings indicated that the VM should shut down in the " + "process when done but a previous launch asked the VM to leak in " + "the same process. For proper VM shutdown, all VM launches must " + "indicate that they should shut down when done."; + } + // If there is already a running VM in the process, grab a strong reference to // it. if (auto vm = gVM.lock()) { From 8b667b0178f135411ad72d7e5b3304cc46ff7dcf Mon Sep 17 00:00:00 2001 From: liyuqian Date: Wed, 17 Apr 2019 17:34:11 -0700 Subject: [PATCH 0851/1117] Add a unit test for PhysicalShapeLayer (#8616) An unnecessary PrerollContext copy is also removed. The added unit test will catch the error if we forget to subtract the elevation after the copy removal. This change has been tested with the framework (`flutter test --local-engine=host_debug_unopt`). --- ci/licenses_golden/licenses_flutter | 1 + flow/BUILD.gn | 1 + flow/layers/container_layer.cc | 3 +- flow/layers/physical_shape_layer.cc | 1 + flow/layers/physical_shape_layer.h | 2 + flow/layers/physical_shape_layer_unittests.cc | 60 +++++++++++++++++++ 6 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 flow/layers/physical_shape_layer_unittests.cc diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 4f82601d8ffe8..265dca257bf06 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -89,6 +89,7 @@ FILE: ../../../flutter/flow/layers/performance_overlay_layer.h FILE: ../../../flutter/flow/layers/performance_overlay_layer_unittests.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.h +FILE: ../../../flutter/flow/layers/physical_shape_layer_unittests.cc FILE: ../../../flutter/flow/layers/picture_layer.cc FILE: ../../../flutter/flow/layers/picture_layer.h FILE: ../../../flutter/flow/layers/platform_view_layer.cc diff --git a/flow/BUILD.gn b/flow/BUILD.gn index 756861f5e79ff..42e431fe057c3 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -98,6 +98,7 @@ executable("flow_unittests") { "flow_test_utils.cc", "flow_test_utils.h", "layers/performance_overlay_layer_unittests.cc", + "layers/physical_shape_layer_unittests.cc", "matrix_decomposition_unittests.cc", "raster_cache_unittests.cc", ] diff --git a/flow/layers/container_layer.cc b/flow/layers/container_layer.cc index 40d600e1c3e08..31a5a255afca9 100644 --- a/flow/layers/container_layer.cc +++ b/flow/layers/container_layer.cc @@ -27,8 +27,7 @@ void ContainerLayer::PrerollChildren(PrerollContext* context, const SkMatrix& child_matrix, SkRect* child_paint_bounds) { for (auto& layer : layers_) { - PrerollContext child_context = *context; - layer->Preroll(&child_context, child_matrix); + layer->Preroll(context, child_matrix); if (layer->needs_system_composite()) { set_needs_system_composite(true); diff --git a/flow/layers/physical_shape_layer.cc b/flow/layers/physical_shape_layer.cc index 2bf45ea763052..c80ca75873d38 100644 --- a/flow/layers/physical_shape_layer.cc +++ b/flow/layers/physical_shape_layer.cc @@ -47,6 +47,7 @@ void PhysicalShapeLayer::Preroll(PrerollContext* context, total_elevation_ = context->total_elevation; SkRect child_paint_bounds; PrerollChildren(context, matrix, &child_paint_bounds); + context->total_elevation -= elevation_; if (elevation_ == 0) { set_paint_bounds(path_.getBounds()); diff --git a/flow/layers/physical_shape_layer.h b/flow/layers/physical_shape_layer.h index e345102ba6589..edfbd410c2851 100644 --- a/flow/layers/physical_shape_layer.h +++ b/flow/layers/physical_shape_layer.h @@ -52,6 +52,8 @@ class PhysicalShapeLayer : public ContainerLayer { bool isRect_; SkRRect frameRRect_; Clip clip_behavior_; + + friend class PhysicalShapeLayer_TotalElevation_Test; }; } // namespace flutter diff --git a/flow/layers/physical_shape_layer_unittests.cc b/flow/layers/physical_shape_layer_unittests.cc new file mode 100644 index 0000000000000..6f5b96cc3702a --- /dev/null +++ b/flow/layers/physical_shape_layer_unittests.cc @@ -0,0 +1,60 @@ +// Copyright 2013 The Flutter 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/physical_shape_layer.h" + +#include "gtest/gtest.h" + +namespace flow { + +TEST(PhysicalShapeLayer, TotalElevation) { + std::shared_ptr layers[4]; + + for (int i = 0; i < 4; i += 1) { + layers[i] = std::make_shared(Clip::none); + layers[i]->set_elevation((float)(i + 1)); + } + + layers[0]->Add(layers[1]); + layers[0]->Add(layers[2]); + layers[2]->Add(layers[3]); + + const Stopwatch unused_stopwatch; + TextureRegistry unused_texture_registry; + 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 + kGiantRect, // SkRect cull_rect + unused_stopwatch, // frame time (dont care) + unused_stopwatch, // engine time (dont care) + unused_texture_registry, // texture registry (not supported) + false, // checkerboard_offscreen_layers + 0.0f, // total elevation + }; + + SkMatrix identity; + identity.setIdentity(); + + layers[0]->Preroll(&preroll_context, identity); + + // It should look like this: + // layers[0] +1.0f + // | \ + // | \ + // | \ + // | layers[2] +3.0f + // | | + // | layers[3] +4.0f + // | + // | + // layers[1] + 2.0f + EXPECT_EQ(layers[0]->total_elevation_, 1.0f); + EXPECT_EQ(layers[1]->total_elevation_, 3.0f); + EXPECT_EQ(layers[2]->total_elevation_, 4.0f); + EXPECT_EQ(layers[3]->total_elevation_, 8.0f); +} + +} // namespace flow From 91b71070f55ffc38c432babc7d9bb68ac2720d8d Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 17 Apr 2019 17:47:58 -0700 Subject: [PATCH 0852/1117] Revert "Add a unit test for PhysicalShapeLayer (#8616)" (#8627) This reverts commit 8b667b0178f135411ad72d7e5b3304cc46ff7dcf. --- ci/licenses_golden/licenses_flutter | 1 - flow/BUILD.gn | 1 - flow/layers/container_layer.cc | 3 +- flow/layers/physical_shape_layer.cc | 1 - flow/layers/physical_shape_layer.h | 2 - flow/layers/physical_shape_layer_unittests.cc | 60 ------------------- 6 files changed, 2 insertions(+), 66 deletions(-) delete mode 100644 flow/layers/physical_shape_layer_unittests.cc diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 265dca257bf06..4f82601d8ffe8 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -89,7 +89,6 @@ FILE: ../../../flutter/flow/layers/performance_overlay_layer.h FILE: ../../../flutter/flow/layers/performance_overlay_layer_unittests.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.h -FILE: ../../../flutter/flow/layers/physical_shape_layer_unittests.cc FILE: ../../../flutter/flow/layers/picture_layer.cc FILE: ../../../flutter/flow/layers/picture_layer.h FILE: ../../../flutter/flow/layers/platform_view_layer.cc diff --git a/flow/BUILD.gn b/flow/BUILD.gn index 42e431fe057c3..756861f5e79ff 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -98,7 +98,6 @@ executable("flow_unittests") { "flow_test_utils.cc", "flow_test_utils.h", "layers/performance_overlay_layer_unittests.cc", - "layers/physical_shape_layer_unittests.cc", "matrix_decomposition_unittests.cc", "raster_cache_unittests.cc", ] diff --git a/flow/layers/container_layer.cc b/flow/layers/container_layer.cc index 31a5a255afca9..40d600e1c3e08 100644 --- a/flow/layers/container_layer.cc +++ b/flow/layers/container_layer.cc @@ -27,7 +27,8 @@ void ContainerLayer::PrerollChildren(PrerollContext* context, const SkMatrix& child_matrix, SkRect* child_paint_bounds) { for (auto& layer : layers_) { - layer->Preroll(context, child_matrix); + PrerollContext child_context = *context; + layer->Preroll(&child_context, child_matrix); if (layer->needs_system_composite()) { set_needs_system_composite(true); diff --git a/flow/layers/physical_shape_layer.cc b/flow/layers/physical_shape_layer.cc index c80ca75873d38..2bf45ea763052 100644 --- a/flow/layers/physical_shape_layer.cc +++ b/flow/layers/physical_shape_layer.cc @@ -47,7 +47,6 @@ void PhysicalShapeLayer::Preroll(PrerollContext* context, total_elevation_ = context->total_elevation; SkRect child_paint_bounds; PrerollChildren(context, matrix, &child_paint_bounds); - context->total_elevation -= elevation_; if (elevation_ == 0) { set_paint_bounds(path_.getBounds()); diff --git a/flow/layers/physical_shape_layer.h b/flow/layers/physical_shape_layer.h index edfbd410c2851..e345102ba6589 100644 --- a/flow/layers/physical_shape_layer.h +++ b/flow/layers/physical_shape_layer.h @@ -52,8 +52,6 @@ class PhysicalShapeLayer : public ContainerLayer { bool isRect_; SkRRect frameRRect_; Clip clip_behavior_; - - friend class PhysicalShapeLayer_TotalElevation_Test; }; } // namespace flutter diff --git a/flow/layers/physical_shape_layer_unittests.cc b/flow/layers/physical_shape_layer_unittests.cc deleted file mode 100644 index 6f5b96cc3702a..0000000000000 --- a/flow/layers/physical_shape_layer_unittests.cc +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2013 The Flutter 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/physical_shape_layer.h" - -#include "gtest/gtest.h" - -namespace flow { - -TEST(PhysicalShapeLayer, TotalElevation) { - std::shared_ptr layers[4]; - - for (int i = 0; i < 4; i += 1) { - layers[i] = std::make_shared(Clip::none); - layers[i]->set_elevation((float)(i + 1)); - } - - layers[0]->Add(layers[1]); - layers[0]->Add(layers[2]); - layers[2]->Add(layers[3]); - - const Stopwatch unused_stopwatch; - TextureRegistry unused_texture_registry; - 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 - kGiantRect, // SkRect cull_rect - unused_stopwatch, // frame time (dont care) - unused_stopwatch, // engine time (dont care) - unused_texture_registry, // texture registry (not supported) - false, // checkerboard_offscreen_layers - 0.0f, // total elevation - }; - - SkMatrix identity; - identity.setIdentity(); - - layers[0]->Preroll(&preroll_context, identity); - - // It should look like this: - // layers[0] +1.0f - // | \ - // | \ - // | \ - // | layers[2] +3.0f - // | | - // | layers[3] +4.0f - // | - // | - // layers[1] + 2.0f - EXPECT_EQ(layers[0]->total_elevation_, 1.0f); - EXPECT_EQ(layers[1]->total_elevation_, 3.0f); - EXPECT_EQ(layers[2]->total_elevation_, 4.0f); - EXPECT_EQ(layers[3]->total_elevation_, 8.0f); -} - -} // namespace flow From 7d3caf895255f9f7d9f553563c6e888147d1a428 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 17 Apr 2019 19:06:03 -0700 Subject: [PATCH 0853/1117] Avoid leaking the VM in runtime_unittests and update failing tests. (#8626) The failing tests were depending on the old assumption that the VM would never shutdown. --- runtime/dart_isolate_unittests.cc | 38 +++++++++++++++++++++---------- runtime/dart_vm_unittests.cc | 21 +++++++++-------- runtime/runtime_test.cc | 1 + 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc index 9a6aa8218f14e..1c77bc892acc0 100644 --- a/runtime/dart_isolate_unittests.cc +++ b/runtime/dart_isolate_unittests.cc @@ -21,6 +21,7 @@ namespace testing { using DartIsolateTest = RuntimeTest; TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) { + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); auto settings = CreateSettingsForFixture(); auto vm_ref = DartVMRef::Create(settings); ASSERT_TRUE(vm_ref); @@ -50,6 +51,7 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) { } TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) { + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); auto settings = CreateSettingsForFixture(); auto vm_ref = DartVMRef::Create(settings); ASSERT_TRUE(vm_ref); @@ -143,12 +145,12 @@ class AutoIsolateShutdown { FML_DISALLOW_COPY_AND_ASSIGN(AutoIsolateShutdown); }; -static void RunDartCodeInIsolate(std::unique_ptr& result, +static void RunDartCodeInIsolate(DartVMRef& vm_ref, + std::unique_ptr& result, const Settings& settings, fml::RefPtr task_runner, std::string entrypoint) { FML_CHECK(task_runner->RunsTasksOnCurrentThread()); - auto vm_ref = DartVMRef::Create(settings); if (!vm_ref) { return; @@ -249,6 +251,7 @@ static void RunDartCodeInIsolate(std::unique_ptr& result, } static std::unique_ptr RunDartCodeInIsolate( + DartVMRef& vm_ref, const Settings& settings, fml::RefPtr task_runner, std::string entrypoint) { @@ -256,7 +259,7 @@ static std::unique_ptr RunDartCodeInIsolate( fml::AutoResetWaitableEvent latch; fml::TaskRunner::RunNowOrPostTask( task_runner, fml::MakeCopyable([&]() mutable { - RunDartCodeInIsolate(result, settings, task_runner, entrypoint); + RunDartCodeInIsolate(vm_ref, result, settings, task_runner, entrypoint); latch.Signal(); })); latch.Wait(); @@ -264,21 +267,30 @@ static std::unique_ptr RunDartCodeInIsolate( } TEST_F(DartIsolateTest, IsolateCanLoadAndRunDartCode) { - auto isolate = RunDartCodeInIsolate(CreateSettingsForFixture(), - GetCurrentTaskRunner(), "main"); + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); + const auto settings = CreateSettingsForFixture(); + auto vm_ref = DartVMRef::Create(settings); + auto isolate = + RunDartCodeInIsolate(vm_ref, settings, GetCurrentTaskRunner(), "main"); ASSERT_TRUE(isolate); ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running); } TEST_F(DartIsolateTest, IsolateCannotLoadAndRunUnknownDartEntrypoint) { - auto isolate = RunDartCodeInIsolate( - CreateSettingsForFixture(), GetCurrentTaskRunner(), "thisShouldNotExist"); + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); + const auto settings = CreateSettingsForFixture(); + auto vm_ref = DartVMRef::Create(settings); + auto isolate = RunDartCodeInIsolate(vm_ref, settings, GetCurrentTaskRunner(), + "thisShouldNotExist"); ASSERT_FALSE(isolate); } TEST_F(DartIsolateTest, CanRunDartCodeCodeSynchronously) { - auto isolate = RunDartCodeInIsolate(CreateSettingsForFixture(), - GetCurrentTaskRunner(), "main"); + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); + const auto settings = CreateSettingsForFixture(); + auto vm_ref = DartVMRef::Create(settings); + auto isolate = + RunDartCodeInIsolate(vm_ref, settings, GetCurrentTaskRunner(), "main"); ASSERT_TRUE(isolate); ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running); @@ -292,15 +304,17 @@ TEST_F(DartIsolateTest, CanRunDartCodeCodeSynchronously) { } TEST_F(DartIsolateTest, CanRegisterNativeCallback) { + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); fml::AutoResetWaitableEvent latch; AddNativeCallback("NotifyNative", CREATE_NATIVE_ENTRY(([&latch](Dart_NativeArguments args) { FML_LOG(ERROR) << "Hello from Dart!"; latch.Signal(); }))); - auto isolate = - RunDartCodeInIsolate(CreateSettingsForFixture(), GetThreadTaskRunner(), - "canRegisterNativeCallback"); + const auto settings = CreateSettingsForFixture(); + auto vm_ref = DartVMRef::Create(settings); + auto isolate = RunDartCodeInIsolate(vm_ref, settings, GetThreadTaskRunner(), + "canRegisterNativeCallback"); ASSERT_TRUE(isolate); ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running); latch.Wait(); diff --git a/runtime/dart_vm_unittests.cc b/runtime/dart_vm_unittests.cc index b8e329e7aa013..3b4d169a502d3 100644 --- a/runtime/dart_vm_unittests.cc +++ b/runtime/dart_vm_unittests.cc @@ -4,23 +4,23 @@ #include "flutter/runtime/dart_vm.h" #include "flutter/runtime/dart_vm_lifecycle.h" +#include "flutter/runtime/runtime_test.h" #include "gtest/gtest.h" namespace flutter { +namespace testing { -TEST(DartVM, SimpleInitialization) { - Settings settings = {}; - settings.task_observer_add = [](intptr_t, fml::closure) {}; - settings.task_observer_remove = [](intptr_t) {}; - auto vm = DartVMRef::Create(settings); +using DartVMTest = RuntimeTest; + +TEST_F(DartVMTest, SimpleInitialization) { + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); + auto vm = DartVMRef::Create(CreateSettingsForFixture()); ASSERT_TRUE(vm); } -TEST(DartVM, SimpleIsolateNameServer) { - Settings settings = {}; - settings.task_observer_add = [](intptr_t, fml::closure) {}; - settings.task_observer_remove = [](intptr_t) {}; - auto vm = DartVMRef::Create(settings); +TEST_F(DartVMTest, SimpleIsolateNameServer) { + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); + auto vm = DartVMRef::Create(CreateSettingsForFixture()); ASSERT_TRUE(vm); ASSERT_TRUE(vm.GetVMData()); auto ns = vm->GetIsolateNameServer(); @@ -32,4 +32,5 @@ TEST(DartVM, SimpleIsolateNameServer) { ASSERT_TRUE(ns->RemoveIsolateNameMapping("foobar")); } +} // namespace testing } // namespace flutter diff --git a/runtime/runtime_test.cc b/runtime/runtime_test.cc index 069ed1a30a056..6f56b2f743f26 100644 --- a/runtime/runtime_test.cc +++ b/runtime/runtime_test.cc @@ -80,6 +80,7 @@ void RuntimeTest::SetSnapshotsAndAssets(Settings& settings) { Settings RuntimeTest::CreateSettingsForFixture() { Settings settings; + settings.leak_vm = false; settings.task_observer_add = [](intptr_t, fml::closure) {}; settings.task_observer_remove = [](intptr_t) {}; settings.root_isolate_create_callback = [this]() { From 8b5a50c0df768743dd9858cceb92d1d1de44c35e Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 17 Apr 2019 19:42:33 -0700 Subject: [PATCH 0854/1117] Test saving compilation traces. (#8618) --- runtime/dart_isolate_unittests.cc | 25 +++++++++++++++++++++++++ runtime/fixtures/simple_main.dart | 15 ++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc index 1c77bc892acc0..eb12946e93511 100644 --- a/runtime/dart_isolate_unittests.cc +++ b/runtime/dart_isolate_unittests.cc @@ -13,6 +13,7 @@ #include "flutter/runtime/runtime_test.h" #include "flutter/testing/testing.h" #include "flutter/testing/thread_test.h" +#include "third_party/tonic/converter/dart_converter.h" #include "third_party/tonic/scopes/dart_isolate_scope.h" namespace flutter { @@ -320,5 +321,29 @@ TEST_F(DartIsolateTest, CanRegisterNativeCallback) { latch.Wait(); } +TEST_F(DartIsolateTest, CanSaveCompilationTrace) { + if (DartVM::IsRunningPrecompiledCode()) { + // Can only save compilation traces in JIT modes. + GTEST_SKIP(); + return; + } + fml::AutoResetWaitableEvent latch; + AddNativeCallback("NotifyNative", + CREATE_NATIVE_ENTRY(([&latch](Dart_NativeArguments args) { + ASSERT_TRUE(tonic::DartConverter::FromDart( + Dart_GetNativeArgument(args, 0))); + latch.Signal(); + }))); + + const auto settings = CreateSettingsForFixture(); + auto vm_ref = DartVMRef::Create(settings); + auto isolate = RunDartCodeInIsolate(vm_ref, settings, GetThreadTaskRunner(), + "testCanSaveCompilationTrace"); + ASSERT_TRUE(isolate); + ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running); + + latch.Wait(); +} + } // namespace testing } // namespace flutter diff --git a/runtime/fixtures/simple_main.dart b/runtime/fixtures/simple_main.dart index bc2d880ff1427..f9ba92d98f7fd 100644 --- a/runtime/fixtures/simple_main.dart +++ b/runtime/fixtures/simple_main.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. import 'dart:isolate'; +import 'dart:ui'; void main() { } @@ -26,6 +27,18 @@ void canRegisterNativeCallback() async { void NotifyNative() native "NotifyNative"; - @pragma('vm:entry-point') void testIsolateShutdown() { } + +@pragma('vm:entry-point') +void testCanSaveCompilationTrace() { + List trace = null; + try { + trace = saveCompilationTrace(); + } catch (exception) { + print("Could not save compilation trace: " + exception); + } + NotifyResult(trace != null && trace.length > 0); +} + +void NotifyResult(bool success) native "NotifyNative"; From 70068706d0ee3bc9847632c4d0e467fba49271f8 Mon Sep 17 00:00:00 2001 From: Joseph Richey Date: Wed, 17 Apr 2019 19:57:20 -0700 Subject: [PATCH 0855/1117] Allow building without python2 (#8605) Almost all of the python build files in the flutter project work if `python` is `python2` or `python3`. This is the only area where print is incorrectly used (for `python3`). Related issue: https://fuchsia-review.googlesource.com/c/fuchsia/+/272925 --- build/git_revision.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/git_revision.py b/build/git_revision.py index 29d62e796a347..3c16eb58e4a26 100755 --- a/build/git_revision.py +++ b/build/git_revision.py @@ -34,7 +34,7 @@ def main(): 'HEAD', ]) - print version.strip() + print (version.strip()) return 0 From 54f7c51339ae7d86a983b5850b14dafe4e2bd90a Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 18 Apr 2019 01:11:24 -0400 Subject: [PATCH 0856/1117] Roll src/third_party/skia 14c90c1ca218..ced2b79d00f9 (1 commits) (#8629) https://skia.googlesource.com/skia.git/%2Blog/14c90c1ca218..ced2b79d00f9 git log 14c90c1ca218428418b82be5684bb71f13e81f60..ced2b79d00f9370cbd874d1462757b554655648f --date=short --no-merges --format=%ad %ae %s 2019-04-18 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src a3585f70a100..f968f64cdf27 (436 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4166659d099ec..9fb71128ddf0e 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': '14c90c1ca218428418b82be5684bb71f13e81f60', + 'skia_revision': 'ced2b79d00f9370cbd874d1462757b554655648f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 5e96446d74342..63b8df71f731e 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: d8a18a9fdd79e2059c52ee457cbff607 +Signature: a5750a77eae3e56f597c008bb9c039f5 UNUSED LICENSES: From 3e6dc02ad62ef9fa02660f5fb0bb114414e282d4 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 18 Apr 2019 04:41:24 -0400 Subject: [PATCH 0857/1117] Roll src/third_party/skia ced2b79d00f9..847d55be4e62 (3 commits) (#8630) https://skia.googlesource.com/skia.git/%2Blog/ced2b79d00f9..847d55be4e62 git log ced2b79d00f9370cbd874d1462757b554655648f..847d55be4e6273fc3cd9c0b30c7bfc8a2d6575b7 --date=short --no-merges --format=%ad %ae %s 2019-04-18 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-04-18 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 c832cdd75f75..82bcffa78747 (7 commits) 2019-04-18 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 84c3a94e1450..abaecd5f2ba7 (6 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 9fb71128ddf0e..0a094cd6e6875 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': 'ced2b79d00f9370cbd874d1462757b554655648f', + 'skia_revision': '847d55be4e6273fc3cd9c0b30c7bfc8a2d6575b7', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 63b8df71f731e..6be10a3bd18bd 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: a5750a77eae3e56f597c008bb9c039f5 +Signature: 1c665fa8b54bdf7301ff1ccfa0fc9522 UNUSED LICENSES: From b6787096a2d3d0365f03f4cfdb70b932e4e5bae3 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 18 Apr 2019 08:52:24 -0400 Subject: [PATCH 0858/1117] Roll src/third_party/skia 847d55be4e62..a94670bd08cd (1 commits) (#8631) https://skia.googlesource.com/skia.git/%2Blog/847d55be4e62..a94670bd08cd git log 847d55be4e6273fc3cd9c0b30c7bfc8a2d6575b7..a94670bd08cd52a19bf72223d63e2cc808b6b057 --date=short --no-merges --format=%ad %ae %s 2019-04-18 hcm@google.com Update Skia milestone to 76 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 0a094cd6e6875..7bd00ea15182b 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': '847d55be4e6273fc3cd9c0b30c7bfc8a2d6575b7', + 'skia_revision': 'a94670bd08cd52a19bf72223d63e2cc808b6b057', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6be10a3bd18bd..ac5e590f513a3 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 1c665fa8b54bdf7301ff1ccfa0fc9522 +Signature: 8f0bff62f9f3e433604132c82ff095c8 UNUSED LICENSES: From 06fea14e5800c35a4fc4dd10cc31b997f1be81e9 Mon Sep 17 00:00:00 2001 From: Justin McCandless Date: Thu, 18 Apr 2019 08:16:07 -0700 Subject: [PATCH 0859/1117] Glitchiness with Tab Characters (#8591) Fix a bug that caused jumping and flashing when entering tab characters into a TextField. --- third_party/txt/src/minikin/LineBreaker.cpp | 26 ++++++------------ third_party/txt/src/minikin/LineBreaker.h | 29 --------------------- 2 files changed, 8 insertions(+), 47 deletions(-) diff --git a/third_party/txt/src/minikin/LineBreaker.cpp b/third_party/txt/src/minikin/LineBreaker.cpp index adff2a1e7733b..7ecee7e2c1c27 100644 --- a/third_party/txt/src/minikin/LineBreaker.cpp +++ b/third_party/txt/src/minikin/LineBreaker.cpp @@ -32,8 +32,6 @@ using std::vector; namespace minikin { -const int CHAR_TAB = 0x0009; - // Large scores in a hierarchy; we prefer desperate breaks to an overfull line. // All these constants are larger than any reasonable actual width score. const float SCORE_INFTY = std::numeric_limits::max(); @@ -159,22 +157,14 @@ float LineBreaker::addStyleRun(MinikinPaint* paint, size_t postSpaceCount = mSpaceCount; for (size_t i = start; i < end; i++) { uint16_t c = mTextBuf[i]; - if (c == CHAR_TAB) { - mWidth = mPreBreak + mTabStops.nextTab(mWidth - mPreBreak); - if (mFirstTabIndex == INT_MAX) { - mFirstTabIndex = (int)i; - } - // fall back to greedy; other modes don't know how to deal with tabs - mStrategy = kBreakStrategy_Greedy; - } else { - if (isWordSpace(c)) - mSpaceCount += 1; - mWidth += mCharWidths[i]; - if (!isLineEndSpace(c)) { - postBreak = mWidth; - postSpaceCount = mSpaceCount; - afterWord = i + 1; - } + // libtxt: Tab handling was removed here. + if (isWordSpace(c)) + mSpaceCount += 1; + mWidth += mCharWidths[i]; + if (!isLineEndSpace(c)) { + postBreak = mWidth; + postSpaceCount = mSpaceCount; + afterWord = i + 1; } if (i + 1 == current) { size_t wordStart = mWordBreaker.wordStart(); diff --git a/third_party/txt/src/minikin/LineBreaker.h b/third_party/txt/src/minikin/LineBreaker.h index 4789850bb92fe..1dc88e1f1d7ce 100644 --- a/third_party/txt/src/minikin/LineBreaker.h +++ b/third_party/txt/src/minikin/LineBreaker.h @@ -85,30 +85,6 @@ class LineWidths { std::vector mIndents; }; -class TabStops { - public: - void set(const int* stops, size_t nStops, int tabWidth) { - if (stops != nullptr) { - mStops.assign(stops, stops + nStops); - } else { - mStops.clear(); - } - mTabWidth = tabWidth; - } - float nextTab(float widthSoFar) const { - for (size_t i = 0; i < mStops.size(); i++) { - if (mStops[i] > widthSoFar) { - return mStops[i]; - } - } - return floor(widthSoFar / mTabWidth + 1) * mTabWidth; - } - - private: - std::vector mStops; - int mTabWidth; -}; - class LineBreaker { public: const static int kTab_Shift = @@ -143,10 +119,6 @@ class LineBreaker { void setIndents(const std::vector& indents); - void setTabStops(const int* stops, size_t nStops, int tabWidth) { - mTabStops.set(stops, nStops, tabWidth); - } - BreakStrategy getStrategy() const { return mStrategy; } void setStrategy(BreakStrategy strategy) { mStrategy = strategy; } @@ -246,7 +218,6 @@ class LineBreaker { HyphenationFrequency mHyphenationFrequency = kHyphenationFrequency_Normal; bool mJustified; LineWidths mLineWidths; - TabStops mTabStops; // result of line breaking std::vector mBreaks; From a144f17aeede2c4d139e3d7f43451a4e70b4e214 Mon Sep 17 00:00:00 2001 From: Justin McCandless Date: Thu, 18 Apr 2019 09:08:41 -0700 Subject: [PATCH 0860/1117] Tight Paragraph Width (#8530) Calculate and expose paragraph tightWidth to the framework to allow drawing Text based on this. --- lib/ui/text.dart | 6 +++++ lib/ui/text/paragraph.cc | 5 ++++ lib/ui/text/paragraph.h | 1 + lib/ui/text/paragraph_impl.h | 2 ++ lib/ui/text/paragraph_impl_txt.cc | 4 ++++ lib/ui/text/paragraph_impl_txt.h | 1 + third_party/txt/src/txt/paragraph.cc | 6 +++++ third_party/txt/src/txt/paragraph.h | 7 ++++++ third_party/txt/tests/paragraph_unittests.cc | 24 +++++++++++++++++++- 9 files changed, 55 insertions(+), 1 deletion(-) diff --git a/lib/ui/text.dart b/lib/ui/text.dart index 87bb557163165..4475551922a9c 100644 --- a/lib/ui/text.dart +++ b/lib/ui/text.dart @@ -1315,6 +1315,12 @@ class Paragraph extends NativeFieldWrapperClass2 { /// Valid only after [layout] has been called. double get height native 'Paragraph_height'; + /// The distance from the left edge of the leftmost glyph to the right edge of + /// the rightmost glyph in the paragraph. + /// + /// Valid only after [layout] has been called. + double get tightWidth native 'Paragraph_tightWidth'; + /// The minimum width that this paragraph could be without failing to paint /// its contents within itself. /// diff --git a/lib/ui/text/paragraph.cc b/lib/ui/text/paragraph.cc index 8d776076077d3..fd517d58073b4 100644 --- a/lib/ui/text/paragraph.cc +++ b/lib/ui/text/paragraph.cc @@ -22,6 +22,7 @@ IMPLEMENT_WRAPPERTYPEINFO(ui, Paragraph); #define FOR_EACH_BINDING(V) \ V(Paragraph, width) \ V(Paragraph, height) \ + V(Paragraph, tightWidth) \ V(Paragraph, minIntrinsicWidth) \ V(Paragraph, maxIntrinsicWidth) \ V(Paragraph, alphabeticBaseline) \ @@ -56,6 +57,10 @@ double Paragraph::height() { return m_paragraphImpl->height(); } +double Paragraph::tightWidth() { + return m_paragraphImpl->tightWidth(); +} + double Paragraph::minIntrinsicWidth() { return m_paragraphImpl->minIntrinsicWidth(); } diff --git a/lib/ui/text/paragraph.h b/lib/ui/text/paragraph.h index a96f6fdfeff56..a348cdf674ccf 100644 --- a/lib/ui/text/paragraph.h +++ b/lib/ui/text/paragraph.h @@ -33,6 +33,7 @@ class Paragraph : public RefCountedDartWrappable { double width(); double height(); + double tightWidth(); double minIntrinsicWidth(); double maxIntrinsicWidth(); double alphabeticBaseline(); diff --git a/lib/ui/text/paragraph_impl.h b/lib/ui/text/paragraph_impl.h index 357fbd3dffdbc..f81cb36d39aa1 100644 --- a/lib/ui/text/paragraph_impl.h +++ b/lib/ui/text/paragraph_impl.h @@ -19,6 +19,8 @@ class ParagraphImpl { virtual double height() = 0; + virtual double tightWidth() = 0; + virtual double minIntrinsicWidth() = 0; virtual double maxIntrinsicWidth() = 0; diff --git a/lib/ui/text/paragraph_impl_txt.cc b/lib/ui/text/paragraph_impl_txt.cc index a875cd9a51a60..e488f38f334d5 100644 --- a/lib/ui/text/paragraph_impl_txt.cc +++ b/lib/ui/text/paragraph_impl_txt.cc @@ -29,6 +29,10 @@ double ParagraphImplTxt::height() { return m_paragraph->GetHeight(); } +double ParagraphImplTxt::tightWidth() { + return m_paragraph->GetTightWidth(); +} + double ParagraphImplTxt::minIntrinsicWidth() { return m_paragraph->GetMinIntrinsicWidth(); } diff --git a/lib/ui/text/paragraph_impl_txt.h b/lib/ui/text/paragraph_impl_txt.h index ad44d7235b052..53479a45a3884 100644 --- a/lib/ui/text/paragraph_impl_txt.h +++ b/lib/ui/text/paragraph_impl_txt.h @@ -19,6 +19,7 @@ class ParagraphImplTxt : public ParagraphImpl { double width() override; double height() override; + double tightWidth() override; double minIntrinsicWidth() override; double maxIntrinsicWidth() override; double alphabeticBaseline() override; diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index 2e84f6fe49a6a..393b28be4f331 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -919,6 +919,8 @@ void Paragraph::Layout(double width, bool force) { [](const CodeUnitRun& a, const CodeUnitRun& b) { return a.code_units.start < b.code_units.start; }); + + tight_width_ = max_right_ - min_left_; } double Paragraph::GetLineXOffset(double line_total_advance) { @@ -970,6 +972,10 @@ double Paragraph::GetMaxWidth() const { return width_; } +double Paragraph::GetTightWidth() const { + return tight_width_; +} + void Paragraph::SetParagraphStyle(const ParagraphStyle& style) { needs_layout_ = true; paragraph_style_ = style; diff --git a/third_party/txt/src/txt/paragraph.h b/third_party/txt/src/txt/paragraph.h index 0518bac03326a..c537871451a45 100644 --- a/third_party/txt/src/txt/paragraph.h +++ b/third_party/txt/src/txt/paragraph.h @@ -155,6 +155,12 @@ class Paragraph { // GetMaxWidth() >= GetLayoutWidth(). double GetMaxWidth() const; + // Returns the tight width found in Layout(), which is defined as the + // horizontal distance from the left edge of the leftmost glyph to the right + // edge of the rightmost glyph. We expect that GetTightWidth() <= + // GetMaxWidth(). + double GetTightWidth() const; + // Distance from top of paragraph to the Alphabetic baseline of the first // line. Used for alphabetic fonts (A-Z, a-z, greek, etc.) double GetAlphabeticBaseline() const; @@ -348,6 +354,7 @@ class Paragraph { // The max width of the paragraph as provided in the most recent Layout() // call. double width_ = -1.0f; + double tight_width_ = -1.0f; double max_intrinsic_width_ = 0; double min_intrinsic_width_ = 0; double alphabetic_baseline_ = FLT_MAX; diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index 62f984af8c6b3..bab5430abc4b3 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -264,6 +264,19 @@ TEST_F(ParagraphTest, BoldParagraph) { ASSERT_TRUE(paragraph->runs_.styles_[1].equals(text_style)); ASSERT_EQ(paragraph->records_[0].style().color, text_style.color); ASSERT_TRUE(Snapshot()); + + // width_ takes the full available space, but tight_width_ is only the width + // of the text, which is less than one line. + ASSERT_DOUBLE_EQ(paragraph->width_, GetTestCanvasWidth()); + ASSERT_TRUE(paragraph->tight_width_ < paragraph->width_); + Paragraph::RectHeightStyle rect_height_style = + Paragraph::RectHeightStyle::kMax; + Paragraph::RectWidthStyle rect_width_style = + Paragraph::RectWidthStyle::kTight; + std::vector boxes = paragraph->GetRectsForRange( + 0, strlen(text), rect_height_style, rect_width_style); + ASSERT_DOUBLE_EQ(paragraph->tight_width_, + boxes[boxes.size() - 1].rect.right() - boxes[0].rect.left()); } TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(LeftAlignParagraph)) { @@ -407,7 +420,8 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(RightAlignParagraph)) { builder.Pop(); auto paragraph = builder.Build(); - paragraph->Layout(GetTestCanvasWidth() - 100); + int available_width = GetTestCanvasWidth() - 100; + paragraph->Layout(available_width); paragraph->Paint(GetCanvas(), 0, 0); @@ -432,6 +446,14 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(RightAlignParagraph)) { paragraph->breaker_.getWidths()[paragraph->records_[0].line()], 2.0); + // width_ takes the full available space, while tight_width_ wraps the glyphs + // as tightly as possible. Even though this text is more than one line long, + // no line perfectly spans the width of the full line, so tight_width_ is less + // than width_. + ASSERT_DOUBLE_EQ(paragraph->width_, available_width); + ASSERT_TRUE(paragraph->tight_width_ < available_width); + ASSERT_DOUBLE_EQ(paragraph->tight_width_, 893.19921875); + ASSERT_TRUE(paragraph->records_[2].style().equals(text_style)); ASSERT_DOUBLE_EQ(paragraph->records_[2].offset().y(), expected_y); expected_y += 30; From 60bb866ceb71d66db24a183547ff7c14cb5fa312 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 18 Apr 2019 12:24:24 -0400 Subject: [PATCH 0861/1117] Roll src/third_party/skia a94670bd08cd..2c2240f66805 (2 commits) (#8632) https://skia.googlesource.com/skia.git/%2Blog/a94670bd08cd..2c2240f66805 git log a94670bd08cd52a19bf72223d63e2cc808b6b057..2c2240f66805ac852507f7eea010c153b42485e3 --date=short --no-merges --format=%ad %ae %s 2019-04-17 bungeman@google.com Make more SkTypeface virtuals pure. 2019-04-18 borenet@google.com [infra] Fixes for chrome_release_branch The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 7bd00ea15182b..74b16cc3d85fc 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': 'a94670bd08cd52a19bf72223d63e2cc808b6b057', + 'skia_revision': '2c2240f66805ac852507f7eea010c153b42485e3', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index ac5e590f513a3..2f6fb28c8539d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8f0bff62f9f3e433604132c82ff095c8 +Signature: cfb77cf37f6efc85c500050d0c6ff422 UNUSED LICENSES: From 4b9966f5cb412a73fa50462b3aee9082f436a62a Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 18 Apr 2019 09:44:22 -0700 Subject: [PATCH 0862/1117] Add an adjustment to the line width check in LineBreaker::addWordBreak (#8623) currentLineWidth is the width passed into Paragraph layout, which comes from the maxIntrinsicWidth returned by a previous call to Paragraph layout. That width is calculated by Layout::measureText. postBreak is calculated from the character widths in the LineBreaker. A slight mismatch between these two widths may unnecessarily cause the insertion of desperate breaks in addWordBreak. Adding some slack to currentLineWidth works around this. Fixes https://github.com/flutter/flutter/issues/30347 --- third_party/txt/src/minikin/LineBreaker.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/third_party/txt/src/minikin/LineBreaker.cpp b/third_party/txt/src/minikin/LineBreaker.cpp index 7ecee7e2c1c27..35f7d9da2bdc3 100644 --- a/third_party/txt/src/minikin/LineBreaker.cpp +++ b/third_party/txt/src/minikin/LineBreaker.cpp @@ -238,7 +238,10 @@ void LineBreaker::addWordBreak(size_t offset, HyphenationType hyph) { Candidate cand; ParaWidth width = mCandidates.back().preBreak; - if (postBreak - width > currentLineWidth()) { + // libtxt: add a fudge factor to this comparison. The currentLineWidth passed + // by the framework is based on maxIntrinsicWidth/Layout::measureText + // calculations that may not precisely match the postBreak width. + if (postBreak - width > currentLineWidth() + 0.00001) { // Add desperate breaks. // Note: these breaks are based on the shaping of the (non-broken) original // text; they are imprecise especially in the presence of kerning, From edef8bb8b3a3ce81fc46a83602202436beca121e Mon Sep 17 00:00:00 2001 From: liyuqian Date: Thu, 18 Apr 2019 10:56:24 -0700 Subject: [PATCH 0863/1117] Reland elevation test (#8633) Reland "Add a unit test for PhysicalShapeLayer (#8616)" This reverts commit 91b71070f55ffc38c432babc7d9bb68ac2720d8d. The only change is the namespace. --- ci/licenses_golden/licenses_flutter | 1 + flow/BUILD.gn | 1 + flow/layers/container_layer.cc | 3 +- flow/layers/physical_shape_layer.cc | 1 + flow/layers/physical_shape_layer.h | 2 + flow/layers/physical_shape_layer_unittests.cc | 60 +++++++++++++++++++ 6 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 flow/layers/physical_shape_layer_unittests.cc diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 4f82601d8ffe8..265dca257bf06 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -89,6 +89,7 @@ FILE: ../../../flutter/flow/layers/performance_overlay_layer.h FILE: ../../../flutter/flow/layers/performance_overlay_layer_unittests.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.cc FILE: ../../../flutter/flow/layers/physical_shape_layer.h +FILE: ../../../flutter/flow/layers/physical_shape_layer_unittests.cc FILE: ../../../flutter/flow/layers/picture_layer.cc FILE: ../../../flutter/flow/layers/picture_layer.h FILE: ../../../flutter/flow/layers/platform_view_layer.cc diff --git a/flow/BUILD.gn b/flow/BUILD.gn index 756861f5e79ff..42e431fe057c3 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -98,6 +98,7 @@ executable("flow_unittests") { "flow_test_utils.cc", "flow_test_utils.h", "layers/performance_overlay_layer_unittests.cc", + "layers/physical_shape_layer_unittests.cc", "matrix_decomposition_unittests.cc", "raster_cache_unittests.cc", ] diff --git a/flow/layers/container_layer.cc b/flow/layers/container_layer.cc index 40d600e1c3e08..31a5a255afca9 100644 --- a/flow/layers/container_layer.cc +++ b/flow/layers/container_layer.cc @@ -27,8 +27,7 @@ void ContainerLayer::PrerollChildren(PrerollContext* context, const SkMatrix& child_matrix, SkRect* child_paint_bounds) { for (auto& layer : layers_) { - PrerollContext child_context = *context; - layer->Preroll(&child_context, child_matrix); + layer->Preroll(context, child_matrix); if (layer->needs_system_composite()) { set_needs_system_composite(true); diff --git a/flow/layers/physical_shape_layer.cc b/flow/layers/physical_shape_layer.cc index 2bf45ea763052..c80ca75873d38 100644 --- a/flow/layers/physical_shape_layer.cc +++ b/flow/layers/physical_shape_layer.cc @@ -47,6 +47,7 @@ void PhysicalShapeLayer::Preroll(PrerollContext* context, total_elevation_ = context->total_elevation; SkRect child_paint_bounds; PrerollChildren(context, matrix, &child_paint_bounds); + context->total_elevation -= elevation_; if (elevation_ == 0) { set_paint_bounds(path_.getBounds()); diff --git a/flow/layers/physical_shape_layer.h b/flow/layers/physical_shape_layer.h index e345102ba6589..edfbd410c2851 100644 --- a/flow/layers/physical_shape_layer.h +++ b/flow/layers/physical_shape_layer.h @@ -52,6 +52,8 @@ class PhysicalShapeLayer : public ContainerLayer { bool isRect_; SkRRect frameRRect_; Clip clip_behavior_; + + friend class PhysicalShapeLayer_TotalElevation_Test; }; } // namespace flutter diff --git a/flow/layers/physical_shape_layer_unittests.cc b/flow/layers/physical_shape_layer_unittests.cc new file mode 100644 index 0000000000000..6dd6c97094899 --- /dev/null +++ b/flow/layers/physical_shape_layer_unittests.cc @@ -0,0 +1,60 @@ +// Copyright 2013 The Flutter 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/physical_shape_layer.h" + +#include "gtest/gtest.h" + +namespace flutter { + +TEST(PhysicalShapeLayer, TotalElevation) { + std::shared_ptr layers[4]; + + for (int i = 0; i < 4; i += 1) { + layers[i] = std::make_shared(Clip::none); + layers[i]->set_elevation((float)(i + 1)); + } + + layers[0]->Add(layers[1]); + layers[0]->Add(layers[2]); + layers[2]->Add(layers[3]); + + const Stopwatch unused_stopwatch; + TextureRegistry unused_texture_registry; + 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 + kGiantRect, // SkRect cull_rect + unused_stopwatch, // frame time (dont care) + unused_stopwatch, // engine time (dont care) + unused_texture_registry, // texture registry (not supported) + false, // checkerboard_offscreen_layers + 0.0f, // total elevation + }; + + SkMatrix identity; + identity.setIdentity(); + + layers[0]->Preroll(&preroll_context, identity); + + // It should look like this: + // layers[0] +1.0f + // | \ + // | \ + // | \ + // | layers[2] +3.0f + // | | + // | layers[3] +4.0f + // | + // | + // layers[1] + 2.0f + EXPECT_EQ(layers[0]->total_elevation_, 1.0f); + EXPECT_EQ(layers[1]->total_elevation_, 3.0f); + EXPECT_EQ(layers[2]->total_elevation_, 4.0f); + EXPECT_EQ(layers[3]->total_elevation_, 8.0f); +} + +} // namespace flutter From 57f8abb73f430636697225bfde3e555112c7fad2 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 18 Apr 2019 11:32:33 -0700 Subject: [PATCH 0864/1117] Avoid leaking the VM in the shell unittests and assert VM state in existing tests. (#8628) --- shell/common/shell_test.cc | 1 + shell/common/shell_unittests.cc | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/shell/common/shell_test.cc b/shell/common/shell_test.cc index d1dc5c406c856..9a9c16db41239 100644 --- a/shell/common/shell_test.cc +++ b/shell/common/shell_test.cc @@ -83,6 +83,7 @@ void ShellTest::SetSnapshotsAndAssets(Settings& settings) { Settings ShellTest::CreateSettingsForFixture() { Settings settings; + settings.leak_vm = false; settings.task_observer_add = [](intptr_t key, fml::closure handler) { fml::MessageLoop::GetCurrent().AddTaskObserver(key, handler); }; diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc index e4ba61e2b8ebb..9def5530306f3 100644 --- a/shell/common/shell_unittests.cc +++ b/shell/common/shell_unittests.cc @@ -83,6 +83,7 @@ static bool ValidateShell(Shell* shell) { } TEST_F(ShellTest, InitializeWithInvalidThreads) { + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); Settings settings = CreateSettingsForFixture(); TaskRunners task_runners("test", nullptr, nullptr, nullptr, nullptr); auto shell = Shell::Create( @@ -95,9 +96,11 @@ TEST_F(ShellTest, InitializeWithInvalidThreads) { return std::make_unique(shell.GetTaskRunners()); }); ASSERT_FALSE(shell); + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); } TEST_F(ShellTest, InitializeWithDifferentThreads) { + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( "io.flutter.test." + ::testing::GetCurrentTestName() + ".", @@ -117,9 +120,13 @@ TEST_F(ShellTest, InitializeWithDifferentThreads) { return std::make_unique(shell.GetTaskRunners()); }); ASSERT_TRUE(ValidateShell(shell.get())); + ASSERT_TRUE(DartVMRef::IsInstanceRunning()); + shell.reset(); + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); } TEST_F(ShellTest, InitializeWithSingleThread) { + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( "io.flutter.test." + ::testing::GetCurrentTestName() + ".", @@ -136,10 +143,14 @@ TEST_F(ShellTest, InitializeWithSingleThread) { [](Shell& shell) { return std::make_unique(shell.GetTaskRunners()); }); + ASSERT_TRUE(DartVMRef::IsInstanceRunning()); ASSERT_TRUE(ValidateShell(shell.get())); + shell.reset(); + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); } TEST_F(ShellTest, InitializeWithSingleThreadWhichIsTheCallingThread) { + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); Settings settings = CreateSettingsForFixture(); fml::MessageLoop::EnsureInitializedForCurrentThread(); auto task_runner = fml::MessageLoop::GetCurrent().GetTaskRunner(); @@ -155,10 +166,14 @@ TEST_F(ShellTest, InitializeWithSingleThreadWhichIsTheCallingThread) { return std::make_unique(shell.GetTaskRunners()); }); ASSERT_TRUE(ValidateShell(shell.get())); + ASSERT_TRUE(DartVMRef::IsInstanceRunning()); + shell.reset(); + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); } TEST_F(ShellTest, InitializeWithMultipleThreadButCallingThreadAsPlatformThread) { + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( "io.flutter.test." + ::testing::GetCurrentTestName() + ".", @@ -179,9 +194,13 @@ TEST_F(ShellTest, return std::make_unique(shell.GetTaskRunners()); }); ASSERT_TRUE(ValidateShell(shell.get())); + ASSERT_TRUE(DartVMRef::IsInstanceRunning()); + shell.reset(); + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); } TEST_F(ShellTest, InitializeWithGPUAndPlatformThreadsTheSame) { + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( "io.flutter.test." + ::testing::GetCurrentTestName() + ".", @@ -202,10 +221,14 @@ TEST_F(ShellTest, InitializeWithGPUAndPlatformThreadsTheSame) { [](Shell& shell) { return std::make_unique(shell.GetTaskRunners()); }); + ASSERT_TRUE(DartVMRef::IsInstanceRunning()); ASSERT_TRUE(ValidateShell(shell.get())); + shell.reset(); + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); } TEST_F(ShellTest, FixturesAreFunctional) { + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); const auto settings = CreateSettingsForFixture(); auto shell = Shell::Create( GetTaskRunnersForFixture(), settings, @@ -239,6 +262,9 @@ TEST_F(ShellTest, FixturesAreFunctional) { latch.Wait(); main_latch.Wait(); + ASSERT_TRUE(DartVMRef::IsInstanceRunning()); + shell.reset(); + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); } } // namespace testing From 763bbca0ccc0e40f3cc5081afa094b5e89e0db47 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 18 Apr 2019 12:12:29 -0700 Subject: [PATCH 0865/1117] Add support for authentication codes via MDNS on iOS (#8625) --- .../Source/FlutterObservatoryPublisher.mm | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm index 4c86ec7b991f8..38c92fa1ce287 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm @@ -98,6 +98,19 @@ - (void)publishServiceProtocolPort:(std::string)uri { NSString* serviceName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"]; + // Check to see if there's an authentication code. If there is, we'll provide + // it as a txt record so flutter tools can establish a connection. + auto path = std::string{[[url path] UTF8String]}; + if (!path.empty()) { + // Remove leading "/" + path = path.substr(1); + } + NSData* pathData = [[[NSData alloc] initWithBytes:path.c_str() length:path.length()] autorelease]; + NSDictionary* txtDict = @{ + @"authCode" : pathData, + }; + NSData* txtData = [NSNetService dataFromTXTRecordDictionary:txtDict]; + #if TARGET_IPHONE_SIMULATOR DNSServiceFlags flags = kDNSServiceFlagsDefault; uint32_t interfaceIndex = if_nametoindex("lo0"); @@ -106,8 +119,8 @@ - (void)publishServiceProtocolPort:(std::string)uri { uint16_t port = [[url port] intValue]; int err = DNSServiceRegister(&_dnsServiceRef, flags, interfaceIndex, [serviceName UTF8String], - registrationType, domain, NULL, htons(port), 0, NULL, - registrationCallback, NULL); + registrationType, domain, NULL, htons(port), txtData.length, + txtData.bytes, registrationCallback, NULL); if (err != 0) { FML_LOG(ERROR) << "Failed to register observatory port with mDNS."; @@ -115,10 +128,12 @@ - (void)publishServiceProtocolPort:(std::string)uri { 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]]); + NSNetService* netServiceTmp = [[NSNetService alloc] initWithDomain:@"local." + type:@"_dartobservatory._tcp." + name:serviceName + port:[[url port] intValue]]; + [netServiceTmp setTXTRecordData:txtData]; + _netService.reset(netServiceTmp); [_netService.get() setDelegate:self]; [_netService.get() publish]; #endif // TARGET_IPHONE_SIMULATOR From c6400e2c252f7eb7617b922a0f54a5f19cbbd19e Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 18 Apr 2019 12:15:45 -0700 Subject: [PATCH 0866/1117] Merge runtime lifecycle unittests into the base test target. (#8634) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `//flutter/runtime: runtime_lifecycle_unittests` was added because the these assumed that there was no VM already running in the process. Running other tests in the base target would mess up that assumption. Now that all test targets have been updated to make sure the VM instance does not leak, the tests in this target can be merged. LUCI bots don’t need to be patched as these tests were only ever run on the trybots. --- BUILD.gn | 1 - runtime/BUILD.gn | 17 +---------------- testing/run_tests.sh | 3 --- 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index a3c33e6fef6ce..1ae4a19c64803 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -47,7 +47,6 @@ group("flutter") { public_deps += [ "$flutter_root/flow:flow_unittests", "$flutter_root/fml:fml_unittests", - "$flutter_root/runtime:runtime_lifecycle_unittests", "$flutter_root/runtime:runtime_unittests", "$flutter_root/shell/common:shell_unittests", "$flutter_root/shell/platform/common/cpp/client_wrapper:client_wrapper_unittests", diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index 4ae61ac3b46e0..9d6f0d80ea623 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -130,6 +130,7 @@ executable("runtime_unittests") { sources = [ "dart_isolate_unittests.cc", + "dart_lifecycle_unittests.cc", "dart_service_isolate_unittests.cc", "dart_vm_unittests.cc", ] @@ -142,19 +143,3 @@ executable("runtime_unittests") { ldflags = [ "-rdynamic" ] } } - -executable("runtime_lifecycle_unittests") { - testonly = true - - sources = [ - "dart_lifecycle_unittests.cc", - ] - - deps = [ - ":runtime_unittests_common", - ] - - if (is_linux) { - ldflags = [ "-rdynamic" ] - } -} diff --git a/testing/run_tests.sh b/testing/run_tests.sh index 87f68897055ea..621743aa809cc 100755 --- a/testing/run_tests.sh +++ b/testing/run_tests.sh @@ -35,9 +35,6 @@ echo "Running fml_unittests..." echo "Running runtime_unittests..." "$HOST_DIR/runtime_unittests" -echo "Running runtime_lifecycle_unittests..." -"$HOST_DIR/runtime_lifecycle_unittests" - echo "Running shell_unittests..." "$HOST_DIR/shell_unittests" From c3bc5d8dc7a337997dd79fcd08d67bb9b8e61e2d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 18 Apr 2019 15:51:24 -0400 Subject: [PATCH 0867/1117] Roll src/third_party/skia 2c2240f66805..067861e14821 (6 commits) (#8636) https://skia.googlesource.com/skia.git/%2Blog/2c2240f66805..067861e14821 git log 2c2240f66805ac852507f7eea010c153b42485e3..067861e1482118dd7071c931a90127c5ca0c9b21 --date=short --no-merges --format=%ad %ae %s 2019-04-18 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-04-18 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-04-18 reed@google.com remove experimental from some APIs (that are no longer experiments) 2019-04-18 michaelludwig@google.com Fix quad type detection from SkPoint array 2019-04-18 brianosman@google.com Remove the axis-aligned vector special case to convexity checker 2019-04-18 ethannicholas@google.com fixed assertion failure in skslc SPIR-V output The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 74b16cc3d85fc..f7904eb653771 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': '2c2240f66805ac852507f7eea010c153b42485e3', + 'skia_revision': '067861e1482118dd7071c931a90127c5ca0c9b21', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2f6fb28c8539d..cc8172a1aa78a 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: cfb77cf37f6efc85c500050d0c6ff422 +Signature: 69e8aeb209ca2d1f280e0b5fef4a35cb UNUSED LICENSES: From d79eb2857d6f08598e6761f56a73e082839c2481 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Thu, 18 Apr 2019 14:14:06 -0700 Subject: [PATCH 0868/1117] Generate layer unique id for raster cache key (#8637) The raw pointer isn't a reliable id as the allocator can reuse an address that's just been released for another layer. This will fix Fuchsia bug FL-216. This problem was not affecting non-Fuchsia Flutter probably because non-Fuchsia Flutter purges the raster cache key much more frequently so we won't see a key collision. In Fuchsia, as the key has to wait for the Vulkan surface to render asynchronously, this suddenly becomes an issue. --- flow/layers/layer.cc | 12 +++++++++++- flow/layers/layer.h | 5 +++++ flow/layers/physical_shape_layer.cc | 2 +- flow/raster_cache.cc | 4 ++-- flow/raster_cache_key.h | 3 ++- flow/scene_update_context.cc | 9 ++++++--- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/flow/layers/layer.cc b/flow/layers/layer.cc index 45f1a08bcd094..b729f582a0a9a 100644 --- a/flow/layers/layer.cc +++ b/flow/layers/layer.cc @@ -12,10 +12,20 @@ namespace flutter { Layer::Layer() : parent_(nullptr), needs_system_composite_(false), - paint_bounds_(SkRect::MakeEmpty()) {} + paint_bounds_(SkRect::MakeEmpty()), + unique_id_(NextUniqueID()) {} Layer::~Layer() = default; +uint64_t Layer::NextUniqueID() { + static std::atomic nextID(1); + uint64_t id; + do { + id = nextID.fetch_add(1); + } while (id == 0); // 0 is reserved for an invalid id. + return id; +} + void Layer::Preroll(PrerollContext* context, const SkMatrix& matrix) {} #if defined(OS_FUCHSIA) diff --git a/flow/layers/layer.h b/flow/layers/layer.h index 1880ff064e7ca..095251608f7ad 100644 --- a/flow/layers/layer.h +++ b/flow/layers/layer.h @@ -143,10 +143,15 @@ class Layer { bool needs_painting() const { return !paint_bounds_.isEmpty(); } + uint64_t unique_id() const { return unique_id_; } + private: ContainerLayer* parent_; bool needs_system_composite_; SkRect paint_bounds_; + uint64_t unique_id_; + + static uint64_t NextUniqueID(); FML_DISALLOW_COPY_AND_ASSIGN(Layer); }; diff --git a/flow/layers/physical_shape_layer.cc b/flow/layers/physical_shape_layer.cc index c80ca75873d38..60902ea75ae4d 100644 --- a/flow/layers/physical_shape_layer.cc +++ b/flow/layers/physical_shape_layer.cc @@ -110,7 +110,7 @@ void PhysicalShapeLayer::UpdateScene(SceneUpdateContext& context) { // Retained rendering: speedup by reusing a retained entity node if possible. // When an entity node is reused, no paint layer is added to the frame so we // won't call PhysicalShapeLayer::Paint. - LayerRasterCacheKey key(this, context.Matrix()); + LayerRasterCacheKey key(unique_id(), context.Matrix()); if (context.HasRetainedNode(key)) { const scenic::EntityNode& retained_node = context.GetRetainedNode(key); FML_DCHECK(context.top_entity()); diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index 2cd03473f0d74..4689c21cf711a 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -151,7 +151,7 @@ static inline size_t ClampSize(size_t value, size_t min, size_t max) { void RasterCache::Prepare(PrerollContext* context, Layer* layer, const SkMatrix& ctm) { - LayerRasterCacheKey cache_key(layer, ctm); + LayerRasterCacheKey cache_key(layer->unique_id(), ctm); Entry& entry = layer_cache_[cache_key]; entry.access_count = ClampSize(entry.access_count + 1, 0, access_threshold_); entry.used_this_frame = true; @@ -230,7 +230,7 @@ RasterCacheResult RasterCache::Get(const SkPicture& picture, } RasterCacheResult RasterCache::Get(Layer* layer, const SkMatrix& ctm) const { - LayerRasterCacheKey cache_key(layer, ctm); + LayerRasterCacheKey cache_key(layer->unique_id(), ctm); auto it = layer_cache_.find(cache_key); return it == layer_cache_.end() ? RasterCacheResult() : it->second.image; } diff --git a/flow/raster_cache_key.h b/flow/raster_cache_key.h index a64cabe182076..5eae4d3dccacb 100644 --- a/flow/raster_cache_key.h +++ b/flow/raster_cache_key.h @@ -56,7 +56,8 @@ using PictureRasterCacheKey = RasterCacheKey; class Layer; -using LayerRasterCacheKey = RasterCacheKey; +// The ID is the uint64_t layer unique_id +using LayerRasterCacheKey = RasterCacheKey; } // namespace flutter diff --git a/flow/scene_update_context.cc b/flow/scene_update_context.cc index d1d33450772e7..d351ad5c0e3c1 100644 --- a/flow/scene_update_context.cc +++ b/flow/scene_update_context.cc @@ -164,9 +164,12 @@ scenic::Image* SceneUpdateContext::GenerateImageIfNeeded( // Acquire a surface from the surface producer and register the paint tasks. std::unique_ptr surface = - surface_producer_->ProduceSurface(physical_size, - LayerRasterCacheKey(layer, Matrix()), - std::move(entity_node)); + surface_producer_->ProduceSurface( + physical_size, + LayerRasterCacheKey( + // Root frame has a nullptr layer + layer ? layer->unique_id() : 0, Matrix()), + std::move(entity_node)); if (!surface) { FML_LOG(ERROR) << "Could not acquire a surface from the surface producer " From 3e597e1de37df4f67f80adb22e3c62d3b25c8f6b Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 18 Apr 2019 14:17:25 -0700 Subject: [PATCH 0869/1117] Enable VM service authentication codes by default (#8594) --- shell/common/switches.cc | 6 ++---- shell/common/switches.h | 8 +++----- .../io/flutter/app/FlutterActivityDelegate.java | 4 ++-- .../io/flutter/embedding/engine/FlutterShellArgs.java | 10 ++++------ 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 6298772af988f..4d4ed1b86b628 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -166,12 +166,10 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { } } - // Enable need for authentication codes for VM service communication, if + // Disable need for authentication codes for VM service communication, if // specified. - // TODO(bkonyi): when authentication codes are enabled by default, change - // to 'DisableServiceAuthCodes' and un-negate. settings.disable_service_auth_codes = - !command_line.HasOption(FlagForSwitch(Switch::EnableServiceAuthCodes)); + command_line.HasOption(FlagForSwitch(Switch::DisableServiceAuthCodes)); // Checked mode overrides. settings.disable_dart_asserts = diff --git a/shell/common/switches.h b/shell/common/switches.h index b0ff32d9b45c1..7747c33bca44c 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -96,11 +96,9 @@ DEF_SWITCH(FlutterAssetsDir, "Path to the Flutter assets directory.") DEF_SWITCH(Help, "help", "Display this help text.") DEF_SWITCH(LogTag, "log-tag", "Tag associated with log messages.") -// TODO(bkonyi): when authentication codes are enabled by default, change -// to 'disable-service-auth-codes' instead of 'enable-service-auth-codes'. -DEF_SWITCH(EnableServiceAuthCodes, - "enable-service-auth-codes", - "Enable the requirement for authentication codes for communicating" +DEF_SWITCH(DisableServiceAuthCodes, + "disable-service-auth-codes", + "Disable the requirement for authentication codes for communicating" " with the VM service.") DEF_SWITCH(StartPaused, "start-paused", diff --git a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java index 7e4cb402eb02f..f7d56d289270f 100644 --- a/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java +++ b/shell/platform/android/io/flutter/app/FlutterActivityDelegate.java @@ -296,8 +296,8 @@ private static String[] getArgsFromIntent(Intent intent) { if (intent.getBooleanExtra("start-paused", false)) { args.add("--start-paused"); } - if (intent.getBooleanExtra("enable-service-auth-codes", false)) { - args.add("--enable-service-auth-codes"); + if (intent.getBooleanExtra("disable-service-auth-codes", false)) { + args.add("--disable-service-auth-codes"); } if (intent.getBooleanExtra("use-test-fonts", false)) { args.add("--use-test-fonts"); diff --git a/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java b/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java index 8a65a1430bb05..c2fab9f035b71 100644 --- a/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java +++ b/shell/platform/android/io/flutter/embedding/engine/FlutterShellArgs.java @@ -27,8 +27,8 @@ public class FlutterShellArgs { public static final String ARG_TRACE_STARTUP = "--trace-startup"; public static final String ARG_KEY_START_PAUSED = "start-paused"; public static final String ARG_START_PAUSED = "--start-paused"; - public static final String ARG_KEY_ENABLE_SERVICE_AUTH_CODES = "enable-service-auth-codes"; - public static final String ARG_ENABLE_SERVICE_AUTH_CODES = "--enable-service-auth-codes"; + public static final String ARG_KEY_DISABLE_SERVICE_AUTH_CODES = "disable-service-auth-codes"; + public static final String ARG_DISABLE_SERVICE_AUTH_CODES = "--disable-service-auth-codes"; public static final String ARG_KEY_USE_TEST_FONTS = "use-test-fonts"; public static final String ARG_USE_TEST_FONTS = "--use-test-fonts"; public static final String ARG_KEY_ENABLE_DART_PROFILING = "enable-dart-profiling"; @@ -58,10 +58,8 @@ public static FlutterShellArgs fromIntent(@NonNull Intent intent) { if (intent.getBooleanExtra(ARG_KEY_START_PAUSED, false)) { args.add(ARG_START_PAUSED); } - // TODO(bkonyi): when authentication codes are enabled by default, change - // to 'disable-service-auth-codes' instead of 'enable-service-auth-codes'. - if (intent.getBooleanExtra(ARG_KEY_ENABLE_SERVICE_AUTH_CODES, false)) { - args.add(ARG_ENABLE_SERVICE_AUTH_CODES); + if (intent.getBooleanExtra(ARG_KEY_DISABLE_SERVICE_AUTH_CODES, false)) { + args.add(ARG_DISABLE_SERVICE_AUTH_CODES); } if (intent.getBooleanExtra(ARG_KEY_USE_TEST_FONTS, false)) { args.add(ARG_USE_TEST_FONTS); From 905ddb6ca9f9dcb6b1a7cea67d502da094867623 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 18 Apr 2019 16:01:19 -0700 Subject: [PATCH 0870/1117] Remove DartSnapshotBuffer and dry up snapshot resolution logic. (#8640) Fixes https://github.com/flutter/flutter/issues/26782. --- ci/licenses_golden/licenses_flutter | 2 - fml/mapping.cc | 41 +++++ fml/mapping.h | 33 +++- runtime/BUILD.gn | 2 - runtime/dart_isolate.cc | 13 +- runtime/dart_snapshot.cc | 246 ++++++++++++---------------- runtime/dart_snapshot.h | 17 +- runtime/dart_snapshot_buffer.cc | 102 ------------ runtime/dart_snapshot_buffer.h | 45 ----- runtime/dart_vm.cc | 5 +- 10 files changed, 191 insertions(+), 315 deletions(-) delete mode 100644 runtime/dart_snapshot_buffer.cc delete mode 100644 runtime/dart_snapshot_buffer.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 265dca257bf06..a323d42e1aee1 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -383,8 +383,6 @@ 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 -FILE: ../../../flutter/runtime/dart_snapshot_buffer.h FILE: ../../../flutter/runtime/dart_vm.cc FILE: ../../../flutter/runtime/dart_vm.h FILE: ../../../flutter/runtime/dart_vm_data.cc diff --git a/fml/mapping.cc b/fml/mapping.cc index 11882b6662bbf..75ca1b396912d 100644 --- a/fml/mapping.cc +++ b/fml/mapping.cc @@ -4,12 +4,18 @@ #include "flutter/fml/mapping.h" +#include + namespace fml { +// FileMapping + uint8_t* FileMapping::GetMutableMapping() { return mutable_mapping_; } +// Data Mapping + DataMapping::DataMapping(std::vector data) : data_(std::move(data)) {} DataMapping::~DataMapping() = default; @@ -22,6 +28,8 @@ const uint8_t* DataMapping::GetMapping() const { return data_.data(); } +// NonOwnedMapping + size_t NonOwnedMapping::GetSize() const { return size_; } @@ -30,4 +38,37 @@ const uint8_t* NonOwnedMapping::GetMapping() const { return data_; } +// Symbol Mapping + +SymbolMapping::SymbolMapping(fml::RefPtr native_library, + const char* symbol_name) + : native_library_(std::move(native_library)) { + if (native_library_ && symbol_name != nullptr) { + mapping_ = native_library_->ResolveSymbol(symbol_name); + + if (mapping_ == nullptr) { + // Apparently, dart_bootstrap seems to account for the Mac behavior of + // requiring the underscore prefixed symbol name on non-Mac platforms as + // well. As a fallback, check the underscore prefixed variant of the + // symbol name and allow callers to not have handle this on a per platform + // toolchain quirk basis. + + std::stringstream underscore_symbol_name; + underscore_symbol_name << "_" << symbol_name; + mapping_ = + native_library_->ResolveSymbol(underscore_symbol_name.str().c_str()); + } + } +} + +SymbolMapping::~SymbolMapping() = default; + +size_t SymbolMapping::GetSize() const { + return 0; +} + +const uint8_t* SymbolMapping::GetMapping() const { + return mapping_; +} + } // namespace fml diff --git a/fml/mapping.h b/fml/mapping.h index 05894a5c219a4..f7e6bbd4231d6 100644 --- a/fml/mapping.h +++ b/fml/mapping.h @@ -13,6 +13,7 @@ #include "flutter/fml/build_config.h" #include "flutter/fml/file.h" #include "flutter/fml/macros.h" +#include "flutter/fml/native_library.h" #include "flutter/fml/unique_fd.h" namespace fml { @@ -31,7 +32,7 @@ class Mapping { FML_DISALLOW_COPY_AND_ASSIGN(Mapping); }; -class FileMapping : public Mapping { +class FileMapping final : public Mapping { public: enum class Protection { kRead, @@ -45,8 +46,10 @@ class FileMapping : public Mapping { ~FileMapping() override; + // |Mapping| size_t GetSize() const override; + // |Mapping| const uint8_t* GetMapping() const override; uint8_t* GetMutableMapping(); @@ -63,14 +66,16 @@ class FileMapping : public Mapping { FML_DISALLOW_COPY_AND_ASSIGN(FileMapping); }; -class DataMapping : public Mapping { +class DataMapping final : public Mapping { public: DataMapping(std::vector data); ~DataMapping() override; + // |Mapping| size_t GetSize() const override; + // |Mapping| const uint8_t* GetMapping() const override; private: @@ -79,13 +84,15 @@ class DataMapping : public Mapping { FML_DISALLOW_COPY_AND_ASSIGN(DataMapping); }; -class NonOwnedMapping : public Mapping { +class NonOwnedMapping final : public Mapping { public: NonOwnedMapping(const uint8_t* data, size_t size) : data_(data), size_(size) {} + // |Mapping| size_t GetSize() const override; + // |Mapping| const uint8_t* GetMapping() const override; private: @@ -95,6 +102,26 @@ class NonOwnedMapping : public Mapping { FML_DISALLOW_COPY_AND_ASSIGN(NonOwnedMapping); }; +class SymbolMapping final : public Mapping { + public: + SymbolMapping(fml::RefPtr native_library, + const char* symbol_name); + + ~SymbolMapping() override; + + // |Mapping| + size_t GetSize() const override; + + // |Mapping| + const uint8_t* GetMapping() const override; + + private: + fml::RefPtr native_library_; + const uint8_t* mapping_ = nullptr; + + FML_DISALLOW_COPY_AND_ASSIGN(SymbolMapping); +}; + } // namespace fml #endif // FLUTTER_FML_MAPPING_H_ diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index 9d6f0d80ea623..bcfd7e399d532 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -46,8 +46,6 @@ source_set("runtime") { "dart_service_isolate.h", "dart_snapshot.cc", "dart_snapshot.h", - "dart_snapshot_buffer.cc", - "dart_snapshot_buffer.h", "dart_vm.cc", "dart_vm.h", "dart_vm_data.cc", diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 20b7c960ee26e..8de6bca542c12 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -679,14 +679,11 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( Dart_Isolate isolate = Dart_CreateIsolate( advisory_script_uri, // advisory_script_entrypoint, // - (*embedder_isolate) - ->GetIsolateSnapshot() - ->GetData() - ->GetSnapshotPointer(), - (*embedder_isolate)->GetIsolateSnapshot()->GetInstructionsIfPresent(), - (*embedder_isolate)->GetSharedSnapshot()->GetDataIfPresent(), - (*embedder_isolate)->GetSharedSnapshot()->GetInstructionsIfPresent(), - flags, embedder_isolate.get(), error); + (*embedder_isolate)->GetIsolateSnapshot()->GetDataMapping(), + (*embedder_isolate)->GetIsolateSnapshot()->GetInstructionsMapping(), + (*embedder_isolate)->GetSharedSnapshot()->GetDataMapping(), + (*embedder_isolate)->GetSharedSnapshot()->GetInstructionsMapping(), flags, + embedder_isolate.get(), error); if (isolate == nullptr) { FML_DLOG(ERROR) << *error; diff --git a/runtime/dart_snapshot.cc b/runtime/dart_snapshot.cc index c2d6d40017164..61d2b85a6ca3b 100644 --- a/runtime/dart_snapshot.cc +++ b/runtime/dart_snapshot.cc @@ -10,7 +10,6 @@ #include "flutter/fml/paths.h" #include "flutter/fml/trace_event.h" #include "flutter/lib/snapshot/snapshot.h" -#include "flutter/runtime/dart_snapshot_buffer.h" #include "flutter/runtime/dart_vm.h" namespace flutter { @@ -21,151 +20,137 @@ const char* DartSnapshot::kIsolateDataSymbol = "kDartIsolateSnapshotData"; const char* DartSnapshot::kIsolateInstructionsSymbol = "kDartIsolateSnapshotInstructions"; -#if defined(OS_ANDROID) -// When assembling the .S file of the application, dart_bootstrap will prefix -// symbols via an `_` to ensure Mac's `dlsym()` can find it (Mac ABI prefixes C -// symbols with underscores). -// But Linux ABI does not prefix C symbols with underscores, so we have to -// explicitly look up the prefixed version. -#define SYMBOL_PREFIX "_" -#else -#define SYMBOL_PREFIX "" -#endif - -static const char* kVMDataSymbolSo = SYMBOL_PREFIX "kDartVmSnapshotData"; -static const char* kVMInstructionsSymbolSo = - SYMBOL_PREFIX "kDartVmSnapshotInstructions"; -static const char* kIsolateDataSymbolSo = - SYMBOL_PREFIX "kDartIsolateSnapshotData"; -static const char* kIsolateInstructionsSymbolSo = - SYMBOL_PREFIX "kDartIsolateSnapshotInstructions"; - -std::unique_ptr ResolveVMData(const Settings& settings) { - if (settings.vm_snapshot_data) { - return DartSnapshotBuffer::CreateWithMapping(settings.vm_snapshot_data()); +static std::unique_ptr GetFileMapping( + const std::string path, + bool executable) { + fml::UniqueFD file = + fml::OpenFile(path.c_str(), // file path + false, // create file if necessary + fml::FilePermission::kRead // file permissions + ); + + if (!file.is_valid()) { + return nullptr; } - if (settings.vm_snapshot_data_path.size() > 0) { - if (auto source = DartSnapshotBuffer::CreateWithContentsOfFile( - fml::OpenFile(settings.vm_snapshot_data_path.c_str(), false, - fml::FilePermission::kRead), - {fml::FileMapping::Protection::kRead})) { - return source; - } + using Prot = fml::FileMapping::Protection; + std::unique_ptr mapping; + if (executable) { + mapping = std::make_unique( + file, std::initializer_list{Prot::kRead, Prot::kExecute}); + } else { + mapping = std::make_unique( + file, std::initializer_list{Prot::kRead}); } - if (settings.application_library_path.size() > 0) { - auto shared_library = - fml::NativeLibrary::Create(settings.application_library_path.c_str()); - if (auto source = DartSnapshotBuffer::CreateWithSymbolInLibrary( - shared_library, kVMDataSymbolSo)) { - return source; - } + if (mapping->GetSize() == 0 || mapping->GetMapping() == nullptr) { + return nullptr; } - auto loaded_process = fml::NativeLibrary::CreateForCurrentProcess(); - return DartSnapshotBuffer::CreateWithSymbolInLibrary( - loaded_process, DartSnapshot::kVMDataSymbol); + return mapping; } -std::unique_ptr ResolveVMInstructions( - const Settings& settings) { - if (settings.vm_snapshot_instr) { - return DartSnapshotBuffer::CreateWithMapping(settings.vm_snapshot_instr()); +// The first party embedders don't yet use the stable embedder API and depend on +// the engine figuring out the locations of the various heap and instructions +// buffers. Consequently, the engine had baked in opinions about where these +// buffers would reside and how they would be packaged (examples, in an external +// dylib, in the same dylib, at a path, at a path relative to and FD, etc..). As +// the needs of the platforms changed, the lack of an API meant that the engine +// had to be patched to look for new fields in the settings object. This grew +// untenable and with the addition of the new Fuchsia embedder and the generic C +// embedder API, embedders could specify the mapping directly. Once everyone +// moves to the embedder API, this method can effectively be reduced to just +// invoking the embedder_mapping_callback directly. +static std::shared_ptr SearchMapping( + MappingCallback embedder_mapping_callback, + const std::string& file_path, + const std::string& native_library_path, + const char* native_library_symbol_name, + bool is_executable) { + // Ask the embedder. There is no fallback as we expect the embedders (via + // their embedding APIs) to just specify the mappings directly. + if (embedder_mapping_callback) { + return embedder_mapping_callback(); } - if (settings.vm_snapshot_instr_path.size() > 0) { - if (auto source = DartSnapshotBuffer::CreateWithContentsOfFile( - fml::OpenFile(settings.vm_snapshot_instr_path.c_str(), false, - fml::FilePermission::kRead), - {fml::FileMapping::Protection::kExecute})) { - return source; + // Attempt to open file at path specified. + if (file_path.size() > 0) { + if (auto file_mapping = GetFileMapping(file_path, is_executable)) { + return file_mapping; } } - if (settings.application_library_path.size() > 0) { - auto library = - fml::NativeLibrary::Create(settings.application_library_path.c_str()); - if (auto source = DartSnapshotBuffer::CreateWithSymbolInLibrary( - library, kVMInstructionsSymbolSo)) { - return source; + // Look in application specified native library if specified. + if (native_library_path.size() > 0) { + auto native_library = + fml::NativeLibrary::Create(native_library_path.c_str()); + auto symbol_mapping = std::make_unique( + native_library, native_library_symbol_name); + if (symbol_mapping->GetMapping() != nullptr) { + return symbol_mapping; } } - auto loaded_process = fml::NativeLibrary::CreateForCurrentProcess(); - return DartSnapshotBuffer::CreateWithSymbolInLibrary( - loaded_process, DartSnapshot::kVMInstructionsSymbol); -} - -std::unique_ptr ResolveIsolateData( - const Settings& settings) { - if (settings.isolate_snapshot_data) { - return DartSnapshotBuffer::CreateWithMapping( - settings.isolate_snapshot_data()); - } - - if (settings.isolate_snapshot_data_path.size() > 0) { - if (auto source = DartSnapshotBuffer::CreateWithContentsOfFile( - fml::OpenFile(settings.isolate_snapshot_data_path.c_str(), false, - fml::FilePermission::kRead), - {fml::FileMapping::Protection::kRead})) { - return source; + // Look inside the currently loaded process. + { + auto loaded_process = fml::NativeLibrary::CreateForCurrentProcess(); + auto symbol_mapping = std::make_unique( + loaded_process, native_library_symbol_name); + if (symbol_mapping->GetMapping() != nullptr) { + return symbol_mapping; } } - if (settings.application_library_path.size() > 0) { - auto library = - fml::NativeLibrary::Create(settings.application_library_path.c_str()); - if (auto source = DartSnapshotBuffer::CreateWithSymbolInLibrary( - library, kIsolateDataSymbolSo)) { - return source; - } - } - - auto loaded_process = fml::NativeLibrary::CreateForCurrentProcess(); - return DartSnapshotBuffer::CreateWithSymbolInLibrary( - loaded_process, DartSnapshot::kIsolateDataSymbol); + return nullptr; } -std::unique_ptr ResolveIsolateInstructions( +static std::shared_ptr ResolveVMData( const Settings& settings) { - if (settings.isolate_snapshot_data) { - return DartSnapshotBuffer::CreateWithMapping( - settings.isolate_snapshot_instr()); - } + return SearchMapping( + settings.vm_snapshot_data, // embedder_mapping_callback + settings.vm_snapshot_data_path, // file_path + settings.application_library_path, // native_library_path + DartSnapshot::kVMDataSymbol, // native_library_symbol_name + false // is_executable + ); +} - if (settings.isolate_snapshot_instr_path.size() > 0) { - if (auto source = DartSnapshotBuffer::CreateWithContentsOfFile( - fml::OpenFile(settings.isolate_snapshot_instr_path.c_str(), false, - fml::FilePermission::kRead), - {fml::FileMapping::Protection::kExecute})) { - return source; - } - } +static std::shared_ptr ResolveVMInstructions( + const Settings& settings) { + return SearchMapping( + settings.vm_snapshot_instr, // embedder_mapping_callback + settings.vm_snapshot_instr_path, // file_path + settings.application_library_path, // native_library_path + DartSnapshot::kVMInstructionsSymbol, // native_library_symbol_name + true // is_executable + ); +} - if (settings.application_library_path.size() > 0) { - auto library = - fml::NativeLibrary::Create(settings.application_library_path.c_str()); - if (auto source = DartSnapshotBuffer::CreateWithSymbolInLibrary( - library, kIsolateInstructionsSymbolSo)) { - return source; - } - } +static std::shared_ptr ResolveIsolateData( + const Settings& settings) { + return SearchMapping( + settings.isolate_snapshot_data, // embedder_mapping_callback + settings.isolate_snapshot_data_path, // file_path + settings.application_library_path, // native_library_path + DartSnapshot::kIsolateDataSymbol, // native_library_symbol_name + false // is_executable + ); +} - auto loaded_process = fml::NativeLibrary::CreateForCurrentProcess(); - return DartSnapshotBuffer::CreateWithSymbolInLibrary( - loaded_process, DartSnapshot::kIsolateInstructionsSymbol); +static std::shared_ptr ResolveIsolateInstructions( + const Settings& settings) { + return SearchMapping( + settings.isolate_snapshot_instr, // embedder_mapping_callback + settings.isolate_snapshot_instr_path, // file_path + settings.application_library_path, // native_library_path + DartSnapshot::kIsolateInstructionsSymbol, // native_library_symbol_name + true // is_executable + ); } fml::RefPtr DartSnapshot::VMSnapshotFromSettings( const Settings& settings) { TRACE_EVENT0("flutter", "DartSnapshot::VMSnapshotFromSettings"); -#if OS_WIN - return fml::MakeRefCounted( - DartSnapshotBuffer::CreateWithUnmanagedAllocation(kDartVmSnapshotData), - DartSnapshotBuffer::CreateWithUnmanagedAllocation( - kDartVmSnapshotInstructions)); -#else // OS_WIN auto snapshot = fml::MakeRefCounted(ResolveVMData(settings), // ResolveVMInstructions(settings) // @@ -174,19 +159,11 @@ fml::RefPtr DartSnapshot::VMSnapshotFromSettings( return snapshot; } return nullptr; -#endif // OS_WIN } fml::RefPtr DartSnapshot::IsolateSnapshotFromSettings( const Settings& settings) { TRACE_EVENT0("flutter", "DartSnapshot::IsolateSnapshotFromSettings"); -#if OS_WIN - return fml::MakeRefCounted( - DartSnapshotBuffer::CreateWithUnmanagedAllocation( - kDartIsolateSnapshotData), - DartSnapshotBuffer::CreateWithUnmanagedAllocation( - kDartIsolateSnapshotInstructions)); -#else // OS_WIN auto snapshot = fml::MakeRefCounted(ResolveIsolateData(settings), // ResolveIsolateInstructions(settings) // @@ -195,15 +172,14 @@ fml::RefPtr DartSnapshot::IsolateSnapshotFromSettings( return snapshot; } return nullptr; -#endif } fml::RefPtr DartSnapshot::Empty() { return fml::MakeRefCounted(nullptr, nullptr); } -DartSnapshot::DartSnapshot(std::unique_ptr data, - std::unique_ptr instructions) +DartSnapshot::DartSnapshot(std::shared_ptr data, + std::shared_ptr instructions) : data_(std::move(data)), instructions_(std::move(instructions)) {} DartSnapshot::~DartSnapshot() = default; @@ -216,20 +192,12 @@ bool DartSnapshot::IsValidForAOT() const { return data_ && instructions_; } -const DartSnapshotBuffer* DartSnapshot::GetData() const { - return data_.get(); -} - -const DartSnapshotBuffer* DartSnapshot::GetInstructions() const { - return instructions_.get(); -} - -const uint8_t* DartSnapshot::GetDataIfPresent() const { - return data_ ? data_->GetSnapshotPointer() : nullptr; +const uint8_t* DartSnapshot::GetDataMapping() const { + return data_ ? data_->GetMapping() : nullptr; } -const uint8_t* DartSnapshot::GetInstructionsIfPresent() const { - return instructions_ ? instructions_->GetSnapshotPointer() : nullptr; +const uint8_t* DartSnapshot::GetInstructionsMapping() const { + return instructions_ ? instructions_->GetMapping() : nullptr; } } // namespace flutter diff --git a/runtime/dart_snapshot.h b/runtime/dart_snapshot.h index 29ab3f035b54b..9e5f1a551e577 100644 --- a/runtime/dart_snapshot.h +++ b/runtime/dart_snapshot.h @@ -11,7 +11,6 @@ #include "flutter/common/settings.h" #include "flutter/fml/macros.h" #include "flutter/fml/memory/ref_counted.h" -#include "flutter/runtime/dart_snapshot_buffer.h" namespace flutter { @@ -34,20 +33,16 @@ class DartSnapshot : public fml::RefCountedThreadSafe { bool IsValidForAOT() const; - const DartSnapshotBuffer* GetData() const; + const uint8_t* GetDataMapping() const; - const DartSnapshotBuffer* GetInstructions() const; - - const uint8_t* GetDataIfPresent() const; - - const uint8_t* GetInstructionsIfPresent() const; + const uint8_t* GetInstructionsMapping() const; private: - std::unique_ptr data_; - std::unique_ptr instructions_; + std::shared_ptr data_; + std::shared_ptr instructions_; - DartSnapshot(std::unique_ptr data, - std::unique_ptr instructions); + DartSnapshot(std::shared_ptr data, + std::shared_ptr instructions); ~DartSnapshot(); diff --git a/runtime/dart_snapshot_buffer.cc b/runtime/dart_snapshot_buffer.cc deleted file mode 100644 index fcd71e9500454..0000000000000 --- a/runtime/dart_snapshot_buffer.cc +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2013 The Flutter 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_snapshot_buffer.h" - -#include - -#include "flutter/fml/mapping.h" - -namespace flutter { - -class NativeLibrarySnapshotBuffer final : public DartSnapshotBuffer { - public: - NativeLibrarySnapshotBuffer(fml::RefPtr library, - const char* symbol_name) - : library_(std::move(library)) { - if (library_) { - symbol_ = library_->ResolveSymbol(symbol_name); - } - } - - const uint8_t* GetSnapshotPointer() const override { return symbol_; } - - size_t GetSnapshotSize() const override { return 0; } - - private: - fml::RefPtr library_; - const uint8_t* symbol_ = nullptr; - - FML_DISALLOW_COPY_AND_ASSIGN(NativeLibrarySnapshotBuffer); -}; - -class MappingBuffer final : public DartSnapshotBuffer { - public: - MappingBuffer(std::unique_ptr mapping) - : mapping_(std::move(mapping)) { - FML_DCHECK(mapping_); - } - - const uint8_t* GetSnapshotPointer() const override { - return mapping_->GetMapping(); - } - - size_t GetSnapshotSize() const override { return mapping_->GetSize(); } - - private: - std::unique_ptr mapping_; - - FML_DISALLOW_COPY_AND_ASSIGN(MappingBuffer); -}; - -class UnmanagedAllocation final : public DartSnapshotBuffer { - public: - UnmanagedAllocation(const uint8_t* allocation) : allocation_(allocation) {} - - const uint8_t* GetSnapshotPointer() const override { return allocation_; } - - size_t GetSnapshotSize() const override { return 0; } - - private: - const uint8_t* allocation_; - - FML_DISALLOW_COPY_AND_ASSIGN(UnmanagedAllocation); -}; - -std::unique_ptr -DartSnapshotBuffer::CreateWithSymbolInLibrary( - fml::RefPtr library, - const char* symbol_name) { - auto source = std::make_unique( - std::move(library), symbol_name); - return source->GetSnapshotPointer() == nullptr ? nullptr : std::move(source); -} - -std::unique_ptr -DartSnapshotBuffer::CreateWithContentsOfFile( - const fml::UniqueFD& fd, - std::initializer_list protection) { - return CreateWithMapping(std::make_unique(fd, protection)); -} - -std::unique_ptr DartSnapshotBuffer::CreateWithMapping( - std::unique_ptr mapping) { - if (mapping == nullptr || mapping->GetSize() == 0 || - mapping->GetMapping() == nullptr) { - return nullptr; - } - return std::make_unique(std::move(mapping)); -} - -std::unique_ptr -DartSnapshotBuffer::CreateWithUnmanagedAllocation(const uint8_t* allocation) { - if (allocation == nullptr) { - return nullptr; - } - return std::make_unique(allocation); -} - -DartSnapshotBuffer::~DartSnapshotBuffer() = default; - -} // namespace flutter diff --git a/runtime/dart_snapshot_buffer.h b/runtime/dart_snapshot_buffer.h deleted file mode 100644 index 2c5887ad7e3bf..0000000000000 --- a/runtime/dart_snapshot_buffer.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2013 The Flutter 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_SNAPSHOT_BUFFER_H_ -#define FLUTTER_RUNTIME_DART_SNAPSHOT_BUFFER_H_ - -#include -#include - -#include "flutter/fml/file.h" -#include "flutter/fml/macros.h" -#include "flutter/fml/mapping.h" -#include "flutter/fml/native_library.h" - -namespace flutter { - -// TODO(chinmaygarde): Replace this with just |fml::Mapping|. -// https://github.com/flutter/flutter/issues/26782 -class DartSnapshotBuffer { - public: - static std::unique_ptr CreateWithSymbolInLibrary( - fml::RefPtr library, - const char* symbol_name); - - static std::unique_ptr CreateWithContentsOfFile( - const fml::UniqueFD& fd, - std::initializer_list protection); - - static std::unique_ptr CreateWithUnmanagedAllocation( - const uint8_t* allocation); - - static std::unique_ptr CreateWithMapping( - std::unique_ptr mapping); - - virtual ~DartSnapshotBuffer(); - - virtual const uint8_t* GetSnapshotPointer() const = 0; - - virtual size_t GetSnapshotSize() const = 0; -}; - -} // namespace flutter - -#endif // FLUTTER_RUNTIME_DART_SNAPSHOT_BUFFER_H_ diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 973d5d8e86eb0..0872ebd28012a 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -371,10 +371,9 @@ DartVM::DartVM(std::shared_ptr vm_data, TRACE_EVENT0("flutter", "Dart_Initialize"); Dart_InitializeParams params = {}; params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION; - params.vm_snapshot_data = - vm_data_->GetVMSnapshot().GetData()->GetSnapshotPointer(); + params.vm_snapshot_data = vm_data_->GetVMSnapshot().GetDataMapping(); params.vm_snapshot_instructions = - vm_data_->GetVMSnapshot().GetInstructionsIfPresent(); + vm_data_->GetVMSnapshot().GetInstructionsMapping(); params.create = reinterpret_cast( DartIsolate::DartIsolateCreateCallback); params.shutdown = reinterpret_cast( From 3387dc480895e2b71bc848ab67512c052da0669d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 18 Apr 2019 19:21:24 -0400 Subject: [PATCH 0871/1117] Roll src/third_party/skia 067861e14821..9b67802a4cd0 (6 commits) (#8641) https://skia.googlesource.com/skia.git/%2Blog/067861e14821..9b67802a4cd0 git log 067861e1482118dd7071c931a90127c5ca0c9b21..9b67802a4cd01fbbe5fcbe9f4117ff68e7b8e751 --date=short --no-merges --format=%ad %ae %s 2019-04-19 martin@mainframe.co.uk Properly retrieve memory block in SkTextUtils 2019-04-18 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial). 2019-04-18 halcanary@google.com SkPDF: move type1 font code into single file 2019-04-18 csmartdalton@google.com Swap front and back stencil sides when rendering bottom-left 2019-04-18 bsalomon@google.com Swap x/y radii for EllipticalRRectOp depending on matrix. 2019-04-18 halcanary@google.com SkQP: consolidate cut_release scripts The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index f7904eb653771..1394a5589631a 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': '067861e1482118dd7071c931a90127c5ca0c9b21', + 'skia_revision': '9b67802a4cd01fbbe5fcbe9f4117ff68e7b8e751', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index cc8172a1aa78a..d249ef4389214 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 69e8aeb209ca2d1f280e0b5fef4a35cb +Signature: ea04142847537ef9dc501d7a2cdac241 UNUSED LICENSES: @@ -1342,7 +1342,6 @@ FILE: ../../../third_party/skia/src/opts/SkOpts_crc32.cpp FILE: ../../../third_party/skia/src/opts/SkOpts_sse42.cpp FILE: ../../../third_party/skia/src/opts/SkSwizzler_opts.h FILE: ../../../third_party/skia/src/pdf/SkBitmapKey.h -FILE: ../../../third_party/skia/src/pdf/SkPDFConvertType1FontStream.h FILE: ../../../third_party/skia/src/pdf/SkPDFDocumentPriv.h FILE: ../../../third_party/skia/src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp FILE: ../../../third_party/skia/src/pdf/SkPDFMakeCIDGlyphWidthsArray.h @@ -2949,7 +2948,6 @@ FILE: ../../../third_party/skia/src/gpu/ops/GrAAHairLinePathRenderer.cpp 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/pdf/SkPDFConvertType1FontStream.cpp FILE: ../../../third_party/skia/src/pdf/SkPDFDevice.cpp FILE: ../../../third_party/skia/src/pdf/SkPDFDevice.h FILE: ../../../third_party/skia/src/pdf/SkPDFDocument.cpp @@ -5701,6 +5699,8 @@ FILE: ../../../third_party/skia/src/gpu/effects/generated/GrComposeLerpRedEffect FILE: ../../../third_party/skia/src/gpu/effects/generated/GrComposeLerpRedEffect.h FILE: ../../../third_party/skia/src/pdf/SkPDFGraphicStackState.cpp FILE: ../../../third_party/skia/src/pdf/SkPDFGraphicStackState.h +FILE: ../../../third_party/skia/src/pdf/SkPDFType1Font.cpp +FILE: ../../../third_party/skia/src/pdf/SkPDFType1Font.h ---------------------------------------------------------------------------------------------------- Copyright 2019 Google LLC. @@ -5736,6 +5736,7 @@ LIBRARY: skia ORIGIN: ../../../third_party/skia/experimental/wasm-skp-debugger/debugger_bindings.cpp + ../../../third_party/skia/LICENSE TYPE: LicenseType.bsd FILE: ../../../third_party/skia/experimental/wasm-skp-debugger/debugger_bindings.cpp +FILE: ../../../third_party/skia/gm/crbug_946965.cpp FILE: ../../../third_party/skia/gm/runtimecolorfilter.cpp FILE: ../../../third_party/skia/include/gpu/gl/GrGLAssembleHelpers.h FILE: ../../../third_party/skia/modules/canvaskit/WasmAliases.h From 9a53f5f79a04b9441aa42aeeb647f5281f2fa7ee Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 18 Apr 2019 16:21:48 -0700 Subject: [PATCH 0872/1117] Roll src/third_party/dart 7b9ab9f353..cf4444b803 (44 commits) (#8639) cf4444b803 Revert "[ VM / Service ] Temporarily disable VM service auth codes by default" f8491950fe Create List, not Impl. fa7485f28e Build types for not simply bounded elements using dynamic type arguments. 9d376de55a [vm] Remove code collection. 0c0e49cd11 update keyword list to include "late" modifier 3cf3e4edde [dart/vm] Reduce trip count of osr test 503e20946c [vm] Start logging if shutdown takes too long. 2b9f968d2f Convert engine.dart to triple-slash comment style 73b917c014 [vm/compiler] Do not generate unnecessary field length guards 20fde9a6a8 Don't overwrite inherited types of fields with types of initializers. e6e2a196a3 Issue 36667. Check for unresolved URI in getLibraryByUri(). 6ac38a926c The synthetic default constructor should have reference. 92729e0cd3 Remove UndefinedTypeImpl. cf77b82f52 [analyzer] handle youtube and animation dartdoc directives 6384f629c0 new conflicting-modifiers error code f3703c1bce change "late" from built-in to keyword af9c01432c Remove unused import 7b6b8f8c43 Restore 'parameters' and 'typeParameters' for ParameterElementImpl. bc58bf598e Add summary serialization support for nullability suffixes. 8093f73424 [vm/dbc] Add UNREACHABLE() stubs to simulator_dbc.cc in 32-bit mode to make 32-build work 336fc9001c Fix for getting type of a DefaultFormalParameter during building types. e93c6b7ce1 Add AST representation of the late keyword 43eebea5a3 [kernel_worker] retry on failure 284a299543 Fix mustCallSuper for mixins; fixes #36492 5a824581b7 Read directive annotations before returning offset. 703ccc974b Support for TypeParameter metadata. 242ed77040 Fix for FormalParameter without name. 92dd37081d Write / read Annotation element. d8a0d68bd6 Rename devcompiler to ddc 6d91643073 [vm, interpreter] Handle closure case of invoke-field-dispatchers as bytecode. b8a9711489 Update AstBuilder to handle "required" modifier ca28e2c8ce forward "required" modifier to parser listeners 250d931ecc When URI cannot be resolved, the library is null. 2491767a33 Use correct CompilationUnitElement for annotations. 4ef18fdb96 Fix nameOffset for Export/ImportElement. 7873dbdc1d Fix for duplicate declarations. 38049f3cb6 [vm, interpreter] Handle implicit static getters as bytecode. 714a082a5d Minimal integration of summary2 into AnalysisDriver. dd3530450d make "late" and "required" builtin keywords 836efd6520 Add a language_2 test for having an invalid type in an on clause 81e554ea43 parse "required" modifier for NNBD 1eab04ed3f Reland "[VM-debugger] resolve column breakpoint tokenposition into a single value" ec27b09e68 [vm, service] Fix deferral of service extension invocation to not be mislead by other OOB messages. 1e30bb90dc [vm/dbc] Support unboxed Int64 on DBC --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 1394a5589631a..7b2e425312ceb 100644 --- a/DEPS +++ b/DEPS @@ -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': '7b9ab9f35390d36d32c405a807be31ae3ed0ddb7', + 'dart_revision': 'cf4444b803a376bb1ad6442e1f09434a4d58167b', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 62957332ff643..ebbcabfd2c6ea 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 3ea8eaf2d73434b50c81b323a6e6ef43 +Signature: cb9e296575fc050579bacb3a1c06c9b5 UNUSED LICENSES: From 0fcfa0df2aa19947ad73882ab4fb24fc9124e47b Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 18 Apr 2019 16:46:03 -0700 Subject: [PATCH 0873/1117] Revert "Remove DartSnapshotBuffer and dry up snapshot resolution logic. (#8640)" (#8644) This reverts commit 905ddb6ca9f9dcb6b1a7cea67d502da094867623. --- ci/licenses_golden/licenses_flutter | 2 + fml/mapping.cc | 41 ----- fml/mapping.h | 33 +--- runtime/BUILD.gn | 2 + runtime/dart_isolate.cc | 13 +- runtime/dart_snapshot.cc | 246 ++++++++++++++++------------ runtime/dart_snapshot.h | 17 +- runtime/dart_snapshot_buffer.cc | 102 ++++++++++++ runtime/dart_snapshot_buffer.h | 45 +++++ runtime/dart_vm.cc | 5 +- 10 files changed, 315 insertions(+), 191 deletions(-) create mode 100644 runtime/dart_snapshot_buffer.cc create mode 100644 runtime/dart_snapshot_buffer.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index a323d42e1aee1..265dca257bf06 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -383,6 +383,8 @@ 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 +FILE: ../../../flutter/runtime/dart_snapshot_buffer.h FILE: ../../../flutter/runtime/dart_vm.cc FILE: ../../../flutter/runtime/dart_vm.h FILE: ../../../flutter/runtime/dart_vm_data.cc diff --git a/fml/mapping.cc b/fml/mapping.cc index 75ca1b396912d..11882b6662bbf 100644 --- a/fml/mapping.cc +++ b/fml/mapping.cc @@ -4,18 +4,12 @@ #include "flutter/fml/mapping.h" -#include - namespace fml { -// FileMapping - uint8_t* FileMapping::GetMutableMapping() { return mutable_mapping_; } -// Data Mapping - DataMapping::DataMapping(std::vector data) : data_(std::move(data)) {} DataMapping::~DataMapping() = default; @@ -28,8 +22,6 @@ const uint8_t* DataMapping::GetMapping() const { return data_.data(); } -// NonOwnedMapping - size_t NonOwnedMapping::GetSize() const { return size_; } @@ -38,37 +30,4 @@ const uint8_t* NonOwnedMapping::GetMapping() const { return data_; } -// Symbol Mapping - -SymbolMapping::SymbolMapping(fml::RefPtr native_library, - const char* symbol_name) - : native_library_(std::move(native_library)) { - if (native_library_ && symbol_name != nullptr) { - mapping_ = native_library_->ResolveSymbol(symbol_name); - - if (mapping_ == nullptr) { - // Apparently, dart_bootstrap seems to account for the Mac behavior of - // requiring the underscore prefixed symbol name on non-Mac platforms as - // well. As a fallback, check the underscore prefixed variant of the - // symbol name and allow callers to not have handle this on a per platform - // toolchain quirk basis. - - std::stringstream underscore_symbol_name; - underscore_symbol_name << "_" << symbol_name; - mapping_ = - native_library_->ResolveSymbol(underscore_symbol_name.str().c_str()); - } - } -} - -SymbolMapping::~SymbolMapping() = default; - -size_t SymbolMapping::GetSize() const { - return 0; -} - -const uint8_t* SymbolMapping::GetMapping() const { - return mapping_; -} - } // namespace fml diff --git a/fml/mapping.h b/fml/mapping.h index f7e6bbd4231d6..05894a5c219a4 100644 --- a/fml/mapping.h +++ b/fml/mapping.h @@ -13,7 +13,6 @@ #include "flutter/fml/build_config.h" #include "flutter/fml/file.h" #include "flutter/fml/macros.h" -#include "flutter/fml/native_library.h" #include "flutter/fml/unique_fd.h" namespace fml { @@ -32,7 +31,7 @@ class Mapping { FML_DISALLOW_COPY_AND_ASSIGN(Mapping); }; -class FileMapping final : public Mapping { +class FileMapping : public Mapping { public: enum class Protection { kRead, @@ -46,10 +45,8 @@ class FileMapping final : public Mapping { ~FileMapping() override; - // |Mapping| size_t GetSize() const override; - // |Mapping| const uint8_t* GetMapping() const override; uint8_t* GetMutableMapping(); @@ -66,16 +63,14 @@ class FileMapping final : public Mapping { FML_DISALLOW_COPY_AND_ASSIGN(FileMapping); }; -class DataMapping final : public Mapping { +class DataMapping : public Mapping { public: DataMapping(std::vector data); ~DataMapping() override; - // |Mapping| size_t GetSize() const override; - // |Mapping| const uint8_t* GetMapping() const override; private: @@ -84,15 +79,13 @@ class DataMapping final : public Mapping { FML_DISALLOW_COPY_AND_ASSIGN(DataMapping); }; -class NonOwnedMapping final : public Mapping { +class NonOwnedMapping : public Mapping { public: NonOwnedMapping(const uint8_t* data, size_t size) : data_(data), size_(size) {} - // |Mapping| size_t GetSize() const override; - // |Mapping| const uint8_t* GetMapping() const override; private: @@ -102,26 +95,6 @@ class NonOwnedMapping final : public Mapping { FML_DISALLOW_COPY_AND_ASSIGN(NonOwnedMapping); }; -class SymbolMapping final : public Mapping { - public: - SymbolMapping(fml::RefPtr native_library, - const char* symbol_name); - - ~SymbolMapping() override; - - // |Mapping| - size_t GetSize() const override; - - // |Mapping| - const uint8_t* GetMapping() const override; - - private: - fml::RefPtr native_library_; - const uint8_t* mapping_ = nullptr; - - FML_DISALLOW_COPY_AND_ASSIGN(SymbolMapping); -}; - } // namespace fml #endif // FLUTTER_FML_MAPPING_H_ diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index bcfd7e399d532..9d6f0d80ea623 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -46,6 +46,8 @@ source_set("runtime") { "dart_service_isolate.h", "dart_snapshot.cc", "dart_snapshot.h", + "dart_snapshot_buffer.cc", + "dart_snapshot_buffer.h", "dart_vm.cc", "dart_vm.h", "dart_vm_data.cc", diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 8de6bca542c12..20b7c960ee26e 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -679,11 +679,14 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( Dart_Isolate isolate = Dart_CreateIsolate( advisory_script_uri, // advisory_script_entrypoint, // - (*embedder_isolate)->GetIsolateSnapshot()->GetDataMapping(), - (*embedder_isolate)->GetIsolateSnapshot()->GetInstructionsMapping(), - (*embedder_isolate)->GetSharedSnapshot()->GetDataMapping(), - (*embedder_isolate)->GetSharedSnapshot()->GetInstructionsMapping(), flags, - embedder_isolate.get(), error); + (*embedder_isolate) + ->GetIsolateSnapshot() + ->GetData() + ->GetSnapshotPointer(), + (*embedder_isolate)->GetIsolateSnapshot()->GetInstructionsIfPresent(), + (*embedder_isolate)->GetSharedSnapshot()->GetDataIfPresent(), + (*embedder_isolate)->GetSharedSnapshot()->GetInstructionsIfPresent(), + flags, embedder_isolate.get(), error); if (isolate == nullptr) { FML_DLOG(ERROR) << *error; diff --git a/runtime/dart_snapshot.cc b/runtime/dart_snapshot.cc index 61d2b85a6ca3b..c2d6d40017164 100644 --- a/runtime/dart_snapshot.cc +++ b/runtime/dart_snapshot.cc @@ -10,6 +10,7 @@ #include "flutter/fml/paths.h" #include "flutter/fml/trace_event.h" #include "flutter/lib/snapshot/snapshot.h" +#include "flutter/runtime/dart_snapshot_buffer.h" #include "flutter/runtime/dart_vm.h" namespace flutter { @@ -20,137 +21,151 @@ const char* DartSnapshot::kIsolateDataSymbol = "kDartIsolateSnapshotData"; const char* DartSnapshot::kIsolateInstructionsSymbol = "kDartIsolateSnapshotInstructions"; -static std::unique_ptr GetFileMapping( - const std::string path, - bool executable) { - fml::UniqueFD file = - fml::OpenFile(path.c_str(), // file path - false, // create file if necessary - fml::FilePermission::kRead // file permissions - ); - - if (!file.is_valid()) { - return nullptr; +#if defined(OS_ANDROID) +// When assembling the .S file of the application, dart_bootstrap will prefix +// symbols via an `_` to ensure Mac's `dlsym()` can find it (Mac ABI prefixes C +// symbols with underscores). +// But Linux ABI does not prefix C symbols with underscores, so we have to +// explicitly look up the prefixed version. +#define SYMBOL_PREFIX "_" +#else +#define SYMBOL_PREFIX "" +#endif + +static const char* kVMDataSymbolSo = SYMBOL_PREFIX "kDartVmSnapshotData"; +static const char* kVMInstructionsSymbolSo = + SYMBOL_PREFIX "kDartVmSnapshotInstructions"; +static const char* kIsolateDataSymbolSo = + SYMBOL_PREFIX "kDartIsolateSnapshotData"; +static const char* kIsolateInstructionsSymbolSo = + SYMBOL_PREFIX "kDartIsolateSnapshotInstructions"; + +std::unique_ptr ResolveVMData(const Settings& settings) { + if (settings.vm_snapshot_data) { + return DartSnapshotBuffer::CreateWithMapping(settings.vm_snapshot_data()); } - using Prot = fml::FileMapping::Protection; - std::unique_ptr mapping; - if (executable) { - mapping = std::make_unique( - file, std::initializer_list{Prot::kRead, Prot::kExecute}); - } else { - mapping = std::make_unique( - file, std::initializer_list{Prot::kRead}); + if (settings.vm_snapshot_data_path.size() > 0) { + if (auto source = DartSnapshotBuffer::CreateWithContentsOfFile( + fml::OpenFile(settings.vm_snapshot_data_path.c_str(), false, + fml::FilePermission::kRead), + {fml::FileMapping::Protection::kRead})) { + return source; + } } - if (mapping->GetSize() == 0 || mapping->GetMapping() == nullptr) { - return nullptr; + if (settings.application_library_path.size() > 0) { + auto shared_library = + fml::NativeLibrary::Create(settings.application_library_path.c_str()); + if (auto source = DartSnapshotBuffer::CreateWithSymbolInLibrary( + shared_library, kVMDataSymbolSo)) { + return source; + } } - return mapping; + auto loaded_process = fml::NativeLibrary::CreateForCurrentProcess(); + return DartSnapshotBuffer::CreateWithSymbolInLibrary( + loaded_process, DartSnapshot::kVMDataSymbol); } -// The first party embedders don't yet use the stable embedder API and depend on -// the engine figuring out the locations of the various heap and instructions -// buffers. Consequently, the engine had baked in opinions about where these -// buffers would reside and how they would be packaged (examples, in an external -// dylib, in the same dylib, at a path, at a path relative to and FD, etc..). As -// the needs of the platforms changed, the lack of an API meant that the engine -// had to be patched to look for new fields in the settings object. This grew -// untenable and with the addition of the new Fuchsia embedder and the generic C -// embedder API, embedders could specify the mapping directly. Once everyone -// moves to the embedder API, this method can effectively be reduced to just -// invoking the embedder_mapping_callback directly. -static std::shared_ptr SearchMapping( - MappingCallback embedder_mapping_callback, - const std::string& file_path, - const std::string& native_library_path, - const char* native_library_symbol_name, - bool is_executable) { - // Ask the embedder. There is no fallback as we expect the embedders (via - // their embedding APIs) to just specify the mappings directly. - if (embedder_mapping_callback) { - return embedder_mapping_callback(); +std::unique_ptr ResolveVMInstructions( + const Settings& settings) { + if (settings.vm_snapshot_instr) { + return DartSnapshotBuffer::CreateWithMapping(settings.vm_snapshot_instr()); } - // Attempt to open file at path specified. - if (file_path.size() > 0) { - if (auto file_mapping = GetFileMapping(file_path, is_executable)) { - return file_mapping; + if (settings.vm_snapshot_instr_path.size() > 0) { + if (auto source = DartSnapshotBuffer::CreateWithContentsOfFile( + fml::OpenFile(settings.vm_snapshot_instr_path.c_str(), false, + fml::FilePermission::kRead), + {fml::FileMapping::Protection::kExecute})) { + return source; } } - // Look in application specified native library if specified. - if (native_library_path.size() > 0) { - auto native_library = - fml::NativeLibrary::Create(native_library_path.c_str()); - auto symbol_mapping = std::make_unique( - native_library, native_library_symbol_name); - if (symbol_mapping->GetMapping() != nullptr) { - return symbol_mapping; + if (settings.application_library_path.size() > 0) { + auto library = + fml::NativeLibrary::Create(settings.application_library_path.c_str()); + if (auto source = DartSnapshotBuffer::CreateWithSymbolInLibrary( + library, kVMInstructionsSymbolSo)) { + return source; } } - // Look inside the currently loaded process. - { - auto loaded_process = fml::NativeLibrary::CreateForCurrentProcess(); - auto symbol_mapping = std::make_unique( - loaded_process, native_library_symbol_name); - if (symbol_mapping->GetMapping() != nullptr) { - return symbol_mapping; + auto loaded_process = fml::NativeLibrary::CreateForCurrentProcess(); + return DartSnapshotBuffer::CreateWithSymbolInLibrary( + loaded_process, DartSnapshot::kVMInstructionsSymbol); +} + +std::unique_ptr ResolveIsolateData( + const Settings& settings) { + if (settings.isolate_snapshot_data) { + return DartSnapshotBuffer::CreateWithMapping( + settings.isolate_snapshot_data()); + } + + if (settings.isolate_snapshot_data_path.size() > 0) { + if (auto source = DartSnapshotBuffer::CreateWithContentsOfFile( + fml::OpenFile(settings.isolate_snapshot_data_path.c_str(), false, + fml::FilePermission::kRead), + {fml::FileMapping::Protection::kRead})) { + return source; } } - return nullptr; -} + if (settings.application_library_path.size() > 0) { + auto library = + fml::NativeLibrary::Create(settings.application_library_path.c_str()); + if (auto source = DartSnapshotBuffer::CreateWithSymbolInLibrary( + library, kIsolateDataSymbolSo)) { + return source; + } + } -static std::shared_ptr ResolveVMData( - const Settings& settings) { - return SearchMapping( - settings.vm_snapshot_data, // embedder_mapping_callback - settings.vm_snapshot_data_path, // file_path - settings.application_library_path, // native_library_path - DartSnapshot::kVMDataSymbol, // native_library_symbol_name - false // is_executable - ); + auto loaded_process = fml::NativeLibrary::CreateForCurrentProcess(); + return DartSnapshotBuffer::CreateWithSymbolInLibrary( + loaded_process, DartSnapshot::kIsolateDataSymbol); } -static std::shared_ptr ResolveVMInstructions( +std::unique_ptr ResolveIsolateInstructions( const Settings& settings) { - return SearchMapping( - settings.vm_snapshot_instr, // embedder_mapping_callback - settings.vm_snapshot_instr_path, // file_path - settings.application_library_path, // native_library_path - DartSnapshot::kVMInstructionsSymbol, // native_library_symbol_name - true // is_executable - ); -} + if (settings.isolate_snapshot_data) { + return DartSnapshotBuffer::CreateWithMapping( + settings.isolate_snapshot_instr()); + } -static std::shared_ptr ResolveIsolateData( - const Settings& settings) { - return SearchMapping( - settings.isolate_snapshot_data, // embedder_mapping_callback - settings.isolate_snapshot_data_path, // file_path - settings.application_library_path, // native_library_path - DartSnapshot::kIsolateDataSymbol, // native_library_symbol_name - false // is_executable - ); -} + if (settings.isolate_snapshot_instr_path.size() > 0) { + if (auto source = DartSnapshotBuffer::CreateWithContentsOfFile( + fml::OpenFile(settings.isolate_snapshot_instr_path.c_str(), false, + fml::FilePermission::kRead), + {fml::FileMapping::Protection::kExecute})) { + return source; + } + } -static std::shared_ptr ResolveIsolateInstructions( - const Settings& settings) { - return SearchMapping( - settings.isolate_snapshot_instr, // embedder_mapping_callback - settings.isolate_snapshot_instr_path, // file_path - settings.application_library_path, // native_library_path - DartSnapshot::kIsolateInstructionsSymbol, // native_library_symbol_name - true // is_executable - ); + if (settings.application_library_path.size() > 0) { + auto library = + fml::NativeLibrary::Create(settings.application_library_path.c_str()); + if (auto source = DartSnapshotBuffer::CreateWithSymbolInLibrary( + library, kIsolateInstructionsSymbolSo)) { + return source; + } + } + + auto loaded_process = fml::NativeLibrary::CreateForCurrentProcess(); + return DartSnapshotBuffer::CreateWithSymbolInLibrary( + loaded_process, DartSnapshot::kIsolateInstructionsSymbol); } fml::RefPtr DartSnapshot::VMSnapshotFromSettings( const Settings& settings) { TRACE_EVENT0("flutter", "DartSnapshot::VMSnapshotFromSettings"); +#if OS_WIN + return fml::MakeRefCounted( + DartSnapshotBuffer::CreateWithUnmanagedAllocation(kDartVmSnapshotData), + DartSnapshotBuffer::CreateWithUnmanagedAllocation( + kDartVmSnapshotInstructions)); +#else // OS_WIN auto snapshot = fml::MakeRefCounted(ResolveVMData(settings), // ResolveVMInstructions(settings) // @@ -159,11 +174,19 @@ fml::RefPtr DartSnapshot::VMSnapshotFromSettings( return snapshot; } return nullptr; +#endif // OS_WIN } fml::RefPtr DartSnapshot::IsolateSnapshotFromSettings( const Settings& settings) { TRACE_EVENT0("flutter", "DartSnapshot::IsolateSnapshotFromSettings"); +#if OS_WIN + return fml::MakeRefCounted( + DartSnapshotBuffer::CreateWithUnmanagedAllocation( + kDartIsolateSnapshotData), + DartSnapshotBuffer::CreateWithUnmanagedAllocation( + kDartIsolateSnapshotInstructions)); +#else // OS_WIN auto snapshot = fml::MakeRefCounted(ResolveIsolateData(settings), // ResolveIsolateInstructions(settings) // @@ -172,14 +195,15 @@ fml::RefPtr DartSnapshot::IsolateSnapshotFromSettings( return snapshot; } return nullptr; +#endif } fml::RefPtr DartSnapshot::Empty() { return fml::MakeRefCounted(nullptr, nullptr); } -DartSnapshot::DartSnapshot(std::shared_ptr data, - std::shared_ptr instructions) +DartSnapshot::DartSnapshot(std::unique_ptr data, + std::unique_ptr instructions) : data_(std::move(data)), instructions_(std::move(instructions)) {} DartSnapshot::~DartSnapshot() = default; @@ -192,12 +216,20 @@ bool DartSnapshot::IsValidForAOT() const { return data_ && instructions_; } -const uint8_t* DartSnapshot::GetDataMapping() const { - return data_ ? data_->GetMapping() : nullptr; +const DartSnapshotBuffer* DartSnapshot::GetData() const { + return data_.get(); +} + +const DartSnapshotBuffer* DartSnapshot::GetInstructions() const { + return instructions_.get(); +} + +const uint8_t* DartSnapshot::GetDataIfPresent() const { + return data_ ? data_->GetSnapshotPointer() : nullptr; } -const uint8_t* DartSnapshot::GetInstructionsMapping() const { - return instructions_ ? instructions_->GetMapping() : nullptr; +const uint8_t* DartSnapshot::GetInstructionsIfPresent() const { + return instructions_ ? instructions_->GetSnapshotPointer() : nullptr; } } // namespace flutter diff --git a/runtime/dart_snapshot.h b/runtime/dart_snapshot.h index 9e5f1a551e577..29ab3f035b54b 100644 --- a/runtime/dart_snapshot.h +++ b/runtime/dart_snapshot.h @@ -11,6 +11,7 @@ #include "flutter/common/settings.h" #include "flutter/fml/macros.h" #include "flutter/fml/memory/ref_counted.h" +#include "flutter/runtime/dart_snapshot_buffer.h" namespace flutter { @@ -33,16 +34,20 @@ class DartSnapshot : public fml::RefCountedThreadSafe { bool IsValidForAOT() const; - const uint8_t* GetDataMapping() const; + const DartSnapshotBuffer* GetData() const; - const uint8_t* GetInstructionsMapping() const; + const DartSnapshotBuffer* GetInstructions() const; + + const uint8_t* GetDataIfPresent() const; + + const uint8_t* GetInstructionsIfPresent() const; private: - std::shared_ptr data_; - std::shared_ptr instructions_; + std::unique_ptr data_; + std::unique_ptr instructions_; - DartSnapshot(std::shared_ptr data, - std::shared_ptr instructions); + DartSnapshot(std::unique_ptr data, + std::unique_ptr instructions); ~DartSnapshot(); diff --git a/runtime/dart_snapshot_buffer.cc b/runtime/dart_snapshot_buffer.cc new file mode 100644 index 0000000000000..fcd71e9500454 --- /dev/null +++ b/runtime/dart_snapshot_buffer.cc @@ -0,0 +1,102 @@ +// Copyright 2013 The Flutter 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_snapshot_buffer.h" + +#include + +#include "flutter/fml/mapping.h" + +namespace flutter { + +class NativeLibrarySnapshotBuffer final : public DartSnapshotBuffer { + public: + NativeLibrarySnapshotBuffer(fml::RefPtr library, + const char* symbol_name) + : library_(std::move(library)) { + if (library_) { + symbol_ = library_->ResolveSymbol(symbol_name); + } + } + + const uint8_t* GetSnapshotPointer() const override { return symbol_; } + + size_t GetSnapshotSize() const override { return 0; } + + private: + fml::RefPtr library_; + const uint8_t* symbol_ = nullptr; + + FML_DISALLOW_COPY_AND_ASSIGN(NativeLibrarySnapshotBuffer); +}; + +class MappingBuffer final : public DartSnapshotBuffer { + public: + MappingBuffer(std::unique_ptr mapping) + : mapping_(std::move(mapping)) { + FML_DCHECK(mapping_); + } + + const uint8_t* GetSnapshotPointer() const override { + return mapping_->GetMapping(); + } + + size_t GetSnapshotSize() const override { return mapping_->GetSize(); } + + private: + std::unique_ptr mapping_; + + FML_DISALLOW_COPY_AND_ASSIGN(MappingBuffer); +}; + +class UnmanagedAllocation final : public DartSnapshotBuffer { + public: + UnmanagedAllocation(const uint8_t* allocation) : allocation_(allocation) {} + + const uint8_t* GetSnapshotPointer() const override { return allocation_; } + + size_t GetSnapshotSize() const override { return 0; } + + private: + const uint8_t* allocation_; + + FML_DISALLOW_COPY_AND_ASSIGN(UnmanagedAllocation); +}; + +std::unique_ptr +DartSnapshotBuffer::CreateWithSymbolInLibrary( + fml::RefPtr library, + const char* symbol_name) { + auto source = std::make_unique( + std::move(library), symbol_name); + return source->GetSnapshotPointer() == nullptr ? nullptr : std::move(source); +} + +std::unique_ptr +DartSnapshotBuffer::CreateWithContentsOfFile( + const fml::UniqueFD& fd, + std::initializer_list protection) { + return CreateWithMapping(std::make_unique(fd, protection)); +} + +std::unique_ptr DartSnapshotBuffer::CreateWithMapping( + std::unique_ptr mapping) { + if (mapping == nullptr || mapping->GetSize() == 0 || + mapping->GetMapping() == nullptr) { + return nullptr; + } + return std::make_unique(std::move(mapping)); +} + +std::unique_ptr +DartSnapshotBuffer::CreateWithUnmanagedAllocation(const uint8_t* allocation) { + if (allocation == nullptr) { + return nullptr; + } + return std::make_unique(allocation); +} + +DartSnapshotBuffer::~DartSnapshotBuffer() = default; + +} // namespace flutter diff --git a/runtime/dart_snapshot_buffer.h b/runtime/dart_snapshot_buffer.h new file mode 100644 index 0000000000000..2c5887ad7e3bf --- /dev/null +++ b/runtime/dart_snapshot_buffer.h @@ -0,0 +1,45 @@ +// Copyright 2013 The Flutter 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_SNAPSHOT_BUFFER_H_ +#define FLUTTER_RUNTIME_DART_SNAPSHOT_BUFFER_H_ + +#include +#include + +#include "flutter/fml/file.h" +#include "flutter/fml/macros.h" +#include "flutter/fml/mapping.h" +#include "flutter/fml/native_library.h" + +namespace flutter { + +// TODO(chinmaygarde): Replace this with just |fml::Mapping|. +// https://github.com/flutter/flutter/issues/26782 +class DartSnapshotBuffer { + public: + static std::unique_ptr CreateWithSymbolInLibrary( + fml::RefPtr library, + const char* symbol_name); + + static std::unique_ptr CreateWithContentsOfFile( + const fml::UniqueFD& fd, + std::initializer_list protection); + + static std::unique_ptr CreateWithUnmanagedAllocation( + const uint8_t* allocation); + + static std::unique_ptr CreateWithMapping( + std::unique_ptr mapping); + + virtual ~DartSnapshotBuffer(); + + virtual const uint8_t* GetSnapshotPointer() const = 0; + + virtual size_t GetSnapshotSize() const = 0; +}; + +} // namespace flutter + +#endif // FLUTTER_RUNTIME_DART_SNAPSHOT_BUFFER_H_ diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 0872ebd28012a..973d5d8e86eb0 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -371,9 +371,10 @@ DartVM::DartVM(std::shared_ptr vm_data, TRACE_EVENT0("flutter", "Dart_Initialize"); Dart_InitializeParams params = {}; params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION; - params.vm_snapshot_data = vm_data_->GetVMSnapshot().GetDataMapping(); + params.vm_snapshot_data = + vm_data_->GetVMSnapshot().GetData()->GetSnapshotPointer(); params.vm_snapshot_instructions = - vm_data_->GetVMSnapshot().GetInstructionsMapping(); + vm_data_->GetVMSnapshot().GetInstructionsIfPresent(); params.create = reinterpret_cast( DartIsolate::DartIsolateCreateCallback); params.shutdown = reinterpret_cast( From 4688dc7700eb93d29d5009e32365b9da4a8197e4 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Thu, 18 Apr 2019 17:15:04 -0700 Subject: [PATCH 0874/1117] Remove unnecessary DartIO::EntropySource wrapper (#8635) --- lib/io/dart_io.cc | 4 ---- lib/io/dart_io.h | 1 - runtime/dart_vm.cc | 2 +- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/io/dart_io.cc b/lib/io/dart_io.cc index b0f2f0202ae01..70dd8d1f1c630 100644 --- a/lib/io/dart_io.cc +++ b/lib/io/dart_io.cc @@ -21,8 +21,4 @@ void DartIO::InitForIsolate() { } } -bool DartIO::EntropySource(uint8_t* buffer, intptr_t length) { - return dart::bin::GetEntropy(buffer, length); -} - } // namespace flutter diff --git a/lib/io/dart_io.h b/lib/io/dart_io.h index a073a850b1f63..10fe07b514744 100644 --- a/lib/io/dart_io.h +++ b/lib/io/dart_io.h @@ -14,7 +14,6 @@ namespace flutter { class DartIO { public: static void InitForIsolate(); - static bool EntropySource(uint8_t* buffer, intptr_t length); private: FML_DISALLOW_IMPLICIT_CONSTRUCTORS(DartIO); diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 973d5d8e86eb0..27261b623764a 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -383,7 +383,7 @@ DartVM::DartVM(std::shared_ptr vm_data, DartIsolate::DartIsolateCleanupCallback); params.thread_exit = ThreadExitCallback; params.get_service_assets = GetVMServiceAssetsArchiveCallback; - params.entropy_source = DartIO::EntropySource; + params.entropy_source = dart::bin::GetEntropy; char* init_error = Dart_Initialize(¶ms); if (init_error) { FML_LOG(FATAL) << "Error while initializing the Dart VM: " << init_error; From ca31a7c57bada458fa7f5c0d3f36bc1af4ccbc79 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 18 Apr 2019 17:46:32 -0700 Subject: [PATCH 0875/1117] Disable auth codes for Observatory test (#8646) --- shell/testing/observatory/launcher.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/shell/testing/observatory/launcher.dart b/shell/testing/observatory/launcher.dart index 82fdd108f3c74..1e3650abaaa4c 100644 --- a/shell/testing/observatory/launcher.dart +++ b/shell/testing/observatory/launcher.dart @@ -42,6 +42,7 @@ class ShellLauncher { '--observatory-port=0', '--non-interactive', '--run-forever', + '--disable-service-auth-codes', ]; final String shellExecutablePath; final String mainDartPath; From 4ead9c8f99d417c13bc8c51e6e90c66ec52045b6 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 18 Apr 2019 18:54:06 -0700 Subject: [PATCH 0876/1117] Remove unused Settings::ToString. (#8642) This was used in some embedder implementations. But that was a while ago. --- common/settings.cc | 40 ---------------------------------------- common/settings.h | 2 -- 2 files changed, 42 deletions(-) diff --git a/common/settings.cc b/common/settings.cc index 7dae838f4ac7f..12f6bc6386c67 100644 --- a/common/settings.cc +++ b/common/settings.cc @@ -14,44 +14,4 @@ Settings::Settings(const Settings& other) = default; Settings::~Settings() = default; -std::string Settings::ToString() const { - std::stringstream stream; - stream << "Settings: " << std::endl; - stream << "vm_snapshot_data_path: " << vm_snapshot_data_path << std::endl; - stream << "vm_snapshot_instr_path: " << vm_snapshot_instr_path << std::endl; - stream << "isolate_snapshot_data_path: " << isolate_snapshot_data_path - << std::endl; - stream << "isolate_snapshot_instr_path: " << isolate_snapshot_instr_path - << std::endl; - stream << "application_library_path: " << application_library_path - << std::endl; - stream << "temp_directory_path: " << temp_directory_path << std::endl; - stream << "dart_flags:" << std::endl; - for (const auto& dart_flag : dart_flags) { - stream << " " << dart_flag << std::endl; - } - stream << "start_paused: " << start_paused << std::endl; - stream << "trace_skia: " << trace_skia << std::endl; - stream << "trace_startup: " << trace_startup << std::endl; - stream << "trace_systrace: " << trace_systrace << std::endl; - stream << "dump_skp_on_shader_compilation: " << dump_skp_on_shader_compilation - << std::endl; - stream << "endless_trace_buffer: " << endless_trace_buffer << std::endl; - stream << "enable_dart_profiling: " << enable_dart_profiling << std::endl; - stream << "disable_dart_asserts: " << disable_dart_asserts << std::endl; - stream << "enable_observatory: " << enable_observatory << std::endl; - stream << "observatory_port: " << observatory_port << std::endl; - stream << "ipv6: " << ipv6 << std::endl; - stream << "use_test_fonts: " << use_test_fonts << std::endl; - stream << "enable_software_rendering: " << enable_software_rendering - << std::endl; - stream << "log_tag: " << log_tag << std::endl; - stream << "icu_initialization_required: " << icu_initialization_required - << std::endl; - stream << "icu_data_path: " << icu_data_path << std::endl; - stream << "assets_dir: " << assets_dir << std::endl; - stream << "assets_path: " << assets_path << std::endl; - return stream.str(); -} - } // namespace flutter diff --git a/common/settings.h b/common/settings.h index 96a1f8f92c122..1805e363f7f22 100644 --- a/common/settings.h +++ b/common/settings.h @@ -145,8 +145,6 @@ struct Settings { fml::UniqueFD::traits_type::InvalidValue(); std::string assets_path; std::string flx_path; - - std::string ToString() const; }; } // namespace flutter From 1e5f59d4f635331428a5610b826c523a085b0e39 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 18 Apr 2019 18:54:43 -0700 Subject: [PATCH 0877/1117] Reland "Remove DartSnapshotBuffer and dry up snapshot resolution logic". (#8645) This reverts commit 0fcfa0df2aa19947ad73882ab4fb24fc9124e47b. Windows depends on referencing the snapshot symbols directly instead of via dlsym. Something in the way these symbolsa are generated in bin_to_assembly.py is causing them to be inaccessible at runtime. --- ci/licenses_golden/licenses_flutter | 2 - fml/mapping.cc | 41 +++++ fml/mapping.h | 33 +++- runtime/BUILD.gn | 2 - runtime/dart_isolate.cc | 13 +- runtime/dart_snapshot.cc | 263 +++++++++++++--------------- runtime/dart_snapshot.h | 17 +- runtime/dart_snapshot_buffer.cc | 102 ----------- runtime/dart_snapshot_buffer.h | 45 ----- runtime/dart_vm.cc | 5 +- 10 files changed, 208 insertions(+), 315 deletions(-) delete mode 100644 runtime/dart_snapshot_buffer.cc delete mode 100644 runtime/dart_snapshot_buffer.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 265dca257bf06..a323d42e1aee1 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -383,8 +383,6 @@ 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 -FILE: ../../../flutter/runtime/dart_snapshot_buffer.h FILE: ../../../flutter/runtime/dart_vm.cc FILE: ../../../flutter/runtime/dart_vm.h FILE: ../../../flutter/runtime/dart_vm_data.cc diff --git a/fml/mapping.cc b/fml/mapping.cc index 11882b6662bbf..75ca1b396912d 100644 --- a/fml/mapping.cc +++ b/fml/mapping.cc @@ -4,12 +4,18 @@ #include "flutter/fml/mapping.h" +#include + namespace fml { +// FileMapping + uint8_t* FileMapping::GetMutableMapping() { return mutable_mapping_; } +// Data Mapping + DataMapping::DataMapping(std::vector data) : data_(std::move(data)) {} DataMapping::~DataMapping() = default; @@ -22,6 +28,8 @@ const uint8_t* DataMapping::GetMapping() const { return data_.data(); } +// NonOwnedMapping + size_t NonOwnedMapping::GetSize() const { return size_; } @@ -30,4 +38,37 @@ const uint8_t* NonOwnedMapping::GetMapping() const { return data_; } +// Symbol Mapping + +SymbolMapping::SymbolMapping(fml::RefPtr native_library, + const char* symbol_name) + : native_library_(std::move(native_library)) { + if (native_library_ && symbol_name != nullptr) { + mapping_ = native_library_->ResolveSymbol(symbol_name); + + if (mapping_ == nullptr) { + // Apparently, dart_bootstrap seems to account for the Mac behavior of + // requiring the underscore prefixed symbol name on non-Mac platforms as + // well. As a fallback, check the underscore prefixed variant of the + // symbol name and allow callers to not have handle this on a per platform + // toolchain quirk basis. + + std::stringstream underscore_symbol_name; + underscore_symbol_name << "_" << symbol_name; + mapping_ = + native_library_->ResolveSymbol(underscore_symbol_name.str().c_str()); + } + } +} + +SymbolMapping::~SymbolMapping() = default; + +size_t SymbolMapping::GetSize() const { + return 0; +} + +const uint8_t* SymbolMapping::GetMapping() const { + return mapping_; +} + } // namespace fml diff --git a/fml/mapping.h b/fml/mapping.h index 05894a5c219a4..f7e6bbd4231d6 100644 --- a/fml/mapping.h +++ b/fml/mapping.h @@ -13,6 +13,7 @@ #include "flutter/fml/build_config.h" #include "flutter/fml/file.h" #include "flutter/fml/macros.h" +#include "flutter/fml/native_library.h" #include "flutter/fml/unique_fd.h" namespace fml { @@ -31,7 +32,7 @@ class Mapping { FML_DISALLOW_COPY_AND_ASSIGN(Mapping); }; -class FileMapping : public Mapping { +class FileMapping final : public Mapping { public: enum class Protection { kRead, @@ -45,8 +46,10 @@ class FileMapping : public Mapping { ~FileMapping() override; + // |Mapping| size_t GetSize() const override; + // |Mapping| const uint8_t* GetMapping() const override; uint8_t* GetMutableMapping(); @@ -63,14 +66,16 @@ class FileMapping : public Mapping { FML_DISALLOW_COPY_AND_ASSIGN(FileMapping); }; -class DataMapping : public Mapping { +class DataMapping final : public Mapping { public: DataMapping(std::vector data); ~DataMapping() override; + // |Mapping| size_t GetSize() const override; + // |Mapping| const uint8_t* GetMapping() const override; private: @@ -79,13 +84,15 @@ class DataMapping : public Mapping { FML_DISALLOW_COPY_AND_ASSIGN(DataMapping); }; -class NonOwnedMapping : public Mapping { +class NonOwnedMapping final : public Mapping { public: NonOwnedMapping(const uint8_t* data, size_t size) : data_(data), size_(size) {} + // |Mapping| size_t GetSize() const override; + // |Mapping| const uint8_t* GetMapping() const override; private: @@ -95,6 +102,26 @@ class NonOwnedMapping : public Mapping { FML_DISALLOW_COPY_AND_ASSIGN(NonOwnedMapping); }; +class SymbolMapping final : public Mapping { + public: + SymbolMapping(fml::RefPtr native_library, + const char* symbol_name); + + ~SymbolMapping() override; + + // |Mapping| + size_t GetSize() const override; + + // |Mapping| + const uint8_t* GetMapping() const override; + + private: + fml::RefPtr native_library_; + const uint8_t* mapping_ = nullptr; + + FML_DISALLOW_COPY_AND_ASSIGN(SymbolMapping); +}; + } // namespace fml #endif // FLUTTER_FML_MAPPING_H_ diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index 9d6f0d80ea623..bcfd7e399d532 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -46,8 +46,6 @@ source_set("runtime") { "dart_service_isolate.h", "dart_snapshot.cc", "dart_snapshot.h", - "dart_snapshot_buffer.cc", - "dart_snapshot_buffer.h", "dart_vm.cc", "dart_vm.h", "dart_vm_data.cc", diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 20b7c960ee26e..8de6bca542c12 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -679,14 +679,11 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( Dart_Isolate isolate = Dart_CreateIsolate( advisory_script_uri, // advisory_script_entrypoint, // - (*embedder_isolate) - ->GetIsolateSnapshot() - ->GetData() - ->GetSnapshotPointer(), - (*embedder_isolate)->GetIsolateSnapshot()->GetInstructionsIfPresent(), - (*embedder_isolate)->GetSharedSnapshot()->GetDataIfPresent(), - (*embedder_isolate)->GetSharedSnapshot()->GetInstructionsIfPresent(), - flags, embedder_isolate.get(), error); + (*embedder_isolate)->GetIsolateSnapshot()->GetDataMapping(), + (*embedder_isolate)->GetIsolateSnapshot()->GetInstructionsMapping(), + (*embedder_isolate)->GetSharedSnapshot()->GetDataMapping(), + (*embedder_isolate)->GetSharedSnapshot()->GetInstructionsMapping(), flags, + embedder_isolate.get(), error); if (isolate == nullptr) { FML_DLOG(ERROR) << *error; diff --git a/runtime/dart_snapshot.cc b/runtime/dart_snapshot.cc index c2d6d40017164..fb49f990a4f3c 100644 --- a/runtime/dart_snapshot.cc +++ b/runtime/dart_snapshot.cc @@ -10,7 +10,6 @@ #include "flutter/fml/paths.h" #include "flutter/fml/trace_event.h" #include "flutter/lib/snapshot/snapshot.h" -#include "flutter/runtime/dart_snapshot_buffer.h" #include "flutter/runtime/dart_vm.h" namespace flutter { @@ -21,151 +20,154 @@ const char* DartSnapshot::kIsolateDataSymbol = "kDartIsolateSnapshotData"; const char* DartSnapshot::kIsolateInstructionsSymbol = "kDartIsolateSnapshotInstructions"; -#if defined(OS_ANDROID) -// When assembling the .S file of the application, dart_bootstrap will prefix -// symbols via an `_` to ensure Mac's `dlsym()` can find it (Mac ABI prefixes C -// symbols with underscores). -// But Linux ABI does not prefix C symbols with underscores, so we have to -// explicitly look up the prefixed version. -#define SYMBOL_PREFIX "_" -#else -#define SYMBOL_PREFIX "" -#endif - -static const char* kVMDataSymbolSo = SYMBOL_PREFIX "kDartVmSnapshotData"; -static const char* kVMInstructionsSymbolSo = - SYMBOL_PREFIX "kDartVmSnapshotInstructions"; -static const char* kIsolateDataSymbolSo = - SYMBOL_PREFIX "kDartIsolateSnapshotData"; -static const char* kIsolateInstructionsSymbolSo = - SYMBOL_PREFIX "kDartIsolateSnapshotInstructions"; - -std::unique_ptr ResolveVMData(const Settings& settings) { - if (settings.vm_snapshot_data) { - return DartSnapshotBuffer::CreateWithMapping(settings.vm_snapshot_data()); +static std::unique_ptr GetFileMapping( + const std::string path, + bool executable) { + fml::UniqueFD file = + fml::OpenFile(path.c_str(), // file path + false, // create file if necessary + fml::FilePermission::kRead // file permissions + ); + + if (!file.is_valid()) { + return nullptr; } - if (settings.vm_snapshot_data_path.size() > 0) { - if (auto source = DartSnapshotBuffer::CreateWithContentsOfFile( - fml::OpenFile(settings.vm_snapshot_data_path.c_str(), false, - fml::FilePermission::kRead), - {fml::FileMapping::Protection::kRead})) { - return source; - } + using Prot = fml::FileMapping::Protection; + std::unique_ptr mapping; + if (executable) { + mapping = std::make_unique( + file, std::initializer_list{Prot::kRead, Prot::kExecute}); + } else { + mapping = std::make_unique( + file, std::initializer_list{Prot::kRead}); } - if (settings.application_library_path.size() > 0) { - auto shared_library = - fml::NativeLibrary::Create(settings.application_library_path.c_str()); - if (auto source = DartSnapshotBuffer::CreateWithSymbolInLibrary( - shared_library, kVMDataSymbolSo)) { - return source; - } + if (mapping->GetSize() == 0 || mapping->GetMapping() == nullptr) { + return nullptr; } - auto loaded_process = fml::NativeLibrary::CreateForCurrentProcess(); - return DartSnapshotBuffer::CreateWithSymbolInLibrary( - loaded_process, DartSnapshot::kVMDataSymbol); + return mapping; } -std::unique_ptr ResolveVMInstructions( - const Settings& settings) { - if (settings.vm_snapshot_instr) { - return DartSnapshotBuffer::CreateWithMapping(settings.vm_snapshot_instr()); +// The first party embedders don't yet use the stable embedder API and depend on +// the engine figuring out the locations of the various heap and instructions +// buffers. Consequently, the engine had baked in opinions about where these +// buffers would reside and how they would be packaged (examples, in an external +// dylib, in the same dylib, at a path, at a path relative to and FD, etc..). As +// the needs of the platforms changed, the lack of an API meant that the engine +// had to be patched to look for new fields in the settings object. This grew +// untenable and with the addition of the new Fuchsia embedder and the generic C +// embedder API, embedders could specify the mapping directly. Once everyone +// moves to the embedder API, this method can effectively be reduced to just +// invoking the embedder_mapping_callback directly. +static std::shared_ptr SearchMapping( + MappingCallback embedder_mapping_callback, + const std::string& file_path, + const std::string& native_library_path, + const char* native_library_symbol_name, + bool is_executable) { + // Ask the embedder. There is no fallback as we expect the embedders (via + // their embedding APIs) to just specify the mappings directly. + if (embedder_mapping_callback) { + return embedder_mapping_callback(); } - if (settings.vm_snapshot_instr_path.size() > 0) { - if (auto source = DartSnapshotBuffer::CreateWithContentsOfFile( - fml::OpenFile(settings.vm_snapshot_instr_path.c_str(), false, - fml::FilePermission::kRead), - {fml::FileMapping::Protection::kExecute})) { - return source; + // Attempt to open file at path specified. + if (file_path.size() > 0) { + if (auto file_mapping = GetFileMapping(file_path, is_executable)) { + return file_mapping; } } - if (settings.application_library_path.size() > 0) { - auto library = - fml::NativeLibrary::Create(settings.application_library_path.c_str()); - if (auto source = DartSnapshotBuffer::CreateWithSymbolInLibrary( - library, kVMInstructionsSymbolSo)) { - return source; + // Look in application specified native library if specified. + if (native_library_path.size() > 0) { + auto native_library = + fml::NativeLibrary::Create(native_library_path.c_str()); + auto symbol_mapping = std::make_unique( + native_library, native_library_symbol_name); + if (symbol_mapping->GetMapping() != nullptr) { + return symbol_mapping; } } - auto loaded_process = fml::NativeLibrary::CreateForCurrentProcess(); - return DartSnapshotBuffer::CreateWithSymbolInLibrary( - loaded_process, DartSnapshot::kVMInstructionsSymbol); -} - -std::unique_ptr ResolveIsolateData( - const Settings& settings) { - if (settings.isolate_snapshot_data) { - return DartSnapshotBuffer::CreateWithMapping( - settings.isolate_snapshot_data()); - } - - if (settings.isolate_snapshot_data_path.size() > 0) { - if (auto source = DartSnapshotBuffer::CreateWithContentsOfFile( - fml::OpenFile(settings.isolate_snapshot_data_path.c_str(), false, - fml::FilePermission::kRead), - {fml::FileMapping::Protection::kRead})) { - return source; + // Look inside the currently loaded process. + { + auto loaded_process = fml::NativeLibrary::CreateForCurrentProcess(); + auto symbol_mapping = std::make_unique( + loaded_process, native_library_symbol_name); + if (symbol_mapping->GetMapping() != nullptr) { + return symbol_mapping; } } - if (settings.application_library_path.size() > 0) { - auto library = - fml::NativeLibrary::Create(settings.application_library_path.c_str()); - if (auto source = DartSnapshotBuffer::CreateWithSymbolInLibrary( - library, kIsolateDataSymbolSo)) { - return source; - } - } - - auto loaded_process = fml::NativeLibrary::CreateForCurrentProcess(); - return DartSnapshotBuffer::CreateWithSymbolInLibrary( - loaded_process, DartSnapshot::kIsolateDataSymbol); + return nullptr; } -std::unique_ptr ResolveIsolateInstructions( +static std::shared_ptr ResolveVMData( const Settings& settings) { - if (settings.isolate_snapshot_data) { - return DartSnapshotBuffer::CreateWithMapping( - settings.isolate_snapshot_instr()); - } +#if OS_WIN + return std::make_unique(kDartVmSnapshotData, 0); +#else // OS_WIN + return SearchMapping( + settings.vm_snapshot_data, // embedder_mapping_callback + settings.vm_snapshot_data_path, // file_path + settings.application_library_path, // native_library_path + DartSnapshot::kVMDataSymbol, // native_library_symbol_name + false // is_executable + ); +#endif // OS_WIN +} - if (settings.isolate_snapshot_instr_path.size() > 0) { - if (auto source = DartSnapshotBuffer::CreateWithContentsOfFile( - fml::OpenFile(settings.isolate_snapshot_instr_path.c_str(), false, - fml::FilePermission::kRead), - {fml::FileMapping::Protection::kExecute})) { - return source; - } - } +static std::shared_ptr ResolveVMInstructions( + const Settings& settings) { +#if OS_WIN + return std::make_unique(kDartVmSnapshotInstructions, 0); +#else // OS_WIN + return SearchMapping( + settings.vm_snapshot_instr, // embedder_mapping_callback + settings.vm_snapshot_instr_path, // file_path + settings.application_library_path, // native_library_path + DartSnapshot::kVMInstructionsSymbol, // native_library_symbol_name + true // is_executable + ); +#endif // OS_WIN +} - if (settings.application_library_path.size() > 0) { - auto library = - fml::NativeLibrary::Create(settings.application_library_path.c_str()); - if (auto source = DartSnapshotBuffer::CreateWithSymbolInLibrary( - library, kIsolateInstructionsSymbolSo)) { - return source; - } - } +static std::shared_ptr ResolveIsolateData( + const Settings& settings) { +#if OS_WIN + return std::make_unique(kDartIsolateSnapshotData, 0); +#else // OS_WIN + return SearchMapping( + settings.isolate_snapshot_data, // embedder_mapping_callback + settings.isolate_snapshot_data_path, // file_path + settings.application_library_path, // native_library_path + DartSnapshot::kIsolateDataSymbol, // native_library_symbol_name + false // is_executable + ); +#endif // OS_WIN +} - auto loaded_process = fml::NativeLibrary::CreateForCurrentProcess(); - return DartSnapshotBuffer::CreateWithSymbolInLibrary( - loaded_process, DartSnapshot::kIsolateInstructionsSymbol); +static std::shared_ptr ResolveIsolateInstructions( + const Settings& settings) { +#if OS_WIN + return std::make_unique( + kDartIsolateSnapshotInstructions, 0); +#else // OS_WIN + return SearchMapping( + settings.isolate_snapshot_instr, // embedder_mapping_callback + settings.isolate_snapshot_instr_path, // file_path + settings.application_library_path, // native_library_path + DartSnapshot::kIsolateInstructionsSymbol, // native_library_symbol_name + true // is_executable + ); +#endif // OS_WIN } fml::RefPtr DartSnapshot::VMSnapshotFromSettings( const Settings& settings) { TRACE_EVENT0("flutter", "DartSnapshot::VMSnapshotFromSettings"); -#if OS_WIN - return fml::MakeRefCounted( - DartSnapshotBuffer::CreateWithUnmanagedAllocation(kDartVmSnapshotData), - DartSnapshotBuffer::CreateWithUnmanagedAllocation( - kDartVmSnapshotInstructions)); -#else // OS_WIN auto snapshot = fml::MakeRefCounted(ResolveVMData(settings), // ResolveVMInstructions(settings) // @@ -174,19 +176,11 @@ fml::RefPtr DartSnapshot::VMSnapshotFromSettings( return snapshot; } return nullptr; -#endif // OS_WIN } fml::RefPtr DartSnapshot::IsolateSnapshotFromSettings( const Settings& settings) { TRACE_EVENT0("flutter", "DartSnapshot::IsolateSnapshotFromSettings"); -#if OS_WIN - return fml::MakeRefCounted( - DartSnapshotBuffer::CreateWithUnmanagedAllocation( - kDartIsolateSnapshotData), - DartSnapshotBuffer::CreateWithUnmanagedAllocation( - kDartIsolateSnapshotInstructions)); -#else // OS_WIN auto snapshot = fml::MakeRefCounted(ResolveIsolateData(settings), // ResolveIsolateInstructions(settings) // @@ -195,15 +189,14 @@ fml::RefPtr DartSnapshot::IsolateSnapshotFromSettings( return snapshot; } return nullptr; -#endif } fml::RefPtr DartSnapshot::Empty() { return fml::MakeRefCounted(nullptr, nullptr); } -DartSnapshot::DartSnapshot(std::unique_ptr data, - std::unique_ptr instructions) +DartSnapshot::DartSnapshot(std::shared_ptr data, + std::shared_ptr instructions) : data_(std::move(data)), instructions_(std::move(instructions)) {} DartSnapshot::~DartSnapshot() = default; @@ -216,20 +209,12 @@ bool DartSnapshot::IsValidForAOT() const { return data_ && instructions_; } -const DartSnapshotBuffer* DartSnapshot::GetData() const { - return data_.get(); -} - -const DartSnapshotBuffer* DartSnapshot::GetInstructions() const { - return instructions_.get(); -} - -const uint8_t* DartSnapshot::GetDataIfPresent() const { - return data_ ? data_->GetSnapshotPointer() : nullptr; +const uint8_t* DartSnapshot::GetDataMapping() const { + return data_ ? data_->GetMapping() : nullptr; } -const uint8_t* DartSnapshot::GetInstructionsIfPresent() const { - return instructions_ ? instructions_->GetSnapshotPointer() : nullptr; +const uint8_t* DartSnapshot::GetInstructionsMapping() const { + return instructions_ ? instructions_->GetMapping() : nullptr; } } // namespace flutter diff --git a/runtime/dart_snapshot.h b/runtime/dart_snapshot.h index 29ab3f035b54b..9e5f1a551e577 100644 --- a/runtime/dart_snapshot.h +++ b/runtime/dart_snapshot.h @@ -11,7 +11,6 @@ #include "flutter/common/settings.h" #include "flutter/fml/macros.h" #include "flutter/fml/memory/ref_counted.h" -#include "flutter/runtime/dart_snapshot_buffer.h" namespace flutter { @@ -34,20 +33,16 @@ class DartSnapshot : public fml::RefCountedThreadSafe { bool IsValidForAOT() const; - const DartSnapshotBuffer* GetData() const; + const uint8_t* GetDataMapping() const; - const DartSnapshotBuffer* GetInstructions() const; - - const uint8_t* GetDataIfPresent() const; - - const uint8_t* GetInstructionsIfPresent() const; + const uint8_t* GetInstructionsMapping() const; private: - std::unique_ptr data_; - std::unique_ptr instructions_; + std::shared_ptr data_; + std::shared_ptr instructions_; - DartSnapshot(std::unique_ptr data, - std::unique_ptr instructions); + DartSnapshot(std::shared_ptr data, + std::shared_ptr instructions); ~DartSnapshot(); diff --git a/runtime/dart_snapshot_buffer.cc b/runtime/dart_snapshot_buffer.cc deleted file mode 100644 index fcd71e9500454..0000000000000 --- a/runtime/dart_snapshot_buffer.cc +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2013 The Flutter 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_snapshot_buffer.h" - -#include - -#include "flutter/fml/mapping.h" - -namespace flutter { - -class NativeLibrarySnapshotBuffer final : public DartSnapshotBuffer { - public: - NativeLibrarySnapshotBuffer(fml::RefPtr library, - const char* symbol_name) - : library_(std::move(library)) { - if (library_) { - symbol_ = library_->ResolveSymbol(symbol_name); - } - } - - const uint8_t* GetSnapshotPointer() const override { return symbol_; } - - size_t GetSnapshotSize() const override { return 0; } - - private: - fml::RefPtr library_; - const uint8_t* symbol_ = nullptr; - - FML_DISALLOW_COPY_AND_ASSIGN(NativeLibrarySnapshotBuffer); -}; - -class MappingBuffer final : public DartSnapshotBuffer { - public: - MappingBuffer(std::unique_ptr mapping) - : mapping_(std::move(mapping)) { - FML_DCHECK(mapping_); - } - - const uint8_t* GetSnapshotPointer() const override { - return mapping_->GetMapping(); - } - - size_t GetSnapshotSize() const override { return mapping_->GetSize(); } - - private: - std::unique_ptr mapping_; - - FML_DISALLOW_COPY_AND_ASSIGN(MappingBuffer); -}; - -class UnmanagedAllocation final : public DartSnapshotBuffer { - public: - UnmanagedAllocation(const uint8_t* allocation) : allocation_(allocation) {} - - const uint8_t* GetSnapshotPointer() const override { return allocation_; } - - size_t GetSnapshotSize() const override { return 0; } - - private: - const uint8_t* allocation_; - - FML_DISALLOW_COPY_AND_ASSIGN(UnmanagedAllocation); -}; - -std::unique_ptr -DartSnapshotBuffer::CreateWithSymbolInLibrary( - fml::RefPtr library, - const char* symbol_name) { - auto source = std::make_unique( - std::move(library), symbol_name); - return source->GetSnapshotPointer() == nullptr ? nullptr : std::move(source); -} - -std::unique_ptr -DartSnapshotBuffer::CreateWithContentsOfFile( - const fml::UniqueFD& fd, - std::initializer_list protection) { - return CreateWithMapping(std::make_unique(fd, protection)); -} - -std::unique_ptr DartSnapshotBuffer::CreateWithMapping( - std::unique_ptr mapping) { - if (mapping == nullptr || mapping->GetSize() == 0 || - mapping->GetMapping() == nullptr) { - return nullptr; - } - return std::make_unique(std::move(mapping)); -} - -std::unique_ptr -DartSnapshotBuffer::CreateWithUnmanagedAllocation(const uint8_t* allocation) { - if (allocation == nullptr) { - return nullptr; - } - return std::make_unique(allocation); -} - -DartSnapshotBuffer::~DartSnapshotBuffer() = default; - -} // namespace flutter diff --git a/runtime/dart_snapshot_buffer.h b/runtime/dart_snapshot_buffer.h deleted file mode 100644 index 2c5887ad7e3bf..0000000000000 --- a/runtime/dart_snapshot_buffer.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2013 The Flutter 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_SNAPSHOT_BUFFER_H_ -#define FLUTTER_RUNTIME_DART_SNAPSHOT_BUFFER_H_ - -#include -#include - -#include "flutter/fml/file.h" -#include "flutter/fml/macros.h" -#include "flutter/fml/mapping.h" -#include "flutter/fml/native_library.h" - -namespace flutter { - -// TODO(chinmaygarde): Replace this with just |fml::Mapping|. -// https://github.com/flutter/flutter/issues/26782 -class DartSnapshotBuffer { - public: - static std::unique_ptr CreateWithSymbolInLibrary( - fml::RefPtr library, - const char* symbol_name); - - static std::unique_ptr CreateWithContentsOfFile( - const fml::UniqueFD& fd, - std::initializer_list protection); - - static std::unique_ptr CreateWithUnmanagedAllocation( - const uint8_t* allocation); - - static std::unique_ptr CreateWithMapping( - std::unique_ptr mapping); - - virtual ~DartSnapshotBuffer(); - - virtual const uint8_t* GetSnapshotPointer() const = 0; - - virtual size_t GetSnapshotSize() const = 0; -}; - -} // namespace flutter - -#endif // FLUTTER_RUNTIME_DART_SNAPSHOT_BUFFER_H_ diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 27261b623764a..d1d19920d7094 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -371,10 +371,9 @@ DartVM::DartVM(std::shared_ptr vm_data, TRACE_EVENT0("flutter", "Dart_Initialize"); Dart_InitializeParams params = {}; params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION; - params.vm_snapshot_data = - vm_data_->GetVMSnapshot().GetData()->GetSnapshotPointer(); + params.vm_snapshot_data = vm_data_->GetVMSnapshot().GetDataMapping(); params.vm_snapshot_instructions = - vm_data_->GetVMSnapshot().GetInstructionsIfPresent(); + vm_data_->GetVMSnapshot().GetInstructionsMapping(); params.create = reinterpret_cast( DartIsolate::DartIsolateCreateCallback); params.shutdown = reinterpret_cast( From 25c33dc9d5514bd750b4275d1754aad6a0c52aaf Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 19 Apr 2019 00:58:24 -0400 Subject: [PATCH 0878/1117] Roll src/third_party/skia 9b67802a4cd0..8cdae55bf1ac (1 commits) (#8647) https://skia.googlesource.com/skia.git/%2Blog/9b67802a4cd0..8cdae55bf1ac git log 9b67802a4cd01fbbe5fcbe9f4117ff68e7b8e751..8cdae55bf1ac0270b8f7c92f131ec9a18957e84d --date=short --no-merges --format=%ad %ae %s 2019-04-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll ../src f968f64cdf27..a55917cb9824 (433 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 7b2e425312ceb..4d0024f666cdf 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': '9b67802a4cd01fbbe5fcbe9f4117ff68e7b8e751', + 'skia_revision': '8cdae55bf1ac0270b8f7c92f131ec9a18957e84d', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index d249ef4389214..225bf5b3e75c0 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ea04142847537ef9dc501d7a2cdac241 +Signature: 8d290c85f27d8d49707c3cc25cf296d6 UNUSED LICENSES: From 8f0af31ecb11baeba2d168654ef01cf5209a7ede Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 19 Apr 2019 04:28:24 -0400 Subject: [PATCH 0879/1117] Roll src/third_party/skia 8cdae55bf1ac..e8a33ec6d084 (3 commits) (#8648) https://skia.googlesource.com/skia.git/%2Blog/8cdae55bf1ac..e8a33ec6d084 git log 8cdae55bf1ac0270b8f7c92f131ec9a18957e84d..e8a33ec6d084fef3200eb8732b453734f4b391ca --date=short --no-merges --format=%ad %ae %s 2019-04-19 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-04-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/angle2 82bcffa78747..145ec7fa7c81 (10 commits) 2019-04-19 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader abaecd5f2ba7..a16238df3f28 (12 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4d0024f666cdf..75611b2ee0c21 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': '8cdae55bf1ac0270b8f7c92f131ec9a18957e84d', + 'skia_revision': 'e8a33ec6d084fef3200eb8732b453734f4b391ca', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 225bf5b3e75c0..c352225677229 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8d290c85f27d8d49707c3cc25cf296d6 +Signature: 232c254841bebc03c812de3e2db955de UNUSED LICENSES: From 30c23e60424df5c1e28f39b8ee457c3f18026a8d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 19 Apr 2019 09:45:51 -0400 Subject: [PATCH 0880/1117] Roll src/third_party/skia e8a33ec6d084..e5763787f920 (1 commits) (#8650) https://skia.googlesource.com/skia.git/%2Blog/e8a33ec6d084..e5763787f920 git log e8a33ec6d084fef3200eb8732b453734f4b391ca..e5763787f920c0c3a30527a596a6c207eb1b220b --date=short --no-merges --format=%ad %ae %s 2019-04-17 robertphillips@google.com Allow GrShadowRRectOp::Make to fail The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 75611b2ee0c21..513d16ccaaefe 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': 'e8a33ec6d084fef3200eb8732b453734f4b391ca', + 'skia_revision': 'e5763787f920c0c3a30527a596a6c207eb1b220b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index c352225677229..1564e750d6829 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 232c254841bebc03c812de3e2db955de +Signature: 9e4254bcfa15f7a83fbf7626e8d7d94c UNUSED LICENSES: From 7e37080ec0d447d1a126e5fba06f73a4208ce1ea Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 19 Apr 2019 10:01:44 -0700 Subject: [PATCH 0881/1117] Allow specifying the Mac SDK path as an environment variable to //flutter/tools/gn (#8643) As long as the Mac SDK is i386 ready, engine developers should be able to use the latest version of Xcode to build all artifacts. This issue goes away when gen_snapshot migrates to x64. --- tools/gn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/gn b/tools/gn index c589e82e09320..ce9b7a6e8e5b1 100755 --- a/tools/gn +++ b/tools/gn @@ -237,6 +237,8 @@ def to_gn_args(args): if sys.platform == 'darwin': gn_args['mac_sdk_path'] = args.mac_sdk_path + if gn_args['mac_sdk_path'] == '': + gn_args['mac_sdk_path'] = os.getenv('FLUTTER_MAC_SDK_PATH', '') return gn_args @@ -294,7 +296,8 @@ def parse_args(args): parser.add_argument('--no-full-dart-sdk', dest='full_dart_sdk', action='store_false') parser.add_argument('--mac-sdk-path', default='', type=str, - help='On the mac, the SDK is inferred from the Xcode location unless this flag is specified.') + help='On the mac, the SDK is inferred from the Xcode location unless this flag is specified. ' + + ' Setting the FLUTTER_MAC_SDK_PATH environment variable achieves the same effect.') return parser.parse_args(args) From eaa0e9c706998eb579068ee9a69321896ff5963c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 19 Apr 2019 13:15:04 -0400 Subject: [PATCH 0882/1117] Roll src/third_party/skia e5763787f920..cc5d3e09e394 (3 commits) (#8651) https://skia.googlesource.com/skia.git/%2Blog/e5763787f920..cc5d3e09e394 git log e5763787f920c0c3a30527a596a6c207eb1b220b..cc5d3e09e39410841ba6e8866680257a92ee5205 --date=short --no-merges --format=%ad %ae %s 2019-04-19 ethannicholas@google.com Revert "Revert "added more SPIR-V RelaxedPrecision decorations"" 2019-04-19 reed@google.com use char-to-glyph cache in freetype typeface 2019-04-19 brianosman@google.com Remove SK_TREAT_COLINEAR_DIAGONAL_POINTS_AS_CONCAVE The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 513d16ccaaefe..c51dd312d89bf 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': 'e5763787f920c0c3a30527a596a6c207eb1b220b', + 'skia_revision': 'cc5d3e09e39410841ba6e8866680257a92ee5205', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 1564e750d6829..30358fe45fdc6 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 9e4254bcfa15f7a83fbf7626e8d7d94c +Signature: b81db5fcd6895228a93af32d2315e2c1 UNUSED LICENSES: From 5fed72520206a87694561100d8a7fdff9a187679 Mon Sep 17 00:00:00 2001 From: Vyacheslav Egorov Date: Fri, 19 Apr 2019 19:48:51 +0200 Subject: [PATCH 0883/1117] Roll buildroot to 380d0ed5c3399d5a2aaac4a66d98e3a3fda77c31 (#8649) 380d0ed Build host Dart binary with -march=core2 on Mac OS X. (#235) --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index c51dd312d89bf..69195a2038d99 100644 --- a/DEPS +++ b/DEPS @@ -121,7 +121,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'ce7b5c786a12927c9e0b4543af267d48c52e0b3a', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '380d0ed5c3399d5a2aaac4a66d98e3a3fda77c31', # Fuchsia compatibility # From 6257dfeb53a7cd81aaeabec737558ff8a1fda071 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 19 Apr 2019 12:48:53 -0700 Subject: [PATCH 0884/1117] Add factory methods to FileMapping that make it easy to create common mappings. (#8652) The GetMapping calls removed in this patch had the same code and had to be repeated across different test harnesses as well as in dart_snapshot.cc. Just make this a factory method so the code is less verbose. --- fml/mapping.cc | 49 +++++++++++++++++++ fml/mapping.h | 13 +++++ runtime/dart_snapshot.cc | 26 ++-------- runtime/runtime_test.cc | 39 +++------------ shell/common/shell_test.cc | 39 +++------------ .../embedder/tests/embedder_context.cc | 37 +++----------- 6 files changed, 87 insertions(+), 116 deletions(-) diff --git a/fml/mapping.cc b/fml/mapping.cc index 75ca1b396912d..7ffacfb493890 100644 --- a/fml/mapping.cc +++ b/fml/mapping.cc @@ -14,6 +14,55 @@ uint8_t* FileMapping::GetMutableMapping() { return mutable_mapping_; } +std::unique_ptr FileMapping::CreateReadOnly( + const std::string& path) { + return CreateReadOnly(OpenFile(path.c_str(), false, FilePermission::kRead), + ""); +} + +std::unique_ptr FileMapping::CreateReadOnly( + const fml::UniqueFD& base_fd, + const std::string& sub_path) { + if (sub_path.size() != 0) { + return CreateReadOnly( + OpenFile(base_fd, sub_path.c_str(), false, FilePermission::kRead), ""); + } + + auto mapping = std::make_unique( + base_fd, std::initializer_list{Protection::kRead}); + + if (mapping->GetSize() == 0 || mapping->GetMapping() == nullptr) { + return nullptr; + } + + return mapping; +} + +std::unique_ptr FileMapping::CreateReadExecute( + const std::string& path) { + return CreateReadExecute( + OpenFile(path.c_str(), false, FilePermission::kRead)); +} + +std::unique_ptr FileMapping::CreateReadExecute( + const fml::UniqueFD& base_fd, + const std::string& sub_path) { + if (sub_path.size() != 0) { + return CreateReadExecute( + OpenFile(base_fd, sub_path.c_str(), false, FilePermission::kRead), ""); + } + + auto mapping = std::make_unique( + base_fd, std::initializer_list{Protection::kRead, + Protection::kExecute}); + + if (mapping->GetSize() == 0 || mapping->GetMapping() == nullptr) { + return nullptr; + } + + return mapping; +} + // Data Mapping DataMapping::DataMapping(std::vector data) : data_(std::move(data)) {} diff --git a/fml/mapping.h b/fml/mapping.h index f7e6bbd4231d6..90b88cc15840c 100644 --- a/fml/mapping.h +++ b/fml/mapping.h @@ -46,6 +46,19 @@ class FileMapping final : public Mapping { ~FileMapping() override; + static std::unique_ptr CreateReadOnly(const std::string& path); + + static std::unique_ptr CreateReadOnly( + const fml::UniqueFD& base_fd, + const std::string& sub_path = ""); + + static std::unique_ptr CreateReadExecute( + const std::string& path); + + static std::unique_ptr CreateReadExecute( + const fml::UniqueFD& base_fd, + const std::string& sub_path = ""); + // |Mapping| size_t GetSize() const override; diff --git a/runtime/dart_snapshot.cc b/runtime/dart_snapshot.cc index fb49f990a4f3c..c666d1c236e62 100644 --- a/runtime/dart_snapshot.cc +++ b/runtime/dart_snapshot.cc @@ -21,33 +21,13 @@ const char* DartSnapshot::kIsolateInstructionsSymbol = "kDartIsolateSnapshotInstructions"; static std::unique_ptr GetFileMapping( - const std::string path, + const std::string& path, bool executable) { - fml::UniqueFD file = - fml::OpenFile(path.c_str(), // file path - false, // create file if necessary - fml::FilePermission::kRead // file permissions - ); - - if (!file.is_valid()) { - return nullptr; - } - - using Prot = fml::FileMapping::Protection; - std::unique_ptr mapping; if (executable) { - mapping = std::make_unique( - file, std::initializer_list{Prot::kRead, Prot::kExecute}); + return fml::FileMapping::CreateReadExecute(path); } else { - mapping = std::make_unique( - file, std::initializer_list{Prot::kRead}); + return fml::FileMapping::CreateReadOnly(path); } - - if (mapping->GetSize() == 0 || mapping->GetMapping() == nullptr) { - return nullptr; - } - - return mapping; } // The first party embedders don't yet use the stable embedder API and depend on diff --git a/runtime/runtime_test.cc b/runtime/runtime_test.cc index 6f56b2f743f26..97d42bc431418 100644 --- a/runtime/runtime_test.cc +++ b/runtime/runtime_test.cc @@ -15,32 +15,6 @@ RuntimeTest::RuntimeTest() RuntimeTest::~RuntimeTest() = default; -static std::unique_ptr GetMapping(const fml::UniqueFD& directory, - const char* path, - bool executable) { - fml::UniqueFD file = fml::OpenFile(directory, path, false /* create */, - fml::FilePermission::kRead); - if (!file.is_valid()) { - return nullptr; - } - - using Prot = fml::FileMapping::Protection; - std::unique_ptr mapping; - if (executable) { - mapping = std::make_unique( - file, std::initializer_list{Prot::kRead, Prot::kExecute}); - } else { - mapping = std::make_unique( - file, std::initializer_list{Prot::kRead}); - } - - if (mapping->GetSize() == 0 || mapping->GetMapping() == nullptr) { - return nullptr; - } - - return mapping; -} - void RuntimeTest::SetSnapshotsAndAssets(Settings& settings) { if (!assets_dir_.is_valid()) { return; @@ -52,27 +26,30 @@ void RuntimeTest::SetSnapshotsAndAssets(Settings& settings) { // don't need to be explicitly suppiled by the embedder. if (DartVM::IsRunningPrecompiledCode()) { settings.vm_snapshot_data = [this]() { - return GetMapping(assets_dir_, "vm_snapshot_data", false); + return fml::FileMapping::CreateReadOnly(assets_dir_, "vm_snapshot_data"); }; settings.isolate_snapshot_data = [this]() { - return GetMapping(assets_dir_, "isolate_snapshot_data", false); + return fml::FileMapping::CreateReadOnly(assets_dir_, + "isolate_snapshot_data"); }; if (DartVM::IsRunningPrecompiledCode()) { settings.vm_snapshot_instr = [this]() { - return GetMapping(assets_dir_, "vm_snapshot_instr", true); + return fml::FileMapping::CreateReadExecute(assets_dir_, + "vm_snapshot_instr"); }; settings.isolate_snapshot_instr = [this]() { - return GetMapping(assets_dir_, "isolate_snapshot_instr", true); + return fml::FileMapping::CreateReadExecute(assets_dir_, + "isolate_snapshot_instr"); }; } } else { settings.application_kernels = [this]() { std::vector> kernel_mappings; kernel_mappings.emplace_back( - GetMapping(assets_dir_, "kernel_blob.bin", false)); + fml::FileMapping::CreateReadOnly(assets_dir_, "kernel_blob.bin")); return kernel_mappings; }; } diff --git a/shell/common/shell_test.cc b/shell/common/shell_test.cc index 9a9c16db41239..bf70163ad3dd8 100644 --- a/shell/common/shell_test.cc +++ b/shell/common/shell_test.cc @@ -18,32 +18,6 @@ ShellTest::ShellTest() ShellTest::~ShellTest() = default; -static std::unique_ptr GetMapping(const fml::UniqueFD& directory, - const char* path, - bool executable) { - fml::UniqueFD file = fml::OpenFile(directory, path, false /* create */, - fml::FilePermission::kRead); - if (!file.is_valid()) { - return nullptr; - } - - using Prot = fml::FileMapping::Protection; - std::unique_ptr mapping; - if (executable) { - mapping = std::make_unique( - file, std::initializer_list{Prot::kRead, Prot::kExecute}); - } else { - mapping = std::make_unique( - file, std::initializer_list{Prot::kRead}); - } - - if (mapping->GetSize() == 0 || mapping->GetMapping() == nullptr) { - return nullptr; - } - - return mapping; -} - void ShellTest::SetSnapshotsAndAssets(Settings& settings) { if (!assets_dir_.is_valid()) { return; @@ -55,27 +29,30 @@ void ShellTest::SetSnapshotsAndAssets(Settings& settings) { // don't need to be explicitly suppiled by the embedder. if (DartVM::IsRunningPrecompiledCode()) { settings.vm_snapshot_data = [this]() { - return GetMapping(assets_dir_, "vm_snapshot_data", false); + return fml::FileMapping::CreateReadOnly(assets_dir_, "vm_snapshot_data"); }; settings.isolate_snapshot_data = [this]() { - return GetMapping(assets_dir_, "isolate_snapshot_data", false); + return fml::FileMapping::CreateReadOnly(assets_dir_, + "isolate_snapshot_data"); }; if (DartVM::IsRunningPrecompiledCode()) { settings.vm_snapshot_instr = [this]() { - return GetMapping(assets_dir_, "vm_snapshot_instr", true); + return fml::FileMapping::CreateReadExecute(assets_dir_, + "vm_snapshot_instr"); }; settings.isolate_snapshot_instr = [this]() { - return GetMapping(assets_dir_, "isolate_snapshot_instr", true); + return fml::FileMapping::CreateReadExecute(assets_dir_, + "isolate_snapshot_instr"); }; } } else { settings.application_kernels = [this]() { std::vector> kernel_mappings; kernel_mappings.emplace_back( - GetMapping(assets_dir_, "kernel_blob.bin", false)); + fml::FileMapping::CreateReadOnly(assets_dir_, "kernel_blob.bin")); return kernel_mappings; }; } diff --git a/shell/platform/embedder/tests/embedder_context.cc b/shell/platform/embedder/tests/embedder_context.cc index 870c18d4d8a13..eecec06fe8c9a 100644 --- a/shell/platform/embedder/tests/embedder_context.cc +++ b/shell/platform/embedder/tests/embedder_context.cc @@ -9,46 +9,21 @@ namespace flutter { namespace testing { -static std::unique_ptr GetMapping(const fml::UniqueFD& directory, - const char* path, - bool executable) { - fml::UniqueFD file = fml::OpenFile(directory, path, false /* create */, - fml::FilePermission::kRead); - if (!file.is_valid()) { - return nullptr; - } - - using Prot = fml::FileMapping::Protection; - std::unique_ptr mapping; - if (executable) { - mapping = std::make_unique( - file, std::initializer_list{Prot::kRead, Prot::kExecute}); - } else { - mapping = std::make_unique( - file, std::initializer_list{Prot::kRead}); - } - - if (mapping->GetSize() == 0 || mapping->GetMapping() == nullptr) { - return nullptr; - } - - return mapping; -} - EmbedderContext::EmbedderContext(std::string assets_path) : assets_path_(std::move(assets_path)), native_resolver_(std::make_shared<::testing::TestDartNativeResolver>()) { auto assets_dir = fml::OpenDirectory(assets_path_.c_str(), false, fml::FilePermission::kRead); - vm_snapshot_data_ = GetMapping(assets_dir, "vm_snapshot_data", false); + vm_snapshot_data_ = + fml::FileMapping::CreateReadOnly(assets_dir, "vm_snapshot_data"); isolate_snapshot_data_ = - GetMapping(assets_dir, "isolate_snapshot_data", false); + fml::FileMapping::CreateReadOnly(assets_dir, "isolate_snapshot_data"); if (flutter::DartVM::IsRunningPrecompiledCode()) { vm_snapshot_instructions_ = - GetMapping(assets_dir, "vm_snapshot_instr", true); - isolate_snapshot_instructions_ = - GetMapping(assets_dir, "isolate_snapshot_instr", true); + fml::FileMapping::CreateReadExecute(assets_dir, "vm_snapshot_instr"); + isolate_snapshot_instructions_ = fml::FileMapping::CreateReadExecute( + assets_dir, "isolate_snapshot_instr"); } isolate_create_callbacks_.push_back( From 1fe32791493852ed04cb01f4c234e1d18b3646a9 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 19 Apr 2019 12:49:07 -0700 Subject: [PATCH 0885/1117] Cleanup references to FLX archives from the engine. (#8653) --- common/settings.h | 1 - shell/common/switches.cc | 2 -- shell/common/switches.h | 1 - shell/platform/android/io/flutter/view/FlutterMain.java | 7 ------- 4 files changed, 11 deletions(-) diff --git a/common/settings.h b/common/settings.h index 1805e363f7f22..317884c1757de 100644 --- a/common/settings.h +++ b/common/settings.h @@ -144,7 +144,6 @@ struct Settings { fml::UniqueFD::element_type assets_dir = fml::UniqueFD::traits_type::InvalidValue(); std::string assets_path; - std::string flx_path; }; } // namespace flutter diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 4d4ed1b86b628..859a798c0fc25 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -198,8 +198,6 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { settings.verbose_logging = command_line.HasOption(FlagForSwitch(Switch::VerboseLogging)); - command_line.GetOptionValue(FlagForSwitch(Switch::FLX), &settings.flx_path); - command_line.GetOptionValue(FlagForSwitch(Switch::FlutterAssetsDir), &settings.assets_path); diff --git a/shell/common/switches.h b/shell/common/switches.h index 7747c33bca44c..73c00d97a0953 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -90,7 +90,6 @@ DEF_SWITCH(SkiaDeterministicRendering, "Skips the call to SkGraphics::Init(), thus avoiding swapping out" "some Skia function pointers based on available CPU features. This" "is used to obtain 100% deterministic behavior in Skia rendering.") -DEF_SWITCH(FLX, "flx", "Specify the FLX path.") DEF_SWITCH(FlutterAssetsDir, "flutter-assets-dir", "Path to the Flutter assets directory.") diff --git a/shell/platform/android/io/flutter/view/FlutterMain.java b/shell/platform/android/io/flutter/view/FlutterMain.java index 14b932061877e..685e6702b00c1 100644 --- a/shell/platform/android/io/flutter/view/FlutterMain.java +++ b/shell/platform/android/io/flutter/view/FlutterMain.java @@ -35,7 +35,6 @@ public class FlutterMain { private static final String AOT_VM_SNAPSHOT_INSTR_KEY = "vm-snapshot-instr"; private static final String AOT_ISOLATE_SNAPSHOT_DATA_KEY = "isolate-snapshot-data"; private static final String AOT_ISOLATE_SNAPSHOT_INSTR_KEY = "isolate-snapshot-instr"; - private static final String FLX_KEY = "flx"; private static final String FLUTTER_ASSETS_DIR_KEY = "flutter-assets-dir"; // XML Attribute keys supported in AndroidManifest.xml @@ -49,8 +48,6 @@ public class FlutterMain { FlutterMain.class.getName() + '.' + AOT_ISOLATE_SNAPSHOT_DATA_KEY; public static final String PUBLIC_AOT_ISOLATE_SNAPSHOT_INSTR_KEY = FlutterMain.class.getName() + '.' + AOT_ISOLATE_SNAPSHOT_INSTR_KEY; - public static final String PUBLIC_FLX_KEY = - FlutterMain.class.getName() + '.' + FLX_KEY; public static final String PUBLIC_FLUTTER_ASSETS_DIR_KEY = FlutterMain.class.getName() + '.' + FLUTTER_ASSETS_DIR_KEY; @@ -60,7 +57,6 @@ public class FlutterMain { private static final String DEFAULT_AOT_VM_SNAPSHOT_INSTR = "vm_snapshot_instr"; private static final String DEFAULT_AOT_ISOLATE_SNAPSHOT_DATA = "isolate_snapshot_data"; private static final String DEFAULT_AOT_ISOLATE_SNAPSHOT_INSTR = "isolate_snapshot_instr"; - private static final String DEFAULT_FLX = "app.flx"; private static final String DEFAULT_LIBRARY = "libflutter.so"; private static final String DEFAULT_KERNEL_BLOB = "kernel_blob.bin"; private static final String DEFAULT_FLUTTER_ASSETS_DIR = "flutter_assets"; @@ -75,7 +71,6 @@ private static String fromFlutterAssets(String filePath) { private static String sAotVmSnapshotInstr = DEFAULT_AOT_VM_SNAPSHOT_INSTR; private static String sAotIsolateSnapshotData = DEFAULT_AOT_ISOLATE_SNAPSHOT_DATA; private static String sAotIsolateSnapshotInstr = DEFAULT_AOT_ISOLATE_SNAPSHOT_INSTR; - private static String sFlx = DEFAULT_FLX; private static String sFlutterAssetsDir = DEFAULT_FLUTTER_ASSETS_DIR; private static boolean sInitialized = false; @@ -295,7 +290,6 @@ private static void initConfig(Context applicationContext) { sAotVmSnapshotInstr = metadata.getString(PUBLIC_AOT_VM_SNAPSHOT_INSTR_KEY, DEFAULT_AOT_VM_SNAPSHOT_INSTR); sAotIsolateSnapshotData = metadata.getString(PUBLIC_AOT_ISOLATE_SNAPSHOT_DATA_KEY, DEFAULT_AOT_ISOLATE_SNAPSHOT_DATA); sAotIsolateSnapshotInstr = metadata.getString(PUBLIC_AOT_ISOLATE_SNAPSHOT_INSTR_KEY, DEFAULT_AOT_ISOLATE_SNAPSHOT_INSTR); - sFlx = metadata.getString(PUBLIC_FLX_KEY, DEFAULT_FLX); sFlutterAssetsDir = metadata.getString(PUBLIC_FLUTTER_ASSETS_DIR_KEY, DEFAULT_FLUTTER_ASSETS_DIR); } } catch (PackageManager.NameNotFoundException e) { @@ -334,7 +328,6 @@ private static void initResources(Context applicationContext) { sResourceExtractor = new ResourceExtractor(context); sResourceExtractor - .addResource(fromFlutterAssets(sFlx)) .addResource(fromFlutterAssets(sAotVmSnapshotData)) .addResource(fromFlutterAssets(sAotVmSnapshotInstr)) .addResource(fromFlutterAssets(sAotIsolateSnapshotData)) From 206cab6e701392fe0433f15a248516e94d4f8025 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 19 Apr 2019 16:43:24 -0400 Subject: [PATCH 0886/1117] Roll src/third_party/skia cc5d3e09e394..1c0b05afdef8 (14 commits) (#8654) https://skia.googlesource.com/skia.git/%2Blog/cc5d3e09e394..1c0b05afdef8 git log cc5d3e09e39410841ba6e8866680257a92ee5205..1c0b05afdef8c0366926d3a5cdbe828ff122cfe2 --date=short --no-merges --format=%ad %ae %s 2019-04-19 bsalomon@google.com SkClipStack::isRRect succeeds if stack is an intersection of rects. 2019-04-17 csmartdalton@google.com ccpr: Calculate edge coverage in the coverage processor 2019-04-19 ethannicholas@google.com Fixed internal skslc error with negated literal vectors 2019-04-19 egdaniel@google.com Adjust vulkan memory allocation block size knobs to better match the type of draws we do. 2019-04-17 ethannicholas@google.com reworked SPIR-V binary operations and added support for VectorTimesScalar 2019-04-19 robertphillips@google.com Add explicit GrSurfaceProxy flag to skip explicit resource allocation 2019-04-19 halcanary@google.com SkQP: new docker test code 2019-04-19 ethannicholas@google.com fixed Metal code generation for recursive functions 2019-04-19 michaelludwig@google.com Don't batch across domain modes in GrTextureOp 2019-04-19 brianosman@google.com Convexity checker: Wait for significant x-product when walking edges 2019-04-19 michaelludwig@google.com Update compositing benchmark to use image-set API 2019-04-18 csmartdalton@google.com ccpr: Indicate path fill type by winding direction of cover triangles 2019-04-19 ethannicholas@google.com added error detection for writing to a constant swizzle mask 2019-04-19 kjlubick@google.com [spec] Initial commit for web spec The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (herb@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 69195a2038d99..dd617da237464 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': 'cc5d3e09e39410841ba6e8866680257a92ee5205', + 'skia_revision': '1c0b05afdef8c0366926d3a5cdbe828ff122cfe2', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 30358fe45fdc6..82673412d04bc 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b81db5fcd6895228a93af32d2315e2c1 +Signature: 60d8d8f89167f18c7f8302cc7bbe217f UNUSED LICENSES: @@ -2458,6 +2458,7 @@ FILE: ../../../third_party/skia/site/user/api/METADATA FILE: ../../../third_party/skia/site/user/api/catalog.htm FILE: ../../../third_party/skia/site/user/modules/METADATA FILE: ../../../third_party/skia/site/user/modules/PathKit_effects.png +FILE: ../../../third_party/skia/specs/web-img-decode/current/index.html FILE: ../../../third_party/skia/src/compute/hs/cl/intel/gen8/u32/hs_kernels.bin FILE: ../../../third_party/skia/src/compute/hs/cl/intel/gen8/u32/hs_kernels.bin.len.xxd FILE: ../../../third_party/skia/src/compute/hs/cl/intel/gen8/u32/hs_kernels.bin.xxd From bd8c5b135e4d41842d0d5d42ff4943a18b8f4f0c Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 19 Apr 2019 15:01:40 -0700 Subject: [PATCH 0887/1117] Only allow mappings for ICU initialization. (#8656) If the mapping callback is not set or it the callback returns invalid data, ICU initialization will be embedder responsibility. This affects all embedders and the following have been audited: * Android: Via a symbol mapping. * iOS: Via a file mapping. * Embedder: Via a file mapping. * Fuchsia: Via a VMO mapping * Test shells and Flutter tester: Via file mapping with ICU data needing to be next to the executable. --- benchmarking/benchmarking.cc | 3 +- common/settings.h | 6 - fml/file.cc | 11 ++ fml/file.h | 2 + fml/icu_util.cc | 107 ++---------------- fml/icu_util.h | 4 +- shell/common/shell.cc | 10 +- shell/common/switches.cc | 15 ++- .../framework/Source/FlutterDartProject.mm | 7 +- shell/platform/embedder/embedder.cc | 7 +- shell/testing/tester_main.cc | 10 +- .../txt/tests/txt_run_all_unittests.cc | 4 +- 12 files changed, 61 insertions(+), 125 deletions(-) diff --git a/benchmarking/benchmarking.cc b/benchmarking/benchmarking.cc index c8e5af7ea3dd5..1bf605dfbae2d 100644 --- a/benchmarking/benchmarking.cc +++ b/benchmarking/benchmarking.cc @@ -10,7 +10,8 @@ namespace benchmarking { int Main(int argc, char** argv) { benchmark::Initialize(&argc, argv); - fml::icu::InitializeICU("icudtl.dat"); + fml::icu::InitializeICU(fml::FileMapping::CreateReadOnly( + fml::OpenDirectoryOfExecutable(), "icudtl.dat")); ::benchmark::RunSpecifiedBenchmarks(); return 0; } diff --git a/common/settings.h b/common/settings.h index 317884c1757de..c7ee514fbdb7f 100644 --- a/common/settings.h +++ b/common/settings.h @@ -132,12 +132,6 @@ struct Settings { bool verbose_logging = false; std::string log_tag = "flutter"; - // The icu_initialization_required setting does not have a corresponding - // switch because it is intended to be decided during build time, not runtime. - // Some companies apply source modification here because their build system - // brings its own ICU data files. - bool icu_initialization_required = true; - std::string icu_data_path; MappingCallback icu_mapper; // Assets settings diff --git a/fml/file.cc b/fml/file.cc index 8deb76c91da0f..c2a94e304c94e 100644 --- a/fml/file.cc +++ b/fml/file.cc @@ -5,6 +5,7 @@ #include "flutter/fml/file.h" #include "flutter/fml/logging.h" +#include "flutter/fml/paths.h" namespace fml { @@ -58,4 +59,14 @@ ScopedTemporaryDirectory::~ScopedTemporaryDirectory() { } } +fml::UniqueFD OpenDirectoryOfExecutable() { + auto result = paths::GetExecutableDirectoryPath(); + + if (!result.first) { + return {}; + } + + return OpenFile(result.second.c_str(), false, FilePermission::kRead); +} + } // namespace fml diff --git a/fml/file.h b/fml/file.h index 068ddc84c999d..42a007c221079 100644 --- a/fml/file.h +++ b/fml/file.h @@ -46,6 +46,8 @@ fml::UniqueFD OpenDirectory(const fml::UniqueFD& base_directory, bool create_if_necessary, FilePermission permission); +fml::UniqueFD OpenDirectoryOfExecutable(); + fml::UniqueFD Duplicate(fml::UniqueFD::element_type descriptor); bool IsDirectory(const fml::UniqueFD& directory); diff --git a/fml/icu_util.cc b/fml/icu_util.cc index fa0cc02b9c20d..13bed1440b0ef 100644 --- a/fml/icu_util.cc +++ b/fml/icu_util.cc @@ -4,115 +4,24 @@ #include "flutter/fml/icu_util.h" -#include #include -#include "flutter/fml/build_config.h" #include "flutter/fml/logging.h" -#include "flutter/fml/mapping.h" -#include "flutter/fml/native_library.h" -#include "flutter/fml/paths.h" #include "third_party/icu/source/common/unicode/udata.h" namespace fml { namespace icu { -class ICUContext { - public: - ICUContext(const std::string& icu_data_path) : valid_(false) { - valid_ = SetupMapping(icu_data_path) && SetupICU(); +void InitializeICU(std::unique_ptr mapping) { + if (mapping == nullptr || mapping->GetSize() == 0) { + return; } - - ICUContext(std::unique_ptr mapping) : mapping_(std::move(mapping)) { - valid_ = SetupICU(); - } - - ~ICUContext() = default; - - bool SetupMapping(const std::string& icu_data_path) { - // Check if the path exists and it readable directly. - auto fd = - fml::OpenFile(icu_data_path.c_str(), false, fml::FilePermission::kRead); - - // Check the path relative to the current executable. - if (!fd.is_valid()) { - auto directory = fml::paths::GetExecutableDirectoryPath(); - - if (!directory.first) { - return false; - } - - std::string path_relative_to_executable = - paths::JoinPaths({directory.second, icu_data_path}); - - fd = fml::OpenFile(path_relative_to_executable.c_str(), false, - fml::FilePermission::kRead); - } - - if (!fd.is_valid()) { - return false; - } - - std::initializer_list protection = { - fml::FileMapping::Protection::kRead}; - - auto file_mapping = - std::make_unique(fd, std::move(protection)); - - if (file_mapping->GetSize() != 0) { - mapping_ = std::move(file_mapping); - return true; - } - - return false; - } - - bool SetupICU() { - if (GetSize() == 0) { - return false; - } - - UErrorCode err_code = U_ZERO_ERROR; - udata_setCommonData(GetMapping(), &err_code); - return (err_code == U_ZERO_ERROR); - } - - const uint8_t* GetMapping() const { - return mapping_ ? mapping_->GetMapping() : nullptr; - } - - size_t GetSize() const { return mapping_ ? mapping_->GetSize() : 0; } - - bool IsValid() const { return valid_; } - - private: - bool valid_; - std::unique_ptr mapping_; - - FML_DISALLOW_COPY_AND_ASSIGN(ICUContext); -}; - -void InitializeICUOnce(const std::string& icu_data_path) { - static ICUContext* context = new ICUContext(icu_data_path); - FML_CHECK(context->IsValid()) - << "Must be able to initialize the ICU context. Tried: " << icu_data_path; -} - -std::once_flag g_icu_init_flag; -void InitializeICU(const std::string& icu_data_path) { - std::call_once(g_icu_init_flag, - [&icu_data_path]() { InitializeICUOnce(icu_data_path); }); -} - -void InitializeICUFromMappingOnce(std::unique_ptr mapping) { - static ICUContext* context = new ICUContext(std::move(mapping)); - FML_CHECK(context->IsValid()) - << "Unable to initialize the ICU context from a mapping."; -} - -void InitializeICUFromMapping(std::unique_ptr mapping) { + static std::once_flag g_icu_init_flag; std::call_once(g_icu_init_flag, [mapping = std::move(mapping)]() mutable { - InitializeICUFromMappingOnce(std::move(mapping)); + static auto icu_mapping = std::move(mapping); + UErrorCode err_code = U_ZERO_ERROR; + udata_setCommonData(icu_mapping->GetMapping(), &err_code); + FML_CHECK(err_code == U_ZERO_ERROR) << "Must be able to initialize ICU."; }); } diff --git a/fml/icu_util.h b/fml/icu_util.h index 22b7a906efce0..dc1d947e03118 100644 --- a/fml/icu_util.h +++ b/fml/icu_util.h @@ -13,9 +13,7 @@ namespace fml { namespace icu { -void InitializeICU(const std::string& icu_data_path = ""); - -void InitializeICUFromMapping(std::unique_ptr mapping); +void InitializeICU(std::unique_ptr mapping); } // namespace icu } // namespace fml diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 5a33f0d388eed..33e2b48e79493 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -193,14 +193,8 @@ static void PerformInitializationTasks(const Settings& settings) { FML_DLOG(INFO) << "Skia deterministic rendering is enabled."; } - if (settings.icu_initialization_required) { - if (settings.icu_data_path.size() != 0) { - fml::icu::InitializeICU(settings.icu_data_path); - } else if (settings.icu_mapper) { - fml::icu::InitializeICUFromMapping(settings.icu_mapper()); - } else { - FML_DLOG(WARNING) << "Skipping ICU initialization in the shell."; - } + if (settings.icu_mapper) { + fml::icu::InitializeICU(settings.icu_mapper()); } }); } diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 859a798c0fc25..bd54486c68607 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -242,9 +242,20 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { command_line.GetOptionValue(FlagForSwitch(Switch::CacheDirPath), &settings.temp_directory_path); - if (settings.icu_initialization_required) { + { + // ICU from a data file. + std::string icu_data_path; command_line.GetOptionValue(FlagForSwitch(Switch::ICUDataFilePath), - &settings.icu_data_path); + &icu_data_path); + if (icu_data_path.size() > 0) { + settings.icu_mapper = [icu_data_path]() { + return fml::FileMapping::CreateReadOnly(icu_data_path); + }; + } + } + + { + // ICU from a symbol in a dynamic library if (command_line.HasOption(FlagForSwitch(Switch::ICUSymbolPrefix))) { std::string icu_symbol_prefix, native_lib_path; command_line.GetOptionValue(FlagForSwitch(Switch::ICUSymbolPrefix), diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index 47277007a97c3..3738c05cd4138 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -59,10 +59,13 @@ // defaults. // Flutter ships the ICU data file in the the bundle of the engine. Look for it there. - if (settings.icu_data_path.size() == 0) { + if (!settings.icu_mapper) { NSString* icuDataPath = [engineBundle pathForResource:@"icudtl" ofType:@"dat"]; if (icuDataPath.length > 0) { - settings.icu_data_path = icuDataPath.UTF8String; + auto icu_data_path = std::string{icuDataPath.UTF8String}; + settings.icu_mapper = [icu_data_path]() { + return fml::FileMapping::CreateReadOnly(icu_data_path); + }; } } diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index e9b50852bb1e5..544b6330be7d3 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -370,7 +370,12 @@ FlutterEngineResult FlutterEngineRun(size_t version, PopulateSnapshotMappingCallbacks(args, settings); - settings.icu_data_path = icu_data_path; + if (!settings.icu_mapper) { + settings.icu_mapper = [icu_data_path]() { + return fml::FileMapping::CreateReadOnly(icu_data_path); + }; + } + settings.assets_path = args->assets_path; if (!flutter::DartVM::IsRunningPrecompiledCode()) { diff --git a/shell/testing/tester_main.cc b/shell/testing/tester_main.cc index fd729d1f434d2..f882374cd71c2 100644 --- a/shell/testing/tester_main.cc +++ b/shell/testing/tester_main.cc @@ -251,8 +251,14 @@ int main(int argc, char* argv[]) { return EXIT_FAILURE; } - if (settings.icu_data_path.size() == 0) { - settings.icu_data_path = "icudtl.dat"; + // Using command line arguments, the user can specify the ICU data as being + // present in either a file or a dynamic library. If no such specification has + // been, default to icudtl.dat. + if (!settings.icu_mapper) { + settings.icu_mapper = []() { + return fml::FileMapping::CreateReadOnly(fml::OpenDirectoryOfExecutable(), + "icudtl.dat"); + }; } // The tools that read logs get confused if there is a log tag specified. diff --git a/third_party/txt/tests/txt_run_all_unittests.cc b/third_party/txt/tests/txt_run_all_unittests.cc index 992a167f0449e..3832bfcb9246f 100644 --- a/third_party/txt/tests/txt_run_all_unittests.cc +++ b/third_party/txt/tests/txt_run_all_unittests.cc @@ -36,7 +36,9 @@ int main(int argc, char** argv) { } FML_DCHECK(txt::GetFontDir().length() > 0); - fml::icu::InitializeICU("icudtl.dat"); + fml::icu::InitializeICU(fml::FileMapping::CreateReadOnly( + fml::OpenDirectoryOfExecutable(), "icudtl.dat")); + SkGraphics::Init(); testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); From b0cbce417555704a7f7ac4ed030a1edc32d8fcf7 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Fri, 19 Apr 2019 17:33:46 -0700 Subject: [PATCH 0888/1117] Replace ThreadLocal with ThreadLocalUniquePtr (#8659) Fixes https://github.com/flutter/flutter/issues/31292. --- flow/export_node.cc | 19 ++--- flow/view_holder.cc | 19 ++--- fml/message_loop.cc | 12 ++- fml/thread_local.cc | 66 ++++------------ fml/thread_local.h | 110 ++++++++------------------- fml/thread_local_unittests.cc | 125 +++++++++++++++---------------- lib/ui/compositing/scene_host.cc | 19 ++--- 7 files changed, 135 insertions(+), 235 deletions(-) diff --git a/flow/export_node.cc b/flow/export_node.cc index f5440f5473ff2..318b52ff3cc27 100644 --- a/flow/export_node.cc +++ b/flow/export_node.cc @@ -11,9 +11,8 @@ namespace { using ExportNodeBindings = std::unordered_map>; -FML_THREAD_LOCAL fml::ThreadLocal tls_export_node_bindings([](intptr_t value) { - delete reinterpret_cast(value); -}); +FML_THREAD_LOCAL fml::ThreadLocalUniquePtr + tls_export_node_bindings; } // namespace @@ -27,13 +26,11 @@ ExportNode::ExportNode(zx::eventpair export_token) void ExportNode::Create(zx_koid_t id, zx::eventpair export_token) { // This GPU thread contains at least 1 ViewHolder. Initialize the per-thread // bindings. - if (tls_export_node_bindings.Get() == 0) { - tls_export_node_bindings.Set( - reinterpret_cast(new ExportNodeBindings())); + if (tls_export_node_bindings.get() == nullptr) { + tls_export_node_bindings.reset(new ExportNodeBindings()); } - auto* bindings = - reinterpret_cast(tls_export_node_bindings.Get()); + auto* bindings = tls_export_node_bindings.get(); FML_DCHECK(bindings); FML_DCHECK(bindings->find(id) == bindings->end()); @@ -43,16 +40,14 @@ void ExportNode::Create(zx_koid_t id, zx::eventpair export_token) { } void ExportNode::Destroy(zx_koid_t id) { - auto* bindings = - reinterpret_cast(tls_export_node_bindings.Get()); + auto* bindings = tls_export_node_bindings.get(); FML_DCHECK(bindings); bindings->erase(id); } ExportNode* ExportNode::FromId(zx_koid_t id) { - auto* bindings = - reinterpret_cast(tls_export_node_bindings.Get()); + auto* bindings = tls_export_node_bindings.get(); if (!bindings) { return nullptr; } diff --git a/flow/view_holder.cc b/flow/view_holder.cc index f7c5de93b198f..2baba58f67f60 100644 --- a/flow/view_holder.cc +++ b/flow/view_holder.cc @@ -11,9 +11,8 @@ namespace { using ViewHolderBindings = std::unordered_map>; -FML_THREAD_LOCAL fml::ThreadLocal tls_view_holder_bindings([](intptr_t value) { - delete reinterpret_cast(value); -}); +FML_THREAD_LOCAL fml::ThreadLocalUniquePtr + tls_view_holder_bindings; fuchsia::ui::gfx::ViewProperties ToViewProperties(float width, float height, @@ -65,13 +64,11 @@ void ViewHolder::Create(zx_koid_t id, BindCallback on_bind_callback) { // This GPU thread contains at least 1 ViewHolder. Initialize the per-thread // bindings. - if (tls_view_holder_bindings.Get() == 0) { - tls_view_holder_bindings.Set( - reinterpret_cast(new ViewHolderBindings())); + if (tls_view_holder_bindings.get() == nullptr) { + tls_view_holder_bindings.reset(new ViewHolderBindings()); } - auto* bindings = - reinterpret_cast(tls_view_holder_bindings.Get()); + auto* bindings = tls_view_holder_bindings.get(); FML_DCHECK(bindings); FML_DCHECK(bindings->find(id) == bindings->end()); @@ -82,16 +79,14 @@ void ViewHolder::Create(zx_koid_t id, } void ViewHolder::Destroy(zx_koid_t id) { - auto* bindings = - reinterpret_cast(tls_view_holder_bindings.Get()); + auto* bindings = tls_view_holder_bindings.get(); FML_DCHECK(bindings); bindings->erase(id); } ViewHolder* ViewHolder::FromId(zx_koid_t id) { - auto* bindings = - reinterpret_cast(tls_view_holder_bindings.Get()); + auto* bindings = tls_view_holder_bindings.get(); if (!bindings) { return nullptr; } diff --git a/fml/message_loop.cc b/fml/message_loop.cc index af3d73510281c..652fb659bd2c1 100644 --- a/fml/message_loop.cc +++ b/fml/message_loop.cc @@ -15,12 +15,10 @@ namespace fml { -FML_THREAD_LOCAL ThreadLocal tls_message_loop([](intptr_t value) { - delete reinterpret_cast(value); -}); +FML_THREAD_LOCAL ThreadLocalUniquePtr tls_message_loop; MessageLoop& MessageLoop::GetCurrent() { - auto* loop = reinterpret_cast(tls_message_loop.Get()); + auto* loop = tls_message_loop.get(); FML_CHECK(loop != nullptr) << "MessageLoop::EnsureInitializedForCurrentThread was not called on " "this thread prior to message loop use."; @@ -28,15 +26,15 @@ MessageLoop& MessageLoop::GetCurrent() { } void MessageLoop::EnsureInitializedForCurrentThread() { - if (tls_message_loop.Get() != 0) { + if (tls_message_loop.get() != nullptr) { // Already initialized. return; } - tls_message_loop.Set(reinterpret_cast(new MessageLoop())); + tls_message_loop.reset(new MessageLoop()); } bool MessageLoop::IsInitializedForCurrentThread() { - return tls_message_loop.Get() != 0; + return tls_message_loop.get() != nullptr; } MessageLoop::MessageLoop() diff --git a/fml/thread_local.cc b/fml/thread_local.cc index d0afbc00186a0..f997ecc05f68b 100644 --- a/fml/thread_local.cc +++ b/fml/thread_local.cc @@ -4,66 +4,32 @@ #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 +#include "flutter/fml/logging.h" - // Collect the container - delete reinterpret_cast(pthread_getspecific(_key)); +namespace fml { +namespace internal { - // Finally, collect the key - FML_CHECK(pthread_key_delete(_key) == 0); +ThreadLocalPointer::ThreadLocalPointer(void (*destroy)(void*)) { + FML_CHECK(pthread_key_create(&key_, destroy) == 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; +ThreadLocalPointer::~ThreadLocalPointer() { + FML_CHECK(pthread_key_delete(key_) == 0); } -intptr_t ThreadLocal::Get() { - return value_; +void* ThreadLocalPointer::get() const { + return pthread_getspecific(key_); } -ThreadLocal::~ThreadLocal() { - if (value_ != 0 && destroy_) { - destroy_(value_); - } +void* ThreadLocalPointer::swap(void* ptr) { + void* old_ptr = get(); + FML_CHECK(pthread_setspecific(key_, ptr) == 0); + return old_ptr; } -#endif // FML_THREAD_LOCAL_PTHREADS - +} // namespace internal } // namespace fml + +#endif // FML_THREAD_LOCAL_PTHREADS diff --git a/fml/thread_local.h b/fml/thread_local.h index 4bf518244a6e9..de49cda324a04 100644 --- a/fml/thread_local.h +++ b/fml/thread_local.h @@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_FML_THREAD_LOCAL_H_ -#define FLUTTER_FML_THREAD_LOCAL_H_ +#ifndef FLUTTER_FML_THREAD_LOCAL_UNIQUE_PTR_H_ +#define FLUTTER_FML_THREAD_LOCAL_UNIQUE_PTR_H_ -#include +#include #include "flutter/fml/build_config.h" -#include "flutter/fml/logging.h" #include "flutter/fml/macros.h" #define FML_THREAD_LOCAL_PTHREADS OS_MACOSX || OS_LINUX || OS_ANDROID @@ -19,103 +18,60 @@ namespace fml { -using ThreadLocalDestroyCallback = std::function; - #if FML_THREAD_LOCAL_PTHREADS -// thread_local is unavailable and we have to resort to pthreads. - #define FML_THREAD_LOCAL static -class ThreadLocal { - private: - class Box { - public: - Box(ThreadLocalDestroyCallback destroy, intptr_t value); - - ~Box(); +namespace internal { - intptr_t Value() const { return value_; } - - void SetValue(intptr_t value) { - if (value == value_) { - return; - } - - DestroyValue(); - value_ = value; - } +class ThreadLocalPointer { + public: + ThreadLocalPointer(void (*destroy)(void*)); + ~ThreadLocalPointer(); - void DestroyValue() { - if (destroy_) { - destroy_(value_); - } - } + void* get() const; + void* swap(void* ptr); - private: - ThreadLocalDestroyCallback destroy_; - intptr_t value_; + private: + pthread_key_t key_; - FML_DISALLOW_COPY_AND_ASSIGN(Box); - }; + FML_DISALLOW_COPY_AND_ASSIGN(ThreadLocalPointer); +}; - static inline void ThreadLocalDestroy(void* value) { - FML_CHECK(value != nullptr); - auto* box = reinterpret_cast(value); - box->DestroyValue(); - delete box; - } +} // namespace internal +template +class ThreadLocalUniquePtr { public: - ThreadLocal(); - - ThreadLocal(ThreadLocalDestroyCallback destroy); - - void Set(intptr_t value) { - auto* box = reinterpret_cast(pthread_getspecific(_key)); - if (box == nullptr) { - box = new Box(destroy_, value); - FML_CHECK(pthread_setspecific(_key, box) == 0); - } else { - box->SetValue(value); - } - } - - intptr_t Get() { - auto* box = reinterpret_cast(pthread_getspecific(_key)); - return box != nullptr ? box->Value() : 0; - } + ThreadLocalUniquePtr() : ptr_(destroy) {} - ~ThreadLocal(); + T* get() const { return reinterpret_cast(ptr_.get()); } + void reset(T* ptr) { destroy(ptr_.swap(ptr)); } private: - pthread_key_t _key; - ThreadLocalDestroyCallback destroy_; + static void destroy(void* ptr) { delete reinterpret_cast(ptr); } - FML_DISALLOW_COPY_AND_ASSIGN(ThreadLocal); + internal::ThreadLocalPointer ptr_; + + FML_DISALLOW_COPY_AND_ASSIGN(ThreadLocalUniquePtr); }; #else // FML_THREAD_LOCAL_PTHREADS -#define FML_THREAD_LOCAL thread_local +#define FML_THREAD_LOCAL static thread_local -class ThreadLocal { +template +class ThreadLocalUniquePtr { public: - ThreadLocal(); - - ThreadLocal(ThreadLocalDestroyCallback destroy); - - void Set(intptr_t value); - - intptr_t Get(); + ThreadLocalUniquePtr() = default; - ~ThreadLocal(); + T* get() const { return ptr_.get(); } + void reset(T* ptr) { ptr_.reset(ptr); } private: - ThreadLocalDestroyCallback destroy_; - intptr_t value_; + std::unique_ptr ptr_; - FML_DISALLOW_COPY_AND_ASSIGN(ThreadLocal); + FML_DISALLOW_COPY_AND_ASSIGN(ThreadLocalUniquePtr); }; #endif // FML_THREAD_LOCAL_PTHREADS @@ -128,4 +84,4 @@ class ThreadLocal { } // namespace fml -#endif // FLUTTER_FML_THREAD_LOCAL_H_ +#endif // FLUTTER_FML_THREAD_LOCAL_UNIQUE_PTR_H_ diff --git a/fml/thread_local_unittests.cc b/fml/thread_local_unittests.cc index 7f48cfcd532f6..e0e026b3b76db 100644 --- a/fml/thread_local_unittests.cc +++ b/fml/thread_local_unittests.cc @@ -2,108 +2,103 @@ // 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/logging.h" +#include "flutter/fml/macros.h" #include "flutter/fml/thread_local.h" #include "gtest/gtest.h" -// We are only going to test the pthreads based thread local boxes. -#if FML_THREAD_LOCAL_PTHREADS +namespace { + +class Box { + public: + Box(int value, std::atomic_int* destroys = nullptr) + : value_(value), destroys_(destroys) {} + ~Box() { + if (destroys_) { + ++*destroys_; + } + } + + int value() const { return value_; } + + private: + int value_; + std::atomic_int* destroys_; + + FML_DISALLOW_COPY_AND_ASSIGN(Box); +}; + +FML_THREAD_LOCAL fml::ThreadLocalUniquePtr local; + +} // namespace TEST(ThreadLocal, SimpleInitialization) { std::thread thread([&] { - fml::ThreadLocal local; + ASSERT_EQ(local.get(), nullptr); auto value = 100; - local.Set(value); - ASSERT_EQ(local.Get(), value); + local.reset(new Box(value)); + ASSERT_EQ(local.get()->value(), value); }); thread.join(); } TEST(ThreadLocal, SimpleInitializationCheckInAnother) { std::thread thread([&] { - fml::ThreadLocal local; + ASSERT_EQ(local.get(), nullptr); auto value = 100; - local.Set(value); - ASSERT_EQ(local.Get(), value); - std::thread thread2([&]() { ASSERT_EQ(local.Get(), 0); }); + local.reset(new Box(value)); + ASSERT_EQ(local.get()->value(), value); + std::thread thread2([&]() { ASSERT_EQ(local.get(), nullptr); }); thread2.join(); }); thread.join(); } TEST(ThreadLocal, DestroyCallback) { + std::atomic_int destroys{0}; std::thread thread([&] { - int destroys = 0; - fml::ThreadLocal local([&destroys](intptr_t) { destroys++; }); + ASSERT_EQ(local.get(), nullptr); auto value = 100; - local.Set(value); - ASSERT_EQ(local.Get(), value); - ASSERT_EQ(destroys, 0); + local.reset(new Box(value, &destroys)); + ASSERT_EQ(local.get()->value(), value); + ASSERT_EQ(destroys.load(), 0); }); thread.join(); + ASSERT_EQ(destroys.load(), 1); } TEST(ThreadLocal, DestroyCallback2) { + std::atomic_int destroys{0}; std::thread thread([&] { - int destroys = 0; - fml::ThreadLocal local([&destroys](intptr_t) { destroys++; }); - - local.Set(100); - ASSERT_EQ(local.Get(), 100); - ASSERT_EQ(destroys, 0); - local.Set(200); - ASSERT_EQ(local.Get(), 200); - ASSERT_EQ(destroys, 1); + local.reset(new Box(100, &destroys)); + ASSERT_EQ(local.get()->value(), 100); + ASSERT_EQ(destroys.load(), 0); + local.reset(new Box(200, &destroys)); + ASSERT_EQ(local.get()->value(), 200); + ASSERT_EQ(destroys.load(), 1); }); thread.join(); + ASSERT_EQ(destroys.load(), 2); } TEST(ThreadLocal, DestroyThreadTimeline) { + std::atomic_int destroys{0}; std::thread thread([&] { - int destroys = 0; - fml::ThreadLocal local([&destroys](intptr_t) { destroys++; }); - - std::thread thread([&]() { - local.Set(100); - ASSERT_EQ(local.Get(), 100); - ASSERT_EQ(destroys, 0); - local.Set(200); - ASSERT_EQ(local.Get(), 200); - ASSERT_EQ(destroys, 1); + std::thread thread2([&]() { + local.reset(new Box(100, &destroys)); + ASSERT_EQ(local.get()->value(), 100); + ASSERT_EQ(destroys.load(), 0); + local.reset(new Box(200, &destroys)); + ASSERT_EQ(local.get()->value(), 200); + ASSERT_EQ(destroys.load(), 1); }); - ASSERT_EQ(local.Get(), 0); - thread.join(); - ASSERT_EQ(local.Get(), 0); - ASSERT_EQ(destroys, 2); - }); - thread.join(); -} - -TEST(ThreadLocal, SettingSameValue) { - std::thread thread([&] { - int destroys = 0; - { - fml::ThreadLocal local([&destroys](intptr_t) { destroys++; }); - - local.Set(100); - ASSERT_EQ(destroys, 0); - local.Set(100); - local.Set(100); - local.Set(100); - ASSERT_EQ(local.Get(), 100); - local.Set(100); - local.Set(100); - ASSERT_EQ(destroys, 0); - local.Set(200); - ASSERT_EQ(destroys, 1); - ASSERT_EQ(local.Get(), 200); - } - - ASSERT_EQ(destroys, 1); + ASSERT_EQ(local.get(), nullptr); + thread2.join(); + ASSERT_EQ(local.get(), nullptr); + ASSERT_EQ(destroys.load(), 2); }); thread.join(); + ASSERT_EQ(destroys.load(), 2); } - -#endif // FML_THREAD_LOCAL_PTHREADS diff --git a/lib/ui/compositing/scene_host.cc b/lib/ui/compositing/scene_host.cc index 84decb9a61f76..56aea7a61afdb 100644 --- a/lib/ui/compositing/scene_host.cc +++ b/lib/ui/compositing/scene_host.cc @@ -20,9 +20,8 @@ namespace { using SceneHostBindings = std::unordered_map; -FML_THREAD_LOCAL fml::ThreadLocal tls_scene_host_bindings([](intptr_t value) { - delete reinterpret_cast(value); -}); +FML_THREAD_LOCAL fml::ThreadLocalUniquePtr + tls_scene_host_bindings; void SceneHost_constructor(Dart_NativeArguments args) { tonic::DartCallConstructor(&flutter::SceneHost::Create, args); @@ -31,17 +30,15 @@ void SceneHost_constructor(Dart_NativeArguments args) { void SceneHost_constructorViewHolderToken(Dart_NativeArguments args) { // This UI thread / Isolate contains at least 1 SceneHost. Initialize the // per-Isolate bindings. - if (tls_scene_host_bindings.Get() == 0) { - tls_scene_host_bindings.Set( - reinterpret_cast(new SceneHostBindings())); + if (tls_scene_host_bindings.get() == nullptr) { + tls_scene_host_bindings.reset(new SceneHostBindings()); } tonic::DartCallConstructor(&flutter::SceneHost::CreateViewHolder, args); } flutter::SceneHost* GetSceneHost(scenic::ResourceId id) { - auto* bindings = - reinterpret_cast(tls_scene_host_bindings.Get()); + auto* bindings = tls_scene_host_bindings.get(); FML_DCHECK(bindings); auto binding = bindings->find(id); @@ -147,8 +144,7 @@ SceneHost::SceneHost(fml::RefPtr viewHolderTokenHandle, } auto bind_callback = [scene_host = this](scenic::ResourceId id) { - auto* bindings = - reinterpret_cast(tls_scene_host_bindings.Get()); + auto* bindings = tls_scene_host_bindings.get(); FML_DCHECK(bindings); FML_DCHECK(bindings->find(id) == bindings->end()); @@ -171,8 +167,7 @@ SceneHost::SceneHost(fml::RefPtr viewHolderTokenHandle, SceneHost::~SceneHost() { if (use_view_holder_) { - auto* bindings = - reinterpret_cast(tls_scene_host_bindings.Get()); + auto* bindings = tls_scene_host_bindings.get(); FML_DCHECK(bindings); bindings->erase(id_); From 1239df96aada4f995efd2627b032215e7232692f Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 19 Apr 2019 17:36:36 -0700 Subject: [PATCH 0889/1117] Allow native bindings in secondary isolates. (#8658) The callbacks can be wired in via the Settings object. Both runtime and shell unit-tests have been patched to test this. --- ci/licenses_golden/licenses_flutter | 4 +- common/settings.h | 2 + runtime/BUILD.gn | 2 +- runtime/dart_isolate.cc | 46 ++++++++-- runtime/dart_isolate.h | 14 ++- runtime/dart_isolate_unittests.cc | 87 +++++++++++++------ runtime/dart_lifecycle_unittests.cc | 22 ++--- .../{simple_main.dart => runtime_test.dart} | 13 +++ runtime/runtime_controller.cc | 59 +++++++++---- runtime/runtime_controller.h | 10 ++- runtime/runtime_test.cc | 2 +- shell/common/BUILD.gn | 2 +- shell/common/engine.cc | 4 +- shell/common/fixtures/main.dart | 8 -- shell/common/fixtures/shell_test.dart | 27 ++++++ shell/common/shell_test.cc | 2 +- shell/common/shell_unittests.cc | 39 +++++++++ testing/test_dart_native_resolver.cc | 11 ++- 18 files changed, 268 insertions(+), 86 deletions(-) rename runtime/fixtures/{simple_main.dart => runtime_test.dart} (72%) delete mode 100644 shell/common/fixtures/main.dart create mode 100644 shell/common/fixtures/shell_test.dart diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index a323d42e1aee1..047d6c80645a6 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -392,7 +392,7 @@ FILE: ../../../flutter/runtime/dart_vm_lifecycle.h FILE: ../../../flutter/runtime/dart_vm_unittests.cc FILE: ../../../flutter/runtime/embedder_resources.cc FILE: ../../../flutter/runtime/embedder_resources.h -FILE: ../../../flutter/runtime/fixtures/simple_main.dart +FILE: ../../../flutter/runtime/fixtures/runtime_test.dart FILE: ../../../flutter/runtime/runtime_controller.cc FILE: ../../../flutter/runtime/runtime_controller.h FILE: ../../../flutter/runtime/runtime_delegate.cc @@ -409,7 +409,7 @@ 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/fixtures/main.dart +FILE: ../../../flutter/shell/common/fixtures/shell_test.dart FILE: ../../../flutter/shell/common/isolate_configuration.cc FILE: ../../../flutter/shell/common/isolate_configuration.h FILE: ../../../flutter/shell/common/persistent_cache.cc diff --git a/common/settings.h b/common/settings.h index c7ee514fbdb7f..68b7529033df9 100644 --- a/common/settings.h +++ b/common/settings.h @@ -113,9 +113,11 @@ struct Settings { // The main isolate is current when this callback is made. This is a good spot // to perform native Dart bindings for libraries not built in. fml::closure root_isolate_create_callback; + fml::closure isolate_create_callback; // The isolate is not current and may have already been destroyed when this // call is made. fml::closure root_isolate_shutdown_callback; + fml::closure isolate_shutdown_callback; // The callback made on the UI thread in an isolate scope when the engine // detects that the framework is idle. The VM also uses this time to perform // tasks suitable when idling. Due to this, embedders are still advised to be diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index bcfd7e399d532..96de6356e23e8 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -96,7 +96,7 @@ source_set("runtime") { } test_fixtures("runtime_fixtures") { - fixtures = [ "fixtures/simple_main.dart" ] + fixtures = [ "fixtures/runtime_test.dart" ] } source_set("runtime_unittests_common") { diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 8de6bca542c12..5d751ec73a577 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -39,7 +39,9 @@ std::weak_ptr DartIsolate::CreateRootIsolate( fml::WeakPtr io_manager, std::string advisory_script_uri, std::string advisory_script_entrypoint, - Dart_IsolateFlags* flags) { + Dart_IsolateFlags* flags, + fml::closure isolate_create_callback, + fml::closure isolate_shutdown_callback) { TRACE_EVENT0("flutter", "DartIsolate::CreateRootIsolate"); Dart_Isolate vm_isolate = nullptr; std::weak_ptr embedder_isolate; @@ -49,6 +51,9 @@ std::weak_ptr DartIsolate::CreateRootIsolate( // Since this is the root isolate, we fake a parent embedder data object. We // cannot use unique_ptr here because the destructor is private (since the // isolate lifecycle is entirely managed by the VM). + // + // The child isolate preparer is null but will be set when the isolate is + // being prepared to run. auto root_embedder_data = std::make_unique>( std::make_shared( settings, // settings @@ -59,8 +64,9 @@ std::weak_ptr DartIsolate::CreateRootIsolate( std::move(io_manager), // IO manager advisory_script_uri, // advisory URI advisory_script_entrypoint, // advisory entrypoint - nullptr // child isolate preparer will be set when this isolate is - // prepared to run + nullptr, // child isolate preparer + isolate_create_callback, // isolate create callback + isolate_shutdown_callback // isolate shutdown callback )); std::tie(vm_isolate, embedder_isolate) = CreateDartVMAndEmbedderObjectPair( @@ -102,7 +108,9 @@ DartIsolate::DartIsolate(const Settings& settings, fml::WeakPtr io_manager, std::string advisory_script_uri, std::string advisory_script_entrypoint, - ChildIsolatePreparer child_isolate_preparer) + ChildIsolatePreparer child_isolate_preparer, + fml::closure isolate_create_callback, + fml::closure isolate_shutdown_callback) : UIDartState(std::move(task_runners), settings.task_observer_add, settings.task_observer_remove, @@ -116,7 +124,9 @@ DartIsolate::DartIsolate(const Settings& settings, settings_(settings), isolate_snapshot_(std::move(isolate_snapshot)), shared_snapshot_(std::move(shared_snapshot)), - child_isolate_preparer_(std::move(child_isolate_preparer)) { + child_isolate_preparer_(std::move(child_isolate_preparer)), + isolate_create_callback_(isolate_create_callback), + isolate_shutdown_callback_(isolate_shutdown_callback) { FML_DCHECK(isolate_snapshot_) << "Must contain a valid isolate snapshot."; phase_ = Phase::Uninitialized; } @@ -279,6 +289,11 @@ bool DartIsolate::PrepareForRunningFromPrecompiledCode() { child_isolate_preparer_ = [](DartIsolate* isolate) { return isolate->PrepareForRunningFromPrecompiledCode(); }; + + if (isolate_create_callback_) { + isolate_create_callback_(); + } + phase_ = Phase::Ready; return true; } @@ -365,7 +380,13 @@ bool DartIsolate::PrepareForRunningFromKernel( return true; }; } + + if (isolate_create_callback_) { + isolate_create_callback_(); + } + phase_ = Phase::Ready; + return true; } @@ -563,7 +584,9 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( {}, // IO Manager DART_VM_SERVICE_ISOLATE_NAME, // script uri DART_VM_SERVICE_ISOLATE_NAME, // script entrypoint - flags // flags + flags, // flags + nullptr, // isolate create callback + nullptr // isolate shutdown callback ); std::shared_ptr service_isolate = weak_service_isolate.lock(); @@ -662,6 +685,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( TaskRunners null_task_runners(advisory_script_uri, nullptr, nullptr, nullptr, nullptr); + // Copy most fields from the parent to the child. embedder_isolate = std::make_unique>( std::make_shared( (*raw_embedder_isolate)->GetSettings(), // settings @@ -672,7 +696,12 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( fml::WeakPtr{}, // io_manager advisory_script_uri, // advisory_script_uri advisory_script_entrypoint, // advisory_script_entrypoint - (*raw_embedder_isolate)->child_isolate_preparer_)); + (*raw_embedder_isolate)->child_isolate_preparer_, // preparer + (*raw_embedder_isolate)->isolate_create_callback_, // on create + (*raw_embedder_isolate)->isolate_shutdown_callback_ // on shutdown + ) + + ); } // Create the Dart VM isolate and give it the embedder object as the baton. @@ -755,6 +784,9 @@ void DartIsolate::AddIsolateShutdownCallback(fml::closure closure) { void DartIsolate::OnShutdownCallback() { shutdown_callbacks_.clear(); + if (isolate_shutdown_callback_) { + isolate_shutdown_callback_(); + } } DartIsolate::AutoFireClosure::AutoFireClosure(fml::closure closure) diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index d2c09517e1676..b86ba27a12e70 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -51,7 +51,9 @@ class DartIsolate : public UIDartState { fml::WeakPtr io_manager, std::string advisory_script_uri, std::string advisory_script_entrypoint, - Dart_IsolateFlags* flags = nullptr); + Dart_IsolateFlags* flags, + fml::closure isolate_create_callback, + fml::closure isolate_shutdown_callback); DartIsolate(const Settings& settings, fml::RefPtr isolate_snapshot, @@ -61,7 +63,9 @@ class DartIsolate : public UIDartState { fml::WeakPtr io_manager, std::string advisory_script_uri, std::string advisory_script_entrypoint, - ChildIsolatePreparer child_isolate_preparer); + ChildIsolatePreparer child_isolate_preparer, + fml::closure isolate_create_callback, + fml::closure isolate_shutdown_callback); ~DartIsolate() override; @@ -128,9 +132,11 @@ class DartIsolate : public UIDartState { std::vector> shutdown_callbacks_; ChildIsolatePreparer child_isolate_preparer_ = nullptr; fml::RefPtr message_handling_task_runner_; + const fml::closure isolate_create_callback_; + const fml::closure isolate_shutdown_callback_; - FML_WARN_UNUSED_RESULT - bool Initialize(Dart_Isolate isolate, bool is_root_isolate); + FML_WARN_UNUSED_RESULT bool Initialize(Dart_Isolate isolate, + bool is_root_isolate); void SetMessageHandlingTaskRunner(fml::RefPtr runner, bool is_root_isolate); diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc index eb12946e93511..98644a1fc7c08 100644 --- a/runtime/dart_isolate_unittests.cc +++ b/runtime/dart_isolate_unittests.cc @@ -5,6 +5,7 @@ #include "flutter/fml/make_copyable.h" #include "flutter/fml/mapping.h" #include "flutter/fml/paths.h" +#include "flutter/fml/synchronization/count_down_latch.h" #include "flutter/fml/synchronization/waitable_event.h" #include "flutter/fml/thread.h" #include "flutter/runtime/dart_isolate.h" @@ -35,15 +36,18 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) { GetCurrentTaskRunner() // ); auto weak_isolate = DartIsolate::CreateRootIsolate( - vm_data->GetSettings(), // settings - vm_data->GetIsolateSnapshot(), // isolate snapshot - vm_data->GetSharedSnapshot(), // shared snapshot - std::move(task_runners), // task runners - nullptr, // window - {}, // snapshot delegate - {}, // io manager - "main.dart", // advisory uri - "main" // advisory entrypoint + vm_data->GetSettings(), // settings + vm_data->GetIsolateSnapshot(), // isolate snapshot + vm_data->GetSharedSnapshot(), // shared snapshot + std::move(task_runners), // task runners + nullptr, // window + {}, // snapshot delegate + {}, // io manager + "main.dart", // advisory uri + "main", // advisory entrypoint, + nullptr, // flags + settings.isolate_create_callback, // isolate create callback + settings.isolate_shutdown_callback // isolate shutdown callback ); auto root_isolate = weak_isolate.lock(); ASSERT_TRUE(root_isolate); @@ -65,15 +69,18 @@ TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) { GetCurrentTaskRunner() // ); auto weak_isolate = DartIsolate::CreateRootIsolate( - vm_data->GetSettings(), // settings - vm_data->GetIsolateSnapshot(), // isolate snapshot - vm_data->GetSharedSnapshot(), // shared snapshot - std::move(task_runners), // task runners - nullptr, // window - {}, // snapshot delegate - {}, // io manager - "main.dart", // advisory uri - "main" // advisory entrypoint + vm_data->GetSettings(), // settings + vm_data->GetIsolateSnapshot(), // isolate snapshot + vm_data->GetSharedSnapshot(), // shared snapshot + std::move(task_runners), // task runners + nullptr, // window + {}, // snapshot delegate + {}, // io manager + "main.dart", // advisory uri + "main", // advisory entrypoint + nullptr, // flags + settings.isolate_create_callback, // isolate create callback + settings.isolate_shutdown_callback // isolate shutdown callback ); auto root_isolate = weak_isolate.lock(); ASSERT_TRUE(root_isolate); @@ -171,15 +178,18 @@ static void RunDartCodeInIsolate(DartVMRef& vm_ref, } auto weak_isolate = DartIsolate::CreateRootIsolate( - vm_data->GetSettings(), // settings - vm_data->GetIsolateSnapshot(), // isolate snapshot - vm_data->GetSharedSnapshot(), // shared snapshot - std::move(task_runners), // task runners - nullptr, // window - {}, // snapshot delegate - {}, // io manager - "main.dart", // advisory uri - "main" // advisory entrypoint + vm_data->GetSettings(), // settings + vm_data->GetIsolateSnapshot(), // isolate snapshot + vm_data->GetSharedSnapshot(), // shared snapshot + std::move(task_runners), // task runners + nullptr, // window + {}, // snapshot delegate + {}, // io manager + "main.dart", // advisory uri + "main", // advisory entrypoint + nullptr, // flags + settings.isolate_create_callback, // isolate create callback + settings.isolate_shutdown_callback // isolate shutdown callback ); auto root_isolate = @@ -345,5 +355,28 @@ TEST_F(DartIsolateTest, CanSaveCompilationTrace) { latch.Wait(); } +TEST_F(DartIsolateTest, CanLaunchSecondaryIsolates) { + fml::CountDownLatch latch(3); + AddNativeCallback("NotifyNative", + CREATE_NATIVE_ENTRY(([&latch](Dart_NativeArguments args) { + latch.CountDown(); + }))); + AddNativeCallback( + "PassMessage", CREATE_NATIVE_ENTRY(([&latch](Dart_NativeArguments args) { + auto message = tonic::DartConverter::FromDart( + Dart_GetNativeArgument(args, 0)); + ASSERT_EQ("Hello from code is secondary isolate.", message); + latch.CountDown(); + }))); + const auto settings = CreateSettingsForFixture(); + auto vm_ref = DartVMRef::Create(settings); + auto isolate = RunDartCodeInIsolate(vm_ref, settings, GetThreadTaskRunner(), + "testCanLaunchSecondaryIsolate"); + ASSERT_TRUE(isolate); + ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running); + + latch.Wait(); +} + } // namespace testing } // namespace flutter diff --git a/runtime/dart_lifecycle_unittests.cc b/runtime/dart_lifecycle_unittests.cc index f50de29089092..7ac4f6413d788 100644 --- a/runtime/dart_lifecycle_unittests.cc +++ b/runtime/dart_lifecycle_unittests.cc @@ -51,16 +51,18 @@ static std::shared_ptr CreateAndRunRootIsolate( TaskRunners runners("io.flutter.test", task_runner, task_runner, task_runner, task_runner); auto isolate_weak = DartIsolate::CreateRootIsolate( - vm.GetSettings(), // settings - vm.GetIsolateSnapshot(), // isolate_snapshot - vm.GetSharedSnapshot(), // shared_snapshot - runners, // task_runners - {}, // window - {}, // snapshot_delegate - {}, // io_manager - "main.dart", // advisory_script_uri - entrypoint.c_str(), // advisory_script_entrypoint - nullptr // flags + vm.GetSettings(), // settings + vm.GetIsolateSnapshot(), // isolate_snapshot + vm.GetSharedSnapshot(), // shared_snapshot + runners, // task_runners + {}, // window + {}, // snapshot_delegate + {}, // io_manager + "main.dart", // advisory_script_uri + entrypoint.c_str(), // advisory_script_entrypoint + nullptr, // flags + settings.isolate_create_callback, // isolate create callback + settings.isolate_shutdown_callback // isolate shutdown callback ); auto isolate = isolate_weak.lock(); diff --git a/runtime/fixtures/simple_main.dart b/runtime/fixtures/runtime_test.dart similarity index 72% rename from runtime/fixtures/simple_main.dart rename to runtime/fixtures/runtime_test.dart index f9ba92d98f7fd..6f67e01b6b2ff 100644 --- a/runtime/fixtures/simple_main.dart +++ b/runtime/fixtures/runtime_test.dart @@ -42,3 +42,16 @@ void testCanSaveCompilationTrace() { } void NotifyResult(bool success) native "NotifyNative"; +void PassMessage(String message) native "PassMessage"; + +void secondaryIsolateMain(String message) { + print("Secondary isolate got message: " + message); + PassMessage("Hello from code is secondary isolate."); + NotifyNative(); +} + +@pragma('vm:entry-point') +void testCanLaunchSecondaryIsolate() { + Isolate.spawn(secondaryIsolateMain, "Hello from root isolate."); + NotifyNative(); +} diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc index 341cbe7ee078d..45267ecc3e820 100644 --- a/runtime/runtime_controller.cc +++ b/runtime/runtime_controller.cc @@ -24,7 +24,9 @@ RuntimeController::RuntimeController( fml::WeakPtr p_io_manager, std::string p_advisory_script_uri, std::string p_advisory_script_entrypoint, - std::function p_idle_notification_callback) + std::function p_idle_notification_callback, + fml::closure p_isolate_create_callback, + fml::closure p_isolate_shutdown_callback) : RuntimeController(p_client, p_vm, std::move(p_isolate_snapshot), @@ -35,7 +37,9 @@ RuntimeController::RuntimeController( std::move(p_advisory_script_uri), std::move(p_advisory_script_entrypoint), p_idle_notification_callback, - WindowData{/* default window data */}) {} + WindowData{/* default window data */}, + p_isolate_create_callback, + p_isolate_shutdown_callback) {} RuntimeController::RuntimeController( RuntimeDelegate& p_client, @@ -48,7 +52,9 @@ RuntimeController::RuntimeController( std::string p_advisory_script_uri, std::string p_advisory_script_entrypoint, std::function idle_notification_callback, - WindowData p_window_data) + WindowData p_window_data, + fml::closure p_isolate_create_callback, + fml::closure p_isolate_shutdown_callback) : client_(p_client), vm_(p_vm), isolate_snapshot_(std::move(p_isolate_snapshot)), @@ -60,22 +66,38 @@ RuntimeController::RuntimeController( advisory_script_entrypoint_(p_advisory_script_entrypoint), idle_notification_callback_(idle_notification_callback), window_data_(std::move(p_window_data)), - root_isolate_( - DartIsolate::CreateRootIsolate(vm_->GetVMData()->GetSettings(), - isolate_snapshot_, - shared_snapshot_, - task_runners_, - std::make_unique(this), - snapshot_delegate_, - io_manager_, - p_advisory_script_uri, - p_advisory_script_entrypoint)) { - std::shared_ptr root_isolate = root_isolate_.lock(); - root_isolate->SetReturnCodeCallback([this](uint32_t code) { + isolate_create_callback_(p_isolate_create_callback), + isolate_shutdown_callback_(p_isolate_shutdown_callback) { + // Create the root isolate as soon as the runtime controller is initialized. + // It will be run at a later point when the engine provides a run + // configuration and then runs the isolate. + auto strong_root_isolate = + DartIsolate::CreateRootIsolate(vm_->GetVMData()->GetSettings(), // + isolate_snapshot_, // + shared_snapshot_, // + task_runners_, // + std::make_unique(this), // + snapshot_delegate_, // + io_manager_, // + p_advisory_script_uri, // + p_advisory_script_entrypoint, // + nullptr, // + isolate_create_callback_, // + isolate_shutdown_callback_ // + ) + .lock(); + + FML_CHECK(strong_root_isolate) << "Could not create root isolate."; + + // The root isolate ivar is weak. + root_isolate_ = strong_root_isolate; + + strong_root_isolate->SetReturnCodeCallback([this](uint32_t code) { root_isolate_return_code_ = {true, code}; }); + if (auto* window = GetWindowIfAvailable()) { - tonic::DartState::Scope scope(root_isolate); + tonic::DartState::Scope scope(strong_root_isolate); window->DidCreateIsolate(); if (!FlushRuntimeStateToIsolate()) { FML_DLOG(ERROR) << "Could not setup intial isolate state."; @@ -83,6 +105,7 @@ RuntimeController::RuntimeController( } else { FML_DCHECK(false) << "RuntimeController created without window binding."; } + FML_DCHECK(Dart_CurrentIsolate() == nullptr); } @@ -119,7 +142,9 @@ std::unique_ptr RuntimeController::Clone() const { advisory_script_uri_, // advisory_script_entrypoint_, // idle_notification_callback_, // - window_data_ // + window_data_, // + isolate_create_callback_, // + isolate_shutdown_callback_ // )); } diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h index fbc92aeb60f22..8522b35d2ff76 100644 --- a/runtime/runtime_controller.h +++ b/runtime/runtime_controller.h @@ -37,7 +37,9 @@ class RuntimeController final : public WindowClient { fml::WeakPtr io_manager, std::string advisory_script_uri, std::string advisory_script_entrypoint, - std::function idle_notification_callback); + std::function idle_notification_callback, + fml::closure isolate_create_callback, + fml::closure isolate_shutdown_callback); ~RuntimeController() override; @@ -132,6 +134,8 @@ class RuntimeController final : public WindowClient { WindowData window_data_; std::weak_ptr root_isolate_; std::pair root_isolate_return_code_ = {false, 0}; + const fml::closure isolate_create_callback_; + const fml::closure isolate_shutdown_callback_; RuntimeController(RuntimeDelegate& client, DartVM* vm, @@ -143,7 +147,9 @@ class RuntimeController final : public WindowClient { std::string advisory_script_uri, std::string advisory_script_entrypoint, std::function idle_notification_callback, - WindowData data); + WindowData data, + fml::closure isolate_create_callback, + fml::closure isolate_shutdown_callback); Window* GetWindowIfAvailable(); diff --git a/runtime/runtime_test.cc b/runtime/runtime_test.cc index 97d42bc431418..264e619ffdde3 100644 --- a/runtime/runtime_test.cc +++ b/runtime/runtime_test.cc @@ -60,7 +60,7 @@ Settings RuntimeTest::CreateSettingsForFixture() { settings.leak_vm = false; settings.task_observer_add = [](intptr_t, fml::closure) {}; settings.task_observer_remove = [](intptr_t) {}; - settings.root_isolate_create_callback = [this]() { + settings.isolate_create_callback = [this]() { native_resolver_->SetNativeResolverForIsolate(); }; SetSnapshotsAndAssets(settings); diff --git a/shell/common/BUILD.gn b/shell/common/BUILD.gn index 48d949e227e1e..b5103cca08c82 100644 --- a/shell/common/BUILD.gn +++ b/shell/common/BUILD.gn @@ -148,7 +148,7 @@ shell_gpu_configuration("shell_unittests_gpu_configuration") { } test_fixtures("shell_unittests_fixtures") { - fixtures = [ "fixtures/main.dart" ] + fixtures = [ "fixtures/shell_test.dart" ] } shell_host_executable("shell_unittests") { diff --git a/shell/common/engine.cc b/shell/common/engine.cc index a427df24dae85..3d049f1c031b1 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -62,7 +62,9 @@ Engine::Engine(Delegate& delegate, std::move(io_manager), // io manager settings_.advisory_script_uri, // advisory script uri settings_.advisory_script_entrypoint, // advisory script entrypoint - settings_.idle_notification_callback // idle notification callback + settings_.idle_notification_callback, // idle notification callback + settings_.isolate_create_callback, // isolate create callback + settings_.isolate_shutdown_callback // isolate shutdown callback ); } diff --git a/shell/common/fixtures/main.dart b/shell/common/fixtures/main.dart deleted file mode 100644 index c896712d2da7e..0000000000000 --- a/shell/common/fixtures/main.dart +++ /dev/null @@ -1,8 +0,0 @@ -main() {} - -@pragma('vm:entry-point') -fixturesAreFunctionalMain() { - SayHiFromFixturesAreFunctionalMain(); -} - -void SayHiFromFixturesAreFunctionalMain() native "SayHiFromFixturesAreFunctionalMain"; \ No newline at end of file diff --git a/shell/common/fixtures/shell_test.dart b/shell/common/fixtures/shell_test.dart new file mode 100644 index 0000000000000..705ac12b95b04 --- /dev/null +++ b/shell/common/fixtures/shell_test.dart @@ -0,0 +1,27 @@ +// Copyright 2013 The Flutter 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 'dart:isolate'; + +main() {} + +@pragma('vm:entry-point') +fixturesAreFunctionalMain() { + SayHiFromFixturesAreFunctionalMain(); +} + +void SayHiFromFixturesAreFunctionalMain() native "SayHiFromFixturesAreFunctionalMain"; + +void NotifyNative() native "NotifyNative"; + +void secondaryIsolateMain(String message) { + print("Secondary isolate got message: " + message); + NotifyNative(); +} + +@pragma('vm:entry-point') +void testCanLaunchSecondaryIsolate() { + Isolate.spawn(secondaryIsolateMain, "Hello from root isolate."); + NotifyNative(); +} diff --git a/shell/common/shell_test.cc b/shell/common/shell_test.cc index bf70163ad3dd8..a6c958f7bbfa8 100644 --- a/shell/common/shell_test.cc +++ b/shell/common/shell_test.cc @@ -67,7 +67,7 @@ Settings ShellTest::CreateSettingsForFixture() { settings.task_observer_remove = [](intptr_t key) { fml::MessageLoop::GetCurrent().RemoveTaskObserver(key); }; - settings.root_isolate_create_callback = [this]() { + settings.isolate_create_callback = [this]() { native_resolver_->SetNativeResolverForIsolate(); }; SetSnapshotsAndAssets(settings); diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc index 9def5530306f3..b18cdf2cd1dff 100644 --- a/shell/common/shell_unittests.cc +++ b/shell/common/shell_unittests.cc @@ -10,6 +10,7 @@ #include "flutter/fml/make_copyable.h" #include "flutter/fml/message_loop.h" +#include "flutter/fml/synchronization/count_down_latch.h" #include "flutter/fml/synchronization/waitable_event.h" #include "flutter/shell/common/platform_view.h" #include "flutter/shell/common/rasterizer.h" @@ -267,5 +268,43 @@ TEST_F(ShellTest, FixturesAreFunctional) { ASSERT_FALSE(DartVMRef::IsInstanceRunning()); } +TEST_F(ShellTest, SecondaryIsolateBindingsAreSetupViaShellSettings) { + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); + const auto settings = CreateSettingsForFixture(); + auto shell = Shell::Create( + GetTaskRunnersForFixture(), settings, + [](Shell& shell) { + return std::make_unique(shell, + shell.GetTaskRunners()); + }, + [](Shell& shell) { + return std::make_unique(shell.GetTaskRunners()); + }); + ASSERT_TRUE(ValidateShell(shell.get())); + + auto configuration = RunConfiguration::InferFromSettings(settings); + ASSERT_TRUE(configuration.IsValid()); + configuration.SetEntrypoint("testCanLaunchSecondaryIsolate"); + + fml::CountDownLatch latch(2); + AddNativeCallback("NotifyNative", CREATE_NATIVE_ENTRY([&latch](auto args) { + latch.CountDown(); + })); + + fml::TaskRunner::RunNowOrPostTask( + shell->GetTaskRunners().GetUITaskRunner(), + fml::MakeCopyable([config = std::move(configuration), + engine = shell->GetEngine()]() mutable { + ASSERT_TRUE(engine); + ASSERT_EQ(engine->Run(std::move(config)), Engine::RunStatus::Success); + })); + + latch.Wait(); + + ASSERT_TRUE(DartVMRef::IsInstanceRunning()); + shell.reset(); + ASSERT_FALSE(DartVMRef::IsInstanceRunning()); +} + } // namespace testing } // namespace flutter diff --git a/testing/test_dart_native_resolver.cc b/testing/test_dart_native_resolver.cc index 62fb2a4944d96..a6d3684ad566b 100644 --- a/testing/test_dart_native_resolver.cc +++ b/testing/test_dart_native_resolver.cc @@ -7,7 +7,9 @@ #include #include +#include "flutter/fml/logging.h" #include "flutter/fml/synchronization/thread_annotations.h" +#include "third_party/tonic/logging/dart_error.h" #include "tonic/converter/dart_converter.h" namespace testing { @@ -44,6 +46,7 @@ Dart_NativeFunction TestDartNativeResolver::DartNativeEntryResolverCallback( std::lock_guard lock(gIsolateResolversMutex); auto found = gIsolateResolvers.find(Dart_CurrentIsolate()); if (found == gIsolateResolvers.end()) { + FML_LOG(ERROR) << "Could not resolve native method for :" << name; return nullptr; } @@ -53,6 +56,7 @@ Dart_NativeFunction TestDartNativeResolver::DartNativeEntryResolverCallback( gIsolateResolvers.erase(found); } + FML_LOG(ERROR) << "Could not resolve native method for :" << name; return nullptr; } @@ -62,13 +66,12 @@ static const uint8_t* DartNativeEntrySymbolCallback( } void TestDartNativeResolver::SetNativeResolverForIsolate() { + FML_CHECK(!Dart_IsError(Dart_RootLibrary())); auto result = Dart_SetNativeResolver(Dart_RootLibrary(), DartNativeEntryResolverCallback, DartNativeEntrySymbolCallback); - - if (Dart_IsError(result)) { - return; - } + FML_CHECK(!tonic::LogIfError(result)) + << "Could not set native resolver in test."; std::lock_guard lock(gIsolateResolversMutex); gIsolateResolvers[Dart_CurrentIsolate()] = shared_from_this(); From 2e4f0a4a72d1b051ff0f114289594975beeca6ba Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Sat, 20 Apr 2019 20:42:46 -0700 Subject: [PATCH 0890/1117] Put the testing lib in the flutter namespace. (#8661) --- runtime/dart_isolate_unittests.cc | 34 ++++---- runtime/runtime_test.cc | 6 +- runtime/runtime_test.h | 4 +- shell/common/shell_test.cc | 33 +++++++- shell/common/shell_test.h | 27 ++++++- shell/common/shell_unittests.cc | 78 ++++++------------- .../embedder/tests/embedder_a11y_unittests.cc | 2 +- .../embedder/tests/embedder_context.cc | 6 +- .../embedder/tests/embedder_context.h | 2 +- .../platform/embedder/tests/embedder_test.cc | 2 +- testing/build/gen_fixtures_location_symbol.py | 2 +- testing/run_all_unittests.cc | 2 +- testing/test_dart_native_resolver.cc | 2 + testing/test_dart_native_resolver.h | 4 +- testing/testing.cc | 4 +- testing/testing.h | 2 + testing/thread_test.cc | 2 + testing/thread_test.h | 4 +- 18 files changed, 122 insertions(+), 94 deletions(-) diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc index 98644a1fc7c08..a3e03b59b0604 100644 --- a/runtime/dart_isolate_unittests.cc +++ b/runtime/dart_isolate_unittests.cc @@ -29,11 +29,11 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) { ASSERT_TRUE(vm_ref); auto vm_data = vm_ref.GetVMData(); ASSERT_TRUE(vm_data); - TaskRunners task_runners(::testing::GetCurrentTestName(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner() // + TaskRunners task_runners(GetCurrentTestName(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner() // ); auto weak_isolate = DartIsolate::CreateRootIsolate( vm_data->GetSettings(), // settings @@ -62,11 +62,11 @@ TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) { ASSERT_TRUE(vm_ref); auto vm_data = vm_ref.GetVMData(); ASSERT_TRUE(vm_data); - TaskRunners task_runners(::testing::GetCurrentTestName(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner() // + TaskRunners task_runners(GetCurrentTestName(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner(), // + GetCurrentTaskRunner() // ); auto weak_isolate = DartIsolate::CreateRootIsolate( vm_data->GetSettings(), // settings @@ -164,11 +164,11 @@ static void RunDartCodeInIsolate(DartVMRef& vm_ref, return; } - TaskRunners task_runners(::testing::GetCurrentTestName(), // - task_runner, // - task_runner, // - task_runner, // - task_runner // + TaskRunners task_runners(GetCurrentTestName(), // + task_runner, // + task_runner, // + task_runner, // + task_runner // ); auto vm_data = vm_ref.GetVMData(); @@ -206,8 +206,8 @@ static void RunDartCodeInIsolate(DartVMRef& vm_ref, } if (!DartVM::IsRunningPrecompiledCode()) { - auto kernel_file_path = fml::paths::JoinPaths( - {::testing::GetFixturesPath(), "kernel_blob.bin"}); + auto kernel_file_path = + fml::paths::JoinPaths({GetFixturesPath(), "kernel_blob.bin"}); if (!fml::IsFile(kernel_file_path)) { FML_LOG(ERROR) << "Could not locate kernel file."; diff --git a/runtime/runtime_test.cc b/runtime/runtime_test.cc index 264e619ffdde3..455a52c95a67a 100644 --- a/runtime/runtime_test.cc +++ b/runtime/runtime_test.cc @@ -11,7 +11,7 @@ namespace flutter { namespace testing { RuntimeTest::RuntimeTest() - : native_resolver_(std::make_shared<::testing::TestDartNativeResolver>()) {} + : native_resolver_(std::make_shared()) {} RuntimeTest::~RuntimeTest() = default; @@ -69,8 +69,8 @@ Settings RuntimeTest::CreateSettingsForFixture() { // |testing::ThreadTest| void RuntimeTest::SetUp() { - assets_dir_ = fml::OpenDirectory(::testing::GetFixturesPath(), false, - fml::FilePermission::kRead); + assets_dir_ = + fml::OpenDirectory(GetFixturesPath(), false, fml::FilePermission::kRead); ThreadTest::SetUp(); } diff --git a/runtime/runtime_test.h b/runtime/runtime_test.h index 40f781cf8f97a..8c60a6e858a6c 100644 --- a/runtime/runtime_test.h +++ b/runtime/runtime_test.h @@ -15,7 +15,7 @@ namespace flutter { namespace testing { -class RuntimeTest : public ::testing::ThreadTest { +class RuntimeTest : public ThreadTest { public: RuntimeTest(); @@ -34,7 +34,7 @@ class RuntimeTest : public ::testing::ThreadTest { private: fml::UniqueFD assets_dir_; - std::shared_ptr<::testing::TestDartNativeResolver> native_resolver_; + std::shared_ptr native_resolver_; void SetSnapshotsAndAssets(Settings& settings); }; diff --git a/shell/common/shell_test.cc b/shell/common/shell_test.cc index a6c958f7bbfa8..54bbd9d18f79e 100644 --- a/shell/common/shell_test.cc +++ b/shell/common/shell_test.cc @@ -14,7 +14,7 @@ namespace flutter { namespace testing { ShellTest::ShellTest() - : native_resolver_(std::make_shared<::testing::TestDartNativeResolver>()) {} + : native_resolver_(std::make_shared()) {} ShellTest::~ShellTest() = default; @@ -87,10 +87,10 @@ TaskRunners ShellTest::GetTaskRunnersForFixture() { // |testing::ThreadTest| void ShellTest::SetUp() { ThreadTest::SetUp(); - assets_dir_ = fml::OpenDirectory(::testing::GetFixturesPath(), false, - fml::FilePermission::kRead); + assets_dir_ = + fml::OpenDirectory(GetFixturesPath(), false, fml::FilePermission::kRead); thread_host_ = std::make_unique( - "io.flutter.test." + ::testing::GetCurrentTestName() + ".", + "io.flutter.test." + GetCurrentTestName() + ".", ThreadHost::Type::Platform | ThreadHost::Type::IO | ThreadHost::Type::UI | ThreadHost::Type::GPU); } @@ -107,5 +107,30 @@ void ShellTest::AddNativeCallback(std::string name, native_resolver_->AddNativeCallback(std::move(name), callback); } +ShellTestPlatformView::ShellTestPlatformView(PlatformView::Delegate& delegate, + TaskRunners task_runners) + : PlatformView(delegate, std::move(task_runners)) {} + +ShellTestPlatformView::~ShellTestPlatformView() = default; + +// |PlatformView| +std::unique_ptr ShellTestPlatformView::CreateRenderingSurface() { + return std::make_unique(this); +} + +// |GPUSurfaceSoftwareDelegate| +sk_sp ShellTestPlatformView::AcquireBackingStore( + const SkISize& size) { + SkImageInfo image_info = SkImageInfo::MakeN32Premul( + size.width(), size.height(), SkColorSpace::MakeSRGB()); + return SkSurface::MakeRaster(image_info); +} + +// |GPUSurfaceSoftwareDelegate| +bool ShellTestPlatformView::PresentBackingStore( + sk_sp backing_store) { + return true; +} + } // namespace testing } // namespace flutter diff --git a/shell/common/shell_test.h b/shell/common/shell_test.h index c88fde85aa812..e011cb6e9d237 100644 --- a/shell/common/shell_test.h +++ b/shell/common/shell_test.h @@ -10,14 +10,16 @@ #include "flutter/common/settings.h" #include "flutter/fml/macros.h" #include "flutter/shell/common/run_configuration.h" +#include "flutter/shell/common/shell.h" #include "flutter/shell/common/thread_host.h" +#include "flutter/shell/gpu/gpu_surface_software.h" #include "flutter/testing/test_dart_native_resolver.h" #include "flutter/testing/thread_test.h" namespace flutter { namespace testing { -class ShellTest : public ::testing::ThreadTest { +class ShellTest : public ThreadTest { public: ShellTest(); @@ -38,12 +40,33 @@ class ShellTest : public ::testing::ThreadTest { private: fml::UniqueFD assets_dir_; - std::shared_ptr<::testing::TestDartNativeResolver> native_resolver_; + std::shared_ptr native_resolver_; std::unique_ptr thread_host_; void SetSnapshotsAndAssets(Settings& settings); }; +class ShellTestPlatformView : public PlatformView, + public GPUSurfaceSoftwareDelegate { + public: + ShellTestPlatformView(PlatformView::Delegate& delegate, + TaskRunners task_runners); + + ~ShellTestPlatformView() override; + + private: + // |PlatformView| + std::unique_ptr CreateRenderingSurface() override; + + // |GPUSurfaceSoftwareDelegate| + virtual sk_sp AcquireBackingStore(const SkISize& size) override; + + // |GPUSurfaceSoftwareDelegate| + virtual bool PresentBackingStore(sk_sp backing_store) override; + + FML_DISALLOW_COPY_AND_ASSIGN(ShellTestPlatformView); +}; + } // namespace testing } // namespace flutter diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc index b18cdf2cd1dff..2ad540ee830e2 100644 --- a/shell/common/shell_unittests.cc +++ b/shell/common/shell_unittests.cc @@ -14,43 +14,13 @@ #include "flutter/fml/synchronization/waitable_event.h" #include "flutter/shell/common/platform_view.h" #include "flutter/shell/common/rasterizer.h" -#include "flutter/shell/common/shell.h" #include "flutter/shell/common/shell_test.h" #include "flutter/shell/common/thread_host.h" -#include "flutter/shell/gpu/gpu_surface_software.h" #include "flutter/testing/testing.h" -#include "gtest/gtest.h" namespace flutter { namespace testing { -class TestPlatformView : public PlatformView, - public GPUSurfaceSoftwareDelegate { - public: - TestPlatformView(PlatformView::Delegate& delegate, 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 { - SkImageInfo image_info = SkImageInfo::MakeN32Premul( - size.width(), size.height(), SkColorSpace::MakeSRGB()); - return SkSurface::MakeRaster(image_info); - } - - // |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; @@ -90,8 +60,8 @@ TEST_F(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()); @@ -103,10 +73,9 @@ TEST_F(ShellTest, InitializeWithInvalidThreads) { TEST_F(ShellTest, InitializeWithDifferentThreads) { ASSERT_FALSE(DartVMRef::IsInstanceRunning()); Settings settings = CreateSettingsForFixture(); - ThreadHost thread_host( - "io.flutter.test." + ::testing::GetCurrentTestName() + ".", - ThreadHost::Type::Platform | ThreadHost::Type::GPU | - ThreadHost::Type::IO | ThreadHost::Type::UI); + ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".", + ThreadHost::Type::Platform | ThreadHost::Type::GPU | + ThreadHost::Type::IO | ThreadHost::Type::UI); TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(), thread_host.gpu_thread->GetTaskRunner(), thread_host.ui_thread->GetTaskRunner(), @@ -114,8 +83,8 @@ TEST_F(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()); @@ -129,17 +98,16 @@ TEST_F(ShellTest, InitializeWithDifferentThreads) { TEST_F(ShellTest, InitializeWithSingleThread) { ASSERT_FALSE(DartVMRef::IsInstanceRunning()); Settings settings = CreateSettingsForFixture(); - ThreadHost thread_host( - "io.flutter.test." + ::testing::GetCurrentTestName() + ".", - ThreadHost::Type::Platform); + ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".", + ThreadHost::Type::Platform); auto task_runner = thread_host.platform_thread->GetTaskRunner(); TaskRunners task_runners("test", task_runner, task_runner, task_runner, task_runner); 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()); @@ -160,8 +128,8 @@ TEST_F(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()); @@ -177,7 +145,7 @@ TEST_F(ShellTest, ASSERT_FALSE(DartVMRef::IsInstanceRunning()); Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( - "io.flutter.test." + ::testing::GetCurrentTestName() + ".", + "io.flutter.test." + GetCurrentTestName() + ".", ThreadHost::Type::GPU | ThreadHost::Type::IO | ThreadHost::Type::UI); fml::MessageLoop::EnsureInitializedForCurrentThread(); TaskRunners task_runners("test", @@ -188,8 +156,8 @@ TEST_F(ShellTest, 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()); @@ -204,7 +172,7 @@ TEST_F(ShellTest, InitializeWithGPUAndPlatformThreadsTheSame) { ASSERT_FALSE(DartVMRef::IsInstanceRunning()); Settings settings = CreateSettingsForFixture(); ThreadHost thread_host( - "io.flutter.test." + ::testing::GetCurrentTestName() + ".", + "io.flutter.test." + GetCurrentTestName() + ".", ThreadHost::Type::Platform | ThreadHost::Type::IO | ThreadHost::Type::UI); TaskRunners task_runners( "test", @@ -216,8 +184,8 @@ TEST_F(ShellTest, InitializeWithGPUAndPlatformThreadsTheSame) { 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()); @@ -234,8 +202,8 @@ TEST_F(ShellTest, FixturesAreFunctional) { auto shell = Shell::Create( GetTaskRunnersForFixture(), 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()); @@ -274,8 +242,8 @@ TEST_F(ShellTest, SecondaryIsolateBindingsAreSetupViaShellSettings) { auto shell = Shell::Create( GetTaskRunnersForFixture(), 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()); diff --git a/shell/platform/embedder/tests/embedder_a11y_unittests.cc b/shell/platform/embedder/tests/embedder_a11y_unittests.cc index 5da4938175bfb..eb83886ae0eed 100644 --- a/shell/platform/embedder/tests/embedder_a11y_unittests.cc +++ b/shell/platform/embedder/tests/embedder_a11y_unittests.cc @@ -34,7 +34,7 @@ TEST_F(Embedder11yTest, A11yTreeIsConsistent) { }))); // Called by test fixture on UI thread to pass data back to this test. - ::testing::NativeEntry callback; + NativeEntry callback; context.AddNativeCallback( "NotifyTestData", CREATE_NATIVE_ENTRY(([&callback](Dart_NativeArguments args) { diff --git a/shell/platform/embedder/tests/embedder_context.cc b/shell/platform/embedder/tests/embedder_context.cc index eecec06fe8c9a..46b8c2e6f14bd 100644 --- a/shell/platform/embedder/tests/embedder_context.cc +++ b/shell/platform/embedder/tests/embedder_context.cc @@ -11,7 +11,7 @@ namespace testing { EmbedderContext::EmbedderContext(std::string assets_path) : assets_path_(std::move(assets_path)), - native_resolver_(std::make_shared<::testing::TestDartNativeResolver>()) { + native_resolver_(std::make_shared()) { auto assets_dir = fml::OpenDirectory(assets_path_.c_str(), false, fml::FilePermission::kRead); vm_snapshot_data_ = @@ -27,8 +27,8 @@ EmbedderContext::EmbedderContext(std::string assets_path) } isolate_create_callbacks_.push_back( - [weak_resolver = std::weak_ptr<::testing::TestDartNativeResolver>{ - native_resolver_}]() { + [weak_resolver = + std::weak_ptr{native_resolver_}]() { if (auto resolver = weak_resolver.lock()) { resolver->SetNativeResolverForIsolate(); } diff --git a/shell/platform/embedder/tests/embedder_context.h b/shell/platform/embedder/tests/embedder_context.h index 3ca774ae54c59..5c166063b4c40 100644 --- a/shell/platform/embedder/tests/embedder_context.h +++ b/shell/platform/embedder/tests/embedder_context.h @@ -58,7 +58,7 @@ class EmbedderContext { std::unique_ptr isolate_snapshot_data_; std::unique_ptr isolate_snapshot_instructions_; std::vector isolate_create_callbacks_; - std::shared_ptr<::testing::TestDartNativeResolver> native_resolver_; + std::shared_ptr native_resolver_; SemanticsNodeCallback update_semantics_node_callback_; SemanticsActionCallback update_semantics_custom_action_callback_; diff --git a/shell/platform/embedder/tests/embedder_test.cc b/shell/platform/embedder/tests/embedder_test.cc index 06ae0d21cfcfa..89ca660ba762c 100644 --- a/shell/platform/embedder/tests/embedder_test.cc +++ b/shell/platform/embedder/tests/embedder_test.cc @@ -12,7 +12,7 @@ EmbedderTest::EmbedderTest() = default; EmbedderTest::~EmbedderTest() = default; std::string EmbedderTest::GetFixturesDirectory() const { - return ::testing::GetFixturesPath(); + return GetFixturesPath(); } EmbedderContext& EmbedderTest::GetEmbedderContext() { diff --git a/testing/build/gen_fixtures_location_symbol.py b/testing/build/gen_fixtures_location_symbol.py index 3b66475d4afb8..01f41d2818759 100644 --- a/testing/build/gen_fixtures_location_symbol.py +++ b/testing/build/gen_fixtures_location_symbol.py @@ -19,7 +19,7 @@ def main(): args = parser.parse_args() with open(args.fixtures_location_file, 'w') as file: - file.write('namespace testing {const char* GetFixturesPath() {return "%s";}}' + file.write('namespace flutter {namespace testing {const char* GetFixturesPath() {return "%s";}}}' % args.fixtures_location) diff --git a/testing/run_all_unittests.cc b/testing/run_all_unittests.cc index 1fa0019be22b4..6d5d11c584fa4 100644 --- a/testing/run_all_unittests.cc +++ b/testing/run_all_unittests.cc @@ -5,6 +5,6 @@ #include "gtest/gtest.h" int main(int argc, char** argv) { - testing::InitGoogleTest(&argc, argv); + ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/testing/test_dart_native_resolver.cc b/testing/test_dart_native_resolver.cc index a6d3684ad566b..1a439943358b9 100644 --- a/testing/test_dart_native_resolver.cc +++ b/testing/test_dart_native_resolver.cc @@ -12,6 +12,7 @@ #include "third_party/tonic/logging/dart_error.h" #include "tonic/converter/dart_converter.h" +namespace flutter { namespace testing { TestDartNativeResolver::TestDartNativeResolver() = default; @@ -89,3 +90,4 @@ void TestDartNativeResolver::SetNativeResolverForIsolate() { } } // namespace testing +} // namespace flutter diff --git a/testing/test_dart_native_resolver.h b/testing/test_dart_native_resolver.h index 632824142d930..66050def9b221 100644 --- a/testing/test_dart_native_resolver.h +++ b/testing/test_dart_native_resolver.h @@ -14,7 +14,7 @@ #define CREATE_NATIVE_ENTRY(native_entry) \ ([&]() { \ - static ::testing::NativeEntry closure; \ + static ::flutter::testing::NativeEntry closure; \ static Dart_NativeFunction entrypoint = [](Dart_NativeArguments args) { \ closure(args); \ }; \ @@ -22,6 +22,7 @@ return entrypoint; \ })() +namespace flutter { namespace testing { using NativeEntry = std::function; @@ -51,5 +52,6 @@ class TestDartNativeResolver }; } // namespace testing +} // namespace flutter #endif // FLUTTER_TESTING_TEST_DART_NATIVE_RESOLVER_H_ diff --git a/testing/testing.cc b/testing/testing.cc index c738219541452..2e2225a568036 100644 --- a/testing/testing.cc +++ b/testing/testing.cc @@ -4,10 +4,12 @@ #include "testing.h" +namespace flutter { namespace testing { std::string GetCurrentTestName() { - return UnitTest::GetInstance()->current_test_info()->name(); + return ::testing::UnitTest::GetInstance()->current_test_info()->name(); } } // namespace testing +} // namespace flutter diff --git a/testing/testing.h b/testing/testing.h index 0662055fea502..00fe3806488dc 100644 --- a/testing/testing.h +++ b/testing/testing.h @@ -9,6 +9,7 @@ #include "gtest/gtest.h" +namespace flutter { namespace testing { // Returns the directory containing the test fixture for the target if this @@ -19,5 +20,6 @@ const char* GetFixturesPath(); std::string GetCurrentTestName(); } // namespace testing +} // namespace flutter #endif // TESTING_TESTING_H_ diff --git a/testing/thread_test.cc b/testing/thread_test.cc index 978d9af532bb6..986afd4e62fbb 100644 --- a/testing/thread_test.cc +++ b/testing/thread_test.cc @@ -6,6 +6,7 @@ #include "flutter/testing/thread_test.h" +namespace flutter { namespace testing { // |testing::Test| @@ -33,3 +34,4 @@ fml::RefPtr ThreadTest::GetThreadTaskRunner() { } } // namespace testing +} // namespace flutter diff --git a/testing/thread_test.h b/testing/thread_test.h index e4af5e1241b87..6d168b0d0c01a 100644 --- a/testing/thread_test.h +++ b/testing/thread_test.h @@ -13,9 +13,10 @@ #include "flutter/fml/thread.h" #include "gtest/gtest.h" +namespace flutter { namespace testing { -class ThreadTest : public Test { +class ThreadTest : public ::testing::Test { public: fml::RefPtr GetCurrentTaskRunner(); @@ -35,5 +36,6 @@ class ThreadTest : public Test { }; } // namespace testing +} // namespace flutter #endif // FLUTTER_TESTING_THREAD_TEST_H_ From c37d4598190b61f83d8eee828d322fc8f6272dd6 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sun, 21 Apr 2019 02:15:49 -0400 Subject: [PATCH 0891/1117] Roll src/third_party/skia 1c0b05afdef8..a76fad2d494a (4 commits) (#8665) https://skia.googlesource.com/skia.git/%2Blog/1c0b05afdef8..a76fad2d494a git log 1c0b05afdef8c0366926d3a5cdbe828ff122cfe2..a76fad2d494af8bde8c3fb34a2de2b359beebab1 --date=short --no-merges --format=%ad %ae %s 2019-04-21 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-04-20 skia-recreate-skps@skia-swarming-bots.iam.gserviceaccount.com Update go_deps asset 2019-04-18 jvanverth@google.com Add Metal support for dynamic buffers. 2019-04-19 reed@google.com Add secret draw-behind method The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (mtklein@google.com), and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index dd617da237464..fabdfdf94ccae 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': '1c0b05afdef8c0366926d3a5cdbe828ff122cfe2', + 'skia_revision': 'a76fad2d494af8bde8c3fb34a2de2b359beebab1', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 82673412d04bc..4e3ce5d13835d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 60d8d8f89167f18c7f8302cc7bbe217f +Signature: e7ac0cfd2e59c61abc7a7430cdf35401 UNUSED LICENSES: From 6e79dcd0cfd9df08b4240a5aa158659c34e4154f Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Sun, 21 Apr 2019 00:30:53 -0700 Subject: [PATCH 0892/1117] RTL handling for ghost runs, NotoNaskhArabic test font (#8638) --- third_party/txt/src/txt/paragraph.cc | 68 +++++++++---- third_party/txt/tests/paragraph_unittests.cc | 92 +++++++++++++++++- .../fonts/NotoNaskhArabic-LICENSE.txt | 92 ++++++++++++++++++ .../fonts/NotoNaskhArabic-Regular.ttf | Bin 0 -> 255280 bytes 4 files changed, 228 insertions(+), 24 deletions(-) create mode 100644 third_party/txt/third_party/fonts/NotoNaskhArabic-LICENSE.txt create mode 100644 third_party/txt/third_party/fonts/NotoNaskhArabic-Regular.ttf diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index 393b28be4f331..01ced24889ca6 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -17,6 +17,8 @@ #include "paragraph.h" #include +#include + #include #include #include @@ -24,7 +26,6 @@ #include #include -#include #include "flutter/fml/logging.h" #include "font_collection.h" #include "font_skia.h" @@ -34,9 +35,6 @@ #include "minikin/LayoutUtils.h" #include "minikin/LineBreaker.h" #include "minikin/MinikinFont.h" -#include "unicode/ubidi.h" -#include "unicode/utf16.h" - #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkFont.h" #include "third_party/skia/include/core/SkFontMetrics.h" @@ -46,6 +44,8 @@ #include "third_party/skia/include/core/SkTypeface.h" #include "third_party/skia/include/effects/SkDashPathEffect.h" #include "third_party/skia/include/effects/SkDiscretePathEffect.h" +#include "unicode/ubidi.h" +#include "unicode/utf16.h" namespace txt { namespace { @@ -552,14 +552,8 @@ void Paragraph::Layout(double width, bool force) { // Find the runs comprising this line. std::vector line_runs; for (const BidiRun& bidi_run : bidi_runs) { - if (bidi_run.start() < line_end_index && - bidi_run.end() > line_range.start) { - line_runs.emplace_back(std::max(bidi_run.start(), line_range.start), - std::min(bidi_run.end(), line_end_index), - bidi_run.direction(), bidi_run.style()); - } // A "ghost" run is a run that does not impact the layout, breaking, - // alignment, width, etc but is still "visible" though getRectsForRange. + // alignment, width, etc but is still "visible" through getRectsForRange. // For example, trailing whitespace on centered text can be scrolled // through with the caret but will not wrap the line. // @@ -567,13 +561,30 @@ void Paragraph::Layout(double width, bool force) { // let it impact metrics. After layout of the whitespace run, we do not // add its width into the x-offset adjustment, effectively nullifying its // impact on the layout. + std::unique_ptr ghost_run = nullptr; if (paragraph_style_.ellipsis.empty() && line_range.end_excluding_whitespace < line_range.end && bidi_run.start() <= line_range.end && bidi_run.end() > line_end_index) { - line_runs.emplace_back(std::max(bidi_run.start(), line_end_index), - std::min(bidi_run.end(), line_range.end), - bidi_run.direction(), bidi_run.style(), true); + ghost_run = std::make_unique( + std::max(bidi_run.start(), line_end_index), + std::min(bidi_run.end(), line_range.end), bidi_run.direction(), + bidi_run.style(), true); + } + // Include the ghost run before normal run if RTL + if (bidi_run.direction() == TextDirection::rtl && ghost_run != nullptr) { + line_runs.push_back(*ghost_run); + } + // Emplace a normal line run. + if (bidi_run.start() < line_end_index && + bidi_run.end() > line_range.start) { + line_runs.emplace_back(std::max(bidi_run.start(), line_range.start), + std::min(bidi_run.end(), line_end_index), + bidi_run.direction(), bidi_run.style()); + } + // Include the ghost run after normal run if LTR + if (bidi_run.direction() == TextDirection::ltr && ghost_run != nullptr) { + line_runs.push_back(*ghost_run); } } bool line_runs_all_rtl = @@ -661,6 +672,17 @@ void Paragraph::Layout(double width, bool force) { if (layout.nGlyphs() == 0) continue; + // When laying out RTL ghost runs, shift the run_x_offset here by the + // advance so that the ghost run is positioned to the left of the first + // real run of text in the line. However, since we do not want it to + // impact the layout of real text, this advance is subsequently added + // back into the run_x_offset after the ghost run positions have been + // calcuated and before the next real run of text is laid out, ensuring + // later runs are laid out in the same position as if there were no ghost + // run. + if (run.is_ghost() && run.is_rtl()) + run_x_offset -= layout.getAdvance(); + std::vector layout_advances(text_count); layout.getAdvances(layout_advances.data()); @@ -808,6 +830,7 @@ void Paragraph::Layout(double width, bool force) { [](const GlyphPosition& a, const GlyphPosition& b) { return a.code_units.start < b.code_units.start; }); + line_code_unit_runs.emplace_back( std::move(code_unit_positions), Range(run.start(), run.end()), @@ -815,14 +838,17 @@ void Paragraph::Layout(double width, bool force) { 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); + if (!run.is_ghost()) { + 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 - - // Do not increase x offset for trailing ghost runs as it should not - // impact the layout of visible glyphs. We do keep the record though so - // GetRectsForRange() can find metrics for trailing spaces. - if (!run.is_ghost()) { + // Do not increase x offset for LTR trailing ghost runs as it should not + // impact the layout of visible glyphs. RTL tailing ghost runs have the + // advance subtracted, so we do add the advance here to reset the + // run_x_offset. We do keep the record though so GetRectsForRange() can + // find metrics for trailing spaces. + if (!run.is_ghost() || run.is_rtl()) { run_x_offset += layout.getAdvance(); } } // for each in line_runs diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index bab5430abc4b3..4be162d2017a9 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -706,6 +706,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(JustifyRTL)) { txt::ParagraphStyle paragraph_style; paragraph_style.max_lines = 14; paragraph_style.text_align = TextAlign::justify; + paragraph_style.text_direction = TextDirection::rtl; txt::ParagraphBuilder builder(paragraph_style, GetTestFontCollection()); txt::TextStyle text_style; @@ -725,16 +726,33 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(JustifyRTL)) { paragraph->Paint(GetCanvas(), 0, 0); - ASSERT_TRUE(Snapshot()); - auto glyph_line_width = [¶graph](int index) { size_t second_to_last_position_index = - paragraph->glyph_lines_[index].positions.size() - 2; + paragraph->glyph_lines_[index].positions.size() - 1; return paragraph->glyph_lines_[index] .positions[second_to_last_position_index] .x_pos.end; }; + SkPaint paint; + paint.setStyle(SkPaint::kStroke_Style); + paint.setAntiAlias(true); + paint.setStrokeWidth(1); + + // Tests for GetRectsForRange() + 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, 100, rect_height_style, rect_width_style); + for (size_t i = 0; i < boxes.size(); ++i) { + GetCanvas()->drawRect(boxes[i].rect, paint); + } + ASSERT_EQ(boxes.size(), 5ull); + ASSERT_TRUE(Snapshot()); + // All lines except the last should be justified to the width of the // paragraph. for (size_t i = 0; i < paragraph->glyph_lines_.size() - 1; ++i) { @@ -971,6 +989,74 @@ TEST_F(ParagraphTest, DISABLED_ArabicParagraph) { ASSERT_TRUE(Snapshot()); } +// Checks if the rects are in the correct positions after typing spaces in +// Arabic. +TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(ArabicRectsParagraph)) { + 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 = 14; + paragraph_style.text_align = TextAlign::right; + paragraph_style.text_direction = TextDirection::rtl; + txt::ParagraphBuilder builder(paragraph_style, GetTestFontCollection()); + + txt::TextStyle text_style; + text_style.font_families = std::vector(1, "Noto Naskh Arabic"); + text_style.font_size = 26; + text_style.letter_spacing = 1; + text_style.word_spacing = 5; + text_style.color = SK_ColorBLACK; + text_style.height = 1; + text_style.decoration = TextDecoration::kUnderline; + 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); + + // Tests for GetRectsForRange() + 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, 100, 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(), 556.54688); + EXPECT_FLOAT_EQ(boxes[0].rect.top(), -0.26855469); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 900); + EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 44); + + EXPECT_FLOAT_EQ(boxes[1].rect.left(), 510.09375); + EXPECT_FLOAT_EQ(boxes[1].rect.top(), -0.26855469); + EXPECT_FLOAT_EQ(boxes[1].rect.right(), 557.04688); + EXPECT_FLOAT_EQ(boxes[1].rect.bottom(), 44); + + ASSERT_EQ(paragraph_style.text_align, + paragraph->GetParagraphStyle().text_align); + + ASSERT_TRUE(Snapshot()); +} + TEST_F(ParagraphTest, GetGlyphPositionAtCoordinateParagraph) { const char* text = "12345 67890 12345 67890 12345 67890 12345 67890 12345 67890 12345 " diff --git a/third_party/txt/third_party/fonts/NotoNaskhArabic-LICENSE.txt b/third_party/txt/third_party/fonts/NotoNaskhArabic-LICENSE.txt new file mode 100644 index 0000000000000..d952d62c065f3 --- /dev/null +++ b/third_party/txt/third_party/fonts/NotoNaskhArabic-LICENSE.txt @@ -0,0 +1,92 @@ +This Font Software is licensed under the SIL Open Font License, +Version 1.1. + +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font +creation efforts of academic and linguistic communities, and to +provide a free and open framework in which fonts may be shared and +improved in partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply to +any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software +components as distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, +deleting, or substituting -- in part or in whole -- any of the +components of the Original Version, by changing formats or by porting +the Font Software to a new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, +modify, redistribute, and sell modified and unmodified copies of the +Font Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, in +Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the +corresponding Copyright Holder. This restriction only applies to the +primary font name as presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created using +the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/third_party/txt/third_party/fonts/NotoNaskhArabic-Regular.ttf b/third_party/txt/third_party/fonts/NotoNaskhArabic-Regular.ttf new file mode 100644 index 0000000000000000000000000000000000000000..ee6cdaa35bc0ef86c1183726f9867655b0b1aef6 GIT binary patch literal 255280 zcmbrn349bq`v3n_cl8{}WO65yb0(Q&5^~=mAtXacLbwx1AQP?t0Rg!|K#mZR%LD-t z5fKm+FGLxX#fT`Vh{w9hdab%FvWTv-D0s1mB=h@J&kO`t|KIQT^^d$$)pb1e)Kh0y zcSmAG6o_A(0{T@{Ry}Dv;!ASFheUBd^{W{={Fl>*(n((YCQ;+)e#7g_|1tfE8j?Rs zAPVpqIy^I{WBBy9h}c$0X_`1={Om=UIn6{77l?G{CoY(8F^x=rmMG&I(pVx3yY<}b>=NB1_auMma*G=0{@@w$}FP&;8J=*F zN&QheMTpWV-%mj-kP_ASa2ib{C-Nsqhik4evW=u5)ixy;BF%1B{wqzENGD0Yio_Kz zNxYRTG7xfA_4*AR+K=o+T`so{y1Nxvocg$9MKUB-loZkkFB8@kJW6A|_>G`)KG=0Z zpm9<=pH5ZEn^Yx_ra1N-)k?Qeo#rEIS2Ae`k?Y^!Utj^)fO3C^I|eRn;+hUNf_sFE zyp7UlG*+HWbNCNbA-B*h_Al2t_AhFdk5ZLnpp7CN*E=-nv_YOoBZMnZ!l>1YJQTVB z>8k6nKo>>rD#zghO%jb1@QIu-EVv4PD98sTZd}vgnm`WXk4P(NyR?>e z$V0&UU^L1!Qj@%q^5kU{3Hy ztG2OdXTe0+*<-gqaz$UzXx)8Cr1AC* zO(t{(><1byWTD?n-~mtn&pu;IT<`b4?LUXn_79`~+)azG_n%qR=p7fr-eSCoJ}zwVM}0zstNo!B z>AiiR$vwurg=(FQ5cbx|6LF)sW^;XnI-@aMU{SJStl zK7(BsWfSst^DDz?l@jKMb_ zIr=NEWyF00*9QcFFprx6cQV@ZeMv*Zgbr}GtMWZy^TEWql-s>?F;*&58UMcGsgS?v{@0tyZJSFG*YQXdOhO0`Q?+ej{BgkhJtQ> zwNH&k82XnIk9PI?yV;(bMElDIAm)Cwi)trN z+wcU}4E|5olW@P~|D+V2K>grWd0llKMEPRfg-v&1U-C@Bz3FybZoU8CWaT^|ID|?RpaKv*1DS zPq~90$C}s^?f)HgS|-|B)XiJJ|7vGXU2htX-P*Q$`1N-FoiQoKYUMijCS{X=8u!z=92Dyb&m1$tK;Zb$8YLm?*6t7 z;oC&G^jFtKweNN7Z{7Qz@ZV%xw2@}>&Ew;yzMtT_3w`EwZ{PbL-Bfp9Roe`0(|xWJ zeL(&c{qk${&u;U*+BZ&joAbN-|A)2UkLHQ%eFi#o?++Mz|2?+HV;}Dw=kRxL)0_PN zJ^y!K3sgTZ?KbAS`$c!GkU+fH1+>c$#`F?(9&vik}FKYPXu5VR;w{`Ugqfffd+*h`SYx2TfqHa53-JfpqB!*!HA4w~G07IOa$7NAjaW z#P=2Jw775iJ&@4i9SiE-&b{wZ_c7|8tDDW#`=f5_le!1*zP}Os?{4dnx~J~mm&AQi z_r8ezTK6^;`?v1bax?kJZQv*+3wS%-f%=Ji7~Dq-x9c;w8$$uW# z-uteJ@DBl*9&jGu>Ipn<*WV!PQCu6rSp5-d*1bv1{%zEZep|_QqR++BSZOY>Q7!wK zN~LOwlzNdL@RfRE-I;*6;RvsyA@JXdbcyU6+-qq;AAprji**+xeV@2b#vSwueJ)jX zN8CquNB=ra?T+s6RMj2-12pruhR z1)7c2uGLV*{}iraNDH*s-)rx|nm3*%2>vKscR%90p*&05b+@3LFR5LhN)rT{49J=f zeSlI&+qG-3pZg=dFc1AvSw3rNf)*k*gC=yxXFIL(*#+S0SK}Uc zI@T1RZ*U{_I^zCOn})D82$ z?#c}`KO+8j>Z+fJ@Ucjb{jDzO1{y!q@6R{tAnGFOp~D_q1=qY7cHD+G{}FrQZfKuF zpAg(htI#J_X=b3G{3cAq-4y;U(tZ!%YW{{ci$Pxi+RL~;gKHbEfzMR5=}>C-nRLUw z9<~W>z6HS5FQs@zJ>AB z4PnpjcGXS5cmn#VZp3|!g8L=~eaY);vf%#?ebeLWL?3qmkE`rP+*PCz_kW(e-n2fu z(C>Z+9qy9^ek*B}AM9te&;&t%nI`ysN2?4UQhUJXh&x8@#!ulF;pg4qfxa}s|8;8j z+lzS2pN7AqAAC&hhG^Kp;|jlF5BkdssP98?(LW5Zqssm0Ke!fl5M}!HfQ`O@JmI4K z1n7tAwckO+cf)r-;(@Ab;tidJPC`fFiZVpoc=L($hA8Cw(p{FS+wJbWzPTRVI%!n^ zH*WmSAsz7j+;uVFlH2dSHvSveNau@qpU2>K zx-J^fjy`p6j016vIp}xY14x6j7oU&Z=tsHpi@b)<-1+t2!v7Tb3i~o2tn%IVU;JKb z28X}|FdC$SJHQ;!2t@p3iBmKv1Xd6Mj35off*v3dM98DrBq@pRl@e9zwAFAQ_7;!RRG-1F!~P#pvj0(<;a^G>hV|%c%h2u^n^?OU z$pFt8=ak9^SiEfxm+&f6nQOb-YidE(r7fX+8X42Sa;6i>&aX5>j#}Rotru@b7q4fC{N66~S)3 zaMIr!dX$kJPg}~VFZ8LzF03C_Q-2yj18EQq#uJmFR717$d>T%5R8J#lBu;!C)JUW7 z{AUb}rE%0m*!j>zYNkmvnQoyeG?k{&t=RR=pqVs_X44#+OY>+x-9`&&AuXcYX)!IK zrL>G%XgRfFf4ze4B+Ns!n%2--x{EOP(>l7F*3$;sNcYetx|cT7eYAz{r>*n=ZKDTi zJMEyI^blHcH$6;`&>nh}9;3(U33`(DqF3yrr|B8mPfj{O&(d>rkp4u6=y~d(7w9m( zNJr=;dYO*WF?xkwrPt^k1%rw`~u`iMTJztJc3 zDSbwNr&II~I!&L`8Tu!kr7!3leMw)@zvyfFhR)N!=>mOA-_b?7MBmd7^dtR5KhtIU z4_%>O=qmk6*Qk@a$R#h4m&H`#cT;%%9gPfww$%HJJ_!NGOhx4iQ z4%@=+XIuFz{8j!MKh9t0C-@uuP5u^toBx@=!~eqHGlyJqQL@1F;loGAPD6#ATwv9c=wzC~_r2+{`UJj>mH=PvD8% z#*=t5@4-`eDo^9-JcDQQES}ACcrMT5`MiJ^@}9hi7xP}cg!ks9yo}pX%%Pv-h%0k>A5N@q77Zejne$@8?_j1AH5QkZq=XJcEkKiMD19$L7K8la#WB6D; zjyLh~d;*`yoB1R@nLo>);|KYl_#ys0?@)#+HA<~AOc}1!DfP+-ev8tJJ;Zh?yOoj3 z!^$Jd9_3NxG39ZkL3u)PD2>XK%3fuZGFo{`*{6(Ao>s;x&nV-RCS|`eUYVdcm5Is$ zrCFJzJgZDro>LAgwqy`<1QA19-;&pt4=r zq3l%NR{pHKqdcVSQhri?mIIZ`%72tA$}h@Q?Ur9+56d&zBg#d#hdnCK zVvotQ+2isY_Jll_Jt@x@4;*-ToOr4>;UZjMm0Jb>g$FNtF0M2WbmMY1Nv9@tE#N% zTi(ZBR@%FyS8-9#!h-zltjvt`wB#gPVuCe3&TI+^4DdJl`TFQ}T8+YGiBX!x$(kyi za-t=$YP_}5I=(tR%~ENaQjwlkX{~BD2UfYE_Yzsi+m+5V0IcJJzPN@D3Upq!~m6H39*|3H<@e@^rR%vUivRbOzn%c&9xLPMzEdkcH z0|rCe>`IuMY8spj;fLF!oK@=_&VZ&VtQe}QRj(R0&>37is=+BGR#~QuhcWQ4%o^7- zDlYJP8VLCPXo6W_99Y;Q%vjUVW~ppzuZW9^tE@ooIA?2ZgD_8f2kwTVo+W!`s>3NY ziI`*Fn9zC=)9Q_JC%40}Re%VY=J?RA}hoQIhEGRCeObG zQ%oq)0)tnlx;sQ&gVSCC%h|_!I!on&tW4w>--L#nD%!WU!I^2D?F_M&yL%G?RO3t? z-k@f2hgLd6`a1CjnJ1Ssvl4kR1S;D^kNe*?X)Buaj&+VH#VFTW+wcPAy3QQPvqU{7 zw(5=wNOFetMbETVwly?QcAA@_nlV-MHPJ2y*Fp)5i+9DofsO{r! z!GU!R-LJYC3udA?M5~tb7}HsmdfkS?xXym+wb$0@UpGhh_eNXVbk>2x+eAxPJpu`u z2ZH|7p!0Ba$fnh;79MrxQl5yBWv?2z1H0cyGfHnku--Y=Zk!QC--uLO=Toja^m z4ReT}10<|!_fhORyWVb){G_M@&>ET{<+ia^>92z*EcpiXCP!#f1{vs@q;d7nu5`Rb*j?REIP|l$CS1vhZt}ahNi(k=494V zG?ld!if9Z@AM2!Yr?0hKgqMl%GIzK}glnzkP8Pw!zZd5}YhNUI)t*Ewu zZ$)c4FbTBld=y>KByVR&Oqgt+&K7ip`2`irpA{EcQ~YrpO%2j>fWGvCKc# z94pyl4FOfL%u*j$W~mR^kg#F%hCLg2>IOEsrpi32Cdb@dGr$~?W2)EYXzKkn%QY7@ za&S&iJ)ZnG4 zThq)NTX(fOTV?-Nb8BX+tRIS7*~M)C;-ibDyu}rZrMqt}G-oZbFOg_Tz>=mVCzo)a z%v)LOt;}+3)~)ti<*Cz(&CS#1Pm}nxkZB3iHc#XJnYXZ8rbL@*O28CJ{IX1$J*9QZ zr74=|(IcYGqkyZCHNx5G*yWHM!qdPq8_F7_2Kci^;zgf;ky4ER2sX%ngn5J%Fv2n- zYlKWA0!B!YS@o>GCf59U9jmJeGant!0){jH;roXl9WEyfuQ8j;hOrI9*vVmMhDrXz z%)_MYVF;|PvAc@R{x#+rsqSbEQ$1$?7ITYKys?E1ZDIRcjC z_%CC{7nd>nGIn&?d&?xtGDgen%PuXG^&8i-fc3l9OBd&}<@1luzc}ADpUDT~2$we|u)T)XTr!++NoHP&*&m?rN9t>fgBb<+wcB&gYrt)X&YC zQ*W75GiUZ3=N#^u!eJ=P;ThVr1XhIkW2V>T6NvtZ}oXGqYIPtXZ>; z&XQ@?u3496$@-b8GwS_kl+BQekIuL_L$c49Jwr0jU?OPNjH5I7(HWoHa}XoXNC+|~ zrY6*z6WGxNW={A#L7JW$UvJHcuiqHY%<=4KJhR8oj+a`)n8G^P#shW3Q&R_aXkFOm z=xatf*;;4faPiw-+vwD+by9ufsD=ZKt#_=t`)(?a8R*QxgxVD280c&kGpq2l!V?g4 zAdJc#^XA=lTWadO`R-r0-8Ob!>ezYn=eu3u5s~Vp2p1Rg=Bo*iV(dH-rFsySiUdN= zSRrvRT_S)F0MtO$gD=GIoxHWy8WiH$jz>JpV#{%p7XkYq?gFw^*7h|%2={W9pZh&?&-X#{x`1so$}7FU7!9} z>g_mnJA{+8jX24>9p``Js1~P+`Qok6n|`(-#U2*LbT}jX8@=fIhx8*(lQSuTms70k zZ0812@J8cF@`s*3;yf!#DrN6WZ8&p`z&U0W&KVcslyE!F=}t-gw zK@?UDHiED5zJCT-1YX8#*3SUQkARL5kQF%^>?MkV%xF7N49bexMHGv?v3TxnK82+{ z4a^2_;xRb%kE;gj0OH~i7mqR%B!KjZ`v7#Yp`0YtD|rDxcn_pW8B3IE1gLi!S}JV? zQF;Y{9vMT3GGhVqW)%SFlRXS<#cSa~0J3u4Cdyq)l!y5ICU6X&KA6BEqQZkjJ(m&{ zL4FbP6hl_=9->}@@S3>=w1Q8FdfUNS9E#(;iZXPT2{(i7azdCRp-)^An z>P_HlqW+~|8~6#|S0H=E9YzUYRAYWCI1Y~iy+iy-^+64VK!7iJfME7yf0QQ1w zL|f_r{P#n@`w@QsGeldFW-I(#p8&}J0Ma~w@NF6Z8*h7==s^=`29UWOw%9%v946Wk z0vZ9*?}VJ4L%_q}3eiKu0Lt2h@Llllf`2z;?ne6E&~JAa(ZldRyoc}@hG*dK{0ay(_Av%imM~lHAfIe~*x*cr+sLQbriC%>r zk52)Mz*?{spgoRvfHwhT9RHf=^_~DSUq_x37BCh-=Qju}0`CyL84FO)H%}0~1^-*~ z0c5;w0?h#F-$uRuJOJz>dIxp*3)0c{i=wI!qS)y+d z_Z`aot`0m*bP=*Hbr5}jjp&C{L_Z!P`pE!L_D^V|pAi0Y71#(M^D@f6j6DBAU$}zn zUoPRf>;XL5MA3z)ENst!TWX-um^&zT@T|9b{8?69y93}F?lXHL5zoicZewo zU=cV^OtX@h7GJw*;o?mdroTeW=Mpi)Qeu8cYy6B@0G{^-1`rE+j9Bn#Vxb`b>B5H) zGu04_Ks?rY7IBtXWEPkXoW!CkzzSl~C^!09Vlj5G6?{i5wj68$(7{{^HiC1+EIk48 zSl%TT7YQIM?ijW^qXA@C4WI$+C6+({IwX8ZEHMqNCT5EUkedWKN$bH^#FFjc6Jk9e zHwF5opsp#nPDP&7Mc_EGv;a^Cwt`c{(ro~COFu#^BM3BuL&P!%0OZY@01%grxa=ta zaXAvP-1)@vQ1=4JD?oU`L1KmQ7eaO+WEVnq&pglu&Jrt{3=me_1aRF8ZZEhc$XfzC z^@hCOuM#UoIi(Z8GvFGrGU!pZ8Jr;t5$SGn& zlfiuO4zZd90Dld1u7%FEO#t>7#=!{i1hL^+paY+fmH^nK4!YJ40?=(l8?lk`;8|h~ zh;KMf%mMp3P_|<)xI(P40-#QfUlSVzJw`#sD75qFasd6tAZ*M!Vq=kKEOZ(d4N#A9 zr-@Z61W<=bmxxX7 z2@p3K?Q}~ufF8F%k13Efr4_tSY%1(A^)X`8Aahy=v0G86TT!R!HQ)%b8IUpKAiy}A z(M4>g4J-giGby}0Mud86=JtT@7tmG?Wc$>wt!~vGO;C)w`4j%-leF|(qqJyX}~sO zEhzwUTdopY-U8kvhJ6cb9SwE@*z*q5;||#Hj?;K8w-}(z6`v5hGZHj_&xoyT1SoqI z!dAguZ3L46%3lL{Yv5ml^4DA-wl)LI1qT7@h5ZY=3;pjd=-r02Z36&o-gXF}J=$Tf zcIe;k1V0g5hkCAC2TlU$x9$gGcW(xJh^O4YA-I0NEQ*_J(W3HX6WV z#O@hFY|}6R`)#^H?A|;8Ih#@6%_!?W*l7!7ZFv=3B6dG)dOymk_fp>xD`O(TXq3)}rLv4?wt zw*hSPNIVz-=7N`r?ePI40Mb1QnUA8*k3sLppyT6q0G*#e`X}BewpSwdR0CK6_7U5M zdhgps?CC84b$ z^IS2Q0M-MfKUf7;f)m7!Jx1*9R$`x=CH83=K)Ihm_rK33b_%+lIz#Lq(}o>>*k$CqjC_}&&wmVH zG(cJZK^?DDgY5ui{(?U7E86-R(q4N8Tp-q&1z?-buZeY4fK$Zqt+a&q&m`JM5>6~6 z)(ozZBsGB3B+13#Ly~wFI8Ksc0eeW&;J87v4O}5fyB=I1Ne5ZF_es*v1jk77834AE zKqT7 z#y5culB}qU6}lu8gDv0(k`m!2BEJn~*nT1@2|6Y{K~gdY$d~*w_?V;~kktb^r9h7q zJJ<@G;7yWJEubg(kfgLU@G42^C_f$bNM8UDo_>L(jJ4nlNtv)uCc?6&0i?~22P**L zvagVo1Dobd0j&V_%YlBmuvhM6fV$N$QU>`mZKwfC*Z2E#UkVH=!{NJF6i5a=)z;X@HV6yZaUlT;H1 zGQbg%YD2)o0J;oY2cZA(67V5Ob$MVj_=%)?xb^!$7fB7(cl?yf+R;Y$OC8_?2)9#0)R3{MS|G?X+}2!lrtK7jy^@w7}RSF>N_?8 zbdWSI1R!mb510>}-~vhGIcNflz=!zgCJjKw1jv{O852=nGjwT2o@VGb3GtIq-sD(t z2)s+uEh%6HNmHQDlvhcbng`C1G!5-K4YH;|*0i5Ux^)m(56+V`y$Zm7(_xnxW5LTL z%|tuToD5pP7LsOZzyg3gvmOITGdm2-1aFfx#|Bn{?Ev!UBF#L+&w~#0J|k&A18krT>?LV=6+pV>CrD~d0SLb%1H4btin##podqPV3;|b3T7@!Jqs%on z@HRTO|2x|n*iPb3)Q+wm1iJDW&)$OKUCt}IXkW`m6+?M9tASUf=89!DOWwMdUYL(&sNz(D|;JXs7HJ)q1d-z90U4?x0Kl}(*T|zX+O$!t|bYtI!gyefD0r&dx@myR*-ZM^*#6lNq>Tl zhrsg^m!*~kC9$V0KyL)j>7&& z%K_va{TLwMu~?Ex)AfXqs-jQoWLMfR1}ySn46sy z92ggv7#A3a_s>pWJ0uezu@P~s1uEK-OlRydGetUDzV3DD8NX@ z&@g{rrk8zv9qD`^| zOHxunVNg(L=vY&a$hzvfOq(1Y9h_euppEWPW6SF88@4nqisiALtZsWj@2=BbC;z#J zm|GXT9jzm?Jy5~J2_LN}S!>p2YGth`S(GO#rWS^>Y-7VyBDdEy3$deO!xvY2YlOd$ zp`$>`v`0WrP_R*N2$(X;p#7~pG6ft@Wv0yBz@VGu%Az)E0jR!LjX^u&8m(yF8 z)DlCNR-&Bp&JBhyT}S`xee$LDio~R(_)5I?Hn{)5>OljB#QO}bDe|v%6cuImPDn6k zW=0HmWcDjB=XH2q-@7I+q}Gv_*W29Nr`FNC_fWGrrPg7dPh}p1|Hcu@ANPbo|4d<> zaJA)yiC95?o;6;p;oKUZkYuyQ8zpOek_{e>R->`T+w$`Y!!@BHVYxX4g$21eVd3zV zO1U}VJT508QG}rWi9Hm9ZmBLLXJwbM%X;EW*P16Ie0?lwJ>v%r$+HEgkIpUXA3wOZ z+MbaT9@(pE_8fCze4o0wjQA*jeFR?XzHnAbXWtcA64M{MS}JAzx=XI^Jjt7WnccNy zX{tUTWocz;KcDPg*|P^EjvjN%u+^}VZpxiQz=y88#h zM-3NTKl38xm}HajHw&0nZf0X$k5ZJ~A1?&@Sn*5er;A~{G&L|kKcC9Puj{$Cd2(s6 zhb1yR&unEjBWXlh^qTh0uQg7o1K$sn(tLYql(D2oR$ja&AtA4aF+?eo>_GvhfLceW zDK9IB5)_+Ea-G9OCbFfc_pEiKC)jdo9X6Y9Y^}q$3N1z^H)5z@tcb>e2hD^AN)4pk zK$aUM8VlppJysdat72XwYCtv&}CA0bk##nn{kRdwEX0hnPB!iNg<{z?Tl)rzf-d|xRS+VPl z)ryjqB3mP3BbJPkGVv+KP)uRTu}M^xdtywEu!yNl^kGaYx&PId!);0Unj50&b1X=7LR1N73?jDwg&bdWGgohzAy$7>$={?ThXPY z$I9a;Yc%BJE9><%!U4G$$^oiub%jXOXtXw4eqjM)A1vFR9%<&qEc&%2Kep?$qhkKS z62+R@j;`{ogufL=78+^Ki`M&xun@f*7tb*7Xbh$rhsBU(kS-b6egpG2m<>Y>%MJSt zijQmvGHc9r4vkIB`4|#njh!=Ru4j_RD&?8rQO9sh<2=qH>ZeZC8f`*io;tmY`5?SN zvn)R;b7I$!uG_j!{O7xS7HtSsq_3`hUesLNXIbqJ=K|QYl=}3Eqgr>|^WMRYaSQ!? z>ibPCPOFZuA0^u{#)ou{!Pg6qQ2}|sm)d1-jEstxa&i*&X1ggSuvbMdDXp?^j5#sN zr>dVR)HlW$W49NUn)L=fHV=AU7+P54NYBd8kFRkUOKTm@eCD5zn0#Ztks?F;^~kDq z^dQ38hwr(>Y>BlP)8+}xk(r|6o{ffDd9l}UFVbSA#ysjVgnRmQFW%}53ae0PNO(bl z+bCkfOwwqv9Z@?1S}xB$d!iAsItoL{IR#iMaV3X^$xM--3AYxNU+(IP+Q2kxHau|0 z=eOT+yjTATB@-M8lSj;ZWbD>q6)PNxwFA-?uY2*4HI~UQjcKj@xwGV{Ez%oZQBsFF zE-oi2a$?t|JvDs}?t60Qti!iX9q-tb_R!L%)yvP1h}<`EW5{FOn=@*m8v-1Xw>lIZ|?ORsS^#(giB)k3v4Od~D zyT8BdZ%>Jc3XN)XSZ%->8W$I03<)(-qr+&|8>)>yMxV@37AkZNz%m`0Q4#vj< zX+uJ#>K>Y^MSi(FNzA-=x6fNI2=R$#`(?ill|<0q1ApSyFQ@W zWb#ioCub(hdO6vSl*thh=0-<^XW9_U87g-?Rcu|wp4r_@*;z7Xr6f@)cMY-k!g_B- z%@p+4!Z5KXvx(XlhO66x;9Khk_lPnTMuhZCNgp^Mt0X#GnsF~H|A$l)-H)-|Vkdt$igiJ6&^0e=w<>+X>10Ea;*-Sx6n*@D=X6;rS)xe@Bl6T3%8pSs>AJi|LSl_3T<#m z-eyk~9Xv>kK_=>I^otb#rZcbaGfuN!O7y ze*BpM*6{FTUuLux`UXX3O#K_vihepqp3c(oH%G(NS;0bC_9%@%zNib2rtndYz-V9( z3`1w#;LCgoO(FW8yT^%*rx;%7T;b?=qGM?>_qiv@B+=W@7sG>V77WeM&bNjIWkv@3 z@P_`0HS@>k49`j`>py-{p4=L1jxePzZL((Q>;0z;m|%}BA6O6;({JHmd~`&-Yo7cO zo2+>NUpKkOQD3_)F;SGqvZ-zx{M+bGDl8(dr)8z_kRZieOISQjChD>&!$Z)$qhEbyf z#un?>hmoiM0+qepI!Rq_-1-M&+kk;B2WJG8n0!(!3(`%&ai%bw?`F zSWOzcM(c2Bgd&k93_CIZW52A?Y6}arNt>n2aeecB?#tBjabfwv$)Q0bGal(gt?rTU zppA-xT8Wj$LV5ORLv%nubfZJk1_T6Ywc(8pt=%WA+F#2gZ4f%uxa$W1=-^^jQya-M zQ{$FV?7PtEZH2h~#8xC6#mlpXS}O?q5=Bx6J+S9&w~t>7qI&+NfD zz2f2|b3}dA?ml7qv`Brx>ujZ3sjnRo3Uf4I|_hyCz9a2~}u4S6z znk8MseTSLE*Y3mZnI`;+6DhzZS#(NTy3S+@#r*46Z8lpChR|Av!H||JCtFbo_u7=~ zu7rAno<0Hd`!~wi>uyqANOQrX8lqZoovrdoz;KbYqyP!P3%=rl(KYEP~h;Eni1>1 zyM6`~&p*ZeIaOR6#`j4bk_}(u_kevs^WDqx7KXtN+RNGC46(9~_+<9Z_1QC#}7Y zUl`N#FpJSr=g7{lb;zmN*>us!{EcSgd&Y}Kmr)6m-J2Kc-QXGC>domKY*vbj)a?p- z#7!Ln_v%>5GNk-Gaf}ixiTimQZrTd-VOVkgqK%cpG3geTO6nx0HR20tc~(D1lq|=j zgk=t!QEKg#X7V!xM+EwDU08IKxmWL=;Q?7y8NneDF*&!4HOCeul}#8itZCs;)@b*M zjnzwXNOoaN-uwynAX`yVcuug!S05CuXmz@v_$+f`&txM$!`Au*2T1V=895y1gvOBQ zpk{fXI2SqR+QPomtcKl_RJ#wS+4x4j;2^%Q3=a0(rwP~YC+^dNgMEBT5f$FyI(IPK zqV@BfvUtpnc5H^c8QOl=<<-$#wwrQ=y!dz_CnznwI$kW7Rq^p|Vb%`U*@M>D-wG4G zqN?+nJd*E*v}#qmI<~6oS4czKmy~#=m8jB6NtWTA!u@^Gm z>R@Sa>xr(X1EqJ_XOVpd8~wsgX8N3xrvLIGwBFD)OnFnTfYvjGJ@FR`Ho1PpnQwsl zMQuuo9e3p^cC>VdYpvZkC55O|jY;ls{q10Kf*kD`XEz2~KBSItZIP~W7wp>4ETk@W z9b*AhdPx0FH$7eSBG^{Ac7F`v73t}+T&hMUb+{fnn3SsZ+~wn_&O3mG+zqZR%A0)6 zb!`{3JlaZW_8?WK3?(BYJp8(TFC0ux>#mJ0`)@&_|Fm}2@E_&bkd*GR-fD(#kpHAsC8xu6!5)}XV2pEDEiWuDD>mVV zz1;d>R`*E39Pa&#B}46LCQU+YKt^U-azeT;D?6EjjlnezeF#p@?};#`Aax1$&gAGN@mfqe>Y;$RgDTWwG3M$@m79a3M4T;>xCO?^A?6O& zHohjy5Y#raVedZYILqYX-UY2)pPpIr)%ngV;aj>o7j<==Z#li(?}(j6cOI8+&zHvM z#Q3I03?7@FpU!va^;5UMJn7-5iYkW>VA4;mzaGn0N_?3A)rC@U=ZNc8ca&q)~F^uyJd0Co(-;816IDOk9{em5kd;b-S{cl82K)8=j zKy+-3tT9_mx}aH#j&wB+bVrY&u+DkMPn-_J=7{O$s*+?|{C%VK6{Y1VDak3L#ur(*t-M?~fX6&3kHS*?bSsCg~ zCG_I|L@hJbzOjfB@xo=YJqQy(oL%oz-5eJe6eOmDxDMB~gK=>IH!3HNsAbpT&a2WU zITkyTNYpOD9u%h68zZB5j2s=9KpIqNy?R1Y<~=s{?B!7t^+r)NxLOrS6D*&|-kTjg zyLQ`W#ZlJkK4m@q^YU!Be~|G+*Vw_fity+6mzOQQKR2%|y60UR+KV6Rx_Cc7cJ&nM z;nspLM?J9Xz*t^{FJE?0-gB4=V?B)}T=#Mi8ygrXCP{=`J{TKoG~Q@0Q70}=)V0sz zMBV$>b{5(P`0HarC3{?IMsabfq_3!~()O#)PY6h|B-JFzHAziL(#E7+NhgzJ|0EVD zCq=esf@&Qa!}3v@s??0$88wdHb|UkQ=5^mSl%59;^JqA3ymPQ_tIs{K*9ptTQth>+MvINSR-*|H4&|E$vRz&0H}600A2Bd| z%j&HxBX@Pl0KH#KY012DgCVy^k|{bQx@6L$W5e@%RF~?bBZ9JGS00-g6u4zwF}JmR zwdt*nUQ;IpHTK-{_~z*>aYFuxwCeIL!J)xPPmK)sFL@&~zV7a6mh{oqk_B_7WyU>R zl$aYA86)lKv@~J%QEkcV(K5Me%Pf^&!(S=#%wrC99&?6H@BdNijgByMSq+CGt)uw%%%bkp#VlWIPYd@64mR}ASz}^! z;^9cTHY3v~OcxPht93*q`Ufo@5l3;|dUp56N8Jny(~4;5sBWv_9D8)A-YQ3D z1f(gl9?M}$wnd3GDRqv>*kKM+hwIXFI7ond#%>7;t=5>rOg3?k7Kz0&GLroKf@>Xq z?F75xVeE|uaOydF5$;<(hasM4Z|Y;x_yin=h)uiqTo?x-;#k9bN?$*RZ-jhO}JcVz; zGl>*?Fj^!#+pdqQj>yi&!i3Ar4%br$Gc!X%ylr${M(6j+Zl%O41AouzEBrrHdfNlt ze~BeOUu>Q8y<6v?{CtZ=Jj{W}+!eWnp;qr4)NOYsp2>Rl(2ql|de0|CV2A#1(QmLy z7Qa+n?A|`-^~&qEeOCL;^}G$~`$t)J(Y@u7B7u(7Zx&Q*v{EM~LjY*!3BEMc#?$p!o70r!hvozroK} zGWwF@8OeCHAP|o;)h9>U@%j0Axp6t6p&?c|Fffqq4+=ULxHu61~4SA#*U!%gzKJ*va(Djv8TZPY5l>Rj8M=1+`EhR)bVvb4|SZS%3I84 z(n{~%ysS(}MB@q9y*Do_GZ@?(*!&LHqX+Z*=sbO@``#QYyVbQtzJ@tYoEM3|p7(&= zR+(?>ogNn+5Ed2X>l+YflPv?ag9i7Gv*pL-S7nt~jdIK`XXT=#ESxB_a%Par%TouX zW;Hs*Y2eUQIZ#fu`xvXSmPhG>gToe&3XUhe$Bg1(x;VEG4-3SRx_Y4wYR|#CILz=K zXQ*DW^s6%^Mz^?M!YZF6+qzAcLF%?o8=N7#Z`ajF4B{4D4i{^acv-@hk9~4Mfy~}p z(e-hNU(Js*Pn`}gjm#+R9~_iW5ET*K!}8U^pn}2K;n5jIv4wtddZQuE9La+-Gg6Jd zy0psr9uZ*$&DMbML8gF&$ss|e(T4a273JAXfl8vuH;k2ur|;tKvoG!)jJ2AzkqOk z>C%YiM^p#@X|NEf!6*!H|e8uY#?YMQ@3T z4$~WA3^k4*yN_Qr#bBNfiV2DdOA5nVG+~K&Q4cQ=xI2e<;vo8lI5~EoZgt<0h?97n zz^XeE%=F?wMuW$K1z0oD;NeXpJn!a-!n6rHIqp)NhXth zd6H(CBu$!hpN1}Ufo@P*S-U`iQYni?5tKzhP*Bmb7^I@2yaFPE_=4gByn?uZqM+}q zAZ;f9@4e6SOeSejf1f|vOeUF}=Pu`-d+s^k@3|dq6Rg8l<=y?xbo$`B`a;v9=G#`* z;blkj_%DmU*kkf1@A%}*tF_@f-gu!lxiJ@wbiX__S$WN8dIzTVrv5vbT=&Um6px?W zA+5hWUyt?om}Ji{Lv8e!fS8P;(t#|QgREbKK)yU34e=h?^h%xttT*=x|0P6b$vQ*D zFlMokcA6`2<%B;{8Mc|#(U`@l_M0&%O24zhrm%ZRZrPCFu?zC&&CR&GjfAS^RtR;A zS#n~aF)9^Nb-YU?cyX^o#*{d{Y$W74x<_PFYOFHd*je;T;^n;4!SDFaBfDtT&~mECjgM< z)oOLg>YB8b*VNYOye6l!0??Y6DK=R!CCZOG#IdJ~eQqkr5m!!;5${}VJefzRE~nx} zJPbV-C3u8LuI+oSrQ+OcZ+*3uQ?y(^df^cuVU~Py!xb+Ys+ToixHG#VAHAXZ@(YU_ zmensxJo12*&vjAM%O{E_4t}!u*6sXPdd^IZOjv`5kFmB7UkA_~7LZ1OaJCWi9QDjn zp~0y#!UJJc@nj|9pPGh7mj&rTSG6t(5SM~{uLxR$vCF1{gF5SEK_{lX#omc-2|8L9 zUd93__ezMq%E8!$3p55Wf>Lp2Q|qm_E;;nWB?E)@VYAQMeD{89$Gx9B?>EKAua=i8 zYE?Wjv$=Q|`_4wK(vUrWYTaKSSij8aFzmj2akJaCbnUvI9-dpROZIX%p7?MR(d3hh z%OkYxKIV%ve=fz2T3Uz`&>}kl`j!@iXz5mpedM##xwcY_w#*Aa?%}7nmtmbUf;hLC zM#6RoLmFM7aGr*h(1r$HV-$?0Lcu76B6*{rb>xjofSD1Hy@9!l;WsenG2HhU){G^R zVR!@2CkP-+^A z^j75J{za{=#osW>**_wGyF6Q5u`bG+i2G z&h!M2#|Yv|DoYq*HjqARi6!01(%76GKBU7sAS07_=_SOf{)fMutyg@PdLBt;kx;Fw zfYMuhK8uRigJ}dfm7urf$(lrr5pIcdO+ljbZm*7!LtC6%(&9gdZtRYy@7Y7VTgbC9PB{ZgoK=G&JQ^LMV?o!VXW~=&SJ6 z`gp6tNA@xwN)N9t)Vl;1_qvNEcoEJ9v)ZT3euw1PtD)Yn)Tr(L%26CC{~=)p`08&vw6Za>`_P03nCZ`W|*LErk8~PO!BO7x| zj2olvTCJrPomt{e#wThmeVtoI{S}`t-hjFJ&CDN|#j_{q+0w*-^kzXiSc%BnTFZ~| zG%*?5L_JzNUu!Yvj1g5zuZWIcv1!YQ;^Aw3j;ijWn?peY#q5XteeAu!Yk8#;L$44w zMeX)zp@2-E*6jvV%j^!hGj86@W79I^-CAu$LAKuLE1f$6V3Je*@TL(i#bJT^Ux1Im zm3C8iT1lNql1)~*?d-i*u2WVwp3xA?=&E9hy81xZr8VJX@kO8C8S04YE7i)NyO+0h z##`4e8;<%^@c`E~RQY zBbF#NrgY;ZS_S`atF_QqKT;dCIks)Cyw;(#Uvi-F%zAg^zWa*rv3-!8Lk035E66Rp zWCyW5%Cn%5W92g$3QHzx+88G}0+lNoonu0(fi zBpY&A{I%@?ZP&1$f0e878!MWYEpqF|ZW_=iQ=9r5ZYzG9y@@{g3wUxn(1PUI0l{d- zVNhpZT`=od9eVMkd|XCPh)aR&Gfu>AB!(i$PNP@+Ry;Kjcc(g5j0PRnaBZqe+qox) zgnUK7KpyJVerLN{)!0AP`l%N7X7qM;`%E`;bMbay6G-I4^o<)(-I`ONm(K&;WmU_N zR6N0b^Xl&I)#M*OKP`T@dMELrJ^XX*lgeqVRq+%Hois!Nf-4j}fSvF*TM%Z%7P2j| zt+(y6DfPUK=b@+aY|p7=35LQ_ZA_A|J&yY&?@5JRX;OBanxPU;Cc`xcx&rkXMJ&Z> zGqJ|0s;pvNZ`kSg>esC^DMG=@p)M{ES1Mz!k;%2K(OiJ*{iWWY4ZB>?;{UR5;bhau z|DHXjJOt#NP0HFV5~|diLcsuYqc*4wDyP%CqEPQ-&CXp;&cOrzXv#Zb)>nui9cn^| zFG^fOa(1QONegC1rH*5UXaLegh&1FUSV=m+&)*n!6<>8sJznKEXufzuKvNq{RXUrx z6m5x0Tc*+OSsJ-9WC{5!)^nD=W@`1O8g0MFom%|tw`Uo46qUrpyyNGDk*Ww*JisAb z6<~`%?p0NJVnLt3Q1Ee#N2sm`t}&P6q-<5CO#)s5Tww9!PR{Fl9mdhjU_~UMkFiF*yUFV6^Tlcv?dONxevcy8e5`qr8oei>oP+UuGL7fl) zw^^q*g!y`2;882`b)MVBvlc$gbA$@@{BD4=acUC-e0GG3s8vqbZ;!M@&s)EHC&zxR zWoK4cW(nN8l=mYDfP5Om{t5C;j9)M?Dzimn<4sEoP;DBnroymLNze-CS#>hOammEz zI-1V9Brwibu3ly3|DGBTJz89G_tQ_EmdXgt(ag1^yVf;S z^{{Vg@wd@Mg~B<(V5d+oKe;{gb>b|qzfIbwAs`~b%eAU@JhU=Ckz`}4TF%f8F@alwBUBrhEtWA z*LI1MMpR8YNsB>1I+)Zk0stCeeJ46bFvf0i`=b7LGD?nFNC}hCZqIerHS~41D7z{m zo^*y^rrol*uE{yv5Q%e5o^cSq*IN01q{f5i?v0O)*JYgBM+}CMfrMS#o8EI>MRm^d z@*vgz1%UXy9EE(Ab9gvwaRyO&yjF|KVp8cf zCJiD=CO7YbmF{WmfsKK3&_I|tm^grnL1EG!=muN{lCHG5S?;FAd7ozarOR$<$Xt5f zk-NRoC1b@4QP{u#t9?%d4MF$U8Xc9_o&8?%md`5mXo(%$;tq_B9r3zGWFnL%v(gM6 zr9z`oEG?Kc8kYm7Biafe$V3kq14AqaNkdhVWllrYHg~hF1#n_u64<-9-*lBeSGVrh z)#>9aRvx^)r}z8pS?tF59iHT}$PF{cU;GE>yY?@l;dqkhBM=NR{ zTD|(JPcJ%C@$urZ;&uOYdJ>bdqukI-#hHJ8;Zv*@7m)BPp(m?mXSlyB9zbu2p7aWp zE{)m8*la!xbj8dYaOnpUpI!rFurDnb6gF{K$~C=Q)#)51$pn>l1r zw2#lVf9j^mgB=&_n^;=x$d288Rvi~Eew+V38@ z{^BU{K)~kW-ou<3pg$zSxiD*Xcb8uqg}-j<4?7*S$s%GhfxIBOH^&{c%9c4hIIZ!YAl75@NE z)>pX0|4XTA@6UXe`yD)3aMdb41+JR-Ex2lgp~f;RX4~04Y!Y5_Qg8v=s^@v2$`r(J zGFeRA4JH1(MGtU?4BF0zqhKss<*yt_!Ik&RS)OR_WAv( zs>a+Z$oDcl+swWP`9Z;~Vxar7e4}t%dB<)V%MlBQHfqgM1SoOTw!ZN#zml-*uTBRY5W%l{Tw%2w)FDffMXnWkP zwyTrsq&-Qn^mi;_D-`c;P`~kO)rNNzEcVKd;-7VzyNds-eDFafYrI3JW3faPBCd?@ zmm=y>CM~$NJOIxQ+%mzdVsZC*$^(pXF7GslCn0%vk}F0i4!we@hyg@I*DS#hfsDo5 zo!pgwEzSgnIpvzC?*1;j^LkfPaPk%{`L8}bOM|7a6AQ~ZV>WELyeNatP6LvXS)K-1el>Y%Ia zJmsW|NVN&b%FnC*f}9J*d2$x!PWCX<{szN(1X6&W} ziR$;0NV;E+q?`SI5sB)Kx=)8hot;$-vr6Tka0*#&9Dr=#O1WcrFUwxeegik10htQf zsWqt-Qrh?~kr1@{{Kbg`0d0wxRPie$kc`du%2Bu6GeF(e6FiKFy7d6Vy8v~2V^`Ng z$n8Q&7`Y|Py|WuxHM5*bTqoE>m_To|w-@MLqd~uMBaOm9{zi)G-MCTw`KB8;ZGwF9 z<1NQ$FPv^^k)H>snbZNXBT|N+U_X(gQ65vghOrP425QB=*$=1v65t;DPoyZa}2N=ZDb`= z?1$iP>&W*I{qLdr-_s+aZ?QK1IW2UQ18__FFUq`ImI7CXkYQrygZh?1iO=p_@? zWTc2*R-W>?xn78?-iMp^O1NqO?`8yRdv^&}?QUv46<00ywG5qohyypW44wT3(Agy^ zo$k)lptEHu%F0sj_A?){A*MsbviA}63PIpd6pNE|udfdyMklJ%)+xvXHV-T#OD${L z0k$7EB$g0Vy}d#pobMH^c1-dkf~}XdQ=H@`XL)zam9R9wWpXcPkFu>y)1%TIS%3w- zF4$?WrJr;LI)%B>Bh8f61+5$driW3U18bQ?MPLW7;GZLp)Bz#bt5UcwDx6Q8yqKr8brX&Pi0BBeoDXu|Xmofz23! z3m!FLYtm`EyQS$TuY#A1KzBDrfSRENj}6ktihn0qgbqBHer$dlFi(FZU2$fsO#Ugb)qEo zAhV1Wm_A9%D*?}^OPst47Ba^axG!pX2*zkS6q2#~*sA7c4!eSco_`;*DS93&$d21! zdmg1-&?S$2seeC293DZDsC9{;t|Fes5?T8bcPLt)6mY0tX$wh`hl=uX}1118p zz`34NiI0>^WG|U56ju^Igt#vtei1(;Qu0G05ov+*;p4OSOo!)W&IzTXdGeBSsmedk zK41JX*r~)z4g^Ru19CI9fdFLU=U5A$orc+v22$=eZR0oQq%ldf@doxfcr~Q0tC;nI zg?cD3MrdoD+}2dd81X?i7-6iUA5)X4so}%aNb%v#=zzq0kUY^jyINY#bleHULvevT z?!c^mn>h@9rh}Bg_|nx(Ud7d%NMIi6FT+FOnB1juotu;T0<5;k*w{b&FmCeg7Nyp~ z1EVTOUIjBz=ejysDrg%g%4i$qf=jymN~yI6VS9drbt3BWe8F^`P{HDF1IK4Sm<|MF zLde2(B5@g%kPWX9b8#{MN8E&oxlk;g{V_B42;Hr~VR%IdEn9{9OwgiXW_TFv2Kt*7 zRVyYzZNN`QkI%k6Jvt=w93*=x?rQQI>}=Q0e3$T0#OL8T2Nb5+XP7o=&97dK!Fd>z zJ-Yd>UV#US%Y8IGx-l@=@3!E zhKCY1#7$yz&E~Cm7X9TZ?2Wm7LTrHKJ5f(rVsoHxB70$<;+feZvFEf8-Q8rJbj$0+ z+T9(EO8$zXQwSwxdm}FtC;{yo7$S=IN;3EJv&>&))bI$rc&bz6Rn)1G5pW{t^ZE%> zus<)eBIfJVDNKR=+ySWSAc%so^J1!*#bm}*l*G{${0{ShqkpLXryNM zgRuQ9RuTQP(|Tw)#?fDPqQ^2szPw?y$Fn!9&Qx@9DvrllAG2FLNZ-pi>`VB^5FP9h z40M8;nuJ7czKKq)5o+_Gpl@oD-3<6gvt?lHQ=UX5%Ls4i4V8?3TuhPPADf1T(^EEa zwJ67x?wFmOKzjdY&la>42~Hdq0t@eMmto=ZAeM}h^i8S%O2kY^|H-Iwv$)~4Tl6&O zS(&tlo|&l?0U29r4;=JQPq%l=4=L|1)ueaHIHDSqDE9z=04FebzH~+u7)YpRldPUL zI*Q`28c~#IPH5TAAZjR?FXcZ=?LEjZ$IZ0zEKti|QR(Po0| zd`htu8YW`qFUAeshb7JgaE^q`*U|!*JWMkV_+OlE%gG>ltRkYQB^lo=$=J_s#$D{a zqLvN~k(J{`>|uzUy@u%7YiLMD-Xr>O|8(zwEL0p(dGZhvqnr+9XNg@@NBBjFs;a2h zP=RZ~>uS=5+NdT|ACKF@VFs0^5=O6Ay|mzU*<2*ewv)#GNl6w`aZQT3OVL3J5k`10 zPU@5pY=9UdY>APg8%Q#NpQS+TT0yH$Ar6W#C~Id~?&@n_xMfx1$KMRNTZYmG{K)oj zh}A7Fu6^q+Hh5q0{^EVJ%%A+jn#bAf6Ei>N8gCEO*6(?0je4xL_LHhlT$=Z1Z9}1B zJChH;y!H!Uz47|~o>*qXa=v(?n%{qNC1SR=*_+khP+VAwhu$fi9dXv`^-bA8qf?1s zXxs+EY@Dr7#`S^WxY;rs*PDmq@f4dfO%#Ulf*+^w;}m{uPK8pL6ab2;lrNLfuPF3n zmSomv04uO$I0K()_8}eV`xpxrDJ#cPCA^}Ts~33(>9qU~3rWNxNZ?(>i7{>@n^YM_ zh&U0A0OL)P7h<|jZ4xO(aft<|Rw#JZ$&D=g>qC7k3K7+@mvJw@9lG{{D~fLxe{=JZ zz2l#MV~=v}%2#*YJbVEgVEqTqx_?7W@vk$!{k%6h)*Nl9tSBt8SXZ63>I|MSIOvq<^>pQks!6Pf#0r7dFQQiDVy2sU8Gb5u>hW=+^Mw6B zP9uBcc9S1Tntq51Jp~WCltEiPgn?!Dw^w%WL#{ci^x4_Xd z@XtWX3c;b%o^b{hbH*9cxsFcJ!%i2br0-EWBRVa-h35s!vVy@$$6*lvm8OSGjbxN^ z)Hcnvnw%=pY9=W@k8;D#MGR}@GDAE z-+%QDRzy!3T-i?2-j;Sc@^r*XOLJBB^h4bJh?&YyUkrjpHosW*|09bRpZ@71-x>LT zdpcQn>Zw!4d>j8Lb0M?l5fbeY2fgxN4LbSQzZrFDzU8i?=aem^UWI4(lU2#A;XM4X z$iSa}HmA9Zh6c5oY;7G(M+Y(w@=S`aC23Jv8hbH&Gv5n_IR1nNBrtq5AVCR=sgx)T zKRG!~Yig9_&Fzzm)P$c#+s5u^&*OJ98KD9l#rE1pDrszKYl9T}gA_L>WKOfGwdg^`H2+g6rz=>k@?4_k#Lj%*$fKJdYCXE@KM!>4nhtk1BiM{V4#XbBhz!6kRp4qL! z89{Bz8AbtUcf@LShYe~im#)#))}_L5RkX^uA!0{iOnXur4Eof{a2R!)%;8WNP{FVO zGY}?(w{RFB3E#?s!2@iv!MI||a88L^N|L<9$^sZf>I%wuNJ4#+96S7|to#Lq4N7~wNy0H|RyJ`2^ra^5UGvm&`-pM0N zE&t77wqn!x%3Ck&=2xD$9V1U8|8i{*tSuTB$J!EWgq$~xu;*nfMPr62Vx! z7%_J;*(&9N$hnI~&hb~{hVc;uHF%2f>*N|dPq1eB#QyJU@Z9y$HFzZU9@;8aU|PziPPm!6xonT% zu-WtK#!kjWm&g!5)XQt7ftEcFg0mr&oPcPkMvZ`0oZR;dK~p9Z(m0cDwZ|`9!;ol+IPx#aBhPu5Zv!Mnt5P(hY!O`(>Gh%PUtSI@xPLB;a2YQPtQa?jkkkIaT!e^`z=NVVPF` zOE&63_GiJ*Y#jCM3syQRQoHME$@wLF`#+kL`mEyi6D($cjuig|%m79THrm51E53x!JtIR+?7OHFwX#l>>23ds zUGsRchuFTEFEV|ClX?t2J;X2UA$}oJ>?Dbg!fHJ|W#riVr*m@!45{-eEi%$m__SqJ z5!nOGW$H4&GXE;Bt~LVg~eTz%7IQb|JXD_p_HweT=Po`F3{e4HZX==NB3F z+mS|h_5Jp~24j=EClQ%i>!@w-s!L|mk;;~QEBEHfH{_^>O0OUq@uIkEvpL+wQBUFy zS$Krs6FdmlW(hTIBAZ240zYqJnz|KI-8p$Sfk9k0JImh5+|GdYDd;r3!Kl(tNVV7r zL>7TDH>&qWD^bX!1wr_D?MLPTH1g$+^S5;S4(a{&_h)fl79fH=G?_dPRJ5^u=7wEO5a4zgZ z1&U%-SS;!(+E9EO;VN*7V71v7;N(oO#pCFsz(TQa(fXpNTK9tsV zxhXEbg>aBi{ekR!5;&Uz1mmcYK>jk3VC^?$y1rT)zP#_YRr=tHz0Otln^f5&S7==z zpmK_;s#rqr26s^HPJU`zeAA-c{oQ-QhCq8e`)vH|wp{yJXM6gKUtFfRM`y?dbVeJB z_Pca^*o<I@IC)O&%gXUEF-KY2GI^ak?bDOF`~{w5}HkFhS8ywgQa5V zw7JFZY9Sb9I(qmZoDR@<@RjA)+`dNd=n6!u+mqd+f#!YVZQ;G~3+ls{_ujV3aNR|# zzl>tVhY#zF8h21z^`Hj~$Qna^lQtf;G~Qzh`@D_C_r9n2uT-ba)0F61eYoIijXDE9 zLo|qSH5sFpuvu5Hu5RaMT_ax*Kq=dsVAVsjmH zgW?6~7K{47Ddad}$&fiTRj`@OYPUKDl8|`&j+F`_; zC>yWt=H=R_K-3c^LNW)Ozq=0Kk-_4u&3bnr=CMV67Plq6KI+H`W3}N#`}*6?)6e{S2tf`cBO(8|fwVP6=)KM?%CEf56T3lMHG)gwSBFW&?b+kQA)$d@>n`7|aGU%4>rcry&=R&rYOJr6$_UB#3TTTKf7l3I~+Y#OR6y28NMONFb|{DDx^ zuFq9fuU?h$_??M?Pfu(dTf0HGd)2z_TgJM*pL1439nHb8S@D+L=+ae0{eBKLt$R1L zcIKVFjZ-Jw3lK6`?f`?OGKg9_qf1cxX zPOJ0!DXUIrx_(OHP?i`mWLc6G1uKSSNM4n6fwidl#oeabRDESdeLUTiFz4Co>V)9W zq;~RrYoFHFP@Rl_KbK6Vjbq)dv0NyV{wa%l7x?0F{!Fk;dzcPb>nw_j)D(RCUH5GZZ#lppC&|4o;t2&c82TZ}InAey;u{^6loJfUJxrPB?_M#Jq z-`Vlzsuvf(`s#~szH`Bi3oDB2ur9mswjCFv4A8Wgw2CYvY77p|$BUE2mlJ)h zwH9kS+ZnyBIQ!C<`qXy4#;K3CS9=PB9*f?l>3#IInU9Cso9gW5>efZ6Yi3`2bdknx zu=s}iivw1ZY31YF4HaHXg=5u&BQB4@HS@TTt?%fl&kDtd)b+mYk58H{daG0K@kE!d zUY&CJ6;Jcm9d$&s=`Fi1>eVZk#@!xo z%w$^e_zqwFZ{^FyIP+b_-yK2mEY-WkX9l#gWDM$%*IlXhU9nQ7 zKU#eF*{6zMxk9a6zdx=_2P#mry|HtoUa9WA?f&C44IW8Eh0Ec!s1j$kIU}z3+*Ltq zXJdU=m!MNPLmFc|o$f!-)PWf?QhHbE)9>j@*h(N|rT{r_P zHpCnddQht@(AETUfQ5O{(z$){1{ENh_F0;_sQ~|NeKy zzW3jMzo=4I6)^$Z9>3qo1;;W|kLGiko2mh|v`}e<}IQ;j&_Z~aOr^&wuA1v->C#cAW+3~*| zD}LeF*v_3}m#80Q1Peck6QF}!dtq|o+6z=F&~O}Xx|q8k z1e=$aqv3h#PO5MP2c<$f9d*6Ebq(F!4W4-1)5TxI28;h_?e1>vYHRDt1*6emZ!djb zyYxH__=Zj*eaV63f#Y9w199{=CHk zKD)(aH?1ikUCsx*W-qH%>AYyLQq8KHbp5*JI$lRkhJF+rRHI6QZijuJ9rs4--T9E6 z<;;L?Vyd28i>oenx8eSW-PyGuO2cKcX7M9LDPO%|TcEn$xkPUt z?rCCwPrZ?u_t>pK#F2<;J0d{1wuDJql3+zAZMBg#h1#Yj*O~%J+Y2e;lwfnP5vRmP zos#pI2XT8h!#)Aeo~g%S@-F;930DOLv38%%T|w_o@3Fw`CHoTkNgb9`-4*yNa98a1 z?+ByRUFka4-q@(t2ORKL>@K@bZ8!A}QeVZTt{H4lE8CNP_L^eis>r>u-w1hc_q)Ec;o(LL<(Vjf=FN&YzVH$?#!k8o`(1v_KFO5<@> zM(J;}p!MX<^pYvj8-tTbd@8!hi@Pkg^rU(qaYoNxlW(iux~MPJG#D|Z&)mfG&xL)x z4qx8qtMs^2P1k=OysGqU54#+8a! z#$W)~6&H1p;uRU&1Gewl5IC`sOIk2BDzp=q9*Q#{2dm+c!+9x>$ALDAX19=mC*DJu zrGU>)w||`9?RNfN@0in2oxPxzwe<$;v;8$Ki_c2=YBH(%s_3|tGp2)fzvbgv6>pv2G~rWXS7%BqY>`vSxeen#Wm+95!e%fl4t6*$f3L#e%4_ zLjnzIJG=IbFIzRf#6a5O)mK#X#UhLEX#GUiP;={u%5O3)Qu=HjQ^ZtJrEwyO=CGKI zmVoC8#UNQBe?cWGR`HmW9Yu(3UUP9J)JHcL#a-sNR`S*1Wu2~}YP*p%(^b9NXY}fV z72V0&&Y#VHKKc8p5s%*vXELNKe3dSHV zZt|;edO(FV`Sd{4)hFH_L{14(_?4a+;22`CczU{V@q9ym5w8zuI_f)j+3M>xuEP#f zJYjB12Q2&X5dSBo1M9^~ zTP2>JKO@8vK95dWRh6kv_ea^NVDRM?QAacu<)cn)U>2iMX+n}0SEA|sc?Q5QwxUYB z)eSc<8SJi5pfXllZK$iFa+2||-|M#NwJJqw2{_a+J>H)-&i&_Zdy?D|miGPdr!cBN z#HD`3m9YGDZFRuCH)_0Zcy{Kk&wY;bJp0L+rQESkvi+#Cqb#1daON!T)(e-; z9Om{e{myr8xM6VSPVUU&X0rG1ovCLI7th5yA~!N?nF_(eE2j!PiR+7~d*-oo0ThT_oTe@`F5DQon>h|#G;r^)KAi_!N_GljBala+ex$=TN_PL5Zyuv3} z>|ytizrS>*mAPiNiQ0(}bBR!6COfW~?6_tG^|0gmS>Eq4d&rIp6X;&J<3>w6u5F)< zv(X*bh8@?&+8*Fo3%7yeu=B26``mxJ_tHwPv}R&y>$ThI)|(#;Bz(@Yoj13o$!N$2 zXEsVZuU*p+llNVneWZuIqev>64^rmIIO55auY_FGSD8;CM}W9-2pkZadn2!6?kyCe zATI@S1aC|?G|21_IjUU3(*FYT2u5GUc{cqPb~?4V zt~nfMRJC;~chHSHjJ-%D3Tc$}@iOiW?(^JtxgT_Y&yBE>+ii^5;9{Bb7MszwqF_{T zHA@Qs_)4sE_(rs<1T<2rj5c>3r{@N!DT$=vP)4F5#HUchc~YryXD5kJW3Qvo19H|T z|Nq>s@rH&)Y(wk1mSyWR1MU8X#Fr+Qn7*-Zbga%d&UtC9`sdA?zkVc)u4B~9e4pYNd}dOOWn4(QtZ~MnibNb% zK2;qzIYVBP7i4-3gr%^tm|_y$Vt!@JvyZY@z9K^5g? zf;nhXIMocYIE){~$NWUG0uFcH?>BfV6;Y33qTuo9<58PIugBFIsA2&KFaZM7I5&-i z$~Cs7?VGr_i2sXIg#ak=bTL^ZC`z{_#3$5ymu*<3IPdz!hn5W-+>}_`S39(;<&N7l z8$PcwUHI7RS8uxO#_h_$Csu9v#yP@@p{TJkdC|pc<-o9^)7Cz|@13`?=CBo#>M79D zv#HifbxiPnD}BEP6-7Q!JOF=eo0w%GcZ-~ce{qRoboTp9;SoyN1D*UQf_~#!^Jo`t zO1q%H-<;gM;oq??WQ>oLmZKRSa)X9^V*~?C80gxM;~ag7;@7xO=^TkmgnOWnp3BSW zIbA*v?ges*^DmX4JVJV@1SKF1o;}zH_5?n*;DQPH@lwWIdO;EyV<&PVq+0_>d&sQ; zq&@6W=51!fBUCcv{Y}ty3XG3PpHJ1Lji9#)(2sVjy4(3`@-dt(%5N4}*oabAeAmqN zF3$zkZrpyW-Ev_x+ZF6o`hrPdamlj9n{&aU~ z0R`~NblbeUs-#vD6a>AYi{2xI>H?TadP5h+b3b@8zh*FOG^>2to4Tk%gPDvAt@`@F zj;HT2>E9LfodQVW^e?Lx-sDx9QE@6uYDL;I^LBX;*~{4B+2@#kxoU%AK`V@uJ}+WN z6d1Q(&AUje9PJ=7{E2kM0nCTkQz{)jB~=DK!JI1u&4d_5XkX}yB=z4tQP9)7yXapo zBDDq<4b8FRrJl}ji1b4`@|aJ>4W;(%WA}l@O0Z~4nPUX!DUW|~f;F;$B5kIuMEpEyOxDYS zWz{6QF5aB>2eB^%A%U6#2}VRn)H1cTXes_0b9Cc$eR56!Q33q5h{}5!e@&|fU`7U8m`z zi0Y(&V>6e}G1Zx*$W+H%9b$e0Ecb;1j)<^h%a)NfxJSehFG6rSjg9c) z=-*A+C&$1^7J(ECi0!56lh-U@^>aEjSag&ztJTWC0K>FRn!{6X7!<*)kv-c>^tgo+3?#X{6S2b3WdnNNM`vGeHkVQLx zvT4m9y48{2iLI?KwN{=1G6vTc*UsYr?&I$fnU&NMETFDg%Lss~a^_k|qBKKq&y#r> zzZ*8Sw`5Zx6*}7_>#Uthm8@SoS5C8=Z^y{05cwp;qKa&kbNHvYDrWAkA8S5ZcGu4( zr@!lm-WRm7Bx5`O2CPt>h-M-e2D$UNCsksjEVwaNNc%UIDe#qE~P+PBO>D^Hde~H+niFuj1*fstRia zZbtR-*{@AkCse22kt5wff{vO z^_L8J`uSGwz09i0q#-*@QF^Yvs3)#>DUsIx`~gKp84fD1_=KG zhm!+?kiIf`jxu#tDrKg4FQ$jgl2}neN$Nm|y!k7ck1;2hR&vIlf7Ky181$+`=~v}< z9a2~wwoUX|s?l(dERk8xyi=SJt2Cs+91z)WY1(JBnckd;74((qOwwc(wOzIqbT!lS z&C8G`+VU$EhnUM5sXCOzh9}Ah3j80-DDY^IyapH4)j_4I&z$@WQ~wRooWMVNQm`%R zDwUcU;0DTT!^p=TaW|NE^C`cB{orJ3j#~rL6hPpM1+xXN{X2qfajqnE&_CE)R&Yk{ zAO@_|M`fGbN1Xq*qN-r2mewZ6rcI^&YVGmaUreuEefs@Mn$54vW6$qkRx;O=DsRk( z<I!s5rHzoZk&dEr7?P>qf>B({d>@jfQN%D(gF{}$njVW5 zmFNir%s^R9paqg=zlxf2JC)!Fb4bd7f46CN_3WL*UK0%rQsz@Ii0uz=Bc#X`y)c>1 zuB7?Uxvx+ekCkL>o;^^K0ZtNOPh~Qq3_wC3p3db^;cUJP2~YbddPwoK{3hn7GoM3N z#R2WgPSZ=!@LlgjZ|{6CEg2mVi~H@;-)?43&V2rqzg@m$`SR2J?Fn5ux|QF_Hobon z>|;YuSf|T(*W(NF-a3?;!

    7rJek&&4Vv!&;p{Mw!a^!TGCMB*7lD2=B`|({e_=K z{==Bf(p#lV2w;r+{l!|557&m%8P;hwo0pkqBK#Kz%Lk`X;_lRSdWy8ovoFfhXr%-y zZG_Im$cQLy;`r>b>4}NcNW-c5W>r#gGi>CG0jd+ss^Wg^zgl#xxtT~gK6{m*ZEhA( ztbnh#pcGyikdrd9OU^6n8}RkX~9oS=r}0Jpb}F`GI@^*cFSZ!GFi0L8eoaez6!=fOt}j&MD4?T6jACPgffwQ zh~<^LK5S9~Ma9m>@tIff850u`%qC95X^mPn%2u=LD3SoAJ}ilWQlJttd{HZs0Z0e5 z09U9^#`1?7?!Uj`D_UoW@<@Z?voAMXaiUJ? zy@G6j#Ywa~N@dpyI!1}hfs`n>uO#aM$=AG6tHmuqT6Gl3s-EXdxl7uGN;DlEsEiI3 z|8b<@mv{s_xmNMw6%8-{yx|H4S=x=oUn$n%mP9-U*%6##5G6`s-))1RHOx#h1w^j5 zF}s;du*2OiM8_{&ckarw@`^@VwJze@>(kj-Mse1;7k2BfxUzZa(lvt#=s7l{FQ|U4Qe{*< zs##>x1d9W=sdzK#wYxLm$YECGe+2JKW(Yqj|5k>S(GWI)zaZFawWDY(0aPfZ*QE3+ z|J*9QS1)*FrT6k{e8Jx>l(X>f<>ztRYnpSpX0|um(vrQgsjaQ){gxd0U#?|y=|?ly z=2}~G><`E%i)SF1+l&w8T5cqP-5X2aZEk97Y36s5zap1WD!TAD-^M4>_-OH^mX=&` z7ruKwmutNhKv5QNazzDXy-9xmvz9FRU@P|^-rdriZT}Je0KXxA(G0RFDN>J>eFzGm zMm^R~uyQ?ChXXT7=zZi>pstp~q1Tgz%=-vm#+T6Q%VL9cDPldN@}=ql?mX;!S|XD@ z#C;1Ve^k98>z7|ZjIg$}D3zk;o>S!-G-cPa%RVb?#O%8>m$T3DIQwuK$W*b1TvQ@; z5^#D)BUAEu1)yS_-sx|Wkz|y!%cm7s3(;Iq9}^O}OSoo8MEPwZ@tiq{3mC&z${3~+ zYooPDIhm-_!MucZAqh*DoHlUh|pq*j%r zR#kzKEygAi+C;UkGy)5xVhrA&HwKq;J@6X4v8jnY9UO!%$rUs0gM%0X={Gq=PMDj0 z+FYtoqMp7x^FFt#Yz!_hQmLibW4YAwSZ7sFRkmylN;^hL>bxY{dZwke_VkoU z>54kOuB~hg=1V0JKGg%HMz5s*S8^TTL5MYu>0#sRwY7PA=rCD=`N4ErENsie348;D zBaL(s^W4x9{l_|8r9_oRssn1odycR@OpfgJilDSi$*VvMdj^9zPSIbffMHB1buu5nq)}uS7kgb( z>h(eJ;sYfwe}2DRrG88LZ>Vi6b^BCJMc)fb)Wnneeh^F>6C{g@Gr!syJwMddq5I-* z1L^>7ES1;m+>n-y0{=H@6jbcN@!yo>iWOH#z=wn^-~$I)DTK>KKx-=PLOP7@Mw@G`gLkq8y%4XKh7(|vm7! zPSF}jYvFgwQ7!?x8`0hUvyZXEC0Qs$KxDPH%5^DF^Xtj!#%5mLs^(U!)Z-4N9qlqo zvVP85nbxw3Wr7bUjy`%u=v{MBp&=0`MDd3fY> z49Tll!;xSmxV0S3|tMq5h-$jNE8>pZBpWWXgR8njJE`WSRP|F1gRhmAyLM(Zf~!M}0oP z{FV7H!iE(UWOP&rh4Z6=QLM;k7$yA|e+7H@w|N6lu0C|$-<>xG2bkB&tJEzR1REU$ z(e~G8%15DGtT^}Y&KrjV%q!*f#}^EQfewTy7bEejc_UFS`ZV)@IorYd=PEy=SjJxk z`{Gp?0V$~7&3BK?DF88c^F5z={lA=zi5`_We2U>=tjLm=GK?^hoRMv4CH?8-^eBPktMnN83VhB>?Tw&az11?X=;*%!6$leIu=8gMLtWEt$f-> zQmI;$h5d6UYE;XW59jZn)IR5Or5ZdC{Nw3ZqwTZ~JJ!KtGamvO^#Wx7fZD44vp+#C zSyW>pZW->ap*vJ_GZHHF2MI53mnuK{h$=-iUzCJO$f6{)vL5Gq**g)-FTn88@(Z+; zEr1e9-U-I?Z_|k;`{`XD1#<-Z{36t_YnNDhy9B{(wHg{it!i(Lx2v-wWKef=Jq;Br z3JrCsy2(PTx818=Q80T$-i#OUNfYp0+DK|=yHo3&C}Z*a%#}mJvuT^$(D%@Hqzkh+gf14t!=y;MUb}aCNh(jCsug{J#3Biiw!YH{Juw!&I zl|mRA#YKKSE#yNrR4=j3VZI^%IU=9_J>=u>4eUD9ucLpDTOvpqylfVT1Em7)!Oy3w z<>DWuzelW+e}Voz+C!et2F2&Al-M50^9KeZ5rhN)Ie2`!eUT?V@A=FTqx;Ir-Hy0Pn^vKzHxD^`$QXNA1$L{_Xon0|f_>F1W6wQLn@5PSQFX<=CE?Yxy( za%f5Ki)-h4kEhe#6MLkZd-eiDAEAbx)Fzl49s2B!0c?JeQ%33|pM4*mT^c#kb24(| z*_tA$XiZK3k|m_yOXPlgmn=b5H+f_`>B!R0jUAtT^wF_Nmc(Aff$ozA`t*+{HkfJ- zids?4p(Fn#GV=UZ#WT!@%=&4Vx5-IjH52JPc@@I`Xns=ATk?-jPL7V2hQE_47(Ts( zR1{pYB%c?@|EF`>MjIij3`SpkC+i+<0d%i4`e*^CkXt}w`lJOkwoh8nMqALS74&=@W~wTXa(jc`i9#?D zF`EsiDHulzhEW43+d3({De^YtGB7Q;st<@yH!*h91QO2AM^uqx`zNi|ffgRcB?Y{qKM017j?#t(i}L(* zbt^CBdgx(O@@t5GUORgQ|2-uzUF`o-X=*ma+%IDO=te12;QkX-7pTM+a{o^*C&o0I zb3MZnSC&e}w(5#8dac--u{I{dDORUWd=1nk-Bh*d+!QyL*r~FjkaF(P^=_ zWXTnqv{VWT#!9;hxk`*|7X(V1v=K(KII7qo_&tMXj}JD*vxnC;|Nj1}(b`q(-Nmu< zDsyA4XP=*8CtEu9ICs0)-_E>V2d==oGjEfqCGrjA#-}P~RPd>A!DrAPal4aMeqLE^ zO+_5RbIgv3f*8%$IrB=TIbmVQ#gstWlRFX7K%^$*#*yi#@oh>=r}OVNaV(0SAkpHS&RNCUrbg zX-!$HE!l@0iQ=)kQ(`4f{T&Q~DRN&pw1c`2u~hR^iMatm;{L;f`9&Qee>+*R5Oo!8M%8 z%wBwQGtkS?*(;Pe{-5CM#+kE#b>521$9=+?%{pC&FBq(321iF%JDq@ObfnMTx=p)% za>t7CiNcCRbAz!%r&Ah@8LHCe^;cyaWA>0V{WUs5Xe;cEUY3aj00} zZf<7j<(+jLZc(L*5ag8+yaQ`Ki{F6nnIrX%@s<>wp@cP94ONu5PNXOZK57Dg&B^`N z8cKT|u(`(SZGG7^>okXa*6i|~tv0)mMEo+S9G+q_1+Yx6N7El5~3N z`fD?n|Ia;Zc?F-%dvqqx%9U0_G#)dB$CoaRg~wN)`Pu~ge}T44(9<~9lvxo^Z!7** zY4$lMj-0#PABm1sjUH&>T^`%5_KKKoNTo)t1FhNM?e5RVlIzxtxetdgxcS)XVAAh0 zMMCzAG=^lsV?<{;NMG_(?RP|S@jo41^$IeTnt>g>rxV~rVA#noo>hNXp-QeFP&wTDhjK{zT_*P=Q?&ko@Q5tG|P z?#NnCKfURm+6t{S!OND$Mjkth4NkCoJG;xKxccGJ1Sf<^d46^3{Z^IUsQDLDtFr}c zbaGumTdrN4TAtZ9^P%D=Eb1;%hH*9S(=>;IWSQ(xGuXj_mL zMd|OjXdj88r-y=ArMPb@6n6WwFR?7HZq`?fwA@{M^U%rrs`Q^_pJdN)xgILsQ~co0 z$DZx1kH%8%8edhH%X_u%lOK2QcEs1Pm!15O>}(@w*F)SBOoF}e4YE(FS$^hK)R4q6 zjaD%e+`%C7Kn@4KAba}{5DR_qXn0_L*G$)^&C-=Sa3&;Q3U_*HxXZZ^{~L+J<`(pv zM$7B;oa*c;!djQuAgowu#ii!CQ2p|$)@_O2E?gTkFq!Y#Ry*_-&JarGcg6MW$=N3) zNjh-Nyn<1s(dzU{qd~=;J%tRlERR-f!Dgav!9H@be);N-GqOW@R-t%*U~-^$P3PF~ zSHQp92&p%7hq&kXcOlh`m1RX<860~9W3k$lc8AWib&AvNpW;+_g>-aFB%jLdm7l}o z_V>@km!DD7Jnms{O{`c|?>g6WOsC^x9g`#3#?{_|t|bF)jthOoH`pD;FXOo%E3W6h zJp0+Q=f-hzH!uo3S#5WyxUEwr)&41y4zK^}$+)PLJzspXjlCjL|j_#06NSeR}P@AYx2?W9CbB`J}E!v5Q) zbhiCdIul-{Hi$K0C3X@?R?8D7y-EXud2Hy&v~_gXCkA4}6X}LQ7ke-{G}IWM{4~q2 zAE=Bj>S)fs)jHVIP`AY0-PzaL7Mc1BN#&}T`;jp_K6?jRXhNifw9xzi@%AQwaaQI2 z@Vm^CnM^YKzVBORCX-1fd-7&anzmWmw4J6KZE0y~Sz4C1v=j@JRX|w<6jW3|6x1jv zvUo)VmF2qNb`j;O;Ptv*5rJm%{myyccQPpjz2Eo!|6)7MOy+sddCqg5^PFe-J@D@6 zb&S;tTn>fHZ8h$mwGyM(f`MACT)m3hB{2)H?=et$rKDF{^a=rqgMA+kjgRL%vkvy+ z=-BdHvESXFBqR4n6^7rpjCQm-w|Uyz2iw~kmz94o<_!C%nGLKxK}~1C~dMbL76r*mN>C3RXtP zMhc-dKA|ru6xyIzwftDyu#itr*?ZatTRH<9gXO=D_|j-N-gh7SG^x$~O4-YObKyHx z>+S>+W{(gR*WT$;x;;x)zh1j*)>eOb)@H)%dyG{cqlA-WlYUl{j(mlVC#}k+;#6nO zn!s1F35DV5v;smOzWF|po zOh_!9OHdsO|G%FMyj=3=>1292GBv!bZZWfGC35|NLW3hq1|RCdWPI)2(Lw{AOd;bq z%$K*cWtx(OM%M?);Qd4H@*COKTtlIePNuohecw~%({LkvrmR3d(6>?HOC-mQ4m(zZ zo!4sJF1y0Z)YW;EjLCr7TNwXvcp=Y4Vmm6Wi7BU!H&Y8gUj2g^5T80-QtMI%E|Xp- z)Ms{WU%s-Pzv@hj-k+PzB&R|rS%v4Aks6PmFL(XrLB#H3y6;lA89+|?Z1;JmMWa4-{D z>nuCDCbI7@nEwuY;leAG5tx`Z!6=V`oE$_YsmRu^#XwXlE!j;(HU0B}VDqpSM#g5M z!8N{iGLoiYN4?fl-q1EY)ZpJ3c!&%oyVCPBRy+TD2A8eNxPP!S{9kb%I)J?E<;@zM zS?6@A48QXO|LAXOU$LU2abUkDV0Ag1UJu5whkJ!jMk8`T+japRGEo;`}sYidR{p=XFK>uJwGRziE7qe*Npgh!ytARK^ zl)w^q0l6{ao~u4#_2k34TBEY9U`d^JV9nL%)I~aOY#d62bN0@){N5E?EylRE!BOYg z)#zE}@1N;!s!`XP3?9Q68Tb4=*Sv58PMILHTxei`magFpZqAB6?Tpr5XAd~cj&-Fv zAO6&BF`r}R4Ca8j(af6xJMdluC*oz6F0&^Md~w{i6L~srm4Cz`jeGNl#bI}?ZY*E( zkXatKKO+uXPe+ZFq&|pS-~vY0BKsQgL7d_V`0pAqT(>|9$L^6*7Rpy+_2S*8S|`c=gf7|-9y+?WY=?ZVt5 zrZn;1BC&I52$`CK?YZtgnIH{iiM&K=gNTj(Do@ZWMbyEAg1f#@ zaNE=Ekx1HF)79TQe}~Q?o7!ZxioTI>J!cl1!{hRAkHv5nU(^4+R_|HY zoCJ-Yi9Pe}O{=dQTK(bmhm6J>e3yT*HZ{|{Z*P70A?KZ2_MVK5-n2qpJb(Kc-#dI; z`OQl;@Ti>s%`^B%`?kbKmsxm4&D}4fSNsd|%98pLabjpSNvKfwy1_a@z?m$7T+Kf}l<&YhhkO5aJM^fV8hqBzs`D0I&P z_~GDOKEtT1_N*v_QWW$9OY+JtJG7Vucv3~Hk>-_AqKUplRc4($RLBn5zo>s)%&Q}H zk2hE4DKs{c(KgCC1;)lk1nDTv7(Bp>Ib|o&M9vS%epHd{M^Q)6+(i}1T?EIs&L5{7 zQV|Z3&&wORE2^^PF8T%SI!K>$QowQ@JH z*==TQQM)=GqyI@CNVuu|@j_R=wpr0_&2O*_rb?v_w%+p4p7}?~MSMc&VJ~iX*L&-l zTMN!T4_WGzN-cYx-L8Ebp@<6Rv*0&ytLJ`pdT%&1<%> zcLsJu1NqICV5GPFo%6oh9_348D+UHuj1Ar}^6A50*tptm8jiMqb?2*x+WB4HxX(Wr z{KpmExYs|3GvwdPo$8B}Z^N5>Hgh3!fO$+mFJx^ zm}>9dyLZ>F_H$PH^=5u!Nqg|n#tj>k2Ma4FcPN;~c;j?QrHuH!dWAO5Xs1hhz*Yfs zPKk9Ii^qjP$YygMnzbDWt=T$NT66Z9XUtx3_TkwJ_ThC*7!q2?TG4VZCct2XBN^fg zmOqa}88Hyzg8ml%GCbXc!>BsePS7REFXNTKkHEgHULf&+B7akl{V>b||9Q9q(y@NNfjnMT&CHCsWXClm6q?Jbi zK)i%V*JnG+J#_GrnX#VBa~rq8=alLm?6(*rd4)c?d5gbeQdQG^{?O2tsKwk@XxrJL zQ7+rQW0}1sWPljmMtq|#a6Ft zY+L?tVrqT1Fx@x*!pK*?_}OpUKDqy`<{gK*)En$$qa(}fC-eJL?!)Edm+WHy*4cJ( z`RZJ1-B5V2As9@R>+fi8U;V+|{)P?F3+_1BGbkFct*~_;Pa@sZZ+x&*}Yw z@Q6fAQzT-F+Xf=0sT3ln_%P?rweV6Z5E+YPffH)nK^|kF6%g=KGv_TpBM^Fx@I?bq z8uS_oy+%r}u@RZn_z))5t8-|GE?pEVBnf`gon#%A|3*E)W+o~CU(RgO@D|ppsSWXl z$r3LGyWrQ5-SJT|WryRT5KLw>6aer&lg5L0X@gNq`&506ddvC7@)H+bbI7=P6=oe~ zjU8>}XXd|E{%wmg_SO#xUxCfCr0(D#*8;R3x#r~E^&H4KBlj?5hh&nARR{7)NtRrB zdP&X6!5b(=YS{#X#EuJA?6_c1wxaxDzxzFFPRi3uYEBNmwn!1m8x-Reit)HiF&d5r zWo9qApJ3kiBZ~eC0s3bD$4_pshnPMfcSs$V=_-<}IJ%k?52UeCP6kf}QrY*y1G%15 zF!0}oWN4_xeTcnm;U~zoqb#FcJ4guw?cSj$>Fcx(RpjR*3vbV%m_@E(Sdzm>C9Y9H zs%nY+Vzdj}8PXq`vNRfn%#qQOSFy`_G>XyE58WIvvQCk3jkTvYZzcahP!%g#4xyS& zqPa9LkaD1*LFQ|$1J-FJk!{J^OBwvZ3I`5@vwj(OpcA)HWEon0qfMQN`-+l;>+=G- zx-6Nwczc${$OV;VlC@7~et2O$^33HdLo`4n)xepIJYDFvU!d{VVxm4qClag77xyb^ zzK7rX4aozfd?NXZptJ~hk?qY^rR7)1kUb;iWkYtvyzGN);az#kLM1Poq^6%LHJi?^ zJiR1G^&smKcOM-SQgk8NO%=(m%2Q4^HY{eSE?EKGVWyYlrygV-pjnlt44U0C&82zD zFA+?iQ{*YbMv~_&cW!D2BF#`*$G8)=e1b2wwKJ`nj!bdYuHZ6P`r|(_8Xx}pg|YHm5R?~!KK z3N1cuGM%!hGF*c;w#JyQ*hD6R# zx7t@}wz=41QMV@BxYk@Ktqmcx?Ehy|RmRe>$x@o+w$PA?xb#aWOiXA@ zTFP^gC*Bl!&xtQe1ETiiCP`WFBEH zkKYvSC$V@5dyf_`(XO;zT~J%l{yn;$4xOY=<-IKFKE;a!O-!oXH~{1&($x#+@6vK5 zYAa^56$Gqb%r!Pxq|yzUps4?p7f^cNpt|$`ut6kxVm={8NAn3OJ&OH>M?q)*5_;ie zdc?;^GRyg!Xcj>L9_&`ZYccV9eK271*Qi3?Ft4yV{|qgF~t1}tNBRu)Yf zi{qY8E1mhTvGUA4slm?GYuZiozjC)V z?H=suPo)y+E7?H%_Q>tuzx2W^R))XnL?i8@MaQUk13V-d^*}yjkgtr+zL*#i$7y8_ zc@<%GA`v9viJ$zwDp#GbkYwTUVg@+yt3=G~7Qqt${(Zu zU40ql(5$gM`OT)6$}3`n_J<$r?>&5Lp}E)7Hu%}wo0DYbzPJAaYc1xgAH}@ItoH*8 zZ!#Zc@?V1KhE#MqZ}KWoL5#&jIH8zjG51}bG}ajy1vP`*J$ zpDLN1M`z8$%hI~^WJ%qDKRQu72(&7J?WC!DVshcWr+}a=F;BiC)BCb0H`vz%loX9e zXyPW7qN+=-ba4h>p(lFKz66dB+WKqpCz-6TndZc5;Gaiel)!y9R)N4qGQZcK?YPEF*HXbm}UuEcSYIFFT ztzNDsg+$P2AL-n6x@mpeE#zt%-P*FIVe-d1tL?)4nqGb9+_(##hplVO`a<95%`I3$ z?wN6Il3iwGd)Z%BQVE=Dc)|fcEkda#!PcEnTf=DgkGy%(_hoq7%_wbp~($Bf z0Mp;sdotIFGaYF^RC=YPNq8rUl&5sxR(J}Q#zap9M4IGR;agZJGjC;I=)5)Q-G|^w z`*_IZ>@a2AcEPIO(YK{fr)y5e(Sga=*?i6Y&gSH3uO{Jd@?Q4jS*E%V98txbUXoaA zby@veg8DoCYO~cG|NLsZUUpa!#EC=^bOl zzG~p2KI{u>3Jr~Xf0rQiHx`yH9}k8#D@IpZR`eLMf$U_KpUiH_ayMk}&c2xC^;y=K zo%FL4ewOirjef=y8?wiAIJ4A6QFwbr$ps4w)jWJ^@x+p4SLP!4Aqnok!co#rsY--p zndPm@&66K3R%G^{G8Y2t&jyIZ8YAJX*Wy`51$JYkBCzktX9%jk7Lr<6-=iP=MMY4> zUWG(M5Zqe!Sw==mIo)=l1PLTc~E2dUV zX`0{XIm&YsQ+UpI#pmG8F(E%^^JeKe^cBycuXql56`!+tb2cl^rxYq}w2qweIk2jU zX8j|NdUU$K`sQnS8F%&JzBp}=MciS>xX;tv7!oMsH!?)Wfh8pmO3jTd=(W+m8ZOwVH*=z>UVnwMaAjoOc6xLNcx0$ zG(`iX9aKo6wjs&2=H<1YYbq@;$De;#c?wlo6O3q|XUDGSeem$A*+a$?e`IS}N6+V1 zpI-j&58r$6#*yZ>fu?lwlHX(h3) zl}~_g0pwDrfs~hF&K3F;<|JCR>U5cgw92f?IkKvxB4}33l%V@GNXoS_Huq%77Bd8) z_{d#^AtpD&)EHtl=qFo4ZXz^eoFv+jv|=$zA>T);P9d-mi9F;iu_1C#`9nAufszAq zikMH{T4bwv#cuJM)260o_Da^$asTm;mmmMaP331cga_|58aM1|4Olsy$ex+g%76Rl z-B)~yz0-U~%wgbaHr>>A@i+Dfg~T`*F|egQvcP~FkA2lw%?;HCa3fvmt9y|!wMXyHHp6aM?4`;La27i947FAv*QhR`7NMd8=*cw7Iy6Lf zHmqRsDw>2tL#PsijXpwfTSf-_8F4G0WK};w>Afh@V?PCY1%fak`jJ47`jM!qg~k>& zgkIBWO<5#mQ{5&LlWcy~27-aX{<}o&9_9&=8ugx#(NQl7rPkT$r?A@HTe{oz61rrC z8uZKBg=4C<%1wyjkzP9_62Dz22Hfs83!i9;#S)ge36pq^KS zqITDzS$n9yE#0VUe79<$yM*4%Aq&;Ig-U^BB|rp7;=J9CfW=|}!;V0Ooso2kbc`)3 z6v4Ll?fu^{P2TUh^Ckevo z<=@_RJNuD)Mv5H+dds%-NV9I`FuVCEyS#sR(y(o+H>W9oJazOK+l1Y8bPG$YETU7M z`)WP+%89XlNv9}&30_5zvyfvNnLINgqEZu zi~Z27C8W?ymPoZF)fuwhAlKD*X$*@(L7MC~7h2JW6HGxz&Q=?un06cCN|CBs)MgO< zT8tEV-m3Uz`498ID9;#;_o@5(yW9VM6i8`kZE{`_*|wPj=Z6aO-o&OXjQ zd+QnGo;cCoH}bz>7W9X-r?5kRB<@hymTwcpHtgzNrgy*|BKx~9+Sl!h$@`nQAmtl9 zWDMVZN!r~{u_o!e1ZUbp;pU2oViU6@gdu%biB-aPe=L3X+m-M3>UsxI(@CD2?(1ek zOP&ioaP9mm#SFg{QcXI5lH0_ELVtUGoOk4{&CR{}NVkgbsn-ZuU!N);iL?fpJnA$Y zd6y}OTS72a+pg2K>RZ`5m8lgzJJVTAYN~`jd{pM;7GhXn>CkM)nMvF=^qMb5D@5}b zrzXATQ(sk_da7`LpjQMq@u=%A9DvJ8j8T$%oC+1%w1XTe&oQ$~?%wC$zN;4{Qlr5@ z?AFgrU-sapU8j8$ZIPSGb9rsW(~ct+3M0 zI;AJCVpde#n-!lHG7F{DB(X0A+EPF}Kvj^!Yn4g?pNP?T*+u!W&9_XC99t8aTGnv! zRWqMBYvpy9V8@RA?d|egY~~omS`|2_ckPoGjEwjB4dd%Rv`%HnG`VutAyaq8!EZgW zRko%0eVAVq8n20Z^UfB!(iU{(amQjg)W+3W)Gd)>O^Y#YG9~NKt4Ed8Cm{-sBxE25 zIq~O$R>xVjL53Js#AuLilf-#Trb#=@iQ+)ss=gD676V;!$#Npj-6fI%BTMuIHA6AN z;3BL*f;Ybj3$C|3^_toIqpPD+%Y1?8b@#8k?7{TN@R}zq<@q&3N6uSz$nF`OdfdFd zwst#KI-lFW)?q`SWK+wHdpq}RY>(ni_WK=UU7fdi-PxV&6JQB;INdFZZ(^tYT-<5Q zX69Go8N3wDo1Ve_{lGN9&Kpz?qH&nK^Te=&v~T&BD7F8PsCht*dhx_43r=*3zCgWh z4GkiAB|7E2IS0t7lfXH}I}pE*(tBB=XOl;_6oP<`uC>+SAfs#7wzpW^?;4$mx}*3l zVj}e-HGVy-5Uru5usC#dZEXM=0yWf9zcJTQl<{_ClS3RG_c!H5pr;q1>;tMC+=#wz*M;8IlKwwIEf+ z$|1#Npr)XsJH!q#H_K7KK17dc9F4q+akRcZWSY`+$IklBUOpi5@1$5Fjn4f|d2VIS zhZcT@ULg|xy9kE`p`&nE6j#2v8MCHTG4JQ*vQ6^5s|iah-ASWn z=tr!tWqf2D-Tg*bGY>2HNufb!7#$gzYHVylFTlp$#)(GW$Tte;fMsknHfnvLaL{Sf z+9pfd7ztX7R|wo8u=R6Q;hn{Q5)-m=K_&kr2{HITGGW9BHw*)q2gE;IkeURd{ZLiV zTdc~&4MPnTfl5yFHzs%1den8sT8NLTNRnXI9FM8*F8}y*U;o}VCL6R$pdi6?C7 zTv=D6-gwY-;*COaMc(eow)1bJ=u#ZB4__Owws9ZVwym%Mna(%4u2) z!WG+>PlVDJZ;ra(;S{W~t5|+*{?p~xisiSt>shTW>UFf{0`2u$lQ(SApl`2MZK*Z2 zH^&@CWz4vV_*w1p^2XQiWWD#7Kl=uo!CB(XX7+u%q#p0cd`R`d%lq90(}@4UGh?6s>E?SL zP~7=WqH>l1g`*M^YGrl^ohe6NZHk&&TZ+vNbsN`S+m^D;lv2Q$oGRr_1rzE%#g>vl zF)^7m?$Dn4f}#MMnwFW1j!B#wi)p@aRgyzAkpEEQ!gHd_2E__?GcFb4p$Yd6!84FnU&{R|7SYv~f3taQt1yi6j7G(P zNyGN9HX4`pa~~`J_l>g4`?T-hec~+cALTplI-4EmYS@qT4K3H#*h4^rwWC?QKbl^RVHCLl`*v6HKgu5| z|M2JG{jDR)e|wvQM568nBOx7wpsc+r2{t5-XKqT>+!$x(-Z z?r#nUqt%6!MjL<*Y*hhCB7h_V2)^>Ak|)*LS1TkDM?$5tqrU#UJ?@yL8?i+-?yII- zX2uUZycYv*`3cv=8hZ7Zy z*O(1y)OlA^Bxz(2Tw{{Sn9rZ~r&pK!F%dq%2PFz#BT0dD;}FaM*jp7zQimc?!Kx^tEjA_6zV5p=(m{F$ z-frKq+Vz9-Q?bqLqia4MIL;cf!%y7lW4X_kzghmbOyIxX{Pq=&@m=+YcXu4U{@Pn9eg@(k+dj%hz&>SW&UKamp;}NrceJU4&jn;L1~}sHc<6)ofN9 zjVsTLCns)Q-*w?ww&SAm?>9E?u?2K@Cec=)n!F}xQYkUQ3WN87xrT&{aUue@ zN!Bv^J!ja7_C>`Q{Xf{sP*O26dQLe`_w*SQUT zeK3uEJ0b z1DXa~D3MAzBSxb$q*H5fKxvw|d_zc|z+Ow}A{Nx`SmK&Mz@t`%LN<5>LjKV8A>P7= z1b=umMEuF2kdD!L)|7Mv)&TVgcy#J3?4jii zft7+`^Eo@&l|zSyvS(ad{@r@xk$TrT$2NT{cD(87@>^HuZl3U;)|h60+OeZ$bLZ*9 zQ?JZE{ke|S)3=}B$xpxYyERlp0bMS~KaD-zBzaaY5(XP>ojNa0pJFl98|cy5>T85p zpAjHGb?vc0IFSfLWhY|#3^?h`OqU$abM&!Bo24FGzOFu|DXcDOq!K4;-+>{xQj=RW z9PuK@h%vq7Ad;*AQGJQ|1!`<}>TGO9+Bx(%VN)wq92F=&4x><|E*8ylB_s5wnY+4i zpsn7urRlC`-79Ta`%Q@yyJk%7b)DXy+4B**edU*oarLmI@w1G*fonba zdh67k^4RBt>p4goN~eyn1D1_9UEQ(%+L)piI)gRu{N}p5U*BINlyzQb=~CTg z#}q$#yBQ~*n04HbXpU?j4GFPmoyMDX*=*j%EKp$7`KGkZi#vtJ8#4x{N@#9+av>N! zo5cisX)D3kBqdq=E45x`x!CLIw+7y?ysK$gtnWH<{9mZ*QVrwAB~=+!^!_p-S*KH`L=t%{~AeXc>JDcfAOVd$?{{Kh-U0>m)Y&ZUmSecZ=63k z|0VX-M<(t$bJ3^^uN<&{Htp=s>CJ%aFdMg-d)OCGJbFI#{nisJmQIIVF)krYwD1fry zK>j{3qxGXBqod-e`q}>e>LH1K7xYrcm{eJ5OrXTHF;|K{FzP3vbp-%D1*N_|j09uC z{9c-CZ?7Jfi03^&H`L8a<-V0uUB!%u>xg@qn8nzNc|HKx1)nDB z3Z+uvT&~sCqA9d-MT54zBNPZH4I1-klHk$&Ss2%vM-@4?kb`+{&;&HRCZ4x5c7r`& z=QYZ_eY$jJ{-XRfc|LD2+DA9%+0OiUp5yg-e?FHdzmaEj=6%&iqIA#Qym4b1mI5?B z2_tPZ;!he@JJi1neIlKQB-Vz_UMPsye6@JvMa%G3c+Gj@F(Kh4GtNP({#9_iL+PXA ze2{f0?KSBuFYDg;>$AsOa;}D%mmfQwk7R6DMWU^|ZbF#N*FW*OhBfPMoST@xl)JtB z0h?#{?jsYspA?k&sjR=#-ucz99H?1YTEj-KweEC&U|%j>{`p65-th%za3>#nYWl20 zyAcp6|M=~n;hZG7f@IYy8a~gg5RxXP+vQ3$W)sSMj;*a}3KSBI!=$jWHb+QZcP{G< zg^)=XlCEL6vXDTuRHa|Bo5Yi^K&u3~c$m70#CTfKgkmYNFhVk-aB1OCuc6X#!Tst# zJ~_zV@ze2CzjsE^lJl)i0!{ z3oFAb%a7dOck|?5*cmo1)l|GjEUe9|F8l)Osj@k*Z*|FAUr*$!)?glG>J9Z=y#hbKE`(uA)z_L#@yU|G zP;VV|8%!n#~(-IMSYAA?y6)_qrm1i^oDPWX*X)rJ&L?}cL z0q#Grrql>Agd|5B5(0VdhWU3q%W5`0ci(r}KVPXeU3vTZeYfsB<5Q=NURkbTJG*99 z&u%*}aYVb9-FS3sq3OuQ{j0lItvKiSu8;ot=JN0F9lm<)7CwFMa9?Nh;Y&}PsrU?$ z2kMDMeR#a$E1D1*G<<_K@AU@tk%*OVZYio-+w!pOG3!XoiHNH+!suXGtB%ex^1(x^IrR@Jvzi0&$E7`{M?19)y?q@*M1>)!zJ@0oPPfG?>sCf_uc-<4<6d>?%O?u zLhn1vCq4*ixa}|3D++y^lBw$d#uHbPx}v*DU6JDUQ`Qxo`~G!BF~CY~fxS7bVHSFPI`ZQP_$DYjf- zlIx1T^;h=Bi0#q&@@I;C`Rxj}B+$4t8ok{U zFgr#)j(XFm$AHU$M`2g2D=~JKXwOOe7W+B&KilCzu@j&#yIyZ7p1@sUCK8YctB0!}E3JvjOK&&Cvar4WZp+3~93k^5*DW}h!QKqx2 z&g{x34QB-vS*^xg2shNPv!=7_Tu#Gy-@bg<75-+qSBe2rJW3H`$;Ctkv$>|m;d1H# z(&E-Hxz)&Sl`79dY)LXC$%8x@PIATpad{Vbq!gp$#i|uWf_%j@+g z;x)=-G=(A`rS^yt*G)Ok8ruRMtCN%@Nj)Z+Ine0{G-2==RISba{aeH@c?@a`9x-~IpZ_8c?U0AVLb7{y&oD_`S}NrZmk(~UU+P9 zdDIjQwFLB6HD!pyfIDYCCVIFDP5?#GB0f0y0D;z8Q{&XRT}m(Ku_*OR;-l3!z6uA4 zhN2!R0=o$9L>YK1Ya6w;5I|11!#J|K{Np!CerPf@eLV%>?7Cpz?%c>#g&vWK)YndG z$RyOe0J7CRE<-K!Z@}+U25liO=wfsi16TzfNr!agkepaLqDtCAWlZnl8gZ{6$Cbop z$Mf|A^7}_~jw%?LTk8@Vu=@`-6r(d(&jB2QscaSDe3&BA&ty0Zu?A zm%dqW>(Nw#Q~HAeWvDi64b=b&1{oH0<`{D^qACUXE>JZzl9EXrM&r>hjEzK0oo(#*4W$F>1~Re>8|)Kiu`F3Yj`LyXqrW+c`W#n#4)Of|wO4K>s$Q2iz6cffA~vD@(aVSZ2nx>?4z0R+%eKZew_S{qi*Zu^a_m1bM&804gkH<#tU-Sw!4+DX zty*|Vim_II!kSCu8iFQ6J`Wg0V(UGae28=RxzE-dQKF&~Ta`Ehq?5b) z^oB;Gr*{=6WOP@0ded!OeT0h{11EEbuV#qq&iQ*!FF)}O`6z$tvoW9&74P5Pvc3C) z3okYPM%lc~)^S(ksxxmm%1uWzm9sn?-fw`%x2tATWnai5gYfmNFPumkbP3F>rAD!N9@KuM0sKIE+)N zgsT%O+B#a#DV4Pr3%t3OSgmKORC|pmE0ima+`Fus%8i&F{KT_yl074dNQ7UsYe+2N z!&+0%N0zTY_tu@e@7XeXxct4h&E}Wcru%zVt(x5qlP223YFDpl>AG^~NB?|V`Sni> zU%g@k;?csjo;xgb!JJ`D@7#~wp;$Ou(ZzDgGZ5t1@&W!!4s z7aM7g1w6slfL34IFq)1u8^gsID&-v+dnTUpDW+_0W58BuRxA4oLj`Zbsh_T?YqSOH zce11se&IHH^LbsqD{=<-CoVy^EfQT`S`I`z*tNIgmPkJ9C7B7m;|94$f_#}GsQEvl zR{oFVn=EJ8u@}9u@THUbmD6Thm44-I+O|RY*0@;rN-$^7Kq$3QalFd^A7xsE0Hbx( zIf72J6R=o*0*!UH@~D#YD|57~jHjyOyg{wZ+eK~=-B&F)zqCi z%V`JzDPAQI#tN*SgdQP*F2?Qb$Ku(3Pd3Zu@{vBDYv6!^kF}+mBdKD4U$8l1U*-c| zoRS$Y&+wn8$fE|yD#!?4oytfdAnoQeW>t0(cT@%RM}k92a8>D$i9x&wpeTbs%BYXF zsF^!hK_ZO-47D&F>Yo34WM)lM=a_@FDi$$GyH_qN?{~r!VvRmPS zM*1fEn91YIg%Tr)>DHjl9O-Pg>PFYt71y%?e|_i1oi6RnJJ*l(z}HWARccRx3f3{7RP9v)9cJQd85K<&=^LY zJ`3>bQ1aVrnXp`Mxy$mPWx=A-Tl|)sx_)$VB`!xPjoO;oRYHbhZ>0YHg!o zAowI_O9`RYKdMjo6ZkX{2n3N-6EFk<0lt@0&->>g^{Ws zbt!BLoEwy4o%4Z9KD*sfD%qubBUsRsOOtd&uoY|&uaHYw28Kwpw!b%H)ckii<5`E) z51CHMj}-;wI|jWg7whQ!`zO**eZHhakMGeEHauLTRB@F!}a@cBth4Wsr^<9NesnbMsaer8u zOg1&UOg>eLbGgl~<-6+jI%68Xh_O=(+=uLZ#A2!|<_#9D+ZzcqCvw($-fCc7nd?km zy~<})=*m_O**Oc}sjNj7-d|EF@iAdrtTmNt-B8N7@rUp{ld*Y2sZf4HDMZ#Kq)+)% zxfE6)MOGm7e_{n*A}av*3?j=R<@m*xnHP@5tb&iVZza6AIj-feuJXEY^MDDPs-0dK!mkPImP>h z(L^8~3YSWuKp>VOmm=)yJlWNGva9p%j2p**ezv3%oIYTTG8VGIHO^5+pYdmM8SLf^ z4mBJ{;%@#SIP)}BWz>FtxAFs%sQ-_e&J|HZ!S(xY>`XA6a(fzbW}mgzp0e2cPr1WK zXO%ZK`l5xVcqqLB6?%qY-`Iz zU54{-IV7C~it9Z34voe@4+48UI+-!_;~;Q*%P$)O`gFM6B^?B5_PY58iI2RodEn*<{{Tj^<<;N3znGD?qFtquw>7z{uw5-yROR8Vg;XsWn0q2ElnWY7on5S;%{ zoDzi$e}jWKFW-ktcIo7JFYW|5r0lf%Qb=Y zT-WukyIj1EcZCIY{rZwZZBa+myjmTO3$>U*=-JM@RT%|u(z*l2K%1#qJ<^UYI^y2(w*4PDuW%#w6(tAisWn_b%Vvj zr;(smYvp+t?^|uLo7@u$rE5fSWmo|xO`YD7j*Y?N7q?~nxrv^kut^cHbBVzgp))h= z4@a^Mi3XL!QSiBXJzY6{jk(oe41LX= z+M>0rFDX4(3a7ytaPm$)j1VVJ5e79pBj}*UwAw;Cu~@cm zu$QTIXXjaSsFN_V$t^O{>gLiaPpa0&s~o)hOxE-5OI4fy!rDLg3DxFVL2++y7v)zb z1AYYzlwXB5eT^rpH-yUf)wzAEk^}A+a3vTk4!FNV@yZwO0|IG-@@G|iyHcnX`9>y> zq^l=|Q7|K#kr<=Zk7k;Lro#GC6Jb(QN=T*Gmr{D+J=iQVnb8`w=yjdLp}A3FjmWwx z1`-2UWas~aYcjXwSD>}m20N1p$0FAtekyMgTvOY5e{>1g4z(*D7dmr;K2ge)ep8dz zCAgc~>TCRIy(xU%NlYsba)?_i7QTqSTn)-|Dc4A5%%qT$c!q;8nogxlGDj3nRuVc` z#m-S6n!)qNGGN71WM41k1u^aZcXOxOANSeXV0%iGltw$?jVu@J?BJKnuySFzAzNb zMzZTmb{2nnzmfpOsRLS=Us}B|qBp~GP?%j*r@1h97wd{t zbQ+l}G5IB(wy4V_IiSZMa`bI>^?7%Ma4&5o3M(RU&%4PAg*B;ATGlAOrb#%t`sP66itZtgQxR}*Egc?jMSx;i zrIV;B!QInPU*pXfOrcxcP*Yhi)YMAuaw0ju;$COB19ei)A>JblsJu}BE>>l5xeO}4 zmSNw4fKY~s!U9EATWeiks;L!p_R-o}R0qS_B6svyT1YpPN@-djPZ&w12ZsRZ07p#= zh}gz+B_WgCA^%hn;kcw?g}x#tlfE;NveUg}cdIC8AXl|Ej(76DZCv(@SF}&(U5dHL zh#^aNQ97Pg+T2w4K(N&2HVD>VAz1m5bv-wuYKvt)vv7hxruYhOl|w>UWvbJK7>C!P zGbzH65Ij0=vgJx{tCgQBS$SO@obWVF8e4-}NV)bUnHHE-3_b^9MEf|jPm9Zv0zVH5 zDliijvNHXbjfP_TS9b(fI#*w`{Hz0=mt?bN?^gEocW1c|-tc7HwdS{w@?7eCh3wRSJV;pV}>hkgx>nx;{HRLhufh4t&)27}VeE8SBhU_gWX z2<#y!C5DGlBSRA7A*XaqCW7IM@i6G}Mh;e<`&(z@_OGt|Qm9t-EE_5mlKJw>*Nukn z+xW@mr&gAvXj{ zc2HV7b^s|=Y!x7um?1k%EHQJrMv+2QKYF0AuktH^L;Np6)6xQmI7n93em=i zw=ZH>GI5q-S7JufeC+L?F#7~O>8Og{xmc)id7*UU<1!%VKSj3`3>4myP#M+^cU8bc zr8!l?2$+!g79{Xbw~M`5q?b(jYZwSd8NPC&2@LnspQ}-VQrNYzQT4ow(Wcc zJrjs;K+h!HVi|DjEcA=QQwIkLw+1WRLO+K(F#&QZz9teckN0A7;@1eQW= zo??}r$Y#M*`e75()U?RS#pRW<{K2~upeiDdUi`aS8F^H!m&6vK z^^%n4A}D99_}<8)6rob7g!EHXPDnq4SX}!YM1;0_r>MMRBswxiqa$Nu;_@#e%}JIG zRRi!*K1<^S0^iG^`J}j`*q@-+Jw^Hzu}n$CrIXO?q%=D_v8^DI!1(*_T-OrJylR?2 z;UhG^A<_JqOmldc7{Y|+Frhh2X$}vIG$FXp&5iU|K2g)7sb3XbLC2T=Io{HjX)pl_%hjWOP8HS2Pya<`3y)WuT-HA zE)pd>2GPL_lq=+!gXS&FKO~x`j5uQAgeIi+)hYzSYMSEADZZbG#d;W64FAIb)s+^> zE?-VjU6(J%QqwnvO~cFNm8Kh;?w<-a!;6aNDl}Q_^CF%i9UcBF04#4549m zK*O{NdcvA~o@ki7tYNhIyrhp&VDrLUL#W0hYWXER8!k^*QB<)9FIdEfJ*g)}Z6X1J zbi#lOd~PnbNO6%Q?Mg#vD))+`gdBnA8# z*3k!x-zz?{@QzSh>@i8d`mT|PdhsMhEv_sb8{)BlP_CCb$X>i~g5AY*(cPgSYKG)% zi{;s5OwG;mnDE~3aa5wdUwQ)3V&p_vq&iuldI@tHD=@teQ#n&CRb#daUGdW*TP!Y8 zt>Pq=L=n3YQFMyksNx)b7SZa;Kv&bjl2v+D*d!Tmzj5#i!$)Xa)yufQs9*833f)U^&-)G}kM1K}WF;XXuL704ViAPJPaD{VhDEYfYd|eXiu9=< zXDD#|z_$a6CMHbyrr3qfr~AK5EGac?(&q*3rmZ?Nk(Je}$>V_TM_+-4M_+>(`YPxN zy5H*6==)B;y5*6D{}l9FHs}Y*SJ$+ynU=BsDtwepEcp%07l_tC{Uf6S>K_>u>k&uA zb_3aZtze+Er>4kiPRXkooti@KKb|tc3=E(V8U3A!(TQ=O{^8xBWkY>3{-69P`nqHV z36}Ob^vS>hq)(Rk!4j1GOQa`n+(@3hQGT*^<3=&>Vq!vK4SfY`=qp%5UPabSO!V}K zLz{&eCg^9^0xS^2o3c%h1HGLVTDx@P_{g3T(f7*^_tqG91_rc2U7+qU6J zU&LWUWLURt3zke&Kx z$Df*!d9swW%m*2P5-W9>AW&BLae;IK9X?#mkHZJS54tTjY#=LzMI^6+foSUu8z8je z`ExcYT{WJ)AKaq9y%eKTW}B>jC_LmMvuFTPic( zvPA~lKQ*c)govVAhRFV+sFos~P0KfJ1^ekRS4>tzTviWLUh0ah6Ag?thpf+tYeP85 zN*ttXbgewnJ$uMV_f$r@XAjnhKJV1Hm>4O=#WawSQd~@Nq`R@8f^qj*SW)`zlBXId z^Pi1YM$W`&U!eDrixe*d83uhTsJOtw!XU@wK^n)#R4P%BMw}z#S_#CjTCGx>x4e;{ zN`j_{t}70upWLbJC* zv$t0sXSdMZ=adlrP8z3#VEE_C+z%_v%pZxRO6NW^L#@l182}g3H=u2PKR2;ThAyPk z#H~)o2b=r}1)(L*`7nE=iWc#Pz)}?i8CV9uKhMu~^dJXBTA_;C5NQFs@Gq6Q5?X(% zj0>&U!D(bf*LA7%S1G`hT91aFPf=*jl<%ZO|5qOk;Z?J#?H6^#)uAR!y1apcEV$jEC; zXoz@HN;CK(;z=E5+JGl3-%+NgDPN|iVGz>6EU#TYDFaDWEtWJR{v}FD#F9F^@CGQ! z-7vbkD5b70KuFO&1q)z)uGk@iNL3LNSBu|AX^A*ehZp`-HL8&jN^4{U@KJPBeTKdv z89=Iv5JtsZgB~)U<1fc;zMk&IgZxpk;{^R8Mg_&%C7+J9U0txU=qC`SH>*&jC{=0s z=+2oYImMu=2UXlsHqf3g^qYIMjtoqm$7UxbmWCMfRjX_CPXiUdyy6rGC{PqGD# z#UhZdD8*)e5liYMisH-_5_%SN<^h79g;Pi5z`2s0IXp}_Ff4OGJ3K7fnM(n-^yJi` z09({J9Rza(&7c5`EtrHS0dC1cE-CPe9+zghh`>e0L=dsBWkN}YX(vkehnsTHC)#}8O7HwvzZ|h$`qd%5+VQjbOF-QPxxq{dJNpPN*)C)+7H> zMHS)-s>KRbDy|~cW_308*GW_*1hnh02Sfz41MF7j0kN)ksSAes^xNBke+K4sc6WBl zK4{s_Av<5hQ~O1Q+F`a6y<_E*sN(04LDb;qcxG;3K&Di!Mil6zc1z8@imRo5u|3Qe zgwsOS_AI2Y+tX!Ls(YJ-Vt%qzj73rAq>r**Wwh2a7S$WZqP6<5Xf(+t>(QbQFL*nN zx085VpY$hlNrVZL$#$0um4vSS+1mEnnNqs|UooxG)}j2YofX)c$r4KgEMka@L=7uQ z9VB#^Mn$d|8^S-y8z`}=AjzOy1*N!%!VtuPU;qV62p1vQo8%z%a5N-S&x!qLL_lp| zzDh_8@wkG(aB<64{pAb&EdM&2Wsh<%{my^Q`NzutS$_4Fs}8OF_^`JlHnVKA=UF>%ZF7x-L`bE1(Wn>_BM zzJBPEb#VYV9x|>{rL&5w-|3(=3po2#UjWBtOsczuoqkiQrY7I$$eC0Ht|_Dkr$gX$ z2rLbOr6I61gnHZ0acNyghTyd5K)j`?G`7&wh)5)BPCGo{{!iH6M$Jkwxk;B