[ Service ] Add gcType to Event

Fixes https://github.com/dart-lang/sdk/issues/49319

TEST=N/A

Change-Id: I703f102e2003ec6a21166b03ec52d89a42f61ad3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251621
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
This commit is contained in:
Ben Konyi 2022-07-20 18:08:27 +00:00 committed by Commit Bot
parent 49885ed289
commit 54d3d7e459
9 changed files with 30 additions and 8 deletions

View file

@ -1,5 +1,9 @@
# Changelog
## 9.3.0
- Update to version `3.60` of the spec.
- Add `gcType` property to `Event`.
## 9.2.0
- Update to version `3.59` of the spec.
- Add `abstract` flag to `FuncRef`.

View file

@ -1 +1 @@
version=3.59
version=3.60

View file

@ -26,7 +26,7 @@ export 'snapshot_graph.dart'
HeapSnapshotObjectNoData,
HeapSnapshotObjectNullData;
const String vmServiceVersion = '3.59.0';
const String vmServiceVersion = '3.60.0';
/// @optional
const String optional = 'optional';
@ -4073,6 +4073,13 @@ class Event extends Response {
@optional
InstanceRef? inspectee;
/// The garbage collection (GC) operation performed.
///
/// This is provided for the event kinds:
/// - GC
@optional
String? gcType;
/// The RPC name of the extension that was added.
///
/// This is provided for the ServiceExtensionAdded event.
@ -4197,6 +4204,7 @@ class Event extends Response {
this.exception,
this.bytes,
this.inspectee,
this.gcType,
this.extensionRPC,
this.extensionKind,
this.extensionData,
@ -4236,6 +4244,7 @@ class Event extends Response {
bytes = json['bytes'];
inspectee = createServiceObject(json['inspectee'], const ['InstanceRef'])
as InstanceRef?;
gcType = json['gcType'];
extensionRPC = json['extensionRPC'];
extensionKind = json['extensionKind'];
extensionData = ExtensionData.parse(json['extensionData']);
@ -4284,6 +4293,7 @@ class Event extends Response {
_setIfNotNull(json, 'exception', exception?.toJson());
_setIfNotNull(json, 'bytes', bytes);
_setIfNotNull(json, 'inspectee', inspectee?.toJson());
_setIfNotNull(json, 'gcType', gcType);
_setIfNotNull(json, 'extensionRPC', extensionRPC);
_setIfNotNull(json, 'extensionKind', extensionKind);
_setIfNotNull(json, 'extensionData', extensionData?.data);

View file

@ -1,5 +1,5 @@
name: vm_service
version: 9.2.0
version: 9.3.0
description: >-
A library to communicate with a service implementing the Dart VM
service protocol.

View file

@ -12,7 +12,7 @@ var tests = <VMTest>[
final result = await vm.invokeRpcNoUpgrade('getVersion', {});
expect(result['type'], 'Version');
expect(result['major'], 3);
expect(result['minor'], 59);
expect(result['minor'], 60);
expect(result['_privateMajor'], 0);
expect(result['_privateMinor'], 0);
},

View file

@ -12,7 +12,7 @@ var tests = <VMTest>[
final result = await vm.invokeRpcNoUpgrade('getVersion', {});
expect(result['type'], equals('Version'));
expect(result['major'], equals(3));
expect(result['minor'], equals(59));
expect(result['minor'], equals(60));
expect(result['_privateMajor'], equals(0));
expect(result['_privateMinor'], equals(0));
},

View file

@ -17,7 +17,7 @@
namespace dart {
#define SERVICE_PROTOCOL_MAJOR_VERSION 3
#define SERVICE_PROTOCOL_MINOR_VERSION 59
#define SERVICE_PROTOCOL_MINOR_VERSION 60
class Array;
class EmbedderServiceHandler;

View file

@ -1,8 +1,8 @@
# Dart VM Service Protocol 3.59
# Dart VM Service Protocol 3.60
> Please post feedback to the [observatory-discuss group][discuss-list]
This document describes of _version 3.58_ of the Dart VM Service Protocol. This
This document describes of _version 3.60_ 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.
@ -2226,6 +2226,12 @@ class Event extends Response {
// This is provided for the Inspect event.
@Instance inspectee [optional];
// The garbage collection (GC) operation performed.
//
// This is provided for the event kinds:
// GC
string gcType [optional];
// The RPC name of the extension that was added.
//
// This is provided for the ServiceExtensionAdded event.
@ -4379,5 +4385,6 @@ version | comments
3.57 | Added optional `libraryFilters` parameter to `getSourceReport` RPC.
3.58 | Added optional `local` parameter to `lookupResolvedPackageUris` RPC.
3.59 | Added `abstract` property to `@Function` and `Function`.
3.60 | Added `gcType` property to `Event`.
[discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observatory-discuss

View file

@ -284,6 +284,7 @@ void ServiceEvent::PrintJSON(JSONStream* js) const {
}
if (gc_stats() != NULL) {
jsobj.AddProperty("reason", Heap::GCReasonToString(gc_stats()->reason_));
jsobj.AddProperty("gcType", Heap::GCTypeToString(gc_stats()->type_));
isolate_group()->heap()->PrintToJSONObject(Heap::kNew, &jsobj);
isolate_group()->heap()->PrintToJSONObject(Heap::kOld, &jsobj);
}