From e0fa0cb73c1faeb4b0212fb0faffbb5cbc906868 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 26 Nov 2018 15:30:03 -0800 Subject: [PATCH 01/17] Dont attempt to log names of extensions as these change depending on the header used. (flutter/engine#6949) --- engine/src/flutter/vulkan/vulkan_interface.cc | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/engine/src/flutter/vulkan/vulkan_interface.cc b/engine/src/flutter/vulkan/vulkan_interface.cc index cd89954c0d..56cb828e9d 100644 --- a/engine/src/flutter/vulkan/vulkan_interface.cc +++ b/engine/src/flutter/vulkan/vulkan_interface.cc @@ -66,30 +66,10 @@ std::string VulkanResultToString(VkResult result) { return "VK_ERROR_INVALID_EXTERNAL_HANDLE"; case VK_ERROR_OUT_OF_POOL_MEMORY: return "VK_ERROR_OUT_OF_POOL_MEMORY"; - -#if VK_HEADER_VERSION >= 63 - case VK_ERROR_NOT_PERMITTED_EXT: - return "VK_ERROR_NOT_PERMITTED_EXT"; -#endif - -#if VK_HEADER_VERSION >= 72 - case VK_ERROR_FRAGMENTATION_EXT: - return "VK_ERROR_FRAGMENTATION_EXT"; -#endif - -#if OS_FUCHSIA -#if VK_KHR_external_memory - case VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR: - return "VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR"; -#elif VK_KHX_external_memory - case VK_ERROR_INVALID_EXTERNAL_HANDLE_KHX: - return "VK_ERROR_INVALID_EXTERNAL_HANDLE_KHX"; -#endif - case VK_ERROR_OUT_OF_POOL_MEMORY_KHR: - return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR"; -#endif + default: + return "Unknown Error"; } - return "Unknown Error"; + return ""; } } // namespace vulkan From c716627a323dc7f7fc3cb977800981e6baa8750c Mon Sep 17 00:00:00 2001 From: Amir Hardon Date: Tue, 27 Nov 2018 10:03:16 -0800 Subject: [PATCH 02/17] Update Dartdoc for SceneBuilder#addPlatformView (flutter/engine#6957) --- engine/src/flutter/lib/ui/compositing.dart | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/lib/ui/compositing.dart b/engine/src/flutter/lib/ui/compositing.dart index a23c2bbbb9..89529c093f 100644 --- a/engine/src/flutter/lib/ui/compositing.dart +++ b/engine/src/flutter/lib/ui/compositing.dart @@ -274,7 +274,20 @@ class SceneBuilder extends NativeFieldWrapperClass2 { /// Adds a platform view (e.g an iOS UIView) to the scene. /// - /// This is work in progress and is not currently supported on any platform. + /// Only supported on iOS, this is currently a no-op on other platforms. + /// + /// On iOS this layer splits the current output surface into two surfaces, one for the scene nodes + /// preceding the platform view, and one for the scene nodes following the platform view. + /// + /// ## Performance impact + /// + /// Adding an additional surface doubles the amount of graphics memory directly used by Flutter + /// for output buffers. Quartz might allocated extra buffers for compositing the Flutter surfaces + /// and the platform view. + /// + /// With a platform view in the scene, Quartz has to composite the two Flutter surfaces and the + /// embedded UIView. In addition to that, on iOS versions greater than 9, the Flutter frames are + /// synchronized with the UIView frames adding additional performance overhead. void addPlatformView(int viewId, { Offset offset: Offset.zero, double width: 0.0, double height: 0.0}) { assert(offset != null, 'Offset argument was null'); _addPlatformView(offset.dx, offset.dy, width, height, viewId); From c2c439fd0a11e2045d7e6e43ffa800701542fd08 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Tue, 27 Nov 2018 13:51:54 -0800 Subject: [PATCH 03/17] Use application_kernel_asset in flutter_tester (flutter/engine#6972) Since the migration to Dart 2, the first positional command-line argument to flutter_tester has been a Dart kernel .dill file. Use Settings::application_kernel_asset here for consistency/clarity. --- engine/src/flutter/shell/testing/tester_main.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/engine/src/flutter/shell/testing/tester_main.cc b/engine/src/flutter/shell/testing/tester_main.cc index 3d24032e95..7aa9dee3c0 100644 --- a/engine/src/flutter/shell/testing/tester_main.cc +++ b/engine/src/flutter/shell/testing/tester_main.cc @@ -120,8 +120,8 @@ int RunTester(const blink::Settings& settings, bool run_forever) { return EXIT_FAILURE; } - if (settings.main_dart_file_path.empty()) { - FML_LOG(ERROR) << "Main dart file not specified."; + if (settings.application_kernel_asset.empty()) { + FML_LOG(ERROR) << "Dart kernel file not specified."; return EXIT_FAILURE; } @@ -142,8 +142,8 @@ int RunTester(const blink::Settings& settings, bool run_forever) { fml::FileMapping::Protection::kRead}; auto main_dart_file_mapping = std::make_unique( fml::OpenFile( - fml::paths::AbsolutePath(settings.main_dart_file_path).c_str(), false, - fml::FilePermission::kRead), + fml::paths::AbsolutePath(settings.application_kernel_asset).c_str(), + false, fml::FilePermission::kRead), protection); auto isolate_configuration = @@ -243,11 +243,11 @@ int main(int argc, char* argv[]) { if (command_line.positional_args().size() > 0) { // The tester may not use the switch for the main dart file path. Specifying // it as a positional argument instead. - settings.main_dart_file_path = command_line.positional_args()[0]; + settings.application_kernel_asset = command_line.positional_args()[0]; } - if (settings.main_dart_file_path.size() == 0) { - FML_LOG(ERROR) << "Main dart file path not specified."; + if (settings.application_kernel_asset.size() == 0) { + FML_LOG(ERROR) << "Dart kernel file not specified."; return EXIT_FAILURE; } From 41fdd03757fd15ff0d04594d8f6043a8e7434d62 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Tue, 27 Nov 2018 14:12:13 -0800 Subject: [PATCH 04/17] Fix EXIF orentation problem (flutter/engine#6974) --- engine/src/flutter/shell/common/io_manager.cc | 1 + engine/src/flutter/shell/gpu/gpu_surface_gl.cc | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/engine/src/flutter/shell/common/io_manager.cc b/engine/src/flutter/shell/common/io_manager.cc index e97222eb40..c6ff79b644 100644 --- a/engine/src/flutter/shell/common/io_manager.cc +++ b/engine/src/flutter/shell/common/io_manager.cc @@ -24,6 +24,7 @@ sk_sp IOManager::CreateCompatibleResourceLoadingContext( // thread. The necessary work isn't being flushed or synchronized with the // other threads correctly, so the textures end up blank. For now, suppress // that feature, which will cause texture uploads to do CPU YUV conversion. + // A similar work-around is also used in shell/gpu/gpu_surface_gl.cc. options.fDisableGpuYUVConversion = true; // To get video playback on the widest range of devices, we limit Skia to diff --git a/engine/src/flutter/shell/gpu/gpu_surface_gl.cc b/engine/src/flutter/shell/gpu/gpu_surface_gl.cc index d0ff74ffb6..675e6d6f7c 100644 --- a/engine/src/flutter/shell/gpu/gpu_surface_gl.cc +++ b/engine/src/flutter/shell/gpu/gpu_surface_gl.cc @@ -56,6 +56,10 @@ GPUSurfaceGL::GPUSurfaceGL(GPUSurfaceGLDelegate* delegate) // ES2 shading language when the ES3 external image extension is missing. options.fPreferExternalImagesOverES3 = true; + // TODO(goderbauer): remove option when skbug.com/7523 is fixed. + // A similar work-around is also used in shell/common/io_manager.cc. + options.fDisableGpuYUVConversion = true; + sk_sp interface; if (proc_resolver_ == nullptr) { From fc758c5aef9c23d8e0c594422b0cf25628637986 Mon Sep 17 00:00:00 2001 From: Todd Volkert Date: Tue, 27 Nov 2018 15:07:26 -0800 Subject: [PATCH 05/17] Roll Skia to bb37aba39910ef1a95cdcbb5b85d99cdabf3c362 (flutter/engine#6975) --- DEPS | 2 +- engine/src/flutter/ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 4d4060099c..34a083e6f2 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': '988f54e4689b3d9fb6d5220e02b418f5cfa2b6db', + 'skia_revision': 'bb37aba39910ef1a95cdcbb5b85d99cdabf3c362', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/engine/src/flutter/ci/licenses_golden/licenses_skia b/engine/src/flutter/ci/licenses_golden/licenses_skia index 1b405986e7..9082e899c9 100644 --- a/engine/src/flutter/ci/licenses_golden/licenses_skia +++ b/engine/src/flutter/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: ee0a1574bb6026ffa4292566b01d932d +Signature: dcef2b9d9d93b9b2ab1886efff54af73 UNUSED LICENSES: From e0b4ecead410b78f903a70f9e319406c96e87f4c Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Wed, 28 Nov 2018 12:59:57 -0800 Subject: [PATCH 06/17] Prepend [NSLocale currentLocale] for first locale on iOS to ensure countryCode exists. Allow language-only locales. (flutter/engine#6995) --- .../framework/Source/FlutterViewController.mm | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 544bad0365..5a367bdeae 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -748,18 +748,35 @@ static blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* touch) { - (void)onLocaleUpdated:(NSNotification*)notification { NSArray* preferredLocales = [NSLocale preferredLanguages]; - NSMutableArray* data = [NSMutableArray new]; + NSMutableArray* data = [[NSMutableArray new] autorelease]; + + // Force prepend the [NSLocale currentLocale] to the front of the list + // to ensure we are including the full default locale. preferredLocales + // is not guaranteed to include anything beyond the languageCode. + NSLocale* currentLocale = [NSLocale currentLocale]; + NSString* languageCode = [currentLocale objectForKey:NSLocaleLanguageCode]; + NSString* countryCode = [currentLocale objectForKey:NSLocaleCountryCode]; + NSString* scriptCode = [currentLocale objectForKey:NSLocaleScriptCode]; + NSString* variantCode = [currentLocale objectForKey:NSLocaleVariantCode]; + if (languageCode) { + [data addObject:languageCode]; + [data addObject:(countryCode ? countryCode : @"")]; + [data addObject:(scriptCode ? scriptCode : @"")]; + [data addObject:(variantCode ? variantCode : @"")]; + } + + // Add any secondary locales/languages to the list. for (NSString* localeID in preferredLocales) { - NSLocale* currentLocale = [[NSLocale alloc] initWithLocaleIdentifier:localeID]; + NSLocale* currentLocale = [[[NSLocale alloc] initWithLocaleIdentifier:localeID] autorelease]; NSString* languageCode = [currentLocale objectForKey:NSLocaleLanguageCode]; NSString* countryCode = [currentLocale objectForKey:NSLocaleCountryCode]; NSString* scriptCode = [currentLocale objectForKey:NSLocaleScriptCode]; NSString* variantCode = [currentLocale objectForKey:NSLocaleVariantCode]; - if (!languageCode || !countryCode) { + if (!languageCode) { continue; } [data addObject:languageCode]; - [data addObject:countryCode]; + [data addObject:(countryCode ? countryCode : @"")]; [data addObject:(scriptCode ? scriptCode : @"")]; [data addObject:(variantCode ? variantCode : @"")]; } From e18ea1518f13714f446110ae3e58baa10fb7cc7a Mon Sep 17 00:00:00 2001 From: Todd Volkert Date: Thu, 29 Nov 2018 14:08:51 -0800 Subject: [PATCH 07/17] Roll Skia to 57d29eaf2ed7518983d9e91fd5219f4cfc181f88 (flutter/engine#7024) flutter/flutter#24402 flutter/flutter#24289 flutter/flutter#24517 --- DEPS | 2 +- engine/src/flutter/ci/licenses_golden/licenses_skia | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DEPS b/DEPS index 34a083e6f2..cd4acaf5ed 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'fuchsia_git': 'https://fuchsia.googlesource.com', 'github_git': 'https://github.com', 'skia_git': 'https://skia.googlesource.com', - 'skia_revision': 'bb37aba39910ef1a95cdcbb5b85d99cdabf3c362', + 'skia_revision': '57d29eaf2ed7518983d9e91fd5219f4cfc181f88', # When updating the Dart revision, ensure that all entries that are # dependencies of Dart are also updated to match the entries in the diff --git a/engine/src/flutter/ci/licenses_golden/licenses_skia b/engine/src/flutter/ci/licenses_golden/licenses_skia index 9082e899c9..aba11c32d8 100644 --- a/engine/src/flutter/ci/licenses_golden/licenses_skia +++ b/engine/src/flutter/ci/licenses_golden/licenses_skia @@ -1,4 +1,4 @@ -Signature: dcef2b9d9d93b9b2ab1886efff54af73 +Signature: d3b07999cc854304c62d727819b592c0 UNUSED LICENSES: From c686b061f56df8ced3e8dd408eff30721f85d48b Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 10 Dec 2018 09:06:32 -0800 Subject: [PATCH 08/17] Reland "Compile libcxx and libcxxabi for Android (#6886)" (flutter/engine#6919) This reverts commit f480d3596c45c8c4e601d4f789a8c4a43a542337. --- DEPS | 8 +- .../flutter/sky/packages/sky_engine/LICENSE | 111 ++++++++++++++++++ .../src/flutter/tools/licenses/lib/main.dart | 63 +++++++++- 3 files changed, 179 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index cd4acaf5ed..3e7f55a6fa 100644 --- a/DEPS +++ b/DEPS @@ -117,7 +117,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '29a5d76757ec12655c0562b317830f669bd44ea7', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'b7f2b443b5648b9cd7ad539d8b4f73b3c69fedbf', # Fuchsia compatibility # @@ -140,6 +140,12 @@ deps = { 'src/third_party/harfbuzz': Var('fuchsia_git') + '/third_party/harfbuzz' + '@' + '02caec6c1c6ad996666788b8e920ccaec8b385e5', + 'src/third_party/libcxx': + Var('fuchsia_git') + '/third_party/libcxx' + '@' + 'c5a5fa59789213c7dae68d2e51cb28ef681d8257', + + 'src/third_party/libcxxabi': + Var('fuchsia_git') + '/third_party/libcxxabi' + '@' + '1a9753522f1ae8d72848d365902f39e0d3d59a39', + # Chromium-style # # As part of integrating with Fuchsia, we should eventually remove all these diff --git a/engine/src/flutter/sky/packages/sky_engine/LICENSE b/engine/src/flutter/sky/packages/sky_engine/LICENSE index 7334fbc6b9..38fca4e7cc 100644 --- a/engine/src/flutter/sky/packages/sky_engine/LICENSE +++ b/engine/src/flutter/sky/packages/sky_engine/LICENSE @@ -7116,6 +7116,117 @@ 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. -------------------------------------------------------------------------------- +libcxx + +University of Illinois/NCSA +Open Source License + +Copyright (c) 2009-2017 by the contributors listed in CREDITS.TXT + +All rights reserved. + +Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal with +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + +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. IN NO EVENT SHALL THE +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE +SOFTWARE. +-------------------------------------------------------------------------------- +libcxx +libcxxabi + +Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +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. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +-------------------------------------------------------------------------------- +libcxxabi + +University of Illinois/NCSA +Open Source License + +Copyright (c) 2009-2018 by the contributors listed in CREDITS.TXT + +All rights reserved. + +Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal with +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + +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. IN NO EVENT SHALL THE +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE +SOFTWARE. +-------------------------------------------------------------------------------- libjpeg-turbo Copyright (C) 1999-2006, MIYASAKA Masaru. diff --git a/engine/src/flutter/tools/licenses/lib/main.dart b/engine/src/flutter/tools/licenses/lib/main.dart index 39aff8a821..a2ab8e2057 100644 --- a/engine/src/flutter/tools/licenses/lib/main.dart +++ b/engine/src/flutter/tools/licenses/lib/main.dart @@ -809,8 +809,7 @@ class _RepositoryMultiLicenseNoticesForFilesFile extends _RepositoryLicenseFile Iterable get licenses => _licenses.values; } -// TODO(goderbauer): use this in https://github.com/flutter/engine/pull/6886. -class _RepositoryCxxStlDualLicenseFile extends _RepositoryLicenseFile { // ignore: unused_element +class _RepositoryCxxStlDualLicenseFile extends _RepositoryLicenseFile { _RepositoryCxxStlDualLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : _licenses = _parseLicenses(io), super(parent, io); @@ -1488,6 +1487,62 @@ class _RepositoryJSR305SrcDirectory extends _RepositoryDirectory { } } +class _RepositoryLibcxxDirectory extends _RepositoryDirectory { + _RepositoryLibcxxDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); + + @override + bool shouldRecurse(fs.IoNode entry) { + return entry.name != 'utils' + && super.shouldRecurse(entry); + } + + @override + _RepositoryDirectory createSubdirectory(fs.Directory entry) { + if (entry.name == 'src') + return new _RepositoryLibcxxSrcDirectory(this, entry); + return super.createSubdirectory(entry); + } + + @override + _RepositoryFile createFile(fs.IoNode entry) { + if (entry.name == 'LICENSE.TXT') + return new _RepositoryCxxStlDualLicenseFile(this, entry); + return super.createFile(entry); + } +} + +class _RepositoryLibcxxSrcDirectory extends _RepositoryDirectory { + _RepositoryLibcxxSrcDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); + + @override + _RepositoryDirectory createSubdirectory(fs.Directory entry) { + if (entry.name == 'support') + return new _RepositoryLibcxxSrcSupportDirectory(this, entry); + return super.createSubdirectory(entry); + } +} + +class _RepositoryLibcxxSrcSupportDirectory extends _RepositoryDirectory { + _RepositoryLibcxxSrcSupportDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); + + @override + bool shouldRecurse(fs.IoNode entry) { + return entry.name != 'solaris' + && super.shouldRecurse(entry); + } +} + +class _RepositoryLibcxxabiDirectory extends _RepositoryDirectory { + _RepositoryLibcxxabiDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); + + @override + _RepositoryFile createFile(fs.IoNode entry) { + if (entry.name == 'LICENSE.TXT') + return new _RepositoryCxxStlDualLicenseFile(this, entry); + return super.createFile(entry); + } +} + class _RepositoryLibJpegDirectory extends _RepositoryDirectory { _RepositoryLibJpegDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @@ -1699,6 +1754,10 @@ class _RepositoryRootThirdPartyDirectory extends _RepositoryGenericThirdPartyDir return new _RepositoryIcuDirectory(this, entry); if (entry.name == 'jsr-305') return new _RepositoryJSR305Directory(this, entry); + if (entry.name == 'libcxx') + return new _RepositoryLibcxxDirectory(this, entry); + if (entry.name == 'libcxxabi') + return new _RepositoryLibcxxabiDirectory(this, entry); if (entry.name == 'libjpeg') return new _RepositoryLibJpegDirectory(this, entry); if (entry.name == 'libjpeg_turbo' || entry.name == 'libjpeg-turbo') From 120c20d5c63fae54a45d4275e0e45b7c4b4c3fb1 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Mon, 10 Dec 2018 09:12:10 -0800 Subject: [PATCH 09/17] Eliminate main_dart_file_path, package_file_path (flutter/engine#6973) These settings were specific to Dart 1 and are no longer used in the engine. This eliminates them from the Settings class. --- engine/src/flutter/common/settings.cc | 2 -- engine/src/flutter/common/settings.h | 3 --- engine/src/flutter/shell/common/switches.cc | 6 ------ engine/src/flutter/shell/common/switches.h | 2 -- .../ios/framework/Source/FlutterDartProject.mm | 9 --------- .../flutter/shell/platform/embedder/embedder.cc | 16 +++++----------- 6 files changed, 5 insertions(+), 33 deletions(-) diff --git a/engine/src/flutter/common/settings.cc b/engine/src/flutter/common/settings.cc index a85d69fc85..f495bac77f 100644 --- a/engine/src/flutter/common/settings.cc +++ b/engine/src/flutter/common/settings.cc @@ -25,8 +25,6 @@ std::string Settings::ToString() const { << std::endl; stream << "application_library_path: " << application_library_path << std::endl; - stream << "main_dart_file_path: " << main_dart_file_path << std::endl; - stream << "packages_file_path: " << packages_file_path << std::endl; stream << "temp_directory_path: " << temp_directory_path << std::endl; stream << "dart_flags:" << std::endl; for (const auto& dart_flag : dart_flags) { diff --git a/engine/src/flutter/common/settings.h b/engine/src/flutter/common/settings.h index 92a8e37109..7d9e4e0173 100644 --- a/engine/src/flutter/common/settings.h +++ b/engine/src/flutter/common/settings.h @@ -38,9 +38,6 @@ struct Settings { std::string application_kernel_asset; std::string application_kernel_list_asset; - std::string main_dart_file_path; - std::string packages_file_path; - std::string temp_directory_path; std::vector dart_flags; diff --git a/engine/src/flutter/shell/common/switches.cc b/engine/src/flutter/shell/common/switches.cc index d2b4d56eb2..8472f27a38 100644 --- a/engine/src/flutter/shell/common/switches.cc +++ b/engine/src/flutter/shell/common/switches.cc @@ -170,12 +170,6 @@ blink::Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { command_line.GetOptionValue(FlagForSwitch(Switch::FlutterAssetsDir), &settings.assets_path); - command_line.GetOptionValue(FlagForSwitch(Switch::MainDartFile), - &settings.main_dart_file_path); - - command_line.GetOptionValue(FlagForSwitch(Switch::Packages), - &settings.packages_file_path); - std::string aot_shared_library_path; command_line.GetOptionValue(FlagForSwitch(Switch::AotSharedLibraryPath), &aot_shared_library_path); diff --git a/engine/src/flutter/shell/common/switches.h b/engine/src/flutter/shell/common/switches.h index bbaa5b4760..9abaf7951a 100644 --- a/engine/src/flutter/shell/common/switches.h +++ b/engine/src/flutter/shell/common/switches.h @@ -92,8 +92,6 @@ DEF_SWITCH(FlutterAssetsDir, "Path to the Flutter assets directory.") DEF_SWITCH(Help, "help", "Display this help text.") DEF_SWITCH(LogTag, "log-tag", "Tag associated with log messages.") -DEF_SWITCH(MainDartFile, "dart-main", "The path to the main Dart file.") -DEF_SWITCH(Packages, "packages", "Specify the path to the packages.") DEF_SWITCH(StartPaused, "start-paused", "Start the application paused in the Dart debugger.") diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index 0e5bf4fdcb..20e1c0d2ca 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -157,15 +157,6 @@ static blink::Settings DefaultSettingsForProcess(NSBundle* bundle = nil) { if (self) { _settings = DefaultSettingsForProcess(); - - if (dartMainURL != nil && [[NSFileManager defaultManager] fileExistsAtPath:dartMainURL.path]) { - _settings.main_dart_file_path = dartMainURL.path.UTF8String; - } - - if (dartPackages.path != nil && - [[NSFileManager defaultManager] fileExistsAtPath:dartPackages.path]) { - _settings.packages_file_path = dartPackages.path.UTF8String; - } } return self; diff --git a/engine/src/flutter/shell/platform/embedder/embedder.cc b/engine/src/flutter/shell/platform/embedder/embedder.cc index d7acb7d4db..d5d5ea51d9 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder.cc +++ b/engine/src/flutter/shell/platform/embedder/embedder.cc @@ -266,9 +266,7 @@ FlutterResult FlutterEngineRun(size_t version, return kInvalidArguments; } - if (SAFE_ACCESS(args, assets_path, nullptr) == nullptr || - SAFE_ACCESS(args, main_path, nullptr) == nullptr || - SAFE_ACCESS(args, packages_path, nullptr) == nullptr) { + if (SAFE_ACCESS(args, assets_path, nullptr) == nullptr) { return kInvalidArguments; } @@ -293,18 +291,14 @@ FlutterResult FlutterEngineRun(size_t version, settings.icu_data_path = icu_data_path; settings.assets_path = args->assets_path; - // Check whether the assets path contains Dart 2 kernel assets. + // Verify the assets path contains Dart 2 kernel assets. const std::string kApplicationKernelSnapshotFileName = "kernel_blob.bin"; 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; - } else { - // Run from a main Dart file. - settings.main_dart_file_path = args->main_path; - settings.packages_file_path = args->packages_path; + if (!fml::IsFile(application_kernel_path)) { + return kInvalidArguments; } + settings.application_kernel_asset = kApplicationKernelSnapshotFileName; settings.task_observer_add = [](intptr_t key, fml::closure callback) { fml::MessageLoop::GetCurrent().AddTaskObserver(key, std::move(callback)); From 6f83593fc3b1192fcf15e170fdc90ada94d16a67 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 10 Dec 2018 09:29:34 -0800 Subject: [PATCH 10/17] Roll buildtools to bac220c15490dcf7b7d8136f75100bbc77e8d217 (flutter/engine#6926) This reduces `libflutter.so` by 6 KB (compressed!). --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 3e7f55a6fa..a94338e18e 100644 --- a/DEPS +++ b/DEPS @@ -104,7 +104,7 @@ vars = { # Build bot tooling for iOS 'ios_tools_revision': '69b7c1b160e7107a6a98d948363772dc9caea46f', - 'buildtools_revision': '5a9e1b3a0b84a2871f20f85fde665e54a894ba72', + 'buildtools_revision': 'bac220c15490dcf7b7d8136f75100bbc77e8d217', } # Only these hosts are allowed for dependencies in this DEPS file. From 402e052414bb800a317fea62d411416a9ccb57c4 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Mon, 10 Dec 2018 10:07:13 -0800 Subject: [PATCH 11/17] Revert "Reland "Compile libcxx and libcxxabi for Android (#6886)"" (flutter/engine#7146) --- DEPS | 8 +- .../flutter/sky/packages/sky_engine/LICENSE | 111 ------------------ .../src/flutter/tools/licenses/lib/main.dart | 63 +--------- 3 files changed, 3 insertions(+), 179 deletions(-) diff --git a/DEPS b/DEPS index a94338e18e..9423b489e1 100644 --- a/DEPS +++ b/DEPS @@ -117,7 +117,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'b7f2b443b5648b9cd7ad539d8b4f73b3c69fedbf', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '29a5d76757ec12655c0562b317830f669bd44ea7', # Fuchsia compatibility # @@ -140,12 +140,6 @@ deps = { 'src/third_party/harfbuzz': Var('fuchsia_git') + '/third_party/harfbuzz' + '@' + '02caec6c1c6ad996666788b8e920ccaec8b385e5', - 'src/third_party/libcxx': - Var('fuchsia_git') + '/third_party/libcxx' + '@' + 'c5a5fa59789213c7dae68d2e51cb28ef681d8257', - - 'src/third_party/libcxxabi': - Var('fuchsia_git') + '/third_party/libcxxabi' + '@' + '1a9753522f1ae8d72848d365902f39e0d3d59a39', - # Chromium-style # # As part of integrating with Fuchsia, we should eventually remove all these diff --git a/engine/src/flutter/sky/packages/sky_engine/LICENSE b/engine/src/flutter/sky/packages/sky_engine/LICENSE index 38fca4e7cc..7334fbc6b9 100644 --- a/engine/src/flutter/sky/packages/sky_engine/LICENSE +++ b/engine/src/flutter/sky/packages/sky_engine/LICENSE @@ -7116,117 +7116,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- -libcxx - -University of Illinois/NCSA -Open Source License - -Copyright (c) 2009-2017 by the contributors listed in CREDITS.TXT - -All rights reserved. - -Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -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. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. --------------------------------------------------------------------------------- -libcxx -libcxxabi - -Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -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. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. --------------------------------------------------------------------------------- -libcxxabi - -University of Illinois/NCSA -Open Source License - -Copyright (c) 2009-2018 by the contributors listed in CREDITS.TXT - -All rights reserved. - -Developed by: - - LLVM Team - - University of Illinois at Urbana-Champaign - - http://llvm.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -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. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. --------------------------------------------------------------------------------- libjpeg-turbo Copyright (C) 1999-2006, MIYASAKA Masaru. diff --git a/engine/src/flutter/tools/licenses/lib/main.dart b/engine/src/flutter/tools/licenses/lib/main.dart index a2ab8e2057..39aff8a821 100644 --- a/engine/src/flutter/tools/licenses/lib/main.dart +++ b/engine/src/flutter/tools/licenses/lib/main.dart @@ -809,7 +809,8 @@ class _RepositoryMultiLicenseNoticesForFilesFile extends _RepositoryLicenseFile Iterable get licenses => _licenses.values; } -class _RepositoryCxxStlDualLicenseFile extends _RepositoryLicenseFile { +// TODO(goderbauer): use this in https://github.com/flutter/engine/pull/6886. +class _RepositoryCxxStlDualLicenseFile extends _RepositoryLicenseFile { // ignore: unused_element _RepositoryCxxStlDualLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : _licenses = _parseLicenses(io), super(parent, io); @@ -1487,62 +1488,6 @@ class _RepositoryJSR305SrcDirectory extends _RepositoryDirectory { } } -class _RepositoryLibcxxDirectory extends _RepositoryDirectory { - _RepositoryLibcxxDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - bool shouldRecurse(fs.IoNode entry) { - return entry.name != 'utils' - && super.shouldRecurse(entry); - } - - @override - _RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'src') - return new _RepositoryLibcxxSrcDirectory(this, entry); - return super.createSubdirectory(entry); - } - - @override - _RepositoryFile createFile(fs.IoNode entry) { - if (entry.name == 'LICENSE.TXT') - return new _RepositoryCxxStlDualLicenseFile(this, entry); - return super.createFile(entry); - } -} - -class _RepositoryLibcxxSrcDirectory extends _RepositoryDirectory { - _RepositoryLibcxxSrcDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - _RepositoryDirectory createSubdirectory(fs.Directory entry) { - if (entry.name == 'support') - return new _RepositoryLibcxxSrcSupportDirectory(this, entry); - return super.createSubdirectory(entry); - } -} - -class _RepositoryLibcxxSrcSupportDirectory extends _RepositoryDirectory { - _RepositoryLibcxxSrcSupportDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - bool shouldRecurse(fs.IoNode entry) { - return entry.name != 'solaris' - && super.shouldRecurse(entry); - } -} - -class _RepositoryLibcxxabiDirectory extends _RepositoryDirectory { - _RepositoryLibcxxabiDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); - - @override - _RepositoryFile createFile(fs.IoNode entry) { - if (entry.name == 'LICENSE.TXT') - return new _RepositoryCxxStlDualLicenseFile(this, entry); - return super.createFile(entry); - } -} - class _RepositoryLibJpegDirectory extends _RepositoryDirectory { _RepositoryLibJpegDirectory(_RepositoryDirectory parent, fs.Directory io) : super(parent, io); @@ -1754,10 +1699,6 @@ class _RepositoryRootThirdPartyDirectory extends _RepositoryGenericThirdPartyDir return new _RepositoryIcuDirectory(this, entry); if (entry.name == 'jsr-305') return new _RepositoryJSR305Directory(this, entry); - if (entry.name == 'libcxx') - return new _RepositoryLibcxxDirectory(this, entry); - if (entry.name == 'libcxxabi') - return new _RepositoryLibcxxabiDirectory(this, entry); if (entry.name == 'libjpeg') return new _RepositoryLibJpegDirectory(this, entry); if (entry.name == 'libjpeg_turbo' || entry.name == 'libjpeg-turbo') From 981e3e84d38e627019db724bf948f82112c4b8c0 Mon Sep 17 00:00:00 2001 From: Craig Stout Date: Wed, 5 Dec 2018 13:57:14 -0800 Subject: [PATCH 12/17] [vulkan] Remove magma native surface The Vulkan surface extension as used here is meant for testing only. Since this isn't used, remove it so we don't have to maintain it. Also remove the attempt to locate all related Vulkan entry points. Test: pixelbook:build topaz, launch a spinning cube --- .../ci/licenses_golden/licenses_flutter | 2 - engine/src/flutter/vulkan/BUILD.gn | 11 +--- engine/src/flutter/vulkan/vulkan_device.cc | 9 ++- .../vulkan/vulkan_native_surface_magma.cc | 66 ------------------- .../vulkan/vulkan_native_surface_magma.h | 43 ------------ .../src/flutter/vulkan/vulkan_proc_table.cc | 25 +++---- engine/src/flutter/vulkan/vulkan_proc_table.h | 14 ++-- 7 files changed, 25 insertions(+), 145 deletions(-) delete mode 100644 engine/src/flutter/vulkan/vulkan_native_surface_magma.cc delete mode 100644 engine/src/flutter/vulkan/vulkan_native_surface_magma.h diff --git a/engine/src/flutter/ci/licenses_golden/licenses_flutter b/engine/src/flutter/ci/licenses_golden/licenses_flutter index 63b2ac899e..5442f3c564 100644 --- a/engine/src/flutter/ci/licenses_golden/licenses_flutter +++ b/engine/src/flutter/ci/licenses_golden/licenses_flutter @@ -594,8 +594,6 @@ FILE: ../../../flutter/vulkan/vulkan_native_surface.cc FILE: ../../../flutter/vulkan/vulkan_native_surface.h FILE: ../../../flutter/vulkan/vulkan_native_surface_android.cc FILE: ../../../flutter/vulkan/vulkan_native_surface_android.h -FILE: ../../../flutter/vulkan/vulkan_native_surface_magma.cc -FILE: ../../../flutter/vulkan/vulkan_native_surface_magma.h FILE: ../../../flutter/vulkan/vulkan_proc_table.cc FILE: ../../../flutter/vulkan/vulkan_proc_table.h FILE: ../../../flutter/vulkan/vulkan_provider.cc diff --git a/engine/src/flutter/vulkan/BUILD.gn b/engine/src/flutter/vulkan/BUILD.gn index e5412a6431..d6e3767af9 100644 --- a/engine/src/flutter/vulkan/BUILD.gn +++ b/engine/src/flutter/vulkan/BUILD.gn @@ -35,8 +35,6 @@ source_set("vulkan") { "vulkan_proc_table.h", "vulkan_surface.cc", "vulkan_surface.h", - "vulkan_swapchain.cc", - "vulkan_swapchain.h", "vulkan_utilities.cc", "vulkan_utilities.h", "vulkan_window.cc", @@ -47,13 +45,8 @@ source_set("vulkan") { sources += [ "vulkan_native_surface_android.cc", "vulkan_native_surface_android.h", - ] - } - - if (is_fuchsia) { - sources += [ - "vulkan_native_surface_magma.cc", - "vulkan_native_surface_magma.h", + "vulkan_swapchain.cc", + "vulkan_swapchain.h", ] } diff --git a/engine/src/flutter/vulkan/vulkan_device.cc b/engine/src/flutter/vulkan/vulkan_device.cc index 50688c1bac..772b190922 100644 --- a/engine/src/flutter/vulkan/vulkan_device.cc +++ b/engine/src/flutter/vulkan/vulkan_device.cc @@ -58,7 +58,9 @@ VulkanDevice::VulkanDevice(VulkanProcTable& p_vk, }; const char* extensions[] = { +#if OS_ANDROID VK_KHR_SWAPCHAIN_EXTENSION_NAME, +#endif #if OS_FUCHSIA VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_FUCHSIA_EXTENSION_NAME, @@ -177,6 +179,7 @@ uint32_t VulkanDevice::GetGraphicsQueueIndex() const { bool VulkanDevice::GetSurfaceCapabilities( const VulkanSurface& surface, VkSurfaceCapabilitiesKHR* capabilities) const { +#if OS_ANDROID if (!surface.IsValid() || capabilities == nullptr) { return false; } @@ -206,6 +209,9 @@ bool VulkanDevice::GetSurfaceCapabilities( capabilities->currentExtent.width = size.width(); capabilities->currentExtent.height = size.height(); return true; +#else + return false; +#endif } bool VulkanDevice::GetPhysicalDeviceFeatures( @@ -262,6 +268,7 @@ std::vector VulkanDevice::GetQueueFamilyProperties() int VulkanDevice::ChooseSurfaceFormat(const VulkanSurface& surface, std::vector desired_formats, VkSurfaceFormatKHR* format) const { +#if OS_ANDROID if (!surface.IsValid() || format == nullptr) { return -1; } @@ -297,7 +304,7 @@ int VulkanDevice::ChooseSurfaceFormat(const VulkanSurface& surface, return static_cast(i); } } - +#endif return -1; } diff --git a/engine/src/flutter/vulkan/vulkan_native_surface_magma.cc b/engine/src/flutter/vulkan/vulkan_native_surface_magma.cc deleted file mode 100644 index 61c12d8d2d..0000000000 --- a/engine/src/flutter/vulkan/vulkan_native_surface_magma.cc +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "flutter/vulkan/vulkan_native_surface_magma.h" - -namespace vulkan { - -VulkanNativeSurfaceMagma::VulkanNativeSurfaceMagma() = default; - -VulkanNativeSurfaceMagma::VulkanNativeSurfaceMagma(int32_t width, - int32_t height) { - size_ = SkISize::Make(width, height); -} - -VulkanNativeSurfaceMagma::~VulkanNativeSurfaceMagma() = default; - -const char* VulkanNativeSurfaceMagma::GetExtensionName() const { - return VK_KHR_MAGMA_SURFACE_EXTENSION_NAME; -} - -uint32_t VulkanNativeSurfaceMagma::GetSkiaExtensionName() const { - // There is no counterpart in Skia that recognizes the Magma extension name. - // However, Flutter handles all setup anyway, so this is unnecessary. - return 0; -} - -VkSurfaceKHR VulkanNativeSurfaceMagma::CreateSurfaceHandle( - vulkan::VulkanProcTable& vk, - const vulkan::VulkanHandle& instance) const { - if (!vk.IsValid() || !instance) { - return VK_NULL_HANDLE; - } - - const VkMagmaSurfaceCreateInfoKHR create_info = { - .sType = VK_STRUCTURE_TYPE_MAGMA_SURFACE_CREATE_INFO_KHR, - .pNext = nullptr, - }; - - VkSurfaceKHR surface = VK_NULL_HANDLE; - - if (VK_CALL_LOG_ERROR(vk.CreateMagmaSurfaceKHR( - instance, &create_info, nullptr /* allocator */, &surface)) != - VK_SUCCESS) { - return VK_NULL_HANDLE; - } - - return surface; -} - -bool VulkanNativeSurfaceMagma::IsValid() const { - // vkCreateMagmaSurfaceKHR doesn't actually take a native handle. So there is - // nothing to check the validity of. - return true; -} - -SkISize VulkanNativeSurfaceMagma::GetSize() const { - if (size_.width() != 0 && size_.height() != 0) { - return size_; - } else { - // TODO: Don't hardcode this after we get a proper Fuchsia Display API. - return SkISize::Make(2160, 1440); - } -} - -} // namespace vulkan diff --git a/engine/src/flutter/vulkan/vulkan_native_surface_magma.h b/engine/src/flutter/vulkan/vulkan_native_surface_magma.h deleted file mode 100644 index 1f3bbfe2f0..0000000000 --- a/engine/src/flutter/vulkan/vulkan_native_surface_magma.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef FLUTTER_VULKAN_VULKAN_NATIVE_SURFACE_MAGMA_H_ -#define FLUTTER_VULKAN_VULKAN_NATIVE_SURFACE_MAGMA_H_ - -#include "flutter/fml/macros.h" -#include "flutter/vulkan/vulkan_native_surface.h" - -namespace vulkan { - -class VulkanNativeSurfaceMagma : public vulkan::VulkanNativeSurface { - public: - VulkanNativeSurfaceMagma(); - - // Alternate constructor which allows the caller to specify the surface's - // width and height. - // TODO: Remove this once we have a Fuchsia Display API. - VulkanNativeSurfaceMagma(int32_t surface_width, int32_t surface_height); - - ~VulkanNativeSurfaceMagma(); - - const char* GetExtensionName() const override; - - uint32_t GetSkiaExtensionName() const override; - - VkSurfaceKHR CreateSurfaceHandle( - vulkan::VulkanProcTable& vk, - const vulkan::VulkanHandle& instance) const override; - - bool IsValid() const override; - - SkISize GetSize() const override; - - private: - SkISize size_; - FML_DISALLOW_COPY_AND_ASSIGN(VulkanNativeSurfaceMagma); -}; - -} // namespace vulkan - -#endif // FLUTTER_VULKAN_VULKAN_NATIVE_SURFACE_MAGMA_H_ diff --git a/engine/src/flutter/vulkan/vulkan_proc_table.cc b/engine/src/flutter/vulkan/vulkan_proc_table.cc index 50d25b4426..b94e1ab4b2 100644 --- a/engine/src/flutter/vulkan/vulkan_proc_table.cc +++ b/engine/src/flutter/vulkan/vulkan_proc_table.cc @@ -74,29 +74,20 @@ bool VulkanProcTable::SetupInstanceProcAddresses( ACQUIRE_PROC(CreateDevice, handle); ACQUIRE_PROC(DestroyDevice, handle); ACQUIRE_PROC(DestroyInstance, handle); - ACQUIRE_PROC(DestroySurfaceKHR, handle); ACQUIRE_PROC(EnumerateDeviceLayerProperties, handle); ACQUIRE_PROC(EnumeratePhysicalDevices, handle); ACQUIRE_PROC(GetDeviceProcAddr, handle); ACQUIRE_PROC(GetPhysicalDeviceFeatures, handle); ACQUIRE_PROC(GetPhysicalDeviceQueueFamilyProperties, handle); +#if OS_ANDROID ACQUIRE_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR, handle); ACQUIRE_PROC(GetPhysicalDeviceSurfaceFormatsKHR, handle); ACQUIRE_PROC(GetPhysicalDeviceSurfacePresentModesKHR, handle); ACQUIRE_PROC(GetPhysicalDeviceSurfaceSupportKHR, handle); - -#if OS_ANDROID + ACQUIRE_PROC(DestroySurfaceKHR, handle); ACQUIRE_PROC(CreateAndroidSurfaceKHR, handle); #endif // OS_ANDROID -#if OS_FUCHSIA - [this, &handle]() -> bool { - ACQUIRE_PROC(CreateMagmaSurfaceKHR, handle); - ACQUIRE_PROC(GetPhysicalDeviceMagmaPresentationSupportKHR, handle); - return true; - }(); -#endif // OS_FUCHSIA - // The debug report functions are optional. We don't want proc acquisition to // fail here because the optional methods were not present (since ACQUIRE_PROC // returns false on failure). Wrap the optional proc acquisitions in an @@ -114,7 +105,6 @@ bool VulkanProcTable::SetupInstanceProcAddresses( bool VulkanProcTable::SetupDeviceProcAddresses( const VulkanHandle& handle) { - ACQUIRE_PROC(AcquireNextImageKHR, handle); ACQUIRE_PROC(AllocateCommandBuffers, handle); ACQUIRE_PROC(AllocateMemory, handle); ACQUIRE_PROC(BeginCommandBuffer, handle); @@ -124,25 +114,28 @@ bool VulkanProcTable::SetupDeviceProcAddresses( ACQUIRE_PROC(CreateFence, handle); ACQUIRE_PROC(CreateImage, handle); ACQUIRE_PROC(CreateSemaphore, handle); - ACQUIRE_PROC(CreateSwapchainKHR, handle); ACQUIRE_PROC(DestroyCommandPool, handle); ACQUIRE_PROC(DestroyFence, handle); ACQUIRE_PROC(DestroyImage, handle); ACQUIRE_PROC(DestroySemaphore, handle); - ACQUIRE_PROC(DestroySwapchainKHR, handle); ACQUIRE_PROC(DeviceWaitIdle, handle); ACQUIRE_PROC(EndCommandBuffer, handle); ACQUIRE_PROC(FreeCommandBuffers, handle); ACQUIRE_PROC(FreeMemory, handle); ACQUIRE_PROC(GetDeviceQueue, handle); ACQUIRE_PROC(GetImageMemoryRequirements, handle); - ACQUIRE_PROC(GetSwapchainImagesKHR, handle); - ACQUIRE_PROC(QueuePresentKHR, handle); ACQUIRE_PROC(QueueSubmit, handle); ACQUIRE_PROC(QueueWaitIdle, handle); ACQUIRE_PROC(ResetCommandBuffer, handle); ACQUIRE_PROC(ResetFences, handle); ACQUIRE_PROC(WaitForFences, handle); +#if OS_ANDROID + ACQUIRE_PROC(AcquireNextImageKHR, handle); + ACQUIRE_PROC(CreateSwapchainKHR, handle); + ACQUIRE_PROC(DestroySwapchainKHR, handle); + ACQUIRE_PROC(GetSwapchainImagesKHR, handle); + ACQUIRE_PROC(QueuePresentKHR, handle); +#endif // OS_ANDROID #if OS_FUCHSIA ACQUIRE_PROC(GetMemoryFuchsiaHandleKHR, handle); ACQUIRE_PROC(ImportSemaphoreFuchsiaHandleKHR, handle); diff --git a/engine/src/flutter/vulkan/vulkan_proc_table.h b/engine/src/flutter/vulkan/vulkan_proc_table.h index 12d4b5beb9..d145150bcf 100644 --- a/engine/src/flutter/vulkan/vulkan_proc_table.h +++ b/engine/src/flutter/vulkan/vulkan_proc_table.h @@ -100,24 +100,22 @@ class VulkanProcTable : public fml::RefCountedThreadSafe { DEFINE_PROC(GetInstanceProcAddr); DEFINE_PROC(GetPhysicalDeviceFeatures); DEFINE_PROC(GetPhysicalDeviceQueueFamilyProperties); - DEFINE_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR); - DEFINE_PROC(GetPhysicalDeviceSurfaceFormatsKHR); - DEFINE_PROC(GetPhysicalDeviceSurfacePresentModesKHR); - DEFINE_PROC(GetPhysicalDeviceSurfaceSupportKHR); - DEFINE_PROC(GetSwapchainImagesKHR); - DEFINE_PROC(QueuePresentKHR); DEFINE_PROC(QueueSubmit); DEFINE_PROC(QueueWaitIdle); DEFINE_PROC(ResetCommandBuffer); DEFINE_PROC(ResetFences); DEFINE_PROC(WaitForFences); #if OS_ANDROID + DEFINE_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR); + DEFINE_PROC(GetPhysicalDeviceSurfaceFormatsKHR); + DEFINE_PROC(GetPhysicalDeviceSurfacePresentModesKHR); + DEFINE_PROC(GetPhysicalDeviceSurfaceSupportKHR); + DEFINE_PROC(GetSwapchainImagesKHR); + DEFINE_PROC(QueuePresentKHR); DEFINE_PROC(CreateAndroidSurfaceKHR); #endif // OS_ANDROID #if OS_FUCHSIA - DEFINE_PROC(CreateMagmaSurfaceKHR); DEFINE_PROC(GetMemoryFuchsiaHandleKHR); - DEFINE_PROC(GetPhysicalDeviceMagmaPresentationSupportKHR); DEFINE_PROC(ImportSemaphoreFuchsiaHandleKHR); #endif // OS_FUCHSIA From 50efc8bc3555e57eb097b08c2d36e7b6b4c152ef Mon Sep 17 00:00:00 2001 From: Craig Stout Date: Wed, 5 Dec 2018 14:02:02 -0800 Subject: [PATCH 13/17] [vulkan] Define VK_USE_PLATFORM_FUCHSIA VK_USE_PLATFORM_MAGMA_KHR is old and will be removed. --- engine/src/flutter/vulkan/vulkan_interface.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engine/src/flutter/vulkan/vulkan_interface.h b/engine/src/flutter/vulkan/vulkan_interface.h index 6934ec9792..33b9c908b1 100644 --- a/engine/src/flutter/vulkan/vulkan_interface.h +++ b/engine/src/flutter/vulkan/vulkan_interface.h @@ -22,6 +22,9 @@ #ifndef VK_USE_PLATFORM_MAGMA_KHR #define VK_USE_PLATFORM_MAGMA_KHR 1 #endif // VK_USE_PLATFORM_MAGMA_KHR +#ifndef VK_USE_PLATFORM_FUCHSIA +#define VK_USE_PLATFORM_FUCHSIA 1 +#endif // VK_USE_PLATFORM_FUCHSIA #endif // OS_FUCHSIA #if !VULKAN_LINK_STATICALLY From 194bf111b6c05e65fe04e9b8b187f3987ebd040f Mon Sep 17 00:00:00 2001 From: Stanislav Baranov Date: Mon, 10 Dec 2018 12:19:22 -0800 Subject: [PATCH 14/17] Generalize runFromBundle to support multiple bundlePaths (flutter/engine#7151) --- .../io/flutter/view/FlutterNativeView.java | 31 +++++++----- .../io/flutter/view/FlutterRunArguments.java | 1 + .../android/platform_view_android_jni.cc | 50 ++++++++----------- 3 files changed, 42 insertions(+), 40 deletions(-) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java index bb5e132d46..bf49b43c2a 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java @@ -76,12 +76,20 @@ public class FlutterNativeView implements BinaryMessenger { } public void runFromBundle(FlutterRunArguments args) { - if (args.bundlePath == null) { - throw new AssertionError("A bundlePath must be specified"); + if (args.bundlePath == null && args.bundlePaths.length == 0) { + throw new AssertionError("Either bundlePath or bundlePaths must be specified"); + } else if ((args.bundlePath != null || args.defaultPath != null) && + args.bundlePaths.length != 0) { + throw new AssertionError("Can't specify both bundlePath and bundlePaths"); } else if (args.entrypoint == null) { - throw new AssertionError("An entrypoint must be specified"); + throw new AssertionError("An entrypoint must be specified"); + } + if (args.bundlePaths.length != 0) { + runFromBundleInternal(args.bundlePaths, args.entrypoint, args.libraryPath); + } else { + runFromBundleInternal(new String[] {args.bundlePath, args.defaultPath}, + args.entrypoint, args.libraryPath); } - runFromBundleInternal(args.bundlePath, args.entrypoint, args.libraryPath, args.defaultPath); } /** @@ -92,17 +100,17 @@ public class FlutterNativeView implements BinaryMessenger { @Deprecated public void runFromBundle(String bundlePath, String defaultPath, String entrypoint, boolean reuseRuntimeController) { - runFromBundleInternal(bundlePath, entrypoint, null, defaultPath); + runFromBundleInternal(new String[] {bundlePath, defaultPath}, entrypoint, null); } - private void runFromBundleInternal(String bundlePath, String entrypoint, - String libraryPath, String defaultPath) { + private void runFromBundleInternal(String[] bundlePaths, String entrypoint, + String libraryPath) { assertAttached(); if (applicationIsRunning) throw new AssertionError( "This Flutter engine instance is already running an application"); - nativeRunBundleAndSnapshotFromLibrary(mNativePlatformView, bundlePath, - defaultPath, entrypoint, libraryPath, mContext.getResources().getAssets()); + nativeRunBundleAndSnapshotFromLibrary(mNativePlatformView, bundlePaths, + entrypoint, libraryPath, mContext.getResources().getAssets()); applicationIsRunning = true; } @@ -240,9 +248,8 @@ public class FlutterNativeView implements BinaryMessenger { private static native void nativeDetach(long nativePlatformViewAndroid); private static native void nativeRunBundleAndSnapshotFromLibrary( - long nativePlatformViewAndroid, String bundlePath, - String defaultPath, String entrypoint, String libraryUrl, - AssetManager manager); + long nativePlatformViewAndroid, String[] bundlePaths, + String entrypoint, String libraryUrl, AssetManager manager); private static native String nativeGetObservatoryUri(); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterRunArguments.java b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterRunArguments.java index 04e13afbb5..9440933031 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterRunArguments.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterRunArguments.java @@ -9,6 +9,7 @@ package io.flutter.view; * the first time. */ public class FlutterRunArguments { + public String[] bundlePaths; public String bundlePath; public String entrypoint; public String libraryPath; diff --git a/engine/src/flutter/shell/platform/android/platform_view_android_jni.cc b/engine/src/flutter/shell/platform/android/platform_view_android_jni.cc index be42414b6c..69e40dd9e1 100644 --- a/engine/src/flutter/shell/platform/android/platform_view_android_jni.cc +++ b/engine/src/flutter/shell/platform/android/platform_view_android_jni.cc @@ -236,15 +236,17 @@ std::unique_ptr CreateIsolateConfiguration( static void RunBundleAndSnapshotFromLibrary(JNIEnv* env, jobject jcaller, jlong shell_holder, - jstring jbundlepath, - jstring jdefaultPath, + jobjectArray jbundlepaths, jstring jEntrypoint, jstring jLibraryUrl, jobject jAssetManager) { auto asset_manager = std::make_shared(); + for (const auto& bundlepath : + fml::jni::StringArrayToVector(env, jbundlepaths)) { + if (bundlepath.empty()) { + continue; + } - const auto bundlepath = fml::jni::JavaStringToString(env, jbundlepath); - if (bundlepath.size() > 0) { // If we got a bundle path, attempt to use that as a directory asset // bundle or a zip asset bundle. const auto file_ext_index = bundlepath.rfind("."); @@ -255,28 +257,21 @@ static void RunBundleAndSnapshotFromLibrary(JNIEnv* env, asset_manager->PushBack( std::make_unique(fml::OpenDirectory( bundlepath.c_str(), false, fml::FilePermission::kRead))); + + // Use the last path component of the bundle path to determine the + // directory in the APK assets. + const auto last_slash_index = bundlepath.rfind("/", bundlepath.size()); + if (last_slash_index != std::string::npos) { + auto apk_asset_dir = bundlepath.substr( + last_slash_index + 1, bundlepath.size() - last_slash_index); + + asset_manager->PushBack(std::make_unique( + env, // jni environment + jAssetManager, // asset manager + std::move(apk_asset_dir)) // apk asset dir + ); + } } - - // Use the last path component of the bundle path to determine the - // directory in the APK assets. - const auto last_slash_index = bundlepath.rfind("/", bundlepath.size()); - if (last_slash_index != std::string::npos) { - auto apk_asset_dir = bundlepath.substr( - last_slash_index + 1, bundlepath.size() - last_slash_index); - - asset_manager->PushBack(std::make_unique( - env, // jni environment - jAssetManager, // asset manager - std::move(apk_asset_dir)) // apk asset dir - ); - } - } - - const auto defaultpath = fml::jni::JavaStringToString(env, jdefaultPath); - if (defaultpath.size() > 0) { - asset_manager->PushBack( - std::make_unique(fml::OpenDirectory( - defaultpath.c_str(), false, fml::FilePermission::kRead))); } auto isolate_configuration = CreateIsolateConfiguration(*asset_manager); @@ -591,9 +586,8 @@ bool PlatformViewAndroid::Register(JNIEnv* env) { }, { .name = "nativeRunBundleAndSnapshotFromLibrary", - .signature = - "(JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;" - "Ljava/lang/String;Landroid/content/res/AssetManager;)V", + .signature = "(J[Ljava/lang/String;Ljava/lang/String;" + "Ljava/lang/String;Landroid/content/res/AssetManager;)V", .fnPtr = reinterpret_cast(&shell::RunBundleAndSnapshotFromLibrary), }, From f604da64090ea6f8047289c6589248c2025a917d Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Mon, 10 Dec 2018 12:36:09 -0800 Subject: [PATCH 15/17] Rename dart-non-checked-mode: disable-dart-asserts (flutter/engine#6977) In Dart 2, runtime checked mode has been eliminated. Many of these type checks have been moved to static compile-time checks, the remainder are enforced at runtime, and are no longer optional. --- engine/src/flutter/common/settings.cc | 2 +- engine/src/flutter/common/settings.h | 2 +- engine/src/flutter/runtime/dart_vm.cc | 10 +++++----- engine/src/flutter/shell/common/switches.cc | 4 ++-- engine/src/flutter/shell/common/switches.h | 14 +++++++------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/engine/src/flutter/common/settings.cc b/engine/src/flutter/common/settings.cc index f495bac77f..d03c52157e 100644 --- a/engine/src/flutter/common/settings.cc +++ b/engine/src/flutter/common/settings.cc @@ -35,7 +35,7 @@ std::string Settings::ToString() const { stream << "trace_startup: " << trace_startup << std::endl; stream << "endless_trace_buffer: " << endless_trace_buffer << std::endl; stream << "enable_dart_profiling: " << enable_dart_profiling << std::endl; - stream << "dart_non_checked_mode: " << dart_non_checked_mode << std::endl; + stream << "disable_dart_asserts: " << disable_dart_asserts << std::endl; stream << "enable_observatory: " << enable_observatory << std::endl; stream << "observatory_port: " << observatory_port << std::endl; stream << "ipv6: " << ipv6 << std::endl; diff --git a/engine/src/flutter/common/settings.h b/engine/src/flutter/common/settings.h index 7d9e4e0173..9e61e729d9 100644 --- a/engine/src/flutter/common/settings.h +++ b/engine/src/flutter/common/settings.h @@ -47,7 +47,7 @@ struct Settings { bool trace_startup = false; bool endless_trace_buffer = false; bool enable_dart_profiling = false; - bool dart_non_checked_mode = false; + bool disable_dart_asserts = false; // Used as the script URI in debug messages. Does not affect how the Dart code // is executed. std::string advisory_script_uri = "main.dart"; diff --git a/engine/src/flutter/runtime/dart_vm.cc b/engine/src/flutter/runtime/dart_vm.cc index 4c3f67c9f6..76613f6e4a 100644 --- a/engine/src/flutter/runtime/dart_vm.cc +++ b/engine/src/flutter/runtime/dart_vm.cc @@ -325,18 +325,18 @@ DartVM::DartVM(const Settings& settings, arraysize(kDartPrecompilationArgs)); } - // Enable checked mode if we are not running precompiled code. We run non- + // Enable Dart assertions if we are not running precompiled code. We run non- // precompiled code only in the debug product mode. - bool use_checked_mode = !settings.dart_non_checked_mode; + bool enable_asserts = !settings.disable_dart_asserts; #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_PROFILE || \ FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE - use_checked_mode = false; + enable_asserts = false; #endif #if !OS_FUCHSIA if (IsRunningPrecompiledCode()) { - use_checked_mode = false; + enable_asserts = false; } #endif // !OS_FUCHSIA @@ -347,7 +347,7 @@ DartVM::DartVM(const Settings& settings, arraysize(kDartWriteProtectCodeArgs)); #endif - if (use_checked_mode) { + if (enable_asserts) { PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); } diff --git a/engine/src/flutter/shell/common/switches.cc b/engine/src/flutter/shell/common/switches.cc index 8472f27a38..8b17a01729 100644 --- a/engine/src/flutter/shell/common/switches.cc +++ b/engine/src/flutter/shell/common/switches.cc @@ -139,8 +139,8 @@ blink::Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { } // Checked mode overrides. - settings.dart_non_checked_mode = - command_line.HasOption(FlagForSwitch(Switch::DartNonCheckedMode)); + settings.disable_dart_asserts = + command_line.HasOption(FlagForSwitch(Switch::DisableDartAsserts)); settings.ipv6 = command_line.HasOption(FlagForSwitch(Switch::IPv6)); diff --git a/engine/src/flutter/shell/common/switches.h b/engine/src/flutter/shell/common/switches.h index 9abaf7951a..829ae9c04f 100644 --- a/engine/src/flutter/shell/common/switches.h +++ b/engine/src/flutter/shell/common/switches.h @@ -120,13 +120,13 @@ DEF_SWITCH(RunForever, "run-forever", "In non-interactive mode, keep the shell running after the Dart " "script has completed.") -DEF_SWITCH(DartNonCheckedMode, - "dart-non-checked-mode", - "Dart code runs in checked mode when the runtime mode is debug. In " - "profile and release product modes, the application code is " - "precompiled and checked mode is unsupported. However, this flag " - "may be specified if the user wishes to run in the debug product " - "mode (i.e. with JIT or DBC) with checked mode off.") +DEF_SWITCH(DisableDartAsserts, + "disable-dart-asserts", + "Dart code runs with assertions enabled when the runtime mode is " + "debug. In profile and release product modes, assertions are " + "disabled. This flag may be specified if the user wishes to run " + "with assertions disabled in the debug product mode (i.e. with JIT " + "or DBC).") DEF_SWITCHES_END void PrintUsage(const std::string& executable_name); From 398355981c7770423953df68254e49cc9f62ffc3 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Mon, 10 Dec 2018 14:03:10 -0800 Subject: [PATCH 16/17] Minor comment fix and add TODO. (flutter/engine#7158) --- engine/src/flutter/third_party/txt/src/txt/paragraph.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/third_party/txt/src/txt/paragraph.cc b/engine/src/flutter/third_party/txt/src/txt/paragraph.cc index dd1c7e6718..ff017b661b 100644 --- a/engine/src/flutter/third_party/txt/src/txt/paragraph.cc +++ b/engine/src/flutter/third_party/txt/src/txt/paragraph.cc @@ -479,8 +479,12 @@ void Paragraph::Layout(double width, bool force) { } } - // Exclude trailing whitespace from right-justified lines so the last - // visible character in the line will be flush with the right margin. + // TODO(garyq): Make GetRectsForRange return a zero-width box for the + // excluded whitespace such that the caret placement is correct regardless + // of the index being whitespace or not. + + // Exclude trailing whitespace from right and center-justified lines so the + // last visible character in the line will be flush with the right margin. size_t line_end_index = (paragraph_style_.effective_align() == TextAlign::right || paragraph_style_.effective_align() == TextAlign::center) From 4edb0f1f99a98dbe12e0741b73e450c32b3954de Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 10 Dec 2018 14:38:44 -0800 Subject: [PATCH 17/17] Handle null bundlePaths in FlutterRunArguments (flutter/engine#7161) --- .../android/io/flutter/view/FlutterNativeView.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java index bf49b43c2a..6d4a4e8bdc 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterNativeView.java @@ -76,15 +76,16 @@ public class FlutterNativeView implements BinaryMessenger { } public void runFromBundle(FlutterRunArguments args) { - if (args.bundlePath == null && args.bundlePaths.length == 0) { + boolean hasBundlePaths = args.bundlePaths != null && args.bundlePaths.length != 0; + if (args.bundlePath == null && !hasBundlePaths) { throw new AssertionError("Either bundlePath or bundlePaths must be specified"); } else if ((args.bundlePath != null || args.defaultPath != null) && - args.bundlePaths.length != 0) { + hasBundlePaths) { throw new AssertionError("Can't specify both bundlePath and bundlePaths"); } else if (args.entrypoint == null) { throw new AssertionError("An entrypoint must be specified"); } - if (args.bundlePaths.length != 0) { + if (hasBundlePaths) { runFromBundleInternal(args.bundlePaths, args.entrypoint, args.libraryPath); } else { runFromBundleInternal(new String[] {args.bundlePath, args.defaultPath},