From 8758f1f954eb7f0062ba1d96baf1e12a9249dc5b Mon Sep 17 00:00:00 2001 From: Daco Harkes Date: Tue, 16 Jan 2024 18:25:18 +0000 Subject: [PATCH] [vm] Bump service protocol to `4.14` and hide implementation Follow up of https://dart-review.googlesource.com/c/sdk/+/346403. TEST=pkg/vm_service/test/get_object_rpc_test.dart Change-Id: I7c1d0fb565f8a128334844f7eec44eb4a4679c08 Cq-Include-Trybots: luci.dart.try:vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-mac-debug-arm64-try,vm-win-debug-x64-try,vm-win-release-ia32-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346600 Commit-Queue: Daco Harkes Reviewed-by: Ben Konyi --- pkg/vm_service/java/version.properties | 2 +- pkg/vm_service/lib/src/vm_service.dart | 40 +------------------ pkg/vm_service/test/get_object_rpc_test.dart | 4 -- .../lib/src/vm_service_interface.dart | 2 +- .../tests/service/get_version_rpc_test.dart | 2 +- runtime/vm/object_service.cc | 8 ++-- runtime/vm/service.h | 4 +- runtime/vm/service/service.md | 27 ++----------- 8 files changed, 13 insertions(+), 76 deletions(-) diff --git a/pkg/vm_service/java/version.properties b/pkg/vm_service/java/version.properties index b40abb14b70..94ffe2ee6ac 100644 --- a/pkg/vm_service/java/version.properties +++ b/pkg/vm_service/java/version.properties @@ -1 +1 @@ -version=4.13 +version=4.14 diff --git a/pkg/vm_service/lib/src/vm_service.dart b/pkg/vm_service/lib/src/vm_service.dart index 3787d606097..c5581f4f2ef 100644 --- a/pkg/vm_service/lib/src/vm_service.dart +++ b/pkg/vm_service/lib/src/vm_service.dart @@ -26,7 +26,7 @@ export 'snapshot_graph.dart' HeapSnapshotObjectNoData, HeapSnapshotObjectNullData; -const String vmServiceVersion = '4.13.0'; +const String vmServiceVersion = '4.14.0'; /// @optional const String optional = 'optional'; @@ -5235,16 +5235,6 @@ class Instance extends Obj implements InstanceRef { @optional InstanceRef? allEntries; - /// The entries for a (Native)Finalizer instance. - /// - /// A linked list of entries through FinalizerEntry.next. - /// - /// Provided for instance kinds: - /// - Finalizer - /// - NativeFinalizer - @optional - InstanceRef? collectedEntries; - /// The value being watched for finalization for a FinalizerEntry instance. /// /// Provided for instance kinds: @@ -5266,21 +5256,6 @@ class Instance extends Obj implements InstanceRef { @optional InstanceRef? detach; - /// The finalizer for a FinalizerEntry instance. - /// - /// Provided for instance kinds: - /// - FinalizerEntry - @optional - InstanceRef? finalizer; - - /// The next item in the collectedEntries linked list for a FinalizerEntry - /// instance. - /// - /// Provided for instance kinds: - /// - FinalizerEntry - @optional - InstanceRef? next; - Instance({ this.kind, this.identityHashCode, @@ -5321,12 +5296,9 @@ class Instance extends Obj implements InstanceRef { this.callback, this.callbackAddress, this.allEntries, - this.collectedEntries, this.value, this.token, this.detach, - this.finalizer, - this.next, }) : super( id: id, classRef: classRef, @@ -5412,19 +5384,12 @@ class Instance extends Obj implements InstanceRef { as InstanceRef?; allEntries = createServiceObject(json['allEntries'], const ['InstanceRef']) as InstanceRef?; - collectedEntries = - createServiceObject(json['collectedEntries'], const ['InstanceRef']) - as InstanceRef?; value = createServiceObject(json['value'], const ['InstanceRef']) as InstanceRef?; token = createServiceObject(json['token'], const ['InstanceRef']) as InstanceRef?; detach = createServiceObject(json['detach'], const ['InstanceRef']) as InstanceRef?; - finalizer = createServiceObject(json['finalizer'], const ['InstanceRef']) - as InstanceRef?; - next = createServiceObject(json['next'], const ['InstanceRef']) - as InstanceRef?; } @override @@ -5477,12 +5442,9 @@ class Instance extends Obj implements InstanceRef { _setIfNotNull(json, 'callback', callback?.toJson()); _setIfNotNull(json, 'callbackAddress', callbackAddress?.toJson()); _setIfNotNull(json, 'allEntries', allEntries?.toJson()); - _setIfNotNull(json, 'collectedEntries', collectedEntries?.toJson()); _setIfNotNull(json, 'value', value?.toJson()); _setIfNotNull(json, 'token', token?.toJson()); _setIfNotNull(json, 'detach', detach?.toJson()); - _setIfNotNull(json, 'finalizer', finalizer?.toJson()); - _setIfNotNull(json, 'next', next?.toJson()); return json; } diff --git a/pkg/vm_service/test/get_object_rpc_test.dart b/pkg/vm_service/test/get_object_rpc_test.dart index 07fbf797154..126d867b25f 100644 --- a/pkg/vm_service/test/get_object_rpc_test.dart +++ b/pkg/vm_service/test/get_object_rpc_test.dart @@ -1954,10 +1954,7 @@ var tests = [ expect(entry.value!.classRef!.name, '_DummyClass'); expect(entry.token!.classRef!.name, '_DummyClass'); expect(entry.detach!.classRef!.name, '_DummyClass'); - expect(entry.finalizer!.kind, equals(InstanceKind.kFinalizer)); - expect(entry.next!.kind, equals(InstanceKind.kNull)); } - expect(result.collectedEntries, isNull); }, // A native finalizer @@ -1989,7 +1986,6 @@ var tests = [ final allEntries = await service.getObject(isolateId, allEntriesRef!.id!) as Instance; expect(allEntries.elements, isEmpty); - expect(result.collectedEntries, isNull); }, ]; diff --git a/pkg/vm_service_interface/lib/src/vm_service_interface.dart b/pkg/vm_service_interface/lib/src/vm_service_interface.dart index 9f4a1e51654..6523f2cfb0f 100644 --- a/pkg/vm_service_interface/lib/src/vm_service_interface.dart +++ b/pkg/vm_service_interface/lib/src/vm_service_interface.dart @@ -17,7 +17,7 @@ import 'service_extension_registry.dart'; export 'service_extension_registry.dart' show ServiceExtensionRegistry; -const String vmServiceVersion = '4.13.0'; +const String vmServiceVersion = '4.14.0'; /// A class representation of the Dart VM Service Protocol. abstract interface class VmServiceInterface { diff --git a/runtime/observatory/tests/service/get_version_rpc_test.dart b/runtime/observatory/tests/service/get_version_rpc_test.dart index 00a1c81f67e..39ccbf21ef8 100644 --- a/runtime/observatory/tests/service/get_version_rpc_test.dart +++ b/runtime/observatory/tests/service/get_version_rpc_test.dart @@ -12,7 +12,7 @@ var tests = [ final result = await vm.invokeRpcNoUpgrade('getVersion', {}); expect(result['type'], 'Version'); expect(result['major'], 4); - expect(result['minor'], 13); + expect(result['minor'], 14); expect(result['_privateMajor'], 0); expect(result['_privateMinor'], 0); }, diff --git a/runtime/vm/object_service.cc b/runtime/vm/object_service.cc index 9ccbefe483d..98096a11087 100644 --- a/runtime/vm/object_service.cc +++ b/runtime/vm/object_service.cc @@ -2045,7 +2045,7 @@ void Finalizer::PrintJSONImpl(JSONStream* stream, bool ref) const { object = all_entries(); jsobj.AddProperty("allEntries", object); object = entries_collected(); - jsobj.AddProperty("entriesCollected", object); + jsobj.AddProperty("_entriesCollected", object); } void Finalizer::PrintImplementationFieldsImpl( @@ -2065,7 +2065,7 @@ void NativeFinalizer::PrintJSONImpl(JSONStream* stream, bool ref) const { object = all_entries(); jsobj.AddProperty("allEntries", object); object = entries_collected(); - jsobj.AddProperty("entriesCollected", object); + jsobj.AddProperty("_entriesCollected", object); } void NativeFinalizer::PrintImplementationFieldsImpl( @@ -2087,9 +2087,9 @@ void FinalizerEntry::PrintJSONImpl(JSONStream* stream, bool ref) const { object = token(); jsobj.AddProperty("token", object); object = finalizer(); - jsobj.AddProperty("finalizer", object); + jsobj.AddProperty("_finalizer", object); object = next(); - jsobj.AddProperty("next", object); + jsobj.AddProperty("_next", object); } void FinalizerEntry::PrintImplementationFieldsImpl( diff --git a/runtime/vm/service.h b/runtime/vm/service.h index ec5e2daf0bf..05725b7720a 100644 --- a/runtime/vm/service.h +++ b/runtime/vm/service.h @@ -18,7 +18,7 @@ namespace dart { #define SERVICE_PROTOCOL_MAJOR_VERSION 4 -#define SERVICE_PROTOCOL_MINOR_VERSION 13 +#define SERVICE_PROTOCOL_MINOR_VERSION 14 class Array; class EmbedderServiceHandler; @@ -199,7 +199,7 @@ class Service : public AllStatic { return stream_cancel_callback_; } - static void PrintJSONForEmbedderInformation(JSONObject *jsobj); + static void PrintJSONForEmbedderInformation(JSONObject* jsobj); static void PrintJSONForVM(JSONStream* js, bool ref); static void CheckForPause(Isolate* isolate, JSONStream* stream); diff --git a/runtime/vm/service/service.md b/runtime/vm/service/service.md index c15d5c2a095..40b77aee12b 100644 --- a/runtime/vm/service/service.md +++ b/runtime/vm/service/service.md @@ -1,8 +1,8 @@ -# Dart VM Service Protocol 4.13 +# Dart VM Service Protocol 4.14 > Please post feedback to the [observatory-discuss group][discuss-list] -This document describes of _version 4.13_ of the Dart VM Service Protocol. This +This document describes of _version 4.14_ of the Dart VM Service Protocol. This protocol is used to communicate with a running Dart Virtual Machine. To use the Service Protocol, start the VM with the *--observe* flag. @@ -3306,15 +3306,6 @@ class Instance extends Object { // NativeFinalizer @Instance allEntries [optional]; - // The entries for a (Native)Finalizer instance. - // - // A linked list of entries through FinalizerEntry.next. - // - // Provided for instance kinds: - // Finalizer - // NativeFinalizer - @Instance collectedEntries [optional]; - // The value being watched for finalization for a FinalizerEntry instance. // // Provided for instance kinds: @@ -3332,19 +3323,6 @@ class Instance extends Object { // Provided for instance kinds: // FinalizerEntry @Instance detach [optional]; - - // The finalizer for a FinalizerEntry instance. - // - // Provided for instance kinds: - // FinalizerEntry - @Instance finalizer [optional]; - - // The next item in the collectedEntries linked list for a FinalizerEntry - // instance. - // - // Provided for instance kinds: - // FinalizerEntry - @Instance next [optional]; } ``` @@ -4808,5 +4786,6 @@ version | comments 4.11 | Added `isGetter` and `isSetter` properties to `@Function` and `Function`. 4.12 | Added `@TypeParameters` and changed `TypeParameters` to extend `Object`. 4.13 | Added `librariesAlreadyCompiled` to `getSourceReport`. +4.14 | Added `Finalizer`, `NativeFinalizer`, and `FinalizerEntry`. [discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observatory-discuss