diff --git a/DEPS b/DEPS index eea5c3c445ff6..bfa262dfa677d 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '7ed0eae0cd13d3d687f7855b0620a0faad2ab5b3', + 'skia_revision': '1d6281d4bb47510754f2c821482ee120c91bd438', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the @@ -31,11 +31,11 @@ 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': '760a9690c22ec3f3d163173737f9949f97e6e02a', + 'dart_revision': '4eb879133a06c86869dc54cecf904f4b1d46c47b', 'dart_args_tag': '1.4.4', 'dart_async_tag': '2.0.8', - 'dart_bazel_worker_tag': '0.1.11', + 'dart_bazel_worker_tag': '0.1.14', 'dart_boolean_selector_tag': '1.0.4', 'dart_boringssl_gen_rev': 'fc47eaa1a245d858bae462cd64d4155605b850ea', 'dart_boringssl_rev': '189270cd190267f5bd60cfe8f8ce7a61d07ba6f4', @@ -58,7 +58,7 @@ vars = { 'dart_http_throttle_tag': '1.0.2', 'dart_intl_tag': '0.15.6', 'dart_json_rpc_2_tag': '2.0.9', - 'dart_linter_tag': '0.1.60', + 'dart_linter_tag': '0.1.62', 'dart_logging_tag': '0.11.3+2', 'dart_markdown_tag': '2.0.2', 'dart_matcher_tag': '0.12.3', @@ -102,7 +102,7 @@ vars = { # Build bot tooling for iOS 'ios_tools_revision': '69b7c1b160e7107a6a98d948363772dc9caea46f', - 'buildtools_revision': 'ae85410691b10aa2469695c2421b1fe751843e64', + 'buildtools_revision': 'c1408453246f0475547b6fe634c2f3dad71c6457', } # Only these hosts are allowed for dependencies in this DEPS file. @@ -115,7 +115,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '4fd7a2738de8fc8f9b498437cde96c1bf7562a04', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '7141218c62890635ce966e2530b465ea4c55c3e2', # Fuchsia compatibility # @@ -124,7 +124,7 @@ deps = { # and not have to specific specific hashes. 'src/third_party/tonic': - Var('fuchsia_git') + '/tonic' + '@' + '90c9c81f49461d9f4d414845a6eeba1c0df35bb4', + Var('fuchsia_git') + '/tonic' + '@' + 'd91fa62844f8531a3701450f6192298d0e873246', 'src/third_party/benchmark': Var('fuchsia_git') + '/third_party/benchmark' + '@' + '296537bc48d380adf21567c5d736ab79f5363d22', @@ -351,7 +351,7 @@ deps = { Var('chromium_git') + '/external/colorama.git' + '@' + '799604a1041e9b3bc5d2789ecbd7e8db2e18e6b8', 'src/third_party/freetype2': - Var('fuchsia_git') + '/third_party/freetype2' + '@' + '3515a77bb83002b69a2957efdbcb764de4de07da', + Var('fuchsia_git') + '/third_party/freetype2' + '@' + '6581fd3e9c8645f01c0d51e4f53893f5391f2bf3', 'src/third_party/root_certificates': Var('dart_git') + '/root_certificates.git' + '@' + Var('dart_root_certificates_rev'), diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 67ad0c9916366..a7ab486700a9b 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -251,10 +251,6 @@ FILE: ../../../flutter/assets/asset_manager.h FILE: ../../../flutter/assets/asset_resolver.h FILE: ../../../flutter/common/task_runners.cc FILE: ../../../flutter/common/task_runners.h -FILE: ../../../flutter/flow/layers/default_layer_builder.cc -FILE: ../../../flutter/flow/layers/default_layer_builder.h -FILE: ../../../flutter/flow/layers/layer_builder.cc -FILE: ../../../flutter/flow/layers/layer_builder.h FILE: ../../../flutter/flow/skia_gpu_object.cc FILE: ../../../flutter/flow/skia_gpu_object.h FILE: ../../../flutter/runtime/dart_isolate.cc @@ -486,6 +482,7 @@ LIBRARY: engine ORIGIN: ../../../flutter/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart + ../../../LICENSE TYPE: LicenseType.bsd FILE: ../../../flutter/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart +FILE: ../../../flutter/fml/paths_unittests.cc FILE: ../../../flutter/lib/ui/isolate_name_server.dart FILE: ../../../flutter/lib/ui/painting/image_encoding.cc FILE: ../../../flutter/lib/ui/painting/image_encoding.h @@ -623,6 +620,12 @@ FILE: ../../../flutter/shell/platform/android/platform_message_response_android. FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate_Internal.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.h FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/platform_message_response_darwin.mm +FILE: ../../../flutter/shell/platform/embedder/embedder_surface.cc +FILE: ../../../flutter/shell/platform/embedder/embedder_surface.h +FILE: ../../../flutter/shell/platform/embedder/embedder_surface_gl.cc +FILE: ../../../flutter/shell/platform/embedder/embedder_surface_gl.h +FILE: ../../../flutter/shell/platform/embedder/embedder_surface_software.cc +FILE: ../../../flutter/shell/platform/embedder/embedder_surface_software.h FILE: ../../../flutter/shell/version/version.cc FILE: ../../../flutter/shell/version/version.h ---------------------------------------------------------------------------------------------------- @@ -829,8 +832,6 @@ 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/picture_serializer.cc -FILE: ../../../flutter/shell/common/picture_serializer.h FILE: ../../../flutter/shell/common/platform_view.cc FILE: ../../../flutter/shell/common/platform_view.h FILE: ../../../flutter/shell/common/rasterizer.cc diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index bbc0bfafcfc1e..fc97101dde107 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 55fe586ba44fb4ac9fcec9857ce134ab +Signature: e92b7f75b17722f80e97fdfa2944220f UNUSED LICENSES: @@ -768,11 +768,12 @@ FILE: ../../../third_party/skia/experimental/svg/model/SkSVGTypes.h FILE: ../../../third_party/skia/experimental/svg/model/SkSVGValue.cpp FILE: ../../../third_party/skia/experimental/svg/model/SkSVGValue.h FILE: ../../../third_party/skia/experimental/xps_to_png/xps_to_png.cs +FILE: ../../../third_party/skia/fuzz/Fuzz.cpp FILE: ../../../third_party/skia/fuzz/Fuzz.h FILE: ../../../third_party/skia/fuzz/FuzzGradients.cpp +FILE: ../../../third_party/skia/fuzz/FuzzMain.cpp FILE: ../../../third_party/skia/fuzz/FuzzParsePath.cpp FILE: ../../../third_party/skia/fuzz/FuzzPathop.cpp -FILE: ../../../third_party/skia/fuzz/fuzz.cpp FILE: ../../../third_party/skia/gm/OverStroke.cpp FILE: ../../../third_party/skia/gm/animatedGif.cpp FILE: ../../../third_party/skia/gm/animatedimageblurs.cpp @@ -904,6 +905,15 @@ FILE: ../../../third_party/skia/src/compute/hs/gen/networks_sorting.c FILE: ../../../third_party/skia/src/compute/hs/gen/target_cuda.c FILE: ../../../third_party/skia/src/compute/hs/gen/target_glsl.c FILE: ../../../third_party/skia/src/compute/hs/gen/target_opencl.c +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_amd_gcn_u32.c +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_config.h +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_modules.h +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_target.h +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_amd_gcn_u64.c +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_config.h +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_modules.h +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_target.h +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/hs_glsl_macros.h FILE: ../../../third_party/skia/src/compute/hs/vk/bench/main.c FILE: ../../../third_party/skia/src/compute/hs/vk/hs_glsl_macros.h FILE: ../../../third_party/skia/src/compute/hs/vk/hs_glsl_preamble.h @@ -959,8 +969,6 @@ FILE: ../../../third_party/skia/src/core/SkColorSpace.cpp FILE: ../../../third_party/skia/src/core/SkColorSpacePriv.h FILE: ../../../third_party/skia/src/core/SkColorSpaceXform.cpp FILE: ../../../third_party/skia/src/core/SkColorSpaceXformPriv.h -FILE: ../../../third_party/skia/src/core/SkColorSpace_XYZ.cpp -FILE: ../../../third_party/skia/src/core/SkColorSpace_XYZ.h FILE: ../../../third_party/skia/src/core/SkCpu.cpp FILE: ../../../third_party/skia/src/core/SkCpu.h FILE: ../../../third_party/skia/src/core/SkDeduper.h @@ -1312,11 +1320,13 @@ FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzRegionSetPath.cpp FILE: ../../../third_party/skia/gm/3dgm.cpp FILE: ../../../third_party/skia/gm/androidblendmodes.cpp FILE: ../../../third_party/skia/gm/clockwise.cpp +FILE: ../../../third_party/skia/gm/crbug_847759.cpp FILE: ../../../third_party/skia/gm/hugepath.cpp FILE: ../../../third_party/skia/gm/localmatrixshader.cpp FILE: ../../../third_party/skia/gm/makeRasterImage.cpp FILE: ../../../third_party/skia/gm/mandoline.cpp FILE: ../../../third_party/skia/gm/orientation.cpp +FILE: ../../../third_party/skia/gm/p3.cpp FILE: ../../../third_party/skia/gm/pathmeasure.cpp FILE: ../../../third_party/skia/gm/perspimages.cpp FILE: ../../../third_party/skia/gm/polygonoffset.cpp @@ -1325,6 +1335,7 @@ FILE: ../../../third_party/skia/gm/scaledemoji_rendering.cpp FILE: ../../../third_party/skia/gm/shadermaskfilter.cpp FILE: ../../../third_party/skia/gm/sharedcorners.cpp FILE: ../../../third_party/skia/gm/skinning.cpp +FILE: ../../../third_party/skia/gm/trickycubicstrokes.cpp FILE: ../../../third_party/skia/include/android/SkAnimatedImage.h FILE: ../../../third_party/skia/include/core/SkCanvasVirtualEnforcer.h FILE: ../../../third_party/skia/include/core/SkCoverageMode.h @@ -1379,6 +1390,7 @@ FILE: ../../../third_party/skia/modules/sksg/src/SkSGRoundEffect.cpp FILE: ../../../third_party/skia/modules/sksg/src/SkSGScene.cpp FILE: ../../../third_party/skia/modules/sksg/src/SkSGText.cpp FILE: ../../../third_party/skia/samplecode/SampleAnimatedImage.cpp +FILE: ../../../third_party/skia/samplecode/SampleCusp.cpp FILE: ../../../third_party/skia/samplecode/SampleFlutterAnimate.cpp FILE: ../../../third_party/skia/samplecode/SampleGlyphTransform.cpp FILE: ../../../third_party/skia/samplecode/SampleNima.cpp @@ -1468,15 +1480,16 @@ FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCPathCache.h FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCPerFlushResources.cpp FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCPerFlushResources.h FILE: ../../../third_party/skia/src/gpu/ccpr/GrCCSTLList.h +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/GrArithmeticFP.cpp -FILE: ../../../third_party/skia/src/gpu/effects/GrArithmeticFP.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrArithmeticFP.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 @@ -1486,19 +1499,12 @@ 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/GrDDLTextureStripAtlas.cpp -FILE: ../../../third_party/skia/src/gpu/effects/GrDDLTextureStripAtlas.h -FILE: ../../../third_party/skia/src/gpu/effects/GrDynamicTextureStripAtlas.cpp -FILE: ../../../third_party/skia/src/gpu/effects/GrDynamicTextureStripAtlas.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/GrOverdrawFragmentProcessor.cpp -FILE: ../../../third_party/skia/src/gpu/effects/GrOverdrawFragmentProcessor.fp -FILE: ../../../third_party/skia/src/gpu/effects/GrOverdrawFragmentProcessor.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 @@ -1516,6 +1522,37 @@ FILE: ../../../third_party/skia/src/gpu/effects/GrUnpremulInputFragmentProcessor FILE: ../../../third_party/skia/src/gpu/effects/GrYUVtoRGBEffect.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrYUVtoRGBEffect.fp FILE: ../../../third_party/skia/src/gpu/effects/GrYUVtoRGBEffect.h +FILE: ../../../third_party/skia/src/gpu/gradients/GrClampedGradientEffect.cpp +FILE: ../../../third_party/skia/src/gpu/gradients/GrClampedGradientEffect.fp +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/mtl/GrMtlBuffer.h FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlBuffer.mm FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlCopyManager.h @@ -1552,11 +1589,14 @@ FILE: ../../../third_party/skia/src/gpu/vk/GrVkImageLayout.h FILE: ../../../third_party/skia/src/gpu/vk/GrVkPipelineLayout.cpp FILE: ../../../third_party/skia/src/gpu/vk/GrVkPipelineLayout.h FILE: ../../../third_party/skia/src/gpu/vk/GrVkTypesPriv.cpp +FILE: ../../../third_party/skia/src/image/SkImage_Lazy.h FILE: ../../../third_party/skia/src/opts/SkOpts_hsw.cpp FILE: ../../../third_party/skia/src/opts/SkRasterPipeline_opts.h FILE: ../../../third_party/skia/src/pathops/SkPathOpsAsWinding.cpp FILE: ../../../third_party/skia/src/pdf/SkClusterator.cpp FILE: ../../../third_party/skia/src/pdf/SkClusterator.h +FILE: ../../../third_party/skia/src/sksl/SkSLCPPUniformCTypes.cpp +FILE: ../../../third_party/skia/src/sksl/SkSLCPPUniformCTypes.h FILE: ../../../third_party/skia/src/sksl/SkSLInterpreter.cpp FILE: ../../../third_party/skia/src/sksl/SkSLInterpreter.h FILE: ../../../third_party/skia/src/sksl/SkSLJIT.cpp @@ -1646,10 +1686,10 @@ LIBRARY: skia LIBRARY: vulkan ORIGIN: ../../../flutter/third_party/txt/LICENSE TYPE: LicenseType.apache -FILE: ../../../third_party/skia/experimental/pathkit/npm-asmjs/example.html -FILE: ../../../third_party/skia/experimental/pathkit/npm-asmjs/package.json -FILE: ../../../third_party/skia/experimental/pathkit/npm-wasm/example.html -FILE: ../../../third_party/skia/experimental/pathkit/npm-wasm/package.json +FILE: ../../../third_party/skia/modules/pathkit/npm-asmjs/example.html +FILE: ../../../third_party/skia/modules/pathkit/npm-asmjs/package.json +FILE: ../../../third_party/skia/modules/pathkit/npm-wasm/example.html +FILE: ../../../third_party/skia/modules/pathkit/npm-wasm/package.json FILE: ../../../third_party/skia/src/images/SkWebpEncoder.cpp FILE: ../../../third_party/skia/third_party/vulkan/vulkan/vk_platform.h FILE: ../../../third_party/skia/third_party/vulkan/vulkan/vulkan.h @@ -1963,11 +2003,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/experimental/pathkit/chaining.js -FILE: ../../../third_party/skia/experimental/pathkit/externs.js -FILE: ../../../third_party/skia/experimental/pathkit/helper.js -FILE: ../../../third_party/skia/experimental/pathkit/karma.conf.js -FILE: ../../../third_party/skia/experimental/pathkit/package.json 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 @@ -1984,10 +2019,10 @@ FILE: ../../../third_party/skia/infra/bots/assets/cmake_linux/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 -FILE: ../../../third_party/skia/infra/bots/assets/linux_vulkan_intel_driver_debug/VERSION -FILE: ../../../third_party/skia/infra/bots/assets/linux_vulkan_intel_driver_release/VERSION FILE: ../../../third_party/skia/infra/bots/assets/linux_vulkan_sdk/VERSION FILE: ../../../third_party/skia/infra/bots/assets/lottie-samples/VERSION +FILE: ../../../third_party/skia/infra/bots/assets/mesa_intel_driver_linux/VERSION +FILE: ../../../third_party/skia/infra/bots/assets/mesa_intel_driver_linux/mesa-driver-builder/Dockerfile FILE: ../../../third_party/skia/infra/bots/assets/mips64el_toolchain_linux/VERSION FILE: ../../../third_party/skia/infra/bots/assets/moltenvk/VERSION FILE: ../../../third_party/skia/infra/bots/assets/node/VERSION @@ -2064,7 +2099,7 @@ FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full.expected/cross_repo_trybot.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full.expected/flutter_trybot.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full.expected/parent_revision_trybot.json -FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full.expected/test.json +FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full.expected/trybot.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/ct/examples/full.expected/failed_gsutil.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/ct/examples/full.expected/test.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/doxygen/examples/full.expected/doxygen.json @@ -2180,7 +2215,6 @@ FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Debian9-Cl 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-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-AlphaR2-GPU-RadeonR9M470X-x86_64-Release-All-Vulkan.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-ANGLE.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Win10-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Release-All-ANGLE.json FILE: ../../../third_party/skia/infra/bots/recipes/perf.expected/Perf-Win10-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Release-All-Vulkan.json @@ -2232,16 +2266,15 @@ FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Ubuntu17-C FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Ubuntu17-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-Vulkan_Coverage.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Ubuntu17-GCC-Golo-GPU-QuadroP400-x86_64-Release-All-Valgrind_AbandonGpuContext_SK_CPU_LIMIT_SSE41.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Ubuntu17-GCC-Golo-GPU-QuadroP400-x86_64-Release-All-Valgrind_PreAbandonGpuContext_SK_CPU_LIMIT_SSE41.json -FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-AlphaR2-GPU-RadeonR9M470X-x86_64-Debug-All-ANGLE.json +FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-BonusConfigs.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-ReleaseAndAbandonGpuContext.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-NUC5i7RYH-CPU-AVX2-x86_64-Debug-All-NativeFonts_GDI.json -FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-NUC5i7RYH-GPU-IntelIris6100-x86_64-Debug-All-ANGLE.json +FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-NUC5i7RYH-GPU-IntelIris6100-x86_64-Release-All-ANGLE.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Debug-All-ANGLE.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Debug-All-Vulkan.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-NUCD34010WYKH-GPU-IntelHD4400-x86_64-Release-All-ANGLE.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-ShuttleA-GPU-GTX660-x86_64-Release-All-Vulkan.json FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-ShuttleC-GPU-GTX960-x86_64-Debug-All-ANGLE.json -FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-ZBOX-GPU-GTX1070-x86_64-Debug-All-Vulkan.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 @@ -2293,6 +2326,11 @@ FILE: ../../../third_party/skia/infra/pathkit/docker/karma-chrome-tests/Dockerfi 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/modules/pathkit/chaining.js +FILE: ../../../third_party/skia/modules/pathkit/externs.js +FILE: ../../../third_party/skia/modules/pathkit/helper.js +FILE: ../../../third_party/skia/modules/pathkit/karma.conf.js +FILE: ../../../third_party/skia/modules/pathkit/package.json FILE: ../../../third_party/skia/public.bzl FILE: ../../../third_party/skia/site/METADATA FILE: ../../../third_party/skia/site/dev/METADATA @@ -2369,6 +2407,8 @@ FILE: ../../../third_party/skia/src/compute/hs/cl/intel/gen8/u64/hs_kernels.bin. FILE: ../../../third_party/skia/src/compute/hs/cl/intel/gen8/u64/hs_kernels.pre.cl FILE: ../../../third_party/skia/src/compute/hs/cl/intel/gen8/u64/hs_kernels.src.len.xxd FILE: ../../../third_party/skia/src/compute/hs/cl/intel/gen8/u64/hs_kernels.src.xxd +FILE: ../../../third_party/skia/src/compute/hs/images/hs_amd_gcn_mkeys.svg +FILE: ../../../third_party/skia/src/compute/hs/images/hs_amd_gcn_msecs.svg FILE: ../../../third_party/skia/src/compute/hs/images/hs_flip_merge.svg FILE: ../../../third_party/skia/src/compute/hs/images/hs_intel_gen8_mkeys.svg FILE: ../../../third_party/skia/src/compute/hs/images/hs_intel_gen8_msecs.svg @@ -2377,6 +2417,72 @@ FILE: ../../../third_party/skia/src/compute/hs/images/hs_nvidia_sm35_u32_msecs.s FILE: ../../../third_party/skia/src/compute/hs/images/hs_nvidia_sm35_u64_mkeys.svg FILE: ../../../third_party/skia/src/compute/hs/images/hs_nvidia_sm35_u64_msecs.svg FILE: ../../../third_party/skia/src/compute/hs/images/hs_sorted_slab.svg +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bc_0.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bc_0.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bc_1.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bc_1.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bc_2.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bc_2.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bc_3.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bc_3.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bc_4.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bc_4.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bs_0.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bs_0.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bs_1.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bs_1.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bs_2.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bs_2.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bs_3.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bs_3.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bs_4.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_bs_4.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_fm_1_0.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_fm_1_0.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_fm_1_1.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_fm_1_1.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_fm_1_2.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_fm_1_2.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_fm_1_3.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_fm_1_3.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_fm_1_4.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_fm_1_4.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_hm_1.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_hm_1.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_transpose.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u32/hs_transpose.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bc_0.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bc_0.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bc_1.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bc_1.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bc_2.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bc_2.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bc_3.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bc_3.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bc_4.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bc_4.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bs_0.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bs_0.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bs_1.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bs_1.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bs_2.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bs_2.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bs_3.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bs_3.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bs_4.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_bs_4.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_fm_0_0.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_fm_0_0.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_fm_0_1.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_fm_0_1.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_fm_0_2.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_fm_0_2.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_fm_0_3.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_fm_0_3.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_hm_0.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_hm_0.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_transpose.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/amd/gcn/u64/hs_transpose.spv.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/intel/gen8/u32/hs_bc_0.len.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/intel/gen8/u32/hs_bc_0.spv.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/intel/gen8/u32/hs_bc_1.len.xxd @@ -2453,8 +2559,6 @@ FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_bc_3.len.x FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_bc_3.spv.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_bc_4.len.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_bc_4.spv.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_bc_5.len.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_bc_5.spv.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_bs_0.len.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_bs_0.spv.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_bs_1.len.xxd @@ -2465,22 +2569,16 @@ FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_bs_3.len.x FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_bs_3.spv.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_bs_4.len.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_bs_4.spv.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_bs_5.len.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_bs_5.spv.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_1_0.len.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_1_0.spv.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_1_1.len.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_1_1.spv.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_1_2.len.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_1_2.spv.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_1_3.len.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_1_3.spv.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_1_4.len.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_1_4.spv.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_1_5.len.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_1_5.spv.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_hm_1.len.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_hm_1.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_0_0.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_0_0.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_0_1.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_0_1.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_0_2.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_0_2.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_0_3.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_fm_0_3.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_hm_0.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_hm_0.spv.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_transpose.len.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u32/hs_transpose.spv.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_bc_0.len.xxd @@ -2503,18 +2601,16 @@ FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_bs_3.len.x FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_bs_3.spv.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_bs_4.len.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_bs_4.spv.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_1_0.len.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_1_0.spv.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_1_1.len.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_1_1.spv.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_1_2.len.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_1_2.spv.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_1_3.len.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_1_3.spv.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_1_4.len.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_1_4.spv.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_hm_1.len.xxd -FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_hm_1.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_0_0.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_0_0.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_0_1.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_0_1.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_0_2.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_0_2.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_0_3.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_fm_0_3.spv.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_hm_0.len.xxd +FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_hm_0.spv.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_transpose.len.xxd FILE: ../../../third_party/skia/src/compute/hs/vk/nvidia/sm_35/u64/hs_transpose.spv.xxd FILE: ../../../third_party/skia/src/core/SkOrderedReadBuffer.h @@ -3006,7 +3102,6 @@ FILE: ../../../third_party/skia/src/core/SkSurfacePriv.h FILE: ../../../third_party/skia/src/core/SkTaskGroup.cpp FILE: ../../../third_party/skia/src/core/SkTaskGroup.h FILE: ../../../third_party/skia/src/core/SkTextBlob.cpp -FILE: ../../../third_party/skia/src/core/SkTextMapStateProc.h FILE: ../../../third_party/skia/src/core/SkVertState.cpp FILE: ../../../third_party/skia/src/core/SkVertState.h FILE: ../../../third_party/skia/src/fonts/SkFontMgr_indirect.cpp @@ -3095,8 +3190,6 @@ FILE: ../../../third_party/skia/src/shaders/SkLocalMatrixShader.cpp FILE: ../../../third_party/skia/src/shaders/SkLocalMatrixShader.h FILE: ../../../third_party/skia/src/shaders/SkPictureShader.cpp FILE: ../../../third_party/skia/src/shaders/SkPictureShader.h -FILE: ../../../third_party/skia/src/shaders/gradients/SkTwoPointConicalGradient_gpu.cpp -FILE: ../../../third_party/skia/src/shaders/gradients/SkTwoPointConicalGradient_gpu.h FILE: ../../../third_party/skia/src/utils/SkDashPath.cpp FILE: ../../../third_party/skia/src/utils/SkDashPathPriv.h FILE: ../../../third_party/skia/src/utils/SkEventTracer.cpp @@ -3229,12 +3322,10 @@ FILE: ../../../third_party/skia/src/gpu/GrShaderCaps.h FILE: ../../../third_party/skia/src/gpu/GrSoftwarePathRenderer.cpp FILE: ../../../third_party/skia/src/gpu/GrSoftwarePathRenderer.h FILE: ../../../third_party/skia/src/gpu/GrSurface.cpp -FILE: ../../../third_party/skia/src/gpu/GrTextureStripAtlas.h FILE: ../../../third_party/skia/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h FILE: ../../../third_party/skia/src/gpu/effects/GrTextureDomain.cpp FILE: ../../../third_party/skia/src/gpu/effects/GrTextureDomain.h -FILE: ../../../third_party/skia/src/gpu/effects/GrTextureStripAtlas.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLCaps.cpp FILE: ../../../third_party/skia/src/gpu/gl/GrGLCaps.h FILE: ../../../third_party/skia/src/gpu/gl/GrGLPath.cpp @@ -3549,7 +3640,6 @@ 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/SkImageCacherator.h FILE: ../../../third_party/skia/src/core/SkLatticeIter.cpp FILE: ../../../third_party/skia/src/core/SkLatticeIter.h FILE: ../../../third_party/skia/src/core/SkLocalMatrixImageFilter.cpp @@ -4528,14 +4618,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== LIBRARY: skia -ORIGIN: ../../../third_party/skia/experimental/pathkit/pathkit_wasm_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/pathkit/pathkit_wasm_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/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 @@ -4566,11 +4653,14 @@ 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/pathkit/pathkit_wasm_bindings.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 @@ -4615,6 +4705,7 @@ FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzNullCanvas.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzPNGEncoder.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzPathMeasure.cpp +FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzPathop.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp FILE: ../../../third_party/skia/fuzz/oss_fuzz/FuzzWEBPEncoder.cpp @@ -5107,8 +5198,6 @@ FILE: ../../../third_party/skia/src/gpu/GrRenderTargetOpList.h FILE: ../../../third_party/skia/src/gpu/SkGpuDevice.h FILE: ../../../third_party/skia/src/gpu/SkGr.cpp FILE: ../../../third_party/skia/src/ports/SkDebug_win.cpp -FILE: ../../../third_party/skia/src/shaders/gradients/SkGradientBitmapCache.cpp -FILE: ../../../third_party/skia/src/shaders/gradients/SkGradientBitmapCache.h ---------------------------------------------------------------------------------------------------- Copyright 2010 Google Inc. @@ -5558,6 +5647,8 @@ TYPE: LicenseType.bsd FILE: ../../../third_party/skia/src/core/SkFlattenablePriv.h FILE: ../../../third_party/skia/src/core/SkGlyphRun.cpp FILE: ../../../third_party/skia/src/core/SkGlyphRun.h +FILE: ../../../third_party/skia/src/core/SkGlyphRunPainter.cpp +FILE: ../../../third_party/skia/src/core/SkGlyphRunPainter.h ---------------------------------------------------------------------------------------------------- Copyright 2018 The Android Open Source Project diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 2d0cf91811ccd..2c7e500f9beb2 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 149340ef002a59fe0840631d6cfd1773 +Signature: 5b5ec302d3f100a7ca4552f231d9f8b7 UNUSED LICENSES: @@ -4436,6 +4436,8 @@ FILE: ../../../third_party/dart/client/idea/.idea/.name FILE: ../../../third_party/dart/client/idea/.idea/inspectionProfiles/Project_Default.xml FILE: ../../../third_party/dart/client/idea/.idea/vcs.xml FILE: ../../../third_party/dart/runtime/CPPLINT.cfg +FILE: ../../../third_party/dart/runtime/docs/compiler/images/catch-block-entry-0.png +FILE: ../../../third_party/dart/runtime/docs/compiler/images/catch-block-entry-1.png FILE: ../../../third_party/dart/runtime/observatory/lib/elements.dart FILE: ../../../third_party/dart/runtime/observatory/lib/src/elements/img/chromium_icon.png FILE: ../../../third_party/dart/runtime/observatory/lib/src/elements/img/dart_icon.png @@ -5452,17 +5454,22 @@ FILE: ../../../third_party/dart/runtime/bin/dart_embedder_api_impl.cc FILE: ../../../third_party/dart/runtime/bin/typed_data_utils.cc FILE: ../../../third_party/dart/runtime/bin/typed_data_utils.h FILE: ../../../third_party/dart/runtime/include/dart_embedder_api.h +FILE: ../../../third_party/dart/runtime/tools/dartfuzz/dartfuzz.dart FILE: ../../../third_party/dart/runtime/vm/base64.cc FILE: ../../../third_party/dart/runtime/vm/base64.h FILE: ../../../third_party/dart/runtime/vm/base64_test.cc +FILE: ../../../third_party/dart/runtime/vm/code_patcher_kbc.cc FILE: ../../../third_party/dart/runtime/vm/compiler/assembler/disassembler_kbc.cc FILE: ../../../third_party/dart/runtime/vm/compiler/assembler/disassembler_kbc.h FILE: ../../../third_party/dart/runtime/vm/compiler/backend/code_statistics.cc FILE: ../../../third_party/dart/runtime/vm/compiler/backend/code_statistics.h FILE: ../../../third_party/dart/runtime/vm/compiler/compiler_pass.cc FILE: ../../../third_party/dart/runtime/vm/compiler/compiler_pass.h +FILE: ../../../third_party/dart/runtime/vm/compiler/compiler_state.h FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/base_flow_graph_builder.cc FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/base_flow_graph_builder.h +FILE: ../../../third_party/dart/runtime/vm/compiler/frontend/bytecode_flow_graph_builder.cc +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/constant_evaluator.cc @@ -5478,8 +5485,11 @@ FILE: ../../../third_party/dart/runtime/vm/constants_kbc.h FILE: ../../../third_party/dart/runtime/vm/datastream.cc FILE: ../../../third_party/dart/runtime/vm/finalizable_data.h FILE: ../../../third_party/dart/runtime/vm/hash.h +FILE: ../../../third_party/dart/runtime/vm/instructions_kbc.cc +FILE: ../../../third_party/dart/runtime/vm/instructions_kbc.h FILE: ../../../third_party/dart/runtime/vm/interpreter.cc FILE: ../../../third_party/dart/runtime/vm/interpreter.h +FILE: ../../../third_party/dart/runtime/vm/interpreter_unsupported.cc FILE: ../../../third_party/dart/runtime/vm/stack_frame_kbc.h FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs.cc FILE: ../../../third_party/dart/runtime/vm/type_testing_stubs.h diff --git a/common/settings.cc b/common/settings.cc index 8123b1d321ef6..9aa8997ba947b 100644 --- a/common/settings.cc +++ b/common/settings.cc @@ -11,7 +11,6 @@ namespace blink { std::string Settings::ToString() const { std::stringstream stream; stream << "Settings: " << std::endl; - stream << "script_snapshot_path: " << script_snapshot_path << 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 diff --git a/common/settings.h b/common/settings.h index 124529b90c57d..1c0002e7ad7d6 100644 --- a/common/settings.h +++ b/common/settings.h @@ -23,9 +23,6 @@ using TaskObserverRemove = std::function; struct Settings { // VM settings - std::string script_snapshot_path; - std::string platform_kernel_path; - std::string vm_snapshot_data_path; std::string vm_snapshot_instr_path; std::string isolate_snapshot_data_path; diff --git a/flow/BUILD.gn b/flow/BUILD.gn index e311926fe25fe..dd4a292dd9d66 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -22,12 +22,8 @@ source_set("flow") { "layers/color_filter_layer.h", "layers/container_layer.cc", "layers/container_layer.h", - "layers/default_layer_builder.cc", - "layers/default_layer_builder.h", "layers/layer.cc", "layers/layer.h", - "layers/layer_builder.cc", - "layers/layer_builder.h", "layers/layer_tree.cc", "layers/layer_tree.h", "layers/opacity_layer.cc", diff --git a/flow/compositor_context.cc b/flow/compositor_context.cc index 3863bde7acbf9..aecd3a24cddf7 100644 --- a/flow/compositor_context.cc +++ b/flow/compositor_context.cc @@ -69,6 +69,7 @@ bool CompositorContext::ScopedFrame::Raster(flow::LayerTree& layer_tree, void CompositorContext::OnGrContextCreated() { texture_registry_.OnGrContextCreated(); + raster_cache_.Clear(); } void CompositorContext::OnGrContextDestroyed() { diff --git a/flow/instrumentation.cc b/flow/instrumentation.cc index a032a0ab32777..3b9c95a331481 100644 --- a/flow/instrumentation.cc +++ b/flow/instrumentation.cc @@ -8,6 +8,7 @@ #include #include "third_party/skia/include/core/SkPath.h" +#include "third_party/skia/include/core/SkSurface.h" namespace flow { @@ -17,6 +18,8 @@ static const size_t kMaxFrameMarkers = 8; Stopwatch::Stopwatch() : start_(fml::TimePoint::Now()), current_sample_(0) { const fml::TimeDelta delta = fml::TimeDelta::Zero(); laps_.resize(kMaxSamples, delta); + cache_dirty_ = true; + prev_drawn_sample_index_ = 0; } Stopwatch::~Stopwatch() = default; @@ -60,32 +63,41 @@ fml::TimeDelta Stopwatch::MaxDelta() const { return max_delta; } -void Stopwatch::Visualize(SkCanvas& canvas, const SkRect& rect) const { - SkPaint paint; +// Initialize the SkSurface for drawing into. Draws the base background and any +// timing data from before the initial Visualize() call. +void Stopwatch::InitVisualizeSurface(const SkRect& rect) const { + if (!cache_dirty_) { + return; + } + cache_dirty_ = false; - // Paint the background. - paint.setColor(0x99FFFFFF); - canvas.drawRect(rect, paint); + // TODO(garyq): Use a GPU surface instead of a CPU surface. + visualize_cache_surface_ = + SkSurface::MakeRasterN32Premul(rect.width(), rect.height()); + + SkCanvas* cache_canvas = visualize_cache_surface_->getCanvas(); // Establish the graph position. - const SkScalar x = rect.x(); - const SkScalar y = rect.y(); + const SkScalar x = 0; + const SkScalar y = 0; const SkScalar width = rect.width(); const SkScalar height = rect.height(); - const SkScalar bottom = y + height; - const SkScalar right = x + width; + + SkPaint paint; + paint.setColor(0x99FFFFFF); + cache_canvas->drawRect(SkRect::MakeXYWH(x, y, width, height), paint); // Scale the graph to show frame times up to those that are 3 times the frame // time. const double max_interval = kOneFrameMS * 3.0; const double max_unit_interval = UnitFrameInterval(max_interval); - // Prepare a path for the data. - // we start at the height of the last point, so it looks like we wrap around + // Draw the old data to initially populate the graph. + // Prepare a path for the data. We start at the height of the last point, so + // it looks like we wrap around SkPath path; path.setIsVolatile(true); - const double sample_unit_width = (1.0 / kMaxSamples); - path.moveTo(x, bottom); + path.moveTo(x, height); path.lineTo(x, y + height * (1.0 - UnitHeight(laps_[0].ToMillisecondsF(), max_unit_interval))); double unit_x; @@ -100,17 +112,61 @@ void Stopwatch::Visualize(SkCanvas& canvas, const SkRect& rect) const { path.lineTo(x + width * unit_next_x, sample_y); } path.lineTo( - right, + width, y + height * (1.0 - UnitHeight(laps_[kMaxSamples - 1].ToMillisecondsF(), max_unit_interval))); - path.lineTo(right, bottom); + path.lineTo(width, height); path.close(); // Draw the graph. paint.setColor(0xAA0000FF); - canvas.drawPath(path, paint); + cache_canvas->drawPath(path, paint); +} + +void Stopwatch::Visualize(SkCanvas& canvas, const SkRect& rect) const { + // Initialize visualize cache if it has not yet been initialized. + InitVisualizeSurface(rect); - // Draw horizontal markers. + SkCanvas* cache_canvas = visualize_cache_surface_->getCanvas(); + SkPaint paint; + + // Establish the graph position. + const SkScalar x = 0; + const SkScalar y = 0; + const SkScalar width = rect.width(); + const SkScalar height = rect.height(); + + // Scale the graph to show frame times up to those that are 3 times the frame + // time. + const double max_interval = kOneFrameMS * 3.0; + const double max_unit_interval = UnitFrameInterval(max_interval); + + const double sample_unit_width = (1.0 / kMaxSamples); + + // Draw vertical replacement bar to erase old/stale pixels. + paint.setColor(0x99FFFFFF); + paint.setStyle(SkPaint::Style::kFill_Style); + paint.setBlendMode(SkBlendMode::kSrc); + double sample_x = + x + width * (static_cast(prev_drawn_sample_index_) / kMaxSamples); + const auto eraser_rect = SkRect::MakeLTRB( + sample_x, y, sample_x + width * sample_unit_width, height); + cache_canvas->drawRect(eraser_rect, paint); + + // Draws blue timing bar for new data. + paint.setColor(0xAA0000FF); + paint.setBlendMode(SkBlendMode::kSrcOver); + const auto bar_rect = SkRect::MakeLTRB( + sample_x, + y + height * (1.0 - + UnitHeight(laps_[current_sample_ == 0 ? kMaxSamples - 1 + : current_sample_ - 1] + .ToMillisecondsF(), + max_unit_interval)), + sample_x + width * sample_unit_width, height); + cache_canvas->drawRect(bar_rect, paint); + + // Draw horizontal frame markers. paint.setStrokeWidth(0); // hairline paint.setStyle(SkPaint::Style::kStroke_Style); paint.setColor(0xCC000000); @@ -129,7 +185,8 @@ void Stopwatch::Visualize(SkCanvas& canvas, const SkRect& rect) const { const double frame_height = height * (1.0 - (UnitFrameInterval((frame_index + 1) * kOneFrameMS) / max_unit_interval)); - canvas.drawLine(x, y + frame_height, right, y + frame_height, paint); + cache_canvas->drawLine(x, y + frame_height, width, y + frame_height, + paint); } } @@ -137,6 +194,7 @@ void Stopwatch::Visualize(SkCanvas& canvas, const SkRect& rect) const { // We paint it over the current frame, not after it, because when we // paint this we don't yet have all the times for the current frame. paint.setStyle(SkPaint::Style::kFill_Style); + paint.setBlendMode(SkBlendMode::kSrcOver); if (UnitFrameInterval(LastLap().ToMillisecondsF()) > 1.0) { // budget exceeded paint.setColor(SK_ColorRED); @@ -144,12 +202,15 @@ void Stopwatch::Visualize(SkCanvas& canvas, const SkRect& rect) const { // within budget paint.setColor(SK_ColorGREEN); } - double sample_x = - x + width * (static_cast(current_sample_) / kMaxSamples); - + sample_x = x + width * (static_cast(current_sample_) / kMaxSamples); const auto marker_rect = SkRect::MakeLTRB( - sample_x, y, sample_x + width * sample_unit_width, bottom); - canvas.drawRect(marker_rect, paint); + sample_x, y, sample_x + width * sample_unit_width, height); + cache_canvas->drawRect(marker_rect, paint); + prev_drawn_sample_index_ = current_sample_; + + // Draw the cached surface onto the output canvas. + paint.reset(); + visualize_cache_surface_->draw(&canvas, rect.x(), rect.y(), &paint); } CounterValues::CounterValues() : current_sample_(kMaxSamples - 1) { diff --git a/flow/instrumentation.h b/flow/instrumentation.h index 19f3b0cfd8bc8..009786ba37cd1 100644 --- a/flow/instrumentation.h +++ b/flow/instrumentation.h @@ -28,6 +28,8 @@ class Stopwatch { fml::TimeDelta MaxDelta() const; + void InitVisualizeSurface(const SkRect& rect) const; + void Visualize(SkCanvas& canvas, const SkRect& rect) const; void Start(); @@ -40,6 +42,11 @@ class Stopwatch { fml::TimePoint start_; std::vector laps_; size_t current_sample_; + // Mutable data cache for performance optimization of the graphs. Prevents + // expensive redrawing of old data. + mutable bool cache_dirty_; + mutable sk_sp visualize_cache_surface_; + mutable size_t prev_drawn_sample_index_; FML_DISALLOW_COPY_AND_ASSIGN(Stopwatch); }; diff --git a/flow/layers/backdrop_filter_layer.cc b/flow/layers/backdrop_filter_layer.cc index b8d04803f1935..1b93b9cabb952 100644 --- a/flow/layers/backdrop_filter_layer.cc +++ b/flow/layers/backdrop_filter_layer.cc @@ -16,8 +16,9 @@ void BackdropFilterLayer::Paint(PaintContext& context) const { TRACE_EVENT0("flutter", "BackdropFilterLayer::Paint"); FML_DCHECK(needs_painting()); - Layer::AutoSaveLayer(context, SkCanvas::SaveLayerRec{&paint_bounds(), nullptr, - filter_.get(), 0}); + Layer::AutoSaveLayer save = Layer::AutoSaveLayer::Create( + context, + SkCanvas::SaveLayerRec{&paint_bounds(), nullptr, filter_.get(), 0}); PaintChildren(context); } diff --git a/flow/layers/clip_rect_layer.cc b/flow/layers/clip_rect_layer.cc index bc9ce7d099bad..733acfcebd072 100644 --- a/flow/layers/clip_rect_layer.cc +++ b/flow/layers/clip_rect_layer.cc @@ -41,8 +41,8 @@ void ClipRectLayer::Paint(PaintContext& context) const { TRACE_EVENT0("flutter", "ClipRectLayer::Paint"); FML_DCHECK(needs_painting()); - SkAutoCanvasRestore save(&context.canvas, clip_behavior_ != Clip::hardEdge); - context.canvas.clipRect(paint_bounds()); + SkAutoCanvasRestore save(&context.canvas, true); + context.canvas.clipRect(paint_bounds(), clip_behavior_ != Clip::hardEdge); if (clip_behavior_ == Clip::antiAliasWithSaveLayer) { context.canvas.saveLayer(paint_bounds(), nullptr); } diff --git a/flow/layers/color_filter_layer.cc b/flow/layers/color_filter_layer.cc index a3c678aa1539e..287507d179f0f 100644 --- a/flow/layers/color_filter_layer.cc +++ b/flow/layers/color_filter_layer.cc @@ -19,7 +19,8 @@ void ColorFilterLayer::Paint(PaintContext& context) const { SkPaint paint; paint.setColorFilter(std::move(color_filter)); - Layer::AutoSaveLayer(context, paint_bounds(), &paint); + Layer::AutoSaveLayer save = + Layer::AutoSaveLayer::Create(context, paint_bounds(), &paint); PaintChildren(context); } diff --git a/flow/layers/default_layer_builder.cc b/flow/layers/default_layer_builder.cc deleted file mode 100644 index c6f4b80e82564..0000000000000 --- a/flow/layers/default_layer_builder.cc +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright 2017 The Flutter 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/default_layer_builder.h" - -#include "flutter/flow/layers/backdrop_filter_layer.h" -#include "flutter/flow/layers/clip_path_layer.h" -#include "flutter/flow/layers/clip_rect_layer.h" -#include "flutter/flow/layers/clip_rrect_layer.h" -#include "flutter/flow/layers/color_filter_layer.h" -#include "flutter/flow/layers/container_layer.h" -#include "flutter/flow/layers/layer.h" -#include "flutter/flow/layers/layer_tree.h" -#include "flutter/flow/layers/opacity_layer.h" -#include "flutter/flow/layers/performance_overlay_layer.h" -#include "flutter/flow/layers/physical_shape_layer.h" -#include "flutter/flow/layers/picture_layer.h" -#include "flutter/flow/layers/shader_mask_layer.h" -#include "flutter/flow/layers/texture_layer.h" -#include "flutter/flow/layers/transform_layer.h" - -#if defined(OS_FUCHSIA) -#include "flutter/flow/layers/child_scene_layer.h" -#endif // defined(OS_FUCHSIA) - -namespace flow { - -static const SkRect kGiantRect = SkRect::MakeLTRB(-1E9F, -1E9F, 1E9F, 1E9F); - -DefaultLayerBuilder::DefaultLayerBuilder() { - cull_rects_.push(kGiantRect); -} - -DefaultLayerBuilder::~DefaultLayerBuilder() = default; - -void DefaultLayerBuilder::PushTransform(const SkMatrix& sk_matrix) { - SkMatrix inverse_sk_matrix; - SkRect cullRect; - // Perspective projections don't produce rectangles that are useful for - // culling for some reason. - if (!sk_matrix.hasPerspective() && sk_matrix.invert(&inverse_sk_matrix)) { - inverse_sk_matrix.mapRect(&cullRect, cull_rects_.top()); - } else { - cullRect = kGiantRect; - } - auto layer = std::make_unique(); - layer->set_transform(sk_matrix); - PushLayer(std::move(layer), cullRect); -} - -void DefaultLayerBuilder::PushClipRect(const SkRect& clipRect, - Clip clip_behavior) { - SkRect cullRect; - if (!cullRect.intersect(clipRect, cull_rects_.top())) { - cullRect = SkRect::MakeEmpty(); - } - auto layer = std::make_unique(clip_behavior); - layer->set_clip_rect(clipRect); - PushLayer(std::move(layer), cullRect); -} - -void DefaultLayerBuilder::PushClipRoundedRect(const SkRRect& rrect, - Clip clip_behavior) { - SkRect cullRect; - if (!cullRect.intersect(rrect.rect(), cull_rects_.top())) { - cullRect = SkRect::MakeEmpty(); - } - auto layer = std::make_unique(clip_behavior); - layer->set_clip_rrect(rrect); - PushLayer(std::move(layer), cullRect); -} - -void DefaultLayerBuilder::PushClipPath(const SkPath& path, Clip clip_behavior) { - FML_DCHECK(clip_behavior != Clip::none); - SkRect cullRect; - if (!cullRect.intersect(path.getBounds(), cull_rects_.top())) { - cullRect = SkRect::MakeEmpty(); - } - auto layer = std::make_unique(clip_behavior); - layer->set_clip_path(path); - PushLayer(std::move(layer), cullRect); -} - -void DefaultLayerBuilder::PushOpacity(int alpha) { - auto layer = std::make_unique(); - layer->set_alpha(alpha); - PushLayer(std::move(layer), cull_rects_.top()); -} - -void DefaultLayerBuilder::PushColorFilter(SkColor color, - SkBlendMode blend_mode) { - auto layer = std::make_unique(); - layer->set_color(color); - layer->set_blend_mode(blend_mode); - PushLayer(std::move(layer), cull_rects_.top()); -} - -void DefaultLayerBuilder::PushBackdropFilter(sk_sp filter) { - auto layer = std::make_unique(); - layer->set_filter(filter); - PushLayer(std::move(layer), cull_rects_.top()); -} - -void DefaultLayerBuilder::PushShaderMask(sk_sp shader, - const SkRect& rect, - SkBlendMode blend_mode) { - auto layer = std::make_unique(); - layer->set_shader(shader); - layer->set_mask_rect(rect); - layer->set_blend_mode(blend_mode); - PushLayer(std::move(layer), cull_rects_.top()); -} - -void DefaultLayerBuilder::PushPhysicalShape(const SkPath& sk_path, - double elevation, - SkColor color, - SkColor shadow_color, - SkScalar device_pixel_ratio, - Clip clip_behavior) { - SkRect cullRect; - if (!cullRect.intersect(sk_path.getBounds(), cull_rects_.top())) { - cullRect = SkRect::MakeEmpty(); - } - auto layer = std::make_unique(clip_behavior); - layer->set_path(sk_path); - layer->set_elevation(elevation); - layer->set_color(color); - layer->set_shadow_color(shadow_color); - layer->set_device_pixel_ratio(device_pixel_ratio); - PushLayer(std::move(layer), cullRect); -} - -void DefaultLayerBuilder::PushPerformanceOverlay(uint64_t enabled_options, - const SkRect& rect) { - if (!current_layer_) { - return; - } - auto layer = std::make_unique(enabled_options); - layer->set_paint_bounds(rect); - current_layer_->Add(std::move(layer)); -} - -void DefaultLayerBuilder::PushPicture(const SkPoint& offset, - SkiaGPUObject picture, - bool picture_is_complex, - bool picture_will_change) { - if (!current_layer_) { - return; - } - SkRect pictureRect = picture.get()->cullRect(); - pictureRect.offset(offset.x(), offset.y()); - if (!SkRect::Intersects(pictureRect, cull_rects_.top())) { - return; - } - auto layer = std::make_unique(); - layer->set_offset(offset); - layer->set_picture(std::move(picture)); - layer->set_is_complex(picture_is_complex); - layer->set_will_change(picture_will_change); - current_layer_->Add(std::move(layer)); -} - -void DefaultLayerBuilder::PushTexture(const SkPoint& offset, - const SkSize& size, - int64_t texture_id, - bool freeze) { - if (!current_layer_) { - return; - } - auto layer = std::make_unique(); - layer->set_offset(offset); - layer->set_size(size); - layer->set_texture_id(texture_id); - layer->set_freeze(freeze); - current_layer_->Add(std::move(layer)); -} - -#if defined(OS_FUCHSIA) -void DefaultLayerBuilder::PushChildScene( - const SkPoint& offset, - const SkSize& size, - fml::RefPtr export_token_holder, - bool hit_testable) { - if (!current_layer_) { - return; - } - SkRect sceneRect = - SkRect::MakeXYWH(offset.x(), offset.y(), size.width(), size.height()); - if (!SkRect::Intersects(sceneRect, cull_rects_.top())) { - return; - } - auto layer = std::make_unique(); - layer->set_offset(offset); - layer->set_size(size); - layer->set_export_node_holder(std::move(export_token_holder)); - layer->set_hit_testable(hit_testable); - current_layer_->Add(std::move(layer)); -} -#endif // defined(OS_FUCHSIA) - -void DefaultLayerBuilder::Pop() { - if (!current_layer_) { - return; - } - cull_rects_.pop(); - current_layer_ = current_layer_->parent(); -} - -std::unique_ptr DefaultLayerBuilder::TakeLayer() { - return std::move(root_layer_); -} - -void DefaultLayerBuilder::PushLayer(std::unique_ptr layer, - const SkRect& cullRect) { - FML_DCHECK(layer); - - cull_rects_.push(cullRect); - - if (!root_layer_) { - root_layer_ = std::move(layer); - current_layer_ = root_layer_.get(); - return; - } - - if (!current_layer_) { - return; - } - - flow::ContainerLayer* newLayer = layer.get(); - current_layer_->Add(std::move(layer)); - current_layer_ = newLayer; -} - -} // namespace flow diff --git a/flow/layers/default_layer_builder.h b/flow/layers/default_layer_builder.h deleted file mode 100644 index 2601344668ed7..0000000000000 --- a/flow/layers/default_layer_builder.h +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef FLUTTER_FLOW_LAYERS_DEFAULT_LAYER_BUILDER_H_ -#define FLUTTER_FLOW_LAYERS_DEFAULT_LAYER_BUILDER_H_ - -#include - -#include "flutter/flow/layers/container_layer.h" -#include "flutter/flow/layers/layer_builder.h" -#include "flutter/fml/macros.h" - -namespace flow { - -class DefaultLayerBuilder final : public LayerBuilder { - public: - DefaultLayerBuilder(); - - // |flow::LayerBuilder| - ~DefaultLayerBuilder() override; - - // |flow::LayerBuilder| - void PushTransform(const SkMatrix& matrix) override; - - // |flow::LayerBuilder| - void PushClipRect(const SkRect& rect, - Clip clip_behavior = Clip::antiAlias) override; - - // |flow::LayerBuilder| - void PushClipRoundedRect(const SkRRect& rect, - Clip clip_behavior = Clip::antiAlias) override; - - // |flow::LayerBuilder| - void PushClipPath(const SkPath& path, - Clip clip_behavior = Clip::antiAlias) override; - - // |flow::LayerBuilder| - void PushOpacity(int alpha) override; - - // |flow::LayerBuilder| - void PushColorFilter(SkColor color, SkBlendMode blend_mode) override; - - // |flow::LayerBuilder| - void PushBackdropFilter(sk_sp filter) override; - - // |flow::LayerBuilder| - void PushShaderMask(sk_sp shader, - const SkRect& rect, - SkBlendMode blend_mode) override; - - // |flow::LayerBuilder| - void PushPhysicalShape(const SkPath& path, - double elevation, - SkColor color, - SkColor shadow_color, - SkScalar device_pixel_ratio, - Clip clip_behavior) override; - - // |flow::LayerBuilder| - void PushPerformanceOverlay(uint64_t enabled_options, - const SkRect& rect) override; - - // |flow::LayerBuilder| - void PushPicture(const SkPoint& offset, - SkiaGPUObject picture, - bool picture_is_complex, - bool picture_will_change) override; - - // |flow::LayerBuilder| - void PushTexture(const SkPoint& offset, - const SkSize& size, - int64_t texture_id, - bool freeze) override; - -#if defined(OS_FUCHSIA) - // |flow::LayerBuilder| - void PushChildScene(const SkPoint& offset, - const SkSize& size, - fml::RefPtr export_token_holder, - bool hit_testable) override; -#endif // defined(OS_FUCHSIA) - - // |flow::LayerBuilder| - void Pop() override; - - // |flow::LayerBuilder| - std::unique_ptr TakeLayer() override; - - private: - std::unique_ptr root_layer_; - flow::ContainerLayer* current_layer_ = nullptr; - - std::stack cull_rects_; - - void PushLayer(std::unique_ptr layer, - const SkRect& cullRect); - - FML_DISALLOW_COPY_AND_ASSIGN(DefaultLayerBuilder); -}; - -} // namespace flow - -#endif // FLUTTER_FLOW_LAYERS_DEFAULT_LAYER_BUILDER_H_ diff --git a/flow/layers/layer.cc b/flow/layers/layer.cc index 67148dc0c083b..c1d91872127ab 100644 --- a/flow/layers/layer.cc +++ b/flow/layers/layer.cc @@ -35,6 +35,19 @@ Layer::AutoSaveLayer::AutoSaveLayer(const PaintContext& paint_context, paint_context_.canvas.saveLayer(layer_rec); } +Layer::AutoSaveLayer Layer::AutoSaveLayer::Create( + const PaintContext& paint_context, + const SkRect& bounds, + const SkPaint* paint) { + return Layer::AutoSaveLayer(paint_context, bounds, paint); +} + +Layer::AutoSaveLayer Layer::AutoSaveLayer::Create( + const PaintContext& paint_context, + const SkCanvas::SaveLayerRec& layer_rec) { + return Layer::AutoSaveLayer(paint_context, layer_rec); +} + Layer::AutoSaveLayer::~AutoSaveLayer() { if (paint_context_.checkerboard_offscreen_layers) { DrawCheckerboard(&paint_context_.canvas, bounds_); diff --git a/flow/layers/layer.h b/flow/layers/layer.h index 53e32941e8d1d..a52f6e04aa86c 100644 --- a/flow/layers/layer.h +++ b/flow/layers/layer.h @@ -12,6 +12,7 @@ #include "flutter/flow/raster_cache.h" #include "flutter/flow/texture.h" #include "flutter/fml/build_config.h" +#include "flutter/fml/compiler_specific.h" #include "flutter/fml/logging.h" #include "flutter/fml/macros.h" #include "flutter/fml/trace_event.h" @@ -57,7 +58,6 @@ class Layer { struct PaintContext { SkCanvas& canvas; - const SkMatrix& root_surface_transformation; const Stopwatch& frame_time; const Stopwatch& engine_time; TextureRegistry& texture_registry; @@ -68,6 +68,18 @@ class Layer { // draws a checkerboard over the layer if that is enabled in the PaintContext. class AutoSaveLayer { public: + FML_WARN_UNUSED_RESULT static AutoSaveLayer Create( + const PaintContext& paint_context, + const SkRect& bounds, + const SkPaint* paint); + + FML_WARN_UNUSED_RESULT static AutoSaveLayer Create( + const PaintContext& paint_context, + const SkCanvas::SaveLayerRec& layer_rec); + + ~AutoSaveLayer(); + + private: AutoSaveLayer(const PaintContext& paint_context, const SkRect& bounds, const SkPaint* paint); @@ -75,9 +87,6 @@ class Layer { AutoSaveLayer(const PaintContext& paint_context, const SkCanvas::SaveLayerRec& layer_rec); - ~AutoSaveLayer(); - - private: const PaintContext& paint_context_; const SkRect bounds_; }; diff --git a/flow/layers/layer_builder.cc b/flow/layers/layer_builder.cc deleted file mode 100644 index 1d2243d5dfc39..0000000000000 --- a/flow/layers/layer_builder.cc +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2017 The Flutter 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/layer_builder.h" -#include "flutter/flow/layers/default_layer_builder.h" - -namespace flow { - -std::unique_ptr LayerBuilder::Create() { - return std::make_unique(); -} - -LayerBuilder::LayerBuilder() = default; - -LayerBuilder::~LayerBuilder() = default; - -int LayerBuilder::GetRasterizerTracingThreshold() const { - return rasterizer_tracing_threshold_; -} - -bool LayerBuilder::GetCheckerboardRasterCacheImages() const { - return checkerboard_raster_cache_images_; -} - -bool LayerBuilder::GetCheckerboardOffscreenLayers() const { - return checkerboard_offscreen_layers_; -} - -void LayerBuilder::SetRasterizerTracingThreshold(uint32_t frameInterval) { - rasterizer_tracing_threshold_ = frameInterval; -} - -void LayerBuilder::SetCheckerboardRasterCacheImages(bool checkerboard) { - checkerboard_raster_cache_images_ = checkerboard; -} - -void LayerBuilder::SetCheckerboardOffscreenLayers(bool checkerboard) { - checkerboard_offscreen_layers_ = checkerboard; -} - -} // namespace flow diff --git a/flow/layers/layer_builder.h b/flow/layers/layer_builder.h deleted file mode 100644 index 8fa83e222f9ca..0000000000000 --- a/flow/layers/layer_builder.h +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2017 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef FLUTTER_FLOW_LAYERS_LAYER_BUILDER_H_ -#define FLUTTER_FLOW_LAYERS_LAYER_BUILDER_H_ - -#include - -#include "flutter/flow/layers/layer.h" -#include "flutter/flow/skia_gpu_object.h" -#include "flutter/fml/macros.h" -#include "third_party/skia/include/core/SkBlendMode.h" -#include "third_party/skia/include/core/SkColor.h" -#include "third_party/skia/include/core/SkImageFilter.h" -#include "third_party/skia/include/core/SkMatrix.h" -#include "third_party/skia/include/core/SkPath.h" -#include "third_party/skia/include/core/SkPicture.h" -#include "third_party/skia/include/core/SkRRect.h" -#include "third_party/skia/include/core/SkRect.h" -#include "third_party/skia/include/core/SkShader.h" - -namespace flow { - -class LayerBuilder { - public: - static std::unique_ptr Create(); - - LayerBuilder(); - - virtual ~LayerBuilder(); - - virtual void PushTransform(const SkMatrix& matrix) = 0; - - virtual void PushClipRect(const SkRect& rect, - Clip clip_behavior = Clip::antiAlias) = 0; - - virtual void PushClipRoundedRect(const SkRRect& rect, - Clip clip_behavior = Clip::antiAlias) = 0; - - virtual void PushClipPath(const SkPath& path, - Clip clip_behavior = Clip::antiAlias) = 0; - - virtual void PushOpacity(int alpha) = 0; - - virtual void PushColorFilter(SkColor color, SkBlendMode blend_mode) = 0; - - virtual void PushBackdropFilter(sk_sp filter) = 0; - - virtual void PushShaderMask(sk_sp shader, - const SkRect& rect, - SkBlendMode blend_mode) = 0; - - virtual void PushPhysicalShape(const SkPath& path, - double elevation, - SkColor color, - SkColor shadow_color, - SkScalar device_pixel_ratio, - Clip clip_behavior) = 0; - - virtual void PushPerformanceOverlay(uint64_t enabled_options, - const SkRect& rect) = 0; - - virtual void PushPicture(const SkPoint& offset, - SkiaGPUObject picture, - bool picture_is_complex, - bool picture_will_change) = 0; - - virtual void PushTexture(const SkPoint& offset, - const SkSize& size, - int64_t texture_id, - bool freeze) = 0; - -#if defined(OS_FUCHSIA) - virtual void PushChildScene( - const SkPoint& offset, - const SkSize& size, - fml::RefPtr export_token_holder, - bool hit_testable) = 0; -#endif // defined(OS_FUCHSIA) - - virtual void Pop() = 0; - - virtual std::unique_ptr TakeLayer() = 0; - - int GetRasterizerTracingThreshold() const; - - bool GetCheckerboardRasterCacheImages() const; - - bool GetCheckerboardOffscreenLayers() const; - - void SetRasterizerTracingThreshold(uint32_t frameInterval); - - void SetCheckerboardRasterCacheImages(bool checkerboard); - - void SetCheckerboardOffscreenLayers(bool checkerboard); - - private: - int rasterizer_tracing_threshold_ = 0; - bool checkerboard_raster_cache_images_ = false; - bool checkerboard_offscreen_layers_ = false; - - FML_DISALLOW_COPY_AND_ASSIGN(LayerBuilder); -}; - -} // namespace flow - -#endif // FLUTTER_FLOW_LAYERS_LAYER_BUILDER_H_ diff --git a/flow/layers/layer_tree.cc b/flow/layers/layer_tree.cc index 007bd0fbd9530..29f9c93b52c19 100644 --- a/flow/layers/layer_tree.cc +++ b/flow/layers/layer_tree.cc @@ -32,7 +32,7 @@ void LayerTree::Preroll(CompositorContext::ScopedFrame& frame, SkRect::MakeEmpty(), }; - root_layer_->Preroll(&context, SkMatrix::I()); + root_layer_->Preroll(&context, frame.root_surface_transformation()); } #if defined(OS_FUCHSIA) @@ -63,12 +63,11 @@ void LayerTree::UpdateScene(SceneUpdateContext& context, void LayerTree::Paint(CompositorContext::ScopedFrame& frame) const { TRACE_EVENT0("flutter", "LayerTree::Paint"); Layer::PaintContext context = { - *frame.canvas(), // - frame.root_surface_transformation(), // - frame.context().frame_time(), // - frame.context().engine_time(), // - frame.context().texture_registry(), // - checkerboard_offscreen_layers_ // + *frame.canvas(), // + frame.context().frame_time(), // + frame.context().engine_time(), // + frame.context().texture_registry(), // + checkerboard_offscreen_layers_ // }; if (root_layer_->needs_painting()) @@ -99,18 +98,17 @@ sk_sp LayerTree::Flatten(const SkRect& bounds) { root_surface_transformation.reset(); Layer::PaintContext paint_context = { - *canvas, // canvas - root_surface_transformation, // root surface transformation - unused_stopwatch, // frame time (dont care) - unused_stopwatch, // engine time (dont care) - unused_texture_registry, // texture registry (not supported) - false // checkerboard offscreen layers + *canvas, // canvas + unused_stopwatch, // frame time (dont care) + unused_stopwatch, // engine time (dont care) + unused_texture_registry, // texture registry (not supported) + false // checkerboard offscreen layers }; // Even if we don't have a root layer, we still need to create an empty // picture. if (root_layer_) { - root_layer_->Preroll(&preroll_context, SkMatrix::I()); + root_layer_->Preroll(&preroll_context, root_surface_transformation); // The needs painting flag may be set after the preroll. So check it after. if (root_layer_->needs_painting()) { root_layer_->Paint(paint_context); diff --git a/flow/layers/opacity_layer.cc b/flow/layers/opacity_layer.cc index 84b8bd64c0224..2272e79093864 100644 --- a/flow/layers/opacity_layer.cc +++ b/flow/layers/opacity_layer.cc @@ -17,7 +17,8 @@ void OpacityLayer::Paint(PaintContext& context) const { SkPaint paint; paint.setAlpha(alpha_); - Layer::AutoSaveLayer save(context, paint_bounds(), &paint); + Layer::AutoSaveLayer save = + Layer::AutoSaveLayer::Create(context, paint_bounds(), &paint); PaintChildren(context); } diff --git a/flow/layers/picture_layer.cc b/flow/layers/picture_layer.cc index 9389e0862c398..3cbf15a609ad1 100644 --- a/flow/layers/picture_layer.cc +++ b/flow/layers/picture_layer.cc @@ -45,8 +45,7 @@ void PictureLayer::Paint(PaintContext& context) const { #endif if (raster_cache_result_.is_valid()) { - raster_cache_result_.draw(context.canvas, - context.root_surface_transformation); + raster_cache_result_.draw(context.canvas); } else { context.canvas.drawPicture(picture()); } diff --git a/flow/layers/shader_mask_layer.cc b/flow/layers/shader_mask_layer.cc index 3ea69322fcd2f..6cb73bbf64855 100644 --- a/flow/layers/shader_mask_layer.cc +++ b/flow/layers/shader_mask_layer.cc @@ -14,7 +14,8 @@ void ShaderMaskLayer::Paint(PaintContext& context) const { TRACE_EVENT0("flutter", "ShaderMaskLayer::Paint"); FML_DCHECK(needs_painting()); - Layer::AutoSaveLayer(context, paint_bounds(), nullptr); + Layer::AutoSaveLayer save = + Layer::AutoSaveLayer::Create(context, paint_bounds(), nullptr); PaintChildren(context); SkPaint paint; diff --git a/flow/matrix_decomposition.cc b/flow/matrix_decomposition.cc index 73a774b4dd037..0cc035cbba216 100644 --- a/flow/matrix_decomposition.cc +++ b/flow/matrix_decomposition.cc @@ -28,6 +28,15 @@ static inline SkVector3 SkVector3Cross(const SkVector3& a, const SkVector3& b) { MatrixDecomposition::MatrixDecomposition(const SkMatrix& matrix) : MatrixDecomposition(SkMatrix44{matrix}) {} +// Use custom normalize to avoid skia precision loss/normalize() privatization. +static inline void SkVector3Normalize(SkVector3& v) { + double mag = sqrt(v.fX * v.fX + v.fY * v.fY + v.fZ * v.fZ); + double scale = 1.0 / mag; + v.fX *= scale; + v.fY *= scale; + v.fZ *= scale; +} + MatrixDecomposition::MatrixDecomposition(SkMatrix44 matrix) : valid_(false) { if (matrix.get(3, 3) == 0) { return; @@ -83,14 +92,14 @@ MatrixDecomposition::MatrixDecomposition(SkMatrix44 matrix) : valid_(false) { scale_.fX = row[0].length(); - row[0].normalize(); + SkVector3Normalize(row[0]); shear_.fX = row[0].dot(row[1]); row[1] = SkVector3Combine(row[1], 1.0, row[0], -shear_.fX); scale_.fY = row[1].length(); - row[1].normalize(); + SkVector3Normalize(row[1]); shear_.fX /= scale_.fY; @@ -101,7 +110,7 @@ MatrixDecomposition::MatrixDecomposition(SkMatrix44 matrix) : valid_(false) { scale_.fZ = row[2].length(); - row[2].normalize(); + SkVector3Normalize(row[2]); shear_.fY /= scale_.fZ; shear_.fZ /= scale_.fZ; diff --git a/flow/matrix_decomposition_unittests.cc b/flow/matrix_decomposition_unittests.cc index 3c1b7d6c9b77b..3b9f8ed815ff6 100644 --- a/flow/matrix_decomposition_unittests.cc +++ b/flow/matrix_decomposition_unittests.cc @@ -95,8 +95,7 @@ TEST(MatrixDecomposition, Combination) { } TEST(MatrixDecomposition, ScaleFloatError) { - // Strange behavior under 0.000245 due to underflow issues. - for (float scale = 0.000245f; scale < 2.0f; scale += 0.000001f) { + for (float scale = 0.0001f; scale < 2.0f; scale += 0.000001f) { SkMatrix44 matrix = SkMatrix44::I(); matrix.setScale(scale, scale, 1.0f); diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index aadebb72d039e..a3aef6e3d1410 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -17,16 +17,12 @@ namespace flow { -void RasterCacheResult::draw( - SkCanvas& canvas, - const SkMatrix& root_surface_transformation) const { +void RasterCacheResult::draw(SkCanvas& canvas) const { SkAutoCanvasRestore auto_restore(&canvas, true); SkIRect bounds = RasterCache::GetDeviceBounds(logical_rect_, canvas.getTotalMatrix()); FML_DCHECK(bounds.size() == image_->dimensions()); - // Clear all transformations on the canvas except the root surface - // transormation. - canvas.setMatrix(root_surface_transformation); + canvas.resetMatrix(); canvas.drawImage(image_, bounds.fLeft, bounds.fTop); } diff --git a/flow/raster_cache.h b/flow/raster_cache.h index b2084d3bf1c74..348ab8000da39 100644 --- a/flow/raster_cache.h +++ b/flow/raster_cache.h @@ -28,8 +28,7 @@ class RasterCacheResult { bool is_valid() const { return static_cast(image_); }; - void draw(SkCanvas& canvas, - const SkMatrix& root_surface_transformation) const; + void draw(SkCanvas& canvas) const; private: sk_sp image_; diff --git a/fml/BUILD.gn b/fml/BUILD.gn index d49558bdad965..94f7dafbbdc91 100644 --- a/fml/BUILD.gn +++ b/fml/BUILD.gn @@ -166,6 +166,7 @@ executable("fml_unittests") { "memory/weak_ptr_unittest.cc", "message_loop_unittests.cc", "message_unittests.cc", + "paths_unittests.cc", "string_view_unittest.cc", "synchronization/thread_annotations_unittest.cc", "synchronization/thread_checker_unittest.cc", diff --git a/fml/memory/ref_counted_unittest.cc b/fml/memory/ref_counted_unittest.cc index 40b7bd095d412..5b6f68e1de6d1 100644 --- a/fml/memory/ref_counted_unittest.cc +++ b/fml/memory/ref_counted_unittest.cc @@ -29,6 +29,16 @@ #define ALLOW_SELF_MOVE(code_line) code_line; #endif +#if defined(__clang__) +#define ALLOW_SELF_ASSIGN_OVERLOADED(code_line) \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wself-assign-overloaded\"") \ + code_line; \ + _Pragma("clang diagnostic pop") +#else +#define ALLOW_SELF_ASSIGN_OVERLOADED(code_line) code_line; +#endif + namespace fml { namespace { @@ -425,7 +435,7 @@ TEST(RefCountedTest, SelfAssignment) { was_destroyed = false; RefPtr r(MakeRefCounted(&created, &was_destroyed)); // Copy. - r = r; + ALLOW_SELF_ASSIGN_OVERLOADED(r = r); EXPECT_EQ(created, r.get()); EXPECT_FALSE(was_destroyed); } diff --git a/fml/paths.cc b/fml/paths.cc index 840e2116379fc..563595ad147a4 100644 --- a/fml/paths.cc +++ b/fml/paths.cc @@ -29,5 +29,25 @@ std::string JoinPaths(std::initializer_list components) { return stream.str(); } +std::string SanitizeURIEscapedCharacters(const std::string& str) { + std::string result; + result.reserve(str.size()); + for (std::string::size_type i = 0; i < str.size(); ++i) { + if (str[i] == '%') { + if (i > str.size() - 3 || !isxdigit(str[i + 1]) || !isxdigit(str[i + 2])) + return ""; + const std::string hex = str.substr(i + 1, 2); + const unsigned char c = strtoul(hex.c_str(), nullptr, 16); + if (!c) + return ""; + result += c; + i += 2; + } else { + result += str[i]; + } + } + return result; +} + } // namespace paths } // namespace fml diff --git a/fml/paths.h b/fml/paths.h index e1b2f7dbffa35..cccf635786fa3 100644 --- a/fml/paths.h +++ b/fml/paths.h @@ -22,6 +22,12 @@ std::string AbsolutePath(const std::string& path); // Returns the directory name component of the given path. std::string GetDirectoryName(const std::string& path); +// Decodes a URI encoded string. +std::string SanitizeURIEscapedCharacters(const std::string& str); + +// Converts a file URI to a path. +std::string FromURI(const std::string& uri); + } // namespace paths } // namespace fml diff --git a/fml/paths_unittests.cc b/fml/paths_unittests.cc new file mode 100644 index 0000000000000..a1df4ea214e0f --- /dev/null +++ b/fml/paths_unittests.cc @@ -0,0 +1,17 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "gtest/gtest.h" + +#include "flutter/fml/paths.h" + +TEST(Paths, SanitizeURI) { + ASSERT_EQ(fml::paths::SanitizeURIEscapedCharacters("hello"), "hello"); + ASSERT_EQ(fml::paths::SanitizeURIEscapedCharacters(""), ""); + ASSERT_EQ(fml::paths::SanitizeURIEscapedCharacters("hello%20world"), + "hello world"); + ASSERT_EQ(fml::paths::SanitizeURIEscapedCharacters( + "%5Chello%5cworld%20foo%20bar%21"), + "\\hello\\world foo bar!"); +} diff --git a/fml/platform/linux/timerfd.h b/fml/platform/linux/timerfd.h index 5c4b965457133..4a56af5553828 100644 --- a/fml/platform/linux/timerfd.h +++ b/fml/platform/linux/timerfd.h @@ -8,7 +8,10 @@ #include "flutter/fml/time/time_point.h" // clang-format off -#if __has_include() +#if __has_include() && \ + (!defined(__ANDROID_API__) || __ANDROID_API__ >= 19) + // sys/timerfd.h is always present in Android NDK due to unified headers, + // but timerfd functions are only available on API 19 or later. // clang-format on #include diff --git a/fml/platform/posix/paths_posix.cc b/fml/platform/posix/paths_posix.cc index 98dee43666b0f..6b93d6f97a8aa 100644 --- a/fml/platform/posix/paths_posix.cc +++ b/fml/platform/posix/paths_posix.cc @@ -14,6 +14,9 @@ namespace paths { namespace { +constexpr char kFileURLPrefix[] = "file://"; +constexpr size_t kFileURLPrefixLength = sizeof(kFileURLPrefix) - 1; + std::string GetCurrentDirectory() { char buffer[PATH_MAX]; FML_CHECK(getcwd(buffer, sizeof(buffer))); @@ -44,5 +47,13 @@ std::string GetDirectoryName(const std::string& path) { return path.substr(0, separator); } +std::string FromURI(const std::string& uri) { + if (uri.substr(0, kFileURLPrefixLength) != kFileURLPrefix) + return uri; + + std::string file_path = uri.substr(kFileURLPrefixLength); + return SanitizeURIEscapedCharacters(file_path); +} + } // namespace paths -} // namespace fml \ No newline at end of file +} // namespace fml diff --git a/fml/platform/win/paths_win.cc b/fml/platform/win/paths_win.cc index b64aa25fff551..5f6604bb39879 100644 --- a/fml/platform/win/paths_win.cc +++ b/fml/platform/win/paths_win.cc @@ -5,6 +5,7 @@ #include "flutter/fml/paths.h" #include +#include #include "flutter/fml/paths.h" @@ -13,6 +14,9 @@ namespace paths { namespace { +constexpr char kFileURLPrefix[] = "file:///"; +constexpr size_t kFileURLPrefixLength = sizeof(kFileURLPrefix) - 1; + size_t RootLength(const std::string& path) { if (path.size() == 0) return 0; @@ -77,5 +81,14 @@ std::string GetDirectoryName(const std::string& path) { return path.substr(0, separator); } +std::string FromURI(const std::string& uri) { + if (uri.substr(0, kFileURLPrefixLength) != kFileURLPrefix) + return uri; + + std::string file_path = uri.substr(kFileURLPrefixLength); + std::replace(file_path.begin(), file_path.end(), '/', '\\'); + return SanitizeURIEscapedCharacters(file_path); +} + } // namespace paths } // namespace fml diff --git a/frontend_server/lib/server.dart b/frontend_server/lib/server.dart index 804c5699eb2f8..37f61d039a940 100644 --- a/frontend_server/lib/server.dart +++ b/frontend_server/lib/server.dart @@ -39,6 +39,11 @@ class _FlutterFrontendCompiler implements frontend.CompilerInterface{ _compiler.acceptLastDelta(); } + @override + Future rejectLastDelta() async { + return _compiler.rejectLastDelta(); + } + @override void invalidate(Uri uri) { _compiler.invalidate(uri); @@ -73,7 +78,7 @@ class _FlutterFrontendCompiler implements frontend.CompilerInterface{ /// version for testing. Future starter( List args, { - _FlutterFrontendCompiler compiler, + frontend.CompilerInterface compiler, Stream> input, StringSink output, }) async { diff --git a/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn index d257830ebd6ba..b7b1f0c7aae0e 100644 --- a/lib/snapshot/BUILD.gn +++ b/lib/snapshot/BUILD.gn @@ -25,36 +25,21 @@ copy("generate_dart_ui") { ] } -action("generate_snapshot_bin") { - if (is_fuchsia) { - snapshot_dart = "snapshot_fuchsia.dart" - - # TODO(rmacnak): Fuchsia cross builds use the wrong Dart target - # architecture, and have added steps that depend on this error for - # reasonable build times (e.g., invoking the analyzer). - if (target_cpu == host_cpu) { - snapshot_kind = "core-jit" - } else { - snapshot_kind = "core" - } +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" } else { - snapshot_dart = "snapshot.dart" - snapshot_kind = "core" + platform_kernel = "$root_out_dir/flutter_patched_sdk/platform_strong.dill" } + inputs = [ + platform_kernel, + ] deps = [ - ":generate_dart_ui", - "//third_party/dart/runtime/bin:gen_snapshot($host_toolchain)", + ":kernel_platform_files", ] - depfile = "$target_gen_dir/core_snapshot.d" - - inputs = [ - "//third_party/dart/runtime/tools/create_snapshot_bin.py", - snapshot_dart, - ] + dart_ui_files - if (is_fuchsia) { - inputs += [ "fuchsia_compilation_trace.txt" ] - } vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin" vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin" @@ -68,63 +53,29 @@ action("generate_snapshot_bin") { isolate_snapshot_instructions, ] - rebased_dart_ui_path = rebase_path(dart_ui_path) - - gen_snapshot_dir = get_label_info( - "//third_party/dart/runtime/bin:gen_snapshot($host_toolchain)", - "root_out_dir") - script = "//third_party/dart/runtime/tools/create_snapshot_bin.py" - args = [ - "--executable", - rebase_path("$gen_snapshot_dir/gen_snapshot"), - "--script", - rebase_path(snapshot_dart), - "--snapshot_kind", - snapshot_kind, - "--vm_flag", + "--strong", + "--sync-async", + "--reify-generic-functions", + "--snapshot_kind=core", "--await_is_keyword", - "--vm_flag", "--enable_mirrors=false", - "--vm_output_bin", - rebase_path(vm_snapshot_data, root_build_dir), - "--vm_instructions_output_bin", - rebase_path(vm_snapshot_instructions, root_build_dir), - "--isolate_output_bin", - rebase_path(isolate_snapshot_data, root_build_dir), - "--isolate_instructions_output_bin", - rebase_path(isolate_snapshot_instructions, root_build_dir), - "--url_mapping=dart:ui,$rebased_dart_ui_path", - "--vm_flag", - "--dependencies=" + rebase_path(depfile), + "--vm_snapshot_data=" + rebase_path(vm_snapshot_data), + "--vm_snapshot_instructions=" + rebase_path(vm_snapshot_instructions), + "--isolate_snapshot_data=" + rebase_path(isolate_snapshot_data), + "--isolate_snapshot_instructions=" + + rebase_path(isolate_snapshot_instructions), + rebase_path(platform_kernel), ] if (is_debug) { args += [ - "--vm_flag", "--enable_asserts", - "--vm_flag", "--enable_type_checks", - "--vm_flag", "--error_on_bad_type", - "--vm_flag", "--error_on_bad_override", ] } - - if (is_fuchsia) { - inputs += zircon_sdk_ext_files + mozart_dart_sdk_ext_files - zircon_path = rebase_path(zircon_sdk_ext_lib) - fuchsia_path = rebase_path(fuchsia_sdk_ext_lib) - mozart_internal_path = rebase_path(mozart_dart_sdk_ext_lib) - args += [ - "--url_mapping=dart:zircon,$zircon_path", - "--url_mapping=dart:fuchsia,$fuchsia_path", - "--url_mapping=dart:mozart.internal,$mozart_internal_path", - "--load_compilation_trace", - rebase_path("fuchsia_compilation_trace.txt"), - ] - } } # Generates an assembly file defining a given symbol with the bytes from a @@ -247,11 +198,20 @@ compile_platform("strong_platform") { ] } -group("kernel_platform_files") { - public_deps = [ - ":non_strong_platform", - ":strong_platform", - ] +# Fuchsia's snapshot requires a different platform with extra dart: libraries. +if (is_fuchsia || is_fuchsia_host) { + group("kernel_platform_files") { + public_deps = [ + "//topaz/runtime/flutter_runner/kernel:kernel_platform_files" + ] + } +} else { + group("kernel_platform_files") { + public_deps = [ + ":non_strong_platform", + ":strong_platform", + ] + } } # Template to generate entry points JSON file using gen_snapshot tool. @@ -282,22 +242,31 @@ template("generate_entry_points_json_with_gen_snapshot") { output = invoker.output tool = "//third_party/dart/runtime/bin:gen_snapshot" - inputs = [ - input, - ] + extra_inputs + inputs = [ input ] + extra_inputs outputs = [ output, + + # Though they are not consumed, GN needs to know to create the output directory. + "$target_gen_dir/dummy.vm_data.snapshot", + "$target_gen_dir/dummy.vm_instr.snapshot", + "$target_gen_dir/dummy.isolate_data.snapshot", + "$target_gen_dir/dummy.isolate_instr.snapshot", ] args = [ - "--print-precompiler-entry-points=" + rebase_path(output), - "--snapshot-kind=app-aot-blobs", - "--vm_snapshot_data=" + rebase_path("$target_gen_dir/dummy.vm_data.snapshot"), - "--vm_snapshot_instructions=" + rebase_path("$target_gen_dir/dummy.vm_instr.snapshot"), - "--isolate_snapshot_data=" + rebase_path("$target_gen_dir/dummy.isolate_data.snapshot"), - "--isolate_snapshot_instructions=" + rebase_path("$target_gen_dir/dummy.isolate_instr.snapshot"), - ] + extra_args + [ - rebase_path(input), - ] + "--no-strong", + "--no-sync-async", + "--no-reify-generic-functions", + "--print-precompiler-entry-points=" + rebase_path(output), + "--snapshot-kind=app-aot-blobs", + "--vm_snapshot_data=" + + rebase_path("$target_gen_dir/dummy.vm_data.snapshot"), + "--vm_snapshot_instructions=" + + rebase_path("$target_gen_dir/dummy.vm_instr.snapshot"), + "--isolate_snapshot_data=" + + rebase_path("$target_gen_dir/dummy.isolate_data.snapshot"), + "--isolate_snapshot_instructions=" + + rebase_path("$target_gen_dir/dummy.isolate_instr.snapshot"), + ] + extra_args + [ rebase_path(input) ] } } diff --git a/lib/ui/compositing.dart b/lib/ui/compositing.dart index d27533c76af4a..ff2cbec389933 100644 --- a/lib/ui/compositing.dart +++ b/lib/ui/compositing.dart @@ -15,6 +15,7 @@ class Scene extends NativeFieldWrapperClass2 { /// or extended directly. /// /// To create a Scene object, use a [SceneBuilder]. + @pragma('vm:entry-point') Scene._(); @@ -45,6 +46,7 @@ class Scene extends NativeFieldWrapperClass2 { /// it to the scene using [addPicture]. class SceneBuilder extends NativeFieldWrapperClass2 { /// Creates an empty [SceneBuilder] object. + @pragma('vm:entry-point') SceneBuilder() { _constructor(); } void _constructor() native 'SceneBuilder_constructor'; diff --git a/lib/ui/compositing/scene_builder.cc b/lib/ui/compositing/scene_builder.cc index 61a3c60ddee3e..bf3e8c0ed4a6e 100644 --- a/lib/ui/compositing/scene_builder.cc +++ b/lib/ui/compositing/scene_builder.cc @@ -4,6 +4,24 @@ #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" +#include "flutter/flow/layers/color_filter_layer.h" +#include "flutter/flow/layers/container_layer.h" +#include "flutter/flow/layers/layer.h" +#include "flutter/flow/layers/layer_tree.h" +#include "flutter/flow/layers/opacity_layer.h" +#include "flutter/flow/layers/performance_overlay_layer.h" +#include "flutter/flow/layers/physical_shape_layer.h" +#include "flutter/flow/layers/picture_layer.h" +#include "flutter/flow/layers/shader_mask_layer.h" +#include "flutter/flow/layers/texture_layer.h" +#include "flutter/flow/layers/transform_layer.h" #include "flutter/fml/build_config.h" #include "flutter/lib/ui/painting/matrix.h" #include "flutter/lib/ui/painting/shader.h" @@ -51,12 +69,28 @@ void SceneBuilder::RegisterNatives(tonic::DartLibraryNatives* natives) { FOR_EACH_BINDING(DART_REGISTER_NATIVE)}); } -SceneBuilder::SceneBuilder() : layer_builder_(flow::LayerBuilder::Create()) {} +static const SkRect kGiantRect = SkRect::MakeLTRB(-1E9F, -1E9F, 1E9F, 1E9F); + +SceneBuilder::SceneBuilder() { + cull_rects_.push(kGiantRect); +} SceneBuilder::~SceneBuilder() = default; void SceneBuilder::pushTransform(const tonic::Float64List& matrix4) { - layer_builder_->PushTransform(ToSkMatrix(matrix4)); + SkMatrix sk_matrix = ToSkMatrix(matrix4); + SkMatrix inverse_sk_matrix; + SkRect cullRect; + // Perspective projections don't produce rectangles that are useful for + // culling for some reason. + if (!sk_matrix.hasPerspective() && sk_matrix.invert(&inverse_sk_matrix)) { + inverse_sk_matrix.mapRect(&cullRect, cull_rects_.top()); + } else { + cullRect = kGiantRect; + } + auto layer = std::make_unique(); + layer->set_transform(sk_matrix); + PushLayer(std::move(layer), cullRect); } void SceneBuilder::pushClipRect(double left, @@ -64,31 +98,57 @@ void SceneBuilder::pushClipRect(double left, double top, double bottom, int clipBehavior) { - layer_builder_->PushClipRect(SkRect::MakeLTRB(left, top, right, bottom), - static_cast(clipBehavior)); + SkRect clipRect = SkRect::MakeLTRB(left, top, right, bottom); + flow::Clip clip_behavior = static_cast(clipBehavior); + SkRect cullRect; + if (!cullRect.intersect(clipRect, cull_rects_.top())) { + cullRect = SkRect::MakeEmpty(); + } + auto layer = std::make_unique(clip_behavior); + layer->set_clip_rect(clipRect); + PushLayer(std::move(layer), cullRect); } void SceneBuilder::pushClipRRect(const RRect& rrect, int clipBehavior) { - layer_builder_->PushClipRoundedRect(rrect.sk_rrect, - static_cast(clipBehavior)); + flow::Clip clip_behavior = static_cast(clipBehavior); + SkRect cullRect; + if (!cullRect.intersect(rrect.sk_rrect.rect(), cull_rects_.top())) { + cullRect = SkRect::MakeEmpty(); + } + auto layer = std::make_unique(clip_behavior); + layer->set_clip_rrect(rrect.sk_rrect); + PushLayer(std::move(layer), cullRect); } void SceneBuilder::pushClipPath(const CanvasPath* path, int clipBehavior) { - layer_builder_->PushClipPath(path->path(), - static_cast(clipBehavior)); + flow::Clip clip_behavior = static_cast(clipBehavior); + FML_DCHECK(clip_behavior != flow::Clip::none); + SkRect cullRect; + if (!cullRect.intersect(path->path().getBounds(), cull_rects_.top())) { + cullRect = SkRect::MakeEmpty(); + } + auto layer = std::make_unique(clip_behavior); + layer->set_clip_path(path->path()); + PushLayer(std::move(layer), cullRect); } void SceneBuilder::pushOpacity(int alpha) { - layer_builder_->PushOpacity(alpha); + auto layer = std::make_unique(); + layer->set_alpha(alpha); + PushLayer(std::move(layer), cull_rects_.top()); } void SceneBuilder::pushColorFilter(int color, int blendMode) { - layer_builder_->PushColorFilter(static_cast(color), - static_cast(blendMode)); + auto layer = std::make_unique(); + layer->set_color(static_cast(color)); + layer->set_blend_mode(static_cast(blendMode)); + PushLayer(std::move(layer), cull_rects_.top()); } void SceneBuilder::pushBackdropFilter(ImageFilter* filter) { - layer_builder_->PushBackdropFilter(filter->filter()); + auto layer = std::make_unique(); + layer->set_filter(filter->filter()); + PushLayer(std::move(layer), cull_rects_.top()); } void SceneBuilder::pushShaderMask(Shader* shader, @@ -97,41 +157,63 @@ void SceneBuilder::pushShaderMask(Shader* shader, double maskRectTop, double maskRectBottom, int blendMode) { - layer_builder_->PushShaderMask( - shader->shader(), - SkRect::MakeLTRB(maskRectLeft, maskRectTop, maskRectRight, - maskRectBottom), - static_cast(blendMode)); + SkRect rect = SkRect::MakeLTRB(maskRectLeft, maskRectTop, maskRectRight, + maskRectBottom); + auto layer = std::make_unique(); + layer->set_shader(shader->shader()); + layer->set_mask_rect(rect); + layer->set_blend_mode(static_cast(blendMode)); + PushLayer(std::move(layer), cull_rects_.top()); } void SceneBuilder::pushPhysicalShape(const CanvasPath* path, double elevation, int color, int shadow_color, - int clip_behavior) { - layer_builder_->PushPhysicalShape( - path->path(), // - elevation, // - static_cast(color), // - static_cast(shadow_color), - UIDartState::Current()->window()->viewport_metrics().device_pixel_ratio, - static_cast(clip_behavior)); + int clipBehavior) { + const SkPath& sk_path = path->path(); + flow::Clip clip_behavior = static_cast(clipBehavior); + SkRect cullRect; + if (!cullRect.intersect(sk_path.getBounds(), cull_rects_.top())) { + cullRect = SkRect::MakeEmpty(); + } + auto layer = std::make_unique(clip_behavior); + layer->set_path(sk_path); + layer->set_elevation(elevation); + layer->set_color(static_cast(color)); + layer->set_shadow_color(static_cast(shadow_color)); + layer->set_device_pixel_ratio( + UIDartState::Current()->window()->viewport_metrics().device_pixel_ratio); + PushLayer(std::move(layer), cullRect); } void SceneBuilder::pop() { - layer_builder_->Pop(); + if (!current_layer_) { + return; + } + cull_rects_.pop(); + current_layer_ = current_layer_->parent(); } void SceneBuilder::addPicture(double dx, double dy, Picture* picture, int hints) { - layer_builder_->PushPicture( - SkPoint::Make(dx, dy), // - UIDartState::CreateGPUObject(picture->picture()), // - !!(hints & 1), // picture is complex - !!(hints & 2) // picture will change - ); + if (!current_layer_) { + return; + } + SkPoint offset = SkPoint::Make(dx, dy); + SkRect pictureRect = picture->picture()->cullRect(); + pictureRect.offset(offset.x(), offset.y()); + if (!SkRect::Intersects(pictureRect, cull_rects_.top())) { + return; + } + auto layer = std::make_unique(); + layer->set_offset(offset); + layer->set_picture(UIDartState::CreateGPUObject(picture->picture())); + layer->set_is_complex(!!(hints & 1)); + layer->set_will_change(!!(hints & 2)); + current_layer_->Add(std::move(layer)); } void SceneBuilder::addTexture(double dx, @@ -140,8 +222,15 @@ void SceneBuilder::addTexture(double dx, double height, int64_t textureId, bool freeze) { - layer_builder_->PushTexture(SkPoint::Make(dx, dy), - SkSize::Make(width, height), textureId, freeze); + 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_texture_id(textureId); + layer->set_freeze(freeze); + current_layer_->Add(std::move(layer)); } void SceneBuilder::addChildScene(double dx, @@ -151,10 +240,19 @@ void SceneBuilder::addChildScene(double dx, SceneHost* sceneHost, bool hitTestable) { #if defined(OS_FUCHSIA) - layer_builder_->PushChildScene(SkPoint::Make(dx, dy), // - SkSize::Make(width, height), // - sceneHost->export_node_holder(), // - hitTestable); + if (!current_layer_) { + return; + } + SkRect sceneRect = SkRect::MakeXYWH(dx, dy, width, height); + if (!SkRect::Intersects(sceneRect, cull_rects_.top())) { + 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); + current_layer_->Add(std::move(layer)); #endif // defined(OS_FUCHSIA) } @@ -163,30 +261,54 @@ void SceneBuilder::addPerformanceOverlay(uint64_t enabledOptions, double right, double top, double bottom) { - layer_builder_->PushPerformanceOverlay( - enabledOptions, SkRect::MakeLTRB(left, top, right, bottom)); + if (!current_layer_) { + return; + } + SkRect rect = SkRect::MakeLTRB(left, top, right, bottom); + auto layer = std::make_unique(enabledOptions); + layer->set_paint_bounds(rect); + current_layer_->Add(std::move(layer)); } void SceneBuilder::setRasterizerTracingThreshold(uint32_t frameInterval) { - layer_builder_->SetRasterizerTracingThreshold(frameInterval); + rasterizer_tracing_threshold_ = frameInterval; } void SceneBuilder::setCheckerboardRasterCacheImages(bool checkerboard) { - layer_builder_->SetCheckerboardRasterCacheImages(checkerboard); + checkerboard_raster_cache_images_ = checkerboard; } void SceneBuilder::setCheckerboardOffscreenLayers(bool checkerboard) { - layer_builder_->SetCheckerboardOffscreenLayers(checkerboard); + checkerboard_offscreen_layers_ = checkerboard; } fml::RefPtr SceneBuilder::build() { - fml::RefPtr scene = - Scene::create(layer_builder_->TakeLayer(), - layer_builder_->GetRasterizerTracingThreshold(), - layer_builder_->GetCheckerboardRasterCacheImages(), - layer_builder_->GetCheckerboardOffscreenLayers()); + fml::RefPtr scene = Scene::create( + std::move(root_layer_), rasterizer_tracing_threshold_, + checkerboard_raster_cache_images_, checkerboard_offscreen_layers_); ClearDartWrapper(); return scene; } +void SceneBuilder::PushLayer(std::unique_ptr layer, + const SkRect& cullRect) { + FML_DCHECK(layer); + + cull_rects_.push(cullRect); + + if (!root_layer_) { + root_layer_ = std::move(layer); + current_layer_ = root_layer_.get(); + return; + } + + if (!current_layer_) { + return; + } + + flow::ContainerLayer* newLayer = layer.get(); + current_layer_->Add(std::move(layer)); + current_layer_ = newLayer; +} + } // namespace blink diff --git a/lib/ui/compositing/scene_builder.h b/lib/ui/compositing/scene_builder.h index 0ad46b36138a1..fc7bcc6a956f7 100644 --- a/lib/ui/compositing/scene_builder.h +++ b/lib/ui/compositing/scene_builder.h @@ -9,7 +9,6 @@ #include #include -#include "flutter/flow/layers/layer_builder.h" #include "flutter/lib/ui/compositing/scene.h" #include "flutter/lib/ui/compositing/scene_host.h" #include "flutter/lib/ui/dart_wrapper.h" @@ -92,7 +91,19 @@ class SceneBuilder : public RefCountedDartWrappable { private: SceneBuilder(); - std::unique_ptr layer_builder_; + std::unique_ptr root_layer_; + flow::ContainerLayer* current_layer_ = nullptr; + + std::stack cull_rects_; + + int rasterizer_tracing_threshold_ = 0; + bool checkerboard_raster_cache_images_ = false; + bool checkerboard_offscreen_layers_ = false; + + void PushLayer(std::unique_ptr layer, + const SkRect& cullRect); + + FML_DISALLOW_COPY_AND_ASSIGN(SceneBuilder); }; } // namespace blink diff --git a/lib/ui/geometry.dart b/lib/ui/geometry.dart index 8f833741388d8..df3faa39850db 100644 --- a/lib/ui/geometry.dart +++ b/lib/ui/geometry.dart @@ -589,6 +589,7 @@ class Rect { Rect._(); /// Construct a rectangle from its left, top, right, and bottom edges. + @pragma('vm:entry-point') Rect.fromLTRB(double left, double top, double right, double bottom) { _value ..[0] = left diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index f644ef8481c0d..65c5529f156d8 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -12,6 +12,7 @@ dynamic _decodeJSON(String message) { return message != null ? json.decode(message) : null; } +@pragma('vm:entry-point') void _updateWindowMetrics(double devicePixelRatio, double width, double height, @@ -43,13 +44,16 @@ typedef _LocaleClosure = String Function(); String _localeClosure() => window._locale.toString(); +@pragma('vm:entry-point') _LocaleClosure _getLocaleClosure() => _localeClosure; +@pragma('vm:entry-point') void _updateLocale(String languageCode, String countryCode) { window._locale = new Locale(languageCode, countryCode); _invoke(window.onLocaleChanged, window._onLocaleChangedZone); } +@pragma('vm:entry-point') void _updateUserSettingsData(String jsonData) { final Map data = json.decode(jsonData); _updateTextScaleFactor(data['textScaleFactor'].toDouble()); @@ -65,11 +69,13 @@ void _updateAlwaysUse24HourFormat(bool alwaysUse24HourFormat) { window._alwaysUse24HourFormat = alwaysUse24HourFormat; } +@pragma('vm:entry-point') void _updateSemanticsEnabled(bool enabled) { window._semanticsEnabled = enabled; _invoke(window.onSemanticsEnabledChanged, window._onSemanticsEnabledChangedZone); } +@pragma('vm:entry-point') void _updateAccessibilityFeatures(int values) { final AccessibilityFeatures newFeatures = new AccessibilityFeatures._(values); if (newFeatures == window._accessibilityFeatures) @@ -78,6 +84,7 @@ void _updateAccessibilityFeatures(int values) { _invoke(window.onAccessibilityFeaturesChanged, window._onAccessibilityFlagsChangedZone); } +@pragma('vm:entry-point') void _dispatchPlatformMessage(String name, ByteData data, int responseId) { if (window.onPlatformMessage != null) { _invoke3( @@ -94,11 +101,13 @@ void _dispatchPlatformMessage(String name, ByteData data, int responseId) { } } +@pragma('vm:entry-point') void _dispatchPointerDataPacket(ByteData packet) { if (window.onPointerDataPacket != null) _invoke1(window.onPointerDataPacket, window._onPointerDataPacketZone, _unpackPointerDataPacket(packet)); } +@pragma('vm:entry-point') void _dispatchSemanticsAction(int id, int action, ByteData args) { _invoke3( window.onSemanticsAction, @@ -109,10 +118,12 @@ void _dispatchSemanticsAction(int id, int action, ByteData args) { ); } +@pragma('vm:entry-point') void _beginFrame(int microseconds) { _invoke1(window.onBeginFrame, window._onBeginFrameZone, new Duration(microseconds: microseconds)); } +@pragma('vm:entry-point') void _drawFrame() { _invoke(window.onDrawFrame, window._onDrawFrameZone); } diff --git a/lib/ui/natives.dart b/lib/ui/natives.dart index c31ecb0b6f51a..49a582c4e930f 100644 --- a/lib/ui/natives.dart +++ b/lib/ui/natives.dart @@ -27,6 +27,7 @@ Future _scheduleFrame( })); } +@pragma('vm:entry-point') void _setupHooks() { assert(() { // In debug mode, register the schedule frame extension. @@ -54,7 +55,9 @@ Function _getCallbackFromHandle(int handle) native 'GetCallbackFromHandle'; // Required for gen_snapshot to work correctly. int _isolateId; +@pragma('vm:entry-point') Function _getPrintClosure() => _print; +@pragma('vm:entry-point') Function _getScheduleMicrotaskClosure() => _scheduleMicrotask; // Though the "main" symbol is not included in any of the libraries imported @@ -62,4 +65,5 @@ Function _getScheduleMicrotaskClosure() => _scheduleMicrotask; // symbol is only necessary for precompilation. It is marked as a stanalone // entry point into the VM. This prevents the precompiler from tree shaking // away "main". +@pragma('vm:entry-point') Function _getMainClosure() => main; diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index e2fe0521a6ac7..af408b4f75ad8 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -102,6 +102,7 @@ class Color { /// 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. @@ -1065,6 +1066,7 @@ class Paint { 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; @@ -1081,6 +1083,7 @@ class Paint { 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; @@ -1363,6 +1366,18 @@ class Paint { } } + /// 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(); @@ -1411,8 +1426,12 @@ class Paint { result.write('${semicolon}filterQuality: $filterQuality'); semicolon = '; '; } - if (shader != null) + if (shader != null) { result.write('${semicolon}shader: $shader'); + semicolon = '; '; + } + if (invertColors) + result.write('${semicolon}invert: $invertColors'); result.write(')'); return result.toString(); } @@ -1467,9 +1486,14 @@ class _ImageInfo { _ImageInfo(this.width, this.height, this.format, this.rowBytes) { rowBytes ??= width * 4; } + + @pragma('vm:entry-point', 'get') int width; + @pragma('vm:entry-point', 'get') int height; + @pragma('vm:entry-point', 'get') int format; + @pragma('vm:entry-point', 'get') int rowBytes; } @@ -1484,6 +1508,7 @@ class Image extends NativeFieldWrapperClass2 { /// or extended directly. /// /// To obtain an [Image] object, use [instantiateImageCodec]. + @pragma('vm:entry-point') Image._(); /// The number of image pixels along the image's horizontal axis. @@ -1531,6 +1556,7 @@ class FrameInfo extends NativeFieldWrapperClass2 { /// /// To obtain an instance of the [FrameInfo] interface, see /// [Codec.getNextFrame]. + @pragma('vm:entry-point') FrameInfo._(); /// The duration this frame should be shown. @@ -1548,6 +1574,7 @@ class Codec extends NativeFieldWrapperClass2 { /// /// To obtain an instance of the [Codec] interface, see /// [instantiateImageCodec]. + @pragma('vm:entry-point') Codec._(); /// Number of frames in this image. @@ -1734,6 +1761,7 @@ enum PathOperation { /// used to create clip regions using [Canvas.clipPath]. class Path extends NativeFieldWrapperClass2 { /// Create a new empty [Path] object. + @pragma('vm:entry-point') Path() { _constructor(); } void _constructor() native 'Path_constructor'; @@ -2383,6 +2411,7 @@ class ImageFilter extends NativeFieldWrapperClass2 { class Shader extends NativeFieldWrapperClass2 { /// This class is created by the engine, and should not be instantiated /// or extended directly. + @pragma('vm:entry-point') Shader._(); } @@ -2646,6 +2675,7 @@ class ImageShader extends Shader { /// 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. + @pragma('vm:entry-point') ImageShader(Image image, TileMode tmx, TileMode tmy, Float64List matrix4) : assert(image != null), // image is checked on the engine side assert(tmx != null), @@ -2810,6 +2840,7 @@ class Canvas extends NativeFieldWrapperClass2 { /// /// To end the recording, call [PictureRecorder.endRecording] on the /// given recorder. + @pragma('vm:entry-point') Canvas(PictureRecorder recorder, [ Rect cullRect ]) : assert(recorder != null) { if (recorder.isRecording) throw new ArgumentError('"recorder" must not already be associated with another Canvas.'); @@ -3527,6 +3558,7 @@ class Picture extends NativeFieldWrapperClass2 { /// or extended directly. /// /// To create a [Picture], use a [PictureRecorder]. + @pragma('vm:entry-point') Picture._(); /// Creates an image from this picture. @@ -3557,6 +3589,7 @@ class PictureRecorder extends NativeFieldWrapperClass2 { /// Creates a new idle PictureRecorder. To associate it with a /// [Canvas] and begin recording, pass this [PictureRecorder] to the /// [Canvas] constructor. + @pragma('vm:entry-point') PictureRecorder() { _constructor(); } void _constructor() native 'PictureRecorder_constructor'; @@ -3622,4 +3655,3 @@ Future _futurize(_Callbacker callbacker) { throw new Exception(error); return completer.future; } - diff --git a/lib/ui/painting/paint.cc b/lib/ui/painting/paint.cc index 00631451549ee..9b876542a61a7 100644 --- a/lib/ui/painting/paint.cc +++ b/lib/ui/painting/paint.cc @@ -30,6 +30,7 @@ constexpr int kColorFilterBlendModeIndex = 11; constexpr int kMaskFilterIndex = 12; constexpr int kMaskFilterBlurStyleIndex = 13; constexpr int kMaskFilterSigmaIndex = 14; +constexpr int kInvertColorIndex = 15; constexpr size_t kDataByteCount = 75; // 4 * (last index + 1) // Indices for objects. @@ -47,6 +48,16 @@ constexpr uint32_t kBlendModeDefault = // default SkPaintDefaults_MiterLimit in Skia (which is not in a public header). constexpr double kStrokeMiterLimitDefault = 4.0; +// A color matrix which inverts colors. +// clang-format off +constexpr SkScalar invert_colors[20] = { + -1.0, 0, 0, 1.0, 0, + 0, -1.0, 0, 1.0, 0, + 0, 0, -1.0, 1.0, 0, + 1.0, 1.0, 1.0, 1.0, 0 +}; +// clang-format on + // Must be kept in sync with the MaskFilter private constants in painting.dart. enum MaskFilterType { Null, Blur }; @@ -116,7 +127,19 @@ Paint::Paint(Dart_Handle paint_objects, Dart_Handle paint_data) { if (filter_quality) paint_.setFilterQuality(static_cast(filter_quality)); - if (uint_data[kColorFilterIndex]) { + if (uint_data[kColorFilterIndex] && uint_data[kInvertColorIndex]) { + SkColor color = uint_data[kColorFilterColorIndex]; + SkBlendMode blend_mode = + static_cast(uint_data[kColorFilterBlendModeIndex]); + sk_sp color_filter = + SkColorFilter::MakeModeFilter(color, blend_mode); + sk_sp invert_filter = + SkColorFilter::MakeMatrixFilterRowMajor255(invert_colors); + paint_.setColorFilter(invert_filter->makeComposed(color_filter)); + } else if (uint_data[kInvertColorIndex]) { + paint_.setColorFilter( + SkColorFilter::MakeMatrixFilterRowMajor255(invert_colors)); + } else if (uint_data[kColorFilterIndex]) { SkColor color = uint_data[kColorFilterColorIndex]; SkBlendMode blend_mode = static_cast(uint_data[kColorFilterBlendModeIndex]); diff --git a/lib/ui/semantics.dart b/lib/ui/semantics.dart index 444ea8856261b..d8125d0ae58bc 100644 --- a/lib/ui/semantics.dart +++ b/lib/ui/semantics.dart @@ -552,6 +552,7 @@ class SemanticsFlag { /// [Window.updateSemantics] to update the semantics conveyed to the user. class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { /// Creates an empty [SemanticsUpdateBuilder] object. + @pragma('vm:entry-point') SemanticsUpdateBuilder() { _constructor(); } void _constructor() native 'SemanticsUpdateBuilder_constructor'; @@ -596,7 +597,9 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { /// 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. + /// 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. @@ -609,6 +612,8 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { int actions, int textSelectionBase, int textSelectionExtent, + int scrollChildren, + int scrollIndex, double scrollPosition, double scrollExtentMax, double scrollExtentMin, @@ -634,6 +639,8 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { actions, textSelectionBase, textSelectionExtent, + scrollChildren, + scrollIndex, scrollPosition, scrollExtentMax, scrollExtentMin, @@ -659,6 +666,8 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { int actions, int textSelectionBase, int textSelectionExtent, + int scrollChildren, + int scrollIndex, double scrollPosition, double scrollExtentMax, double scrollExtentMin, @@ -719,6 +728,7 @@ class SemanticsUpdate extends NativeFieldWrapperClass2 { /// or extended directly. /// /// To create a SemanticsUpdate object, use a [SemanticsUpdateBuilder]. + @pragma('vm:entry-point') SemanticsUpdate._(); /// Releases the resources used by this semantics update. diff --git a/lib/ui/semantics/semantics_node.h b/lib/ui/semantics/semantics_node.h index 2ade1f49a905b..e5d405d38e716 100644 --- a/lib/ui/semantics/semantics_node.h +++ b/lib/ui/semantics/semantics_node.h @@ -79,6 +79,8 @@ struct SemanticsNode { int32_t actions = 0; int32_t textSelectionBase = -1; int32_t textSelectionExtent = -1; + int32_t scrollChildren = 0; + int32_t scrollIndex = 0; double scrollPosition = std::nan(""); double scrollExtentMax = std::nan(""); double scrollExtentMin = std::nan(""); diff --git a/lib/ui/semantics/semantics_update_builder.cc b/lib/ui/semantics/semantics_update_builder.cc index 8c53103808c58..5536029565518 100644 --- a/lib/ui/semantics/semantics_update_builder.cc +++ b/lib/ui/semantics/semantics_update_builder.cc @@ -41,6 +41,8 @@ void SemanticsUpdateBuilder::updateNode( int actions, int textSelectionBase, int textSelectionExtent, + int scrollChildren, + int scrollIndex, double scrollPosition, double scrollExtentMax, double scrollExtentMin, @@ -64,6 +66,8 @@ void SemanticsUpdateBuilder::updateNode( node.actions = actions; node.textSelectionBase = textSelectionBase; node.textSelectionExtent = textSelectionExtent; + node.scrollChildren = scrollChildren; + node.scrollIndex = scrollIndex; node.scrollPosition = scrollPosition; node.scrollExtentMax = scrollExtentMax; node.scrollExtentMin = scrollExtentMin; diff --git a/lib/ui/semantics/semantics_update_builder.h b/lib/ui/semantics/semantics_update_builder.h index 5fa9f2f4bf2da..a9422afba6cae 100644 --- a/lib/ui/semantics/semantics_update_builder.h +++ b/lib/ui/semantics/semantics_update_builder.h @@ -29,6 +29,8 @@ class SemanticsUpdateBuilder int actions, int textSelectionBase, int textSelectionExtent, + int scrollChildren, + int scrollIndex, double scrollPosition, double scrollExtentMax, double scrollExtentMin, diff --git a/lib/ui/text.dart b/lib/ui/text.dart index 766fe9ced98a8..60498c5386157 100644 --- a/lib/ui/text.dart +++ b/lib/ui/text.dart @@ -750,6 +750,7 @@ class TextBox { this.direction, ); + @pragma('vm:entry-point') TextBox._( this.left, this.top, @@ -948,6 +949,7 @@ class Paragraph extends NativeFieldWrapperClass2 { /// or extended directly. /// /// To create a [Paragraph] object, use a [ParagraphBuilder]. + @pragma('vm:entry-point') Paragraph._(); /// The amount of horizontal space this paragraph occupies. @@ -1035,6 +1037,7 @@ class Paragraph extends NativeFieldWrapperClass2 { class ParagraphBuilder extends NativeFieldWrapperClass2 { /// Creates a [ParagraphBuilder] object, which is used to create a /// [Paragraph]. + @pragma('vm:entry-point') ParagraphBuilder(ParagraphStyle style) { _constructor(style._encoded, style._fontFamily, style._fontSize, style._lineHeight, style._ellipsis, _encodeLocale(style._locale)); } void _constructor(Int32List encoded, String fontFamily, double fontSize, double lineHeight, String ellipsis, String locale) native 'ParagraphBuilder_constructor'; diff --git a/lib/ui/text/asset_manager_font_provider.cc b/lib/ui/text/asset_manager_font_provider.cc index 7edcbe6706f3f..6caf8dd898b91 100644 --- a/lib/ui/text/asset_manager_font_provider.cc +++ b/lib/ui/text/asset_manager_font_provider.cc @@ -103,7 +103,7 @@ SkTypeface* AssetManagerFontStyleSet::createTypeface(int i) { std::unique_ptr stream = SkMemoryStream::Make(asset_data); // Ownership of the stream is transferred. - asset.typeface = SkTypeface::MakeFromStream(stream.release()); + asset.typeface = SkTypeface::MakeFromStream(std::move(stream)); if (!asset.typeface) return nullptr; } diff --git a/lib/ui/text/font_collection.cc b/lib/ui/text/font_collection.cc index 987bbfaa76041..b5a88354cc05b 100644 --- a/lib/ui/text/font_collection.cc +++ b/lib/ui/text/font_collection.cc @@ -96,7 +96,7 @@ void FontCollection::RegisterFonts(fml::RefPtr asset_manager) { void FontCollection::RegisterTestFonts() { sk_sp test_typeface = - SkTypeface::MakeFromStream(GetTestFontData().release()); + SkTypeface::MakeFromStream(GetTestFontData()); std::unique_ptr font_provider = std::make_unique(); diff --git a/lib/ui/window.dart b/lib/ui/window.dart index 236346bc52843..f645e1e6b771b 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -763,6 +763,7 @@ class AccessibilityFeatures { 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; @@ -784,6 +785,12 @@ class AccessibilityFeatures { /// 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 = []; @@ -795,6 +802,8 @@ class AccessibilityFeatures { features.add('disableAnimations'); if (boldText) features.add('boldText'); + if (reduceMotion) + features.add('reduceMotion'); return 'AccessibilityFeatures$features'; } diff --git a/lib/ui/window/window.h b/lib/ui/window/window.h index 2e950056b98c9..44f348d07fc3e 100644 --- a/lib/ui/window/window.h +++ b/lib/ui/window/window.h @@ -31,6 +31,7 @@ enum class AccessibilityFeatureFlag : int32_t { kInvertColors = 1 << 1, kDisableAnimations = 1 << 2, kBoldText = 1 << 3, + kReduceMotion = 1 << 4, }; class WindowClient { diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index e48c542c11d61..34962593ea1f5 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -282,20 +282,12 @@ bool DartIsolate::PrepareForRunningFromPrecompiledCode() { return true; } -bool DartIsolate::LoadScriptSnapshot( - std::shared_ptr mapping, - bool last_piece) { - FML_CHECK(last_piece) << "Script snapshots cannot be divided"; - if (tonic::LogIfError(Dart_LoadScriptFromSnapshot(mapping->GetMapping(), - mapping->GetSize()))) { +bool DartIsolate::LoadKernel(std::shared_ptr mapping, + bool last_piece) { + if (!Dart_IsKernel(mapping->GetMapping(), mapping->GetSize())) { return false; } - return true; -} -bool DartIsolate::LoadKernelSnapshot( - std::shared_ptr mapping, - bool last_piece) { // Mapping must be retained until isolate shutdown. kernel_buffers_.push_back(mapping); @@ -317,21 +309,11 @@ bool DartIsolate::LoadKernelSnapshot( return true; } -bool DartIsolate::LoadSnapshot(std::shared_ptr mapping, - bool last_piece) { - if (Dart_IsKernel(mapping->GetMapping(), mapping->GetSize())) { - return LoadKernelSnapshot(std::move(mapping), last_piece); - } else { - return LoadScriptSnapshot(std::move(mapping), last_piece); - } - return false; -} - FML_WARN_UNUSED_RESULT -bool DartIsolate::PrepareForRunningFromSnapshot( +bool DartIsolate::PrepareForRunningFromKernel( std::shared_ptr mapping, bool last_piece) { - TRACE_EVENT0("flutter", "DartIsolate::PrepareForRunningFromSnapshot"); + TRACE_EVENT0("flutter", "DartIsolate::PrepareForRunningFromKernel"); if (phase_ != Phase::LibrariesSetup) { return false; } @@ -349,7 +331,7 @@ bool DartIsolate::PrepareForRunningFromSnapshot( // Use root library provided by kernel in favor of one provided by snapshot. Dart_SetRootLibrary(Dart_Null()); - if (!LoadSnapshot(mapping, last_piece)) { + if (!LoadKernel(mapping, last_piece)) { return false; } @@ -367,61 +349,7 @@ bool DartIsolate::PrepareForRunningFromSnapshot( } child_isolate_preparer_ = [mapping](DartIsolate* isolate) { - return isolate->PrepareForRunningFromSnapshot(mapping); - }; - phase_ = Phase::Ready; - return true; -} - -bool DartIsolate::PrepareForRunningFromSource( - const std::string& main_source_file, - const std::string& packages) { - TRACE_EVENT0("flutter", "DartIsolate::PrepareForRunningFromSource"); - if (phase_ != Phase::LibrariesSetup) { - return false; - } - - if (DartVM::IsRunningPrecompiledCode()) { - return false; - } - - if (main_source_file.empty()) { - return false; - } - - tonic::DartState::Scope scope(this); - - if (!Dart_IsNull(Dart_RootLibrary())) { - return false; - } - - auto& loader = file_loader(); - - if (!packages.empty()) { - auto packages_absolute_path = fml::paths::AbsolutePath(packages); - FML_DLOG(INFO) << "Loading from packages: " << packages_absolute_path; - if (!loader.LoadPackagesMap(packages_absolute_path)) { - return false; - } - } - - auto main_source_absolute_path = fml::paths::AbsolutePath(main_source_file); - FML_DLOG(INFO) << "Loading from source: " << main_source_absolute_path; - - if (tonic::LogIfError(loader.LoadScript(main_source_absolute_path))) { - return false; - } - - if (Dart_IsNull(Dart_RootLibrary())) { - return false; - } - - if (!MarkIsolateRunnable()) { - return false; - } - - child_isolate_preparer_ = [main_source_file, packages](DartIsolate* isolate) { - return isolate->PrepareForRunningFromSource(main_source_file, packages); + return isolate->PrepareForRunningFromKernel(mapping); }; phase_ = Phase::Ready; return true; @@ -608,22 +536,11 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate( return nullptr; } - // The engine never holds a strong reference to the VM service isolate. Since - // we are about to lose our last weak reference to it, start the VM service - // while we have this reference. - const bool isolate_snapshot_is_dart_2 = Dart_IsDart2Snapshot( - vm->GetIsolateSnapshot()->GetData()->GetSnapshotPointer()); - const bool is_preview_dart2 = - (vm->GetPlatformKernel().GetSize() > 0) || isolate_snapshot_is_dart_2; - const bool running_from_sources = - !DartVM::IsRunningPrecompiledCode() && !is_preview_dart2; - tonic::DartState::Scope scope(service_isolate); if (!DartServiceIsolate::Startup( settings.ipv6 ? "::1" : "127.0.0.1", // server IP address settings.observatory_port, // server observatory port tonic::DartState::HandleLibraryTag, // embedder library tag handler - running_from_sources, // running from source code false, // disable websocket origin check error // error (out) )) { @@ -727,39 +644,20 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( Dart_IsolateFlagsInitialize(&nonnull_flags); flags = &nonnull_flags; } - bool dart2 = (vm->GetPlatformKernel().GetSize() > 0) || - Dart_IsDart2Snapshot((*embedder_isolate) - ->GetIsolateSnapshot() - ->GetData() - ->GetSnapshotPointer()); - flags->use_dart_frontend = dart2; + flags->use_dart_frontend = true; // Create the Dart VM isolate and give it the embedder object as the baton. - Dart_Isolate isolate = - (vm->GetPlatformKernel().GetSize() > 0) - ? Dart_CreateIsolateFromKernel( - advisory_script_uri, // - advisory_script_entrypoint, // - vm->GetPlatformKernel().GetMapping(), // - vm->GetPlatformKernel().GetSize(), // - flags, // - embedder_isolate.get(), // - error // - ) - : 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); + 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); if (isolate == nullptr) { FML_DLOG(ERROR) << *error; diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index df9a9f66d1b46..f2167364effdd 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -68,13 +68,8 @@ class DartIsolate : public UIDartState { bool PrepareForRunningFromPrecompiledCode(); FML_WARN_UNUSED_RESULT - bool PrepareForRunningFromSnapshot( - std::shared_ptr snapshot, - bool last_piece = true); - - FML_WARN_UNUSED_RESULT - bool PrepareForRunningFromSource(const std::string& main_source_file, - const std::string& packages); + bool PrepareForRunningFromKernel(std::shared_ptr kernel, + bool last_piece = true); FML_WARN_UNUSED_RESULT bool Run(const std::string& entrypoint); @@ -96,12 +91,7 @@ class DartIsolate : public UIDartState { std::weak_ptr GetWeakIsolatePtr(); private: - bool LoadScriptSnapshot(std::shared_ptr mapping, - bool last_piece); - bool LoadKernelSnapshot(std::shared_ptr mapping, - bool last_piece); - bool LoadSnapshot(std::shared_ptr mapping, - bool last_piece); + bool LoadKernel(std::shared_ptr mapping, bool last_piece); class AutoFireClosure { public: diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc index 02cbbaf8cf5f2..cb7797abdcb74 100644 --- a/runtime/dart_isolate_unittests.cc +++ b/runtime/dart_isolate_unittests.cc @@ -46,70 +46,4 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) { ASSERT_TRUE(root_isolate->Shutdown()); } -TEST_F(DartIsolateTest, IsolateCanAssociateSnapshot) { - Settings settings = {}; - settings.task_observer_add = [](intptr_t, fml::closure) {}; - settings.task_observer_remove = [](intptr_t) {}; - auto vm = DartVM::ForProcess(settings); - ASSERT_TRUE(vm); - TaskRunners task_runners(CURRENT_TEST_NAME, // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner() // - ); - auto weak_isolate = DartIsolate::CreateRootIsolate( - vm.get(), // vm - vm->GetIsolateSnapshot(), // isolate snapshot - vm->GetSharedSnapshot(), // shared snapshot - std::move(task_runners), // task runners - nullptr, // window - {}, // resource context - nullptr, // unref qeueue - "main.dart", // advisory uri - "main" // advisory entrypoint - ); - auto root_isolate = weak_isolate.lock(); - ASSERT_TRUE(root_isolate); - ASSERT_EQ(root_isolate->GetPhase(), DartIsolate::Phase::LibrariesSetup); - ASSERT_TRUE(root_isolate->PrepareForRunningFromSource( - testing::GetFixturesPath() + std::string{"/simple_main.dart"}, "")); - ASSERT_EQ(root_isolate->GetPhase(), DartIsolate::Phase::Ready); - ASSERT_TRUE(root_isolate->Shutdown()); -} - -TEST_F(DartIsolateTest, CanResolveAndInvokeMethod) { - Settings settings = {}; - settings.task_observer_add = [](intptr_t, fml::closure) {}; - settings.task_observer_remove = [](intptr_t) {}; - auto vm = DartVM::ForProcess(settings); - ASSERT_TRUE(vm); - TaskRunners task_runners(CURRENT_TEST_NAME, // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner(), // - GetCurrentTaskRunner() // - ); - auto weak_isolate = DartIsolate::CreateRootIsolate( - vm.get(), // vm - vm->GetIsolateSnapshot(), // isolate snapshot - vm->GetSharedSnapshot(), // shared snapshot - std::move(task_runners), // task runners - nullptr, // window - {}, // resource context - nullptr, // unref qeueue - "main.dart", // advisory uri - "main" // advisory entrypoint - ); - auto root_isolate = weak_isolate.lock(); - ASSERT_TRUE(root_isolate); - ASSERT_EQ(root_isolate->GetPhase(), DartIsolate::Phase::LibrariesSetup); - ASSERT_TRUE(root_isolate->PrepareForRunningFromSource( - testing::GetFixturesPath() + std::string{"/simple_main.dart"}, "")); - ASSERT_EQ(root_isolate->GetPhase(), DartIsolate::Phase::Ready); - ASSERT_TRUE(root_isolate->Run("simple_main")); - ASSERT_EQ(root_isolate->GetPhase(), DartIsolate::Phase::Running); - ASSERT_TRUE(root_isolate->Shutdown()); -} - } // namespace blink diff --git a/runtime/dart_service_isolate.cc b/runtime/dart_service_isolate.cc index d1a699869959a..05da4c48fc2dd 100644 --- a/runtime/dart_service_isolate.cc +++ b/runtime/dart_service_isolate.cc @@ -26,21 +26,11 @@ return false; \ } -#define kLibrarySourceNamePrefix "/vmservice" -static const char* kServiceIsolateScript = "vmservice_io.dart"; - -namespace flutter { -namespace runtime { -extern ResourcesEntry __flutter_embedded_service_isolate_resources_[]; -} -} // namespace flutter - namespace blink { namespace { static Dart_LibraryTagHandler g_embedder_tag_handler; static tonic::DartLibraryNatives* g_natives; -static EmbedderResources* g_resources; static std::string observatory_uri_; Dart_NativeFunction GetNativeFunction(Dart_Handle name, @@ -57,13 +47,6 @@ const uint8_t* GetSymbol(Dart_NativeFunction native_function) { } // namespace -void DartServiceIsolate::TriggerResourceLoad(Dart_NativeArguments args) { - Dart_Handle library = Dart_RootLibrary(); - FML_DCHECK(!Dart_IsError(library)); - Dart_Handle result = LoadResources(library); - FML_DCHECK(!Dart_IsError(result)); -} - void DartServiceIsolate::NotifyServerState(Dart_NativeArguments args) { Dart_Handle exception = nullptr; std::string uri = @@ -84,7 +67,6 @@ void DartServiceIsolate::Shutdown(Dart_NativeArguments args) { bool DartServiceIsolate::Startup(std::string server_ip, intptr_t server_port, Dart_LibraryTagHandler embedder_tag_handler, - bool running_from_sources, bool disable_origin_check, char** error) { Dart_Isolate isolate = Dart_CurrentIsolate(); @@ -103,36 +85,13 @@ bool DartServiceIsolate::Startup(std::string server_ip, }); } - if (!g_resources) { - g_resources = new EmbedderResources( - &flutter::runtime::__flutter_embedded_service_isolate_resources_[0]); - } - - Dart_Handle result; - - if (running_from_sources) { - // Use our own library tag handler when loading service isolate sources. - Dart_SetLibraryTagHandler(DartServiceIsolate::LibraryTagHandler); - // Load main script. - Dart_Handle library = LoadScript(kServiceIsolateScript); - FML_DCHECK(library != Dart_Null()); - SHUTDOWN_ON_ERROR(library); - // Setup native entry resolution. - result = Dart_SetNativeResolver(library, GetNativeFunction, GetSymbol); - - SHUTDOWN_ON_ERROR(result); - // Finalize loading. - result = Dart_FinalizeLoading(false); - SHUTDOWN_ON_ERROR(result); - } else { - Dart_Handle uri = Dart_NewStringFromCString("dart:vmservice_io"); - Dart_Handle library = Dart_LookupLibrary(uri); - SHUTDOWN_ON_ERROR(library); - result = Dart_SetRootLibrary(library); - SHUTDOWN_ON_ERROR(result); - result = Dart_SetNativeResolver(library, GetNativeFunction, GetSymbol); - SHUTDOWN_ON_ERROR(result); - } + Dart_Handle uri = Dart_NewStringFromCString("dart:vmservice_io"); + Dart_Handle library = Dart_LookupLibrary(uri); + SHUTDOWN_ON_ERROR(library); + Dart_Handle result = Dart_SetRootLibrary(library); + SHUTDOWN_ON_ERROR(result); + result = Dart_SetNativeResolver(library, GetNativeFunction, GetSymbol); + SHUTDOWN_ON_ERROR(result); // Make runnable. Dart_ExitScope(); @@ -146,7 +105,7 @@ bool DartServiceIsolate::Startup(std::string server_ip, Dart_EnterIsolate(isolate); Dart_EnterScope(); - Dart_Handle library = Dart_RootLibrary(); + library = Dart_RootLibrary(); SHUTDOWN_ON_ERROR(library); // Set the HTTP server's ip. @@ -174,115 +133,4 @@ bool DartServiceIsolate::Startup(std::string server_ip, return true; } -Dart_Handle DartServiceIsolate::GetSource(const char* name) { - const intptr_t kBufferSize = 512; - char buffer[kBufferSize]; - snprintf(&buffer[0], kBufferSize - 1, "%s/%s", kLibrarySourceNamePrefix, - name); - const char* vmservice_source = NULL; - int r = g_resources->ResourceLookup(buffer, &vmservice_source); - FML_DCHECK(r != EmbedderResources::kNoSuchInstance); - return Dart_NewStringFromCString(vmservice_source); -} - -Dart_Handle DartServiceIsolate::LoadScript(const char* name) { - Dart_Handle url = Dart_NewStringFromCString("dart:vmservice_io"); - Dart_Handle source = GetSource(name); - return Dart_LoadScript(url, Dart_Null(), source, 0, 0); -} - -Dart_Handle DartServiceIsolate::LoadSource(Dart_Handle library, - const char* name) { - Dart_Handle url = Dart_NewStringFromCString(name); - Dart_Handle source = GetSource(name); - return Dart_LoadSource(library, url, Dart_Null(), source, 0, 0); -} - -Dart_Handle DartServiceIsolate::LoadResource(Dart_Handle library, - const char* resource_name) { - // Prepare for invoke call. - Dart_Handle name = Dart_NewStringFromCString(resource_name); - RETURN_ERROR_HANDLE(name); - const char* data_buffer = NULL; - int data_buffer_length = - g_resources->ResourceLookup(resource_name, &data_buffer); - FML_DCHECK(data_buffer_length != EmbedderResources::kNoSuchInstance); - Dart_Handle data_list = - Dart_NewTypedData(Dart_TypedData_kUint8, data_buffer_length); - RETURN_ERROR_HANDLE(data_list); - Dart_TypedData_Type type = Dart_TypedData_kInvalid; - void* data_list_buffer = NULL; - intptr_t data_list_buffer_length = 0; - Dart_Handle result = Dart_TypedDataAcquireData( - data_list, &type, &data_list_buffer, &data_list_buffer_length); - RETURN_ERROR_HANDLE(result); - FML_DCHECK(data_buffer_length == data_list_buffer_length); - FML_DCHECK(data_list_buffer != NULL); - FML_DCHECK(type = Dart_TypedData_kUint8); - memmove(data_list_buffer, &data_buffer[0], data_buffer_length); - result = Dart_TypedDataReleaseData(data_list); - RETURN_ERROR_HANDLE(result); - - // Make invoke call. - const intptr_t kNumArgs = 2; - Dart_Handle args[kNumArgs] = {name, data_list}; - result = Dart_Invoke(library, Dart_NewStringFromCString("_addResource"), - kNumArgs, args); - return result; -} - -Dart_Handle DartServiceIsolate::LoadResources(Dart_Handle library) { - Dart_Handle result = Dart_Null(); - intptr_t prefixLen = strlen(kLibrarySourceNamePrefix); - for (intptr_t i = 0; g_resources->Path(i) != NULL; i++) { - const char* path = g_resources->Path(i); - // If it doesn't begin with kLibrarySourceNamePrefix it is a frontend - // resource. - if (strncmp(path, kLibrarySourceNamePrefix, prefixLen) != 0) { - result = LoadResource(library, path); - if (Dart_IsError(result)) { - break; - } - } - } - return result; -} - -Dart_Handle DartServiceIsolate::LibraryTagHandler(Dart_LibraryTag tag, - Dart_Handle library, - Dart_Handle url) { - if (!Dart_IsLibrary(library)) { - return Dart_NewApiError("not a library"); - } - if (!Dart_IsString(url)) { - return Dart_NewApiError("url is not a string"); - } - const char* url_string = NULL; - Dart_Handle result = Dart_StringToCString(url, &url_string); - if (Dart_IsError(result)) { - return result; - } - Dart_Handle library_url = Dart_LibraryUrl(library); - const char* library_url_string = NULL; - result = Dart_StringToCString(library_url, &library_url_string); - if (Dart_IsError(result)) { - return result; - } - if (tag == Dart_kImportTag) { - // Embedder handles all requests for external libraries. - return g_embedder_tag_handler(tag, library, url); - } - FML_DCHECK((tag == Dart_kSourceTag) || (tag == Dart_kCanonicalizeUrl)); - if (tag == Dart_kCanonicalizeUrl) { - // url is already canonicalized. - return url; - } - // Get source from builtin resources. - Dart_Handle source = GetSource(url_string); - if (Dart_IsError(source)) { - return source; - } - return Dart_LoadSource(library, url, Dart_Null(), source, 0, 0); -} - } // namespace blink diff --git a/runtime/dart_service_isolate.h b/runtime/dart_service_isolate.h index 59a02e2e9d495..3d672dc83bb4c 100644 --- a/runtime/dart_service_isolate.h +++ b/runtime/dart_service_isolate.h @@ -16,7 +16,6 @@ class DartServiceIsolate { static bool Startup(std::string server_ip, intptr_t server_port, Dart_LibraryTagHandler embedder_tag_handler, - bool running_from_sources, bool disable_origin_check, char** error); @@ -24,21 +23,8 @@ class DartServiceIsolate { private: // Native entries. - static void TriggerResourceLoad(Dart_NativeArguments args); static void NotifyServerState(Dart_NativeArguments args); static void Shutdown(Dart_NativeArguments args); - - // Script loading. - static Dart_Handle GetSource(const char* name); - static Dart_Handle LoadScript(const char* name); - static Dart_Handle LoadSource(Dart_Handle library, const char* name); - static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, - Dart_Handle library, - Dart_Handle url); - - // Observatory resource loading. - static Dart_Handle LoadResources(Dart_Handle library); - static Dart_Handle LoadResource(Dart_Handle library, const char* name); }; } // namespace blink diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index b263914538217..a5fb451588be6 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -66,6 +66,9 @@ static const char* kDartLanguageArgs[] = { "--background_compilation", "--await_is_keyword", "--causal_async_stacks", + "--strong", + "--reify_generic_functions", + "--sync_async", // clang-format on }; @@ -84,22 +87,6 @@ static const char* kDartAssertArgs[] = { // clang-format on }; -static const char* kDartCheckedModeArgs[] = { - // clang-format off - "--enable_type_checks", - "--error_on_bad_type", - "--error_on_bad_override", - // clang-format on -}; - -static const char* kDartStrongModeArgs[] = { - // clang-format off - "--strong", - "--reify_generic_functions", - "--sync_async", - // clang-format on -}; - static const char* kDartStartPausedArgs[]{ "--pause_isolates_on_start", }; @@ -310,8 +297,6 @@ DartVM::DartVM(const Settings& settings, vm_snapshot_(std::move(vm_snapshot)), isolate_snapshot_(std::move(isolate_snapshot)), shared_snapshot_(std::move(shared_snapshot)), - platform_kernel_mapping_( - std::make_unique(settings.platform_kernel_path)), weak_factory_(this) { TRACE_EVENT0("flutter", "DartVMInitializer"); FML_DLOG(INFO) << "Attempting Dart VM launch for mode: " @@ -368,29 +353,12 @@ DartVM::DartVM(const Settings& settings, arraysize(kDartWriteProtectCodeArgs)); #endif - const bool isolate_snapshot_is_dart_2 = + const bool is_preview_dart2 = Dart_IsDart2Snapshot(isolate_snapshot_->GetData()->GetSnapshotPointer()); + FML_CHECK(is_preview_dart2) << "Not Dart 2!"; - const bool is_preview_dart2 = - (platform_kernel_mapping_->GetSize() > 0) || isolate_snapshot_is_dart_2; - - FML_DLOG(INFO) << "Dart 2 " << (is_preview_dart2 ? "is" : "is NOT") - << " enabled. Platform kernel: " - << static_cast(platform_kernel_mapping_->GetSize() > 0) - << " Isolate Snapshot is Dart 2: " - << isolate_snapshot_is_dart_2; - - if (is_preview_dart2) { - PushBackAll(&args, kDartStrongModeArgs, arraysize(kDartStrongModeArgs)); - if (use_checked_mode) { - PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); - } - } else if (use_checked_mode) { - FML_DLOG(INFO) << "Checked mode is ON"; + if (use_checked_mode) { PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); - PushBackAll(&args, kDartCheckedModeArgs, arraysize(kDartCheckedModeArgs)); - } else { - FML_DLOG(INFO) << "Is not Dart 2 and Checked mode is OFF"; } if (settings.start_paused) { @@ -485,10 +453,6 @@ const Settings& DartVM::GetSettings() const { return settings_; } -const fml::Mapping& DartVM::GetPlatformKernel() const { - return *platform_kernel_mapping_.get(); -} - const DartSnapshot& DartVM::GetVMSnapshot() const { return *vm_snapshot_.get(); } diff --git a/runtime/dart_vm.h b/runtime/dart_vm.h index ebb41edadb479..b853f026c328f 100644 --- a/runtime/dart_vm.h +++ b/runtime/dart_vm.h @@ -42,8 +42,6 @@ class DartVM : public fml::RefCountedThreadSafe { const Settings& GetSettings() const; - const fml::Mapping& GetPlatformKernel() const; - const DartSnapshot& GetVMSnapshot() const; IsolateNameServer* GetIsolateNameServer(); @@ -62,7 +60,6 @@ class DartVM : public fml::RefCountedThreadSafe { IsolateNameServer isolate_name_server_; const fml::RefPtr isolate_snapshot_; const fml::RefPtr shared_snapshot_; - std::unique_ptr platform_kernel_mapping_; ServiceProtocol service_protocol_; fml::WeakPtrFactory weak_factory_; diff --git a/runtime/dart_vm_entry_points.txt b/runtime/dart_vm_entry_points.txt index d5110c7ad9ac4..29e642b13d140 100644 --- a/runtime/dart_vm_entry_points.txt +++ b/runtime/dart_vm_entry_points.txt @@ -1,46 +1,2 @@ -dart:_internal,::,_printClosure -dart:async,::,_setScheduleImmediateClosure -dart:io,::,_getUriBaseClosure -dart:io,::,_setupHooks -dart:io,_Platform,_localeClosure -dart:io,_Platform,set:_nativeScript -dart:isolate,::,_getIsolateScheduleImmediateClosure -dart:isolate,::,_setupHooks -dart:isolate,::,_startMainIsolate -dart:ui,::,_beginFrame -dart:ui,::,_dispatchPlatformMessage -dart:ui,::,_dispatchPointerDataPacket -dart:ui,::,_dispatchSemanticsAction -dart:ui,::,_drawFrame -dart:ui,::,_getLocaleClosure -dart:ui,::,_getMainClosure -dart:ui,::,_getPrintClosure -dart:ui,::,_getScheduleMicrotaskClosure -dart:ui,::,_setupHooks -dart:ui,::,_updateLocale -dart:ui,::,_updateSemanticsEnabled -dart:ui,::,_updateAccessibilityFeatures -dart:ui,::,_updateUserSettingsData -dart:ui,::,_updateWindowMetrics -dart:ui,_ImageInfo,get:width -dart:ui,_ImageInfo,get:height -dart:ui,_ImageInfo,get:format -dart:ui,_ImageInfo,get:rowBytes -dart:ui,Canvas,Canvas. -dart:ui,Codec,Codec._ -dart:ui,Color,Color. -dart:ui,FrameInfo,FrameInfo._ -dart:ui,Image,Image._ -dart:ui,ImageShader,ImageShader. -dart:ui,Paragraph,Paragraph._ -dart:ui,ParagraphBuilder,ParagraphBuilder. -dart:ui,Path,Path. -dart:ui,Picture,Picture._ -dart:ui,PictureRecorder,PictureRecorder. -dart:ui,Rect,Rect.fromLTRB -dart:ui,Scene,Scene._ -dart:ui,SceneBuilder,SceneBuilder. -dart:ui,SemanticsUpdate,SemanticsUpdate._ -dart:ui,SemanticsUpdateBuilder,SemanticsUpdateBuilder. -dart:ui,Shader,Shader._ -dart:ui,TextBox,TextBox._ +# Please don't add entries to this file. +# Use the @pragma('vm:entry-point') annotation instead. diff --git a/runtime/dart_vm_unittests.cc b/runtime/dart_vm_unittests.cc index d0e247836410b..94d5dadaaec1f 100644 --- a/runtime/dart_vm_unittests.cc +++ b/runtime/dart_vm_unittests.cc @@ -15,7 +15,6 @@ TEST(DartVM, SimpleInitialization) { ASSERT_TRUE(vm); ASSERT_EQ(vm, DartVM::ForProcess(settings)); ASSERT_FALSE(DartVM::IsRunningPrecompiledCode()); - ASSERT_EQ(vm->GetPlatformKernel().GetSize(), 0u); } TEST(DartVM, SimpleIsolateNameServer) { diff --git a/shell/common/BUILD.gn b/shell/common/BUILD.gn index 0091d5bf02361..db0b6dd43e975 100644 --- a/shell/common/BUILD.gn +++ b/shell/common/BUILD.gn @@ -67,8 +67,6 @@ source_set("common") { "io_manager.h", "isolate_configuration.cc", "isolate_configuration.h", - "picture_serializer.cc", - "picture_serializer.h", "platform_view.cc", "platform_view.h", "rasterizer.cc", diff --git a/shell/common/engine.cc b/shell/common/engine.cc index 1b9d3657b6ece..b79dbfae33555 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -47,7 +47,6 @@ Engine::Engine(Delegate& delegate, : delegate_(delegate), settings_(std::move(settings)), animator_(std::move(animator)), - load_script_error_(tonic::kNoError), activity_running_(false), have_surface_(false), weak_factory_(this) { @@ -205,10 +204,6 @@ tonic::DartErrorHandleType Engine::GetUIIsolateLastError() { return runtime_controller_->GetLastError(); } -tonic::DartErrorHandleType Engine::GetLoadScriptError() { - return load_script_error_; -} - void Engine::OnOutputSurfaceCreated() { have_surface_ = true; StartAnimatorIfPossible(); diff --git a/shell/common/engine.h b/shell/common/engine.h index 259f73514b67d..f35b9ba421113 100644 --- a/shell/common/engine.h +++ b/shell/common/engine.h @@ -79,8 +79,6 @@ class Engine final : public blink::RuntimeDelegate { tonic::DartErrorHandleType GetUIIsolateLastError(); - tonic::DartErrorHandleType GetLoadScriptError(); - std::pair GetUIIsolateReturnCode(); void OnOutputSurfaceCreated(); @@ -111,7 +109,6 @@ class Engine final : public blink::RuntimeDelegate { const blink::Settings settings_; std::unique_ptr animator_; std::unique_ptr runtime_controller_; - tonic::DartErrorHandleType load_script_error_; std::string initial_route_; blink::ViewportMetrics viewport_metrics_; fml::RefPtr asset_manager_; diff --git a/shell/common/isolate_configuration.cc b/shell/common/isolate_configuration.cc index 66dd53fb1b59c..57c38bef9f8d8 100644 --- a/shell/common/isolate_configuration.cc +++ b/shell/common/isolate_configuration.cc @@ -39,45 +39,23 @@ class AppSnapshotIsolateConfiguration final : public IsolateConfiguration { FML_DISALLOW_COPY_AND_ASSIGN(AppSnapshotIsolateConfiguration); }; -class SnapshotIsolateConfiguration : public IsolateConfiguration { +class KernelIsolateConfiguration : public IsolateConfiguration { public: - SnapshotIsolateConfiguration(std::unique_ptr snapshot) - : snapshot_(std::move(snapshot)) {} + KernelIsolateConfiguration(std::unique_ptr kernel) + : kernel_(std::move(kernel)) {} // |shell::IsolateConfiguration| bool DoPrepareIsolate(blink::DartIsolate& isolate) override { if (blink::DartVM::IsRunningPrecompiledCode()) { return false; } - return isolate.PrepareForRunningFromSnapshot(std::move(snapshot_)); + return isolate.PrepareForRunningFromKernel(std::move(kernel_)); } private: - std::unique_ptr snapshot_; + std::unique_ptr kernel_; - FML_DISALLOW_COPY_AND_ASSIGN(SnapshotIsolateConfiguration); -}; - -class SourceIsolateConfiguration final : public IsolateConfiguration { - public: - SourceIsolateConfiguration(std::string main_path, std::string packages_path) - : main_path_(std::move(main_path)), - packages_path_(std::move(packages_path)) {} - - // |shell::IsolateConfiguration| - bool DoPrepareIsolate(blink::DartIsolate& isolate) override { - if (blink::DartVM::IsRunningPrecompiledCode()) { - return false; - } - return isolate.PrepareForRunningFromSource(std::move(main_path_), - std::move(packages_path_)); - } - - private: - std::string main_path_; - std::string packages_path_; - - FML_DISALLOW_COPY_AND_ASSIGN(SourceIsolateConfiguration); + FML_DISALLOW_COPY_AND_ASSIGN(KernelIsolateConfiguration); }; class KernelListIsolateConfiguration final : public IsolateConfiguration { @@ -94,8 +72,8 @@ class KernelListIsolateConfiguration final : public IsolateConfiguration { for (size_t i = 0; i < kernel_pieces_.size(); i++) { bool last_piece = i + 1 == kernel_pieces_.size(); - if (!isolate.PrepareForRunningFromSnapshot(std::move(kernel_pieces_[i]), - last_piece)) { + if (!isolate.PrepareForRunningFromKernel(std::move(kernel_pieces_[i]), + last_piece)) { return false; } } @@ -117,30 +95,12 @@ std::unique_ptr IsolateConfiguration::InferFromSettings( return CreateForAppSnapshot(); } - // Run from sources. - { - const auto& main = settings.main_dart_file_path; - const auto& packages = settings.packages_file_path; - if (main.size() != 0 && packages.size() != 0) { - return CreateForSource(std::move(main), std::move(packages)); - } - } - // Running from kernel snapshot. if (asset_manager) { std::unique_ptr kernel = asset_manager->GetAsMapping(settings.application_kernel_asset); if (kernel) { - return CreateForSnapshot(std::move(kernel)); - } - } - - // Running from script snapshot. - if (asset_manager) { - std::unique_ptr script_snapshot = - asset_manager->GetAsMapping(settings.script_snapshot_path); - if (script_snapshot) { - return CreateForSnapshot(std::move(script_snapshot)); + return CreateForKernel(std::move(kernel)); } } @@ -189,16 +149,9 @@ IsolateConfiguration::CreateForAppSnapshot() { return std::make_unique(); } -std::unique_ptr IsolateConfiguration::CreateForSnapshot( - std::unique_ptr snapshot) { - return std::make_unique(std::move(snapshot)); -} - -std::unique_ptr IsolateConfiguration::CreateForSource( - std::string main_path, - std::string packages_path) { - return std::make_unique(std::move(main_path), - std::move(packages_path)); +std::unique_ptr IsolateConfiguration::CreateForKernel( + std::unique_ptr kernel) { + return std::make_unique(std::move(kernel)); } std::unique_ptr IsolateConfiguration::CreateForKernelList( diff --git a/shell/common/isolate_configuration.h b/shell/common/isolate_configuration.h index ba8752273d6de..7dd54ccf3b3b7 100644 --- a/shell/common/isolate_configuration.h +++ b/shell/common/isolate_configuration.h @@ -26,12 +26,8 @@ class IsolateConfiguration { static std::unique_ptr CreateForAppSnapshot(); - static std::unique_ptr CreateForSnapshot( - std::unique_ptr snapshot); - - static std::unique_ptr CreateForSource( - std::string main_path, - std::string packages_path); + static std::unique_ptr CreateForKernel( + std::unique_ptr kernel); static std::unique_ptr CreateForKernelList( std::vector> kernel_pieces); diff --git a/shell/common/picture_serializer.cc b/shell/common/picture_serializer.cc deleted file mode 100644 index b62e96d74f0a1..0000000000000 --- a/shell/common/picture_serializer.cc +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "flutter/shell/common/picture_serializer.h" - -#include "third_party/skia/include/core/SkStream.h" - -namespace shell { - -void SerializePicture(const std::string& path, SkPicture* picture) { - SkFILEWStream stream(path.c_str()); - picture->serialize(&stream); -} - -} // namespace shell diff --git a/shell/common/picture_serializer.h b/shell/common/picture_serializer.h deleted file mode 100644 index 0416b2f0c6277..0000000000000 --- a/shell/common/picture_serializer.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SHELL_GPU_PICTURE_SERIALIZER_H_ -#define SHELL_GPU_PICTURE_SERIALIZER_H_ - -#include - -#include "third_party/skia/include/core/SkPicture.h" - -namespace shell { - -void SerializePicture(const std::string& path, SkPicture* picture); - -} // namespace shell - -#endif // SHELL_GPU_PICTURE_SERIALIZER_H_ diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index 6f0ddd53a1907..6f08b2afd0b7e 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -9,10 +9,15 @@ #include "third_party/skia/include/core/SkEncodedImageFormat.h" #include "third_party/skia/include/core/SkImageEncoder.h" #include "third_party/skia/include/core/SkPictureRecorder.h" +#include "third_party/skia/include/core/SkSerialProcs.h" #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/core/SkSurfaceCharacterization.h" #include "third_party/skia/include/utils/SkBase64.h" +#ifdef ERROR +#undef ERROR +#endif + namespace shell { Rasterizer::Rasterizer(blink::TaskRunners task_runners) @@ -114,7 +119,7 @@ bool Rasterizer::DrawToSurface(flow::LayerTree& layer_tree) { surface_->GetContext(), canvas, surface_->GetRootTransformation(), true); if (canvas) { - canvas->clear(SK_ColorBLACK); + canvas->clear(SK_ColorTRANSPARENT); } if (compositor_frame && compositor_frame->Raster(layer_tree, false)) { @@ -126,7 +131,11 @@ bool Rasterizer::DrawToSurface(flow::LayerTree& layer_tree) { return false; } -static sk_sp ScreenshotLayerTreeAsPicture( +static sk_sp SerializeTypeface(SkTypeface* typeface, void* ctx) { + return typeface->serialize(SkTypeface::SerializeBehavior::kDoIncludeData); +} + +static sk_sp ScreenshotLayerTreeAsPicture( flow::LayerTree* tree, flow::CompositorContext& compositor_context) { FML_DCHECK(tree != nullptr); @@ -143,7 +152,10 @@ static sk_sp ScreenshotLayerTreeAsPicture( frame->Raster(*tree, true); - return recorder.finishRecordingAsPicture(); + SkSerialProcs procs = {0}; + procs.fTypefaceProc = SerializeTypeface; + + return recorder.finishRecordingAsPicture()->serialize(&procs); } static sk_sp CreateSnapshotSurface(GrContext* surface_context, @@ -173,6 +185,7 @@ static sk_sp ScreenshotLayerTreeAsImage( auto snapshot_surface = CreateSnapshotSurface(surface_context, tree->frame_size()); if (snapshot_surface == nullptr) { + FML_LOG(ERROR) << "Screenshot: unable to create snapshot surface"; return nullptr; } @@ -186,23 +199,25 @@ static sk_sp ScreenshotLayerTreeAsImage( auto frame = compositor_context.AcquireFrame( surface_context, canvas, root_surface_transformation, false); - canvas->clear(SK_ColorBLACK); + canvas->clear(SK_ColorTRANSPARENT); frame->Raster(*tree, true); canvas->flush(); // Prepare an image from the surface, this image may potentially be on th GPU. auto potentially_gpu_snapshot = snapshot_surface->makeImageSnapshot(); if (!potentially_gpu_snapshot) { + FML_LOG(ERROR) << "Screenshot: unable to make image screenshot"; return nullptr; } // Copy the GPU image snapshot into CPU memory. auto cpu_snapshot = potentially_gpu_snapshot->makeRasterImage(); if (!cpu_snapshot) { + FML_LOG(ERROR) << "Screenshot: unable to make raster image"; return nullptr; } - // If the caller want the pixels to be compressed, there is a Skia utilitiy to + // If the caller want the pixels to be compressed, there is a Skia utility to // compress to PNG. Use that. if (compressed) { return cpu_snapshot->encodeToData(); @@ -211,6 +226,7 @@ static sk_sp ScreenshotLayerTreeAsImage( // Copy it into a bitmap and return the same. SkPixmap pixmap; if (!cpu_snapshot->peekPixels(&pixmap)) { + FML_LOG(ERROR) << "Screenshot: unable to obtain bitmap pixels"; return nullptr; } @@ -222,7 +238,7 @@ Rasterizer::Screenshot Rasterizer::ScreenshotLastLayerTree( bool base64_encode) { auto layer_tree = GetLastLayerTree(); if (layer_tree == nullptr) { - FML_DLOG(INFO) << "Last layer tree was null when screenshotting."; + FML_LOG(ERROR) << "Last layer tree was null when screenshotting."; return {}; } @@ -232,8 +248,7 @@ Rasterizer::Screenshot Rasterizer::ScreenshotLastLayerTree( switch (type) { case ScreenshotType::SkiaPicture: - data = ScreenshotLayerTreeAsPicture(layer_tree, *compositor_context_) - ->serialize(); + data = ScreenshotLayerTreeAsPicture(layer_tree, *compositor_context_); break; case ScreenshotType::UncompressedImage: data = ScreenshotLayerTreeAsImage(layer_tree, *compositor_context_, @@ -246,7 +261,7 @@ Rasterizer::Screenshot Rasterizer::ScreenshotLastLayerTree( } if (data == nullptr) { - FML_DLOG(INFO) << "Sceenshot data was null."; + FML_LOG(ERROR) << "Screenshot data was null."; return {}; } diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 5afe07691eca0..7d434cb055be4 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -865,24 +865,24 @@ bool Shell::OnServiceProtocolRunInView( return false; } - auto main_script_file = - fml::paths::AbsolutePath(params.at("mainScript").ToString()); + std::string main_script_path = + fml::paths::FromURI(params.at("mainScript").ToString()); + std::string packages_path = + fml::paths::FromURI(params.at("packagesFile").ToString()); + std::string asset_directory_path = + fml::paths::FromURI(params.at("assetDirectory").ToString()); auto main_script_file_mapping = - std::make_unique(main_script_file, false); + std::make_unique(main_script_path, false); - auto isolate_configuration = - blink::DartVM::IsKernelMapping(main_script_file_mapping.get()) - ? IsolateConfiguration::CreateForSnapshot( - std::move(main_script_file_mapping)) - : IsolateConfiguration::CreateForSource( - main_script_file, params.at("packagesFile").ToString()); + auto isolate_configuration = IsolateConfiguration::CreateForKernel( + std::move(main_script_file_mapping)); RunConfiguration configuration(std::move(isolate_configuration)); - configuration.AddAssetResolver(std::make_unique( - fml::OpenFile(params.at("assetDirectory").ToString().c_str(), - fml::OpenPermission::kRead, true))); + configuration.AddAssetResolver( + std::make_unique(fml::OpenFile( + asset_directory_path.c_str(), fml::OpenPermission::kRead, true))); auto& allocator = response.GetAllocator(); response.SetObject(); diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 80ae36a7e5776..98f0bb353015f 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -170,9 +170,6 @@ blink::Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { command_line.GetOptionValue(FlagForSwitch(Switch::FlutterAssetsDir), &settings.assets_path); - command_line.GetOptionValue(FlagForSwitch(Switch::Snapshot), - &settings.script_snapshot_path); - command_line.GetOptionValue(FlagForSwitch(Switch::MainDartFile), &settings.main_dart_file_path); diff --git a/shell/common/switches.h b/shell/common/switches.h index 6bae9047e0e3d..644b02f2cbce5 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -93,7 +93,6 @@ DEF_SWITCH(Help, "help", "Display this help text.") DEF_SWITCH(LogTag, "log-tag", "Tag associated with log messages.") DEF_SWITCH(MainDartFile, "dart-main", "The path to the main Dart file.") DEF_SWITCH(Packages, "packages", "Specify the path to the packages.") -DEF_SWITCH(Snapshot, "snapshot-blob", "Specify the path to the snapshot blob") DEF_SWITCH(StartPaused, "start-paused", "Start the application paused in the Dart debugger.") diff --git a/shell/gpu/gpu_surface_gl.cc b/shell/gpu/gpu_surface_gl.cc index 505f9e40eead5..5a7c2a198476b 100644 --- a/shell/gpu/gpu_surface_gl.cc +++ b/shell/gpu/gpu_surface_gl.cc @@ -11,6 +11,7 @@ #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 @@ -42,6 +43,8 @@ GPUSurfaceGL::GPUSurfaceGL(GPUSurfaceGLDelegate* delegate) return; } + proc_resolver_ = delegate_->GetGLProcResolver(); + GrContextOptions options; options.fAvoidStencilBuffers = true; @@ -49,7 +52,18 @@ GPUSurfaceGL::GPUSurfaceGL(GPUSurfaceGLDelegate* delegate) // ES2 shading language when the ES3 external image extension is missing. options.fPreferExternalImagesOverES3 = true; - auto context = GrContext::MakeGL(GrGLMakeNativeInterface(), options); + auto interface = + proc_resolver_ + ? GrGLMakeAssembledGLESInterface( + this /* context */, + [](void* context, const char gl_proc_name[]) -> GrGLFuncPtr { + return reinterpret_cast( + reinterpret_cast(context)->proc_resolver_( + gl_proc_name)); + }) + : GrGLMakeNativeInterface(); + + auto context = GrContext::MakeGL(interface, options); if (context == nullptr) { FML_LOG(ERROR) << "Failed to setup Skia Gr context."; diff --git a/shell/gpu/gpu_surface_gl.h b/shell/gpu/gpu_surface_gl.h index 971e4649dc1a8..f01317b9caec0 100644 --- a/shell/gpu/gpu_surface_gl.h +++ b/shell/gpu/gpu_surface_gl.h @@ -5,6 +5,7 @@ #ifndef SHELL_GPU_GPU_SURFACE_GL_H_ #define SHELL_GPU_GPU_SURFACE_GL_H_ +#include #include #include "flutter/fml/macros.h" @@ -33,6 +34,10 @@ class GPUSurfaceGLDelegate { matrix.setIdentity(); return matrix; } + + using GLProcResolver = + std::function; + virtual GLProcResolver GetGLProcResolver() const { return nullptr; } }; class GPUSurfaceGL : public Surface { @@ -55,6 +60,7 @@ class GPUSurfaceGL : public Surface { private: GPUSurfaceGLDelegate* delegate_; + GPUSurfaceGLDelegate::GLProcResolver proc_resolver_; sk_sp context_; sk_sp onscreen_surface_; sk_sp offscreen_surface_; diff --git a/shell/platform/android/flutter_main.cc b/shell/platform/android/flutter_main.cc index b8931e6e46753..0bcf75d76feca 100644 --- a/shell/platform/android/flutter_main.cc +++ b/shell/platform/android/flutter_main.cc @@ -66,16 +66,11 @@ void FlutterMain::Init(JNIEnv* env, if (!blink::DartVM::IsRunningPrecompiledCode()) { // Check to see if the appropriate kernel files are present and configure // settings accordingly. - auto platform_kernel_path = - fml::paths::JoinPaths({settings.assets_path, "platform_strong.dill"}); auto application_kernel_path = fml::paths::JoinPaths({settings.assets_path, "kernel_blob.bin"}); if (fml::IsFile(application_kernel_path)) { settings.application_kernel_asset = application_kernel_path; - if (fml::IsFile(platform_kernel_path)) { - settings.platform_kernel_path = platform_kernel_path; - } } } diff --git a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java index 7136457ffca47..ae3a1381e230a 100644 --- a/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java +++ b/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java @@ -158,7 +158,7 @@ public boolean sendKeyEvent(KeyEvent event) { int character = event.getUnicodeChar(); if (character != 0) { int selStart = Math.max(0, Selection.getSelectionStart(mEditable)); - int selEnd = Selection.getSelectionEnd(mEditable); + int selEnd = Math.max(0, Selection.getSelectionEnd(mEditable)); if (selEnd != selStart) mEditable.delete(selStart, selEnd); mEditable.insert(selStart, String.valueOf((char) character)); diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index ba15c33428c6b..0870a59c00201 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -144,8 +144,8 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { } AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(mOwner, virtualViewId); - // Work around for https://github.com/flutter/flutter/issues/2101 - result.setViewIdResourceName(""); + // Work around for https://github.com/flutter/flutter/issues/2101 + result.setViewIdResourceName(""); result.setPackageName(mOwner.getContext().getPackageName()); result.setClassName("android.view.View"); result.setSource(mOwner, virtualViewId); @@ -717,10 +717,28 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { event.setScrollX((int) position); event.setMaxScrollX((int) max); } + if (object.scrollChildren > 0) { + event.setItemCount(object.scrollChildren); + event.setFromIndex(object.scrollIndex); + int visibleChildren = object.childrenInHitTestOrder.size() - 1; + // We assume that only children at the end of the list can be hidden. + assert(!object.childrenInHitTestOrder.get(object.scrollIndex).hasFlag(Flag.IS_HIDDEN)); + for (; visibleChildren >= 0; visibleChildren--) { + SemanticsObject child = object.childrenInHitTestOrder.get(visibleChildren); + if (!child.hasFlag(Flag.IS_HIDDEN)) { + break; + } + } + event.setToIndex(object.scrollIndex + visibleChildren); + } sendAccessibilityEvent(event); } - if (object.hasFlag(Flag.IS_LIVE_REGION) && !object.hadFlag(Flag.IS_LIVE_REGION)) { - sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); + if (object.hasFlag(Flag.IS_LIVE_REGION)) { + String label = object.label == null ? "" : object.label; + String previousLabel = object.previousLabel == null ? "" : object.label; + if (!label.equals(previousLabel) || !object.hadFlag(Flag.IS_LIVE_REGION)) { + sendAccessibilityEvent(object.id, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); + } } else if (object.hasFlag(Flag.IS_TEXT_FIELD) && object.didChangeLabel() && mInputFocusedObject != null && mInputFocusedObject.id == object.id) { // Text fields should announce when their label changes while focused. We use a live @@ -851,17 +869,6 @@ public void onMessage(Object message, BasicMessageChannel.Reply reply) { sendAccessibilityEvent(e); break; } - // Requires that the node id provided corresponds to a live region, or TalkBack will - // ignore the event. The event will cause talkback to read out the new label even - // if node is not focused. - case "updateLiveRegion": { - Integer nodeId = (Integer) annotatedEvent.get("nodeId"); - if (nodeId == null) { - return; - } - sendAccessibilityEvent(nodeId, AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); - break; - } } } @@ -947,6 +954,8 @@ private class SemanticsObject { int actions; int textSelectionBase; int textSelectionExtent; + int scrollChildren; + int scrollIndex; float scrollPosition; float scrollExtentMax; float scrollExtentMin; @@ -1048,6 +1057,8 @@ void updateWith(ByteBuffer buffer, String[] strings) { actions = buffer.getInt(); textSelectionBase = buffer.getInt(); textSelectionExtent = buffer.getInt(); + scrollChildren = buffer.getInt(); + scrollIndex = buffer.getInt(); scrollPosition = buffer.getFloat(); scrollExtentMax = buffer.getFloat(); scrollExtentMin = buffer.getFloat(); diff --git a/shell/platform/android/io/flutter/view/FlutterMain.java b/shell/platform/android/io/flutter/view/FlutterMain.java index c68393123377a..bf4312c612698 100644 --- a/shell/platform/android/io/flutter/view/FlutterMain.java +++ b/shell/platform/android/io/flutter/view/FlutterMain.java @@ -32,7 +32,6 @@ public class FlutterMain { 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 SNAPSHOT_BLOB_KEY = "snapshot-blob"; private static final String FLUTTER_ASSETS_DIR_KEY = "flutter-assets-dir"; // XML Attribute keys supported in AndroidManifest.xml @@ -48,8 +47,6 @@ public class FlutterMain { 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_SNAPSHOT_BLOB_KEY = - FlutterMain.class.getName() + '.' + SNAPSHOT_BLOB_KEY; public static final String PUBLIC_FLUTTER_ASSETS_DIR_KEY = FlutterMain.class.getName() + '.' + FLUTTER_ASSETS_DIR_KEY; @@ -60,9 +57,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_SNAPSHOT_BLOB = "snapshot_blob.bin"; private static final String DEFAULT_KERNEL_BLOB = "kernel_blob.bin"; - private static final String DEFAULT_PLATFORM_DILL = "platform_strong.dill"; private static final String DEFAULT_FLUTTER_ASSETS_DIR = "flutter_assets"; // Assets that are shared among all Flutter apps within an APK. @@ -80,7 +75,6 @@ private static String fromFlutterAssets(String filePath) { 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 sSnapshotBlob = DEFAULT_SNAPSHOT_BLOB; private static String sFlutterAssetsDir = DEFAULT_FLUTTER_ASSETS_DIR; private static boolean sInitialized = false; @@ -249,7 +243,6 @@ private static void initConfig(Context applicationContext) { 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); - sSnapshotBlob = metadata.getString(PUBLIC_SNAPSHOT_BLOB_KEY, DEFAULT_SNAPSHOT_BLOB); sFlutterAssetsDir = metadata.getString(PUBLIC_FLUTTER_ASSETS_DIR_KEY, DEFAULT_FLUTTER_ASSETS_DIR); } } catch (PackageManager.NameNotFoundException e) { @@ -263,27 +256,17 @@ private static void initResources(Context applicationContext) { sResourceExtractor = new ResourceExtractor(context); - // Search for the icudtl.dat file at the old and new locations. - // TODO(jsimmons): remove the old location when all tools have been updated. - Set sharedAssets = listAssets(applicationContext, SHARED_ASSET_DIR); - String icuAssetPath; - if (sharedAssets.contains(SHARED_ASSET_ICU_DATA)) { - icuAssetPath = SHARED_ASSET_DIR + File.separator + SHARED_ASSET_ICU_DATA; - } else { - icuAssetPath = SHARED_ASSET_ICU_DATA; - } + String icuAssetPath = SHARED_ASSET_DIR + File.separator + SHARED_ASSET_ICU_DATA; sResourceExtractor.addResource(icuAssetPath); sIcuDataPath = PathUtils.getDataDirectory(applicationContext) + File.separator + icuAssetPath; sResourceExtractor .addResource(fromFlutterAssets(sFlx)) - .addResource(fromFlutterAssets(sSnapshotBlob)) .addResource(fromFlutterAssets(sAotVmSnapshotData)) .addResource(fromFlutterAssets(sAotVmSnapshotInstr)) .addResource(fromFlutterAssets(sAotIsolateSnapshotData)) .addResource(fromFlutterAssets(sAotIsolateSnapshotInstr)) - .addResource(fromFlutterAssets(DEFAULT_KERNEL_BLOB)) - .addResource(fromFlutterAssets(DEFAULT_PLATFORM_DILL)); + .addResource(fromFlutterAssets(DEFAULT_KERNEL_BLOB)); if (sIsPrecompiledAsSharedLibrary) { sResourceExtractor .addResource(sAotSharedLibraryPath); @@ -292,8 +275,7 @@ private static void initResources(Context applicationContext) { .addResource(sAotVmSnapshotData) .addResource(sAotVmSnapshotInstr) .addResource(sAotIsolateSnapshotData) - .addResource(sAotIsolateSnapshotInstr) - .addResource(sSnapshotBlob); + .addResource(sAotIsolateSnapshotInstr); } sResourceExtractor.start(); } diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 0acaa6c4e894c..8a46370248365 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -12,6 +12,7 @@ import android.content.pm.ApplicationInfo; import android.content.res.Configuration; import android.database.ContentObserver; +import android.graphics.PixelFormat; import android.provider.Settings; import android.net.Uri; import android.os.Handler; @@ -69,8 +70,6 @@ public interface Provider { private static final String TAG = "FlutterView"; - private static final String ACTION_DISCOVER = "io.flutter.view.DISCOVER"; - static final class ViewportMetrics { float devicePixelRatio = 1.0f; int physicalWidth = 0; @@ -96,7 +95,6 @@ static final class ViewportMetrics { private final BasicMessageChannel mFlutterLifecycleChannel; private final BasicMessageChannel mFlutterSystemChannel; private final BasicMessageChannel mFlutterSettingsChannel; - private final BroadcastReceiver mDiscoveryReceiver; private final List mActivityLifecycleListeners; private final List mFirstFrameListeners; private final AtomicLong nextTextureId = new AtomicLong(0L); @@ -131,20 +129,11 @@ public FlutterView(Context context, AttributeSet attrs, FlutterNativeView native } mNativeView.attachViewAndActivity(this, activity); - int color = 0xFF000000; - TypedValue typedValue = new TypedValue(); - context.getTheme().resolveAttribute(android.R.attr.colorBackground, typedValue, true); - if (typedValue.type >= TypedValue.TYPE_FIRST_COLOR_INT && typedValue.type <= TypedValue.TYPE_LAST_COLOR_INT) { - color = typedValue.data; - } - // TODO(abarth): Consider letting the developer override this color. - final int backgroundColor = color; - mSurfaceCallback = new SurfaceHolder.Callback() { @Override public void surfaceCreated(SurfaceHolder holder) { assertAttached(); - nativeSurfaceCreated(mNativeView.get(), holder.getSurface(), backgroundColor); + nativeSurfaceCreated(mNativeView.get(), holder.getSurface()); } @Override @@ -183,13 +172,6 @@ public void surfaceDestroyed(SurfaceHolder holder) { setLocale(getResources().getConfiguration().locale); setUserSettings(); - - if ((context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { - mDiscoveryReceiver = new DiscoveryReceiver(); - context.registerReceiver(mDiscoveryReceiver, new IntentFilter(ACTION_DISCOVER)); - } else { - mDiscoveryReceiver = null; - } } private void encodeKeyEvent(KeyEvent event, Map message) { @@ -295,6 +277,26 @@ public void removeFirstFrameListener(FirstFrameListener listener) { mFirstFrameListeners.remove(listener); } + /** + * Updates this to support rendering as a transparent {@link SurfaceView}. + * + * Sets it on top of its window. The background color still needs to be + * controlled from within the Flutter UI itself. + */ + public void enableTransparentBackground() { + setZOrderOnTop(true); + getHolder().setFormat(PixelFormat.TRANSPARENT); + } + + /** + * Reverts this back to the {@link SurfaceView} defaults, at the back of its + * window and opaque. + */ + public void disableTransparentBackground() { + setZOrderOnTop(false); + getHolder().setFormat(PixelFormat.OPAQUE); + } + public void setInitialRoute(String route) { mFlutterNavigationChannel.invokeMethod("setInitialRoute", route); } @@ -332,9 +334,6 @@ float getDevicePixelRatio() { public FlutterNativeView detach() { if (!isAttached()) return null; - if (mDiscoveryReceiver != null) { - getContext().unregisterReceiver(mDiscoveryReceiver); - } getHolder().removeCallback(mSurfaceCallback); mNativeView.detach(); @@ -347,10 +346,6 @@ public void destroy() { if (!isAttached()) return; - if (mDiscoveryReceiver != null) { - getContext().unregisterReceiver(mDiscoveryReceiver); - } - getHolder().removeCallback(mSurfaceCallback); mNativeView.destroy(); @@ -651,8 +646,7 @@ public Bitmap getBitmap() { return nativeGetBitmap(mNativeView.get()); } - private static native void nativeSurfaceCreated(long nativePlatformViewAndroid, Surface surface, - int backgroundColor); + private static native void nativeSurfaceCreated(long nativePlatformViewAndroid, Surface surface); private static native void nativeSurfaceChanged(long nativePlatformViewAndroid, int width, int height); @@ -946,28 +940,6 @@ public void setMessageHandler(String channel, BinaryMessageHandler handler) { mNativeView.setMessageHandler(channel, handler); } - /** - * Broadcast receiver used to discover active Flutter instances. - * - * This is used by the `flutter` tool to find the observatory ports for all the - * active Flutter views. We dump the data to the logs and the tool scrapes the - * log lines for the data. - */ - private class DiscoveryReceiver extends BroadcastReceiver { - @Override - public void onReceive(Context context, Intent intent) { - URI observatoryUri = URI.create(FlutterNativeView.getObservatoryUri()); - JSONObject discover = new JSONObject(); - try { - discover.put("id", getContext().getPackageName()); - discover.put("observatoryPort", observatoryUri.getPort()); - Log.i(TAG, "DISCOVER: " + discover); // The tool looks for this data. See - // android_device.dart. - } catch (JSONException e) { - } - } - } - /** * Listener will be called on the Android UI thread once when Flutter renders * the first frame. @@ -997,9 +969,19 @@ final class SurfaceTextureRegistryEntry implements TextureRegistry.SurfaceTextur this.surfaceTexture.setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() { @Override public void onFrameAvailable(SurfaceTexture texture) { + if (released) { + // Even though we make sure to unregister the callback before releasing, as of Android O + // SurfaceTexture has a data race when accessing the callback, so the callback may + // still be called by a stale reference after released==true and mNativeView==null. + return; + } nativeMarkTextureFrameAvailable(mNativeView.get(), SurfaceTextureRegistryEntry.this.id); } - }); + }, + // The callback relies on being executed on the UI thread (unsynchronised read of mNativeView + // and also the engine code check for platform thread in Shell::OnPlatformViewMarkTextureFrameAvailable), + // so we explicitly pass a Handler for the current thread. + new Handler()); } @Override @@ -1019,6 +1001,9 @@ public void release() { } released = true; nativeUnregisterTexture(mNativeView.get(), id); + // 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(); } } diff --git a/shell/platform/android/platform_view_android.cc b/shell/platform/android/platform_view_android.cc index eea7593e06a18..ee82b44e51604 100644 --- a/shell/platform/android/platform_view_android.cc +++ b/shell/platform/android/platform_view_android.cc @@ -207,7 +207,7 @@ void PlatformViewAndroid::DispatchSemanticsAction(JNIEnv* env, void PlatformViewAndroid::UpdateSemantics( blink::SemanticsNodeUpdates update, blink::CustomAccessibilityActionUpdates actions) { - constexpr size_t kBytesPerNode = 36 * sizeof(int32_t); + constexpr size_t kBytesPerNode = 38 * sizeof(int32_t); constexpr size_t kBytesPerChild = sizeof(int32_t); constexpr size_t kBytesPerAction = 4 * sizeof(int32_t); @@ -243,6 +243,8 @@ void PlatformViewAndroid::UpdateSemantics( buffer_int32[position++] = node.actions; buffer_int32[position++] = node.textSelectionBase; buffer_int32[position++] = node.textSelectionExtent; + buffer_int32[position++] = node.scrollChildren; + buffer_int32[position++] = node.scrollIndex; buffer_float32[position++] = (float)node.scrollPosition; buffer_float32[position++] = (float)node.scrollExtentMax; buffer_float32[position++] = (float)node.scrollExtentMin; diff --git a/shell/platform/android/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index 315ac0b55bdc0..d93f9357144a6 100644 --- a/shell/platform/android/platform_view_android_jni.cc +++ b/shell/platform/android/platform_view_android_jni.cc @@ -176,8 +176,7 @@ static jstring GetObservatoryUri(JNIEnv* env, jclass clazz) { static void SurfaceCreated(JNIEnv* env, jobject jcaller, jlong shell_holder, - jobject jsurface, - jint backgroundColor) { + jobject jsurface) { // Note: This frame ensures that any local references used by // ANativeWindow_fromSurface are released immediately. This is needed as a // workaround for https://code.google.com/p/android/issues/detail?id=68174 @@ -218,10 +217,10 @@ std::unique_ptr CreateIsolateConfiguration( return IsolateConfiguration::CreateForKernelList(std::move(kernels)); } if (blob) { - return IsolateConfiguration::CreateForSnapshot(std::move(blob)); + return IsolateConfiguration::CreateForKernel(std::move(blob)); } if (delta) { - return IsolateConfiguration::CreateForSnapshot(std::move(delta)); + return IsolateConfiguration::CreateForKernel(std::move(delta)); } return nullptr; }; @@ -229,9 +228,6 @@ std::unique_ptr CreateIsolateConfiguration( if (auto kernel = configuration_from_blob("kernel_blob.bin")) { return kernel; } - if (auto script = configuration_from_blob("snapshot_blob.bin")) { - return script; - } // This happens when starting isolate directly from CoreJIT snapshot. return IsolateConfiguration::CreateForAppSnapshot(); @@ -638,7 +634,7 @@ bool PlatformViewAndroid::Register(JNIEnv* env) { static const JNINativeMethod view_methods[] = { { .name = "nativeSurfaceCreated", - .signature = "(JLandroid/view/Surface;I)V", + .signature = "(JLandroid/view/Surface;)V", .fnPtr = reinterpret_cast(&shell::SurfaceCreated), }, { diff --git a/shell/platform/darwin/BUILD.gn b/shell/platform/darwin/BUILD.gn index e608a9dd6af48..9f4dfca0714c9 100644 --- a/shell/platform/darwin/BUILD.gn +++ b/shell/platform/darwin/BUILD.gn @@ -28,6 +28,7 @@ source_set("flutter_channels") { "ios/framework/Headers/FlutterBinaryMessenger.h", "ios/framework/Headers/FlutterChannels.h", "ios/framework/Headers/FlutterCodecs.h", + "ios/framework/Headers/FlutterMacros.h", "ios/framework/Source/FlutterChannels.mm", "ios/framework/Source/FlutterCodecs.mm", "ios/framework/Source/FlutterStandardCodec.mm", diff --git a/shell/platform/darwin/ios/framework/Headers/Flutter.h b/shell/platform/darwin/ios/framework/Headers/Flutter.h index 668a39eed354a..49464e40dc06b 100644 --- a/shell/platform/darwin/ios/framework/Headers/Flutter.h +++ b/shell/platform/darwin/ios/framework/Headers/Flutter.h @@ -8,6 +8,10 @@ /** BREAKING CHANGES: + August 31, 2018: Marked -[FlutterDartProject + initFromDefaultSourceForConfiguration] and FlutterStandardBigInteger as + unavailable. + July 26, 2018: Marked -[FlutterDartProject initFromDefaultSourceForConfiguration] deprecated. diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h b/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h index 8f06d51ea94c0..54d7eeca54fda 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h @@ -154,13 +154,6 @@ FLUTTER_EXPORT - `FlutterStandardTypedData`: `Uint8List`, `Int32List`, `Int64List`, or `Float64List` - `NSArray`: `List` - `NSDictionary`: `Map` - - Support for `FlutterStandardBigInteger` has been deprecated on 2018-01-09 to be - made unavailable four weeks after this change is available on the Flutter alpha - branch. `FlutterStandardBigInteger` were needed because the Dart 1.0 `int` type - had no size limit. With Dart 2.0, the `int` type is a fixed-size, 64-bit signed - integer. If you need to communicate larger integers, use `NSString` encoding - instead. */ FLUTTER_EXPORT @interface FlutterStandardMessageCodec : NSObject @@ -309,25 +302,13 @@ FLUTTER_EXPORT and `FlutterStandardMethodCodec`. */ FLUTTER_EXPORT -FLUTTER_DEPRECATED( - "Deprecated on 2018-01-09 to be made unavailable four weeks after the " - "deprecation is available on the flutter/flutter alpha branch. " +FLUTTER_UNAVAILABLE( + "Unavailable on 2018-08-31. Deprecated on 2018-01-09. " "FlutterStandardBigInteger was needed because the Dart 1.0 int type had no " "size limit. With Dart 2.0, the int type is a fixed-size, 64-bit signed " "integer. If you need to communicate larger integers, use NSString encoding " "instead.") @interface FlutterStandardBigInteger : NSObject -/** - Creates a `FlutterStandardBigInteger` from a hexadecimal representation. - - - Parameter hex: a hexadecimal string. - */ -+ (instancetype)bigIntegerWithHex:(NSString*)hex; - -/** - The hexadecimal string representation of this integer. - */ -@property(readonly, nonatomic) NSString* hex; @end /** diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h b/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h index 08e7cea2e4f0e..bef67aa04a937 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h @@ -21,7 +21,7 @@ FLUTTER_EXPORT - (instancetype)initWithFlutterAssetsWithScriptSnapshot:(NSURL*)flutterAssetsURL NS_DESIGNATED_INITIALIZER; -- (instancetype)initFromDefaultSourceForConfiguration FLUTTER_DEPRECATED("Use -init instead."); +- (instancetype)initFromDefaultSourceForConfiguration FLUTTER_UNAVAILABLE("Use -init instead."); /** Returns the file name for the given asset. diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h b/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h index ea19d1cb5fb12..e3050963192e1 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h @@ -21,7 +21,7 @@ #endif // defined(NS_ASSUME_NONNULL_BEGIN) /** - Indicates that the API has been deprecated for the specifed reason. Code that + Indicates that the API has been deprecated for the specified reason. Code that uses the deprecated API will continue to work as before. However, the API will soon become unavailable and users are encouraged to immediately take the appropriate action mentioned in the deprecation message and the BREAKING diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h b/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h index 6250089aed536..e640bb7a8a65b 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h @@ -53,6 +53,20 @@ FLUTTER_EXPORT - (id)pluginRegistry; +/** + Specifies the view to use as a splash screen. Flutter's rendering is asynchronous, so the first + frame rendered by the Flutter application might not immediately appear when the Flutter view is + initially placed in the view hierarchy. The splash screen view will be used as a replacement + until the first frame is rendered. + + The view used should be appropriate for multiple sizes; an autoresizing mask to have a flexible + width and height will be applied automatically. + + If not specified, uses a view generated from `UILaunchStoryboardName` from the main bundle's + `Info.plist` file. + */ +@property(strong, nonatomic) UIView* splashScreenView; + @end #endif // FLUTTER_FLUTTERVIEWCONTROLLER_H_ diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index a89c61acfccb7..f5d5d80dfe41a 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -15,8 +15,6 @@ #include "flutter/shell/platform/darwin/common/command_line.h" #include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h" -static const char* kScriptSnapshotFileName = "snapshot_blob.bin"; -static const char* kVMKernelSnapshotFileName = "platform_strong.dill"; static const char* kApplicationKernelSnapshotFileName = "kernel_blob.bin"; static blink::Settings DefaultSettingsForProcess(NSBundle* bundle = nil) { @@ -83,8 +81,8 @@ // In case the application bundle is still not specified, look for the App.framework in the // Frameworks directory. if (settings.application_library_path.size() == 0) { - NSString* applicationFrameworkPath = - [mainBundle pathForResource:@"Frameworks/App.framework" ofType:@""]; + NSString* applicationFrameworkPath = [mainBundle pathForResource:@"Frameworks/App.framework" + ofType:@""]; if (applicationFrameworkPath.length > 0) { NSString* executablePath = [NSBundle bundleWithPath:applicationFrameworkPath].executablePath; @@ -106,25 +104,6 @@ if (!blink::DartVM::IsRunningPrecompiledCode()) { // Looking for the various script and kernel snapshot buffers only makes sense if we have a // VM that can use these buffers. - { - // Check if there is a script snapshot in the assets directory we could potentially use. - NSURL* scriptSnapshotURL = [NSURL URLWithString:@(kScriptSnapshotFileName) - relativeToURL:[NSURL fileURLWithPath:assetsPath]]; - if ([[NSFileManager defaultManager] fileExistsAtPath:scriptSnapshotURL.path]) { - settings.script_snapshot_path = scriptSnapshotURL.path.UTF8String; - } - } - - { - // Check if there is a VM kernel snapshot in the assets directory we could potentially - // use. - NSURL* vmKernelSnapshotURL = [NSURL URLWithString:@(kVMKernelSnapshotFileName) - relativeToURL:[NSURL fileURLWithPath:assetsPath]]; - if ([[NSFileManager defaultManager] fileExistsAtPath:vmKernelSnapshotURL.path]) { - settings.platform_kernel_path = vmKernelSnapshotURL.path.UTF8String; - } - } - { // Check if there is an application kernel snapshot in the assets directory we could // potentially use. @@ -196,24 +175,13 @@ - (instancetype)initWithFlutterAssetsWithScriptSnapshot:(NSURL*)flutterAssetsURL if (flutterAssetsURL != nil && [[NSFileManager defaultManager] fileExistsAtPath:flutterAssetsURL.path]) { _settings.assets_path = flutterAssetsURL.path.UTF8String; - - NSURL* scriptSnapshotPath = - [NSURL URLWithString:@(kScriptSnapshotFileName) relativeToURL:flutterAssetsURL]; - if ([[NSFileManager defaultManager] fileExistsAtPath:scriptSnapshotPath.path]) { - _settings.script_snapshot_path = scriptSnapshotPath.path.UTF8String; - } } } return self; } -#pragma mark - Convenience initializers - -// Exists for backward-compatibility. Expect this to be removed. -- (instancetype)initFromDefaultSourceForConfiguration { - return [self init]; -} +#pragma mark - Settings accessors - (const blink::Settings&)settings { return _settings; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm index f995adfd95ccc..a70fe44036fd6 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm @@ -203,41 +203,6 @@ - (NSUInteger)hash { } @end -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - -@implementation FlutterStandardBigInteger -+ (instancetype)bigIntegerWithHex:(NSString*)hex { - return [[[FlutterStandardBigInteger alloc] initWithHex:hex] autorelease]; -} - -- (instancetype)initWithHex:(NSString*)hex { - NSAssert(hex, @"Hex cannot be nil"); - self = [super init]; - NSAssert(self, @"Super init cannot be nil"); - _hex = [hex retain]; - return self; -} - -- (void)dealloc { - [_hex release]; - [super dealloc]; -} - -- (BOOL)isEqual:(id)object { - if (self == object) - return YES; - if (![object isKindOfClass:[FlutterStandardBigInteger class]]) - return NO; - FlutterStandardBigInteger* other = (FlutterStandardBigInteger*)object; - return [self.hex isEqual:other.hex]; -} - -- (NSUInteger)hash { - return [self.hex hash]; -} -@end - #pragma mark - Writer and reader of standard codec @implementation FlutterStandardWriter { @@ -336,10 +301,6 @@ - (void)writeValue:(id)value { NSString* string = value; [self writeByte:FlutterStandardFieldString]; [self writeUTF8:string]; - } else if ([value isKindOfClass:[FlutterStandardBigInteger class]]) { - FlutterStandardBigInteger* bigInt = value; - [self writeByte:FlutterStandardFieldIntHex]; - [self writeUTF8:bigInt.hex]; } else if ([value isKindOfClass:[FlutterStandardTypedData class]]) { FlutterStandardTypedData* typedData = value; [self writeByte:FlutterStandardFieldForDataType(typedData.type)]; @@ -479,7 +440,6 @@ - (id)readValueOfType:(UInt8)type { return [NSNumber numberWithDouble:value]; } case FlutterStandardFieldIntHex: - return [FlutterStandardBigInteger bigIntegerWithHex:[self readUTF8]]; case FlutterStandardFieldString: return [self readUTF8]; case FlutterStandardFieldUInt8Data: @@ -522,4 +482,3 @@ - (FlutterStandardReader*)readerWithData:(NSData*)data { return [[[FlutterStandardReader alloc] initWithData:data] autorelease]; } @end -#pragma clang diagnostic pop diff --git a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h index e4129e3732188..24197e1ea8d6a 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h @@ -16,6 +16,7 @@ typedef NS_ENUM(NSInteger, FlutterStandardField) { FlutterStandardFieldIntHex, FlutterStandardFieldFloat64, FlutterStandardFieldString, + // The following must match the corresponding order from `FlutterStandardDataType`. FlutterStandardFieldUInt8Data, FlutterStandardFieldInt32Data, FlutterStandardFieldInt64Data, diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 27b8e3738ce76..f90d2862eaf56 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -49,7 +49,7 @@ @implementation FlutterViewController { // We keep a separate reference to this and create it ahead of time because we want to be able to // setup a shell along with its platform view before the view has to appear. fml::scoped_nsobject _flutterView; - fml::scoped_nsobject _launchView; + fml::scoped_nsobject _splashScreenView; UIInterfaceOrientationMask _orientationPreferences; UIStatusBarStyle _statusBarStyle; blink::ViewportMetrics _viewportMetrics; @@ -322,47 +322,46 @@ - (void)loadView { self.view.multipleTouchEnabled = YES; self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [self installLaunchViewIfNecessary]; + [self installSplashScreenViewIfNecessary]; } #pragma mark - Managing launch views -- (void)installLaunchViewIfNecessary { +- (void)installSplashScreenViewIfNecessary { // Show the launch screen view again on top of the FlutterView if available. // This launch screen view will be removed once the first Flutter frame is rendered. - [_launchView.get() removeFromSuperview]; - _launchView.reset(); - NSString* launchStoryboardName = - [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UILaunchStoryboardName"]; - if (launchStoryboardName && !self.isBeingPresented && !self.isMovingToParentViewController) { - UIViewController* launchViewController = - [[UIStoryboard storyboardWithName:launchStoryboardName bundle:nil] - instantiateInitialViewController]; - _launchView.reset([launchViewController.view retain]); - _launchView.get().frame = self.view.bounds; - _launchView.get().autoresizingMask = - UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [self.view addSubview:_launchView.get()]; + if (self.isBeingPresented || self.isMovingToParentViewController) { + [_splashScreenView.get() removeFromSuperview]; + _splashScreenView.reset(); + return; + } + + // Use the property getter to initialize the default value. + UIView* splashScreenView = self.splashScreenView; + if (splashScreenView == nil) { + return; } + splashScreenView.frame = self.view.bounds; + [self.view addSubview:splashScreenView]; } -- (void)removeLaunchViewIfPresent { - if (!_launchView) { +- (void)removeSplashScreenViewIfPresent { + if (!_splashScreenView) { return; } [UIView animateWithDuration:0.2 animations:^{ - _launchView.get().alpha = 0; + _splashScreenView.get().alpha = 0; } completion:^(BOOL finished) { - [_launchView.get() removeFromSuperview]; - _launchView.reset(); + [_splashScreenView.get() removeFromSuperview]; + _splashScreenView.reset(); }]; } -- (void)installLaunchViewCallback { - if (!_shell || !_launchView) { +- (void)installSplashScreenViewCallback { + if (!_shell || !_splashScreenView) { return; } auto weak_platform_view = _shell->GetPlatformView(); @@ -381,18 +380,43 @@ - (void)installLaunchViewCallback { // association. Thus, we are not convinced that the unsafe unretained weak object is in // fact alive. if (weak_platform_view) { - [weak_flutter_view_controller removeLaunchViewIfPresent]; + [weak_flutter_view_controller removeSplashScreenViewIfPresent]; } }); }); } +#pragma mark - Properties + +- (UIView*)splashScreenView { + if (_splashScreenView == nullptr) { + NSString* launchStoryboardName = + [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UILaunchStoryboardName"]; + if (launchStoryboardName == nil) { + return nil; + } + UIStoryboard* storyboard = [UIStoryboard storyboardWithName:launchStoryboardName bundle:nil]; + if (storyboard == nil) { + return nil; + } + UIViewController* splashScreenViewController = [storyboard instantiateInitialViewController]; + self.splashScreenView = splashScreenViewController.view; + } + return _splashScreenView.get(); +} + +- (void)setSplashScreenView:(UIView*)view { + _splashScreenView.reset([view retain]); + _splashScreenView.get().autoresizingMask = + UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; +} + #pragma mark - Surface creation and teardown updates - (void)surfaceUpdated:(BOOL)appeared { // NotifyCreated/NotifyDestroyed are synchronous and require hops between the UI and GPU thread. if (appeared) { - [self installLaunchViewCallback]; + [self installSplashScreenViewCallback]; _shell->GetPlatformView()->NotifyCreated(); } else { @@ -815,7 +839,7 @@ - (void)onAccessibilityStatusChanged:(NSNotification*)notification { if (UIAccessibilityIsInvertColorsEnabled()) flags ^= static_cast(blink::AccessibilityFeatureFlag::kInvertColors); if (UIAccessibilityIsReduceMotionEnabled()) - flags ^= static_cast(blink::AccessibilityFeatureFlag::kDisableAnimations); + flags ^= static_cast(blink::AccessibilityFeatureFlag::kReduceMotion); if (UIAccessibilityIsBoldTextEnabled()) flags ^= static_cast(blink::AccessibilityFeatureFlag::kBoldText); #if TARGET_OS_SIMULATOR diff --git a/shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm b/shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm index af32c95fa714b..402962c6637d0 100644 --- a/shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm +++ b/shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm @@ -66,16 +66,13 @@ void checkEncodeDecode(id value) { checkEncodeDecode(@(value), [NSData dataWithBytes:bytes length:9]); } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" TEST(FlutterStandardCodec, CanEncodeAndDecodeUInt64AsHexString) { FlutterStandardMessageCodec* codec = [FlutterStandardMessageCodec sharedInstance]; UInt64 u64 = 0xfffffffffffffffa; NSData* encoded = [codec encode:@(u64)]; - FlutterStandardBigInteger* decoded = [codec decode:encoded]; - ASSERT_TRUE([decoded.hex isEqual:@"fffffffffffffffa"]); + NSString* decoded = [codec decode:encoded]; + ASSERT_TRUE([decoded isEqual:@"fffffffffffffffa"]); } -#pragma clang diagnostic pop TEST(FlutterStandardCodec, CanEncodeAndDecodeSInt8) { uint8_t bytes[5] = {0x03, 0xfe, 0xff, 0xff, 0xff}; @@ -99,15 +96,6 @@ void checkEncodeDecode(id value) { checkEncodeDecode(@(0x1234567890abcdef), [NSData dataWithBytes:bytes length:9]); } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -TEST(FlutterStandardCodec, CanEncodeAndDecodeBigInteger) { - FlutterStandardBigInteger* value = - [FlutterStandardBigInteger bigIntegerWithHex:@"-abcdef0123456789abcdef01234567890"]; - checkEncodeDecode(value); -} -#pragma clang diagnostic pop - TEST(FlutterStandardCodec, CanEncodeAndDecodeFloat32) { uint8_t bytes[16] = {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xfb, 0x21, 0x09, 0x40}; diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index 4efa7cbbed9eb..fcd2dc5a2aed4 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -7,7 +7,7 @@ import("$flutter_root/shell/gpu/gpu.gni") import("$flutter_root/shell/platform/embedder/embedder.gni") shell_gpu_configuration("embedder_gpu_configuration") { - enable_software = false + enable_software = true enable_vulkan = false enable_gl = true } @@ -16,6 +16,12 @@ source_set("embedder") { sources = [ "embedder.cc", "embedder.h", + "embedder_surface.cc", + "embedder_surface.h", + "embedder_surface_gl.cc", + "embedder_surface_gl.h", + "embedder_surface_software.cc", + "embedder_surface_software.h", "embedder_engine.cc", "embedder_engine.h", "embedder_include.c", diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 37509d6761bb0..d0a87703b9c9b 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -39,8 +39,8 @@ return static_castmember)>((default_value)); \ })() -bool IsRendererValid(const FlutterRendererConfig* config) { - if (config == nullptr || config->type != kOpenGL) { +static bool IsOpenGLRendererConfigValid(const FlutterRendererConfig* config) { + if (config->type != kOpenGL) { return false; } @@ -56,76 +56,68 @@ bool IsRendererValid(const FlutterRendererConfig* config) { return true; } -struct _FlutterPlatformMessageResponseHandle { - fml::RefPtr message; -}; - -FlutterResult FlutterEngineRun(size_t version, - const FlutterRendererConfig* config, - const FlutterProjectArgs* args, - void* user_data, - FlutterEngine* engine_out) { - // Step 0: Figure out arguments for shell creation. - if (version != FLUTTER_ENGINE_VERSION) { - return kInvalidLibraryVersion; +static bool IsSoftwareRendererConfigValid(const FlutterRendererConfig* config) { + if (config->type != kSoftware) { + return false; } - if (engine_out == nullptr) { - return kInvalidArguments; + const FlutterSoftwareRendererConfig* software_config = &config->software; + + if (SAFE_ACCESS(software_config, surface_present_callback, nullptr) == + nullptr) { + return false; } - if (args == nullptr) { - return kInvalidArguments; + return true; +} + +static bool IsRendererValid(const FlutterRendererConfig* config) { + if (config == nullptr) { + return false; } - if (SAFE_ACCESS(args, assets_path, nullptr) == nullptr || - SAFE_ACCESS(args, main_path, nullptr) == nullptr || - SAFE_ACCESS(args, packages_path, nullptr) == nullptr) { - return kInvalidArguments; + switch (config->type) { + case kOpenGL: + return IsOpenGLRendererConfigValid(config); + case kSoftware: + return IsSoftwareRendererConfigValid(config); + default: + return false; } - if (!IsRendererValid(config)) { - return kInvalidArguments; + return false; +} + +static shell::Shell::CreateCallback +InferOpenGLPlatformViewCreationCallback( + const FlutterRendererConfig* config, + void* user_data, + shell::PlatformViewEmbedder::PlatformDispatchTable + platform_dispatch_table) { + if (config->type != kOpenGL) { + return nullptr; } - auto make_current = [ptr = config->open_gl.make_current, - user_data]() -> bool { return ptr(user_data); }; + auto gl_make_current = [ptr = config->open_gl.make_current, + user_data]() -> bool { return ptr(user_data); }; - auto clear_current = [ptr = config->open_gl.clear_current, - user_data]() -> bool { return ptr(user_data); }; + auto gl_clear_current = [ptr = config->open_gl.clear_current, + user_data]() -> bool { return ptr(user_data); }; - auto present = [ptr = config->open_gl.present, user_data]() -> bool { + auto gl_present = [ptr = config->open_gl.present, user_data]() -> bool { return ptr(user_data); }; - auto fbo_callback = [ptr = config->open_gl.fbo_callback, - user_data]() -> intptr_t { return ptr(user_data); }; - - shell::PlatformViewEmbedder::PlatformMessageResponseCallback - platform_message_response_callback = nullptr; - if (SAFE_ACCESS(args, platform_message_callback, nullptr) != nullptr) { - platform_message_response_callback = - [ptr = args->platform_message_callback, - user_data](fml::RefPtr message) { - auto handle = new FlutterPlatformMessageResponseHandle(); - const FlutterPlatformMessage incoming_message = { - sizeof(FlutterPlatformMessage), // struct_size - message->channel().c_str(), // channel - message->data().data(), // message - message->data().size(), // message_size - handle, // response_handle - }; - handle->message = std::move(message); - return ptr(&incoming_message, user_data); - }; - } + auto gl_fbo_callback = [ptr = config->open_gl.fbo_callback, + user_data]() -> intptr_t { return ptr(user_data); }; const FlutterOpenGLRendererConfig* open_gl_config = &config->open_gl; - std::function make_resource_current_callback = nullptr; + std::function gl_make_resource_current_callback = nullptr; if (SAFE_ACCESS(open_gl_config, make_resource_current, nullptr) != nullptr) { - make_resource_current_callback = [ptr = - config->open_gl.make_resource_current, - user_data]() { return ptr(user_data); }; + gl_make_resource_current_callback = + [ptr = config->open_gl.make_resource_current, user_data]() { + return ptr(user_data); + }; } std::function gl_surface_transformation_callback = nullptr; @@ -146,9 +138,126 @@ FlutterResult FlutterEngineRun(size_t version, }; } + shell::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) { + return ptr(user_data, gl_proc_name); + }; + } + bool fbo_reset_after_present = SAFE_ACCESS(open_gl_config, fbo_reset_after_present, false); + shell::EmbedderSurfaceGL::GLDispatchTable gl_dispatch_table = { + gl_make_current, // gl_make_current_callback + gl_clear_current, // gl_clear_current_callback + gl_present, // gl_present_callback + gl_fbo_callback, // gl_fbo_callback + gl_make_resource_current_callback, // gl_make_resource_current_callback + gl_surface_transformation_callback, // gl_surface_transformation_callback + gl_proc_resolver, // gl_proc_resolver + }; + + return [gl_dispatch_table, fbo_reset_after_present, + platform_dispatch_table](shell::Shell& shell) { + return std::make_unique( + shell, // delegate + shell.GetTaskRunners(), // task runners + gl_dispatch_table, // embedder GL dispatch table + fbo_reset_after_present, // fbo reset after present + platform_dispatch_table // embedder platform dispatch table + ); + }; +} + +static shell::Shell::CreateCallback +InferSoftwarePlatformViewCreationCallback( + const FlutterRendererConfig* config, + void* user_data, + shell::PlatformViewEmbedder::PlatformDispatchTable + platform_dispatch_table) { + if (config->type != kSoftware) { + return nullptr; + } + + auto software_present_backing_store = + [ptr = config->software.surface_present_callback, user_data]( + const void* allocation, size_t row_bytes, size_t height) -> bool { + return ptr(user_data, allocation, row_bytes, height); + }; + + shell::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 + ); + }; +} + +static shell::Shell::CreateCallback +InferPlatformViewCreationCallback( + const FlutterRendererConfig* config, + void* user_data, + shell::PlatformViewEmbedder::PlatformDispatchTable + platform_dispatch_table) { + if (config == nullptr) { + return nullptr; + } + + switch (config->type) { + case kOpenGL: + return InferOpenGLPlatformViewCreationCallback(config, user_data, + platform_dispatch_table); + case kSoftware: + return InferSoftwarePlatformViewCreationCallback(config, user_data, + platform_dispatch_table); + default: + return nullptr; + } + return nullptr; +} + +struct _FlutterPlatformMessageResponseHandle { + fml::RefPtr message; +}; + +FlutterResult FlutterEngineRun(size_t version, + const FlutterRendererConfig* config, + const FlutterProjectArgs* args, + void* user_data, + FlutterEngine* engine_out) { + // Step 0: Figure out arguments for shell creation. + if (version != FLUTTER_ENGINE_VERSION) { + return kInvalidLibraryVersion; + } + + if (engine_out == nullptr) { + return kInvalidArguments; + } + + if (args == nullptr) { + return kInvalidArguments; + } + + if (SAFE_ACCESS(args, assets_path, nullptr) == nullptr || + SAFE_ACCESS(args, main_path, nullptr) == nullptr || + SAFE_ACCESS(args, packages_path, nullptr) == nullptr) { + return kInvalidArguments; + } + + if (!IsRendererValid(config)) { + return kInvalidArguments; + } + std::string icu_data_path; if (SAFE_ACCESS(args, icu_data_path, nullptr) != nullptr) { icu_data_path = SAFE_ACCESS(args, icu_data_path, nullptr); @@ -168,16 +277,11 @@ FlutterResult FlutterEngineRun(size_t version, // Check whether the assets path contains Dart 2 kernel assets. const std::string kApplicationKernelSnapshotFileName = "kernel_blob.bin"; - std::string platform_kernel_path = - fml::paths::JoinPaths({settings.assets_path, "platform_strong.dill"}); std::string application_kernel_path = fml::paths::JoinPaths( {settings.assets_path, kApplicationKernelSnapshotFileName}); if (fml::IsFile(application_kernel_path)) { // Run from a kernel snapshot. - settings.platform_kernel_path = platform_kernel_path; - if (fml::IsFile(platform_kernel_path)) { - settings.application_kernel_asset = kApplicationKernelSnapshotFileName; - } + settings.application_kernel_asset = kApplicationKernelSnapshotFileName; } else { // Run from a main Dart file. settings.main_dart_file_path = args->main_path; @@ -205,25 +309,35 @@ FlutterResult FlutterEngineRun(size_t version, thread_host.io_thread->GetTaskRunner() // io ); - shell::PlatformViewEmbedder::DispatchTable dispatch_table = { - make_current, // gl_make_current_callback - clear_current, // gl_clear_current_callback - present, // gl_present_callback - fbo_callback, // gl_fbo_callback + shell::PlatformViewEmbedder::PlatformMessageResponseCallback + platform_message_response_callback = nullptr; + if (SAFE_ACCESS(args, platform_message_callback, nullptr) != nullptr) { + platform_message_response_callback = + [ptr = args->platform_message_callback, + user_data](fml::RefPtr message) { + auto handle = new FlutterPlatformMessageResponseHandle(); + const FlutterPlatformMessage incoming_message = { + sizeof(FlutterPlatformMessage), // struct_size + message->channel().c_str(), // channel + message->data().data(), // message + message->data().size(), // message_size + handle, // response_handle + }; + handle->message = std::move(message); + return ptr(&incoming_message, user_data); + }; + } + + shell::PlatformViewEmbedder::PlatformDispatchTable platform_dispatch_table = { platform_message_response_callback, // platform_message_response_callback - make_resource_current_callback, // gl_make_resource_current_callback - gl_surface_transformation_callback // gl_surface_transformation_callback }; - shell::Shell::CreateCallback on_create_platform_view = - [dispatch_table, fbo_reset_after_present](shell::Shell& shell) { - return std::make_unique( - shell, // delegate - shell.GetTaskRunners(), // task runners - dispatch_table, // embedder dispatch table - fbo_reset_after_present // fbo reset after present - ); - }; + auto on_create_platform_view = InferPlatformViewCreationCallback( + config, user_data, platform_dispatch_table); + + if (!on_create_platform_view) { + return kInvalidArguments; + } shell::Shell::CreateCallback on_create_rasterizer = [](shell::Shell& shell) { diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 68bed60eeaa92..6a4928f0d0172 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -27,6 +27,7 @@ typedef enum { typedef enum { kOpenGL, + kSoftware, } FlutterRendererType; typedef struct _FlutterEngine* FlutterEngine; @@ -55,6 +56,11 @@ typedef struct { typedef bool (*BoolCallback)(void* /* user data */); typedef FlutterTransformation (*TransformationCallback)(void* /* user data */); typedef uint32_t (*UIntCallback)(void* /* user data */); +typedef bool (*SoftwareSurfacePresentCallback)(void* /* user data */, + const void* /* allocation */, + size_t /* row bytes */, + size_t /* height */); +typedef void* (*ProcResolver)(void* /* user data */, const char* /* name */); typedef struct { // The size of this struct. Must be sizeof(FlutterOpenGLRendererConfig). @@ -72,12 +78,24 @@ typedef struct { // The transformation to apply to the render target before any rendering // operations. This callback is optional. TransformationCallback surface_transformation; + ProcResolver gl_proc_resolver; } FlutterOpenGLRendererConfig; +typedef struct { + // The size of this struct. Must be sizeof(FlutterSoftwareRendererConfig). + size_t struct_size; + // The callback presented to the embedder to present a fully populated buffer + // to the user. The pixel format of the buffer is the native 32-bit RGBA + // format. The buffer is owned by the Flutter engine and must be copied in + // this callback if needed. + SoftwareSurfacePresentCallback surface_present_callback; +} FlutterSoftwareRendererConfig; + typedef struct { FlutterRendererType type; union { FlutterOpenGLRendererConfig open_gl; + FlutterSoftwareRendererConfig software; }; } FlutterRendererConfig; diff --git a/shell/platform/embedder/embedder_surface.cc b/shell/platform/embedder/embedder_surface.cc new file mode 100644 index 0000000000000..d14b114e7410c --- /dev/null +++ b/shell/platform/embedder/embedder_surface.cc @@ -0,0 +1,13 @@ +// Copyright 2018 The Flutter 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_surface.h" + +namespace shell { + +EmbedderSurface::EmbedderSurface() = default; + +EmbedderSurface::~EmbedderSurface() = default; + +} // namespace shell diff --git a/shell/platform/embedder/embedder_surface.h b/shell/platform/embedder/embedder_surface.h new file mode 100644 index 0000000000000..5db1394875b29 --- /dev/null +++ b/shell/platform/embedder/embedder_surface.h @@ -0,0 +1,31 @@ +// Copyright 2018 The Flutter 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_SURFACE_H_ +#define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_H_ + +#include "flutter/fml/macros.h" +#include "flutter/shell/common/surface.h" + +namespace shell { + +class EmbedderSurface { + public: + EmbedderSurface(); + + virtual ~EmbedderSurface(); + + virtual bool IsValid() const = 0; + + virtual std::unique_ptr CreateGPUSurface() = 0; + + virtual sk_sp CreateResourceContext() const = 0; + + private: + FML_DISALLOW_COPY_AND_ASSIGN(EmbedderSurface); +}; + +} // namespace shell + +#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 new file mode 100644 index 0000000000000..1ee37c0615564 --- /dev/null +++ b/shell/platform/embedder/embedder_surface_gl.cc @@ -0,0 +1,93 @@ +// Copyright 2018 The Flutter 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_surface_gl.h" + +#include "flutter/shell/common/io_manager.h" + +#ifdef ERROR +#undef ERROR +#endif + +namespace shell { + +EmbedderSurfaceGL::EmbedderSurfaceGL(GLDispatchTable gl_dispatch_table, + bool fbo_reset_after_present) + : gl_dispatch_table_(gl_dispatch_table), + fbo_reset_after_present_(fbo_reset_after_present) { + // Make sure all required members of the dispatch table are checked. + if (!gl_dispatch_table_.gl_make_current_callback || + !gl_dispatch_table_.gl_clear_current_callback || + !gl_dispatch_table_.gl_present_callback || + !gl_dispatch_table_.gl_fbo_callback) { + return; + } + + valid_ = true; +} + +EmbedderSurfaceGL::~EmbedderSurfaceGL() = default; + +// |shell::EmbedderSurface| +bool EmbedderSurfaceGL::IsValid() const { + return valid_; +} + +// |shell::GPUSurfaceGLDelegate| +bool EmbedderSurfaceGL::GLContextMakeCurrent() { + return gl_dispatch_table_.gl_make_current_callback(); +} + +// |shell::GPUSurfaceGLDelegate| +bool EmbedderSurfaceGL::GLContextClearCurrent() { + return gl_dispatch_table_.gl_clear_current_callback(); +} + +// |shell::GPUSurfaceGLDelegate| +bool EmbedderSurfaceGL::GLContextPresent() { + return gl_dispatch_table_.gl_present_callback(); +} + +// |shell::GPUSurfaceGLDelegate| +intptr_t EmbedderSurfaceGL::GLContextFBO() const { + return gl_dispatch_table_.gl_fbo_callback(); +} + +// |shell::GPUSurfaceGLDelegate| +bool EmbedderSurfaceGL::GLContextFBOResetAfterPresent() const { + return fbo_reset_after_present_; +} + +// |shell::GPUSurfaceGLDelegate| +SkMatrix EmbedderSurfaceGL::GLContextSurfaceTransformation() const { + auto callback = gl_dispatch_table_.gl_surface_transformation_callback; + if (!callback) { + SkMatrix matrix; + matrix.setIdentity(); + return matrix; + } + return callback(); +} + +// |shell::GPUSurfaceGLDelegate| +EmbedderSurfaceGL::GLProcResolver EmbedderSurfaceGL::GetGLProcResolver() const { + return gl_dispatch_table_.gl_proc_resolver; +} + +// |shell::EmbedderSurface| +std::unique_ptr EmbedderSurfaceGL::CreateGPUSurface() { + return std::make_unique(this); +} + +// |shell::EmbedderSurface| +sk_sp EmbedderSurfaceGL::CreateResourceContext() const { + auto callback = gl_dispatch_table_.gl_make_resource_current_callback; + if (callback && callback()) { + return IOManager::CreateCompatibleResourceLoadingContext( + GrBackend::kOpenGL_GrBackend); + } + return nullptr; +} + +} // namespace shell diff --git a/shell/platform/embedder/embedder_surface_gl.h b/shell/platform/embedder/embedder_surface_gl.h new file mode 100644 index 0000000000000..8fd40885ee3b6 --- /dev/null +++ b/shell/platform/embedder/embedder_surface_gl.h @@ -0,0 +1,73 @@ +// Copyright 2018 The Flutter 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_SURFACE_GL_H_ +#define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_GL_H_ + +#include "flutter/fml/macros.h" +#include "flutter/shell/gpu/gpu_surface_gl.h" +#include "flutter/shell/platform/embedder/embedder_surface.h" + +namespace shell { + +class EmbedderSurfaceGL final : public EmbedderSurface, + public GPUSurfaceGLDelegate { + public: + struct GLDispatchTable { + std::function gl_make_current_callback; // required + std::function gl_clear_current_callback; // required + std::function gl_present_callback; // required + std::function gl_fbo_callback; // required + std::function gl_make_resource_current_callback; // optional + std::function + gl_surface_transformation_callback; // optional + std::function gl_proc_resolver; // optional + }; + + EmbedderSurfaceGL(GLDispatchTable gl_dispatch_table, + bool fbo_reset_after_present); + + ~EmbedderSurfaceGL() override; + + private: + bool valid_ = false; + GLDispatchTable gl_dispatch_table_; + bool fbo_reset_after_present_; + + // |shell::EmbedderSurface| + bool IsValid() const override; + + // |shell::EmbedderSurface| + std::unique_ptr CreateGPUSurface() override; + + // |shell::EmbedderSurface| + sk_sp CreateResourceContext() const override; + + // |shell::GPUSurfaceGLDelegate| + bool GLContextMakeCurrent() override; + + // |shell::GPUSurfaceGLDelegate| + bool GLContextClearCurrent() override; + + // |shell::GPUSurfaceGLDelegate| + bool GLContextPresent() override; + + // |shell::GPUSurfaceGLDelegate| + intptr_t GLContextFBO() const override; + + // |shell::GPUSurfaceGLDelegate| + bool GLContextFBOResetAfterPresent() const override; + + // |shell::GPUSurfaceGLDelegate| + SkMatrix GLContextSurfaceTransformation() const override; + + // |shell::GPUSurfaceGLDelegate| + GLProcResolver GetGLProcResolver() const override; + + FML_DISALLOW_COPY_AND_ASSIGN(EmbedderSurfaceGL); +}; + +} // namespace shell + +#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 new file mode 100644 index 0000000000000..103257745b359 --- /dev/null +++ b/shell/platform/embedder/embedder_surface_software.cc @@ -0,0 +1,111 @@ +// Copyright 2018 The Flutter 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_surface_software.h" + +#include "flutter/fml/trace_event.h" +#include "third_party/skia/include/gpu/GrContext.h" + +#ifdef ERROR +#undef ERROR +#endif + +namespace shell { + +EmbedderSurfaceSoftware::EmbedderSurfaceSoftware( + SoftwareDispatchTable software_dispatch_table) + : software_dispatch_table_(software_dispatch_table) { + if (!software_dispatch_table_.software_present_backing_store) { + return; + } + valid_ = true; +} + +EmbedderSurfaceSoftware::~EmbedderSurfaceSoftware() = default; + +// |shell::EmbedderSurface| +bool EmbedderSurfaceSoftware::IsValid() const { + return valid_; +} + +// |shell::EmbedderSurface| +std::unique_ptr EmbedderSurfaceSoftware::CreateGPUSurface() { + if (!IsValid()) { + return nullptr; + } + + auto surface = std::make_unique(this); + + if (!surface->IsValid()) { + return nullptr; + } + + return surface; +} + +// |shell::EmbedderSurface| +sk_sp EmbedderSurfaceSoftware::CreateResourceContext() const { + return nullptr; +} + +// |shell::GPUSurfaceSoftwareDelegate| +sk_sp EmbedderSurfaceSoftware::AcquireBackingStore( + const SkISize& size) { + TRACE_EVENT0("flutter", "EmbedderSurfaceSoftware::AcquireBackingStore"); + if (!IsValid()) { + FML_LOG(ERROR) + << "Could not acquire backing store for the software surface."; + return nullptr; + } + + if (sk_surface_ != nullptr && + SkISize::Make(sk_surface_->width(), sk_surface_->height()) == size) { + // The old and new surface sizes are the same. Nothing to do here. + return sk_surface_; + } + + SkImageInfo info = + SkImageInfo::MakeN32(size.fWidth, size.fHeight, kPremul_SkAlphaType); + sk_surface_ = SkSurface::MakeRaster(info, nullptr); + + if (sk_surface_ == nullptr) { + FML_LOG(ERROR) << "Could not create backing store for software rendering."; + return nullptr; + } + + return sk_surface_; +} + +// |shell::GPUSurfaceSoftwareDelegate| +bool EmbedderSurfaceSoftware::PresentBackingStore( + sk_sp backing_store) { + if (!IsValid()) { + FML_LOG(ERROR) << "Tried to present an invalid software surface."; + return false; + } + + SkPixmap pixmap; + if (!backing_store->peekPixels(&pixmap)) { + FML_LOG(ERROR) << "Could not peek the pixels of the backing store."; + return false; + } + + // Some basic sanity checking. + uint64_t expected_pixmap_data_size = pixmap.width() * pixmap.height() * 4; + + const size_t pixmap_size = pixmap.computeByteSize(); + + if (expected_pixmap_data_size != pixmap_size) { + FML_LOG(ERROR) << "Software backing store had unexpected size."; + return false; + } + + return software_dispatch_table_.software_present_backing_store( + pixmap.addr(), // + pixmap.rowBytes(), // + pixmap.height() // + ); +} + +} // namespace shell diff --git a/shell/platform/embedder/embedder_surface_software.h b/shell/platform/embedder/embedder_surface_software.h new file mode 100644 index 0000000000000..852a77b62a2e4 --- /dev/null +++ b/shell/platform/embedder/embedder_surface_software.h @@ -0,0 +1,51 @@ +// Copyright 2018 The Flutter 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_SURFACE_SOFTWARE_H_ +#define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_SOFTWARE_H_ + +#include "flutter/fml/macros.h" +#include "flutter/shell/gpu/gpu_surface_software.h" +#include "flutter/shell/platform/embedder/embedder_surface.h" + +namespace shell { + +class EmbedderSurfaceSoftware final : public EmbedderSurface, + public GPUSurfaceSoftwareDelegate { + public: + struct SoftwareDispatchTable { + std::function + software_present_backing_store; // required + }; + + EmbedderSurfaceSoftware(SoftwareDispatchTable software_dispatch_table); + + ~EmbedderSurfaceSoftware() override; + + private: + bool valid_ = false; + SoftwareDispatchTable software_dispatch_table_; + sk_sp sk_surface_; + + // |shell::EmbedderSurface| + bool IsValid() const override; + + // |shell::EmbedderSurface| + std::unique_ptr CreateGPUSurface() override; + + // |shell::EmbedderSurface| + sk_sp CreateResourceContext() const override; + + // |shell::GPUSurfaceSoftwareDelegate| + sk_sp AcquireBackingStore(const SkISize& size) override; + + // |shell::GPUSurfaceSoftwareDelegate| + bool PresentBackingStore(sk_sp backing_store) override; + + FML_DISALLOW_COPY_AND_ASSIGN(EmbedderSurfaceSoftware); +}; + +} // namespace shell + +#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_SOFTWARE_H_ diff --git a/shell/platform/embedder/platform_view_embedder.cc b/shell/platform/embedder/platform_view_embedder.cc index 31fcc7da32db7..07f6c8dc1ff95 100644 --- a/shell/platform/embedder/platform_view_embedder.cc +++ b/shell/platform/embedder/platform_view_embedder.cc @@ -4,56 +4,36 @@ #include "flutter/shell/platform/embedder/platform_view_embedder.h" -#include "flutter/shell/common/io_manager.h" +#ifdef ERROR +#undef ERROR +#endif namespace shell { -PlatformViewEmbedder::PlatformViewEmbedder(PlatformView::Delegate& delegate, - blink::TaskRunners task_runners, - DispatchTable dispatch_table, - bool fbo_reset_after_present) +PlatformViewEmbedder::PlatformViewEmbedder( + PlatformView::Delegate& delegate, + blink::TaskRunners task_runners, + EmbedderSurfaceGL::GLDispatchTable gl_dispatch_table, + bool fbo_reset_after_present, + PlatformDispatchTable platform_dispatch_table) : PlatformView(delegate, std::move(task_runners)), - dispatch_table_(dispatch_table), - fbo_reset_after_present_(fbo_reset_after_present) {} + embedder_surface_( + std::make_unique(gl_dispatch_table, + fbo_reset_after_present)), + platform_dispatch_table_(platform_dispatch_table) {} + +PlatformViewEmbedder::PlatformViewEmbedder( + PlatformView::Delegate& delegate, + blink::TaskRunners task_runners, + EmbedderSurfaceSoftware::SoftwareDispatchTable software_dispatch_table, + PlatformDispatchTable platform_dispatch_table) + : PlatformView(delegate, std::move(task_runners)), + embedder_surface_( + std::make_unique(software_dispatch_table)), + platform_dispatch_table_(platform_dispatch_table) {} PlatformViewEmbedder::~PlatformViewEmbedder() = default; -// |shell::GPUSurfaceGLDelegate| -bool PlatformViewEmbedder::GLContextMakeCurrent() { - return dispatch_table_.gl_make_current_callback(); -} - -// |shell::GPUSurfaceGLDelegate| -bool PlatformViewEmbedder::GLContextClearCurrent() { - return dispatch_table_.gl_clear_current_callback(); -} - -// |shell::GPUSurfaceGLDelegate| -bool PlatformViewEmbedder::GLContextPresent() { - return dispatch_table_.gl_present_callback(); -} - -// |shell::GPUSurfaceGLDelegate| -intptr_t PlatformViewEmbedder::GLContextFBO() const { - return dispatch_table_.gl_fbo_callback(); -} - -// |shell::GPUSurfaceGLDelegate| -bool PlatformViewEmbedder::GLContextFBOResetAfterPresent() const { - return fbo_reset_after_present_; -} - -// |shell::GPUSurfaceGLDelegate| -SkMatrix PlatformViewEmbedder::GLContextSurfaceTransformation() const { - auto callback = dispatch_table_.gl_surface_transformation_callback; - if (!callback) { - SkMatrix matrix; - matrix.setIdentity(); - return matrix; - } - return callback(); -} - void PlatformViewEmbedder::HandlePlatformMessage( fml::RefPtr message) { if (!message) { @@ -64,25 +44,31 @@ void PlatformViewEmbedder::HandlePlatformMessage( return; } - if (dispatch_table_.platform_message_response_callback == nullptr) { + if (platform_dispatch_table_.platform_message_response_callback == nullptr) { message->response()->CompleteEmpty(); return; } - dispatch_table_.platform_message_response_callback(std::move(message)); + platform_dispatch_table_.platform_message_response_callback( + std::move(message)); } +// |shell::PlatformView| std::unique_ptr PlatformViewEmbedder::CreateRenderingSurface() { - return std::make_unique(this); + if (embedder_surface_ == nullptr) { + FML_LOG(ERROR) << "Embedder surface was null."; + return nullptr; + } + return embedder_surface_->CreateGPUSurface(); } +// |shell::PlatformView| sk_sp PlatformViewEmbedder::CreateResourceContext() const { - auto callback = dispatch_table_.gl_make_resource_current_callback; - if (callback && callback()) { - return IOManager::CreateCompatibleResourceLoadingContext( - GrBackend::kOpenGL_GrBackend); + if (embedder_surface_ == nullptr) { + FML_LOG(ERROR) << "Embedder surface was null."; + return nullptr; } - return nullptr; + return embedder_surface_->CreateResourceContext(); } } // namespace shell diff --git a/shell/platform/embedder/platform_view_embedder.h b/shell/platform/embedder/platform_view_embedder.h index 0442003f9ff0d..af28dd83625c6 100644 --- a/shell/platform/embedder/platform_view_embedder.h +++ b/shell/platform/embedder/platform_view_embedder.h @@ -5,62 +5,50 @@ #ifndef FLUTTER_SHELL_PLATFORM_EMBEDDER_PLATFORM_VIEW_EMBEDDER_H_ #define FLUTTER_SHELL_PLATFORM_EMBEDDER_PLATFORM_VIEW_EMBEDDER_H_ +#include + #include "flutter/fml/macros.h" #include "flutter/shell/common/platform_view.h" -#include "flutter/shell/gpu/gpu_surface_gl.h" #include "flutter/shell/platform/embedder/embedder.h" +#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" namespace shell { -class PlatformViewEmbedder final : public PlatformView, - public GPUSurfaceGLDelegate { +class PlatformViewEmbedder final : public PlatformView { public: using PlatformMessageResponseCallback = std::function)>; - struct DispatchTable { - std::function gl_make_current_callback; // required - std::function gl_clear_current_callback; // required - std::function gl_present_callback; // required - std::function gl_fbo_callback; // required + + struct PlatformDispatchTable { PlatformMessageResponseCallback - platform_message_response_callback; // optional - std::function gl_make_resource_current_callback; // optional - std::function - gl_surface_transformation_callback; // optional + platform_message_response_callback; // optional }; + // Creates a platform view that sets up an OpenGL rasterizer. PlatformViewEmbedder(PlatformView::Delegate& delegate, blink::TaskRunners task_runners, - DispatchTable dispatch_table, - bool fbo_reset_after_present); - - ~PlatformViewEmbedder() override; - - // |shell::GPUSurfaceGLDelegate| - bool GLContextMakeCurrent() override; + EmbedderSurfaceGL::GLDispatchTable gl_dispatch_table, + bool fbo_reset_after_present, + PlatformDispatchTable platform_dispatch_table); - // |shell::GPUSurfaceGLDelegate| - bool GLContextClearCurrent() override; + // Create a platform view that sets up a software rasterizer. + PlatformViewEmbedder( + PlatformView::Delegate& delegate, + blink::TaskRunners task_runners, + EmbedderSurfaceSoftware::SoftwareDispatchTable software_dispatch_table, + PlatformDispatchTable platform_dispatch_table); - // |shell::GPUSurfaceGLDelegate| - bool GLContextPresent() override; - - // |shell::GPUSurfaceGLDelegate| - intptr_t GLContextFBO() const override; - - // |shell::GPUSurfaceGLDelegate| - bool GLContextFBOResetAfterPresent() const override; - - // |shell::GPUSurfaceGLDelegate| - SkMatrix GLContextSurfaceTransformation() const override; + ~PlatformViewEmbedder() override; // |shell::PlatformView| void HandlePlatformMessage( fml::RefPtr message) override; private: - DispatchTable dispatch_table_; - bool fbo_reset_after_present_; + std::unique_ptr embedder_surface_; + PlatformDispatchTable platform_dispatch_table_; // |shell::PlatformView| std::unique_ptr CreateRenderingSurface() override; diff --git a/shell/testing/observatory/test.dart b/shell/testing/observatory/test.dart index ba14fe41cc3e0..d753d1522c9b8 100644 --- a/shell/testing/observatory/test.dart +++ b/shell/testing/observatory/test.dart @@ -156,7 +156,8 @@ final List basicTests = [ ]; final List startPausedTests = [ - testStartPaused, + // TODO(engine): Investigate difference in lifecycle events. + // testStartPaused, ]; Future runTests(ShellLauncher launcher, List tests) async { diff --git a/shell/testing/tester_main.cc b/shell/testing/tester_main.cc index 274ef7bb64a6c..4e10dab16f25c 100644 --- a/shell/testing/tester_main.cc +++ b/shell/testing/tester_main.cc @@ -133,11 +133,7 @@ int RunTester(const blink::Settings& settings, bool run_forever) { fml::paths::AbsolutePath(settings.main_dart_file_path), false); auto isolate_configuration = - blink::DartVM::IsKernelMapping(main_dart_file_mapping.get()) - ? IsolateConfiguration::CreateForSnapshot( - std::move(main_dart_file_mapping)) - : IsolateConfiguration::CreateForSource(settings.main_dart_file_path, - settings.packages_file_path); + IsolateConfiguration::CreateForKernel(std::move(main_dart_file_mapping)); if (!isolate_configuration) { FML_LOG(ERROR) << "Could create isolate configuration."; @@ -242,9 +238,6 @@ int main(int argc, char* argv[]) { settings.icu_data_path = "icudtl.dat"; - settings.platform_kernel_path = - fml::paths::JoinPaths({settings.assets_path, "platform_strong.dill"}); - // The tools that read logs get confused if there is a log tag specified. settings.log_tag = ""; diff --git a/shell/version/BUILD.gn b/shell/version/BUILD.gn index 0214a4d767bff..348ea3e26d2a7 100644 --- a/shell/version/BUILD.gn +++ b/shell/version/BUILD.gn @@ -15,4 +15,6 @@ source_set("version") { "SHELL_SKIA_VERSION=\"$shell_skia_version\"", "SHELL_DART_VERSION=\"$shell_dart_version\"", ] + + public_configs = [ "$flutter_root:config" ] } diff --git a/sky/packages/sky_engine/LICENSE b/sky/packages/sky_engine/LICENSE index e3189d063d016..e90b7a123752a 100644 --- a/sky/packages/sky_engine/LICENSE +++ b/sky/packages/sky_engine/LICENSE @@ -3484,7 +3484,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- engine -Copyright 2017 The Flutter Authors. All rights reserved. +Copyright 2013 The Chromium Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -3514,7 +3514,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- engine -Copyright 2018 The Flutter Authors. All rights reserved. +Copyright 2017 The Flutter Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -3543,9 +3543,8 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- engine -garnet -Copyright 2013 The Chromium Authors. All rights reserved. +Copyright 2018 The Flutter Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -3574,12 +3573,9 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- engine -garnet icu -skia -topaz -Copyright 2015 The Chromium Authors. All rights reserved. +Copyright 2014 The Chromium Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -3608,11 +3604,10 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- engine -garnet icu -topaz +skia -Copyright 2014 The Chromium Authors. All rights reserved. +Copyright 2015 The Chromium Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -3641,11 +3636,10 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- engine -garnet -tonic -topaz +icu +skia -Copyright 2016 The Fuchsia Authors. All rights reserved. +Copyright 2016 The Chromium Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -3674,11 +3668,9 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- engine -garnet -tonic -topaz +skia -Copyright 2017 The Fuchsia Authors. All rights reserved. +Copyright 2018 The Chromium Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -3707,11 +3699,9 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- engine -garnet -topaz -txt +tonic -Copyright 2017 The Chromium Authors. All rights reserved. +Copyright 2016 The Fuchsia Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -3740,11 +3730,9 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- engine -icu -skia -topaz +tonic -Copyright 2016 The Chromium Authors. All rights reserved. +Copyright 2017 The Fuchsia Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -3773,10 +3761,9 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- engine -skia -topaz +txt -Copyright 2018 The Chromium Authors. All rights reserved. +Copyright 2017 The Chromium Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -4465,160 +4452,6 @@ Legal Terms --- end of FTL.TXT --- -------------------------------------------------------------------------------- -garnet - -Copyright 2013 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -garnet - -Copyright 2014 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -garnet - -Copyright 2017 The Fuchsia Authors.All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -garnet -tonic -topaz - -Copyright 2015 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -garnet -tonic -topaz - -Copyright 2018 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- gif GNU LESSER GENERAL PUBLIC LICENSE @@ -7255,41 +7088,6 @@ written authorization of the copyright holder. -------------------------------------------------------------------------------- icu -ICU License - ICU 1.8.1 and later - -COPYRIGHT AND PERMISSION NOTICE - -Copyright (c) 1995-2009 International Business Machines Corporation and others - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, and/or sell copies of the Software, and to permit persons -to whom the Software is furnished to do so, provided that the above -copyright notice(s) and this permission notice appear in all copies of -the Software and that both the above copyright notice(s) and this -permission notice appear in supporting documentation. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY -SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER -RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF -CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN -CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -Except as contained in this notice, the name of a copyright holder -shall not be used in advertising or otherwise to promote the sale, use -or other dealings in this Software without prior written authorization -of the copyright holder. --------------------------------------------------------------------------------- -icu - The BSD License http://opensource.org/licenses/bsd-license.php Copyright (C) 2006-2008, Google Inc. @@ -11151,35 +10949,9 @@ 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. -------------------------------------------------------------------------------- -topaz - -Copyright 2016 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -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 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 HOLDERS 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. --------------------------------------------------------------------------------- -topaz +tonic -Copyright 2017 Th%e Fuchsia Authors. All rights reserved. +Copyright 2015 The Fuchsia Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -11207,10 +10979,9 @@ 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. -------------------------------------------------------------------------------- -topaz +tonic -Copyright 2017, the Flutter project authors. Please see the AUTHORS file -for details. All rights reserved. +Copyright 2018 The Fuchsia Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/sky/tools/create_ios_framework.py b/sky/tools/create_ios_framework.py index 2f2a277859797..0500e671c21f6 100755 --- a/sky/tools/create_ios_framework.py +++ b/sky/tools/create_ios_framework.py @@ -17,6 +17,8 @@ def main(): parser.add_argument('--arm64-out-dir', type=str, required=True) parser.add_argument('--armv7-out-dir', type=str, required=True) parser.add_argument('--simulator-out-dir', type=str, required=True) + parser.add_argument('--strip', action="store_true", default=False) + parser.add_argument('--dsym', action="store_true", default=False) args = parser.parse_args() @@ -56,6 +58,8 @@ def main(): shutil.rmtree(fat_framework, True) shutil.copytree(arm64_framework, fat_framework) + linker_out = os.path.join(fat_framework, 'Flutter') + subprocess.call([ 'lipo', arm64_dylib, @@ -63,9 +67,20 @@ def main(): simulator_dylib, '-create', '-output', - os.path.join(fat_framework, 'Flutter') + linker_out ]) + if args.dsym: + dsym_out = os.path.splitext(fat_framework)[0] + '.dSYM' + subprocess.call(['dsymutil', '-o', dsym_out, linker_out]) + + if args.strip: + # copy unstripped + unstripped_out = os.path.join(args.dst, 'Flutter.unstripped') + shutil.copyfile(linker_out, unstripped_out) + + subprocess.call(["strip", "-x", "-S", linker_out]) + if __name__ == '__main__': sys.exit(main()) diff --git a/testing/dart/.gitignore b/testing/dart/.gitignore index 93d2a1eaede95..349beaaf08c80 100644 --- a/testing/dart/.gitignore +++ b/testing/dart/.gitignore @@ -1,2 +1,4 @@ .packages pubspec.lock +ios/** +android/** diff --git a/testing/dart/canvas_test.dart b/testing/dart/canvas_test.dart index 714e3413cb09f..8ab5581317730 100644 --- a/testing/dart/canvas_test.dart +++ b/testing/dart/canvas_test.dart @@ -3,93 +3,80 @@ // found in the LICENSE file. import 'dart:ui'; +import 'dart:typed_data'; import 'package:test/test.dart'; -class FakeEverything implements Canvas, PictureRecorder, Color { - dynamic noSuchMethod(Invocation invocation) { - return new FakeEverything(); - } -} - -class NegativeSpace implements Canvas, PictureRecorder, Color { - dynamic noSuchMethod(Invocation invocation) { - return false; - } -} +typedef void CanvasCallback(Canvas canvas); -void testCanvas(callback(Canvas canvas)) { +void testCanvas(CanvasCallback callback) { try { - callback(new Canvas(new PictureRecorder(), new Rect.fromLTRB(0.0, 0.0, 0.0, 0.0))); + callback(Canvas(PictureRecorder(), Rect.fromLTRB(0.0, 0.0, 0.0, 0.0))); } catch (error) { } } void main() { test("canvas APIs should not crash", () { - dynamic fake = new FakeEverything(); - dynamic no = new NegativeSpace(); - Paint paint = new Paint(); - Rect rect = new Rect.fromLTRB(double.NAN, double.NAN, double.NAN, double.NAN); - List list = [fake, fake]; - Offset offset = new Offset(double.NAN, double.NAN); - Path path = new Path(); + Paint paint = Paint(); + Rect rect = Rect.fromLTRB(double.nan, double.nan, double.nan, double.nan); + RRect rrect = RRect.fromRectAndCorners(rect); + Offset offset = Offset(double.nan, double.nan); + Path path = Path(); + Color color = Color(0); + Paragraph paragraph = ParagraphBuilder(ParagraphStyle()).build(); + + PictureRecorder recorder = PictureRecorder(); + Canvas recorderCanvas = Canvas(recorder); + Picture picture = recorder.endRecording(); + Image image = picture.toImage(1, 1); - try { new Canvas(null, null); } catch (error) { } - try { new Canvas(null, rect); } catch (error) { } - try { new Canvas(null, fake); } catch (error) { } - try { new Canvas(fake, rect); } catch (error) { } - try { new Canvas(no, rect); } catch (error) { } + try { Canvas(null, null); } catch (error) { } + try { Canvas(null, rect); } catch (error) { } + try { Canvas(PictureRecorder(), null); } catch (error) { } + try { Canvas(PictureRecorder(), rect); } catch (error) { } try { - new PictureRecorder() + PictureRecorder() ..endRecording() ..endRecording() ..endRecording(); } catch (error) { } - testCanvas((Canvas canvas) => canvas.clipPath(fake)); - testCanvas((Canvas canvas) => canvas.clipRect(fake)); - testCanvas((Canvas canvas) => canvas.clipRRect(fake)); - testCanvas((Canvas canvas) => canvas.drawArc(fake, 0.0, 0.0, false, paint)); - testCanvas((Canvas canvas) => canvas.drawArc(rect, 0.0, 0.0, false, fake)); - testCanvas((Canvas canvas) => canvas.drawAtlas(fake, list, list, list, fake, rect, paint)); - testCanvas((Canvas canvas) => canvas.drawCircle(offset, double.NAN, paint)); - testCanvas((Canvas canvas) => canvas.drawColor(fake, fake)); - testCanvas((Canvas canvas) => canvas.drawDRRect(fake, fake, fake)); - testCanvas((Canvas canvas) => canvas.drawImage(fake, offset, paint)); - testCanvas((Canvas canvas) => canvas.drawImageNine(fake, rect, rect, paint)); - testCanvas((Canvas canvas) => canvas.drawImageRect(fake, rect, rect, paint)); + testCanvas((Canvas canvas) => canvas.clipPath(path)); + testCanvas((Canvas canvas) => canvas.clipRect(rect)); + testCanvas((Canvas canvas) => canvas.clipRRect(rrect)); + testCanvas((Canvas canvas) => canvas.drawArc(rect, 0.0, 0.0, false, paint)); + testCanvas((Canvas canvas) => canvas.drawAtlas(image, [], [], [], BlendMode.src, rect, paint)); + testCanvas((Canvas canvas) => canvas.drawCircle(offset, double.nan, paint)); + testCanvas((Canvas canvas) => canvas.drawColor(color, BlendMode.src)); + testCanvas((Canvas canvas) => canvas.drawDRRect(rrect, rrect, paint)); + testCanvas((Canvas canvas) => canvas.drawImage(image, offset, paint)); + testCanvas((Canvas canvas) => canvas.drawImageNine(image, rect, rect, paint)); + testCanvas((Canvas canvas) => canvas.drawImageRect(image, rect, rect, paint)); testCanvas((Canvas canvas) => canvas.drawLine(offset, offset, paint)); testCanvas((Canvas canvas) => canvas.drawOval(rect, paint)); testCanvas((Canvas canvas) => canvas.drawPaint(paint)); - testCanvas((Canvas canvas) => canvas.drawPaint(fake)); - testCanvas((Canvas canvas) => canvas.drawPaint(no)); - testCanvas((Canvas canvas) => canvas.drawParagraph(fake, offset)); - testCanvas((Canvas canvas) => canvas.drawPath(fake, paint)); - testCanvas((Canvas canvas) => canvas.drawPicture(fake)); - testCanvas((Canvas canvas) => canvas.drawPoints(fake, list, fake)); - testCanvas((Canvas canvas) => canvas.drawRawAtlas(fake, fake, fake, fake, fake, fake, fake)); - testCanvas((Canvas canvas) => canvas.drawRawPoints(fake, list, paint)); + testCanvas((Canvas canvas) => canvas.drawParagraph(paragraph, offset)); + testCanvas((Canvas canvas) => canvas.drawPath(path, paint)); + testCanvas((Canvas canvas) => canvas.drawPicture(picture)); + testCanvas((Canvas canvas) => canvas.drawPoints(PointMode.points, [], paint)); + testCanvas((Canvas canvas) => canvas.drawRawAtlas(image, Float32List(0), Float32List(0), Int32List(0), BlendMode.src, rect, paint)); + testCanvas((Canvas canvas) => canvas.drawRawPoints(PointMode.points, Float32List(0), paint)); testCanvas((Canvas canvas) => canvas.drawRect(rect, paint)); - testCanvas((Canvas canvas) => canvas.drawRRect(fake, paint)); - testCanvas((Canvas canvas) => canvas.drawShadow(path, color, double.NAN, null)); - testCanvas((Canvas canvas) => canvas.drawShadow(path, color, double.NAN, false)); - testCanvas((Canvas canvas) => canvas.drawShadow(path, color, double.NAN, true)); - testCanvas((Canvas canvas) => canvas.drawShadow(path, color, double.NAN, no)); - testCanvas((Canvas canvas) => canvas.drawShadow(path, color, double.NAN, fake)); - testCanvas((Canvas canvas) => canvas.drawVertices(fake, null, paint)); + testCanvas((Canvas canvas) => canvas.drawRRect(rrect, paint)); + testCanvas((Canvas canvas) => canvas.drawShadow(path, color, double.nan, null)); + testCanvas((Canvas canvas) => canvas.drawShadow(path, color, double.nan, false)); + testCanvas((Canvas canvas) => canvas.drawShadow(path, color, double.nan, true)); + testCanvas((Canvas canvas) => canvas.drawVertices(Vertices(VertexMode.triangles, []), null, paint)); testCanvas((Canvas canvas) => canvas.getSaveCount()); testCanvas((Canvas canvas) => canvas.restore()); - testCanvas((Canvas canvas) => canvas.rotate(double.NAN)); + testCanvas((Canvas canvas) => canvas.rotate(double.nan)); testCanvas((Canvas canvas) => canvas.save()); testCanvas((Canvas canvas) => canvas.saveLayer(rect, paint)); - testCanvas((Canvas canvas) => canvas.saveLayer(fake, fake)); testCanvas((Canvas canvas) => canvas.saveLayer(null, null)); - testCanvas((Canvas canvas) => canvas.scale(double.NAN, double.NAN)); - testCanvas((Canvas canvas) => canvas.skew(double.NAN, double.NAN)); - testCanvas((Canvas canvas) => canvas.transform(fake)); - testCanvas((Canvas canvas) => canvas.transform(no)); + testCanvas((Canvas canvas) => canvas.scale(double.nan, double.nan)); + testCanvas((Canvas canvas) => canvas.skew(double.nan, double.nan)); testCanvas((Canvas canvas) => canvas.transform(null)); - testCanvas((Canvas canvas) => canvas.translate(double.NAN, double.NAN)); + testCanvas((Canvas canvas) => canvas.translate(double.nan, double.nan)); }); } diff --git a/testing/dart/codec_test.dart b/testing/dart/codec_test.dart index ed8828cf5223d..0e2f71cd489c3 100644 --- a/testing/dart/codec_test.dart +++ b/testing/dart/codec_test.dart @@ -88,6 +88,6 @@ File _getSkiaResource(String fileName) { Matcher exceptionWithMessage(String m) { return predicate((e) { - return e is Exception && e.message == m; + return e is Exception && e.toString().contains(m); }); } diff --git a/testing/dart/isolate_name_server_test.dart b/testing/dart/isolate_name_server_test.dart index b8e4a342ec707..37f6349d579a7 100644 --- a/testing/dart/isolate_name_server_test.dart +++ b/testing/dart/isolate_name_server_test.dart @@ -89,7 +89,7 @@ void main() { // Test driver. final testReceivePort = new ReceivePort(); - testReceivePort.listen(expectAsync1((List response) { + testReceivePort.listen(expectAsync1((response) { final int code = response[0]; final String message = response[1]; switch (code) { diff --git a/testing/dart/pubspec.yaml b/testing/dart/pubspec.yaml index 69b94607d1a7d..ec3ea88b2ac6d 100644 --- a/testing/dart/pubspec.yaml +++ b/testing/dart/pubspec.yaml @@ -1,4 +1,4 @@ name: engine_tests dependencies: - test: 0.12.40 - path: 1.6.0 + test: 1.3.0 + path: 1.6.2 diff --git a/testing/dart/window_hooks_integration_test.dart b/testing/dart/window_hooks_integration_test.dart index 5b5ff619a4375..ee4d6d6e16a84 100644 --- a/testing/dart/window_hooks_integration_test.dart +++ b/testing/dart/window_hooks_integration_test.dart @@ -2,7 +2,11 @@ // 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:async'; +import 'dart:io'; import 'dart:typed_data'; import 'dart:convert'; import 'dart:developer' as developer; diff --git a/testing/run_tests.sh b/testing/run_tests.sh index 7baf91d29b711..69f5b9689d5c8 100755 --- a/testing/run_tests.sh +++ b/testing/run_tests.sh @@ -2,21 +2,25 @@ set -ex -out/host_debug_unopt/fxl_unittests +out/host_debug_unopt/fml_unittests out/host_debug_unopt/synchronization_unittests -flutter/ci/analyze.sh - 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 out/host_debug_unopt/engine_test.dill +} + # Verify that a failing test returns a failure code. -! out/host_debug_unopt/flutter_tester --disable-observatory --disable-diagnostic --non-interactive --enable-checked-mode --packages=flutter/testing/dart/.packages flutter/testing/fail_test.dart +! run_test flutter/testing/fail_test.dart for TEST_SCRIPT in flutter/testing/dart/*.dart; do - out/host_debug_unopt/flutter_tester --disable-observatory --disable-diagnostic --non-interactive --enable-checked-mode --packages=flutter/testing/dart/.packages $TEST_SCRIPT - out/host_debug_unopt/flutter_tester --disable-observatory --disable-diagnostic --non-interactive --packages=flutter/testing/dart/.packages $TEST_SCRIPT + run_test $TEST_SCRIPT done pushd flutter diff --git a/third_party/txt/src/minikin/Layout.cpp b/third_party/txt/src/minikin/Layout.cpp index 6475cb2ebc509..4339fcb02a920 100644 --- a/third_party/txt/src/minikin/Layout.cpp +++ b/third_party/txt/src/minikin/Layout.cpp @@ -1132,7 +1132,9 @@ void Layout::appendLayout(Layout* src, size_t start, float extraAdvance) { int font_ix = findFace(src->mFaces[i], NULL); fontMap[i] = font_ix; } - int x0 = mAdvance; + // LibTxt: Changed x0 from int to float to prevent rounding that causes text + // jitter. + float x0 = mAdvance; for (size_t i = 0; i < src->mGlyphs.size(); i++) { LayoutGlyph& srcGlyph = src->mGlyphs[i]; int font_ix = fontMap[srcGlyph.font_ix]; diff --git a/third_party/txt/src/txt/paint_record.h b/third_party/txt/src/txt/paint_record.h index 8fa52fa4560ea..2b9248ef7c169 100644 --- a/third_party/txt/src/txt/paint_record.h +++ b/third_party/txt/src/txt/paint_record.h @@ -63,7 +63,7 @@ class PaintRecord { size_t line() const { return line_; } - size_t GetRunWidth() const { return run_width_; } + double GetRunWidth() const { return run_width_; } private: TextStyle style_; diff --git a/third_party/txt/src/txt/paragraph.cc b/third_party/txt/src/txt/paragraph.cc index 5a4f7a80c87d9..97a8a05fb4581 100644 --- a/third_party/txt/src/txt/paragraph.cc +++ b/third_party/txt/src/txt/paragraph.cc @@ -871,6 +871,9 @@ Paragraph::GetMinikinFontCollectionForStyle(const TextStyle& style) { sk_sp Paragraph::GetDefaultSkiaTypeface(const TextStyle& style) { std::shared_ptr collection = GetMinikinFontCollectionForStyle(style); + if (!collection) { + return nullptr; + } minikin::FakedFont faked_font = collection->baseFontFaked(GetMinikinFontStyle(style)); return static_cast(faked_font.font)->GetSkTypeface(); diff --git a/third_party/txt/src/txt/paragraph.h b/third_party/txt/src/txt/paragraph.h index e83be665eddb3..2cadfbb862229 100644 --- a/third_party/txt/src/txt/paragraph.h +++ b/third_party/txt/src/txt/paragraph.h @@ -184,6 +184,7 @@ class Paragraph { FRIEND_TEST(ParagraphTest, HyphenBreakParagraph); FRIEND_TEST(ParagraphTest, RepeatLayoutParagraph); FRIEND_TEST(ParagraphTest, Ellipsize); + FRIEND_TEST(ParagraphTest, UnderlineShiftParagraph); // Starting data to layout. std::vector text_; diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index 54721f639781a..136b7e7886f90 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -1007,7 +1007,7 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeParagraph)) { EXPECT_EQ(boxes.size(), 1ull); EXPECT_FLOAT_EQ(boxes[0].rect.left(), 56.835938); EXPECT_FLOAT_EQ(boxes[0].rect.top(), 0.40625); - EXPECT_FLOAT_EQ(boxes[0].rect.right(), 177.44922); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 177.97266); EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 59); paint.setColor(SK_ColorGREEN); @@ -1016,9 +1016,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeParagraph)) { GetCanvas()->drawRect(boxes[i].rect, paint); } EXPECT_EQ(boxes.size(), 1ull); - EXPECT_FLOAT_EQ(boxes[0].rect.left(), 177); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 177.97266); EXPECT_FLOAT_EQ(boxes[0].rect.top(), 0.40625); - EXPECT_FLOAT_EQ(boxes[0].rect.right(), 506.08984); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 507.02344); EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 59); paint.setColor(SK_ColorRED); @@ -1027,9 +1027,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeParagraph)) { GetCanvas()->drawRect(boxes[i].rect, paint); } EXPECT_EQ(boxes.size(), 4ull); - EXPECT_FLOAT_EQ(boxes[0].rect.left(), 210.83594); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 211.375); EXPECT_FLOAT_EQ(boxes[0].rect.top(), 59.40625); - EXPECT_FLOAT_EQ(boxes[0].rect.right(), 463.44922); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 463.61719); EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 118); // TODO(garyq): The following set of vals are definetly wrong and @@ -1045,9 +1045,9 @@ TEST_F(ParagraphTest, DISABLE_ON_WINDOWS(GetRectsForRangeParagraph)) { GetCanvas()->drawRect(boxes[i].rect, paint); } EXPECT_EQ(boxes.size(), 1ull); - EXPECT_FLOAT_EQ(boxes[0].rect.left(), 449.25391); + EXPECT_FLOAT_EQ(boxes[0].rect.left(), 450.1875); EXPECT_FLOAT_EQ(boxes[0].rect.top(), 0.40625); - EXPECT_FLOAT_EQ(boxes[0].rect.right(), 519.44922); + EXPECT_FLOAT_EQ(boxes[0].rect.right(), 519.47266); EXPECT_FLOAT_EQ(boxes[0].rect.bottom(), 59); paint.setColor(SK_ColorRED); @@ -1569,4 +1569,82 @@ TEST_F(ParagraphTest, Ellipsize) { ASSERT_EQ(paragraph->records_.size(), 1ull); } +// Test for shifting when identical runs of text are built as multiple runs. +TEST_F(ParagraphTest, UnderlineShiftParagraph) { + const char* text1 = "fluttser "; + auto icu_text1 = icu::UnicodeString::fromUTF8(text1); + std::u16string u16_text1(icu_text1.getBuffer(), + icu_text1.getBuffer() + icu_text1.length()); + const char* text2 = "mdje"; + auto icu_text2 = icu::UnicodeString::fromUTF8(text2); + std::u16string u16_text2(icu_text2.getBuffer(), + icu_text2.getBuffer() + icu_text2.length()); + const char* text3 = "fluttser mdje"; + auto icu_text3 = icu::UnicodeString::fromUTF8(text3); + std::u16string u16_text3(icu_text3.getBuffer(), + icu_text3.getBuffer() + icu_text3.length()); + + // Construct multi-run paragraph. + txt::ParagraphStyle paragraph_style; + paragraph_style.max_lines = 2; + paragraph_style.text_align = TextAlign::left; + txt::ParagraphBuilder builder(paragraph_style, GetTestFontCollection()); + + txt::TextStyle text_style1; + text_style1.color = SK_ColorBLACK; + text_style1.font_family = "Roboto"; + builder.PushStyle(text_style1); + + builder.AddText(u16_text1); + + txt::TextStyle text_style2; + text_style2.color = SK_ColorBLACK; + text_style2.font_family = "Roboto"; + text_style2.decoration = TextDecoration::kUnderline; + text_style2.decoration_color = SK_ColorBLACK; + builder.PushStyle(text_style2); + + builder.AddText(u16_text2); + + builder.Pop(); + + // Construct single run paragraph. + txt::ParagraphBuilder builder2(paragraph_style, GetTestFontCollection()); + + builder2.PushStyle(text_style1); + + builder2.AddText(u16_text3); + + builder2.Pop(); + + // Build multi-run paragraph + auto paragraph = builder.Build(); + paragraph->Layout(GetTestCanvasWidth()); + + paragraph->Paint(GetCanvas(), 0, 0); + + // Build single-run paragraph + auto paragraph2 = builder2.Build(); + paragraph2->Layout(GetTestCanvasWidth()); + + paragraph2->Paint(GetCanvas(), 0, 25); + + ASSERT_TRUE(Snapshot()); + + ASSERT_EQ(paragraph->records_[0].GetRunWidth() + + paragraph->records_[1].GetRunWidth(), + paragraph2->records_[0].GetRunWidth()); + + auto rects1 = paragraph->GetRectsForRange(0, 12); + auto rects2 = paragraph2->GetRectsForRange(0, 12); + + for (size_t i = 0; i < 12; ++i) { + auto r1 = GetCoordinatesForGlyphPosition(*paragraph, i); + auto r2 = GetCoordinatesForGlyphPosition(*paragraph2, i); + + ASSERT_EQ(r1.fLeft, r2.fLeft); + ASSERT_EQ(r1.fRight, r2.fRight); + } +} + } // namespace txt diff --git a/tools/gn b/tools/gn index 0a15b78e2b81b..874b9e049a3b7 100755 --- a/tools/gn +++ b/tools/gn @@ -89,7 +89,7 @@ def to_gn_args(args): gn_args['is_debug'] = args.unoptimized gn_args['android_full_debug'] = args.target_os == 'android' and args.unoptimized gn_args['is_clang'] = not sys.platform.startswith(('cygwin', 'win')) - + gn_args['embedder_for_target'] = args.embedder_for_target enable_lto = args.lto @@ -248,9 +248,9 @@ def main(argv): if sys.platform.startswith(('cygwin', 'win')): subdir = 'win' elif sys.platform == 'darwin': - subdir = 'mac' + subdir = 'mac-x64' elif sys.platform.startswith('linux'): - subdir = 'linux64' + subdir = 'linux-x64' else: raise Error('Unknown platform: ' + sys.platform) diff --git a/tools/licenses/README.md b/tools/licenses/README.md index f60cdd5f7fc12..805c32f8b4bd0 100644 --- a/tools/licenses/README.md +++ b/tools/licenses/README.md @@ -1,3 +1,16 @@ +# Update License Files + +## Apply patch generated by CI +If you're not working on a Linux box then you can't auto-generate license files. A workaround is provided via CI. + +Your build will fail one or more CI checks if your license files are not correct. Open the failing CI check. In the CI output you will find a patch diff that represents the changes that need to be made to your license files. Copy this patch to a temporary patch file wherever you'd like. Then apply the patch to your repo: + +``` +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: ``` diff --git a/tools/licenses/lib/main.dart b/tools/licenses/lib/main.dart index 43273d110f5f2..00442400a06dc 100644 --- a/tools/licenses/lib/main.dart +++ b/tools/licenses/lib/main.dart @@ -2262,123 +2262,6 @@ class RepositoryFlutterTxtThirdPartyDirectory extends RepositoryDirectory { } } -class RepositoryGarnetDirectory extends RepositoryDirectory { - RepositoryGarnetDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - bool shouldRecurse(fs.IoNode entry) { - return entry.name != 'bin' - && entry.name != 'docs' - && entry.name != 'drivers' - && entry.name != 'examples' - && entry.name != 'go' - && entry.name != 'lib' - && entry.name != 'packages' - && super.shouldRecurse(entry); - } - - @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'public') - return new RepositoryGarnetPublicDirectory(this, entry); - return super.createSubdirectory(entry); - } -} - -class RepositoryGarnetPublicDirectory extends RepositoryDirectory { - RepositoryGarnetPublicDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - bool shouldRecurse(fs.IoNode entry) { - return entry.name != 'dart-pkg' - && entry.name != 'build' - && entry.name != 'rust' - && super.shouldRecurse(entry); - } - - @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'lib') - return new RepositoryGarnetLibDirectory(this, entry); - return super.createSubdirectory(entry); - } -} - -class RepositoryGarnetLibDirectory extends RepositoryDirectory { - RepositoryGarnetLibDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - bool shouldRecurse(fs.IoNode entry) { - return entry.name != 'app' - && entry.name != 'escher' - && entry.name != 'url' - && super.shouldRecurse(entry); - } - - @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'fidl') - return new RepositoryGarnetFidlDirectory(this, entry); - return super.createSubdirectory(entry); - } -} - -class RepositoryGarnetFidlDirectory extends RepositoryDirectory { - RepositoryGarnetFidlDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - bool shouldRecurse(fs.IoNode entry) { - return entry.name != 'compiler' - && entry.name != 'fuzz' - && super.shouldRecurse(entry); - } - - @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'public') - return new RepositoryGarnetPublicDirectory(this, entry); - return super.createSubdirectory(entry); - } -} - -class RepositoryTopazDirectory extends RepositoryDirectory { - RepositoryTopazDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - bool shouldRecurse(fs.IoNode entry) { - return entry.name != 'tools' - && super.shouldRecurse(entry); - } - - @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'shell') - return new RepositoryTopazShellDirectory(this, entry); - return super.createSubdirectory(entry); - } -} - -class RepositoryTopazShellDirectory extends RepositoryDirectory { - RepositoryTopazShellDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'third_party') - return new RepositoryTopazShellThirdPartyDirectory(this, entry); - return super.createSubdirectory(entry); - } -} - -class RepositoryTopazShellThirdPartyDirectory extends RepositoryDirectory { - RepositoryTopazShellThirdPartyDirectory(RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - bool shouldRecurse(fs.IoNode entry) { - return entry.name != 'QR-Code-generator' - && super.shouldRecurse(entry); - } -} - class RepositoryRoot extends RepositoryDirectory { RepositoryRoot(fs.Directory io) : super(null, io); @@ -2413,10 +2296,6 @@ class RepositoryRoot extends RepositoryDirectory { return new RepositoryRootThirdPartyDirectory(this, entry); if (entry.name == 'flutter') return new RepositoryFlutterDirectory(this, entry); - if (entry.name == 'garnet') - return new RepositoryGarnetDirectory(this, entry); - if (entry.name == 'topaz') - return new RepositoryTopazDirectory(this, entry); return super.createSubdirectory(entry); } diff --git a/tools/licenses/pubspec.yaml b/tools/licenses/pubspec.yaml index ba5a68adface2..f56b63a03bb56 100644 --- a/tools/licenses/pubspec.yaml +++ b/tools/licenses/pubspec.yaml @@ -1,6 +1,6 @@ name: licenses dependencies: path: ^1.3.0 - archive: ^1.0.24 - args: 0.13.7 + archive: ^2.0.4 + args: 1.5.0 crypto: ^2.0.2+1