From fd762144ef5caae2eaf14e5fd2f2ecfd47812cb2 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 19 Oct 2020 18:29:50 -0700 Subject: [PATCH] Fix native constructor of list of zircon handles and remove unused list factory specializations. The Fuchsia specific Dart utilities don't use Tonic and hence are unaffected by the recent changes to the engine for sound null-safety. This patch fixes the creation of lists of non-nullable Zircon handles. While looking for potential unpatched callsites that create lists of non-nullable handles from native code, I also found a couple of unused and incomplete specializations. I have removed the same. Fixes https://github.com/flutter/flutter/issues/68496 --- lib/ui/text/text_box.h | 14 -------------- .../fuchsia/dart-pkg/zircon/sdk_ext/system.cc | 3 ++- third_party/tonic/dart_wrappable.h | 12 ------------ 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/lib/ui/text/text_box.h b/lib/ui/text/text_box.h index c3eea00aa8999..27f60670f232f 100644 --- a/lib/ui/text/text_box.h +++ b/lib/ui/text/text_box.h @@ -25,18 +25,4 @@ struct TextBox { } // namespace flutter -namespace tonic { - -template <> -struct DartConverter { - static Dart_Handle ToDart(const flutter::TextBox& val); -}; - -template <> -struct DartListFactory { - static Dart_Handle NewList(intptr_t length); -}; - -} // namespace tonic - #endif // FLUTTER_LIB_UI_TEXT_TEXT_BOX_H_ diff --git a/shell/platform/fuchsia/dart-pkg/zircon/sdk_ext/system.cc b/shell/platform/fuchsia/dart-pkg/zircon/sdk_ext/system.cc index 1c3d642a2c987..9482c453d50ca 100644 --- a/shell/platform/fuchsia/dart-pkg/zircon/sdk_ext/system.cc +++ b/shell/platform/fuchsia/dart-pkg/zircon/sdk_ext/system.cc @@ -98,7 +98,8 @@ Dart_Handle MakeHandleList(const std::vector& in_handles) { tonic::DartClassLibrary& class_library = tonic::DartState::Current()->class_library(); Dart_Handle handle_type = class_library.GetClass("zircon", "Handle"); - Dart_Handle list = Dart_NewListOfType(handle_type, in_handles.size()); + Dart_Handle list = Dart_NewListOfTypeFilled( + handle_type, Handle::CreateInvalid(), in_handles.size()); if (Dart_IsError(list)) return list; for (size_t i = 0; i < in_handles.size(); i++) { diff --git a/third_party/tonic/dart_wrappable.h b/third_party/tonic/dart_wrappable.h index 49b0a2c40baf3..a036abb854e7c 100644 --- a/third_party/tonic/dart_wrappable.h +++ b/third_party/tonic/dart_wrappable.h @@ -166,18 +166,6 @@ struct DartConverter> { } }; -template