[vm] Remove old flutter_engine patches

Dart has rolled beyond these Dart SDK hashes in flutter/engine/DEPS.

Change-Id: Ib7dc7b7f746b8485348cef09d30f67bf3b965bac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170426
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
Daco Harkes 2020-11-05 11:34:13 +00:00 committed by commit-bot@chromium.org
parent 27ca552ddb
commit d9d0cc61c4
2 changed files with 0 additions and 1400 deletions

View file

@ -1,596 +0,0 @@
diff --git a/DEPS b/DEPS
index 01113f340..e55da1cff 100644
--- a/DEPS
+++ b/DEPS
@@ -34,14 +34,14 @@ 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': 'a3815b659047cfc6b63d41d180aa1ca1b781ee68',
# WARNING: DO NOT EDIT MANUALLY
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
'dart_args_tag': '1.6.0',
'dart_boringssl_gen_rev': '429ccb1877f7987a6f3988228bc2440e61293499',
'dart_boringssl_rev': '4dfd5af70191b068aebe567b8e29ce108cee85ce',
- 'dart_collection_rev': '80f5b6de8a8d8d584732a71bb59912da3e44883b',
+ 'dart_collection_rev': '583693680fc067e34ca5b72503df25e8b80579f9',
'dart_dart2js_info_tag': '0.6.0',
'dart_dart_style_tag': '1.3.6',
'dart_http_retry_tag': '0.1.1',
@@ -49,7 +49,6 @@ vars = {
'dart_intl_tag': '0.16.1',
'dart_linter_tag': '0.1.117',
'dart_oauth2_tag': '1.6.0',
- 'dart_pedantic_tag': 'v1.9.0',
'dart_protobuf_rev': '3746c8fd3f2b0147623a8e3db89c3ff4330de760',
'dart_pub_rev': '04b054b62cc437cf23451785fdc50e49cd9de139',
'dart_pub_semver_tag': 'v1.4.4',
@@ -61,15 +60,13 @@ vars = {
'dart_shelf_static_rev': 'v0.2.8',
'dart_shelf_tag': '0.7.3+3',
'dart_shelf_web_socket_tag': '0.2.2+3',
- 'dart_source_map_stack_trace_tag': '2.0.0',
- 'dart_source_span_tag': '1.7.0',
'dart_sse_tag': 'e5cf68975e8e87171a3dc297577aa073454a91dc',
- 'dart_stack_trace_tag': '56811dbb2530d823b764fe167ec335879a4adb32',
+ 'dart_stack_trace_tag': 'd3813ca0a77348e0faf0d6af0cc17913e36afa39',
'dart_stagehand_tag': 'v3.3.9',
- 'dart_stream_channel_tag': '70433d577be02c48cb16d72d65654f3b4d82c6ed',
+ 'dart_stream_channel_tag': 'c446774fd077c9bdbd6235a7aadc661ef60a9727',
'dart_test_reflective_loader_tag': '0.1.9',
'dart_tflite_native_rev': '3c777c40608a2a9f1427bfe0028ab48e7116b4c1',
- 'dart_typed_data_tag': '0c369b73a9b7ebf042c06512951bfe5b52b84a5f',
+ 'dart_typed_data_tag': 'f94fc57b8e8c0e4fe4ff6cfd8290b94af52d3719',
'dart_usage_tag': '3.4.0',
'dart_watcher_rev': 'fc3c9aae5d31d707b3013b42634dde8d8a1161b4',
@@ -171,13 +168,13 @@ deps = {
Var('dart_git') + '/args.git' + '@' + Var('dart_args_tag'),
'src/third_party/dart/third_party/pkg/async':
- Var('dart_git') + '/async.git@6b90f4557f330e1ead021f501ee7f1d8b0e77815',
+ Var('dart_git') + '/async.git@128c461a97dbdbd9336ba000ba5a5c02e79b8651',
'src/third_party/dart/third_party/pkg/bazel_worker':
Var('dart_git') + '/bazel_worker.git@26680d5e249b249c7216ab2fed0ac8ed4ee285c5',
'src/third_party/dart/third_party/pkg/boolean_selector':
- Var('dart_git') + '/boolean_selector.git@1309eabed510cc3b7536fd4367d39b97ebee3d69',
+ Var('dart_git') + '/boolean_selector.git@665e6921ab246569420376f827bff4585dff0b14',
'src/third_party/dart/third_party/pkg/charcode':
Var('dart_git') + '/charcode.git@af1e2d59a9c383da94f99ea51dac4b93fb0626c4',
@@ -207,7 +204,7 @@ deps = {
Var('dart_git') + '/ffi.git@454ab0f9ea6bd06942a983238d8a6818b1357edb',
'src/third_party/dart/third_party/pkg/fixnum':
- Var('dart_git') + '/fixnum.git@9b38f49f6679654d66a363e69e48173cca07e882',
+ Var('dart_git') + '/fixnum.git@300c3f025e94a72b7b6770e15f76a4de15f77668',
'src/third_party/dart/third_party/pkg/glob':
Var('dart_git') + '/glob.git@e9f4e6b7ae8abe5071461cf8f47191bb19cf7ef6',
@@ -246,7 +243,7 @@ deps = {
Var('dart_git') + '/markdown.git@dd150bb64c5f3b41d31f20f399ae2a855f7f8c00',
'src/third_party/dart/third_party/pkg/matcher':
- Var('dart_git') + '/matcher.git@8f8d965933c94a489b1a39e20d558a32841bfa5b',
+ Var('dart_git') + '/matcher.git@9cae8faa7868bf3a88a7ba45eb0bd128e66ac515',
'src/third_party/dart/third_party/pkg/mime':
Var('dart_git') + '/mime.git@179b5e6a88f4b63f36dc1b8fcbc1e83e5e0cd3a7',
@@ -261,13 +258,13 @@ deps = {
Var('dart_git') + '/oauth2.git' + '@' + Var('dart_oauth2_tag'),
'src/third_party/dart/third_party/pkg/path':
- Var('dart_git') + '/path.git@4f3bb71843fe5493ba490828a1721821d7b33746',
+ Var('dart_git') + '/path.git@62ecd5a78ffe5734d14ed0df76d20309084cd04a',
'src/third_party/dart/third_party/pkg/pedantic':
- Var('dart_git') + '/pedantic.git' + '@' + Var('dart_pedantic_tag'),
+ Var('dart_git') + '/pedantic.git@24b38df72430d7e21cb4257828580becb9a39c72',
'src/third_party/dart/third_party/pkg/pool':
- Var('dart_git') + '/pool.git@86fbb2cde9bbc66c8d159909d2f65a5981ea5b50',
+ Var('dart_git') + '/pool.git@eedbd5fde84f9a1a8da643b475305a81841da599',
'src/third_party/dart/third_party/pkg/protobuf':
Var('dart_git') + '/protobuf.git' + '@' + Var('dart_protobuf_rev'),
@@ -300,13 +297,13 @@ deps = {
Var('dart_git') + '/shelf_web_socket.git' + '@' + Var('dart_shelf_web_socket_tag'),
'src/third_party/dart/third_party/pkg/source_map_stack_trace':
- Var('dart_git') + '/source_map_stack_trace.git' + '@' + Var('dart_source_map_stack_trace_tag'),
+ Var('dart_git') + '/source_map_stack_trace.git@1c3026f69d9771acf2f8c176a1ab750463309cce',
'src/third_party/dart/third_party/pkg/source_maps':
- Var('dart_git') + '/source_maps.git@87b4fd9027378bbd51b02e9d7df794eee8a82b7a',
+ Var('dart_git') + '/source_maps.git@53eb92ccfe6e64924054f83038a534b959b12b3e',
'src/third_party/dart/third_party/pkg/source_span':
- Var('dart_git') + '/source_span.git' + '@' + Var('dart_source_span_tag'),
+ Var('dart_git') + '/source_span.git@94833d6cbf4552ebe5d2aa6714acecd93834e53a',
'src/third_party/dart/third_party/pkg/sse':
Var('dart_git') + '/sse.git' + '@' + Var('dart_sse_tag'),
@@ -321,13 +318,13 @@ deps = {
Var('dart_git') + '/stream_channel.git' + '@' + Var('dart_stream_channel_tag'),
'src/third_party/dart/third_party/pkg/string_scanner':
- Var('dart_git') + '/string_scanner.git@a918e7371af6b6e73bfd534ff9da6084741c1f99',
+ Var('dart_git') + '/string_scanner.git@1b63e6e5db5933d7be0a45da6e1129fe00262734',
'src/third_party/dart/third_party/pkg/term_glyph':
- Var('dart_git') + '/term_glyph.git@b3da31e9684a99cfe5f192b89914492018b44da7',
+ Var('dart_git') + '/term_glyph.git@6a0f9b6fb645ba75e7a00a4e20072678327a0347',
'src/third_party/dart/third_party/pkg/test':
- Var('dart_git') + '/test.git@718fe6f93c4655208460f28e89d887c5ef4144c5',
+ Var('dart_git') + '/test.git@c6b3fe63eda87da1687580071cad1eefd575f851',
'src/third_party/dart/third_party/pkg/test_reflective_loader':
Var('dart_git') + '/test_reflective_loader.git' + '@' + Var('dart_test_reflective_loader_tag'),
@@ -357,7 +354,7 @@ deps = {
Var('dart_git') + '/package_config.git@9c586d04bd26fef01215fd10e7ab96a3050cfa64',
'src/third_party/dart/tools/sdks':
- {'packages': [{'version': 'version:2.9.0-21.0.dev', 'package': 'dart/dart-sdk/${{platform}}'}], 'dep_type': 'cipd'},
+ {'packages': [{'version': 'version:2.10.0-0.2-preview', 'package': 'dart/dart-sdk/${{platform}}'}], 'dep_type': 'cipd'},
# WARNING: end of dart dependencies list that is cleaned up automatically - see create_updated_flutter_deps.py.
diff --git a/lib/ui/annotations.dart b/lib/ui/annotations.dart
index 45d8ca6cc..b300af073 100644
--- a/lib/ui/annotations.dart
+++ b/lib/ui/annotations.dart
@@ -4,7 +4,7 @@
// TODO(dnfield): Remove unused_import ignores when https://github.com/dart-lang/sdk/issues/35164 is resolved.
-// @dart = 2.9
+// @dart = 2.10
part of dart.ui;
diff --git a/lib/ui/channel_buffers.dart b/lib/ui/channel_buffers.dart
index cb32c4581..39d31d271 100644
--- a/lib/ui/channel_buffers.dart
+++ b/lib/ui/channel_buffers.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of dart.ui;
diff --git a/lib/ui/compositing.dart b/lib/ui/compositing.dart
index ea3c0b714..4e0553936 100644
--- a/lib/ui/compositing.dart
+++ b/lib/ui/compositing.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of dart.ui;
diff --git a/lib/ui/geometry.dart b/lib/ui/geometry.dart
index 2739048e7..a7404996c 100644
--- a/lib/ui/geometry.dart
+++ b/lib/ui/geometry.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of dart.ui;
diff --git a/lib/ui/hash_codes.dart b/lib/ui/hash_codes.dart
index a6ede7849..7da175a27 100644
--- a/lib/ui/hash_codes.dart
+++ b/lib/ui/hash_codes.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of dart.ui;
diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart
index ff2dcaa12..39bab1240 100644
--- a/lib/ui/hooks.dart
+++ b/lib/ui/hooks.dart
@@ -4,7 +4,7 @@
// TODO(dnfield): Remove unused_import ignores when https://github.com/dart-lang/sdk/issues/35164 is resolved.
-// @dart = 2.9
+// @dart = 2.10
part of dart.ui;
diff --git a/lib/ui/isolate_name_server.dart b/lib/ui/isolate_name_server.dart
index d976e0ac2..4b5c2c84d 100644
--- a/lib/ui/isolate_name_server.dart
+++ b/lib/ui/isolate_name_server.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of dart.ui;
diff --git a/lib/ui/lerp.dart b/lib/ui/lerp.dart
index db9f7b2ec..0bb0a08b7 100644
--- a/lib/ui/lerp.dart
+++ b/lib/ui/lerp.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of dart.ui;
diff --git a/lib/ui/natives.dart b/lib/ui/natives.dart
index ce29fe15c..0f2939592 100644
--- a/lib/ui/natives.dart
+++ b/lib/ui/natives.dart
@@ -4,7 +4,7 @@
// TODO(dnfield): remove unused_element ignores when https://github.com/dart-lang/sdk/issues/35164 is resolved.
-// @dart = 2.9
+// @dart = 2.10
part of dart.ui;
diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart
index 992db71cf..2599f90e2 100644
--- a/lib/ui/painting.dart
+++ b/lib/ui/painting.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of dart.ui;
diff --git a/lib/ui/plugins.dart b/lib/ui/plugins.dart
index 64eca6e04..9622852fd 100644
--- a/lib/ui/plugins.dart
+++ b/lib/ui/plugins.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of dart.ui;
diff --git a/lib/ui/pointer.dart b/lib/ui/pointer.dart
index 3c12cb971..3c8ffefaf 100644
--- a/lib/ui/pointer.dart
+++ b/lib/ui/pointer.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of dart.ui;
diff --git a/lib/ui/semantics.dart b/lib/ui/semantics.dart
index bee542328..518a69412 100644
--- a/lib/ui/semantics.dart
+++ b/lib/ui/semantics.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of dart.ui;
diff --git a/lib/ui/text.dart b/lib/ui/text.dart
index 8bdc0f05d..c246731d8 100644
--- a/lib/ui/text.dart
+++ b/lib/ui/text.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of dart.ui;
diff --git a/lib/ui/ui.dart b/lib/ui/ui.dart
index 7612cf509..fe0e4fa16 100644
--- a/lib/ui/ui.dart
+++ b/lib/ui/ui.dart
@@ -9,7 +9,7 @@
/// This library exposes the lowest-level services that Flutter frameworks use
/// to bootstrap applications, such as classes for driving the input, graphics
/// text, layout, and rendering subsystems.
-// @dart = 2.9
+// @dart = 2.10
library dart.ui;
import 'dart:_internal' hide Symbol; // ignore: unused_import
diff --git a/lib/ui/window.dart b/lib/ui/window.dart
index 815bee5a1..22f9ed0c3 100644
--- a/lib/ui/window.dart
+++ b/lib/ui/window.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of dart.ui;
/// Signature of callbacks that have no arguments and return no data.
diff --git a/lib/web_ui/lib/src/ui/annotations.dart b/lib/web_ui/lib/src/ui/annotations.dart
index 977ca70ca..7dac0c567 100644
--- a/lib/web_ui/lib/src/ui/annotations.dart
+++ b/lib/web_ui/lib/src/ui/annotations.dart
@@ -4,7 +4,7 @@
// TODO(dnfield): Remove unused_import ignores when https://github.com/dart-lang/sdk/issues/35164 is resolved.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
// TODO(dnfield): Update this if/when we default this to on in the tool,
diff --git a/lib/web_ui/lib/src/ui/canvas.dart b/lib/web_ui/lib/src/ui/canvas.dart
index 1061ab718..ee185ef29 100644
--- a/lib/web_ui/lib/src/ui/canvas.dart
+++ b/lib/web_ui/lib/src/ui/canvas.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
/// Defines how a list of points is interpreted when drawing a set of points.
diff --git a/lib/web_ui/lib/src/ui/channel_buffers.dart b/lib/web_ui/lib/src/ui/channel_buffers.dart
index 5d3db5da5..6ce0bc962 100644
--- a/lib/web_ui/lib/src/ui/channel_buffers.dart
+++ b/lib/web_ui/lib/src/ui/channel_buffers.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
/// A saved platform message for a channel with its callback.
diff --git a/lib/web_ui/lib/src/ui/compositing.dart b/lib/web_ui/lib/src/ui/compositing.dart
index 635dd7261..11a0e1199 100644
--- a/lib/web_ui/lib/src/ui/compositing.dart
+++ b/lib/web_ui/lib/src/ui/compositing.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
/// An opaque object representing a composited scene.
diff --git a/lib/web_ui/lib/src/ui/geometry.dart b/lib/web_ui/lib/src/ui/geometry.dart
index 904cec065..c528c8c73 100644
--- a/lib/web_ui/lib/src/ui/geometry.dart
+++ b/lib/web_ui/lib/src/ui/geometry.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
/// Base class for [Size] and [Offset], which are both ways to describe
diff --git a/lib/web_ui/lib/src/ui/hash_codes.dart b/lib/web_ui/lib/src/ui/hash_codes.dart
index 69aeb33bb..e91fb1cc5 100644
--- a/lib/web_ui/lib/src/ui/hash_codes.dart
+++ b/lib/web_ui/lib/src/ui/hash_codes.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
class _HashEnd { const _HashEnd(); }
diff --git a/lib/web_ui/lib/src/ui/initialization.dart b/lib/web_ui/lib/src/ui/initialization.dart
index 2749fa9e5..6865da812 100644
--- a/lib/web_ui/lib/src/ui/initialization.dart
+++ b/lib/web_ui/lib/src/ui/initialization.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
/// Initializes the platform.
diff --git a/lib/web_ui/lib/src/ui/lerp.dart b/lib/web_ui/lib/src/ui/lerp.dart
index bcc278f8a..5cd4c8ac1 100644
--- a/lib/web_ui/lib/src/ui/lerp.dart
+++ b/lib/web_ui/lib/src/ui/lerp.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
/// Linearly interpolate between two numbers.
diff --git a/lib/web_ui/lib/src/ui/natives.dart b/lib/web_ui/lib/src/ui/natives.dart
index e4bf1a2f5..4763db34e 100644
--- a/lib/web_ui/lib/src/ui/natives.dart
+++ b/lib/web_ui/lib/src/ui/natives.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
// Corelib 'print' implementation.
diff --git a/lib/web_ui/lib/src/ui/painting.dart b/lib/web_ui/lib/src/ui/painting.dart
index a9bd10662..67da1842f 100644
--- a/lib/web_ui/lib/src/ui/painting.dart
+++ b/lib/web_ui/lib/src/ui/painting.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
// ignore: unused_element, Used in Shader assert.
diff --git a/lib/web_ui/lib/src/ui/path.dart b/lib/web_ui/lib/src/ui/path.dart
index 18e351f53..1514d2432 100644
--- a/lib/web_ui/lib/src/ui/path.dart
+++ b/lib/web_ui/lib/src/ui/path.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
/// A complex, one-dimensional subset of a plane.
diff --git a/lib/web_ui/lib/src/ui/path_metrics.dart b/lib/web_ui/lib/src/ui/path_metrics.dart
index 6d54888c2..b65e2b928 100644
--- a/lib/web_ui/lib/src/ui/path_metrics.dart
+++ b/lib/web_ui/lib/src/ui/path_metrics.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
/// An iterable collection of [PathMetric] objects describing a [Path].
diff --git a/lib/web_ui/lib/src/ui/pointer.dart b/lib/web_ui/lib/src/ui/pointer.dart
index 698badcc4..e2f351caf 100644
--- a/lib/web_ui/lib/src/ui/pointer.dart
+++ b/lib/web_ui/lib/src/ui/pointer.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
/// How the pointer has changed since the last report.
diff --git a/lib/web_ui/lib/src/ui/semantics.dart b/lib/web_ui/lib/src/ui/semantics.dart
index c6dffe2fc..a0fde9a5b 100644
--- a/lib/web_ui/lib/src/ui/semantics.dart
+++ b/lib/web_ui/lib/src/ui/semantics.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
/// The possible actions that can be conveyed from the operating system
diff --git a/lib/web_ui/lib/src/ui/test_embedding.dart b/lib/web_ui/lib/src/ui/test_embedding.dart
index f72a5c75e..955dbfe53 100644
--- a/lib/web_ui/lib/src/ui/test_embedding.dart
+++ b/lib/web_ui/lib/src/ui/test_embedding.dart
@@ -4,7 +4,7 @@
// TODO(flutter_web): the Web-only API below need to be cleaned up.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
/// Used to track when the platform is initialized. This ensures the test fonts
diff --git a/lib/web_ui/lib/src/ui/text.dart b/lib/web_ui/lib/src/ui/text.dart
index ec9a45943..58698d862 100644
--- a/lib/web_ui/lib/src/ui/text.dart
+++ b/lib/web_ui/lib/src/ui/text.dart
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// Synced 2019-05-30T14:20:57.833907.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
/// Whether to slant the glyphs in the font
diff --git a/lib/web_ui/lib/src/ui/tile_mode.dart b/lib/web_ui/lib/src/ui/tile_mode.dart
index 8fd24ae58..9ce9ddf3c 100644
--- a/lib/web_ui/lib/src/ui/tile_mode.dart
+++ b/lib/web_ui/lib/src/ui/tile_mode.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
/// Defines what happens at the edge of the gradient.
diff --git a/lib/web_ui/lib/src/ui/window.dart b/lib/web_ui/lib/src/ui/window.dart
index 557e6aa84..fd9e66740 100644
--- a/lib/web_ui/lib/src/ui/window.dart
+++ b/lib/web_ui/lib/src/ui/window.dart
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// Synced 2019-05-30T14:20:57.841444.
-// @dart = 2.9
+// @dart = 2.10
part of ui;
/// Signature of callbacks that have no arguments and return no data.
diff --git a/lib/web_ui/lib/ui.dart b/lib/web_ui/lib/ui.dart
index 49217e14a..13d5ee281 100644
--- a/lib/web_ui/lib/ui.dart
+++ b/lib/web_ui/lib/ui.dart
@@ -5,7 +5,7 @@
/// This library defines the web equivalent of the native dart:ui.
///
/// All types in this library are public.
-// @dart = 2.9
+// @dart = 2.10
library ui;
import 'dart:async';

View file

@ -1,804 +0,0 @@
diff --git a/BUILD.gn b/BUILD.gn
index edbeb6803..e280ae901 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -98,6 +98,7 @@ group("flutter") {
"//flutter/shell/platform/embedder:embedder_proctable_unittests",
"//flutter/shell/platform/embedder:embedder_unittests",
"//flutter/testing:testing_unittests",
+ "//flutter/third_party/tonic/tests:tonic_unittests",
"//flutter/third_party/txt:txt_unittests",
]
diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter
index f13271aa9..6b84f6a83 100755
--- a/ci/licenses_golden/licenses_flutter
+++ b/ci/licenses_golden/licenses_flutter
@@ -1463,6 +1463,8 @@ FILE: ../../../flutter/third_party/tonic/dart_persistent_value.cc
FILE: ../../../flutter/third_party/tonic/dart_persistent_value.h
FILE: ../../../flutter/third_party/tonic/dart_state.cc
FILE: ../../../flutter/third_party/tonic/dart_state.h
+FILE: ../../../flutter/third_party/tonic/dart_weak_persistent_value.cc
+FILE: ../../../flutter/third_party/tonic/dart_weak_persistent_value.h
FILE: ../../../flutter/third_party/tonic/dart_wrappable.cc
FILE: ../../../flutter/third_party/tonic/dart_wrappable.h
FILE: ../../../flutter/third_party/tonic/dart_wrapper_info.h
diff --git a/lib/ui/painting/image_decoder.cc b/lib/ui/painting/image_decoder.cc
index d6c4a668f..b6ffb20f5 100644
--- a/lib/ui/painting/image_decoder.cc
+++ b/lib/ui/painting/image_decoder.cc
@@ -224,12 +224,13 @@ void ImageDecoder::Decode(fml::RefPtr<ImageDescriptor> descriptor,
FML_DCHECK(callback);
FML_DCHECK(runners_.GetUITaskRunner()->RunsTasksOnCurrentThread());
- // Always service the callback on the UI thread.
- auto result = [callback, ui_runner = runners_.GetUITaskRunner()](
+ // Always service the callback (and cleanup the descriptor) on the UI thread.
+ auto result = [callback, descriptor, ui_runner = runners_.GetUITaskRunner()](
SkiaGPUObject<SkImage> image,
fml::tracing::TraceFlow flow) {
- ui_runner->PostTask(fml::MakeCopyable(
- [callback, image = std::move(image), flow = std::move(flow)]() mutable {
+ ui_runner->PostTask(
+ fml::MakeCopyable([callback, descriptor, image = std::move(image),
+ flow = std::move(flow)]() mutable {
// We are going to terminate the trace flow here. Flows cannot
// terminate without a base trace. Add one explicitly.
TRACE_EVENT0("flutter", "ImageDecodeCallback");
diff --git a/lib/ui/painting/image_encoding.cc b/lib/ui/painting/image_encoding.cc
index c17a784c5..8a7653f0b 100644
--- a/lib/ui/painting/image_encoding.cc
+++ b/lib/ui/painting/image_encoding.cc
@@ -35,9 +35,7 @@ enum ImageByteFormat {
kPNG,
};
-void FinalizeSkData(void* isolate_callback_data,
- Dart_WeakPersistentHandle handle,
- void* peer) {
+void FinalizeSkData(void* isolate_callback_data, void* peer) {
SkData* buffer = reinterpret_cast<SkData*>(peer);
buffer->unref();
}
diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc
index b834957a9..8a6215110 100644
--- a/runtime/dart_isolate.cc
+++ b/runtime/dart_isolate.cc
@@ -981,6 +981,11 @@ void DartIsolate::AddIsolateShutdownCallback(const fml::closure& closure) {
}
void DartIsolate::OnShutdownCallback() {
+ tonic::DartState* state = tonic::DartState::Current();
+ if (state != nullptr) {
+ state->SetIsShuttingDown();
+ }
+
{
tonic::DartApiScope api_scope;
Dart_Handle sticky_error = Dart_GetStickyError();
diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc
index ae9849a5a..b0c61a1b5 100644
--- a/shell/platform/embedder/embedder.cc
+++ b/shell/platform/embedder/embedder.cc
@@ -1922,8 +1922,7 @@ FlutterEngineResult FlutterEnginePostDartObject(
dart_object.value.as_external_typed_data.data = buffer;
dart_object.value.as_external_typed_data.peer = peer;
dart_object.value.as_external_typed_data.callback =
- +[](void* unused_isolate_callback_data,
- Dart_WeakPersistentHandle unused_handle, void* peer) {
+ +[](void* unused_isolate_callback_data, void* peer) {
auto typed_peer = reinterpret_cast<ExternalTypedDataPeer*>(peer);
typed_peer->trampoline(typed_peer->user_data);
delete typed_peer;
diff --git a/shell/platform/fuchsia/dart_runner/dart_runner.cc b/shell/platform/fuchsia/dart_runner/dart_runner.cc
index 76d85405a..415d2885c 100644
--- a/shell/platform/fuchsia/dart_runner/dart_runner.cc
+++ b/shell/platform/fuchsia/dart_runner/dart_runner.cc
@@ -86,6 +86,10 @@ void IsolateShutdownCallback(void* isolate_group_data, void* isolate_data) {
tonic::DartMicrotaskQueue::GetForCurrentThread()->Destroy();
async_loop_quit(loop);
}
+
+ auto state =
+ static_cast<std::shared_ptr<tonic::DartState>*>(isolate_group_data);
+ state->get()->SetIsShuttingDown();
}
void IsolateGroupCleanupCallback(void* isolate_group_data) {
diff --git a/testing/run_tests.py b/testing/run_tests.py
index 06b8256d0..8bdd114f4 100755
--- a/testing/run_tests.py
+++ b/testing/run_tests.py
@@ -132,6 +132,8 @@ def RunCCTests(build_dir, filter):
RunEngineExecutable(build_dir, 'runtime_unittests', filter, shuffle_flags)
+ RunEngineExecutable(build_dir, 'tonic_unittests', filter, shuffle_flags)
+
if not IsWindows():
# https://github.com/flutter/flutter/issues/36295
RunEngineExecutable(build_dir, 'shell_unittests', filter, shuffle_flags)
diff --git a/third_party/tonic/BUILD.gn b/third_party/tonic/BUILD.gn
index f5bedda8d..9a6abda8b 100644
--- a/third_party/tonic/BUILD.gn
+++ b/third_party/tonic/BUILD.gn
@@ -35,6 +35,8 @@ source_set("tonic") {
"dart_persistent_value.h",
"dart_state.cc",
"dart_state.h",
+ "dart_weak_persistent_value.cc",
+ "dart_weak_persistent_value.h",
"dart_wrappable.cc",
"dart_wrappable.h",
"dart_wrapper_info.h",
diff --git a/third_party/tonic/dart_state.cc b/third_party/tonic/dart_state.cc
index b711a2297..3f37685c5 100644
--- a/third_party/tonic/dart_state.cc
+++ b/third_party/tonic/dart_state.cc
@@ -27,7 +27,8 @@ DartState::DartState(int dirfd,
message_handler_(new DartMessageHandler()),
file_loader_(new FileLoader(dirfd)),
message_epilogue_(message_epilogue),
- has_set_return_code_(false) {}
+ has_set_return_code_(false),
+ is_shutting_down_(false) {}
DartState::~DartState() {}
diff --git a/third_party/tonic/dart_state.h b/third_party/tonic/dart_state.h
index 845914937..1984a66bf 100644
--- a/third_party/tonic/dart_state.h
+++ b/third_party/tonic/dart_state.h
@@ -5,6 +5,7 @@
#ifndef LIB_TONIC_DART_STATE_H_
#define LIB_TONIC_DART_STATE_H_
+#include <atomic>
#include <functional>
#include <memory>
@@ -68,6 +69,9 @@ class DartState : public std::enable_shared_from_this<DartState> {
void SetReturnCodeCallback(std::function<void(uint32_t)> callback);
bool has_set_return_code() const { return has_set_return_code_; }
+ void SetIsShuttingDown() { is_shutting_down_ = true; }
+ bool IsShuttingDown() { return is_shutting_down_; }
+
virtual void DidSetIsolate();
static Dart_Handle HandleLibraryTag(Dart_LibraryTag tag,
@@ -83,6 +87,7 @@ class DartState : public std::enable_shared_from_this<DartState> {
std::function<void(Dart_Handle)> message_epilogue_;
std::function<void(uint32_t)> set_return_code_callback_;
bool has_set_return_code_;
+ std::atomic<bool> is_shutting_down_;
protected:
TONIC_DISALLOW_COPY_AND_ASSIGN(DartState);
diff --git a/third_party/tonic/dart_weak_persistent_value.cc b/third_party/tonic/dart_weak_persistent_value.cc
new file mode 100644
index 000000000..a2664d3e0
--- /dev/null
+++ b/third_party/tonic/dart_weak_persistent_value.cc
@@ -0,0 +1,70 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tonic/dart_weak_persistent_value.h"
+
+#include "tonic/dart_state.h"
+#include "tonic/scopes/dart_isolate_scope.h"
+
+namespace tonic {
+
+DartWeakPersistentValue::DartWeakPersistentValue() : handle_(nullptr) {}
+
+DartWeakPersistentValue::~DartWeakPersistentValue() {
+ Clear();
+}
+
+void DartWeakPersistentValue::Set(DartState* dart_state,
+ Dart_Handle object,
+ void* peer,
+ intptr_t external_allocation_size,
+ Dart_HandleFinalizer callback) {
+ TONIC_DCHECK(is_empty());
+ dart_state_ = dart_state->GetWeakPtr();
+ handle_ = Dart_NewWeakPersistentHandle(object, peer, external_allocation_size,
+ callback);
+}
+
+void DartWeakPersistentValue::Clear() {
+ if (!handle_) {
+ return;
+ }
+
+ auto dart_state = dart_state_.lock();
+ if (!dart_state) {
+ // The DartVM that the handle used to belong to has been shut down and that
+ // handle has already been deleted.
+ handle_ = nullptr;
+ return;
+ }
+
+ // The DartVM frees the handles during shutdown and calls the finalizers.
+ // Freeing handles during shutdown would fail.
+ if (!dart_state->IsShuttingDown()) {
+ if (Dart_CurrentIsolateGroup()) {
+ Dart_DeleteWeakPersistentHandle(handle_);
+ } else {
+ // If we are not on the mutator thread, this will fail. The caller must
+ // ensure to be on the mutator thread.
+ DartIsolateScope scope(dart_state->isolate());
+ Dart_DeleteWeakPersistentHandle(handle_);
+ }
+ }
+ // If it's shutting down, the handle will be deleted already.
+
+ dart_state_.reset();
+ handle_ = nullptr;
+}
+
+Dart_Handle DartWeakPersistentValue::Get() {
+ auto dart_state = dart_state_.lock();
+ TONIC_DCHECK(dart_state);
+ TONIC_DCHECK(!dart_state->IsShuttingDown());
+ if (!handle_) {
+ return nullptr;
+ }
+ return Dart_HandleFromWeakPersistent(handle_);
+}
+
+} // namespace tonic
diff --git a/third_party/tonic/dart_weak_persistent_value.h b/third_party/tonic/dart_weak_persistent_value.h
new file mode 100644
index 000000000..5f8aed5ee
--- /dev/null
+++ b/third_party/tonic/dart_weak_persistent_value.h
@@ -0,0 +1,48 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef LIB_TONIC_DART_WEAK_PERSISTENT_VALUE_H_
+#define LIB_TONIC_DART_WEAK_PERSISTENT_VALUE_H_
+
+#include <memory>
+
+#include "third_party/dart/runtime/include/dart_api.h"
+#include "tonic/common/macros.h"
+
+namespace tonic {
+class DartState;
+
+// DartWeakPersistentValue is a bookkeeping class to help pair calls to
+// Dart_NewWeakPersistentHandle with Dart_DeleteWeakPersistentHandle even in
+// the case if IsolateGroup shutdown. Consider using this class instead of
+// holding a Dart_PersistentHandle directly so that you don't leak the
+// Dart_WeakPersistentHandle.
+class DartWeakPersistentValue {
+ public:
+ DartWeakPersistentValue();
+ ~DartWeakPersistentValue();
+
+ Dart_WeakPersistentHandle value() const { return handle_; }
+ bool is_empty() const { return handle_ == nullptr; }
+
+ void Set(DartState* dart_state,
+ Dart_Handle object,
+ void* peer,
+ intptr_t external_allocation_size,
+ Dart_HandleFinalizer callback);
+ void Clear();
+ Dart_Handle Get();
+
+ const std::weak_ptr<DartState>& dart_state() const { return dart_state_; }
+
+ private:
+ std::weak_ptr<DartState> dart_state_;
+ Dart_WeakPersistentHandle handle_;
+
+ TONIC_DISALLOW_COPY_AND_ASSIGN(DartWeakPersistentValue);
+};
+
+} // namespace tonic
+
+#endif // LIB_TONIC_DART_WEAK_PERSISTENT_VALUE_H_
diff --git a/third_party/tonic/dart_wrappable.cc b/third_party/tonic/dart_wrappable.cc
index 3bdfe3e6e..858215c11 100644
--- a/third_party/tonic/dart_wrappable.cc
+++ b/third_party/tonic/dart_wrappable.cc
@@ -12,12 +12,17 @@
namespace tonic {
DartWrappable::~DartWrappable() {
- TONIC_CHECK(!dart_wrapper_);
+ // Calls the destructor of dart_wrapper_ to delete WeakPersistentHandle.
}
// TODO(dnfield): Delete this. https://github.com/flutter/flutter/issues/50997
Dart_Handle DartWrappable::CreateDartWrapper(DartState* dart_state) {
- TONIC_DCHECK(!dart_wrapper_);
+ if (!dart_wrapper_.is_empty()) {
+ // Any previously given out wrapper must have been GCed.
+ TONIC_DCHECK(Dart_IsNull(dart_wrapper_.Get()));
+ dart_wrapper_.Clear();
+ }
+
const DartWrapperInfo& info = GetDartWrapperInfo();
Dart_PersistentHandle type = dart_state->class_library().GetClass(info);
@@ -36,14 +41,19 @@ Dart_Handle DartWrappable::CreateDartWrapper(DartState* dart_state) {
TONIC_DCHECK(!LogIfError(res));
this->RetainDartWrappableReference(); // Balanced in FinalizeDartWrapper.
- dart_wrapper_ = Dart_NewWeakPersistentHandle(
- wrapper, this, GetAllocationSize(), &FinalizeDartWrapper);
+ dart_wrapper_.Set(dart_state, wrapper, this, GetAllocationSize(),
+ &FinalizeDartWrapper);
return wrapper;
}
void DartWrappable::AssociateWithDartWrapper(Dart_Handle wrapper) {
- TONIC_DCHECK(!dart_wrapper_);
+ if (!dart_wrapper_.is_empty()) {
+ // Any previously given out wrapper must have been GCed.
+ TONIC_DCHECK(Dart_IsNull(dart_wrapper_.Get()));
+ dart_wrapper_.Clear();
+ }
+
TONIC_CHECK(!LogIfError(wrapper));
const DartWrapperInfo& info = GetDartWrapperInfo();
@@ -54,26 +64,25 @@ void DartWrappable::AssociateWithDartWrapper(Dart_Handle wrapper) {
wrapper, kWrapperInfoIndex, reinterpret_cast<intptr_t>(&info))));
this->RetainDartWrappableReference(); // Balanced in FinalizeDartWrapper.
- dart_wrapper_ = Dart_NewWeakPersistentHandle(
- wrapper, this, GetAllocationSize(), &FinalizeDartWrapper);
+
+ DartState* dart_state = DartState::Current();
+ dart_wrapper_.Set(dart_state, wrapper, this, GetAllocationSize(),
+ &FinalizeDartWrapper);
}
void DartWrappable::ClearDartWrapper() {
- TONIC_DCHECK(dart_wrapper_);
- Dart_Handle wrapper = Dart_HandleFromWeakPersistent(dart_wrapper_);
+ TONIC_DCHECK(!dart_wrapper_.is_empty());
+ Dart_Handle wrapper = dart_wrapper_.Get();
TONIC_CHECK(!LogIfError(Dart_SetNativeInstanceField(wrapper, kPeerIndex, 0)));
TONIC_CHECK(
!LogIfError(Dart_SetNativeInstanceField(wrapper, kWrapperInfoIndex, 0)));
- Dart_DeleteWeakPersistentHandle(dart_wrapper_);
- dart_wrapper_ = nullptr;
+ dart_wrapper_.Clear();
this->ReleaseDartWrappableReference();
}
void DartWrappable::FinalizeDartWrapper(void* isolate_callback_data,
- Dart_WeakPersistentHandle wrapper,
void* peer) {
DartWrappable* wrappable = reinterpret_cast<DartWrappable*>(peer);
- wrappable->dart_wrapper_ = nullptr;
wrappable->ReleaseDartWrappableReference(); // Balanced in CreateDartWrapper.
}
diff --git a/third_party/tonic/dart_wrappable.h b/third_party/tonic/dart_wrappable.h
index a036abb85..f944dacef 100644
--- a/third_party/tonic/dart_wrappable.h
+++ b/third_party/tonic/dart_wrappable.h
@@ -9,6 +9,7 @@
#include "tonic/common/macros.h"
#include "tonic/converter/dart_converter.h"
#include "tonic/dart_state.h"
+#include "tonic/dart_weak_persistent_value.h"
#include "tonic/dart_wrapper_info.h"
#include "tonic/logging/dart_error.h"
@@ -26,7 +27,7 @@ class DartWrappable {
kNumberOfNativeFields,
};
- DartWrappable() : dart_wrapper_(nullptr) {}
+ DartWrappable() : dart_wrapper_(DartWeakPersistentValue()) {}
// Subclasses that wish to expose a new interface must override this function
// and provide information about their wrapper. There is no need to call your
@@ -49,7 +50,9 @@ class DartWrappable {
Dart_Handle CreateDartWrapper(DartState* dart_state);
void AssociateWithDartWrapper(Dart_Handle wrappable);
void ClearDartWrapper(); // Warning: Might delete this.
- Dart_WeakPersistentHandle dart_wrapper() const { return dart_wrapper_; }
+ Dart_WeakPersistentHandle dart_wrapper() const {
+ return dart_wrapper_.value();
+ }
protected:
virtual ~DartWrappable();
@@ -59,11 +62,9 @@ class DartWrappable {
const tonic::DartWrapperInfo& wrapper_info);
private:
- static void FinalizeDartWrapper(void* isolate_callback_data,
- Dart_WeakPersistentHandle wrapper,
- void* peer);
+ static void FinalizeDartWrapper(void* isolate_callback_data, void* peer);
- Dart_WeakPersistentHandle dart_wrapper_;
+ DartWeakPersistentValue dart_wrapper_;
TONIC_DISALLOW_COPY_AND_ASSIGN(DartWrappable);
};
@@ -103,22 +104,36 @@ struct DartConverter<
typename std::enable_if<
std::is_convertible<T*, const DartWrappable*>::value>::type> {
static Dart_Handle ToDart(DartWrappable* val) {
- if (!val)
+ if (!val) {
return Dart_Null();
- if (Dart_WeakPersistentHandle wrapper = val->dart_wrapper())
- return Dart_HandleFromWeakPersistent(wrapper);
+ }
+ if (Dart_WeakPersistentHandle wrapper = val->dart_wrapper()) {
+ auto strong_handle = Dart_HandleFromWeakPersistent(wrapper);
+ if (!Dart_IsNull(strong_handle)) {
+ return strong_handle;
+ }
+ // After the weak referenced object has been GCed, the handle points to
+ // Dart_Null(). Fall through create a new wrapper object.
+ }
return val->CreateDartWrapper(DartState::Current());
}
static void SetReturnValue(Dart_NativeArguments args,
DartWrappable* val,
bool auto_scope = true) {
- if (!val)
+ if (!val) {
Dart_SetReturnValue(args, Dart_Null());
- else if (Dart_WeakPersistentHandle wrapper = val->dart_wrapper())
- Dart_SetWeakHandleReturnValue(args, wrapper);
- else
- Dart_SetReturnValue(args, val->CreateDartWrapper(DartState::Current()));
+ return;
+ } else if (Dart_WeakPersistentHandle wrapper = val->dart_wrapper()) {
+ auto strong_handle = Dart_HandleFromWeakPersistent(wrapper);
+ if (!Dart_IsNull(strong_handle)) {
+ Dart_SetReturnValue(args, strong_handle);
+ return;
+ }
+ // After the weak referenced object has been GCed, the handle points to
+ // Dart_Null(). Fall through create a new wrapper object.
+ }
+ Dart_SetReturnValue(args, val->CreateDartWrapper(DartState::Current()));
}
static T* FromDart(Dart_Handle handle) {
diff --git a/third_party/tonic/tests/BUILD.gn b/third_party/tonic/tests/BUILD.gn
new file mode 100644
index 000000000..359deb13b
--- /dev/null
+++ b/third_party/tonic/tests/BUILD.gn
@@ -0,0 +1,33 @@
+# Copyright 2013 The Flutter Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//flutter/testing/testing.gni")
+
+test_fixtures("tonic_fixtures") {
+ dart_main = "fixtures/tonic_test.dart"
+ fixtures = []
+}
+
+executable("tonic_unittests") {
+ testonly = true
+
+ public_configs = [ "//flutter:export_dynamic_symbols" ]
+
+ sources = [
+ "dart_state_unittest.cc",
+ "dart_weak_persistent_handle_unittest.cc",
+ ]
+
+ public_deps = [
+ ":tonic_fixtures",
+ "//flutter/runtime:libdart",
+ "//flutter/runtime:runtime",
+ "//flutter/testing",
+ "//flutter/testing:fixture_test",
+ "//third_party/dart/runtime:dart_api",
+ "//third_party/googletest:gtest",
+ ]
+
+ deps = [ "../:tonic" ]
+}
diff --git a/third_party/tonic/tests/dart_state_unittest.cc b/third_party/tonic/tests/dart_state_unittest.cc
new file mode 100644
index 000000000..3d053de40
--- /dev/null
+++ b/third_party/tonic/tests/dart_state_unittest.cc
@@ -0,0 +1,61 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "flutter/common/task_runners.h"
+#include "flutter/runtime/dart_vm_lifecycle.h"
+#include "flutter/runtime/isolate_configuration.h"
+#include "flutter/testing/fixture_test.h"
+
+namespace flutter {
+namespace testing {
+
+using DartState = FixtureTest;
+
+TEST_F(DartState, IsShuttingDown) {
+ ASSERT_FALSE(DartVMRef::IsInstanceRunning());
+ auto settings = CreateSettingsForFixture();
+ auto vm_ref = DartVMRef::Create(settings);
+ ASSERT_TRUE(vm_ref);
+ auto vm_data = vm_ref.GetVMData();
+ ASSERT_TRUE(vm_data);
+ TaskRunners task_runners(GetCurrentTestName(), //
+ GetCurrentTaskRunner(), //
+ GetCurrentTaskRunner(), //
+ GetCurrentTaskRunner(), //
+ GetCurrentTaskRunner() //
+ );
+ auto isolate_configuration =
+ IsolateConfiguration::InferFromSettings(settings);
+ auto weak_isolate = DartIsolate::CreateRunningRootIsolate(
+ vm_data->GetSettings(), // settings
+ vm_data->GetIsolateSnapshot(), // isolate snapshot
+ std::move(task_runners), // task runners
+ nullptr, // window
+ {}, // snapshot delegate
+ {}, // hint freed delegate
+ {}, // io manager
+ {}, // unref queue
+ {}, // image decoder
+ "main.dart", // advisory uri
+ "main", // advisory entrypoint
+ DartIsolate::Flags{}, // flags
+ settings.isolate_create_callback, // isolate create callback
+ settings.isolate_shutdown_callback, // isolate shutdown callback
+ "main", // dart entrypoint
+ std::nullopt, // dart entrypoint library
+ std::move(isolate_configuration) // isolate configuration
+ );
+ auto root_isolate = weak_isolate.lock();
+ ASSERT_TRUE(root_isolate);
+
+ tonic::DartState* dart_state = root_isolate.get();
+ ASSERT_FALSE(dart_state->IsShuttingDown());
+
+ ASSERT_TRUE(root_isolate->Shutdown());
+
+ ASSERT_TRUE(dart_state->IsShuttingDown());
+}
+
+} // namespace testing
+} // namespace flutter
diff --git a/third_party/tonic/tests/dart_weak_persistent_handle_unittest.cc b/third_party/tonic/tests/dart_weak_persistent_handle_unittest.cc
new file mode 100644
index 000000000..65d5e116c
--- /dev/null
+++ b/third_party/tonic/tests/dart_weak_persistent_handle_unittest.cc
@@ -0,0 +1,167 @@
+// 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/testing/dart_isolate_runner.h"
+#include "flutter/testing/fixture_test.h"
+
+namespace flutter {
+namespace testing {
+
+class DartWeakPersistentHandle : public FixtureTest {
+ public:
+ DartWeakPersistentHandle()
+ : settings_(CreateSettingsForFixture()),
+ vm_(DartVMRef::Create(settings_)) {}
+
+ ~DartWeakPersistentHandle() = default;
+
+ [[nodiscard]] bool RunWithEntrypoint(const std::string& entrypoint) {
+ if (running_isolate_) {
+ return false;
+ }
+ auto thread = CreateNewThread();
+ TaskRunners single_threaded_task_runner(GetCurrentTestName(), thread,
+ thread, thread, thread);
+ auto isolate =
+ RunDartCodeInIsolate(vm_, settings_, single_threaded_task_runner,
+ entrypoint, {}, GetFixturesPath());
+ if (!isolate || isolate->get()->GetPhase() != DartIsolate::Phase::Running) {
+ return false;
+ }
+
+ running_isolate_ = std::move(isolate);
+ return true;
+ }
+
+ [[nodiscard]] bool RunInIsolateScope(std::function<bool(void)> closure) {
+ return running_isolate_->RunInIsolateScope(closure);
+ }
+
+ private:
+ Settings settings_;
+ DartVMRef vm_;
+ std::unique_ptr<AutoIsolateShutdown> running_isolate_;
+ FML_DISALLOW_COPY_AND_ASSIGN(DartWeakPersistentHandle);
+};
+
+void NopFinalizer(void* isolate_callback_data, void* peer) {}
+
+TEST_F(DartWeakPersistentHandle, ClearImmediately) {
+ auto weak_persistent_value = tonic::DartWeakPersistentValue();
+
+ fml::AutoResetWaitableEvent event;
+
+ AddNativeCallback(
+ "GiveObjectToNative", CREATE_NATIVE_ENTRY([&](Dart_NativeArguments args) {
+ auto handle = Dart_GetNativeArgument(args, 0);
+
+ auto dart_state = tonic::DartState::Current();
+ ASSERT_TRUE(dart_state);
+ ASSERT_TRUE(tonic::DartState::Current());
+ weak_persistent_value.Set(dart_state, handle, nullptr, 0, NopFinalizer);
+
+ weak_persistent_value.Clear();
+
+ event.Signal();
+ }));
+
+ ASSERT_TRUE(RunWithEntrypoint("callGiveObjectToNative"));
+
+ event.Wait();
+}
+
+TEST_F(DartWeakPersistentHandle, ClearLaterCc) {
+ auto weak_persistent_value = tonic::DartWeakPersistentValue();
+
+ fml::AutoResetWaitableEvent event;
+
+ AddNativeCallback(
+ "GiveObjectToNative", CREATE_NATIVE_ENTRY([&](Dart_NativeArguments args) {
+ auto handle = Dart_GetNativeArgument(args, 0);
+
+ auto dart_state = tonic::DartState::Current();
+ ASSERT_TRUE(dart_state);
+ ASSERT_TRUE(tonic::DartState::Current());
+ weak_persistent_value.Set(dart_state, handle, nullptr, 0, NopFinalizer);
+
+ // Do not clear handle immediately.
+
+ event.Signal();
+ }));
+
+ ASSERT_TRUE(RunWithEntrypoint("callGiveObjectToNative"));
+
+ event.Wait();
+
+ ASSERT_TRUE(RunInIsolateScope([&weak_persistent_value]() -> bool {
+ // Clear on initiative of native.
+ weak_persistent_value.Clear();
+ return true;
+ }));
+}
+
+TEST_F(DartWeakPersistentHandle, ClearLaterDart) {
+ auto weak_persistent_value = tonic::DartWeakPersistentValue();
+
+ fml::AutoResetWaitableEvent event;
+
+ AddNativeCallback(
+ "GiveObjectToNative", CREATE_NATIVE_ENTRY([&](Dart_NativeArguments args) {
+ auto handle = Dart_GetNativeArgument(args, 0);
+
+ auto dart_state = tonic::DartState::Current();
+ ASSERT_TRUE(dart_state);
+ ASSERT_TRUE(tonic::DartState::Current());
+ weak_persistent_value.Set(dart_state, handle, nullptr, 0, NopFinalizer);
+
+ // Do not clear handle immediately.
+ }));
+
+ AddNativeCallback("SignalDone",
+ CREATE_NATIVE_ENTRY([&](Dart_NativeArguments args) {
+ // Clear on initiative of Dart.
+ weak_persistent_value.Clear();
+
+ event.Signal();
+ }));
+
+ ASSERT_TRUE(RunWithEntrypoint("testClearLater"));
+
+ event.Wait();
+}
+
+// Handle outside the test body scope so it survives until isolate shutdown.
+tonic::DartWeakPersistentValue global_weak_persistent_value =
+ tonic::DartWeakPersistentValue();
+
+TEST_F(DartWeakPersistentHandle, ClearOnShutdown) {
+ fml::AutoResetWaitableEvent event;
+
+ AddNativeCallback("GiveObjectToNative",
+ CREATE_NATIVE_ENTRY([&](Dart_NativeArguments args) {
+ auto handle = Dart_GetNativeArgument(args, 0);
+
+ auto dart_state = tonic::DartState::Current();
+ ASSERT_TRUE(dart_state);
+ ASSERT_TRUE(tonic::DartState::Current());
+
+ // The test is repeated, ensure the global var is
+ // cleared before use.
+ global_weak_persistent_value.Clear();
+
+ global_weak_persistent_value.Set(
+ dart_state, handle, nullptr, 0, NopFinalizer);
+
+ // Do not clear handle, so it is cleared on shutdown.
+
+ event.Signal();
+ }));
+
+ ASSERT_TRUE(RunWithEntrypoint("callGiveObjectToNative"));
+
+ event.Wait();
+}
+
+} // namespace testing
+} // namespace flutter
diff --git a/third_party/tonic/tests/fixtures/tonic_test.dart b/third_party/tonic/tests/fixtures/tonic_test.dart
new file mode 100644
index 000000000..83e92d4dc
--- /dev/null
+++ b/third_party/tonic/tests/fixtures/tonic_test.dart
@@ -0,0 +1,25 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+void main() {}
+
+class SomeClass {
+ int i;
+ SomeClass(this.i);
+}
+
+void giveObjectToNative(Object someObject) native 'GiveObjectToNative';
+
+void signalDone() native 'SignalDone';
+
+@pragma('vm:entry-point')
+void callGiveObjectToNative() {
+ giveObjectToNative(SomeClass(123));
+}
+
+@pragma('vm:entry-point')
+void testClearLater() {
+ giveObjectToNative(SomeClass(123));
+ signalDone();
+}
diff --git a/third_party/tonic/typed_data/dart_byte_data.cc b/third_party/tonic/typed_data/dart_byte_data.cc
index dc312de3f..cfb07399f 100644
--- a/third_party/tonic/typed_data/dart_byte_data.cc
+++ b/third_party/tonic/typed_data/dart_byte_data.cc
@@ -16,9 +16,7 @@ namespace {
// with a buffer allocated outside the Dart heap.
const int kExternalSizeThreshold = 1000;
-void FreeFinalizer(void* isolate_callback_data,
- Dart_WeakPersistentHandle handle,
- void* peer) {
+void FreeFinalizer(void* isolate_callback_data, void* peer) {
free(peer);
}