From a047fd20f6f005f1998ba839a42adffdfd1945fe Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Thu, 30 Aug 2018 16:29:51 -0400 Subject: [PATCH 001/134] Roll src/third_party/skia 7ed0eae0cd13..8e318fda76df (17 commits) (#6123) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/DEPS b/DEPS index eea5c3c445ff6..120f45cc79593 100644 --- a/DEPS +++ b/DEPS @@ -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': '8e318fda76dfdd2cc6be3a79ac1296278a3d43c6', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index bbc0bfafcfc1e..3bd5a19c2f9a0 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 55fe586ba44fb4ac9fcec9857ce134ab +Signature: 055777fad7c590dd7df4f1eecc2b975f UNUSED LICENSES: @@ -1474,9 +1474,6 @@ 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 @@ -3006,7 +3003,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 @@ -4615,6 +4611,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 From 51d4be7745d58c68eccf7ce89dea2934a2ea7ed0 Mon Sep 17 00:00:00 2001 From: "James D. Lin" Date: Thu, 30 Aug 2018 15:13:28 -0700 Subject: [PATCH 002/134] Add a `-[FlutterViewController splashScreenView]` property (#6112) Add a `-[FlutterViewController splashScreenView]` property Add a `-[FlutterViewController splashScreenView]` property that clients can use to customize the launch view (issue #17140). --- .../framework/Headers/FlutterViewController.h | 14 ++++ .../framework/Source/FlutterViewController.mm | 71 ++++++++++++------- 2 files changed, 60 insertions(+), 25 deletions(-) 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/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 27b8e3738ce76..2fb9f90c6f281 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,40 @@ - (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"]; + 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 { From e7767ae9b7a3bce027378ece554a9dba83ba86b2 Mon Sep 17 00:00:00 2001 From: matthew-carroll Date: Thu, 30 Aug 2018 16:37:58 -0700 Subject: [PATCH 003/134] Add license file patching instructions to README (#6125) Add license file patching instructions to README --- tools/licenses/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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: ``` From 21ac961df38224e92cba619d64cb7d7861a269e9 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Thu, 30 Aug 2018 19:47:51 -0400 Subject: [PATCH 004/134] Roll src/third_party/skia 8e318fda76df..381efe73499e (11 commits) (#6126) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/DEPS b/DEPS index 120f45cc79593..c3887c46a8742 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '8e318fda76dfdd2cc6be3a79ac1296278a3d43c6', + 'skia_revision': '381efe73499e0d88b7751f2396a190d87762bdb8', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3bd5a19c2f9a0..e4e170f12b94b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 055777fad7c590dd7df4f1eecc2b975f +Signature: 560483fbd6f0671f2dbc3b1915817ce8 UNUSED LICENSES: @@ -1483,10 +1483,6 @@ 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 @@ -3225,12 +3221,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 From a114659c4a83cabd2427722e9b050d0b378af8e7 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Thu, 30 Aug 2018 23:10:51 -0400 Subject: [PATCH 005/134] Roll src/third_party/skia 381efe73499e..f8592a69428e (1 commits) (#6127) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c3887c46a8742..d4aded2099c40 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '381efe73499e0d88b7751f2396a190d87762bdb8', + 'skia_revision': 'f8592a69428eb15713383cdd73c3ef1b9511afd2', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index e4e170f12b94b..070356b7828be 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 560483fbd6f0671f2dbc3b1915817ce8 +Signature: 677c97e32d042e32d7be8f0a5bf5c76e UNUSED LICENSES: From 90faf8531c001a01010b389c085bddbc829bf8b0 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Fri, 31 Aug 2018 08:36:51 -0400 Subject: [PATCH 006/134] Roll src/third_party/skia f8592a69428e..8ff2f13f3817 (1 commits) (#6129) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d4aded2099c40..127a05d787a0f 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'f8592a69428eb15713383cdd73c3ef1b9511afd2', + 'skia_revision': '8ff2f13f38171def1b1aeea8960443bb1fdd364a', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 070356b7828be..2990ea08a55a6 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 677c97e32d042e32d7be8f0a5bf5c76e +Signature: c4713f2ce051c3800943375594bf6060 UNUSED LICENSES: From f612a761c2f0f6bb857b7f1dbf101c2082f7dda7 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Fri, 31 Aug 2018 12:47:51 -0400 Subject: [PATCH 007/134] Roll src/third_party/skia 8ff2f13f3817..62db8d577931 (21 commits) (#6130) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 42 +++++++++++++++++--------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/DEPS b/DEPS index 127a05d787a0f..60eb3e714688e 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '8ff2f13f38171def1b1aeea8960443bb1fdd364a', + 'skia_revision': '62db8d5779319ab8cedbd1da26110b1dff7ec09c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2990ea08a55a6..318bfa89816cd 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c4713f2ce051c3800943375594bf6060 +Signature: 4eee53d8412c999ed8a57a9cd5baec32 UNUSED LICENSES: @@ -1550,6 +1550,8 @@ 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 @@ -1639,10 +1641,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 @@ -1956,11 +1958,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 @@ -2226,6 +2223,7 @@ FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Ubuntu17-C 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 @@ -2234,7 +2232,6 @@ FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clan FILE: ../../../third_party/skia/infra/bots/recipes/test.expected/Test-Win10-Clang-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 @@ -2286,6 +2283,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 @@ -4518,14 +4520,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 @@ -4556,11 +4555,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 From 842546824c21a4b15c136cbb98d63a075b006966 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Fri, 31 Aug 2018 11:28:18 -0700 Subject: [PATCH 008/134] Roll buildroot to pick up new NDK r17b (#6131) --- DEPS | 2 +- fml/platform/linux/timerfd.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 60eb3e714688e..bc2f65e8f96c7 100644 --- a/DEPS +++ b/DEPS @@ -115,7 +115,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '4fd7a2738de8fc8f9b498437cde96c1bf7562a04', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '101c573fa3d412f1a0a8e391905b817bb830a93f', # Fuchsia compatibility # 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 From 017dafd4266005805167045739fa2ddec9bb7cad Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Fri, 31 Aug 2018 12:15:54 -0700 Subject: [PATCH 009/134] Roll buildroot to 35959f6255c341eee550884ed69afd6b2891bd53 (unbreaks Windows) (#6132) --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index bc2f65e8f96c7..fb0548f6e903b 100644 --- a/DEPS +++ b/DEPS @@ -115,7 +115,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '101c573fa3d412f1a0a8e391905b817bb830a93f', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '35959f6255c341eee550884ed69afd6b2891bd53', # Fuchsia compatibility # From fbf672643659a9ae9290100a51ff1c35189cf06f Mon Sep 17 00:00:00 2001 From: "James D. Lin" Date: Fri, 31 Aug 2018 12:33:57 -0700 Subject: [PATCH 010/134] Mark deprecated Flutter iOS APIs as unavailable (#6124) The following were previously marked as deprecated over a month ago: * `FlutterStandardBigInteger` * `-[FlutterDartProject initFromDefaultSourceForConfiguration]` Remove their implementations and mark them as unavailable. --- .../darwin/ios/framework/Headers/Flutter.h | 4 ++ .../ios/framework/Headers/FlutterCodecs.h | 23 +---------- .../framework/Headers/FlutterDartProject.h | 2 +- .../ios/framework/Headers/FlutterMacros.h | 2 +- .../framework/Source/FlutterDartProject.mm | 7 +--- .../framework/Source/FlutterStandardCodec.mm | 41 ------------------- .../Source/FlutterStandardCodec_Internal.h | 1 + .../Source/flutter_standard_codec_unittest.mm | 16 +------- 8 files changed, 12 insertions(+), 84 deletions(-) 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/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index a89c61acfccb7..64eb73650dcc1 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -208,12 +208,7 @@ - (instancetype)initWithFlutterAssetsWithScriptSnapshot:(NSURL*)flutterAssetsURL 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/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}; From f44c0008ba4dc1cd486e85b80d7ea0bc1a01b6e9 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Fri, 31 Aug 2018 16:12:51 -0400 Subject: [PATCH 011/134] Roll src/third_party/skia 62db8d577931..7bfe8438a94b (20 commits) (#6134) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DEPS b/DEPS index fb0548f6e903b..933a602dac348 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '62db8d5779319ab8cedbd1da26110b1dff7ec09c', + 'skia_revision': '7bfe8438a94b0cc3f34fca1748eace7e8f3c69bd', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 318bfa89816cd..ab41edaa100df 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 4eee53d8412c999ed8a57a9cd5baec32 +Signature: 673603465118960f6671d748396ceaf2 UNUSED LICENSES: @@ -2170,7 +2170,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 @@ -2222,11 +2221,10 @@ 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 @@ -5551,6 +5549,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 From da419912d614483a30672befcb7cfb8b58d86600 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Fri, 31 Aug 2018 19:38:51 -0400 Subject: [PATCH 012/134] Roll src/third_party/skia 7bfe8438a94b..6487e5ca6f10 (6 commits) (#6136) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 933a602dac348..2773df1d7ca9a 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '7bfe8438a94b0cc3f34fca1748eace7e8f3c69bd', + 'skia_revision': '6487e5ca6f10d9b6977293465709e568062525db', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index ab41edaa100df..5161c2eec288a 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 673603465118960f6671d748396ceaf2 +Signature: 8af7d381cac2c89a8800197e383f7c57 UNUSED LICENSES: @@ -1379,6 +1379,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 From b3c778fe9cf4e10dc348c89c39d54f37dc5f3be4 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 31 Aug 2018 20:03:06 -0700 Subject: [PATCH 013/134] Allow embedders to specify software renderer configs. (#6133) --- ci/licenses_golden/licenses_flutter | 6 + shell/platform/embedder/BUILD.gn | 8 +- shell/platform/embedder/embedder.cc | 250 +++++++++++++----- shell/platform/embedder/embedder.h | 16 ++ shell/platform/embedder/embedder_surface.cc | 13 + shell/platform/embedder/embedder_surface.h | 31 +++ .../platform/embedder/embedder_surface_gl.cc | 84 ++++++ shell/platform/embedder/embedder_surface_gl.h | 69 +++++ .../embedder/embedder_surface_software.cc | 107 ++++++++ .../embedder/embedder_surface_software.h | 51 ++++ .../embedder/platform_view_embedder.cc | 86 +++--- .../embedder/platform_view_embedder.h | 56 ++-- 12 files changed, 620 insertions(+), 157 deletions(-) create mode 100644 shell/platform/embedder/embedder_surface.cc create mode 100644 shell/platform/embedder/embedder_surface.h create mode 100644 shell/platform/embedder/embedder_surface_gl.cc create mode 100644 shell/platform/embedder/embedder_surface_gl.h create mode 100644 shell/platform/embedder/embedder_surface_software.cc create mode 100644 shell/platform/embedder/embedder_surface_software.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 0256b51e6bea7..813bdff51f800 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -609,6 +609,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 ---------------------------------------------------------------------------------------------------- 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..bd685a86b6876 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; @@ -149,6 +141,114 @@ FlutterResult FlutterEngineRun(size_t version, 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 + }; + + 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); @@ -205,25 +305,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..224ba5ffb247b 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,10 @@ 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 struct { // The size of this struct. Must be sizeof(FlutterOpenGLRendererConfig). @@ -74,10 +79,21 @@ typedef struct { TransformationCallback surface_transformation; } 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..318716962e522 --- /dev/null +++ b/shell/platform/embedder/embedder_surface_gl.cc @@ -0,0 +1,84 @@ +// 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" + +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::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..6c15b5d81ca35 --- /dev/null +++ b/shell/platform/embedder/embedder_surface_gl.h @@ -0,0 +1,69 @@ +// 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 + }; + + 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; + + 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..edc855b276116 --- /dev/null +++ b/shell/platform/embedder/embedder_surface_software.cc @@ -0,0 +1,107 @@ +// 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" + +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..47b83813d974b 100644 --- a/shell/platform/embedder/platform_view_embedder.cc +++ b/shell/platform/embedder/platform_view_embedder.cc @@ -4,56 +4,32 @@ #include "flutter/shell/platform/embedder/platform_view_embedder.h" -#include "flutter/shell/common/io_manager.h" - 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)), + 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)), - dispatch_table_(dispatch_table), - fbo_reset_after_present_(fbo_reset_after_present) {} + 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 +40,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; From f25d89a2deccad20778411845f39d88366b6a072 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 31 Aug 2018 20:23:53 -0700 Subject: [PATCH 014/134] Fix windows embedder builds. (#6137) --- shell/platform/embedder/embedder_surface_gl.cc | 4 ++++ shell/platform/embedder/embedder_surface_software.cc | 4 ++++ shell/platform/embedder/platform_view_embedder.cc | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/shell/platform/embedder/embedder_surface_gl.cc b/shell/platform/embedder/embedder_surface_gl.cc index 318716962e522..7313ed9d94bec 100644 --- a/shell/platform/embedder/embedder_surface_gl.cc +++ b/shell/platform/embedder/embedder_surface_gl.cc @@ -6,6 +6,10 @@ #include "flutter/shell/common/io_manager.h" +#ifdef ERROR +#undef ERROR +#endif + namespace shell { EmbedderSurfaceGL::EmbedderSurfaceGL(GLDispatchTable gl_dispatch_table, diff --git a/shell/platform/embedder/embedder_surface_software.cc b/shell/platform/embedder/embedder_surface_software.cc index edc855b276116..103257745b359 100644 --- a/shell/platform/embedder/embedder_surface_software.cc +++ b/shell/platform/embedder/embedder_surface_software.cc @@ -7,6 +7,10 @@ #include "flutter/fml/trace_event.h" #include "third_party/skia/include/gpu/GrContext.h" +#ifdef ERROR +#undef ERROR +#endif + namespace shell { EmbedderSurfaceSoftware::EmbedderSurfaceSoftware( diff --git a/shell/platform/embedder/platform_view_embedder.cc b/shell/platform/embedder/platform_view_embedder.cc index 47b83813d974b..07f6c8dc1ff95 100644 --- a/shell/platform/embedder/platform_view_embedder.cc +++ b/shell/platform/embedder/platform_view_embedder.cc @@ -4,6 +4,10 @@ #include "flutter/shell/platform/embedder/platform_view_embedder.h" +#ifdef ERROR +#undef ERROR +#endif + namespace shell { PlatformViewEmbedder::PlatformViewEmbedder( From 0f7bfeaf486e26fae43e37c236b2320765560665 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Sat, 1 Sep 2018 02:53:51 -0400 Subject: [PATCH 015/134] Roll src/third_party/skia 6487e5ca6f10..e8e12e89c46b (1 commits) (#6138) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 2773df1d7ca9a..c93529f342f70 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '6487e5ca6f10d9b6977293465709e568062525db', + 'skia_revision': 'e8e12e89c46bc810e9baacf953c31ffa1bb45629', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 5161c2eec288a..349c3f668c5e2 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8af7d381cac2c89a8800197e383f7c57 +Signature: 014ba4aada05a3fb2d045db7bec94a12 UNUSED LICENSES: From db3484f2781d130f596fcce697591319b68b29a7 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Sat, 1 Sep 2018 21:14:53 -0700 Subject: [PATCH 016/134] Fix crash in text layout when GetMinikinFontCollectionForStyle returns null. (#6139) --- third_party/txt/src/txt/paragraph.cc | 3 +++ 1 file changed, 3 insertions(+) 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(); From a4471589f2cd4b62b1b1d99807fe3e19a242d8d1 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Sun, 2 Sep 2018 06:07:51 -0400 Subject: [PATCH 017/134] Roll src/third_party/skia e8e12e89c46b..8534723c7be1 (1 commits) (#6140) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index c93529f342f70..473f50a6df633 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'e8e12e89c46bc810e9baacf953c31ffa1bb45629', + 'skia_revision': '8534723c7be1c079711d8bac45e93728d6524f8a', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 349c3f668c5e2..2657929fa7fea 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 014ba4aada05a3fb2d045db7bec94a12 +Signature: 8bca555e3b7cc4ac094711e73a97d600 UNUSED LICENSES: From 949fb0fb4cbe4bf4753d68264b9d9cc966ba7058 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Sun, 2 Sep 2018 13:11:51 -0400 Subject: [PATCH 018/134] Roll src/third_party/skia 8534723c7be1..2f8c60e28682 (1 commits) (#6141) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 473f50a6df633..50945608fbc05 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '8534723c7be1c079711d8bac45e93728d6524f8a', + 'skia_revision': '2f8c60e28682871c8c99733954551ca64c68dab1', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2657929fa7fea..58ce8b883f470 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8bca555e3b7cc4ac094711e73a97d600 +Signature: e13358b587ef790ab6f10f46fb491916 UNUSED LICENSES: From d88e0b8229ecca8e2dda40c169b0fcc0edae5312 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Sun, 2 Sep 2018 16:35:51 -0400 Subject: [PATCH 019/134] Roll src/third_party/skia 2f8c60e28682..ca858b68c34b (2 commits) (#6142) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 50945608fbc05..2978139399a91 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '2f8c60e28682871c8c99733954551ca64c68dab1', + 'skia_revision': 'ca858b68c34bde4849a30ea44a4adcbfe8d917c5', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 58ce8b883f470..ded804c25346a 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: e13358b587ef790ab6f10f46fb491916 +Signature: b8d4589e63f865a07e03805cfaa0e85a UNUSED LICENSES: From 2318a5274af4f763251a4e9c3dea17451a342a6a Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Sun, 2 Sep 2018 22:00:51 -0400 Subject: [PATCH 020/134] Roll src/third_party/skia ca858b68c34b..2f53025e8bf1 (1 commits) (#6143) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 2978139399a91..e59d0d7083d7e 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'ca858b68c34bde4849a30ea44a4adcbfe8d917c5', + 'skia_revision': '2f53025e8bf18690f7791204ba42c536319c803e', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index ded804c25346a..158c92cdcc9cc 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b8d4589e63f865a07e03805cfaa0e85a +Signature: ecc4c4296d5e72c4a659b2314c956030 UNUSED LICENSES: From 77fad1a731f20dd49cd93c14288f116f9cb2f5a6 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Mon, 3 Sep 2018 06:39:51 -0400 Subject: [PATCH 021/134] Roll src/third_party/skia 2f53025e8bf1..09a7bb222172 (1 commits) (#6144) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index e59d0d7083d7e..f8c21b193c9a1 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '2f53025e8bf18690f7791204ba42c536319c803e', + 'skia_revision': '09a7bb222172dd28b3cdb2fe141c9562ee95e34f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 158c92cdcc9cc..9b0b48a4a5108 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ecc4c4296d5e72c4a659b2314c956030 +Signature: d597c0bbb66b374bfc814fd9cf95ccf8 UNUSED LICENSES: @@ -1325,6 +1325,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 @@ -1469,6 +1470,10 @@ 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 From de4c7a53f21cd0d2dd1cce9ea000e7f6a5398c2f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Mon, 3 Sep 2018 10:05:13 -0400 Subject: [PATCH 022/134] Roll src/third_party/skia 09a7bb222172..88119de2b849 (1 commits) (#6146) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f8c21b193c9a1..9f889352dea91 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '09a7bb222172dd28b3cdb2fe141c9562ee95e34f', + 'skia_revision': '88119de2b849f22ec21b1364f44fad84109342d6', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 9b0b48a4a5108..070e940cccd93 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: d597c0bbb66b374bfc814fd9cf95ccf8 +Signature: 1fc0b9fdf607399c2818ecfbf9c66f77 UNUSED LICENSES: From bdcbe801a4dfd7ed0e8c32e2f0df43fc242c5ca8 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Mon, 3 Sep 2018 13:28:51 -0400 Subject: [PATCH 023/134] Roll src/third_party/skia 88119de2b849..bf67741140fd (1 commits) (#6147) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 9f889352dea91..984d77906c072 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '88119de2b849f22ec21b1364f44fad84109342d6', + 'skia_revision': 'bf67741140fd3db27098c988194e6c7fa0c26f96', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 070e940cccd93..b42e50f36f1ca 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 1fc0b9fdf607399c2818ecfbf9c66f77 +Signature: f3cccff222bfd806f54c0c66b0d13fcc UNUSED LICENSES: From eea3a21e1185d547c320f7f08245c66eab748f12 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Mon, 3 Sep 2018 16:52:51 -0400 Subject: [PATCH 024/134] Roll src/third_party/skia bf67741140fd..24e58341fbcd (2 commits) (#6148) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 984d77906c072..4042ebeef53d6 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'bf67741140fd3db27098c988194e6c7fa0c26f96', + 'skia_revision': '24e58341fbcd904fdf81d86e5a7703e254d63e35', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b42e50f36f1ca..9b6281e840565 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f3cccff222bfd806f54c0c66b0d13fcc +Signature: af91da401385350e1fd99d6d8f3947a4 UNUSED LICENSES: From 2dc8271a4c08028b856018c4e8c88afe86389b40 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Tue, 4 Sep 2018 00:27:51 -0400 Subject: [PATCH 025/134] Roll src/third_party/skia 24e58341fbcd..cff3fd834ca8 (1 commits) (#6151) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4042ebeef53d6..4bbb54852db24 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '24e58341fbcd904fdf81d86e5a7703e254d63e35', + 'skia_revision': 'cff3fd834ca8f3849cca81b4cb4353f10d7ad10f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 9b6281e840565..8ac7acb52a13d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: af91da401385350e1fd99d6d8f3947a4 +Signature: b7ea7936f3a9d9f8522895f97e83bc67 UNUSED LICENSES: From b0b8daa7b2a63d0371aa31deb637ca263545fdcd Mon Sep 17 00:00:00 2001 From: Kirill Nikolaev Date: Tue, 4 Sep 2018 15:31:01 +0200 Subject: [PATCH 026/134] Unregister onFrameAvailable callbacks when a TextureEntry is released. (#6079) Otherwise the callbacks may be called after FlutterNativeView is destroyed and is null. Also defensively check for whether the texture is already released in the callback because the callback may be called from another thread by a stale reference (see the comment). This closes https://github.com/flutter/flutter/issues/20951. --- .../android/io/flutter/view/FlutterView.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 0acaa6c4e894c..33c8c834742be 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -997,9 +997,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 +1029,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(); } } From f89a386a1c06d203c041758a00f90e0ca15f8576 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Tue, 4 Sep 2018 09:48:58 -0400 Subject: [PATCH 027/134] Roll src/third_party/skia cff3fd834ca8..a45e1a71f548 (1 commits) (#6152) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4bbb54852db24..ee6ec21094686 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'cff3fd834ca8f3849cca81b4cb4353f10d7ad10f', + 'skia_revision': 'a45e1a71f548e0814d99b1a299911ec7c944887f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 8ac7acb52a13d..2bf7919fefc2b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b7ea7936f3a9d9f8522895f97e83bc67 +Signature: 8a26acc7786c1e0c403afb52fb28ef0a UNUSED LICENSES: From 137389a85b74832515204e7e34fb5fed2be6c9b0 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Tue, 4 Sep 2018 13:13:51 -0400 Subject: [PATCH 028/134] Roll src/third_party/skia a45e1a71f548..b84576af0a43 (16 commits) (#6153) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/DEPS b/DEPS index ee6ec21094686..00d42fb2c616b 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'a45e1a71f548e0814d99b1a299911ec7c944887f', + 'skia_revision': 'b84576af0a4386a88bf5f8453b8ff7bc0db3adcc', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2bf7919fefc2b..96f83ce457e68 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8a26acc7786c1e0c403afb52fb28ef0a +Signature: aaaf2a01cd942fd5b5d2eb792ca3420f UNUSED LICENSES: @@ -959,8 +959,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 @@ -1495,9 +1493,6 @@ 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 From 593ed59143c65bba7c3965ba2dc73b94c69ee593 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Tue, 4 Sep 2018 10:21:30 -0700 Subject: [PATCH 029/134] Revert "Use Skia normalize again after Skia precision fix. (#6121)" (#6122) This reverts commit dc7b5eb89da31cddc2abc91aa5b30bcc6d66e70c. --- flow/matrix_decomposition.cc | 14 +++++++++++--- flow/matrix_decomposition_unittests.cc | 3 +-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/flow/matrix_decomposition.cc b/flow/matrix_decomposition.cc index 73a774b4dd037..e1ac11a927046 100644 --- a/flow/matrix_decomposition.cc +++ b/flow/matrix_decomposition.cc @@ -28,6 +28,14 @@ static inline SkVector3 SkVector3Cross(const SkVector3& a, const SkVector3& b) { MatrixDecomposition::MatrixDecomposition(const SkMatrix& matrix) : MatrixDecomposition(SkMatrix44{matrix}) {} +// TODO(garyq): use skia row[x].normalize() when skia fixes it +static inline void SkVector3Normalize(SkVector3& v) { + float mag = sqrt(v.fX * v.fX + v.fY * v.fY + v.fZ * v.fZ); + v.fX /= mag; + v.fY /= mag; + v.fZ /= mag; +} + MatrixDecomposition::MatrixDecomposition(SkMatrix44 matrix) : valid_(false) { if (matrix.get(3, 3) == 0) { return; @@ -83,14 +91,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 +109,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); From aaf98fbfedb2ebf1eb81d082514170adbd35f34c Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Tue, 4 Sep 2018 10:54:52 -0700 Subject: [PATCH 030/134] Use double multiplication by a scale instead of 3 divides for speed. (#6154) --- flow/matrix_decomposition.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/flow/matrix_decomposition.cc b/flow/matrix_decomposition.cc index e1ac11a927046..0cc035cbba216 100644 --- a/flow/matrix_decomposition.cc +++ b/flow/matrix_decomposition.cc @@ -28,12 +28,13 @@ static inline SkVector3 SkVector3Cross(const SkVector3& a, const SkVector3& b) { MatrixDecomposition::MatrixDecomposition(const SkMatrix& matrix) : MatrixDecomposition(SkMatrix44{matrix}) {} -// TODO(garyq): use skia row[x].normalize() when skia fixes it +// Use custom normalize to avoid skia precision loss/normalize() privatization. static inline void SkVector3Normalize(SkVector3& v) { - float mag = sqrt(v.fX * v.fX + v.fY * v.fY + v.fZ * v.fZ); - v.fX /= mag; - v.fY /= mag; - v.fZ /= mag; + 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) { From c173655b227fcb3067fd1738aa98f825553fd7d1 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Tue, 4 Sep 2018 16:37:51 -0400 Subject: [PATCH 031/134] Roll src/third_party/skia b84576af0a43..e486bbaae296 (9 commits) (#6155) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 00d42fb2c616b..a7aa655ffcaad 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'b84576af0a4386a88bf5f8453b8ff7bc0db3adcc', + 'skia_revision': 'e486bbaae296b81cd47101c1a57ceef1728571f9', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 96f83ce457e68..8458af8583196 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: aaaf2a01cd942fd5b5d2eb792ca3420f +Signature: 112b161eefde13f4bf778963ba8895b8 UNUSED LICENSES: From b32ceafb1f1cc47836ea8db1ce9046ede8e45b6d Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Tue, 4 Sep 2018 14:38:10 -0700 Subject: [PATCH 032/134] Add some more logs for diagnosing screenshot failures (#6156) Fixes https://github.com/flutter/flutter/issues/21228 --- shell/common/rasterizer.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index 6f0ddd53a1907..4603c57b0ea87 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -173,6 +173,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; } @@ -193,16 +194,18 @@ static sk_sp ScreenshotLayerTreeAsImage( // 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 +214,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 +226,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 {}; } @@ -246,7 +250,7 @@ Rasterizer::Screenshot Rasterizer::ScreenshotLastLayerTree( } if (data == nullptr) { - FML_DLOG(INFO) << "Sceenshot data was null."; + FML_LOG(ERROR) << "Screenshot data was null."; return {}; } From 30af2f299718f7a042bd379ae7afb669a5ac0b13 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Tue, 4 Sep 2018 20:02:51 -0400 Subject: [PATCH 033/134] Roll src/third_party/skia e486bbaae296..fddc6fa394cb (2 commits) (#6159) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index a7aa655ffcaad..0e65f669f0598 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'e486bbaae296b81cd47101c1a57ceef1728571f9', + 'skia_revision': 'fddc6fa394cb645a7239f0d27925ffb4e6070340', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 8458af8583196..79e7573492e74 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 112b161eefde13f4bf778963ba8895b8 +Signature: bfba71d5b389f53589fcb7b70a68c942 UNUSED LICENSES: From 6ad3183b181fd6c45b624ad73288da3ea7494db9 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 4 Sep 2018 18:23:29 -0700 Subject: [PATCH 034/134] Fix windows build. (#6162) --- shell/common/rasterizer.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index 4603c57b0ea87..cbfc4e4f5c547 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -13,6 +13,10 @@ #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) From 9643a50ac4d72676d2604c0caea41d5d4dc38e92 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Tue, 4 Sep 2018 23:26:51 -0400 Subject: [PATCH 035/134] Roll src/third_party/skia fddc6fa394cb..85f4e40c5481 (1 commits) (#6164) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 0e65f669f0598..bd17ac6c1ba5f 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'fddc6fa394cb645a7239f0d27925ffb4e6070340', + 'skia_revision': '85f4e40c5481fea45a519433c18f482b80a16d34', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 79e7573492e74..a5e3f82245fb1 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: bfba71d5b389f53589fcb7b70a68c942 +Signature: 5061d7463742eef8941a8620bf704635 UNUSED LICENSES: From 19a3bc8e11fd56915a230b3b5ab22f232ae02093 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Wed, 5 Sep 2018 02:51:51 -0400 Subject: [PATCH 036/134] Roll src/third_party/skia 85f4e40c5481..72a02112a99f (1 commits) (#6165) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index bd17ac6c1ba5f..9f549a63702ce 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '85f4e40c5481fea45a519433c18f482b80a16d34', + 'skia_revision': '72a02112a99fa9d73ceb0aca66f9bd2833ef60ba', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a5e3f82245fb1..34e253507ef50 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 5061d7463742eef8941a8620bf704635 +Signature: eebd7bb9ce26512160f6865b1b022ee5 UNUSED LICENSES: From 5063a8a5b32c36d4ba7b921e260b7b4ee09c9f35 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Wed, 5 Sep 2018 06:16:51 -0400 Subject: [PATCH 037/134] Roll src/third_party/skia 72a02112a99f..9478f7a38e6c (1 commits) (#6166) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 9f549a63702ce..23d6dc3571275 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '72a02112a99fa9d73ceb0aca66f9bd2833ef60ba', + 'skia_revision': '9478f7a38e6c378f338648ec3eade4060e7721ea', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 34e253507ef50..2a2259e4542ef 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: eebd7bb9ce26512160f6865b1b022ee5 +Signature: 2e165b14710a3965f27465c91f1843e7 UNUSED LICENSES: From 6d0fbc7eb7da7c218a69918dd142ff6ea5cf2b66 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Wed, 5 Sep 2018 09:41:51 -0400 Subject: [PATCH 038/134] Roll src/third_party/skia 9478f7a38e6c..d0f0cb8ffc5e (1 commits) (#6167) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 23d6dc3571275..f03b8a17de78b 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '9478f7a38e6c378f338648ec3eade4060e7721ea', + 'skia_revision': 'd0f0cb8ffc5ed55647d39071586f929132aa46b7', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2a2259e4542ef..96010bbb33afe 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2e165b14710a3965f27465c91f1843e7 +Signature: b3451a3c64c368c9a9360530914fb1de UNUSED LICENSES: From b22badf1d473d2fc88e8db60d2616028bfbc5226 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Wed, 5 Sep 2018 09:16:56 -0700 Subject: [PATCH 039/134] Dart SDK roll for 2018/09/04 (#6161) --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f03b8a17de78b..4415e4de95352 100644 --- a/DEPS +++ b/DEPS @@ -31,7 +31,7 @@ vars = { # Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS. # You can use //tools/dart/create_updated_flutter_deps.py to produce # updated revision list of existing dependencies. - 'dart_revision': '760a9690c22ec3f3d163173737f9949f97e6e02a', + 'dart_revision': '2b995b2654ba162c48cdd187ce0b2f1d24c6838f', 'dart_args_tag': '1.4.4', 'dart_async_tag': '2.0.8', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 2d0cf91811ccd..4f3821e0c6fc6 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 149340ef002a59fe0840631d6cfd1773 +Signature: 598ca2c15761821d8380b0e4c6c1307b UNUSED LICENSES: @@ -5461,6 +5461,7 @@ 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_reader.cc From 6af60d716abdc4dd64459107c12b72161ff24988 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 5 Sep 2018 10:01:33 -0700 Subject: [PATCH 040/134] Remove obsolete discovery mechanism from FlutterView (#6157) --- .../android/io/flutter/view/FlutterView.java | 39 ------------------- 1 file changed, 39 deletions(-) diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 33c8c834742be..b72643e3f3ce7 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -69,8 +69,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 +94,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); @@ -183,13 +180,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) { @@ -332,9 +322,6 @@ float getDevicePixelRatio() { public FlutterNativeView detach() { if (!isAttached()) return null; - if (mDiscoveryReceiver != null) { - getContext().unregisterReceiver(mDiscoveryReceiver); - } getHolder().removeCallback(mSurfaceCallback); mNativeView.detach(); @@ -347,10 +334,6 @@ public void destroy() { if (!isAttached()) return; - if (mDiscoveryReceiver != null) { - getContext().unregisterReceiver(mDiscoveryReceiver); - } - getHolder().removeCallback(mSurfaceCallback); mNativeView.destroy(); @@ -946,28 +929,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. From 564d214b71ec3ad251a2dc7b243c606eb057d69a Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Wed, 5 Sep 2018 13:05:51 -0400 Subject: [PATCH 041/134] Roll src/third_party/skia d0f0cb8ffc5e..9d1c88d9912d (12 commits) (#6168) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4415e4de95352..30f014b703912 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'd0f0cb8ffc5ed55647d39071586f929132aa46b7', + 'skia_revision': '9d1c88d9912dbddc2fe0b09878b4f30675c9f3bd', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 96010bbb33afe..5ea8c3c3fc51f 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b3451a3c64c368c9a9360530914fb1de +Signature: ea6fea0bd881af4fc62c11924902a3f0 UNUSED LICENSES: From 3a7d0b559fe9190b11aa36402ea663736bd802e7 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 5 Sep 2018 10:20:55 -0700 Subject: [PATCH 042/134] Roll buildroot to 7aadfaf196f9cd8a299f9ad78fab63362800466d (#6169) --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 30f014b703912..6cc050877a3af 100644 --- a/DEPS +++ b/DEPS @@ -115,7 +115,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '35959f6255c341eee550884ed69afd6b2891bd53', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '7aadfaf196f9cd8a299f9ad78fab63362800466d', # Fuchsia compatibility # From 0981731fd703507ba42996bdb1edeecdb27b04b7 Mon Sep 17 00:00:00 2001 From: Michael Klimushyn Date: Wed, 5 Sep 2018 10:44:02 -0700 Subject: [PATCH 043/134] Enable transparent FlutterViews (#6163) - Changes rasterizer to clear the canvas with `SkColor_TRANSPARENT` - Removes the unused `backgroundColor` param from `FlutterView.java` --- shell/common/rasterizer.cc | 4 ++-- .../android/io/flutter/view/FlutterView.java | 14 ++------------ .../platform/android/platform_view_android_jni.cc | 5 ++--- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index cbfc4e4f5c547..d3d78c6d72c8c 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -118,7 +118,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)) { @@ -191,7 +191,7 @@ 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(); diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index b72643e3f3ce7..9a3ee9cb9d55f 100644 --- a/shell/platform/android/io/flutter/view/FlutterView.java +++ b/shell/platform/android/io/flutter/view/FlutterView.java @@ -128,20 +128,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 @@ -634,8 +625,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); diff --git a/shell/platform/android/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index 315ac0b55bdc0..6dd4b9ab3350a 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 @@ -638,7 +637,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), }, { From 9f0ad8b794e384ae17cf00109d0f45951942ef03 Mon Sep 17 00:00:00 2001 From: Simon Lightfoot Date: Wed, 5 Sep 2018 20:12:21 +0100 Subject: [PATCH 044/134] Fixes negative end selection offset. (#6171) --- .../io/flutter/plugin/editing/InputConnectionAdaptor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)); From e6d9b34a8cefe8f425b0cb493b3cbe1a535c52ed Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 5 Sep 2018 12:22:27 -0700 Subject: [PATCH 045/134] Remove the old location of the ICU data asset (#6170) The tools are now placing icudtl.dat in the flutter_shared directory. It is no longer necessary to check for this asset at its previous path. --- .../platform/android/io/flutter/view/FlutterMain.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/shell/platform/android/io/flutter/view/FlutterMain.java b/shell/platform/android/io/flutter/view/FlutterMain.java index 2ac9347f18955..49d3b01707633 100644 --- a/shell/platform/android/io/flutter/view/FlutterMain.java +++ b/shell/platform/android/io/flutter/view/FlutterMain.java @@ -262,15 +262,7 @@ 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; From a0f30b3b0c0395d1268496af36e5fdd310bf1962 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Wed, 5 Sep 2018 16:45:51 -0400 Subject: [PATCH 046/134] Roll src/third_party/skia 9d1c88d9912d..343553a1fe9e (16 commits) (#6175) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 6cc050877a3af..ecb7bb82cfef4 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '9d1c88d9912dbddc2fe0b09878b4f30675c9f3bd', + 'skia_revision': '343553a1fe9ec65ee6526015a7972435914d7a48', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 5ea8c3c3fc51f..90c46770b3701 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ea6fea0bd881af4fc62c11924902a3f0 +Signature: bde0f7aa6e379bb73ab99efb8fba20a1 UNUSED LICENSES: From f6ad3e0967d1d378fc2e42aaf7c757bf3b68ed32 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 5 Sep 2018 16:16:58 -0700 Subject: [PATCH 047/134] Roll Tonic (#6177) --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index ecb7bb82cfef4..fdb0f7872eaea 100644 --- a/DEPS +++ b/DEPS @@ -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', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 4f3821e0c6fc6..aca13aa04fe96 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 598ca2c15761821d8380b0e4c6c1307b +Signature: 5ff2cabdf3ef0c70254ec22bc9e767c6 UNUSED LICENSES: From 108e0a64eff59c1783c507e1596eaad8c94d26c2 Mon Sep 17 00:00:00 2001 From: Michael Klimushyn Date: Wed, 5 Sep 2018 16:47:02 -0700 Subject: [PATCH 048/134] Add transparency helpers to FlutterView.java (#6172) Fixes #9627 --- .../android/io/flutter/view/FlutterView.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/shell/platform/android/io/flutter/view/FlutterView.java b/shell/platform/android/io/flutter/view/FlutterView.java index 9a3ee9cb9d55f..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; @@ -276,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); } From 572753fb1205dabe699724bbe99cfe7ca02a78d9 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Wed, 5 Sep 2018 20:05:51 -0400 Subject: [PATCH 049/134] Roll src/third_party/skia 343553a1fe9e..ffbcc3fadfa1 (6 commits) (#6178) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index fdb0f7872eaea..4e417716f42ac 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '343553a1fe9ec65ee6526015a7972435914d7a48', + 'skia_revision': 'ffbcc3fadfa1e9718acf591be0989d279c22d266', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 90c46770b3701..4aa343aded22a 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: bde0f7aa6e379bb73ab99efb8fba20a1 +Signature: e1e86ab62aa82b8b7f174536641a6f8d UNUSED LICENSES: From ade0f22303716b28cbf27f6c8be5aa71e1c4608e Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Wed, 5 Sep 2018 19:45:55 -0700 Subject: [PATCH 050/134] Remove unused file picture_serializer. (#6179) --- ci/licenses_golden/licenses_flutter | 2 -- shell/common/BUILD.gn | 2 -- shell/common/picture_serializer.cc | 16 ---------------- shell/common/picture_serializer.h | 18 ------------------ 4 files changed, 38 deletions(-) delete mode 100644 shell/common/picture_serializer.cc delete mode 100644 shell/common/picture_serializer.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 813bdff51f800..62c4bcd7b2671 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -819,8 +819,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/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/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_ From 1768bedcf935f3a6eb798aedca4bde21978ba520 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Thu, 6 Sep 2018 08:00:52 -0400 Subject: [PATCH 051/134] Roll src/third_party/skia ffbcc3fadfa1..71f8475a0dba (3 commits) (#6181) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4e417716f42ac..9c47002732a2a 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'ffbcc3fadfa1e9718acf591be0989d279c22d266', + 'skia_revision': '71f8475a0dbacc5d63fef094100835bad7b1e74c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 4aa343aded22a..31cb5f4ce3bbe 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: e1e86ab62aa82b8b7f174536641a6f8d +Signature: 2d0f3b3ff2a5279313bfee7ef0cef7c5 UNUSED LICENSES: From 897178cc3a52093a509895ab37134d1e484c387a Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Thu, 6 Sep 2018 11:24:51 -0400 Subject: [PATCH 052/134] Roll src/third_party/skia 71f8475a0dba..33d3d31a7e28 (6 commits) (#6182) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 9c47002732a2a..c49ac92f4b15e 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '71f8475a0dbacc5d63fef094100835bad7b1e74c', + 'skia_revision': '33d3d31a7e28631613cf4193263269664b4896af', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 31cb5f4ce3bbe..6525e3b50a9f8 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2d0f3b3ff2a5279313bfee7ef0cef7c5 +Signature: 0428ac4d3d4808be87dc69890e2422af UNUSED LICENSES: From 5f61056946efa1380f87c402f960be9e7b19cdc4 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 6 Sep 2018 09:30:27 -0700 Subject: [PATCH 053/134] Revert "Dart SDK roll for 2018/09/04 (#6161)" (#6183) * Revert "Dart SDK roll for 2018/09/04 (#6161)" This reverts commit b22badf1d473d2fc88e8db60d2616028bfbc5226. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index c49ac92f4b15e..5141288d6462d 100644 --- a/DEPS +++ b/DEPS @@ -31,7 +31,7 @@ vars = { # Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS. # You can use //tools/dart/create_updated_flutter_deps.py to produce # updated revision list of existing dependencies. - 'dart_revision': '2b995b2654ba162c48cdd187ce0b2f1d24c6838f', + 'dart_revision': '760a9690c22ec3f3d163173737f9949f97e6e02a', 'dart_args_tag': '1.4.4', 'dart_async_tag': '2.0.8', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index aca13aa04fe96..effcb3701a544 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 5ff2cabdf3ef0c70254ec22bc9e767c6 +Signature: da77c336d1e2756b2cca2e2d00f2d741 UNUSED LICENSES: @@ -5461,7 +5461,6 @@ 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_reader.cc From 058edef8f2d718b1510984a12b73f5374c76ad62 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Thu, 6 Sep 2018 11:00:18 -0700 Subject: [PATCH 054/134] Fix LibTxt/minikin text shifiting when breaking into multiple runs (#6184) --- third_party/txt/src/minikin/Layout.cpp | 4 +- third_party/txt/src/txt/paint_record.h | 2 +- third_party/txt/src/txt/paragraph.h | 1 + third_party/txt/tests/paragraph_unittests.cc | 92 ++++++++++++++++++-- 4 files changed, 90 insertions(+), 9 deletions(-) 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.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 From a146862524d71f9e034ce7fe758dd57b36adb883 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Thu, 6 Sep 2018 14:50:52 -0400 Subject: [PATCH 055/134] Roll src/third_party/skia 33d3d31a7e28..a9564d6dae1c (5 commits) (#6185) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 5141288d6462d..57f0e480f55da 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '33d3d31a7e28631613cf4193263269664b4896af', + 'skia_revision': 'a9564d6dae1c64cb7dc4217fd2f03d48b7cdfc0d', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6525e3b50a9f8..10e6cb1092d91 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 0428ac4d3d4808be87dc69890e2422af +Signature: 5e66185dbea5f083799877fc769e39c1 UNUSED LICENSES: From 30c8da8abf2d549cf0f17a6965c497ba7d3713aa Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Thu, 6 Sep 2018 12:26:20 -0700 Subject: [PATCH 056/134] Pull $flutter_root:config into shell/engine/version:version (#6186) To fix the Fuchsia build. --- shell/version/BUILD.gn | 2 ++ 1 file changed, 2 insertions(+) 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" ] } From bd7593b2ad07a2a7915574b84a8b44dbc918b826 Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Thu, 6 Sep 2018 12:35:12 -0700 Subject: [PATCH 057/134] [fuchsia] Plumb root_surface_transformation in scene_update_context (#6187) * [fuchsia] Plumb root_surface_transformation in scene_update_context To fix the Fuchsia build. * Update scene_update_context.cc --- flow/scene_update_context.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/flow/scene_update_context.cc b/flow/scene_update_context.cc index 576bde7fa1aff..1da575bf56f12 100644 --- a/flow/scene_update_context.cc +++ b/flow/scene_update_context.cc @@ -187,9 +187,12 @@ SceneUpdateContext::ExecutePaintTasks(CompositorContext::ScopedFrame& frame) { for (auto& task : paint_tasks_) { FML_DCHECK(task.surface); SkCanvas* canvas = task.surface->GetSkiaSurface()->getCanvas(); - Layer::PaintContext context = {*canvas, frame.context().frame_time(), + Layer::PaintContext context = {*canvas, + frame.root_surface_transformation(), + frame.context().frame_time(), frame.context().engine_time(), - frame.context().texture_registry(), false}; + frame.context().texture_registry(), + false}; canvas->restoreToCount(1); canvas->save(); canvas->clear(task.background_color); From e70d0e1b7c23f1df0c14023232a97d2cc72a8a8d Mon Sep 17 00:00:00 2001 From: liyuqian Date: Thu, 6 Sep 2018 13:44:47 -0700 Subject: [PATCH 058/134] Always serialize fonts during skp capturing (#6160) This fixes flutter/flutter#20788 --- shell/common/rasterizer.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index d3d78c6d72c8c..6f08b2afd0b7e 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -9,6 +9,7 @@ #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" @@ -130,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); @@ -147,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, @@ -240,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_, From 9b297b3b51228d5009b47a09cc7c8e9774877f5e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Thu, 6 Sep 2018 18:15:52 -0400 Subject: [PATCH 059/134] Roll src/third_party/skia a9564d6dae1c..106d04e907c1 (7 commits) (#6190) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 57f0e480f55da..fc644661cb190 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'a9564d6dae1c64cb7dc4217fd2f03d48b7cdfc0d', + 'skia_revision': '106d04e907c1778810282dd53c1c5c0ca84ee389', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 10e6cb1092d91..2e36c6453a70d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 5e66185dbea5f083799877fc769e39c1 +Signature: b83ef922f9026252a7dc1fa5d51bbf99 UNUSED LICENSES: From 58a1894a1cd798de2f9a206f157a90d45944028b Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 6 Sep 2018 15:29:04 -0700 Subject: [PATCH 060/134] Update to latest clang (#6174) * Roll buildroot to be483cb1cd3a9c4313b2e534034d23a05c3d849e * Rolls buildtools to c1408453246f0475547b6fe634c2f3dad71c6457 --- DEPS | 4 ++-- fml/memory/ref_counted_unittest.cc | 12 +++++++++++- shell/platform/darwin/BUILD.gn | 1 + tools/gn | 6 +++--- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/DEPS b/DEPS index fc644661cb190..f75eb9f683636 100644 --- a/DEPS +++ b/DEPS @@ -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' + '@' + '7aadfaf196f9cd8a299f9ad78fab63362800466d', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'be483cb1cd3a9c4313b2e534034d23a05c3d849e', # Fuchsia compatibility # 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/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/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) From f02fc8c1068619dd2911a3e8bf95f8d43b8d276c Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 6 Sep 2018 15:52:04 -0700 Subject: [PATCH 061/134] Dart SDK roll for 2018/09/06 (#6189) --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 91 +++++++++++++------------ frontend_server/lib/server.dart | 5 ++ 3 files changed, 52 insertions(+), 46 deletions(-) diff --git a/DEPS b/DEPS index f75eb9f683636..a1c7dcd3816e1 100644 --- a/DEPS +++ b/DEPS @@ -31,7 +31,7 @@ vars = { # Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS. # You can use //tools/dart/create_updated_flutter_deps.py to produce # updated revision list of existing dependencies. - 'dart_revision': '760a9690c22ec3f3d163173737f9949f97e6e02a', + 'dart_revision': 'c7ab56e1b5ab9bcf6f20057ac9135dede7d40395', 'dart_args_tag': '1.4.4', 'dart_async_tag': '2.0.8', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index effcb3701a544..4aba7f34ba2fb 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: da77c336d1e2756b2cca2e2d00f2d741 +Signature: cd0d6dca1aa2aca73d1f1dab47cf9355 UNUSED LICENSES: @@ -5461,6 +5461,7 @@ 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_reader.cc @@ -16698,6 +16699,50 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== +==================================================================================================== +LIBRARY: tonic +ORIGIN: ../../../garnet/LICENSE +TYPE: LicenseType.bsd +FILE: ../../../third_party/tonic/dart_list.cc +FILE: ../../../third_party/tonic/dart_list.h +FILE: ../../../third_party/tonic/file_loader/file_loader_fuchsia.cc +FILE: ../../../third_party/tonic/file_loader/file_loader_posix.cc +FILE: ../../../third_party/tonic/file_loader/file_loader_win.cc +FILE: ../../../third_party/tonic/filesystem/filesystem/path_win.cc +FILE: ../../../third_party/tonic/filesystem/filesystem/portable_unistd.h +FILE: ../../../third_party/tonic/platform/platform_utils.h +FILE: ../../../third_party/tonic/platform/platform_utils_posix.cc +FILE: ../../../third_party/tonic/platform/platform_utils_win.cc +---------------------------------------------------------------------------------------------------- +Copyright 2017 The Fuchsia Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +==================================================================================================== + ==================================================================================================== LIBRARY: tonic ORIGIN: ../../../third_party/tonic/LICENSE @@ -16797,50 +16842,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== -==================================================================================================== -LIBRARY: tonic -ORIGIN: ../../../third_party/tonic/file_loader/file_loader_fuchsia.cc + ../../../third_party/tonic/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../third_party/tonic/dart_list.cc -FILE: ../../../third_party/tonic/dart_list.h -FILE: ../../../third_party/tonic/file_loader/file_loader_fuchsia.cc -FILE: ../../../third_party/tonic/file_loader/file_loader_posix.cc -FILE: ../../../third_party/tonic/file_loader/file_loader_win.cc -FILE: ../../../third_party/tonic/filesystem/filesystem/path_win.cc -FILE: ../../../third_party/tonic/filesystem/filesystem/portable_unistd.h -FILE: ../../../third_party/tonic/platform/platform_utils.h -FILE: ../../../third_party/tonic/platform/platform_utils_posix.cc -FILE: ../../../third_party/tonic/platform/platform_utils_win.cc ----------------------------------------------------------------------------------------------------- -Copyright 2017 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - ==================================================================================================== LIBRARY: tonic ORIGIN: ../../../third_party/tonic/typed_data/dart_byte_data.cc + ../../../third_party/tonic/LICENSE diff --git a/frontend_server/lib/server.dart b/frontend_server/lib/server.dart index 804c5699eb2f8..572087e9d186e 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); From e164e83a857fae541492ca810e3d731b39ff7ffd Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 7 Sep 2018 08:11:17 +0800 Subject: [PATCH 062/134] Reset the raster cache when the compositor context is created. (#6150) --- flow/compositor_context.cc | 1 + 1 file changed, 1 insertion(+) 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() { From b09563b2ec8efa3b827d145af5e249c364600510 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Thu, 6 Sep 2018 21:51:51 -0400 Subject: [PATCH 063/134] Roll src/third_party/skia 106d04e907c1..b090b2b26803 (1 commits) (#6193) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index a1c7dcd3816e1..e704ef9e65595 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '106d04e907c1778810282dd53c1c5c0ca84ee389', + 'skia_revision': 'b090b2b26803179f5a271efb142c747a1bba6225', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2e36c6453a70d..a5202b8062a0d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b83ef922f9026252a7dc1fa5d51bbf99 +Signature: 130ac28d47a78f20416d05845589d141 UNUSED LICENSES: From 75f6bdfd41b4c19a5b27ee18d96281f01b2ae221 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Thu, 6 Sep 2018 19:09:30 -0700 Subject: [PATCH 064/134] Revert "Dart SDK roll for 2018/09/06 (#6189)" (#6192) This reverts commit f02fc8c1068619dd2911a3e8bf95f8d43b8d276c. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 91 ++++++++++++------------- frontend_server/lib/server.dart | 5 -- 3 files changed, 46 insertions(+), 52 deletions(-) diff --git a/DEPS b/DEPS index e704ef9e65595..49174b6860dad 100644 --- a/DEPS +++ b/DEPS @@ -31,7 +31,7 @@ vars = { # Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS. # You can use //tools/dart/create_updated_flutter_deps.py to produce # updated revision list of existing dependencies. - 'dart_revision': 'c7ab56e1b5ab9bcf6f20057ac9135dede7d40395', + 'dart_revision': '760a9690c22ec3f3d163173737f9949f97e6e02a', 'dart_args_tag': '1.4.4', 'dart_async_tag': '2.0.8', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 4aba7f34ba2fb..effcb3701a544 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: cd0d6dca1aa2aca73d1f1dab47cf9355 +Signature: da77c336d1e2756b2cca2e2d00f2d741 UNUSED LICENSES: @@ -5461,7 +5461,6 @@ 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_reader.cc @@ -16699,50 +16698,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== -==================================================================================================== -LIBRARY: tonic -ORIGIN: ../../../garnet/LICENSE -TYPE: LicenseType.bsd -FILE: ../../../third_party/tonic/dart_list.cc -FILE: ../../../third_party/tonic/dart_list.h -FILE: ../../../third_party/tonic/file_loader/file_loader_fuchsia.cc -FILE: ../../../third_party/tonic/file_loader/file_loader_posix.cc -FILE: ../../../third_party/tonic/file_loader/file_loader_win.cc -FILE: ../../../third_party/tonic/filesystem/filesystem/path_win.cc -FILE: ../../../third_party/tonic/filesystem/filesystem/portable_unistd.h -FILE: ../../../third_party/tonic/platform/platform_utils.h -FILE: ../../../third_party/tonic/platform/platform_utils_posix.cc -FILE: ../../../third_party/tonic/platform/platform_utils_win.cc ----------------------------------------------------------------------------------------------------- -Copyright 2017 The Fuchsia Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==================================================================================================== - ==================================================================================================== LIBRARY: tonic ORIGIN: ../../../third_party/tonic/LICENSE @@ -16842,6 +16797,50 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================================================================================== +==================================================================================================== +LIBRARY: tonic +ORIGIN: ../../../third_party/tonic/file_loader/file_loader_fuchsia.cc + ../../../third_party/tonic/LICENSE +TYPE: LicenseType.bsd +FILE: ../../../third_party/tonic/dart_list.cc +FILE: ../../../third_party/tonic/dart_list.h +FILE: ../../../third_party/tonic/file_loader/file_loader_fuchsia.cc +FILE: ../../../third_party/tonic/file_loader/file_loader_posix.cc +FILE: ../../../third_party/tonic/file_loader/file_loader_win.cc +FILE: ../../../third_party/tonic/filesystem/filesystem/path_win.cc +FILE: ../../../third_party/tonic/filesystem/filesystem/portable_unistd.h +FILE: ../../../third_party/tonic/platform/platform_utils.h +FILE: ../../../third_party/tonic/platform/platform_utils_posix.cc +FILE: ../../../third_party/tonic/platform/platform_utils_win.cc +---------------------------------------------------------------------------------------------------- +Copyright 2017 The Fuchsia Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +==================================================================================================== + ==================================================================================================== LIBRARY: tonic ORIGIN: ../../../third_party/tonic/typed_data/dart_byte_data.cc + ../../../third_party/tonic/LICENSE diff --git a/frontend_server/lib/server.dart b/frontend_server/lib/server.dart index 572087e9d186e..804c5699eb2f8 100644 --- a/frontend_server/lib/server.dart +++ b/frontend_server/lib/server.dart @@ -39,11 +39,6 @@ class _FlutterFrontendCompiler implements frontend.CompilerInterface{ _compiler.acceptLastDelta(); } - @override - Future rejectLastDelta() async { - return _compiler.rejectLastDelta(); - } - @override void invalidate(Uri uri) { _compiler.invalidate(uri); From f33615c15273b971f4247e9793c6d16d3835c837 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Fri, 7 Sep 2018 08:59:51 -0400 Subject: [PATCH 065/134] Roll src/third_party/skia b090b2b26803..0b80e62a14ae (2 commits) (#6197) Auto-roller completed checks. Merging. --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 49174b6860dad..8cbc157d1f822 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'b090b2b26803179f5a271efb142c747a1bba6225', + 'skia_revision': '0b80e62a14ae492d961ed29c616a5c3b72d11ce3', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the From 5a19d7633a33f5d5727c76ae01a08c247ec3af46 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Fri, 7 Sep 2018 12:26:51 -0400 Subject: [PATCH 066/134] Roll src/third_party/skia 0b80e62a14ae..300b6197e344 (9 commits) (#6198) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 8cbc157d1f822..805d443095a8b 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '0b80e62a14ae492d961ed29c616a5c3b72d11ce3', + 'skia_revision': '300b6197e344706f543b570bfcfa8f46da1dd2e3', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a5202b8062a0d..84be8d650377d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 130ac28d47a78f20416d05845589d141 +Signature: 0d38433bf769eb57972110051ae31959 UNUSED LICENSES: From 85d47fb03c1bcfecf722c6b55bd0fa674596468e Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Fri, 7 Sep 2018 09:34:45 -0700 Subject: [PATCH 067/134] Accept file URIs as parameters in the RunInView service RPC (#6191) See https://github.com/flutter/flutter/issues/21348 --- ci/licenses_golden/licenses_flutter | 1 + fml/BUILD.gn | 1 + fml/paths.cc | 20 ++++++++++++++++++++ fml/paths.h | 6 ++++++ fml/paths_unittests.cc | 17 +++++++++++++++++ fml/platform/posix/paths_posix.cc | 13 ++++++++++++- fml/platform/win/paths_win.cc | 13 +++++++++++++ shell/common/shell.cc | 20 ++++++++++++-------- 8 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 fml/paths_unittests.cc diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 62c4bcd7b2671..f697e110945bb 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -481,6 +481,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 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/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/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/shell/common/shell.cc b/shell/common/shell.cc index 5afe07691eca0..59272e11c0539 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -865,24 +865,28 @@ 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()); + : IsolateConfiguration::CreateForSource(main_script_path, + packages_path); 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(); From 687cf08c70d561281e0c69b33ad0cba280c60e89 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Fri, 7 Sep 2018 10:22:07 -0700 Subject: [PATCH 068/134] Add option to invert paint colors to be used for smart invert accessibility on iOS (#6176) --- lib/ui/painting.dart | 20 +++++++++++++++++++- lib/ui/painting/paint.cc | 25 ++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index e2fe0521a6ac7..af08b848cf910 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -1065,6 +1065,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 +1082,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 +1365,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 +1425,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(); } 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]); From 2af72eb2cc057ddc70a3589f08ae234ddcb9b459 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Fri, 7 Sep 2018 11:20:44 -0700 Subject: [PATCH 069/134] Don't map iOS reduce motion to disabled animations (#6194) --- lib/ui/window.dart | 9 +++++++++ lib/ui/window/window.h | 1 + .../darwin/ios/framework/Source/FlutterViewController.mm | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) 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/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 2fb9f90c6f281..26c8ffc328466 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -836,7 +836,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 From 16c56afb09ee1271076e3285be43e83318c328cd Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Fri, 7 Sep 2018 15:52:51 -0400 Subject: [PATCH 070/134] Roll src/third_party/skia 300b6197e344..094b3eaf479c (17 commits) (#6200) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 805d443095a8b..2ebacb97b1cbf 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '300b6197e344706f543b570bfcfa8f46da1dd2e3', + 'skia_revision': '094b3eaf479ca121ecc6d7d94d459a3e8303b4b7', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 84be8d650377d..4839de00c2e7d 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 0d38433bf769eb57972110051ae31959 +Signature: 36b93a6dd343aee5c769bcbf986f3aa5 UNUSED LICENSES: From 93dac2a88d1695fc9508acabb2e3d4cf5f0429a5 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Fri, 7 Sep 2018 14:02:39 -0700 Subject: [PATCH 071/134] Always save canvas and correctly pass antialias boolean in ClipRects. (#6199) --- flow/layers/clip_rect_layer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flow/layers/clip_rect_layer.cc b/flow/layers/clip_rect_layer.cc index 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); } From e27a2e955bc3aa15e5dd144d51fed92e346cbae2 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 7 Sep 2018 14:45:13 -0700 Subject: [PATCH 072/134] Dart SDK roll for 2018/09/07 (#6201) --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 7 ++++++- frontend_server/lib/server.dart | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 2ebacb97b1cbf..dc2ecc7370a56 100644 --- a/DEPS +++ b/DEPS @@ -31,7 +31,7 @@ vars = { # Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS. # You can use //tools/dart/create_updated_flutter_deps.py to produce # updated revision list of existing dependencies. - 'dart_revision': '760a9690c22ec3f3d163173737f9949f97e6e02a', + 'dart_revision': 'cd9a42239f76e110dd73aeaac4c69a057a76ddf1', 'dart_args_tag': '1.4.4', 'dart_async_tag': '2.0.8', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index effcb3701a544..ba70e444fdc73 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: da77c336d1e2756b2cca2e2d00f2d741 +Signature: fbcaf0eca04aa4bfacf6dcc71a919be3 UNUSED LICENSES: @@ -5455,12 +5455,14 @@ FILE: ../../../third_party/dart/runtime/include/dart_embedder_api.h 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_reader.cc @@ -5478,8 +5480,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/frontend_server/lib/server.dart b/frontend_server/lib/server.dart index 804c5699eb2f8..572087e9d186e 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); From 4c2448d1591a5fab033de3885ad34d1fdf5474f1 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Fri, 7 Sep 2018 15:44:46 -0700 Subject: [PATCH 073/134] Some cleanups enabled by removing support for Dart. (#5621) - Switch core snapshot to Dart 2 and remove support for loading platform.dill. - Remove support for loading script snapshots. - Remove support for loading source. - Remove settings and fix names to reflect the above. - Remove support for loading the service isolate from source. --- common/settings.cc | 1 - common/settings.h | 3 - lib/snapshot/BUILD.gn | 326 ++++++++---------- runtime/dart_isolate.cc | 140 +------- runtime/dart_isolate.h | 16 +- runtime/dart_isolate_unittests.cc | 66 ---- runtime/dart_service_isolate.cc | 168 +-------- runtime/dart_service_isolate.h | 14 - runtime/dart_vm.cc | 16 +- runtime/dart_vm.h | 3 - runtime/dart_vm_unittests.cc | 1 - shell/common/engine.cc | 5 - shell/common/engine.h | 3 - shell/common/isolate_configuration.cc | 71 +--- shell/common/isolate_configuration.h | 8 +- shell/common/shell.cc | 8 +- shell/common/switches.cc | 3 - shell/common/switches.h | 1 - shell/platform/android/flutter_main.cc | 5 - .../android/io/flutter/view/FlutterMain.java | 14 +- .../android/platform_view_android_jni.cc | 7 +- .../framework/Source/FlutterDartProject.mm | 31 +- shell/platform/embedder/embedder.cc | 7 +- shell/testing/tester_main.cc | 9 +- 24 files changed, 195 insertions(+), 731 deletions(-) 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/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn index d257830ebd6ba..99e3c2f9638aa 100644 --- a/lib/snapshot/BUILD.gn +++ b/lib/snapshot/BUILD.gn @@ -25,197 +25,143 @@ 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" - } - } else { - snapshot_dart = "snapshot.dart" - snapshot_kind = "core" - } +# Fuchsia's snapshot requires a different platform with extra dart: libraries. +if (!is_fuchsia) { + compiled_action("generate_snapshot_bin") { + tool = "//third_party/dart/runtime/bin:gen_snapshot" - deps = [ - ":generate_dart_ui", - "//third_party/dart/runtime/bin:gen_snapshot($host_toolchain)", - ] - 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" ] - } + platform_kernel = "$root_out_dir/flutter_patched_sdk/platform_strong.dill" + inputs = [ + platform_kernel, + ] + deps = [ + ":kernel_platform_files", + ] - vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin" - vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin" - isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin" - isolate_snapshot_instructions = - "$target_gen_dir/isolate_snapshot_instructions.bin" - outputs = [ - vm_snapshot_data, - vm_snapshot_instructions, - isolate_snapshot_data, - isolate_snapshot_instructions, - ] + vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin" + vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin" + isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin" + isolate_snapshot_instructions = + "$target_gen_dir/isolate_snapshot_instructions.bin" + outputs = [ + vm_snapshot_data, + vm_snapshot_instructions, + isolate_snapshot_data, + isolate_snapshot_instructions, + ] - rebased_dart_ui_path = rebase_path(dart_ui_path) + args = [ + "--snapshot_kind=core", + "--await_is_keyword", + "--enable_mirrors=false", + "--vm_snapshot_data=" + rebase_path(vm_snapshot_data), + "--vm_snapshot_instructions=" + rebase_path(vm_snapshot_instructions), + "--isolate_snapshot_data=" + rebase_path(isolate_snapshot_data), + "--isolate_snapshot_instructions=" + + rebase_path(isolate_snapshot_instructions), + rebase_path(platform_kernel), + ] - 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" + if (is_debug) { + args += [ + "--enable_asserts", + "--enable_type_checks", + "--error_on_bad_type", + "--error_on_bad_override", + ] + } + } - args = [ - "--executable", - rebase_path("$gen_snapshot_dir/gen_snapshot"), - "--script", - rebase_path(snapshot_dart), - "--snapshot_kind", - snapshot_kind, - "--vm_flag", - "--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), - ] + # Generates an assembly file defining a given symbol with the bytes from a + # binary file. Places the symbol in a text section if 'executable' is true, + # otherwise places the symbol in a read-only data section. + template("bin_to_assembly") { + assert(defined(invoker.deps), "Must define deps") + assert(defined(invoker.input), "Must define input binary file") + assert(defined(invoker.output), "Must define output assembly file") + assert(defined(invoker.symbol), "Must define symbol name") + assert(defined(invoker.executable), "Must define boolean executable") + + action(target_name) { + deps = invoker.deps + script = "//third_party/dart/runtime/tools/bin_to_assembly.py" + args = [ + "--input", + rebase_path(invoker.input), + "--output", + rebase_path(invoker.output), + "--symbol_name", + invoker.symbol, + "--target_os", + current_os, + ] + if (invoker.executable) { + args += [ "--executable" ] + } + inputs = [ + script, + invoker.input, + ] + outputs = [ + invoker.output, + ] + } + } - 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", + bin_to_assembly("vm_snapshot_data_assembly") { + deps = [ + ":generate_snapshot_bin", ] + input = "$target_gen_dir/vm_isolate_snapshot.bin" + output = "$target_gen_dir/vm_snapshot_data.S" + symbol = "kDartVmSnapshotData" + executable = false } - 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"), + bin_to_assembly("vm_snapshot_instructions_assembly") { + deps = [ + ":generate_snapshot_bin", ] + input = "$target_gen_dir/vm_snapshot_instructions.bin" + output = "$target_gen_dir/vm_snapshot_instructions.S" + symbol = "kDartVmSnapshotInstructions" + executable = true } -} -# Generates an assembly file defining a given symbol with the bytes from a -# binary file. Places the symbol in a text section if 'executable' is true, -# otherwise places the symbol in a read-only data section. -template("bin_to_assembly") { - assert(defined(invoker.deps), "Must define deps") - assert(defined(invoker.input), "Must define input binary file") - assert(defined(invoker.output), "Must define output assembly file") - assert(defined(invoker.symbol), "Must define symbol name") - assert(defined(invoker.executable), "Must define boolean executable") - - action(target_name) { - deps = invoker.deps - script = "//third_party/dart/runtime/tools/bin_to_assembly.py" - args = [ - "--input", - rebase_path(invoker.input), - "--output", - rebase_path(invoker.output), - "--symbol_name", - invoker.symbol, - "--target_os", - current_os, - ] - if (invoker.executable) { - args += [ "--executable" ] - } - inputs = [ - script, - invoker.input, - ] - outputs = [ - invoker.output, + bin_to_assembly("isolate_snapshot_data_assembly") { + deps = [ + ":generate_snapshot_bin", ] + input = "$target_gen_dir/isolate_snapshot.bin" + output = "$target_gen_dir/isolate_snapshot_data.S" + symbol = "kDartIsolateSnapshotData" + executable = false } -} - -bin_to_assembly("vm_snapshot_data_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/vm_isolate_snapshot.bin" - output = "$target_gen_dir/vm_snapshot_data.S" - symbol = "kDartVmSnapshotData" - executable = false -} - -bin_to_assembly("vm_snapshot_instructions_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/vm_snapshot_instructions.bin" - output = "$target_gen_dir/vm_snapshot_instructions.S" - symbol = "kDartVmSnapshotInstructions" - executable = true -} - -bin_to_assembly("isolate_snapshot_data_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/isolate_snapshot.bin" - output = "$target_gen_dir/isolate_snapshot_data.S" - symbol = "kDartIsolateSnapshotData" - executable = false -} -bin_to_assembly("isolate_snapshot_instructions_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/isolate_snapshot_instructions.bin" - output = "$target_gen_dir/isolate_snapshot_instructions.S" - symbol = "kDartIsolateSnapshotInstructions" - executable = true -} + bin_to_assembly("isolate_snapshot_instructions_assembly") { + deps = [ + ":generate_snapshot_bin", + ] + input = "$target_gen_dir/isolate_snapshot_instructions.bin" + output = "$target_gen_dir/isolate_snapshot_instructions.S" + symbol = "kDartIsolateSnapshotInstructions" + executable = true + } -source_set("snapshot") { - deps = [ - ":isolate_snapshot_data_assembly", - ":isolate_snapshot_instructions_assembly", - ":vm_snapshot_data_assembly", - ":vm_snapshot_instructions_assembly", - ] - sources = [ - "$target_gen_dir/isolate_snapshot_data.S", - "$target_gen_dir/isolate_snapshot_instructions.S", - "$target_gen_dir/vm_snapshot_data.S", - "$target_gen_dir/vm_snapshot_instructions.S", - ] + source_set("snapshot") { + deps = [ + ":isolate_snapshot_data_assembly", + ":isolate_snapshot_instructions_assembly", + ":vm_snapshot_data_assembly", + ":vm_snapshot_instructions_assembly", + ] + sources = [ + "$target_gen_dir/isolate_snapshot_data.S", + "$target_gen_dir/isolate_snapshot_instructions.S", + "$target_gen_dir/vm_snapshot_data.S", + "$target_gen_dir/vm_snapshot_instructions.S", + ] + } } compile_platform("non_strong_platform") { @@ -282,22 +228,28 @@ 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), - ] + "--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/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..4fa0d3a3ea1ba 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -310,8 +310,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,17 +366,11 @@ DartVM::DartVM(const Settings& settings, arraysize(kDartWriteProtectCodeArgs)); #endif - const bool isolate_snapshot_is_dart_2 = - Dart_IsDart2Snapshot(isolate_snapshot_->GetData()->GetSnapshotPointer()); - const bool is_preview_dart2 = - (platform_kernel_mapping_->GetSize() > 0) || isolate_snapshot_is_dart_2; + Dart_IsDart2Snapshot(isolate_snapshot_->GetData()->GetSnapshotPointer()); 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; + << " enabled."; if (is_preview_dart2) { PushBackAll(&args, kDartStrongModeArgs, arraysize(kDartStrongModeArgs)); @@ -485,10 +477,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_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/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/shell.cc b/shell/common/shell.cc index 59272e11c0539..7d434cb055be4 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -875,12 +875,8 @@ bool Shell::OnServiceProtocolRunInView( auto main_script_file_mapping = 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_path, - packages_path); + auto isolate_configuration = IsolateConfiguration::CreateForKernel( + std::move(main_script_file_mapping)); RunConfiguration configuration(std::move(isolate_configuration)); 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/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/view/FlutterMain.java b/shell/platform/android/io/flutter/view/FlutterMain.java index 49d3b01707633..198bcade69ae8 100644 --- a/shell/platform/android/io/flutter/view/FlutterMain.java +++ b/shell/platform/android/io/flutter/view/FlutterMain.java @@ -31,7 +31,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 @@ -47,8 +46,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; @@ -59,9 +56,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. @@ -79,7 +74,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; @@ -248,7 +242,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) { @@ -268,13 +261,11 @@ private static void initResources(Context applicationContext) { 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); @@ -283,8 +274,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/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index 6dd4b9ab3350a..d93f9357144a6 100644 --- a/shell/platform/android/platform_view_android_jni.cc +++ b/shell/platform/android/platform_view_android_jni.cc @@ -217,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; }; @@ -228,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(); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index 64eb73650dcc1..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,12 +175,6 @@ - (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; - } } } diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index bd685a86b6876..c4df169639aec 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -268,16 +268,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; 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 = ""; From 335811560b98fc5089af0bf237749cc188431af1 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Fri, 7 Sep 2018 19:11:51 -0400 Subject: [PATCH 074/134] Roll src/third_party/skia 094b3eaf479c..2810c856dfa2 (6 commits) (#6203) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index dc2ecc7370a56..6d2f1ea506ae0 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '094b3eaf479ca121ecc6d7d94d459a3e8303b4b7', + 'skia_revision': '2810c856dfa2005037e921bf121a825d9b70bc92', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 4839de00c2e7d..afae772c469fb 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 36b93a6dd343aee5c769bcbf986f3aa5 +Signature: e6f9307aa1c287014bd4c665ff283591 UNUSED LICENSES: @@ -1310,6 +1310,7 @@ 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 @@ -2056,6 +2057,7 @@ FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full.expected/flutter_trybot.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full.expected/parent_revision_trybot.json FILE: ../../../third_party/skia/infra/bots/recipe_modules/checkout/examples/full.expected/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 From bf96dbed38ed6fa9b17595de7b0dbdcfc061f962 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Fri, 7 Sep 2018 17:39:51 -0700 Subject: [PATCH 075/134] Revert "Some cleanups enabled by removing support for Dart. (#5621)" (#6205) This reverts commit 4c2448d1591a5fab033de3885ad34d1fdf5474f1. --- common/settings.cc | 1 + common/settings.h | 3 + lib/snapshot/BUILD.gn | 326 ++++++++++-------- runtime/dart_isolate.cc | 140 +++++++- runtime/dart_isolate.h | 16 +- runtime/dart_isolate_unittests.cc | 66 ++++ runtime/dart_service_isolate.cc | 168 ++++++++- runtime/dart_service_isolate.h | 14 + runtime/dart_vm.cc | 16 +- runtime/dart_vm.h | 3 + runtime/dart_vm_unittests.cc | 1 + shell/common/engine.cc | 5 + shell/common/engine.h | 3 + shell/common/isolate_configuration.cc | 71 +++- shell/common/isolate_configuration.h | 8 +- shell/common/shell.cc | 8 +- shell/common/switches.cc | 3 + shell/common/switches.h | 1 + shell/platform/android/flutter_main.cc | 5 + .../android/io/flutter/view/FlutterMain.java | 14 +- .../android/platform_view_android_jni.cc | 7 +- .../framework/Source/FlutterDartProject.mm | 31 +- shell/platform/embedder/embedder.cc | 7 +- shell/testing/tester_main.cc | 9 +- 24 files changed, 731 insertions(+), 195 deletions(-) diff --git a/common/settings.cc b/common/settings.cc index 9aa8997ba947b..8123b1d321ef6 100644 --- a/common/settings.cc +++ b/common/settings.cc @@ -11,6 +11,7 @@ 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 1c0002e7ad7d6..124529b90c57d 100644 --- a/common/settings.h +++ b/common/settings.h @@ -23,6 +23,9 @@ 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/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn index 99e3c2f9638aa..d257830ebd6ba 100644 --- a/lib/snapshot/BUILD.gn +++ b/lib/snapshot/BUILD.gn @@ -25,145 +25,199 @@ copy("generate_dart_ui") { ] } -# Fuchsia's snapshot requires a different platform with extra dart: libraries. -if (!is_fuchsia) { - compiled_action("generate_snapshot_bin") { - tool = "//third_party/dart/runtime/bin:gen_snapshot" - - platform_kernel = "$root_out_dir/flutter_patched_sdk/platform_strong.dill" - inputs = [ - platform_kernel, - ] - deps = [ - ":kernel_platform_files", - ] - - vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin" - vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin" - isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin" - isolate_snapshot_instructions = - "$target_gen_dir/isolate_snapshot_instructions.bin" - outputs = [ - vm_snapshot_data, - vm_snapshot_instructions, - isolate_snapshot_data, - isolate_snapshot_instructions, - ] - - args = [ - "--snapshot_kind=core", - "--await_is_keyword", - "--enable_mirrors=false", - "--vm_snapshot_data=" + rebase_path(vm_snapshot_data), - "--vm_snapshot_instructions=" + rebase_path(vm_snapshot_instructions), - "--isolate_snapshot_data=" + rebase_path(isolate_snapshot_data), - "--isolate_snapshot_instructions=" + - rebase_path(isolate_snapshot_instructions), - rebase_path(platform_kernel), - ] - - if (is_debug) { - args += [ - "--enable_asserts", - "--enable_type_checks", - "--error_on_bad_type", - "--error_on_bad_override", - ] +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" } + } else { + snapshot_dart = "snapshot.dart" + snapshot_kind = "core" } - # Generates an assembly file defining a given symbol with the bytes from a - # binary file. Places the symbol in a text section if 'executable' is true, - # otherwise places the symbol in a read-only data section. - template("bin_to_assembly") { - assert(defined(invoker.deps), "Must define deps") - assert(defined(invoker.input), "Must define input binary file") - assert(defined(invoker.output), "Must define output assembly file") - assert(defined(invoker.symbol), "Must define symbol name") - assert(defined(invoker.executable), "Must define boolean executable") - - action(target_name) { - deps = invoker.deps - script = "//third_party/dart/runtime/tools/bin_to_assembly.py" - args = [ - "--input", - rebase_path(invoker.input), - "--output", - rebase_path(invoker.output), - "--symbol_name", - invoker.symbol, - "--target_os", - current_os, - ] - if (invoker.executable) { - args += [ "--executable" ] - } - inputs = [ - script, - invoker.input, - ] - outputs = [ - invoker.output, - ] - } + deps = [ + ":generate_dart_ui", + "//third_party/dart/runtime/bin:gen_snapshot($host_toolchain)", + ] + 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" ] } - bin_to_assembly("vm_snapshot_data_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/vm_isolate_snapshot.bin" - output = "$target_gen_dir/vm_snapshot_data.S" - symbol = "kDartVmSnapshotData" - executable = false - } + vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin" + vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin" + isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin" + isolate_snapshot_instructions = + "$target_gen_dir/isolate_snapshot_instructions.bin" + outputs = [ + vm_snapshot_data, + vm_snapshot_instructions, + isolate_snapshot_data, + isolate_snapshot_instructions, + ] - bin_to_assembly("vm_snapshot_instructions_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/vm_snapshot_instructions.bin" - output = "$target_gen_dir/vm_snapshot_instructions.S" - symbol = "kDartVmSnapshotInstructions" - executable = true - } + 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", + "--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), + ] - bin_to_assembly("isolate_snapshot_data_assembly") { - deps = [ - ":generate_snapshot_bin", + 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", ] - input = "$target_gen_dir/isolate_snapshot.bin" - output = "$target_gen_dir/isolate_snapshot_data.S" - symbol = "kDartIsolateSnapshotData" - executable = false } - bin_to_assembly("isolate_snapshot_instructions_assembly") { - deps = [ - ":generate_snapshot_bin", + 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"), ] - input = "$target_gen_dir/isolate_snapshot_instructions.bin" - output = "$target_gen_dir/isolate_snapshot_instructions.S" - symbol = "kDartIsolateSnapshotInstructions" - executable = true } +} - source_set("snapshot") { - deps = [ - ":isolate_snapshot_data_assembly", - ":isolate_snapshot_instructions_assembly", - ":vm_snapshot_data_assembly", - ":vm_snapshot_instructions_assembly", +# Generates an assembly file defining a given symbol with the bytes from a +# binary file. Places the symbol in a text section if 'executable' is true, +# otherwise places the symbol in a read-only data section. +template("bin_to_assembly") { + assert(defined(invoker.deps), "Must define deps") + assert(defined(invoker.input), "Must define input binary file") + assert(defined(invoker.output), "Must define output assembly file") + assert(defined(invoker.symbol), "Must define symbol name") + assert(defined(invoker.executable), "Must define boolean executable") + + action(target_name) { + deps = invoker.deps + script = "//third_party/dart/runtime/tools/bin_to_assembly.py" + args = [ + "--input", + rebase_path(invoker.input), + "--output", + rebase_path(invoker.output), + "--symbol_name", + invoker.symbol, + "--target_os", + current_os, ] - sources = [ - "$target_gen_dir/isolate_snapshot_data.S", - "$target_gen_dir/isolate_snapshot_instructions.S", - "$target_gen_dir/vm_snapshot_data.S", - "$target_gen_dir/vm_snapshot_instructions.S", + if (invoker.executable) { + args += [ "--executable" ] + } + inputs = [ + script, + invoker.input, + ] + outputs = [ + invoker.output, ] } } +bin_to_assembly("vm_snapshot_data_assembly") { + deps = [ + ":generate_snapshot_bin", + ] + input = "$target_gen_dir/vm_isolate_snapshot.bin" + output = "$target_gen_dir/vm_snapshot_data.S" + symbol = "kDartVmSnapshotData" + executable = false +} + +bin_to_assembly("vm_snapshot_instructions_assembly") { + deps = [ + ":generate_snapshot_bin", + ] + input = "$target_gen_dir/vm_snapshot_instructions.bin" + output = "$target_gen_dir/vm_snapshot_instructions.S" + symbol = "kDartVmSnapshotInstructions" + executable = true +} + +bin_to_assembly("isolate_snapshot_data_assembly") { + deps = [ + ":generate_snapshot_bin", + ] + input = "$target_gen_dir/isolate_snapshot.bin" + output = "$target_gen_dir/isolate_snapshot_data.S" + symbol = "kDartIsolateSnapshotData" + executable = false +} + +bin_to_assembly("isolate_snapshot_instructions_assembly") { + deps = [ + ":generate_snapshot_bin", + ] + input = "$target_gen_dir/isolate_snapshot_instructions.bin" + output = "$target_gen_dir/isolate_snapshot_instructions.S" + symbol = "kDartIsolateSnapshotInstructions" + executable = true +} + +source_set("snapshot") { + deps = [ + ":isolate_snapshot_data_assembly", + ":isolate_snapshot_instructions_assembly", + ":vm_snapshot_data_assembly", + ":vm_snapshot_instructions_assembly", + ] + sources = [ + "$target_gen_dir/isolate_snapshot_data.S", + "$target_gen_dir/isolate_snapshot_instructions.S", + "$target_gen_dir/vm_snapshot_data.S", + "$target_gen_dir/vm_snapshot_instructions.S", + ] +} + compile_platform("non_strong_platform") { libraries_specification_uri = "libraries.json" @@ -228,28 +282,22 @@ 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) ] + "--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/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 34962593ea1f5..e48c542c11d61 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -282,12 +282,20 @@ bool DartIsolate::PrepareForRunningFromPrecompiledCode() { return true; } -bool DartIsolate::LoadKernel(std::shared_ptr mapping, - bool last_piece) { - if (!Dart_IsKernel(mapping->GetMapping(), mapping->GetSize())) { +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()))) { 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); @@ -309,11 +317,21 @@ bool DartIsolate::LoadKernel(std::shared_ptr mapping, 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::PrepareForRunningFromKernel( +bool DartIsolate::PrepareForRunningFromSnapshot( std::shared_ptr mapping, bool last_piece) { - TRACE_EVENT0("flutter", "DartIsolate::PrepareForRunningFromKernel"); + TRACE_EVENT0("flutter", "DartIsolate::PrepareForRunningFromSnapshot"); if (phase_ != Phase::LibrariesSetup) { return false; } @@ -331,7 +349,7 @@ bool DartIsolate::PrepareForRunningFromKernel( // Use root library provided by kernel in favor of one provided by snapshot. Dart_SetRootLibrary(Dart_Null()); - if (!LoadKernel(mapping, last_piece)) { + if (!LoadSnapshot(mapping, last_piece)) { return false; } @@ -349,7 +367,61 @@ bool DartIsolate::PrepareForRunningFromKernel( } child_isolate_preparer_ = [mapping](DartIsolate* isolate) { - return isolate->PrepareForRunningFromKernel(mapping); + 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); }; phase_ = Phase::Ready; return true; @@ -536,11 +608,22 @@ 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) )) { @@ -644,20 +727,39 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( Dart_IsolateFlagsInitialize(&nonnull_flags); flags = &nonnull_flags; } - flags->use_dart_frontend = true; + bool dart2 = (vm->GetPlatformKernel().GetSize() > 0) || + Dart_IsDart2Snapshot((*embedder_isolate) + ->GetIsolateSnapshot() + ->GetData() + ->GetSnapshotPointer()); + flags->use_dart_frontend = dart2; // Create the Dart VM isolate and give it the embedder object as the baton. - 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); + 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); if (isolate == nullptr) { FML_DLOG(ERROR) << *error; diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index f2167364effdd..df9a9f66d1b46 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -68,8 +68,13 @@ class DartIsolate : public UIDartState { bool PrepareForRunningFromPrecompiledCode(); FML_WARN_UNUSED_RESULT - bool PrepareForRunningFromKernel(std::shared_ptr kernel, - bool last_piece = true); + 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); FML_WARN_UNUSED_RESULT bool Run(const std::string& entrypoint); @@ -91,7 +96,12 @@ class DartIsolate : public UIDartState { std::weak_ptr GetWeakIsolatePtr(); private: - bool LoadKernel(std::shared_ptr mapping, bool last_piece); + 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); class AutoFireClosure { public: diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc index cb7797abdcb74..02cbbaf8cf5f2 100644 --- a/runtime/dart_isolate_unittests.cc +++ b/runtime/dart_isolate_unittests.cc @@ -46,4 +46,70 @@ 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 05da4c48fc2dd..d1a699869959a 100644 --- a/runtime/dart_service_isolate.cc +++ b/runtime/dart_service_isolate.cc @@ -26,11 +26,21 @@ 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, @@ -47,6 +57,13 @@ 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 = @@ -67,6 +84,7 @@ 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(); @@ -85,13 +103,36 @@ bool DartServiceIsolate::Startup(std::string server_ip, }); } - 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); + 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); + } // Make runnable. Dart_ExitScope(); @@ -105,7 +146,7 @@ bool DartServiceIsolate::Startup(std::string server_ip, Dart_EnterIsolate(isolate); Dart_EnterScope(); - library = Dart_RootLibrary(); + Dart_Handle library = Dart_RootLibrary(); SHUTDOWN_ON_ERROR(library); // Set the HTTP server's ip. @@ -133,4 +174,115 @@ 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 3d672dc83bb4c..59a02e2e9d495 100644 --- a/runtime/dart_service_isolate.h +++ b/runtime/dart_service_isolate.h @@ -16,6 +16,7 @@ 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); @@ -23,8 +24,21 @@ 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 4fa0d3a3ea1ba..b263914538217 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -310,6 +310,8 @@ 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: " @@ -366,11 +368,17 @@ DartVM::DartVM(const Settings& settings, arraysize(kDartWriteProtectCodeArgs)); #endif - const bool is_preview_dart2 = + const bool isolate_snapshot_is_dart_2 = Dart_IsDart2Snapshot(isolate_snapshot_->GetData()->GetSnapshotPointer()); + 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."; + << " 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)); @@ -477,6 +485,10 @@ 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 b853f026c328f..ebb41edadb479 100644 --- a/runtime/dart_vm.h +++ b/runtime/dart_vm.h @@ -42,6 +42,8 @@ class DartVM : public fml::RefCountedThreadSafe { const Settings& GetSettings() const; + const fml::Mapping& GetPlatformKernel() const; + const DartSnapshot& GetVMSnapshot() const; IsolateNameServer* GetIsolateNameServer(); @@ -60,6 +62,7 @@ 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_unittests.cc b/runtime/dart_vm_unittests.cc index 94d5dadaaec1f..d0e247836410b 100644 --- a/runtime/dart_vm_unittests.cc +++ b/runtime/dart_vm_unittests.cc @@ -15,6 +15,7 @@ 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/engine.cc b/shell/common/engine.cc index b79dbfae33555..1b9d3657b6ece 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -47,6 +47,7 @@ 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) { @@ -204,6 +205,10 @@ 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 f35b9ba421113..259f73514b67d 100644 --- a/shell/common/engine.h +++ b/shell/common/engine.h @@ -79,6 +79,8 @@ class Engine final : public blink::RuntimeDelegate { tonic::DartErrorHandleType GetUIIsolateLastError(); + tonic::DartErrorHandleType GetLoadScriptError(); + std::pair GetUIIsolateReturnCode(); void OnOutputSurfaceCreated(); @@ -109,6 +111,7 @@ 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 57c38bef9f8d8..66dd53fb1b59c 100644 --- a/shell/common/isolate_configuration.cc +++ b/shell/common/isolate_configuration.cc @@ -39,23 +39,45 @@ class AppSnapshotIsolateConfiguration final : public IsolateConfiguration { FML_DISALLOW_COPY_AND_ASSIGN(AppSnapshotIsolateConfiguration); }; -class KernelIsolateConfiguration : public IsolateConfiguration { +class SnapshotIsolateConfiguration : public IsolateConfiguration { public: - KernelIsolateConfiguration(std::unique_ptr kernel) - : kernel_(std::move(kernel)) {} + SnapshotIsolateConfiguration(std::unique_ptr snapshot) + : snapshot_(std::move(snapshot)) {} // |shell::IsolateConfiguration| bool DoPrepareIsolate(blink::DartIsolate& isolate) override { if (blink::DartVM::IsRunningPrecompiledCode()) { return false; } - return isolate.PrepareForRunningFromKernel(std::move(kernel_)); + return isolate.PrepareForRunningFromSnapshot(std::move(snapshot_)); } private: - std::unique_ptr kernel_; + std::unique_ptr snapshot_; - FML_DISALLOW_COPY_AND_ASSIGN(KernelIsolateConfiguration); + 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); }; class KernelListIsolateConfiguration final : public IsolateConfiguration { @@ -72,8 +94,8 @@ class KernelListIsolateConfiguration final : public IsolateConfiguration { for (size_t i = 0; i < kernel_pieces_.size(); i++) { bool last_piece = i + 1 == kernel_pieces_.size(); - if (!isolate.PrepareForRunningFromKernel(std::move(kernel_pieces_[i]), - last_piece)) { + if (!isolate.PrepareForRunningFromSnapshot(std::move(kernel_pieces_[i]), + last_piece)) { return false; } } @@ -95,12 +117,30 @@ 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 CreateForKernel(std::move(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)); } } @@ -149,9 +189,16 @@ IsolateConfiguration::CreateForAppSnapshot() { return std::make_unique(); } -std::unique_ptr IsolateConfiguration::CreateForKernel( - std::unique_ptr kernel) { - return std::make_unique(std::move(kernel)); +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::CreateForKernelList( diff --git a/shell/common/isolate_configuration.h b/shell/common/isolate_configuration.h index 7dd54ccf3b3b7..ba8752273d6de 100644 --- a/shell/common/isolate_configuration.h +++ b/shell/common/isolate_configuration.h @@ -26,8 +26,12 @@ class IsolateConfiguration { static std::unique_ptr CreateForAppSnapshot(); - static std::unique_ptr CreateForKernel( - std::unique_ptr kernel); + 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 CreateForKernelList( std::vector> kernel_pieces); diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 7d434cb055be4..59272e11c0539 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -875,8 +875,12 @@ bool Shell::OnServiceProtocolRunInView( auto main_script_file_mapping = std::make_unique(main_script_path, false); - auto isolate_configuration = IsolateConfiguration::CreateForKernel( - std::move(main_script_file_mapping)); + auto isolate_configuration = + blink::DartVM::IsKernelMapping(main_script_file_mapping.get()) + ? IsolateConfiguration::CreateForSnapshot( + std::move(main_script_file_mapping)) + : IsolateConfiguration::CreateForSource(main_script_path, + packages_path); RunConfiguration configuration(std::move(isolate_configuration)); diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 98f0bb353015f..80ae36a7e5776 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -170,6 +170,9 @@ 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 644b02f2cbce5..6bae9047e0e3d 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -93,6 +93,7 @@ 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/platform/android/flutter_main.cc b/shell/platform/android/flutter_main.cc index 0bcf75d76feca..b8931e6e46753 100644 --- a/shell/platform/android/flutter_main.cc +++ b/shell/platform/android/flutter_main.cc @@ -66,11 +66,16 @@ 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/view/FlutterMain.java b/shell/platform/android/io/flutter/view/FlutterMain.java index 198bcade69ae8..49d3b01707633 100644 --- a/shell/platform/android/io/flutter/view/FlutterMain.java +++ b/shell/platform/android/io/flutter/view/FlutterMain.java @@ -31,6 +31,7 @@ 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 @@ -46,6 +47,8 @@ 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; @@ -56,7 +59,9 @@ 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. @@ -74,6 +79,7 @@ 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; @@ -242,6 +248,7 @@ 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) { @@ -261,11 +268,13 @@ private static void initResources(Context applicationContext) { 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_KERNEL_BLOB)) + .addResource(fromFlutterAssets(DEFAULT_PLATFORM_DILL)); if (sIsPrecompiledAsSharedLibrary) { sResourceExtractor .addResource(sAotSharedLibraryPath); @@ -274,7 +283,8 @@ private static void initResources(Context applicationContext) { .addResource(sAotVmSnapshotData) .addResource(sAotVmSnapshotInstr) .addResource(sAotIsolateSnapshotData) - .addResource(sAotIsolateSnapshotInstr); + .addResource(sAotIsolateSnapshotInstr) + .addResource(sSnapshotBlob); } sResourceExtractor.start(); } diff --git a/shell/platform/android/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index d93f9357144a6..6dd4b9ab3350a 100644 --- a/shell/platform/android/platform_view_android_jni.cc +++ b/shell/platform/android/platform_view_android_jni.cc @@ -217,10 +217,10 @@ std::unique_ptr CreateIsolateConfiguration( return IsolateConfiguration::CreateForKernelList(std::move(kernels)); } if (blob) { - return IsolateConfiguration::CreateForKernel(std::move(blob)); + return IsolateConfiguration::CreateForSnapshot(std::move(blob)); } if (delta) { - return IsolateConfiguration::CreateForKernel(std::move(delta)); + return IsolateConfiguration::CreateForSnapshot(std::move(delta)); } return nullptr; }; @@ -228,6 +228,9 @@ 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(); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index f5d5d80dfe41a..64eb73650dcc1 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -15,6 +15,8 @@ #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) { @@ -81,8 +83,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; @@ -104,6 +106,25 @@ 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. @@ -175,6 +196,12 @@ - (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; + } } } diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index c4df169639aec..bd685a86b6876 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -268,11 +268,16 @@ 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.application_kernel_asset = kApplicationKernelSnapshotFileName; + settings.platform_kernel_path = platform_kernel_path; + if (fml::IsFile(platform_kernel_path)) { + settings.application_kernel_asset = kApplicationKernelSnapshotFileName; + } } else { // Run from a main Dart file. settings.main_dart_file_path = args->main_path; diff --git a/shell/testing/tester_main.cc b/shell/testing/tester_main.cc index 4e10dab16f25c..274ef7bb64a6c 100644 --- a/shell/testing/tester_main.cc +++ b/shell/testing/tester_main.cc @@ -133,7 +133,11 @@ int RunTester(const blink::Settings& settings, bool run_forever) { fml::paths::AbsolutePath(settings.main_dart_file_path), false); auto isolate_configuration = - IsolateConfiguration::CreateForKernel(std::move(main_dart_file_mapping)); + 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); if (!isolate_configuration) { FML_LOG(ERROR) << "Could create isolate configuration."; @@ -238,6 +242,9 @@ 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 = ""; From b9523318caa1a99ffde8adaf331212eb879cabc9 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 7 Sep 2018 18:25:38 -0700 Subject: [PATCH 076/134] Allow embedders to specify a custom GL proc address resolver. (#6204) This updates the embedder API but introduces no breaking ABI/API changes. --- shell/gpu/gpu_surface_gl.cc | 16 +++++++++++++- shell/gpu/gpu_surface_gl.h | 6 ++++++ shell/platform/embedder/embedder.cc | 21 +++++++++++++------ shell/platform/embedder/embedder.h | 2 ++ .../platform/embedder/embedder_surface_gl.cc | 5 +++++ shell/platform/embedder/embedder_surface_gl.h | 6 +++++- 6 files changed, 48 insertions(+), 8 deletions(-) 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/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index bd685a86b6876..184f63e639edf 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -138,16 +138,25 @@ InferOpenGLPlatformViewCreationCallback( }; } + 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_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, diff --git a/shell/platform/embedder/embedder.h b/shell/platform/embedder/embedder.h index 224ba5ffb247b..6a4928f0d0172 100644 --- a/shell/platform/embedder/embedder.h +++ b/shell/platform/embedder/embedder.h @@ -60,6 +60,7 @@ 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). @@ -77,6 +78,7 @@ 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 { diff --git a/shell/platform/embedder/embedder_surface_gl.cc b/shell/platform/embedder/embedder_surface_gl.cc index 7313ed9d94bec..1ee37c0615564 100644 --- a/shell/platform/embedder/embedder_surface_gl.cc +++ b/shell/platform/embedder/embedder_surface_gl.cc @@ -70,6 +70,11 @@ SkMatrix EmbedderSurfaceGL::GLContextSurfaceTransformation() const { 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); diff --git a/shell/platform/embedder/embedder_surface_gl.h b/shell/platform/embedder/embedder_surface_gl.h index 6c15b5d81ca35..8fd40885ee3b6 100644 --- a/shell/platform/embedder/embedder_surface_gl.h +++ b/shell/platform/embedder/embedder_surface_gl.h @@ -21,7 +21,8 @@ class EmbedderSurfaceGL final : public EmbedderSurface, std::function gl_fbo_callback; // required std::function gl_make_resource_current_callback; // optional std::function - gl_surface_transformation_callback; // optional + gl_surface_transformation_callback; // optional + std::function gl_proc_resolver; // optional }; EmbedderSurfaceGL(GLDispatchTable gl_dispatch_table, @@ -61,6 +62,9 @@ class EmbedderSurfaceGL final : public EmbedderSurface, // |shell::GPUSurfaceGLDelegate| SkMatrix GLContextSurfaceTransformation() const override; + // |shell::GPUSurfaceGLDelegate| + GLProcResolver GetGLProcResolver() const override; + FML_DISALLOW_COPY_AND_ASSIGN(EmbedderSurfaceGL); }; From bf3c224197cfb5c27892e645af1e240308ab74a2 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Fri, 7 Sep 2018 22:37:51 -0400 Subject: [PATCH 077/134] Roll src/third_party/skia 2810c856dfa2..a3dc329d1db1 (1 commits) (#6206) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 6d2f1ea506ae0..564ad97e2acd0 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '2810c856dfa2005037e921bf121a825d9b70bc92', + 'skia_revision': 'a3dc329d1db198eb60e639dcd8382f1d9413a74f', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index afae772c469fb..6bfbf6e93e3a5 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: e6f9307aa1c287014bd4c665ff283591 +Signature: f1bbf2ae30240aaf87e792d63bce7633 UNUSED LICENSES: From 5c1a826eec4d499f33aae730f16de3b11f202e83 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Sat, 8 Sep 2018 20:53:51 -0400 Subject: [PATCH 078/134] Roll src/third_party/skia a3dc329d1db1..40c7c64572bc (1 commits) (#6208) Auto-roller completed checks. Merging. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 564ad97e2acd0..360f443cb8eba 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'a3dc329d1db198eb60e639dcd8382f1d9413a74f', + 'skia_revision': '40c7c64572bc73348e510be610cdb4f6e097f89c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6bfbf6e93e3a5..72d03362ba3ca 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f1bbf2ae30240aaf87e792d63bce7633 +Signature: 817e8b75d1b857f78f54b3a5bb5e0210 UNUSED LICENSES: From 1770f885483512340ec268c5398b32c30b2782f1 Mon Sep 17 00:00:00 2001 From: Joshua Seaton Date: Sat, 8 Sep 2018 23:09:57 -0700 Subject: [PATCH 079/134] Remove mention of Garnet/Topaz from license (#6209) Thanks, Chinmay --- tools/licenses/lib/main.dart | 121 ----------------------------------- 1 file changed, 121 deletions(-) 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); } From 269880b761a54553aa22a770d68d1af0f30d01b1 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Mon, 10 Sep 2018 11:12:46 -0400 Subject: [PATCH 080/134] Roll src/third_party/skia 40c7c64572bc..cd9d074578e0 (6 commits) (#6210) https://skia.googlesource.com/skia.git/+log/40c7c64572bc..cd9d074578e0 Created with: gclient setdep -r src/third_party/skia@cd9d074578e0 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- sky/packages/sky_engine/LICENSE | 271 +++---------------------------- 3 files changed, 23 insertions(+), 252 deletions(-) diff --git a/DEPS b/DEPS index 360f443cb8eba..dcc0636b64ab0 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '40c7c64572bc73348e510be610cdb4f6e097f89c', + 'skia_revision': 'cd9d074578e02f697de3ca988e3aa5506e2bf2b4', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 72d03362ba3ca..94c53c73544ed 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 817e8b75d1b857f78f54b3a5bb5e0210 +Signature: fc45f5c90807450ab9b3792c3f74b397 UNUSED LICENSES: 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 From d52e5cca03fbcfc9bf7cf873c4b0b875ba84c1b7 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Mon, 10 Sep 2018 14:36:17 -0400 Subject: [PATCH 081/134] Roll src/third_party/skia cd9d074578e0..a2bc1ca21bbc (8 commits) (#6211) https://skia.googlesource.com/skia.git/+log/cd9d074578e0..a2bc1ca21bbc Created with: gclient setdep -r src/third_party/skia@a2bc1ca21bbc The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index dcc0636b64ab0..cc4777e093d4e 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'cd9d074578e02f697de3ca988e3aa5506e2bf2b4', + 'skia_revision': 'a2bc1ca21bbc354ec6b1d2a3456ef0c367593e8b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 94c53c73544ed..b887bcaa40fb7 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: fc45f5c90807450ab9b3792c3f74b397 +Signature: 24e7f4dd7d374abb7118fdfe6a4c254e UNUSED LICENSES: From e65beb89da8b9e5747867241b99e0491b603633f Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Mon, 10 Sep 2018 14:30:55 -0700 Subject: [PATCH 082/134] Roll Dart to ef720983530e04819b6fda0659ed7a3fdb190060. (#6212) --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- lib/snapshot/BUILD.gn | 9 +++++++++ runtime/dart_vm.cc | 25 ++++++++++++++++++------- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/DEPS b/DEPS index cc4777e093d4e..713653ecc735d 100644 --- a/DEPS +++ b/DEPS @@ -31,7 +31,7 @@ vars = { # Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS. # You can use //tools/dart/create_updated_flutter_deps.py to produce # updated revision list of existing dependencies. - 'dart_revision': 'cd9a42239f76e110dd73aeaac4c69a057a76ddf1', + 'dart_revision': 'ef720983530e04819b6fda0659ed7a3fdb190060', 'dart_args_tag': '1.4.4', 'dart_async_tag': '2.0.8', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index ba70e444fdc73..f5e87bbd1aeb3 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: fbcaf0eca04aa4bfacf6dcc71a919be3 +Signature: 7e3e1daeb388f5b96234b99e29bf6711 UNUSED LICENSES: diff --git a/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn index d257830ebd6ba..45fe883b324a9 100644 --- a/lib/snapshot/BUILD.gn +++ b/lib/snapshot/BUILD.gn @@ -86,6 +86,12 @@ action("generate_snapshot_bin") { "--await_is_keyword", "--vm_flag", "--enable_mirrors=false", + "--vm_flag", + "--no-strong", + "--vm_flag", + "--no-sync-async", + "--vm_flag", + "--no-reify-generic-functions", "--vm_output_bin", rebase_path(vm_snapshot_data, root_build_dir), "--vm_instructions_output_bin", @@ -289,6 +295,9 @@ template("generate_entry_points_json_with_gen_snapshot") { output, ] args = [ + "--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"), diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index b263914538217..b0c9d355a2159 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -92,7 +92,15 @@ static const char* kDartCheckedModeArgs[] = { // clang-format on }; -static const char* kDartStrongModeArgs[] = { +static const char* kDartModeArgs[] = { + // clang-format off + "--no-strong", + "--no-reify_generic_functions", + "--no-sync_async", + // clang-format on +}; + +static const char* kDart2ModeArgs[] = { // clang-format off "--strong", "--reify_generic_functions", @@ -381,16 +389,19 @@ DartVM::DartVM(const Settings& settings, << isolate_snapshot_is_dart_2; if (is_preview_dart2) { - PushBackAll(&args, kDartStrongModeArgs, arraysize(kDartStrongModeArgs)); + PushBackAll(&args, kDart2ModeArgs, arraysize(kDart2ModeArgs)); if (use_checked_mode) { PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); } - } else if (use_checked_mode) { - FML_DLOG(INFO) << "Checked mode is ON"; - PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); - PushBackAll(&args, kDartCheckedModeArgs, arraysize(kDartCheckedModeArgs)); } else { - FML_DLOG(INFO) << "Is not Dart 2 and Checked mode is OFF"; + PushBackAll(&args, kDartModeArgs, arraysize(kDartModeArgs)); + if (use_checked_mode) { + FML_DLOG(INFO) << "Checked mode is ON"; + 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) { From f19ee56e6920be7191b5f661b89060b3a0415f02 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 10 Sep 2018 23:36:14 +0200 Subject: [PATCH 083/134] Roll freetype2 to 6581fd3e9c8645f01c0d51e4f53893f5391f2bf3 (#6214) --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 713653ecc735d..da75b00e91952 100644 --- a/DEPS +++ b/DEPS @@ -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'), From 1fb01f335065c3052a32336319a78cdbfbb2e95a Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Mon, 10 Sep 2018 17:54:17 -0400 Subject: [PATCH 084/134] Roll src/third_party/skia a2bc1ca21bbc..7891994e89a3 (9 commits) (#6217) https://skia.googlesource.com/skia.git/+log/a2bc1ca21bbc..7891994e89a3 Created with: gclient setdep -r src/third_party/skia@7891994e89a3 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 129 +++++++++++++++++++++++-------- 2 files changed, 99 insertions(+), 32 deletions(-) diff --git a/DEPS b/DEPS index da75b00e91952..1138595e50ddf 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'a2bc1ca21bbc354ec6b1d2a3456ef0c367593e8b', + 'skia_revision': '7891994e89a35273524c8aa672ec68a0aa0a6901', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index b887bcaa40fb7..8b044275f5b28 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 24e7f4dd7d374abb7118fdfe6a4c254e +Signature: 644a4365dc26a656c59ddce150c27d3a UNUSED LICENSES: @@ -904,6 +904,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 @@ -2365,6 +2374,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 @@ -2373,6 +2384,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 @@ -2449,8 +2526,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 @@ -2461,22 +2536,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 @@ -2499,18 +2568,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 From e3133e0e3f7cbbd57fa930c11f3640561d691eba Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Mon, 10 Sep 2018 17:03:54 -0700 Subject: [PATCH 085/134] Reapply "Some cleanups enabled by removing support for Dart 1." (#6216) - Add missing Dart 2 flags to gen_snapshot invocation. - Disable brittle service test. --- common/settings.cc | 1 - common/settings.h | 3 - lib/snapshot/BUILD.gn | 341 ++++++++---------- runtime/dart_isolate.cc | 140 +------ runtime/dart_isolate.h | 16 +- runtime/dart_isolate_unittests.cc | 66 ---- runtime/dart_service_isolate.cc | 168 +-------- runtime/dart_service_isolate.h | 14 - runtime/dart_vm.cc | 61 +--- runtime/dart_vm.h | 3 - runtime/dart_vm_unittests.cc | 1 - shell/common/engine.cc | 5 - shell/common/engine.h | 3 - shell/common/isolate_configuration.cc | 71 +--- shell/common/isolate_configuration.h | 8 +- shell/common/shell.cc | 8 +- shell/common/switches.cc | 3 - shell/common/switches.h | 1 - shell/platform/android/flutter_main.cc | 5 - .../android/io/flutter/view/FlutterMain.java | 14 +- .../android/platform_view_android_jni.cc | 7 +- .../framework/Source/FlutterDartProject.mm | 31 +- shell/platform/embedder/embedder.cc | 7 +- shell/testing/observatory/test.dart | 3 +- shell/testing/tester_main.cc | 9 +- 25 files changed, 208 insertions(+), 781 deletions(-) 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/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn index 45fe883b324a9..2370f50656916 100644 --- a/lib/snapshot/BUILD.gn +++ b/lib/snapshot/BUILD.gn @@ -25,203 +25,146 @@ 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" - } - } else { - snapshot_dart = "snapshot.dart" - snapshot_kind = "core" - } +# Fuchsia's snapshot requires a different platform with extra dart: libraries. +if (!is_fuchsia) { + compiled_action("generate_snapshot_bin") { + tool = "//third_party/dart/runtime/bin:gen_snapshot" - deps = [ - ":generate_dart_ui", - "//third_party/dart/runtime/bin:gen_snapshot($host_toolchain)", - ] - 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" ] - } + platform_kernel = "$root_out_dir/flutter_patched_sdk/platform_strong.dill" + inputs = [ + platform_kernel, + ] + deps = [ + ":kernel_platform_files", + ] - vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin" - vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin" - isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin" - isolate_snapshot_instructions = - "$target_gen_dir/isolate_snapshot_instructions.bin" - outputs = [ - vm_snapshot_data, - vm_snapshot_instructions, - isolate_snapshot_data, - isolate_snapshot_instructions, - ] + vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin" + vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin" + isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin" + isolate_snapshot_instructions = + "$target_gen_dir/isolate_snapshot_instructions.bin" + outputs = [ + vm_snapshot_data, + vm_snapshot_instructions, + isolate_snapshot_data, + isolate_snapshot_instructions, + ] - rebased_dart_ui_path = rebase_path(dart_ui_path) + args = [ + "--strong", + "--sync-async", + "--reify-generic-functions", + "--snapshot_kind=core", + "--await_is_keyword", + "--enable_mirrors=false", + "--vm_snapshot_data=" + rebase_path(vm_snapshot_data), + "--vm_snapshot_instructions=" + rebase_path(vm_snapshot_instructions), + "--isolate_snapshot_data=" + rebase_path(isolate_snapshot_data), + "--isolate_snapshot_instructions=" + + rebase_path(isolate_snapshot_instructions), + rebase_path(platform_kernel), + ] - 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" + if (is_debug) { + args += [ + "--enable_asserts", + "--enable_type_checks", + "--error_on_bad_type", + "--error_on_bad_override", + ] + } + } - args = [ - "--executable", - rebase_path("$gen_snapshot_dir/gen_snapshot"), - "--script", - rebase_path(snapshot_dart), - "--snapshot_kind", - snapshot_kind, - "--vm_flag", - "--await_is_keyword", - "--vm_flag", - "--enable_mirrors=false", - "--vm_flag", - "--no-strong", - "--vm_flag", - "--no-sync-async", - "--vm_flag", - "--no-reify-generic-functions", - "--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), - ] + # Generates an assembly file defining a given symbol with the bytes from a + # binary file. Places the symbol in a text section if 'executable' is true, + # otherwise places the symbol in a read-only data section. + template("bin_to_assembly") { + assert(defined(invoker.deps), "Must define deps") + assert(defined(invoker.input), "Must define input binary file") + assert(defined(invoker.output), "Must define output assembly file") + assert(defined(invoker.symbol), "Must define symbol name") + assert(defined(invoker.executable), "Must define boolean executable") + + action(target_name) { + deps = invoker.deps + script = "//third_party/dart/runtime/tools/bin_to_assembly.py" + args = [ + "--input", + rebase_path(invoker.input), + "--output", + rebase_path(invoker.output), + "--symbol_name", + invoker.symbol, + "--target_os", + current_os, + ] + if (invoker.executable) { + args += [ "--executable" ] + } + inputs = [ + script, + invoker.input, + ] + outputs = [ + invoker.output, + ] + } + } - 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", + bin_to_assembly("vm_snapshot_data_assembly") { + deps = [ + ":generate_snapshot_bin", ] + input = "$target_gen_dir/vm_isolate_snapshot.bin" + output = "$target_gen_dir/vm_snapshot_data.S" + symbol = "kDartVmSnapshotData" + executable = false } - 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"), + bin_to_assembly("vm_snapshot_instructions_assembly") { + deps = [ + ":generate_snapshot_bin", ] + input = "$target_gen_dir/vm_snapshot_instructions.bin" + output = "$target_gen_dir/vm_snapshot_instructions.S" + symbol = "kDartVmSnapshotInstructions" + executable = true } -} -# Generates an assembly file defining a given symbol with the bytes from a -# binary file. Places the symbol in a text section if 'executable' is true, -# otherwise places the symbol in a read-only data section. -template("bin_to_assembly") { - assert(defined(invoker.deps), "Must define deps") - assert(defined(invoker.input), "Must define input binary file") - assert(defined(invoker.output), "Must define output assembly file") - assert(defined(invoker.symbol), "Must define symbol name") - assert(defined(invoker.executable), "Must define boolean executable") - - action(target_name) { - deps = invoker.deps - script = "//third_party/dart/runtime/tools/bin_to_assembly.py" - args = [ - "--input", - rebase_path(invoker.input), - "--output", - rebase_path(invoker.output), - "--symbol_name", - invoker.symbol, - "--target_os", - current_os, - ] - if (invoker.executable) { - args += [ "--executable" ] - } - inputs = [ - script, - invoker.input, - ] - outputs = [ - invoker.output, + bin_to_assembly("isolate_snapshot_data_assembly") { + deps = [ + ":generate_snapshot_bin", ] + input = "$target_gen_dir/isolate_snapshot.bin" + output = "$target_gen_dir/isolate_snapshot_data.S" + symbol = "kDartIsolateSnapshotData" + executable = false } -} - -bin_to_assembly("vm_snapshot_data_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/vm_isolate_snapshot.bin" - output = "$target_gen_dir/vm_snapshot_data.S" - symbol = "kDartVmSnapshotData" - executable = false -} - -bin_to_assembly("vm_snapshot_instructions_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/vm_snapshot_instructions.bin" - output = "$target_gen_dir/vm_snapshot_instructions.S" - symbol = "kDartVmSnapshotInstructions" - executable = true -} - -bin_to_assembly("isolate_snapshot_data_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/isolate_snapshot.bin" - output = "$target_gen_dir/isolate_snapshot_data.S" - symbol = "kDartIsolateSnapshotData" - executable = false -} -bin_to_assembly("isolate_snapshot_instructions_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/isolate_snapshot_instructions.bin" - output = "$target_gen_dir/isolate_snapshot_instructions.S" - symbol = "kDartIsolateSnapshotInstructions" - executable = true -} + bin_to_assembly("isolate_snapshot_instructions_assembly") { + deps = [ + ":generate_snapshot_bin", + ] + input = "$target_gen_dir/isolate_snapshot_instructions.bin" + output = "$target_gen_dir/isolate_snapshot_instructions.S" + symbol = "kDartIsolateSnapshotInstructions" + executable = true + } -source_set("snapshot") { - deps = [ - ":isolate_snapshot_data_assembly", - ":isolate_snapshot_instructions_assembly", - ":vm_snapshot_data_assembly", - ":vm_snapshot_instructions_assembly", - ] - sources = [ - "$target_gen_dir/isolate_snapshot_data.S", - "$target_gen_dir/isolate_snapshot_instructions.S", - "$target_gen_dir/vm_snapshot_data.S", - "$target_gen_dir/vm_snapshot_instructions.S", - ] + source_set("snapshot") { + deps = [ + ":isolate_snapshot_data_assembly", + ":isolate_snapshot_instructions_assembly", + ":vm_snapshot_data_assembly", + ":vm_snapshot_instructions_assembly", + ] + sources = [ + "$target_gen_dir/isolate_snapshot_data.S", + "$target_gen_dir/isolate_snapshot_instructions.S", + "$target_gen_dir/vm_snapshot_data.S", + "$target_gen_dir/vm_snapshot_instructions.S", + ] + } } compile_platform("non_strong_platform") { @@ -288,25 +231,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 = [ - "--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), - ] + "--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/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 b0c9d355a2159..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,30 +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* kDartModeArgs[] = { - // clang-format off - "--no-strong", - "--no-reify_generic_functions", - "--no-sync_async", - // clang-format on -}; - -static const char* kDart2ModeArgs[] = { - // clang-format off - "--strong", - "--reify_generic_functions", - "--sync_async", - // clang-format on -}; - static const char* kDartStartPausedArgs[]{ "--pause_isolates_on_start", }; @@ -318,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: " @@ -376,32 +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, kDart2ModeArgs, arraysize(kDart2ModeArgs)); - if (use_checked_mode) { - PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); - } - } else { - PushBackAll(&args, kDartModeArgs, arraysize(kDartModeArgs)); - if (use_checked_mode) { - FML_DLOG(INFO) << "Checked mode is ON"; - PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); - PushBackAll(&args, kDartCheckedModeArgs, arraysize(kDartCheckedModeArgs)); - } else { - FML_DLOG(INFO) << "Is not Dart 2 and Checked mode is OFF"; - } + if (use_checked_mode) { + PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); } if (settings.start_paused) { @@ -496,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_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/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/shell.cc b/shell/common/shell.cc index 59272e11c0539..7d434cb055be4 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -875,12 +875,8 @@ bool Shell::OnServiceProtocolRunInView( auto main_script_file_mapping = 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_path, - packages_path); + auto isolate_configuration = IsolateConfiguration::CreateForKernel( + std::move(main_script_file_mapping)); RunConfiguration configuration(std::move(isolate_configuration)); 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/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/view/FlutterMain.java b/shell/platform/android/io/flutter/view/FlutterMain.java index 49d3b01707633..198bcade69ae8 100644 --- a/shell/platform/android/io/flutter/view/FlutterMain.java +++ b/shell/platform/android/io/flutter/view/FlutterMain.java @@ -31,7 +31,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 @@ -47,8 +46,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; @@ -59,9 +56,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. @@ -79,7 +74,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; @@ -248,7 +242,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) { @@ -268,13 +261,11 @@ private static void initResources(Context applicationContext) { 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); @@ -283,8 +274,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/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index 6dd4b9ab3350a..d93f9357144a6 100644 --- a/shell/platform/android/platform_view_android_jni.cc +++ b/shell/platform/android/platform_view_android_jni.cc @@ -217,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; }; @@ -228,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(); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index 64eb73650dcc1..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,12 +175,6 @@ - (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; - } } } diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 184f63e639edf..d0a87703b9c9b 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -277,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; 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 = ""; From 8f39cac12c98b47057431b9f543f7d1f0fe5185c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Mon, 10 Sep 2018 21:19:17 -0400 Subject: [PATCH 086/134] Roll src/third_party/skia 7891994e89a3..3c4d533d8ebd (1 commits) (#6218) https://skia.googlesource.com/skia.git/+log/7891994e89a3..3c4d533d8ebd Created with: gclient setdep -r src/third_party/skia@3c4d533d8ebd The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 1138595e50ddf..f0ca81f113de0 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '7891994e89a35273524c8aa672ec68a0aa0a6901', + 'skia_revision': '3c4d533d8ebd88c5167b3d105513dc3fa52e7507', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 8b044275f5b28..685ad437bb6d6 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 644a4365dc26a656c59ddce150c27d3a +Signature: b60edd1ece1601fa5154eaf2252a2afb UNUSED LICENSES: From 8d9e20c021ddd894775f8dd96b3a683e7330934b Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Tue, 11 Sep 2018 00:44:17 -0400 Subject: [PATCH 087/134] Roll src/third_party/skia 3c4d533d8ebd..5518e65d90d7 (1 commits) (#6219) https://skia.googlesource.com/skia.git/+log/3c4d533d8ebd..5518e65d90d7 Created with: gclient setdep -r src/third_party/skia@5518e65d90d7 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f0ca81f113de0..5227e163baf18 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '3c4d533d8ebd88c5167b3d105513dc3fa52e7507', + 'skia_revision': '5518e65d90d7b6be63615e04362115792ae3d3b3', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 685ad437bb6d6..5c507619bda49 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b60edd1ece1601fa5154eaf2252a2afb +Signature: 2cb0bb77f973fae0baeca32ef1a13083 UNUSED LICENSES: From 6ed00a8688603c4dff36394fceb57f939a229ab2 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Tue, 11 Sep 2018 04:08:17 -0400 Subject: [PATCH 088/134] Roll src/third_party/skia 5518e65d90d7..82bf31003c66 (1 commits) (#6220) https://skia.googlesource.com/skia.git/+log/5518e65d90d7..82bf31003c66 Created with: gclient setdep -r src/third_party/skia@82bf31003c66 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 5227e163baf18..90436d811b86a 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '5518e65d90d7b6be63615e04362115792ae3d3b3', + 'skia_revision': '82bf31003c66bdf073a1439d9b9011c84d6a5d5d', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 5c507619bda49..2bdd9af889f5e 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 2cb0bb77f973fae0baeca32ef1a13083 +Signature: 8d00c4b290c91cd9d0fa1d80c7d3a305 UNUSED LICENSES: From 35ddf873aeed64f17f9bd4e3002fc1df75ff4495 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Tue, 11 Sep 2018 11:22:52 +0200 Subject: [PATCH 089/134] Roll buildroot to eba79bb6db1b50a98ab8ce39def287f7d332a5b8 (#6215) Enables LTO for android. --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 90436d811b86a..f10e0ff1afce9 100644 --- a/DEPS +++ b/DEPS @@ -115,7 +115,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'be483cb1cd3a9c4313b2e534034d23a05c3d849e', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'eba79bb6db1b50a98ab8ce39def287f7d332a5b8', # Fuchsia compatibility # From 54fe12bc454c471f4e9d1fb7bd9d8c7839485a92 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Tue, 11 Sep 2018 07:32:18 -0400 Subject: [PATCH 090/134] Roll src/third_party/skia 82bf31003c66..2bf7a7bcc67f (1 commits) (#6221) https://skia.googlesource.com/skia.git/+log/82bf31003c66..2bf7a7bcc67f Created with: gclient setdep -r src/third_party/skia@2bf7a7bcc67f The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f10e0ff1afce9..a18fc25e84159 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '82bf31003c66bdf073a1439d9b9011c84d6a5d5d', + 'skia_revision': '2bf7a7bcc67fb04e746974859b9f748718515359', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 2bdd9af889f5e..fc74e4c90915b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8d00c4b290c91cd9d0fa1d80c7d3a305 +Signature: 188f5a95a3af90dbf8ce1aed1c7a0eb4 UNUSED LICENSES: From 7be4462cff648c31f25e08d25ee6c61999326e46 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Tue, 11 Sep 2018 10:56:17 -0400 Subject: [PATCH 091/134] Roll src/third_party/skia 2bf7a7bcc67f..bd6595544171 (4 commits) (#6222) https://skia.googlesource.com/skia.git/+log/2bf7a7bcc67f..bd6595544171 Created with: gclient setdep -r src/third_party/skia@bd6595544171 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index a18fc25e84159..6b3264e47e54d 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '2bf7a7bcc67fb04e746974859b9f748718515359', + 'skia_revision': 'bd659554417135fa601cd25a4a51c27abcd52148', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index fc74e4c90915b..77cccff14fe54 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 188f5a95a3af90dbf8ce1aed1c7a0eb4 +Signature: 5f13f15f6fc5eee125e43ecb575494da UNUSED LICENSES: @@ -1556,6 +1556,7 @@ 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 @@ -3609,7 +3610,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 From 51b26f6347f77bced5dfbbd200aab5198b4a72fb Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Tue, 11 Sep 2018 18:01:39 +0200 Subject: [PATCH 092/134] Revert "Roll buildroot to eba79bb6db1b50a98ab8ce39def287f7d332a5b8 (#6215)" (#6223) This reverts commit 35ddf873aeed64f17f9bd4e3002fc1df75ff4495. Buildbots are hanging while generating treemaps with LTO enabled. --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 6b3264e47e54d..940d3b4ddd1c9 100644 --- a/DEPS +++ b/DEPS @@ -115,7 +115,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'eba79bb6db1b50a98ab8ce39def287f7d332a5b8', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'be483cb1cd3a9c4313b2e534034d23a05c3d849e', # Fuchsia compatibility # From 9a173a8dc845281d8593458f7d1133f0355add33 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Tue, 11 Sep 2018 18:15:07 +0200 Subject: [PATCH 093/134] Roll buldroot to a11c4fd9fcc7ad84f465d74461421f3ec790fb99 (#6224) --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 940d3b4ddd1c9..f1abd309894bb 100644 --- a/DEPS +++ b/DEPS @@ -115,7 +115,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'be483cb1cd3a9c4313b2e534034d23a05c3d849e', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'a11c4fd9fcc7ad84f465d74461421f3ec790fb99', # Fuchsia compatibility # From 565a19489a85a39d731560ad353437d1fb7698a5 Mon Sep 17 00:00:00 2001 From: Aart Bik <39774503+aartbik@users.noreply.github.com> Date: Tue, 11 Sep 2018 15:21:31 -0700 Subject: [PATCH 094/134] Flutter roll for Dart. (#6227) Changes included in this roll: 05ccfa8502 [VM] Reduce size of monomorphic entries in AOT on ARM/ARM64 & use smaller tail-calls in various places 805c92cf32 Add @TypeArguments as a valid type for BoundVariable.value 3af0db2f97 fix my name in .mailmap 0eee800e1b Report INCONSISTENT_METHOD_INHERITANCE for mixins. c7960df357 Generate analyzer error codes from messages.yaml e2fdd57664 Clarify ambiguous definition of constant interpolated string expressions. 24493c2f54 Add support for dartdevk to read Analyzer summaries into Kernel format d32c8e4793 Generate error code index from "index:" field in messages.yaml d0a5a4c22b Convert summarize_const_expr.dart to triple-slash comment style. d32f524bb3 Fix NamespaceBuilder._addPublicNames for mixins. aa003d4f8e [infra] Update checked in SDKs to 2.1.0-dev.4.0 7fa80d8200 Remove unused error codes ae2f75abec Report CompileTimeErrorCode.MIXIN_APPLICATION_NO_CONCRETE_SUPER_INVOKED_MEMBER. cbfc78f5b2 Parse mixin declarations as if they were classes d97823b704 Revert "[VM] Add new SymbolConstant to package:kernel/ast.dart" b6c98976d5 Report CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE for mixins. 3ddc9bb329 Add a doc comment for String.compare 9281748a35 Check for conflicting static and instance members in mixins. 3346632ad3 Report CompileTimeErrorCode.EXTENDS_NON_CLASS for mixins. f649a1f3cc Add a missing error message (issue 34412) 63fbfcc69a Translate InvalidInlineFunctionType to ParserErrorCode.INVALID_INLINE_FUNCTION_TYPE. --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f1abd309894bb..2b42859bb10ec 100644 --- a/DEPS +++ b/DEPS @@ -31,7 +31,7 @@ vars = { # Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS. # You can use //tools/dart/create_updated_flutter_deps.py to produce # updated revision list of existing dependencies. - 'dart_revision': 'ef720983530e04819b6fda0659ed7a3fdb190060', + 'dart_revision': '05ccfa85024ab2985824ee8e4070c2eee8454f81', 'dart_args_tag': '1.4.4', 'dart_async_tag': '2.0.8', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index f5e87bbd1aeb3..0f9ecc24eab60 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 7e3e1daeb388f5b96234b99e29bf6711 +Signature: 8d4516e66578b0887482c63865d1ef78 UNUSED LICENSES: From 7ac3345c65bac3ffafffb09800283283f6effe9e Mon Sep 17 00:00:00 2001 From: liyuqian Date: Tue, 11 Sep 2018 15:29:08 -0700 Subject: [PATCH 095/134] Remove root_surface_transformation from PaintContext (#6213) It should be sufficient to provide the matrix to preroll. --- flow/layers/layer.h | 1 - flow/layers/layer_tree.cc | 26 ++++++++++++-------------- flow/layers/picture_layer.cc | 3 +-- flow/raster_cache.cc | 8 ++------ flow/raster_cache.h | 3 +-- flow/scene_update_context.cc | 7 ++----- 6 files changed, 18 insertions(+), 30 deletions(-) diff --git a/flow/layers/layer.h b/flow/layers/layer.h index 53e32941e8d1d..173c2890b6ae8 100644 --- a/flow/layers/layer.h +++ b/flow/layers/layer.h @@ -57,7 +57,6 @@ class Layer { struct PaintContext { SkCanvas& canvas; - const SkMatrix& root_surface_transformation; const Stopwatch& frame_time; const Stopwatch& engine_time; TextureRegistry& texture_registry; 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/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/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/flow/scene_update_context.cc b/flow/scene_update_context.cc index 1da575bf56f12..576bde7fa1aff 100644 --- a/flow/scene_update_context.cc +++ b/flow/scene_update_context.cc @@ -187,12 +187,9 @@ SceneUpdateContext::ExecutePaintTasks(CompositorContext::ScopedFrame& frame) { for (auto& task : paint_tasks_) { FML_DCHECK(task.surface); SkCanvas* canvas = task.surface->GetSkiaSurface()->getCanvas(); - Layer::PaintContext context = {*canvas, - frame.root_surface_transformation(), - frame.context().frame_time(), + Layer::PaintContext context = {*canvas, frame.context().frame_time(), frame.context().engine_time(), - frame.context().texture_registry(), - false}; + frame.context().texture_registry(), false}; canvas->restoreToCount(1); canvas->save(); canvas->clear(task.background_color); From 838eb3d481b8656a367a620e680cd4b520afd96c Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Tue, 11 Sep 2018 16:13:23 -0700 Subject: [PATCH 096/134] Improve performance of performance overlay by caching. (#6225) Cache a SkSurface with previously drawn shapes so that we do not need to draw them again in future frames. On Nexus 5X test device, old render time for just the overlay was 1.3ms-3.0ms and this version improves to 0.9ms-1.3ms running flutter gallery in profile mode. --- flow/instrumentation.cc | 107 +++++++++++++++++++++++++++++++--------- flow/instrumentation.h | 7 +++ 2 files changed, 91 insertions(+), 23 deletions(-) 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); }; From 40573274f2c6719b87b7f7f5b6bf0fee7509c86c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Tue, 11 Sep 2018 19:29:18 -0400 Subject: [PATCH 097/134] Roll src/third_party/skia bd6595544171..1b5ece0f06f4 (22 commits) (#6229) https://skia.googlesource.com/skia.git/+log/bd6595544171..1b5ece0f06f4 Created with: gclient setdep -r src/third_party/skia@1b5ece0f06f4 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DEPS b/DEPS index 2b42859bb10ec..62d5d60a40746 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'bd659554417135fa601cd25a4a51c27abcd52148', + 'skia_revision': '1b5ece0f06f494ec08d11f4088cc5260fb71f398', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 77cccff14fe54..69f44ef02bab7 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 5f13f15f6fc5eee125e43ecb575494da +Signature: 10dfa753016bffb996532562239a77eb UNUSED LICENSES: @@ -1325,6 +1325,7 @@ 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 @@ -1986,10 +1987,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 From 0ded891881dbfbe28c3e3d21bc29ca8fa9847ca5 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Wed, 12 Sep 2018 00:03:17 -0400 Subject: [PATCH 098/134] Roll src/third_party/skia 1b5ece0f06f4..e70aed7066c6 (1 commits) (#6231) https://skia.googlesource.com/skia.git/+log/1b5ece0f06f4..e70aed7066c6 Created with: gclient setdep -r src/third_party/skia@e70aed7066c6 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 62d5d60a40746..f1f775b3e0af2 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '1b5ece0f06f494ec08d11f4088cc5260fb71f398', + 'skia_revision': 'e70aed7066c6870d60e39e84b53d037a28ee1204', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 69f44ef02bab7..d8f0787082b1a 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 10dfa753016bffb996532562239a77eb +Signature: a219736b64b9f9dbd6245d50d87d3d05 UNUSED LICENSES: From 6f459e2f10ca77a1dceced8cba062f5760a05f8e Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 12 Sep 2018 12:07:20 +0200 Subject: [PATCH 099/134] Revert "Reapply "Some cleanups enabled by removing support for Dart 1" (#6216)" (#6232) This reverts commit e3133e0e3f7cbbd57fa930c11f3640561d691eba. --- common/settings.cc | 1 + common/settings.h | 3 + lib/snapshot/BUILD.gn | 341 ++++++++++-------- runtime/dart_isolate.cc | 140 ++++++- runtime/dart_isolate.h | 16 +- runtime/dart_isolate_unittests.cc | 66 ++++ runtime/dart_service_isolate.cc | 168 ++++++++- runtime/dart_service_isolate.h | 14 + runtime/dart_vm.cc | 61 +++- runtime/dart_vm.h | 3 + runtime/dart_vm_unittests.cc | 1 + shell/common/engine.cc | 5 + shell/common/engine.h | 3 + shell/common/isolate_configuration.cc | 71 +++- shell/common/isolate_configuration.h | 8 +- shell/common/shell.cc | 8 +- shell/common/switches.cc | 3 + shell/common/switches.h | 1 + shell/platform/android/flutter_main.cc | 5 + .../android/io/flutter/view/FlutterMain.java | 14 +- .../android/platform_view_android_jni.cc | 7 +- .../framework/Source/FlutterDartProject.mm | 27 ++ shell/platform/embedder/embedder.cc | 7 +- shell/testing/observatory/test.dart | 3 +- shell/testing/tester_main.cc | 9 +- 25 files changed, 779 insertions(+), 206 deletions(-) diff --git a/common/settings.cc b/common/settings.cc index 9aa8997ba947b..8123b1d321ef6 100644 --- a/common/settings.cc +++ b/common/settings.cc @@ -11,6 +11,7 @@ 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 1c0002e7ad7d6..124529b90c57d 100644 --- a/common/settings.h +++ b/common/settings.h @@ -23,6 +23,9 @@ 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/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn index 2370f50656916..45fe883b324a9 100644 --- a/lib/snapshot/BUILD.gn +++ b/lib/snapshot/BUILD.gn @@ -25,148 +25,205 @@ copy("generate_dart_ui") { ] } -# Fuchsia's snapshot requires a different platform with extra dart: libraries. -if (!is_fuchsia) { - compiled_action("generate_snapshot_bin") { - tool = "//third_party/dart/runtime/bin:gen_snapshot" - - platform_kernel = "$root_out_dir/flutter_patched_sdk/platform_strong.dill" - inputs = [ - platform_kernel, - ] - deps = [ - ":kernel_platform_files", - ] - - vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin" - vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin" - isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin" - isolate_snapshot_instructions = - "$target_gen_dir/isolate_snapshot_instructions.bin" - outputs = [ - vm_snapshot_data, - vm_snapshot_instructions, - isolate_snapshot_data, - isolate_snapshot_instructions, - ] - - args = [ - "--strong", - "--sync-async", - "--reify-generic-functions", - "--snapshot_kind=core", - "--await_is_keyword", - "--enable_mirrors=false", - "--vm_snapshot_data=" + rebase_path(vm_snapshot_data), - "--vm_snapshot_instructions=" + rebase_path(vm_snapshot_instructions), - "--isolate_snapshot_data=" + rebase_path(isolate_snapshot_data), - "--isolate_snapshot_instructions=" + - rebase_path(isolate_snapshot_instructions), - rebase_path(platform_kernel), - ] - - if (is_debug) { - args += [ - "--enable_asserts", - "--enable_type_checks", - "--error_on_bad_type", - "--error_on_bad_override", - ] +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" } + } else { + snapshot_dart = "snapshot.dart" + snapshot_kind = "core" } - # Generates an assembly file defining a given symbol with the bytes from a - # binary file. Places the symbol in a text section if 'executable' is true, - # otherwise places the symbol in a read-only data section. - template("bin_to_assembly") { - assert(defined(invoker.deps), "Must define deps") - assert(defined(invoker.input), "Must define input binary file") - assert(defined(invoker.output), "Must define output assembly file") - assert(defined(invoker.symbol), "Must define symbol name") - assert(defined(invoker.executable), "Must define boolean executable") - - action(target_name) { - deps = invoker.deps - script = "//third_party/dart/runtime/tools/bin_to_assembly.py" - args = [ - "--input", - rebase_path(invoker.input), - "--output", - rebase_path(invoker.output), - "--symbol_name", - invoker.symbol, - "--target_os", - current_os, - ] - if (invoker.executable) { - args += [ "--executable" ] - } - inputs = [ - script, - invoker.input, - ] - outputs = [ - invoker.output, - ] - } + deps = [ + ":generate_dart_ui", + "//third_party/dart/runtime/bin:gen_snapshot($host_toolchain)", + ] + 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" ] } - bin_to_assembly("vm_snapshot_data_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/vm_isolate_snapshot.bin" - output = "$target_gen_dir/vm_snapshot_data.S" - symbol = "kDartVmSnapshotData" - executable = false - } + vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin" + vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin" + isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin" + isolate_snapshot_instructions = + "$target_gen_dir/isolate_snapshot_instructions.bin" + outputs = [ + vm_snapshot_data, + vm_snapshot_instructions, + isolate_snapshot_data, + isolate_snapshot_instructions, + ] - bin_to_assembly("vm_snapshot_instructions_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/vm_snapshot_instructions.bin" - output = "$target_gen_dir/vm_snapshot_instructions.S" - symbol = "kDartVmSnapshotInstructions" - executable = true - } + 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", + "--await_is_keyword", + "--vm_flag", + "--enable_mirrors=false", + "--vm_flag", + "--no-strong", + "--vm_flag", + "--no-sync-async", + "--vm_flag", + "--no-reify-generic-functions", + "--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), + ] - bin_to_assembly("isolate_snapshot_data_assembly") { - deps = [ - ":generate_snapshot_bin", + 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", ] - input = "$target_gen_dir/isolate_snapshot.bin" - output = "$target_gen_dir/isolate_snapshot_data.S" - symbol = "kDartIsolateSnapshotData" - executable = false } - bin_to_assembly("isolate_snapshot_instructions_assembly") { - deps = [ - ":generate_snapshot_bin", + 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"), ] - input = "$target_gen_dir/isolate_snapshot_instructions.bin" - output = "$target_gen_dir/isolate_snapshot_instructions.S" - symbol = "kDartIsolateSnapshotInstructions" - executable = true } +} - source_set("snapshot") { - deps = [ - ":isolate_snapshot_data_assembly", - ":isolate_snapshot_instructions_assembly", - ":vm_snapshot_data_assembly", - ":vm_snapshot_instructions_assembly", +# Generates an assembly file defining a given symbol with the bytes from a +# binary file. Places the symbol in a text section if 'executable' is true, +# otherwise places the symbol in a read-only data section. +template("bin_to_assembly") { + assert(defined(invoker.deps), "Must define deps") + assert(defined(invoker.input), "Must define input binary file") + assert(defined(invoker.output), "Must define output assembly file") + assert(defined(invoker.symbol), "Must define symbol name") + assert(defined(invoker.executable), "Must define boolean executable") + + action(target_name) { + deps = invoker.deps + script = "//third_party/dart/runtime/tools/bin_to_assembly.py" + args = [ + "--input", + rebase_path(invoker.input), + "--output", + rebase_path(invoker.output), + "--symbol_name", + invoker.symbol, + "--target_os", + current_os, ] - sources = [ - "$target_gen_dir/isolate_snapshot_data.S", - "$target_gen_dir/isolate_snapshot_instructions.S", - "$target_gen_dir/vm_snapshot_data.S", - "$target_gen_dir/vm_snapshot_instructions.S", + if (invoker.executable) { + args += [ "--executable" ] + } + inputs = [ + script, + invoker.input, + ] + outputs = [ + invoker.output, ] } } +bin_to_assembly("vm_snapshot_data_assembly") { + deps = [ + ":generate_snapshot_bin", + ] + input = "$target_gen_dir/vm_isolate_snapshot.bin" + output = "$target_gen_dir/vm_snapshot_data.S" + symbol = "kDartVmSnapshotData" + executable = false +} + +bin_to_assembly("vm_snapshot_instructions_assembly") { + deps = [ + ":generate_snapshot_bin", + ] + input = "$target_gen_dir/vm_snapshot_instructions.bin" + output = "$target_gen_dir/vm_snapshot_instructions.S" + symbol = "kDartVmSnapshotInstructions" + executable = true +} + +bin_to_assembly("isolate_snapshot_data_assembly") { + deps = [ + ":generate_snapshot_bin", + ] + input = "$target_gen_dir/isolate_snapshot.bin" + output = "$target_gen_dir/isolate_snapshot_data.S" + symbol = "kDartIsolateSnapshotData" + executable = false +} + +bin_to_assembly("isolate_snapshot_instructions_assembly") { + deps = [ + ":generate_snapshot_bin", + ] + input = "$target_gen_dir/isolate_snapshot_instructions.bin" + output = "$target_gen_dir/isolate_snapshot_instructions.S" + symbol = "kDartIsolateSnapshotInstructions" + executable = true +} + +source_set("snapshot") { + deps = [ + ":isolate_snapshot_data_assembly", + ":isolate_snapshot_instructions_assembly", + ":vm_snapshot_data_assembly", + ":vm_snapshot_instructions_assembly", + ] + sources = [ + "$target_gen_dir/isolate_snapshot_data.S", + "$target_gen_dir/isolate_snapshot_instructions.S", + "$target_gen_dir/vm_snapshot_data.S", + "$target_gen_dir/vm_snapshot_instructions.S", + ] +} + compile_platform("non_strong_platform") { libraries_specification_uri = "libraries.json" @@ -231,31 +288,25 @@ 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 = [ - "--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) ] + "--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/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 34962593ea1f5..e48c542c11d61 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -282,12 +282,20 @@ bool DartIsolate::PrepareForRunningFromPrecompiledCode() { return true; } -bool DartIsolate::LoadKernel(std::shared_ptr mapping, - bool last_piece) { - if (!Dart_IsKernel(mapping->GetMapping(), mapping->GetSize())) { +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()))) { 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); @@ -309,11 +317,21 @@ bool DartIsolate::LoadKernel(std::shared_ptr mapping, 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::PrepareForRunningFromKernel( +bool DartIsolate::PrepareForRunningFromSnapshot( std::shared_ptr mapping, bool last_piece) { - TRACE_EVENT0("flutter", "DartIsolate::PrepareForRunningFromKernel"); + TRACE_EVENT0("flutter", "DartIsolate::PrepareForRunningFromSnapshot"); if (phase_ != Phase::LibrariesSetup) { return false; } @@ -331,7 +349,7 @@ bool DartIsolate::PrepareForRunningFromKernel( // Use root library provided by kernel in favor of one provided by snapshot. Dart_SetRootLibrary(Dart_Null()); - if (!LoadKernel(mapping, last_piece)) { + if (!LoadSnapshot(mapping, last_piece)) { return false; } @@ -349,7 +367,61 @@ bool DartIsolate::PrepareForRunningFromKernel( } child_isolate_preparer_ = [mapping](DartIsolate* isolate) { - return isolate->PrepareForRunningFromKernel(mapping); + 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); }; phase_ = Phase::Ready; return true; @@ -536,11 +608,22 @@ 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) )) { @@ -644,20 +727,39 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( Dart_IsolateFlagsInitialize(&nonnull_flags); flags = &nonnull_flags; } - flags->use_dart_frontend = true; + bool dart2 = (vm->GetPlatformKernel().GetSize() > 0) || + Dart_IsDart2Snapshot((*embedder_isolate) + ->GetIsolateSnapshot() + ->GetData() + ->GetSnapshotPointer()); + flags->use_dart_frontend = dart2; // Create the Dart VM isolate and give it the embedder object as the baton. - 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); + 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); if (isolate == nullptr) { FML_DLOG(ERROR) << *error; diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h index f2167364effdd..df9a9f66d1b46 100644 --- a/runtime/dart_isolate.h +++ b/runtime/dart_isolate.h @@ -68,8 +68,13 @@ class DartIsolate : public UIDartState { bool PrepareForRunningFromPrecompiledCode(); FML_WARN_UNUSED_RESULT - bool PrepareForRunningFromKernel(std::shared_ptr kernel, - bool last_piece = true); + 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); FML_WARN_UNUSED_RESULT bool Run(const std::string& entrypoint); @@ -91,7 +96,12 @@ class DartIsolate : public UIDartState { std::weak_ptr GetWeakIsolatePtr(); private: - bool LoadKernel(std::shared_ptr mapping, bool last_piece); + 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); class AutoFireClosure { public: diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc index cb7797abdcb74..02cbbaf8cf5f2 100644 --- a/runtime/dart_isolate_unittests.cc +++ b/runtime/dart_isolate_unittests.cc @@ -46,4 +46,70 @@ 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 05da4c48fc2dd..d1a699869959a 100644 --- a/runtime/dart_service_isolate.cc +++ b/runtime/dart_service_isolate.cc @@ -26,11 +26,21 @@ 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, @@ -47,6 +57,13 @@ 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 = @@ -67,6 +84,7 @@ 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(); @@ -85,13 +103,36 @@ bool DartServiceIsolate::Startup(std::string server_ip, }); } - 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); + 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); + } // Make runnable. Dart_ExitScope(); @@ -105,7 +146,7 @@ bool DartServiceIsolate::Startup(std::string server_ip, Dart_EnterIsolate(isolate); Dart_EnterScope(); - library = Dart_RootLibrary(); + Dart_Handle library = Dart_RootLibrary(); SHUTDOWN_ON_ERROR(library); // Set the HTTP server's ip. @@ -133,4 +174,115 @@ 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 3d672dc83bb4c..59a02e2e9d495 100644 --- a/runtime/dart_service_isolate.h +++ b/runtime/dart_service_isolate.h @@ -16,6 +16,7 @@ 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); @@ -23,8 +24,21 @@ 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 a5fb451588be6..b0c9d355a2159 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -66,9 +66,6 @@ static const char* kDartLanguageArgs[] = { "--background_compilation", "--await_is_keyword", "--causal_async_stacks", - "--strong", - "--reify_generic_functions", - "--sync_async", // clang-format on }; @@ -87,6 +84,30 @@ 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* kDartModeArgs[] = { + // clang-format off + "--no-strong", + "--no-reify_generic_functions", + "--no-sync_async", + // clang-format on +}; + +static const char* kDart2ModeArgs[] = { + // clang-format off + "--strong", + "--reify_generic_functions", + "--sync_async", + // clang-format on +}; + static const char* kDartStartPausedArgs[]{ "--pause_isolates_on_start", }; @@ -297,6 +318,8 @@ 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: " @@ -353,12 +376,32 @@ DartVM::DartVM(const Settings& settings, arraysize(kDartWriteProtectCodeArgs)); #endif - const bool is_preview_dart2 = + const bool isolate_snapshot_is_dart_2 = Dart_IsDart2Snapshot(isolate_snapshot_->GetData()->GetSnapshotPointer()); - FML_CHECK(is_preview_dart2) << "Not Dart 2!"; - if (use_checked_mode) { - PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); + 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, kDart2ModeArgs, arraysize(kDart2ModeArgs)); + if (use_checked_mode) { + PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); + } + } else { + PushBackAll(&args, kDartModeArgs, arraysize(kDartModeArgs)); + if (use_checked_mode) { + FML_DLOG(INFO) << "Checked mode is ON"; + 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) { @@ -453,6 +496,10 @@ 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 b853f026c328f..ebb41edadb479 100644 --- a/runtime/dart_vm.h +++ b/runtime/dart_vm.h @@ -42,6 +42,8 @@ class DartVM : public fml::RefCountedThreadSafe { const Settings& GetSettings() const; + const fml::Mapping& GetPlatformKernel() const; + const DartSnapshot& GetVMSnapshot() const; IsolateNameServer* GetIsolateNameServer(); @@ -60,6 +62,7 @@ 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_unittests.cc b/runtime/dart_vm_unittests.cc index 94d5dadaaec1f..d0e247836410b 100644 --- a/runtime/dart_vm_unittests.cc +++ b/runtime/dart_vm_unittests.cc @@ -15,6 +15,7 @@ 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/engine.cc b/shell/common/engine.cc index b79dbfae33555..1b9d3657b6ece 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -47,6 +47,7 @@ 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) { @@ -204,6 +205,10 @@ 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 f35b9ba421113..259f73514b67d 100644 --- a/shell/common/engine.h +++ b/shell/common/engine.h @@ -79,6 +79,8 @@ class Engine final : public blink::RuntimeDelegate { tonic::DartErrorHandleType GetUIIsolateLastError(); + tonic::DartErrorHandleType GetLoadScriptError(); + std::pair GetUIIsolateReturnCode(); void OnOutputSurfaceCreated(); @@ -109,6 +111,7 @@ 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 57c38bef9f8d8..66dd53fb1b59c 100644 --- a/shell/common/isolate_configuration.cc +++ b/shell/common/isolate_configuration.cc @@ -39,23 +39,45 @@ class AppSnapshotIsolateConfiguration final : public IsolateConfiguration { FML_DISALLOW_COPY_AND_ASSIGN(AppSnapshotIsolateConfiguration); }; -class KernelIsolateConfiguration : public IsolateConfiguration { +class SnapshotIsolateConfiguration : public IsolateConfiguration { public: - KernelIsolateConfiguration(std::unique_ptr kernel) - : kernel_(std::move(kernel)) {} + SnapshotIsolateConfiguration(std::unique_ptr snapshot) + : snapshot_(std::move(snapshot)) {} // |shell::IsolateConfiguration| bool DoPrepareIsolate(blink::DartIsolate& isolate) override { if (blink::DartVM::IsRunningPrecompiledCode()) { return false; } - return isolate.PrepareForRunningFromKernel(std::move(kernel_)); + return isolate.PrepareForRunningFromSnapshot(std::move(snapshot_)); } private: - std::unique_ptr kernel_; + std::unique_ptr snapshot_; - FML_DISALLOW_COPY_AND_ASSIGN(KernelIsolateConfiguration); + 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); }; class KernelListIsolateConfiguration final : public IsolateConfiguration { @@ -72,8 +94,8 @@ class KernelListIsolateConfiguration final : public IsolateConfiguration { for (size_t i = 0; i < kernel_pieces_.size(); i++) { bool last_piece = i + 1 == kernel_pieces_.size(); - if (!isolate.PrepareForRunningFromKernel(std::move(kernel_pieces_[i]), - last_piece)) { + if (!isolate.PrepareForRunningFromSnapshot(std::move(kernel_pieces_[i]), + last_piece)) { return false; } } @@ -95,12 +117,30 @@ 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 CreateForKernel(std::move(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)); } } @@ -149,9 +189,16 @@ IsolateConfiguration::CreateForAppSnapshot() { return std::make_unique(); } -std::unique_ptr IsolateConfiguration::CreateForKernel( - std::unique_ptr kernel) { - return std::make_unique(std::move(kernel)); +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::CreateForKernelList( diff --git a/shell/common/isolate_configuration.h b/shell/common/isolate_configuration.h index 7dd54ccf3b3b7..ba8752273d6de 100644 --- a/shell/common/isolate_configuration.h +++ b/shell/common/isolate_configuration.h @@ -26,8 +26,12 @@ class IsolateConfiguration { static std::unique_ptr CreateForAppSnapshot(); - static std::unique_ptr CreateForKernel( - std::unique_ptr kernel); + 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 CreateForKernelList( std::vector> kernel_pieces); diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 7d434cb055be4..59272e11c0539 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -875,8 +875,12 @@ bool Shell::OnServiceProtocolRunInView( auto main_script_file_mapping = std::make_unique(main_script_path, false); - auto isolate_configuration = IsolateConfiguration::CreateForKernel( - std::move(main_script_file_mapping)); + auto isolate_configuration = + blink::DartVM::IsKernelMapping(main_script_file_mapping.get()) + ? IsolateConfiguration::CreateForSnapshot( + std::move(main_script_file_mapping)) + : IsolateConfiguration::CreateForSource(main_script_path, + packages_path); RunConfiguration configuration(std::move(isolate_configuration)); diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 98f0bb353015f..80ae36a7e5776 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -170,6 +170,9 @@ 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 644b02f2cbce5..6bae9047e0e3d 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -93,6 +93,7 @@ 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/platform/android/flutter_main.cc b/shell/platform/android/flutter_main.cc index 0bcf75d76feca..b8931e6e46753 100644 --- a/shell/platform/android/flutter_main.cc +++ b/shell/platform/android/flutter_main.cc @@ -66,11 +66,16 @@ 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/view/FlutterMain.java b/shell/platform/android/io/flutter/view/FlutterMain.java index 198bcade69ae8..49d3b01707633 100644 --- a/shell/platform/android/io/flutter/view/FlutterMain.java +++ b/shell/platform/android/io/flutter/view/FlutterMain.java @@ -31,6 +31,7 @@ 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 @@ -46,6 +47,8 @@ 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; @@ -56,7 +59,9 @@ 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. @@ -74,6 +79,7 @@ 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; @@ -242,6 +248,7 @@ 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) { @@ -261,11 +268,13 @@ private static void initResources(Context applicationContext) { 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_KERNEL_BLOB)) + .addResource(fromFlutterAssets(DEFAULT_PLATFORM_DILL)); if (sIsPrecompiledAsSharedLibrary) { sResourceExtractor .addResource(sAotSharedLibraryPath); @@ -274,7 +283,8 @@ private static void initResources(Context applicationContext) { .addResource(sAotVmSnapshotData) .addResource(sAotVmSnapshotInstr) .addResource(sAotIsolateSnapshotData) - .addResource(sAotIsolateSnapshotInstr); + .addResource(sAotIsolateSnapshotInstr) + .addResource(sSnapshotBlob); } sResourceExtractor.start(); } diff --git a/shell/platform/android/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index d93f9357144a6..6dd4b9ab3350a 100644 --- a/shell/platform/android/platform_view_android_jni.cc +++ b/shell/platform/android/platform_view_android_jni.cc @@ -217,10 +217,10 @@ std::unique_ptr CreateIsolateConfiguration( return IsolateConfiguration::CreateForKernelList(std::move(kernels)); } if (blob) { - return IsolateConfiguration::CreateForKernel(std::move(blob)); + return IsolateConfiguration::CreateForSnapshot(std::move(blob)); } if (delta) { - return IsolateConfiguration::CreateForKernel(std::move(delta)); + return IsolateConfiguration::CreateForSnapshot(std::move(delta)); } return nullptr; }; @@ -228,6 +228,9 @@ 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(); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index f5d5d80dfe41a..8ef42bf83968c 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -15,6 +15,8 @@ #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) { @@ -104,6 +106,25 @@ 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. @@ -175,6 +196,12 @@ - (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; + } } } diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index d0a87703b9c9b..184f63e639edf 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -277,11 +277,16 @@ 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.application_kernel_asset = kApplicationKernelSnapshotFileName; + settings.platform_kernel_path = platform_kernel_path; + if (fml::IsFile(platform_kernel_path)) { + settings.application_kernel_asset = kApplicationKernelSnapshotFileName; + } } else { // Run from a main Dart file. settings.main_dart_file_path = args->main_path; diff --git a/shell/testing/observatory/test.dart b/shell/testing/observatory/test.dart index d753d1522c9b8..ba14fe41cc3e0 100644 --- a/shell/testing/observatory/test.dart +++ b/shell/testing/observatory/test.dart @@ -156,8 +156,7 @@ final List basicTests = [ ]; final List startPausedTests = [ - // TODO(engine): Investigate difference in lifecycle events. - // testStartPaused, + testStartPaused, ]; Future runTests(ShellLauncher launcher, List tests) async { diff --git a/shell/testing/tester_main.cc b/shell/testing/tester_main.cc index 4e10dab16f25c..274ef7bb64a6c 100644 --- a/shell/testing/tester_main.cc +++ b/shell/testing/tester_main.cc @@ -133,7 +133,11 @@ int RunTester(const blink::Settings& settings, bool run_forever) { fml::paths::AbsolutePath(settings.main_dart_file_path), false); auto isolate_configuration = - IsolateConfiguration::CreateForKernel(std::move(main_dart_file_mapping)); + 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); if (!isolate_configuration) { FML_LOG(ERROR) << "Could create isolate configuration."; @@ -238,6 +242,9 @@ 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 = ""; From 87b4af095ce1ec20af59f6c200a674a984986261 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Wed, 12 Sep 2018 09:08:18 -0400 Subject: [PATCH 100/134] Roll src/third_party/skia e70aed7066c6..44215505623b (1 commits) (#6235) https://skia.googlesource.com/skia.git/+log/e70aed7066c6..44215505623b Created with: gclient setdep -r src/third_party/skia@44215505623b The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index f1f775b3e0af2..d8f2c11e9ba37 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'e70aed7066c6870d60e39e84b53d037a28ee1204', + 'skia_revision': '44215505623b61df2458a1e54ddebf026569912a', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index d8f0787082b1a..dd73f2b350764 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: a219736b64b9f9dbd6245d50d87d3d05 +Signature: e2ba5f932aaa872643e174d75cfc6cfc UNUSED LICENSES: From 1e622d24d99f65fad071bd47f9dc47a552bf889f Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Wed, 12 Sep 2018 10:47:29 -0400 Subject: [PATCH 101/134] Update to newer Skia font API (#6236) This function now takes an sk_sp --- lib/ui/text/asset_manager_font_provider.cc | 2 +- lib/ui/text/font_collection.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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(); From 12315736f9ca798e7e87b1f42c0fc19ac44ed255 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 12 Sep 2018 17:13:53 +0200 Subject: [PATCH 102/134] Roll buildroot to c2764d3620d792e71301dff9a66866029ed200f0 (#6237) --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index d8f2c11e9ba37..b119a437b332f 100644 --- a/DEPS +++ b/DEPS @@ -115,7 +115,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'a11c4fd9fcc7ad84f465d74461421f3ec790fb99', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'c2764d3620d792e71301dff9a66866029ed200f0', # Fuchsia compatibility # From 9a7d7215aee0eccee87f9d9803d0cc13472a97bc Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Wed, 12 Sep 2018 12:33:18 -0400 Subject: [PATCH 103/134] Roll src/third_party/skia 44215505623b..16322637c477 (10 commits) (#6238) https://skia.googlesource.com/skia.git/+log/44215505623b..16322637c477 Created with: gclient setdep -r src/third_party/skia@16322637c477 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index b119a437b332f..4da66200a2fa4 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '44215505623b61df2458a1e54ddebf026569912a', + 'skia_revision': '16322637c4776170fbdf19ba621d2bf83c66d423', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index dd73f2b350764..4a0dd8c75e68b 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: e2ba5f932aaa872643e174d75cfc6cfc +Signature: 34c192228659431630a0d3d544beac72 UNUSED LICENSES: From 513f8fbae726aadbb1aa769ca4d43e5fe8d1f429 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Wed, 12 Sep 2018 15:51:17 -0400 Subject: [PATCH 104/134] Roll src/third_party/skia 16322637c477..858f648bdae3 (7 commits) (#6240) https://skia.googlesource.com/skia.git/+log/16322637c477..858f648bdae3 Created with: gclient setdep -r src/third_party/skia@858f648bdae3 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 4da66200a2fa4..1ca4b50a8f5b1 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '16322637c4776170fbdf19ba621d2bf83c66d423', + 'skia_revision': '858f648bdae374edafda228872cbfa29550c15ef', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 4a0dd8c75e68b..0a8122f4d5311 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 34c192228659431630a0d3d544beac72 +Signature: f683ca056a64c7d0b66ff352887d98ae UNUSED LICENSES: @@ -2067,7 +2067,6 @@ 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 From 0c28a093ae8d26e7d2ba5a7adce046771583070f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Wed, 12 Sep 2018 19:15:17 -0400 Subject: [PATCH 105/134] Roll src/third_party/skia 858f648bdae3..34e5e1b387f5 (8 commits) (#6241) https://skia.googlesource.com/skia.git/+log/858f648bdae3..34e5e1b387f5 Created with: gclient setdep -r src/third_party/skia@34e5e1b387f5 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 1ca4b50a8f5b1..06be1ef714234 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '858f648bdae374edafda228872cbfa29550c15ef', + 'skia_revision': '34e5e1b387f5c4b4eb49a7b2d083e7aa1b477beb', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 0a8122f4d5311..e5dbe19a3e145 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: f683ca056a64c7d0b66ff352887d98ae +Signature: 1e98ae8c9000bfb017653df6f739f132 UNUSED LICENSES: @@ -1521,6 +1521,20 @@ 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/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/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/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/mtl/GrMtlBuffer.h FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlBuffer.mm FILE: ../../../third_party/skia/src/gpu/mtl/GrMtlCopyManager.h From 2a433bc6854b3c107ed078a24b5eb018f7ffedb7 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Wed, 12 Sep 2018 22:39:17 -0400 Subject: [PATCH 106/134] Roll src/third_party/skia 34e5e1b387f5..76bba35cbaa4 (2 commits) (#6243) https://skia.googlesource.com/skia.git/+log/34e5e1b387f5..76bba35cbaa4 Created with: gclient setdep -r src/third_party/skia@76bba35cbaa4 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 06be1ef714234..479a592eafc4a 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '34e5e1b387f5c4b4eb49a7b2d083e7aa1b477beb', + 'skia_revision': '76bba35cbaa440c3421aa9c6613060aaf369f8ba', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index e5dbe19a3e145..6507389a89cc4 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 1e98ae8c9000bfb017653df6f739f132 +Signature: d739945d0814adf2238cbc15c91ca548 UNUSED LICENSES: From 49ef4adad32767ee70da43e47e8df4ecdbfd028a Mon Sep 17 00:00:00 2001 From: KyleWong Date: Thu, 13 Sep 2018 12:08:01 +0800 Subject: [PATCH 107/134] Fix a crash when UILaunchStoryboardName is not specified in Info.plist (#6234) Some developers might prefer launch images. --- .../darwin/ios/framework/Source/FlutterViewController.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 26c8ffc328466..f90d2862eaf56 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -392,6 +392,9 @@ - (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; From c0e6f6a6e665b8b5f66038819f15701dbfe2f0da Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Thu, 13 Sep 2018 02:22:18 -0400 Subject: [PATCH 108/134] Roll src/third_party/skia 76bba35cbaa4..46a5f6c28a34 (1 commits) (#6244) https://skia.googlesource.com/skia.git/+log/76bba35cbaa4..46a5f6c28a34 Created with: gclient setdep -r src/third_party/skia@46a5f6c28a34 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 479a592eafc4a..09677bb832bc0 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '76bba35cbaa440c3421aa9c6613060aaf369f8ba', + 'skia_revision': '46a5f6c28a34feeabab8f3256bcfc006c2f225f5', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6507389a89cc4..6857f4787dea0 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: d739945d0814adf2238cbc15c91ca548 +Signature: 9172d63708dc001f48198ed2e2745964 UNUSED LICENSES: From 23fcc2771884e54428e14d63ea95d0cc344570be Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 13 Sep 2018 18:49:54 +0200 Subject: [PATCH 109/134] Prepare for stripping and dsyming Flutter.framework (#6247) --- DEPS | 2 +- sky/tools/create_ios_framework.py | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 09677bb832bc0..b7e8f0937bb40 100644 --- a/DEPS +++ b/DEPS @@ -115,7 +115,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'c2764d3620d792e71301dff9a66866029ed200f0', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '7141218c62890635ce966e2530b465ea4c55c3e2', # Fuchsia compatibility # 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()) From abd918eb618bfcc9a1a07513f88dfc066ea4aa3c Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Thu, 13 Sep 2018 10:28:27 -0700 Subject: [PATCH 110/134] Add scrollIndex and scrollChildren to semantics, add Android implementation (#6239) --- lib/ui/semantics.dart | 10 ++++++++- lib/ui/semantics/semantics_node.h | 2 ++ lib/ui/semantics/semantics_update_builder.cc | 4 ++++ lib/ui/semantics/semantics_update_builder.h | 2 ++ .../io/flutter/view/AccessibilityBridge.java | 22 +++++++++++++++++-- .../platform/android/platform_view_android.cc | 4 +++- 6 files changed, 40 insertions(+), 4 deletions(-) diff --git a/lib/ui/semantics.dart b/lib/ui/semantics.dart index 444ea8856261b..e4bc18b81ffd8 100644 --- a/lib/ui/semantics.dart +++ b/lib/ui/semantics.dart @@ -596,7 +596,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 +611,8 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { int actions, int textSelectionBase, int textSelectionExtent, + int scrollChildren, + int scrollIndex, double scrollPosition, double scrollExtentMax, double scrollExtentMin, @@ -634,6 +638,8 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { actions, textSelectionBase, textSelectionExtent, + scrollChildren, + scrollIndex, scrollPosition, scrollExtentMax, scrollExtentMin, @@ -659,6 +665,8 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 { int actions, int textSelectionBase, int textSelectionExtent, + int scrollChildren, + int scrollIndex, double scrollPosition, double scrollExtentMax, double scrollExtentMin, 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/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index ba15c33428c6b..807e46b2a9bd1 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,6 +717,20 @@ 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)) { @@ -947,6 +961,8 @@ private class SemanticsObject { int actions; int textSelectionBase; int textSelectionExtent; + int scrollChildren; + int scrollIndex; float scrollPosition; float scrollExtentMax; float scrollExtentMin; @@ -1048,6 +1064,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/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; From 931d3cbbc250dbeec1c485f6bee869a15080ac0e Mon Sep 17 00:00:00 2001 From: Siva Date: Thu, 13 Sep 2018 15:44:24 -0700 Subject: [PATCH 111/134] Roll Dart to version c28db2d6e17f046f95db5987394df43c95d58468 (#6249) --- DEPS | 4 ++-- ci/licenses_golden/licenses_third_party | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index b7e8f0937bb40..612238126c41a 100644 --- a/DEPS +++ b/DEPS @@ -31,7 +31,7 @@ vars = { # Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS. # You can use //tools/dart/create_updated_flutter_deps.py to produce # updated revision list of existing dependencies. - 'dart_revision': '05ccfa85024ab2985824ee8e4070c2eee8454f81', + 'dart_revision': 'c28db2d6e17f046f95db5987394df43c95d58468', 'dart_args_tag': '1.4.4', 'dart_async_tag': '2.0.8', @@ -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.61', 'dart_logging_tag': '0.11.3+2', 'dart_markdown_tag': '2.0.2', 'dart_matcher_tag': '0.12.3', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 0f9ecc24eab60..3155d3f2711f3 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 8d4516e66578b0887482c63865d1ef78 +Signature: bab57131714504d8735f525bec6946b7 UNUSED LICENSES: @@ -5452,6 +5452,7 @@ 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 From f3ef31aa8c2c15adc0da3da07b675e7ac3f9e4b4 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Fri, 14 Sep 2018 08:09:49 -0400 Subject: [PATCH 112/134] Roll src/third_party/skia 46a5f6c28a34..637c06aec7b1 (1 commits) (#6246) https://skia.googlesource.com/skia.git/+log/46a5f6c28a34..637c06aec7b1 Created with: gclient setdep -r src/third_party/skia@637c06aec7b1 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 612238126c41a..4a19a9b033b0b 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '46a5f6c28a34feeabab8f3256bcfc006c2f225f5', + 'skia_revision': '637c06aec7b1f424c15db74639e8ed3a6759163b', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6857f4787dea0..44f707cccb30c 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 9172d63708dc001f48198ed2e2745964 +Signature: c73e821c0663a977f80a79857cb14e84 UNUSED LICENSES: From ade2d1d04cca762aededb85e649d75a841242100 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Fri, 14 Sep 2018 08:32:17 -0400 Subject: [PATCH 113/134] Roll src/third_party/skia 637c06aec7b1..66261f1ac2b7 (29 commits) (#6251) https://skia.googlesource.com/skia.git/+log/637c06aec7b1..66261f1ac2b7 Created with: gclient setdep -r src/third_party/skia@66261f1ac2b7 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4a19a9b033b0b..eae2673e82013 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '637c06aec7b1f424c15db74639e8ed3a6759163b', + 'skia_revision': '66261f1ac2b743b9f7808277ae2e8709238a8d42', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 44f707cccb30c..6bdbebfd65571 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: c73e821c0663a977f80a79857cb14e84 +Signature: 8ed6cf53af997d9ca12acc3f132a0a3d UNUSED LICENSES: @@ -1529,12 +1529,21 @@ 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/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 From 7a9b430d740b9a7ae4d9a6d44357d83561e1124d Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Fri, 14 Sep 2018 11:56:18 -0400 Subject: [PATCH 114/134] Roll src/third_party/skia 66261f1ac2b7..7724d3f4949b (3 commits) (#6252) https://skia.googlesource.com/skia.git/+log/66261f1ac2b7..7724d3f4949b Created with: gclient setdep -r src/third_party/skia@7724d3f4949b The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index eae2673e82013..31b5ea52cc2df 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '66261f1ac2b743b9f7808277ae2e8709238a8d42', + 'skia_revision': '7724d3f4949b9b43e99764acc9fcd6f43872d12c', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 6bdbebfd65571..7f799042d7bea 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8ed6cf53af997d9ca12acc3f132a0a3d +Signature: b0d224dbe1bddd5c441cee3e8f9d1562 UNUSED LICENSES: @@ -1524,6 +1524,9 @@ 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/GrGradientShader.cpp FILE: ../../../third_party/skia/src/gpu/gradients/GrGradientShader.h FILE: ../../../third_party/skia/src/gpu/gradients/GrLinearGradientLayout.cpp From 272be27f707308c410ecebfc0870c5a4793ab610 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Fri, 14 Sep 2018 09:10:59 -0700 Subject: [PATCH 115/134] update live region to trigger on label change, remove manual trigger (#6248) --- .../io/flutter/view/AccessibilityBridge.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/shell/platform/android/io/flutter/view/AccessibilityBridge.java index 807e46b2a9bd1..0870a59c00201 100644 --- a/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -733,8 +733,12 @@ void updateSemantics(ByteBuffer buffer, String[] strings) { } 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 @@ -865,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; - } } } From 60bb5da33c72ac91d4ec7033a9d72fdcdf4c8450 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Fri, 14 Sep 2018 09:36:13 -0700 Subject: [PATCH 116/134] Reapply "Some cleanups enabled by removing support for Dart 1" (#6250) Following fixes in dart-lang/sdk@91cbb57cd5cd012d5aa66bfb6eb3a1306271f431 --- common/settings.cc | 1 - common/settings.h | 3 - lib/snapshot/BUILD.gn | 341 ++++++++---------- runtime/dart_isolate.cc | 140 +------ runtime/dart_isolate.h | 16 +- runtime/dart_isolate_unittests.cc | 66 ---- runtime/dart_service_isolate.cc | 168 +-------- runtime/dart_service_isolate.h | 14 - runtime/dart_vm.cc | 61 +--- runtime/dart_vm.h | 3 - runtime/dart_vm_unittests.cc | 1 - shell/common/engine.cc | 5 - shell/common/engine.h | 3 - shell/common/isolate_configuration.cc | 71 +--- shell/common/isolate_configuration.h | 8 +- shell/common/shell.cc | 8 +- shell/common/switches.cc | 3 - shell/common/switches.h | 1 - shell/platform/android/flutter_main.cc | 5 - .../android/io/flutter/view/FlutterMain.java | 14 +- .../android/platform_view_android_jni.cc | 7 +- .../framework/Source/FlutterDartProject.mm | 27 -- shell/platform/embedder/embedder.cc | 7 +- shell/testing/observatory/test.dart | 3 +- shell/testing/tester_main.cc | 9 +- 25 files changed, 206 insertions(+), 779 deletions(-) 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/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn index 45fe883b324a9..2370f50656916 100644 --- a/lib/snapshot/BUILD.gn +++ b/lib/snapshot/BUILD.gn @@ -25,203 +25,146 @@ 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" - } - } else { - snapshot_dart = "snapshot.dart" - snapshot_kind = "core" - } +# Fuchsia's snapshot requires a different platform with extra dart: libraries. +if (!is_fuchsia) { + compiled_action("generate_snapshot_bin") { + tool = "//third_party/dart/runtime/bin:gen_snapshot" - deps = [ - ":generate_dart_ui", - "//third_party/dart/runtime/bin:gen_snapshot($host_toolchain)", - ] - 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" ] - } + platform_kernel = "$root_out_dir/flutter_patched_sdk/platform_strong.dill" + inputs = [ + platform_kernel, + ] + deps = [ + ":kernel_platform_files", + ] - vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin" - vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin" - isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin" - isolate_snapshot_instructions = - "$target_gen_dir/isolate_snapshot_instructions.bin" - outputs = [ - vm_snapshot_data, - vm_snapshot_instructions, - isolate_snapshot_data, - isolate_snapshot_instructions, - ] + vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin" + vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin" + isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin" + isolate_snapshot_instructions = + "$target_gen_dir/isolate_snapshot_instructions.bin" + outputs = [ + vm_snapshot_data, + vm_snapshot_instructions, + isolate_snapshot_data, + isolate_snapshot_instructions, + ] - rebased_dart_ui_path = rebase_path(dart_ui_path) + args = [ + "--strong", + "--sync-async", + "--reify-generic-functions", + "--snapshot_kind=core", + "--await_is_keyword", + "--enable_mirrors=false", + "--vm_snapshot_data=" + rebase_path(vm_snapshot_data), + "--vm_snapshot_instructions=" + rebase_path(vm_snapshot_instructions), + "--isolate_snapshot_data=" + rebase_path(isolate_snapshot_data), + "--isolate_snapshot_instructions=" + + rebase_path(isolate_snapshot_instructions), + rebase_path(platform_kernel), + ] - 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" + if (is_debug) { + args += [ + "--enable_asserts", + "--enable_type_checks", + "--error_on_bad_type", + "--error_on_bad_override", + ] + } + } - args = [ - "--executable", - rebase_path("$gen_snapshot_dir/gen_snapshot"), - "--script", - rebase_path(snapshot_dart), - "--snapshot_kind", - snapshot_kind, - "--vm_flag", - "--await_is_keyword", - "--vm_flag", - "--enable_mirrors=false", - "--vm_flag", - "--no-strong", - "--vm_flag", - "--no-sync-async", - "--vm_flag", - "--no-reify-generic-functions", - "--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), - ] + # Generates an assembly file defining a given symbol with the bytes from a + # binary file. Places the symbol in a text section if 'executable' is true, + # otherwise places the symbol in a read-only data section. + template("bin_to_assembly") { + assert(defined(invoker.deps), "Must define deps") + assert(defined(invoker.input), "Must define input binary file") + assert(defined(invoker.output), "Must define output assembly file") + assert(defined(invoker.symbol), "Must define symbol name") + assert(defined(invoker.executable), "Must define boolean executable") + + action(target_name) { + deps = invoker.deps + script = "//third_party/dart/runtime/tools/bin_to_assembly.py" + args = [ + "--input", + rebase_path(invoker.input), + "--output", + rebase_path(invoker.output), + "--symbol_name", + invoker.symbol, + "--target_os", + current_os, + ] + if (invoker.executable) { + args += [ "--executable" ] + } + inputs = [ + script, + invoker.input, + ] + outputs = [ + invoker.output, + ] + } + } - 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", + bin_to_assembly("vm_snapshot_data_assembly") { + deps = [ + ":generate_snapshot_bin", ] + input = "$target_gen_dir/vm_isolate_snapshot.bin" + output = "$target_gen_dir/vm_snapshot_data.S" + symbol = "kDartVmSnapshotData" + executable = false } - 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"), + bin_to_assembly("vm_snapshot_instructions_assembly") { + deps = [ + ":generate_snapshot_bin", ] + input = "$target_gen_dir/vm_snapshot_instructions.bin" + output = "$target_gen_dir/vm_snapshot_instructions.S" + symbol = "kDartVmSnapshotInstructions" + executable = true } -} -# Generates an assembly file defining a given symbol with the bytes from a -# binary file. Places the symbol in a text section if 'executable' is true, -# otherwise places the symbol in a read-only data section. -template("bin_to_assembly") { - assert(defined(invoker.deps), "Must define deps") - assert(defined(invoker.input), "Must define input binary file") - assert(defined(invoker.output), "Must define output assembly file") - assert(defined(invoker.symbol), "Must define symbol name") - assert(defined(invoker.executable), "Must define boolean executable") - - action(target_name) { - deps = invoker.deps - script = "//third_party/dart/runtime/tools/bin_to_assembly.py" - args = [ - "--input", - rebase_path(invoker.input), - "--output", - rebase_path(invoker.output), - "--symbol_name", - invoker.symbol, - "--target_os", - current_os, - ] - if (invoker.executable) { - args += [ "--executable" ] - } - inputs = [ - script, - invoker.input, - ] - outputs = [ - invoker.output, + bin_to_assembly("isolate_snapshot_data_assembly") { + deps = [ + ":generate_snapshot_bin", ] + input = "$target_gen_dir/isolate_snapshot.bin" + output = "$target_gen_dir/isolate_snapshot_data.S" + symbol = "kDartIsolateSnapshotData" + executable = false } -} - -bin_to_assembly("vm_snapshot_data_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/vm_isolate_snapshot.bin" - output = "$target_gen_dir/vm_snapshot_data.S" - symbol = "kDartVmSnapshotData" - executable = false -} - -bin_to_assembly("vm_snapshot_instructions_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/vm_snapshot_instructions.bin" - output = "$target_gen_dir/vm_snapshot_instructions.S" - symbol = "kDartVmSnapshotInstructions" - executable = true -} - -bin_to_assembly("isolate_snapshot_data_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/isolate_snapshot.bin" - output = "$target_gen_dir/isolate_snapshot_data.S" - symbol = "kDartIsolateSnapshotData" - executable = false -} -bin_to_assembly("isolate_snapshot_instructions_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/isolate_snapshot_instructions.bin" - output = "$target_gen_dir/isolate_snapshot_instructions.S" - symbol = "kDartIsolateSnapshotInstructions" - executable = true -} + bin_to_assembly("isolate_snapshot_instructions_assembly") { + deps = [ + ":generate_snapshot_bin", + ] + input = "$target_gen_dir/isolate_snapshot_instructions.bin" + output = "$target_gen_dir/isolate_snapshot_instructions.S" + symbol = "kDartIsolateSnapshotInstructions" + executable = true + } -source_set("snapshot") { - deps = [ - ":isolate_snapshot_data_assembly", - ":isolate_snapshot_instructions_assembly", - ":vm_snapshot_data_assembly", - ":vm_snapshot_instructions_assembly", - ] - sources = [ - "$target_gen_dir/isolate_snapshot_data.S", - "$target_gen_dir/isolate_snapshot_instructions.S", - "$target_gen_dir/vm_snapshot_data.S", - "$target_gen_dir/vm_snapshot_instructions.S", - ] + source_set("snapshot") { + deps = [ + ":isolate_snapshot_data_assembly", + ":isolate_snapshot_instructions_assembly", + ":vm_snapshot_data_assembly", + ":vm_snapshot_instructions_assembly", + ] + sources = [ + "$target_gen_dir/isolate_snapshot_data.S", + "$target_gen_dir/isolate_snapshot_instructions.S", + "$target_gen_dir/vm_snapshot_data.S", + "$target_gen_dir/vm_snapshot_instructions.S", + ] + } } compile_platform("non_strong_platform") { @@ -288,25 +231,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 = [ - "--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), - ] + "--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/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 b0c9d355a2159..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,30 +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* kDartModeArgs[] = { - // clang-format off - "--no-strong", - "--no-reify_generic_functions", - "--no-sync_async", - // clang-format on -}; - -static const char* kDart2ModeArgs[] = { - // clang-format off - "--strong", - "--reify_generic_functions", - "--sync_async", - // clang-format on -}; - static const char* kDartStartPausedArgs[]{ "--pause_isolates_on_start", }; @@ -318,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: " @@ -376,32 +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, kDart2ModeArgs, arraysize(kDart2ModeArgs)); - if (use_checked_mode) { - PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); - } - } else { - PushBackAll(&args, kDartModeArgs, arraysize(kDartModeArgs)); - if (use_checked_mode) { - FML_DLOG(INFO) << "Checked mode is ON"; - PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); - PushBackAll(&args, kDartCheckedModeArgs, arraysize(kDartCheckedModeArgs)); - } else { - FML_DLOG(INFO) << "Is not Dart 2 and Checked mode is OFF"; - } + if (use_checked_mode) { + PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); } if (settings.start_paused) { @@ -496,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_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/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/shell.cc b/shell/common/shell.cc index 59272e11c0539..7d434cb055be4 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -875,12 +875,8 @@ bool Shell::OnServiceProtocolRunInView( auto main_script_file_mapping = 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_path, - packages_path); + auto isolate_configuration = IsolateConfiguration::CreateForKernel( + std::move(main_script_file_mapping)); RunConfiguration configuration(std::move(isolate_configuration)); 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/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/view/FlutterMain.java b/shell/platform/android/io/flutter/view/FlutterMain.java index 49d3b01707633..198bcade69ae8 100644 --- a/shell/platform/android/io/flutter/view/FlutterMain.java +++ b/shell/platform/android/io/flutter/view/FlutterMain.java @@ -31,7 +31,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 @@ -47,8 +46,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; @@ -59,9 +56,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. @@ -79,7 +74,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; @@ -248,7 +242,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) { @@ -268,13 +261,11 @@ private static void initResources(Context applicationContext) { 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); @@ -283,8 +274,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/platform_view_android_jni.cc b/shell/platform/android/platform_view_android_jni.cc index 6dd4b9ab3350a..d93f9357144a6 100644 --- a/shell/platform/android/platform_view_android_jni.cc +++ b/shell/platform/android/platform_view_android_jni.cc @@ -217,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; }; @@ -228,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(); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index 8ef42bf83968c..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) { @@ -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,12 +175,6 @@ - (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; - } } } diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 184f63e639edf..d0a87703b9c9b 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -277,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; 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 = ""; From 24d94601b906e3f23b26330a120533eb3d7983ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Crelier?= Date: Fri, 14 Sep 2018 11:18:34 -0700 Subject: [PATCH 117/134] Roll Dart to bb56d4592f7cde38cdf0a04ad7f40d105af99d11 (#6253) * bb56d4592f Fix receiver type for js-interop access 8dea9aa45e Share inlining cache between members 272473b77e Remove getters allowing access to all enclosing type parameter types. f5ec9b0554 This CL changes some status comments, but also points out an issue. a16c7d899a Fix typo in mixin test. cea39db6e2 Perform instance member inference for mixins. 65b390ca83 Simplify summary resynthesis tests ca8e5baccd Fix #34443 fix tests that will fail with int2double 0e878dd6db Fix several inferred type summary tests. 1397fd9342 Fix test_variable_final_top_level_untyped. 61096acab3 Improve analyzer/fasta error code matching 1a8b1bfd24 Fix test_bottom_reference_shared. 7bc5c551cd Fix test test_implicit_dependencies_follow_other_dependencies. 49da026e3e Report error for `extends void` type parameters 3cf61aee33 Fix #34444, rounded doubles in double literals test 260ea4b591 Add an option to use one-phase summaries. 7c5b3dc485 [vm/tfa] Pass receiver type into field initializer summaries. cd26b889e1 linter 0.1.62 8e4933c172 Tests for ClassElement.allSupertypes for mixins. a48120aabd Wire up placeholder executable in pkg/analyzer_fe_comparison. * update licenses --- DEPS | 4 ++-- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 31b5ea52cc2df..02616660a3d2d 100644 --- a/DEPS +++ b/DEPS @@ -31,7 +31,7 @@ vars = { # Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS. # You can use //tools/dart/create_updated_flutter_deps.py to produce # updated revision list of existing dependencies. - 'dart_revision': 'c28db2d6e17f046f95db5987394df43c95d58468', + 'dart_revision': 'bb56d4592f7cde38cdf0a04ad7f40d105af99d11', 'dart_args_tag': '1.4.4', 'dart_async_tag': '2.0.8', @@ -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.61', + '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', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 3155d3f2711f3..ee2a474a80037 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: bab57131714504d8735f525bec6946b7 +Signature: d2753c18f5888758e87aa10c270fa760 UNUSED LICENSES: From a0dff815e1cda538eb0aba4f272cd087e16f288d Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Fri, 14 Sep 2018 11:29:51 -0700 Subject: [PATCH 118/134] Update test and license scripts for Dart SDK 2.1.0 (#6254) --- testing/dart/canvas_test.dart | 24 ++++++++++++------------ testing/dart/pubspec.yaml | 4 ++-- testing/run_tests.sh | 2 +- tools/licenses/pubspec.yaml | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/testing/dart/canvas_test.dart b/testing/dart/canvas_test.dart index 714e3413cb09f..0bcdbccff9ea4 100644 --- a/testing/dart/canvas_test.dart +++ b/testing/dart/canvas_test.dart @@ -29,9 +29,9 @@ void main() { 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); + 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); + Offset offset = new Offset(double.nan, double.nan); Path path = new Path(); try { new Canvas(null, null); } catch (error) { } @@ -53,7 +53,7 @@ void main() { 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.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)); @@ -72,24 +72,24 @@ void main() { testCanvas((Canvas canvas) => canvas.drawRawPoints(fake, list, 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.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.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.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.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/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/run_tests.sh b/testing/run_tests.sh index 7baf91d29b711..5f4d7c54a47fa 100755 --- a/testing/run_tests.sh +++ b/testing/run_tests.sh @@ -2,7 +2,7 @@ set -ex -out/host_debug_unopt/fxl_unittests +out/host_debug_unopt/fml_unittests out/host_debug_unopt/synchronization_unittests flutter/ci/analyze.sh 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 From e817f2d98cc0afbccef8f5da1fb4cd0899640701 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Fri, 14 Sep 2018 15:23:17 -0400 Subject: [PATCH 119/134] Roll src/third_party/skia 7724d3f4949b..7b617a7fc85d (6 commits) (#6255) https://skia.googlesource.com/skia.git/+log/7724d3f4949b..7b617a7fc85d Created with: gclient setdep -r src/third_party/skia@7b617a7fc85d The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 02616660a3d2d..4e0dfd7fb4a75 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '7724d3f4949b9b43e99764acc9fcd6f43872d12c', + 'skia_revision': '7b617a7fc85db973fc15e225c56a4da05f564e36', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 7f799042d7bea..1471a4e7389d7 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b0d224dbe1bddd5c441cee3e8f9d1562 +Signature: df6172050acff69f2268723bb4859d7c UNUSED LICENSES: @@ -1527,6 +1527,8 @@ 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 @@ -1541,6 +1543,9 @@ FILE: ../../../third_party/skia/src/gpu/gradients/GrSingleIntervalGradientColori 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 From b43b3e87022b86c56805898e47109730fbce9e7f Mon Sep 17 00:00:00 2001 From: liyuqian Date: Fri, 14 Sep 2018 15:13:00 -0700 Subject: [PATCH 120/134] Remove LayerBuilder and DefaultLayerBuilder (#6256) This essentially reverts https://github.com/flutter/engine/pull/4197/ as no one is (or soon will be) implementing an alternative LayerBuilder. Let's just put everything in SceneBuilder to reduce the YAGNI (you aren't gonna need it) smell. This will also make retained rendering API changes much easier. --- ci/licenses_golden/licenses_flutter | 4 - flow/BUILD.gn | 4 - flow/layers/default_layer_builder.cc | 235 --------------------------- flow/layers/default_layer_builder.h | 104 ------------ flow/layers/layer_builder.cc | 42 ----- flow/layers/layer_builder.h | 108 ------------ lib/ui/compositing/scene_builder.cc | 215 ++++++++++++++++++------ lib/ui/compositing/scene_builder.h | 15 +- 8 files changed, 180 insertions(+), 547 deletions(-) delete mode 100644 flow/layers/default_layer_builder.cc delete mode 100644 flow/layers/default_layer_builder.h delete mode 100644 flow/layers/layer_builder.cc delete mode 100644 flow/layers/layer_builder.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index f697e110945bb..600bd350394a3 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -248,10 +248,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 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/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_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/lib/ui/compositing/scene_builder.cc b/lib/ui/compositing/scene_builder.cc index 61a3c60ddee3e..81414b96a9a9a 100644 --- a/lib/ui/compositing/scene_builder.cc +++ b/lib/ui/compositing/scene_builder.cc @@ -4,6 +4,21 @@ #include "flutter/lib/ui/compositing/scene_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" #include "flutter/fml/build_config.h" #include "flutter/lib/ui/painting/matrix.h" #include "flutter/lib/ui/painting/shader.h" @@ -51,12 +66,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 +95,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 +154,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 +219,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 +237,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 +258,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 From 45696e72f6877403e0a2f6f4ea215fd794fddeff Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Fri, 14 Sep 2018 18:48:17 -0400 Subject: [PATCH 121/134] Roll src/third_party/skia 7b617a7fc85d..afebe1614e5e (8 commits) (#6258) https://skia.googlesource.com/skia.git/+log/7b617a7fc85d..afebe1614e5e Created with: gclient setdep -r src/third_party/skia@afebe1614e5e The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/DEPS b/DEPS index 4e0dfd7fb4a75..d6349ea541966 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '7b617a7fc85db973fc15e225c56a4da05f564e36', + 'skia_revision': 'afebe1614e5e5964a13f3083b66925df79a92a32', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 1471a4e7389d7..3951614aa9016 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: df6172050acff69f2268723bb4859d7c +Signature: b2aab89230c83ed1b9a73c02b71dd5d2 UNUSED LICENSES: @@ -3189,8 +3189,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 @@ -5199,8 +5197,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. From aaef8ebdf140a1af78546320e90f86b2904b4daa Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Sat, 15 Sep 2018 01:22:17 -0400 Subject: [PATCH 122/134] Roll src/third_party/skia afebe1614e5e..8e73f4b6bbef (1 commits) (#6265) https://skia.googlesource.com/skia.git/+log/afebe1614e5e..8e73f4b6bbef Created with: gclient setdep -r src/third_party/skia@8e73f4b6bbef The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index d6349ea541966..92ed9b1b233cc 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'afebe1614e5e5964a13f3083b66925df79a92a32', + 'skia_revision': '8e73f4b6bbef45ddb4b7eddb20a9e599e072d0e1', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 3951614aa9016..831b13641f1ef 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b2aab89230c83ed1b9a73c02b71dd5d2 +Signature: b6cee600ab2d4af62945c41184f1b448 UNUSED LICENSES: From d212e84b7dc8e7ed24cd4e51fcb1c8b418dfc847 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Sat, 15 Sep 2018 12:56:17 -0400 Subject: [PATCH 123/134] Roll src/third_party/skia 8e73f4b6bbef..840debe9c748 (1 commits) (#6267) https://skia.googlesource.com/skia.git/+log/8e73f4b6bbef..840debe9c748 Created with: gclient setdep -r src/third_party/skia@840debe9c748 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 92ed9b1b233cc..7220919af3e54 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '8e73f4b6bbef45ddb4b7eddb20a9e599e072d0e1', + 'skia_revision': '840debe9c748d1567fd307e70ad8f21ed7ff25b1', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 831b13641f1ef..36945d7d6fd00 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: b6cee600ab2d4af62945c41184f1b448 +Signature: 8ef333fb5cf80b069ac715c138e5906c UNUSED LICENSES: From 72665c6827a566e626bde75a4289609fb65ac657 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Sun, 16 Sep 2018 04:56:17 -0400 Subject: [PATCH 124/134] Roll src/third_party/skia 840debe9c748..098c1355bf70 (1 commits) (#6268) https://skia.googlesource.com/skia.git/+log/840debe9c748..098c1355bf70 Created with: gclient setdep -r src/third_party/skia@098c1355bf70 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 7220919af3e54..76b36f2153d7d 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '840debe9c748d1567fd307e70ad8f21ed7ff25b1', + 'skia_revision': '098c1355bf7081632d03954714201bbdd7701983', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index 36945d7d6fd00..a8b09be5dc2d4 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 8ef333fb5cf80b069ac715c138e5906c +Signature: 80a63efa3b30fe7a5a052cb2fded2558 UNUSED LICENSES: From 83b0e299a566739b4add93a684aff0657930a19f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Mon, 17 Sep 2018 06:35:17 -0400 Subject: [PATCH 125/134] Roll src/third_party/skia 098c1355bf70..060e992ef5b8 (1 commits) (#6269) https://skia.googlesource.com/skia.git/+log/098c1355bf70..060e992ef5b8 Created with: gclient setdep -r src/third_party/skia@060e992ef5b8 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 76b36f2153d7d..961ca7fa187ad 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '098c1355bf7081632d03954714201bbdd7701983', + 'skia_revision': '060e992ef5b85d5db021bfc8aad78945da75bf59', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index a8b09be5dc2d4..cf11e961d0490 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 80a63efa3b30fe7a5a052cb2fded2558 +Signature: 50b3d2570775ed8879ed4580b0909186 UNUSED LICENSES: From 1b2a2075a9360364a0571d965254b90f26f790a9 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 17 Sep 2018 09:28:11 -0700 Subject: [PATCH 126/134] Update engine tests for Dart 2 compilation and language changes (#6262) --- testing/dart/canvas_test.dart | 91 ++++++++----------- testing/dart/codec_test.dart | 2 +- testing/dart/isolate_name_server_test.dart | 2 +- .../dart/window_hooks_integration_test.dart | 4 + testing/run_tests.sh | 14 ++- 5 files changed, 54 insertions(+), 59 deletions(-) diff --git a/testing/dart/canvas_test.dart b/testing/dart/canvas_test.dart index 0bcdbccff9ea4..8ab5581317730 100644 --- a/testing/dart/canvas_test.dart +++ b/testing/dart/canvas_test.dart @@ -3,92 +3,79 @@ // 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.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(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.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.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.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.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.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.transform(null)); 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/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 5f4d7c54a47fa..69f5b9689d5c8 100755 --- a/testing/run_tests.sh +++ b/testing/run_tests.sh @@ -5,18 +5,22 @@ set -ex 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 From b0b19d6ce1d23a5ca766ecc08199df1e27028d43 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 17 Sep 2018 10:07:47 -0700 Subject: [PATCH 127/134] Fix the frontend_server test (#6261) --- frontend_server/lib/server.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend_server/lib/server.dart b/frontend_server/lib/server.dart index 572087e9d186e..37f61d039a940 100644 --- a/frontend_server/lib/server.dart +++ b/frontend_server/lib/server.dart @@ -78,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 { From ba7752917f3081fd6b4e10d8ef6cecbdfe59a985 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 17 Sep 2018 11:43:41 -0700 Subject: [PATCH 128/134] Ensure that Layer::AutoSaveLayer objects are not immediately destructed (#6264) Fixes https://github.com/flutter/flutter/issues/20859 --- flow/layers/backdrop_filter_layer.cc | 5 +++-- flow/layers/color_filter_layer.cc | 3 ++- flow/layers/layer.cc | 13 +++++++++++++ flow/layers/layer.h | 16 +++++++++++++--- flow/layers/opacity_layer.cc | 3 ++- flow/layers/shader_mask_layer.cc | 3 ++- 6 files changed, 35 insertions(+), 8 deletions(-) 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/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/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 173c2890b6ae8..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" @@ -67,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); @@ -74,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/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/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; From dcbc8a820733f1e613ffdaad3cf1ab57d6337632 Mon Sep 17 00:00:00 2001 From: Alexander Markov Date: Mon, 17 Sep 2018 12:06:11 -0700 Subject: [PATCH 129/134] Roll Dart to 050561fd82be5e775316223c9d2d9e7e5e596c8e (#6271) dart-lang/sdk@050561f [vm] Relax recently added assertion in Dart 1 mode dart-lang/sdk@6c712f1 Add a fix to create a mixin dart-lang/sdk@cc08d0e Add operators `&`, `|` and `^` to `bool`. dart-lang/sdk@5af9844 Language specification reorganization. dart-lang/sdk@2cb2ac4 Optimize `ClassHierarchyBuilder.isInheritedInSubtypeOf`. dart-lang/sdk@e8880fd Fix handling of unary- in the analyzer/FE comparison tool. dart-lang/sdk@bd103eb Store unlinked data with unlinked salt. dart-lang/sdk@c5d77d1 Support mixins in more places in index and search. dart-lang/sdk@c3bdb6c Refactor summary resynthesis tests in preparation for using the one-phase summary API. dart-lang/sdk@ddcb8b7 Remove unused SubtypeManager. dart-lang/sdk@76091c1 [vm/bytecode] Add PushNull, PushTrue, PushFalse and PushInt bytecodes dart-lang/sdk@a80b13e Add an assist to convert from a class to a mixin dart-lang/sdk@0f45b2e Fix spelling hexidecimal -> hexadecimal dart-lang/sdk@348ed30 [vm/kernel] In async transformation check if strongMode is on. dart-lang/sdk@c6c4748 [vm/bytecode] Bytecode compilation dart-lang/sdk@78d9a28 [vm, arm] Globally block LR for register allocation. dart-lang/sdk@078be2c [vm] Add library private key to the Class hash function for reload. dart-lang/sdk@4fab565 Several minor fixes to the analyzer/FE comparison tool. dart-lang/sdk@eb96871 Compute unlinked API signatures without unlinked summaries. dart-lang/sdk@98d25ed fix #34450, implement boolean bitwise operators in dartdevc dart-lang/sdk@229d793 [vm/compiler] Support materializing unboxed variables when entering catch. dart-lang/sdk@eec96f9 [vm/kernel] Preserve strong mode types in async transformation dart-lang/sdk@bf4facd Handle errors when comparing analyzer and front end behaviors. dart-lang/sdk@3e9f4e6 dart2js: generate simple '==' in more cases --- DEPS | 2 +- ci/licenses_golden/licenses_third_party | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 961ca7fa187ad..a8f419a910f1d 100644 --- a/DEPS +++ b/DEPS @@ -31,7 +31,7 @@ vars = { # Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS. # You can use //tools/dart/create_updated_flutter_deps.py to produce # updated revision list of existing dependencies. - 'dart_revision': 'bb56d4592f7cde38cdf0a04ad7f40d105af99d11', + 'dart_revision': '050561fd82be5e775316223c9d2d9e7e5e596c8e', 'dart_args_tag': '1.4.4', 'dart_async_tag': '2.0.8', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index ee2a474a80037..0524887254ca9 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: d2753c18f5888758e87aa10c270fa760 +Signature: 23f7e8d39ec24c9954fd6a342b83e480 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 @@ -5466,6 +5468,8 @@ 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 From dbfa8276d471d567e1f57d2a4d74685e7cdf55d0 Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Mon, 17 Sep 2018 15:42:42 -0700 Subject: [PATCH 130/134] [fuchsia] Fixes for the Fuchsia build (#6273) --- lib/snapshot/BUILD.gn | 273 +++++++++++++++------------- lib/ui/compositing/scene_builder.cc | 3 + 2 files changed, 145 insertions(+), 131 deletions(-) diff --git a/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn index 2370f50656916..b7b1f0c7aae0e 100644 --- a/lib/snapshot/BUILD.gn +++ b/lib/snapshot/BUILD.gn @@ -25,148 +25,150 @@ copy("generate_dart_ui") { ] } -# Fuchsia's snapshot requires a different platform with extra dart: libraries. -if (!is_fuchsia) { - compiled_action("generate_snapshot_bin") { - tool = "//third_party/dart/runtime/bin:gen_snapshot" +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 { platform_kernel = "$root_out_dir/flutter_patched_sdk/platform_strong.dill" - inputs = [ - platform_kernel, - ] - deps = [ - ":kernel_platform_files", - ] - - vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin" - vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin" - isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin" - isolate_snapshot_instructions = - "$target_gen_dir/isolate_snapshot_instructions.bin" - outputs = [ - vm_snapshot_data, - vm_snapshot_instructions, - isolate_snapshot_data, - isolate_snapshot_instructions, - ] - - args = [ - "--strong", - "--sync-async", - "--reify-generic-functions", - "--snapshot_kind=core", - "--await_is_keyword", - "--enable_mirrors=false", - "--vm_snapshot_data=" + rebase_path(vm_snapshot_data), - "--vm_snapshot_instructions=" + rebase_path(vm_snapshot_instructions), - "--isolate_snapshot_data=" + rebase_path(isolate_snapshot_data), - "--isolate_snapshot_instructions=" + - rebase_path(isolate_snapshot_instructions), - rebase_path(platform_kernel), - ] - - if (is_debug) { - args += [ - "--enable_asserts", - "--enable_type_checks", - "--error_on_bad_type", - "--error_on_bad_override", - ] - } } - # Generates an assembly file defining a given symbol with the bytes from a - # binary file. Places the symbol in a text section if 'executable' is true, - # otherwise places the symbol in a read-only data section. - template("bin_to_assembly") { - assert(defined(invoker.deps), "Must define deps") - assert(defined(invoker.input), "Must define input binary file") - assert(defined(invoker.output), "Must define output assembly file") - assert(defined(invoker.symbol), "Must define symbol name") - assert(defined(invoker.executable), "Must define boolean executable") - - action(target_name) { - deps = invoker.deps - script = "//third_party/dart/runtime/tools/bin_to_assembly.py" - args = [ - "--input", - rebase_path(invoker.input), - "--output", - rebase_path(invoker.output), - "--symbol_name", - invoker.symbol, - "--target_os", - current_os, - ] - if (invoker.executable) { - args += [ "--executable" ] - } - inputs = [ - script, - invoker.input, - ] - outputs = [ - invoker.output, - ] - } - } + inputs = [ + platform_kernel, + ] + deps = [ + ":kernel_platform_files", + ] - bin_to_assembly("vm_snapshot_data_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/vm_isolate_snapshot.bin" - output = "$target_gen_dir/vm_snapshot_data.S" - symbol = "kDartVmSnapshotData" - executable = false - } + vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin" + vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin" + isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin" + isolate_snapshot_instructions = + "$target_gen_dir/isolate_snapshot_instructions.bin" + outputs = [ + vm_snapshot_data, + vm_snapshot_instructions, + isolate_snapshot_data, + isolate_snapshot_instructions, + ] - bin_to_assembly("vm_snapshot_instructions_assembly") { - deps = [ - ":generate_snapshot_bin", - ] - input = "$target_gen_dir/vm_snapshot_instructions.bin" - output = "$target_gen_dir/vm_snapshot_instructions.S" - symbol = "kDartVmSnapshotInstructions" - executable = true - } + args = [ + "--strong", + "--sync-async", + "--reify-generic-functions", + "--snapshot_kind=core", + "--await_is_keyword", + "--enable_mirrors=false", + "--vm_snapshot_data=" + rebase_path(vm_snapshot_data), + "--vm_snapshot_instructions=" + rebase_path(vm_snapshot_instructions), + "--isolate_snapshot_data=" + rebase_path(isolate_snapshot_data), + "--isolate_snapshot_instructions=" + + rebase_path(isolate_snapshot_instructions), + rebase_path(platform_kernel), + ] - bin_to_assembly("isolate_snapshot_data_assembly") { - deps = [ - ":generate_snapshot_bin", + if (is_debug) { + args += [ + "--enable_asserts", + "--enable_type_checks", + "--error_on_bad_type", + "--error_on_bad_override", ] - input = "$target_gen_dir/isolate_snapshot.bin" - output = "$target_gen_dir/isolate_snapshot_data.S" - symbol = "kDartIsolateSnapshotData" - executable = false } +} - bin_to_assembly("isolate_snapshot_instructions_assembly") { - deps = [ - ":generate_snapshot_bin", +# Generates an assembly file defining a given symbol with the bytes from a +# binary file. Places the symbol in a text section if 'executable' is true, +# otherwise places the symbol in a read-only data section. +template("bin_to_assembly") { + assert(defined(invoker.deps), "Must define deps") + assert(defined(invoker.input), "Must define input binary file") + assert(defined(invoker.output), "Must define output assembly file") + assert(defined(invoker.symbol), "Must define symbol name") + assert(defined(invoker.executable), "Must define boolean executable") + + action(target_name) { + deps = invoker.deps + script = "//third_party/dart/runtime/tools/bin_to_assembly.py" + args = [ + "--input", + rebase_path(invoker.input), + "--output", + rebase_path(invoker.output), + "--symbol_name", + invoker.symbol, + "--target_os", + current_os, ] - input = "$target_gen_dir/isolate_snapshot_instructions.bin" - output = "$target_gen_dir/isolate_snapshot_instructions.S" - symbol = "kDartIsolateSnapshotInstructions" - executable = true - } - - source_set("snapshot") { - deps = [ - ":isolate_snapshot_data_assembly", - ":isolate_snapshot_instructions_assembly", - ":vm_snapshot_data_assembly", - ":vm_snapshot_instructions_assembly", + if (invoker.executable) { + args += [ "--executable" ] + } + inputs = [ + script, + invoker.input, ] - sources = [ - "$target_gen_dir/isolate_snapshot_data.S", - "$target_gen_dir/isolate_snapshot_instructions.S", - "$target_gen_dir/vm_snapshot_data.S", - "$target_gen_dir/vm_snapshot_instructions.S", + outputs = [ + invoker.output, ] } } +bin_to_assembly("vm_snapshot_data_assembly") { + deps = [ + ":generate_snapshot_bin", + ] + input = "$target_gen_dir/vm_isolate_snapshot.bin" + output = "$target_gen_dir/vm_snapshot_data.S" + symbol = "kDartVmSnapshotData" + executable = false +} + +bin_to_assembly("vm_snapshot_instructions_assembly") { + deps = [ + ":generate_snapshot_bin", + ] + input = "$target_gen_dir/vm_snapshot_instructions.bin" + output = "$target_gen_dir/vm_snapshot_instructions.S" + symbol = "kDartVmSnapshotInstructions" + executable = true +} + +bin_to_assembly("isolate_snapshot_data_assembly") { + deps = [ + ":generate_snapshot_bin", + ] + input = "$target_gen_dir/isolate_snapshot.bin" + output = "$target_gen_dir/isolate_snapshot_data.S" + symbol = "kDartIsolateSnapshotData" + executable = false +} + +bin_to_assembly("isolate_snapshot_instructions_assembly") { + deps = [ + ":generate_snapshot_bin", + ] + input = "$target_gen_dir/isolate_snapshot_instructions.bin" + output = "$target_gen_dir/isolate_snapshot_instructions.S" + symbol = "kDartIsolateSnapshotInstructions" + executable = true +} + +source_set("snapshot") { + deps = [ + ":isolate_snapshot_data_assembly", + ":isolate_snapshot_instructions_assembly", + ":vm_snapshot_data_assembly", + ":vm_snapshot_instructions_assembly", + ] + sources = [ + "$target_gen_dir/isolate_snapshot_data.S", + "$target_gen_dir/isolate_snapshot_instructions.S", + "$target_gen_dir/vm_snapshot_data.S", + "$target_gen_dir/vm_snapshot_instructions.S", + ] +} + compile_platform("non_strong_platform") { libraries_specification_uri = "libraries.json" @@ -196,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. diff --git a/lib/ui/compositing/scene_builder.cc b/lib/ui/compositing/scene_builder.cc index 81414b96a9a9a..bf3e8c0ed4a6e 100644 --- a/lib/ui/compositing/scene_builder.cc +++ b/lib/ui/compositing/scene_builder.cc @@ -5,6 +5,9 @@ #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" From cdbe21466fb8e25d5979a66de78e72e7e248b11d Mon Sep 17 00:00:00 2001 From: Michael Klimushyn Date: Mon, 17 Sep 2018 17:10:30 -0700 Subject: [PATCH 131/134] Update test .gitignore (#6272) `testing/dart/android/` and `testing/dart/ios` both look like generated directories created after each `run_tests` execution. --- testing/dart/.gitignore | 2 ++ 1 file changed, 2 insertions(+) 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/** From 9e315e64659ea966eba58bada2b51112b07d284c Mon Sep 17 00:00:00 2001 From: sjindel-google Date: Tue, 18 Sep 2018 10:56:26 +0200 Subject: [PATCH 132/134] Remove entries from dart_vm_entry_points.txt and use annotations (#6226) The `dart_vm_entry_points.txt` file is now deprecated in favor of annotations. Support for parsing and generating the entry-points files will be removed from Dart shortly. --- lib/ui/compositing.dart | 2 ++ lib/ui/geometry.dart | 1 + lib/ui/hooks.dart | 11 ++++++++ lib/ui/natives.dart | 4 +++ lib/ui/painting.dart | 16 ++++++++++- lib/ui/semantics.dart | 2 ++ lib/ui/text.dart | 3 ++ runtime/dart_vm_entry_points.txt | 48 ++------------------------------ 8 files changed, 40 insertions(+), 47 deletions(-) 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/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 af08b848cf910..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. @@ -1485,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; } @@ -1502,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. @@ -1549,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. @@ -1566,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. @@ -1752,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'; @@ -2401,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._(); } @@ -2664,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), @@ -2828,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.'); @@ -3545,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. @@ -3575,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'; @@ -3640,4 +3655,3 @@ Future _futurize(_Callbacker callbacker) { throw new Exception(error); return completer.future; } - diff --git a/lib/ui/semantics.dart b/lib/ui/semantics.dart index e4bc18b81ffd8..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'; @@ -727,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/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/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. From 765b0cc23ddfa7150f5754ea27af1e0462b5f7b9 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll <37626415+skia-flutter-autoroll@users.noreply.github.com> Date: Tue, 18 Sep 2018 11:42:17 -0400 Subject: [PATCH 133/134] Roll src/third_party/skia 060e992ef5b8..1d6281d4bb47 (34 commits) (#6274) https://skia.googlesource.com/skia.git/+log/060e992ef5b8..1d6281d4bb47 Created with: gclient setdep -r src/third_party/skia@1d6281d4bb47 The AutoRoll server is located here: https://autoroll.skia.org/r/skia-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. --- DEPS | 2 +- ci/licenses_golden/licenses_skia | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index a8f419a910f1d..c78b0af49df34 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '060e992ef5b85d5db021bfc8aad78945da75bf59', + '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 diff --git a/ci/licenses_golden/licenses_skia b/ci/licenses_golden/licenses_skia index cf11e961d0490..fc97101dde107 100644 --- a/ci/licenses_golden/licenses_skia +++ b/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: 50b3d2570775ed8879ed4580b0909186 +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 From 2e8e96fad1ada324adca718d13410a98d9bb1036 Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Tue, 18 Sep 2018 13:43:41 -0700 Subject: [PATCH 134/134] Roll Dart to 4eb879133a06c86869dc54cecf904f4b1d46c47b (#6276) --- DEPS | 4 ++-- ci/licenses_golden/licenses_third_party | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index c78b0af49df34..bfa262dfa677d 100644 --- a/DEPS +++ b/DEPS @@ -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': '050561fd82be5e775316223c9d2d9e7e5e596c8e', + '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', diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 0524887254ca9..2c7e500f9beb2 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: 23f7e8d39ec24c9954fd6a342b83e480 +Signature: 5b5ec302d3f100a7ca4552f231d9f8b7 UNUSED LICENSES: