Commit Graph

226 Commits

Author SHA1 Message Date
Derek Xu 3dc9d8dcf9 [VM/Service] Add getQueuedMicrotasks RPC
TEST=pkg/vm_service/test/get_queued_microtasks_rpc_test

CoreLibraryReviewExempt: This CL does not include any core library API
changes, only VM Service implementation changes within
sdk/lib/vmservice/.
Change-Id: Ie5488f498e4d0f3d201e3f31423fd5029b74a726
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425160
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-05-13 14:29:37 -07:00
Derek Xu 75311aefa8 [VM/Timeline] Add Microtask stream
TEST=runtime/vm/dart_api_impl_test.cc

Change-Id: Icb078489f3600ac0fb8b314ca3bf748f482a687e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422860
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-04-22 07:42:27 -07:00
Derek Xu 1d69b0b980 [VM] Add automatic detection of timers that are significantly overdue
This change makes it so that when the VM detects that a timer is at
least 100 ms overdue, it sends a warning in a VM Service event on the
'Timer' stream.

TEST=Built an Android Flutter app with a modified Engine that contained
a `sleep` call in `eventhandler_linux.cc` and confirmed that the warning
event got sent, built an iOS Flutter app with a modified Engine that
contained a `sleep` call in `eventhandler_macos.cc` and verified that
the warning event got sent,
pkg/vm_service/test/overdue_timer_detection_test

CoreLibraryReviewExempt: This CL does not include any core library API
changes, only VM Service implementation changes.
Change-Id: Ie8db047116b7f63cfb5413f763eaf56c7bdd6975
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409500
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-04-14 07:36:31 -07:00
Ben Konyi ad36a981bc [ package:vm_service] Update CodeRef.function to have type dynamic
The function property of a Code object can contain either a Function or
a NativeFunction. This change updates the protocol specification to
properly document existing behavior and regenerates package:vm_service
to update `CodeRef.function` to have a `dynamic` type.

This is a breaking change to `package:vm_service`, so this will be
released as 15.0.0.

Related to https://github.com/flutter/devtools/issues/8567

TEST=N/A

Change-Id: Ie89723cdba8176be0d84a57a878fbedbca57f9c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398260
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2024-11-29 20:28:45 +00:00
Alexander Thomas 5b1e226fc6 [api.dart.dev] Update incorrect URLs in the Dart SDK sources
The old site supported api.dart.dev/stable/<page in the latest version>
links. These currently don't work, but the correct link omits the
`/stable/` path component.

Even if we add redirects to make the old URLs work, we still want to
update sources with the canonical URLs.

CoreLibraryReviewExempt: Documentation change only.
Fixes: https://github.com/dart-lang/sdk/issues/57110
Change-Id: I0b20bfa875db5ce62362a02e884d7d43b0efc73e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395961
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
2024-11-20 09:36:12 +00:00
Ben Konyi 98ddead31c [ package:vm_service ] Don't try to send service extension response after service connection disposal
Also prepares for 14.3.1 release.

Fixes https://github.com/flutter/flutter/issues/157296

Change-Id: I623102a54ad7ca4481dd5957a7da65dbc5a2e9b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391500
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2024-10-22 17:02:02 +00:00
Derek Xu 6121c396ee [VM/Service] Expose Service ID zone APIs in service.md and package:vm_service
TEST=pkg/vm_service/test/id_zones_test.dart, CI

Issue: https://github.com/dart-lang/sdk/issues/55869
CoreLibraryReviewExempt: This CL does not include any core library API
changes, only VM Service implementation changes in
sdk/lib/vmservice/running_isolates.dart.
Change-Id: Id63180fd08a88865064435b056fa3269835cd476
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381400
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-09-25 17:28:44 +00:00
Danny Tuppeny e099a00ee2 [dds] [vm_service] Add a new RPC error code for "Service Disposed" errors
This is not currently used for errors but just adds constants to allow clients to write code to handle these kinds of errors so we can use them in future (instead of generic error codes with string messages).

DAP is also updated ready to handle this error code.

See https://github.com/flutter/flutter/issues/153471

Change-Id: I6ad030d0317e9a70d9e28578787edec75554daad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381501
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-09-03 14:54:18 +00:00
Derek Xu 46d02f42a4 [VM/Service] Fix service/bad_reload_test and service/get_object_rpc_test
service/get_object_rpc_test was failing because one ID in it hadn't been
updated to the new format.

service/bad_reload_test was failing because `ServiceEvent::PrintJSON`
was attempting to populate the `reloadError` property of every `Event`
of kind `IsolateReload` with an `@Error`, but it was not possible to
allocate IDs for these `@Error`s because `ReloadSources` runs for an
isolate group, not for an individual isolate. I fixed this by removing
the `reloadError` property and adding a `reloadFailureReason` property
with type `string`.

TEST=confirmed that service/bad_reload_test and
service/get_object_rpc_test complete successfully on a local build of
the linux-debug-x64 SDK, vm-linux-debug-x64 tryjob

Issue: https://github.com/dart-lang/sdk/issues/55869
Change-Id: Ibf507aa0e475a6b9bed42b055e9d19b54aa81844
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382661
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-08-29 14:48:58 +00:00
Derek Xu 354084c62c [package:vm_service] Include stack traces with 'Service connection disposed' RPCErrors
TEST=pkg/vm_service/test/regress_55559_test.dart

Issue: https://github.com/dart-lang/sdk/issues/56491
Change-Id: I584cbc0827a1a074d28840819cc572beba5f2854
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381060
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-08-16 16:27:32 +00:00
Parker Lougheed 6c92babf4d [vm_service] Use collection language features in generated code
This removes the necessity of the `_setIfNotNull` function.

TEST: CI - No behavior change.
Change-Id: I80725bba21a1bda60d35d166723e4bbd55b6e73b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374240
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-08-08 20:07:15 +00:00
Parker Lougheed d60221ed47 [vm_service] Get tester example functional and clean up
Makes adjustments so `example/vm_service_tester.dart` runs successfully, and complete some clean up to make the code and comments in the file more consistent.

Closes https://github.com/dart-lang/sdk/issues/55753

TEST=N/A
Change-Id: Ib91985792a25a27008c2ef96786a40bb7a26ad57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374242
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-08-06 15:37:44 +00:00
Alexander Markov 00eac588c2 [vm] Remove transition_sentinel and detection of cyclic initialization of legacy static fields
Since null safety, all static fields with initializers are implicitly
late. This change cleans up transition_sentinel which was used in
the detection of cyclic initialization of legacy static fields.

TEST=ci

Change-Id: I6a990dc8ba030f5bd40eb0b86706cbfb0f725e33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373520
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-06-27 18:29:58 +00:00
Ömer Sinan Ağacan 633e7c4b15 [vm_service] Decode incoming JSON in one step instead of two
Currently we decode incoming data as a string, then parse the string as
JSON.

We can do it in one step by fusing a `Utf8Decoder` with a `JsonDecoder`,
which will be faster.

A difference between `jsonDecode` and the fused version is that
`jsonDecode` returns `dynamic`, the fused version returns `Object?`.

To keep changes as small as possible we cast the return value of the
fused verison to `dynamic` in this CL.

However using `dynamic` values is often slower than type casting it to
the right type and then using it. So it might make sense to cast it to
something like `Map<String, dynamic>` in a separate CL.

Change-Id: I76de535a72ae5532db5a27e543929519c48c701c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371080
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-06-13 11:53:40 +00:00
Jackson Gardner a479f91e80 Throw an RPC error when calling methods on a disposed connection.
This is consistent with the way we handle outstanding requests when the
service is disposed. Note that some of the devtools code in flutter
expects and handles this RPC error in some cases.

Change-Id: I56aae14f898b6d62b77d10ef50dec63ae96d507d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367821
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
2024-05-29 20:43:39 +00:00
Ben Konyi a7d8707a59 [ package:vm_service ] Automatically invoke VmService.dispose() when the service connection closes
Fixes https://github.com/dart-lang/sdk/issues/55559

Change-Id: I213ae3960c15bf2a68b4113a26f333090266b9c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365060
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-05-02 16:01:49 +00:00
Derek Xu d5bfb27945 [VM/Service] Fix alignment issues in readUtf16
Issue: https://github.com/dart-lang/sdk/issues/55475
Change-Id: Ib7b09e21096dd76cee5037c3120a7944a2b85340
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363120
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-04-16 16:36:48 +00:00
Ben Konyi 3a62af40b3 [ package:vm_service* ] Prepare for release of package:vm_service 14.2.0 and package:vm_service_interface 1.1.0
Adds support for 4.15 of the VM service protocol to both packages. Also
adds `yieldControlToDDS` to the `VmServiceInterface` so implementers of
the service protocol can correctly handle DDS connections.

Change-Id: I9253a647c1781f4d52758ecce4984082dfbf4fa0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357720
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
2024-03-20 13:34:07 +00:00
Ömer Sinan Ağacan 361c2564f7 [vm_service] Optimize ReadStream
This adds fast paths that avoid copying bytes from the input to a
temporary array when the current chunk has enough bytes for thing being
parsed.

Also avoids allocating a temporary array when parsing a 64-bit float by
allocating a single 8-byte buffer and reusing it.

This reduces runtime of a `HeapSnapshotGraph.fromChunks` call parsing a
91M snapshot in a single chunk from 2 seconds to 1.8 seconds. The
benchmark code is compiled with `dart2js -O4`.

Change-Id: I39d9579bcf488b17ecd0d5c7a84f93748c733920
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340182
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2024-03-08 10:00:19 +00:00
Polina Cherkasova f3d587f890 Add flags to opt out from some data parsing, to save time and memory.
Change-Id: I8144478175e1de103fcf5dc67deafe067ed72570
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351301
Commit-Queue: Polina Cherkasova <polinach@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-02-15 22:52:41 +00:00
Alexander Markov a261196ea7 [vm] Remove context allocations for tear-offs
Previously, when taking a tear-off, a separate Context object was
allocated in order to capture receiver. Now, receiver is stored directly
in the Closure object in the 'context' field. This saves 1 object
allocation per tear-off and makes tear-offs cheaper compared to
explicit closures which can share context with other closures.

Benchmarks in AOT mode:

x64:
TearOff.NotInlined +40%
TearOff.NotInlined.InTry +43%
TearOff.Inlined.InTry +47%

arm64:
TearOff.NotInlined +27-43%
TearOff.NotInlined.InTry +29-43%
TearOff.Inlined.InTry +58-94%

arm64c:
TearOff.NotInlined +71%
TearOff.NotInlined.InTry +72%
TearOff.Inlined.InTry +96%

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/54808
Change-Id: I3ad95e8a8a4fc23f856bbc0fe238da58a9d25b8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350945
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-02-13 15:33:38 +00:00
Polina Cherkasova 47f0541c99 Clean up code.
1. Add '_' to libs that are not exported.
2. Remove references from src to root libs.
3. Remove not used code.

No code changes.

Change-Id: Ie344fb7e41decb0ebf6e50d59dc843fb04ca683b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350692
Commit-Queue: Polina Cherkasova <polinach@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-02-12 17:59:57 +00:00
Derek Xu 60833d9cd9 [VM/Service] Update dart:io service extension spec
The main purpose of these changes is to make sure that the types in
package:http_profile are compatible with the interfaces in the spec.

See runtime/vm/service/service_extension.md and
pkg/vm_service/CHANGELOG.md for the full list of changes.

TEST=pkg/vm_service/test/get_http_profile_test.dart, DevTools tests

CoreLibraryReviewExempt: Only touches sdk/lib/io/network_profiling.dart
to update the version returned by the getVersion dart:io service
extension.
Change-Id: I1b9d0b7d43defbc857a2a8fde003012effd1ee15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341120
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-02-06 19:26:06 +00:00
Polina Cherkasova 166c796179 Implement toChunks and allow optimization.
1. Implement HeapSnapshotGraph.toChunks
2. Add parameter calculateReferrers, to allow to skip calculation of referrers, when they are not needed.

Change-Id: I312f01f1527e6b2bf4c8ddce6017ca6c53c8dd3a
CoreLibraryReviewExempt: minor dart:io documentation change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/348802
Commit-Queue: Polina Cherkasova <polinach@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-02-06 16:55:20 +00:00
Daco Harkes 8758f1f954 [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 <dacoharkes@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-01-16 18:25:18 +00:00
Daco Harkes f944ef16ab [vm] Fix g3 build
The file doesn't seem to have field promotion enabled in g3.

Change-Id: I1eafd191064fa24e62f60b7d29bb7468f55cfceb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346460
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-01-16 09:48:40 +00:00
Daco Harkes 7ba473f32b [vm] Support Finalizers in the debugger
TEST=pkg/vm_service/test/get_object_rpc_test.dart

Closes: https://github.com/dart-lang/sdk/issues/54615
Change-Id: I5262d756af63eb5d1677894f6a2e151cd0d65fc1
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/+/346403
Reviewed-by: Ben Konyi <bkonyi@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-01-15 23:14:56 +00:00
Alexander Aprelev ebf1456c7b [gardening] Workaround ddc issue in vmservice code in g3.
There seems to be a problem with convincing ddc that null-checking
is sufficient for late final field.

Fixes b/319411590
TEST=ci

Change-Id: I1a396201d2a1edf960c0f73e5e0d0ab5be8d9475
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345580
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2024-01-10 17:20:32 +00:00
Jonas Termansen ffdb0a2e19 [vm_service] Bump vm_service language version to 3.2.
Remove older version tags in vm_service and clean up old experiments.

Bug: b/318347018
Change-Id: I6bf87e46878d57d05d7f9d64674ce0c573364d4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345302
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2024-01-10 12:06:57 +00:00
Parker Lougheed ba78c6604c [vm_service] Update generator to unignore use_super_parameters lint
Fixes https://github.com/dart-lang/sdk/issues/53601

Bug: 53601
Change-Id: Iae5b2c0e0cf24ab58866ec5169e10282402a61da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340161
Commit-Queue: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
2023-12-07 20:31:11 +00:00
Ömer Sinan Ağacan 8058ad681b [VM/Service] Avoid copying incoming byte arrays
In devtools, `VmService` is passed a stream from the
`web_socket_channel` library, which writes `Uint8List` values to the
stream. In these cases we don't need to copy the messages.

Change-Id: Iade3897370fb11b31e8f2894d64554b8b7e7d141
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339123
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-11-30 19:27:48 +00:00
Ben Konyi aa2637ebd9 [ package:vm_service ] Migrate Observatory service tests (o* - r*)
Also:
 - added some missing RPC error kinds to `RPCErrorKind`
 - started making use of `update_line_numbers.dart` to automatically fix
   line numbers in service tests. Will go back through the existing
   tests to update them to use this script in a future CL.
Change-Id: I99a443ca59429eec829e5f289c0f396562cde89b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333980
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-11-08 16:42:44 +00:00
Ben Konyi fa6253ec11 [ package:vm_service ] Cleanup for 13.0.0 release
This change includes:
 - Removal of deprecated methods and constants
 - Removal of dependency on package:expect for testing, instead copying
   over the minimal amount of functionality needed for testing from
   package:expect into pkg/vm_service/test/common/expect.dart
 - Removal of classes and interfaces that are now found in
   package:vm_service_interface
Change-Id: I21c2d228e615f97e64dd98b6512bf2e533916454
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331760
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-10-25 14:02:42 +00:00
Ben Konyi 08b4f49249 Split package:vm_service into package:vm_service and package:vm_service_interface
To reduce the headache associated with adding parameters to VM service
APIs, VmServiceInterface has been removed from package:vm_service and
pulled into its own dedicated package:vm_service_interface. This will
help reduce the need for major version bumps of package:vm_service,
which requires manual version bumps through >8 packages in order to make
the latest version available to flutter_tools and DevTools.

This separation of the VmService client from the interface will reduce
the frequency of major version bumps to `package:vm_service` as adding
optional parameters to existing APIs would cause implementers of the
interface to break.

package:vm_service continues to expose a copy of the contents of package:vm_service_interface to avoid breaking google3 rolls until package:dwds can migrate to package:vm_service_interface. package:vm_service will not be published until this copy is removed.

This change also includes:
 - some code cleanup and modernization to both the code generator and
   generated code
 - >=3.0.0 SDK version requirement to allow for new language features

Change-Id: Ib1859c1b4e153fef7ee1f91e67e881bbf42652c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330500
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-10-23 17:00:10 +00:00
Kenzie Schmoll a489f8a621 Add wrapFuture VmService endpoint that can be overridden to add additional logic to each VM service RPC call, like logging or tracking values.
This CL also adds:
1. a method `vmServiceConnectUriWithCreator` helper alongside the existing `vmServiceConnectUri` helper. This method can create a generic `VmService` instance with the same logic as the existing `vmServiceConnectUri` helper. This was implemented this way so that it is not a breaking change to the existing helper.
2. a typedef `VmServiceCreator` for use in the `vmServiceConnectUriWithCreator` method and for shared use in packages that depend on `package:vm_service` (e.g. the DevTools packages)
3. a static method `VmService.defaultCreator` that provides a `VmServiceCreator` method for the `VmService` class.

The DevTools changes that are paired with this change are here: https://github.com/flutter/devtools/pull/6508.

Change-Id: I72d22e7d93d5aeba628bef630ae168eb7477ca6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329820
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2023-10-12 18:36:52 +00:00
Kenzie Schmoll 112c08b418 Remove deprecated APIs from dart_io_extensions.dart and add new is*Available RPCs.
Removed:
- `startSocketProfiling`
- `pauseSocketProfiling`
- `getHttpEnableTimelineLogging`
- `setHttpEnableTimelineLogging`

Added:
- `isSocketProfilingAvailable`
- `isHttpTimelineLoggingAvailable`
- `isHttpProfilingAvailable`

The added RPCs were previously implemented in DevTools with a TODO to move these into `dart_io_extensions.dart`: https://github.com/flutter/devtools/blob/master/packages/devtools_app/lib/src/service/vm_service_wrapper.dart#L896-L918

Change-Id: Ic6c14ae7c09361e39fb3b0ad8c28e3e5863ca9bb
CoreLibraryReviewExempt: VM service changes
TEST=existing tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329800
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-10-11 22:22:12 +00:00
Devon Carew e2fe203adc [deps] roll package:lints to the latest
Change-Id: I582f956cd4b712203c2f6dd630b4e1384040446d
Tested: analysis clean (this is a lint only related change)
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329400
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-10-05 03:36:59 +00:00
Devon Carew 3b0b1bd863 Bump package:lints to the latest; address instances of new lints.
Changes:
```
> git log --format="%C(auto) %h %s" 8d5f750..b044aca
 https://dart.googlesource.com/lints.git/+/b044aca add several rules to core and recommended (150)
 https://dart.googlesource.com/lints.git/+/81100a2 fix a dangling table link (146)
```

Diff: https://dart.googlesource.com/lints.git/+/8d5f7500024320654adb1e799e49fc10c5304ae7..b044acab9f6669b3d8e781923a8ff86877801177/
Change-Id: I031333ade99af700a7009b14a36d3aadba12fc94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327321
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-09-25 21:15:15 +00:00
Liam Appelbe 2fcc9bd9c6 [ VM / Service ] Add librariesAlreadyCompiled to getSourceReport RPC
The goal is to have the flutter test framework skip compilation of
libraries it's already seen. See option 3 from this doc:
https://docs.google.com/document/d/193DKN1DmbHdphhbC8RngdkSafHQGF2QEmf-qDxqSIrk/edit#heading=h.fn9090oeqrk3

Change-Id: Ia76bbb35df22dee6e9f8b32f90bbf2ef2fa18913
TEST=source_report_libraries_already_compiled_test.dart
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321660
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2023-09-19 21:53:41 +00:00
Ben Konyi 0f39236144 [ package:vm_service ] Add wsUri property to VmService
The `wsUri` property can be used to identify the target VM service that
a `VmService` instance is connected to.

Change-Id: Ic2ba4674e7b247f808d399aeb64d246a5c791a93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322540
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-08-24 20:23:14 +00:00
Derek Xu eb7368356d [VM/Service] Improve documentation of reloadSources
TEST=Only changes documentation.

Change-Id: I00fa8afce200f53420c1b712c91768d586d31514
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322000
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-08-21 16:52:19 +00:00
Ryan Macnak 5e49ea5ad8 [vm, service] Fix discrepancy between VM generating kind _TypeParameters and service.md claiming the existence of kind TypeParameters.
Fix the service type `TypeParameters` to recognize it is a heap object.

Exhaustively test that the service client libraries can handle inflating all types produced by the VM. Compare vm/cc/PrintJSON, which exhaustively tests the VM can generate any type.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/52893
Change-Id: Id1f080656ef6e999e69f2ebb5b9961fa3b461e4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316862
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-08-01 20:34:21 +00:00
Derek Xu 24e65bee37 [VM/Service] Add isGetter and isSetter properties to @Function and Function
TEST=pkg/vm_service/test/get_object_rpc_test.dart and
vm/cc/PrintJSONPrimitives

Fixes: https://github.com/dart-lang/sdk/issues/52920
Change-Id: Id3786e48c8827911e7c49af6ab2f0bf0cd97279f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313642
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-07-17 15:01:21 +00:00
Derek Xu ce5210bac9 [package:vm_service] Make generator generate abstract classes for enums in service.md
Change-Id: Idd7542daadcecdd8f71eebafdae3a8e7eecb7e9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313641
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-07-17 15:01:21 +00:00
Vyacheslav Egorov 8d5dbbdf69 [vm/debugger] Rename "causal" to "awaiter" internally
The name is more accurately reflects what this stack trace
contains: despite what causal implies it does *not* actually
reflect the stack which initiated the async operation. Instead
it contains the chain of listeners which will run when
the async operation completes - its awaiters.

TEST=ci

Change-Id: Ie7309c9b1c39246e0fd4c14f7b9c515bcdfbbe10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311384
Reviewed-by: Derek Xu <derekx@google.com>
2023-06-27 07:47:39 +00:00
Vyacheslav Egorov 4a6f9328a2 [vm/debugger] Simplify async breakpoints implementation
We no longer rewrite suspendable function into closures nested
inside the original function, so the whole synthetic async breakpoint
machinery is not needed.

Refactor `Breakpoint` class to make one-shot and per-closure
separate properties of breakpoint, which allows creating
one-shot-per-closure breakpoints.

TEST=existing service tests

Change-Id: I208afe13f36efa40f5746e44867bd24684cf5f03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310601
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-06-26 22:45:10 +00:00
Helin Shiah 5b3f7990e8 Revert "Revert "Send DAP events through DDS"" - only check for event handler when DDS URI is also set.
Original change reverted due to test failure: https://github.com/dart-lang/sdk/issues/43743#issuecomment-1601278402

This reverts commit 02b10e1321.

Change-Id: Idb2cbffe18342c76d0cc062e5855c10a6df0e8f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310780
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2023-06-22 21:43:22 +00:00
Helin Shiah 02b10e1321 Revert "Send DAP events through DDS"
This reverts commit 5292ee8839.

Reason for revert: Causes failure on `sse_smoke_test` because it needs to set up an event handler.

Original change's description:
> Send DAP events through DDS
>
> Change-Id: Ib40306b8e47d74b02b6cbf348c2b5833cfb31a9d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309080
> Commit-Queue: Helin Shiah <helinx@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

Change-Id: I62b12de8e2478441d9a7a4177ed1090aa845467f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310740
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2023-06-21 18:17:16 +00:00
Helin Shiah 5292ee8839 Send DAP events through DDS
Change-Id: Ib40306b8e47d74b02b6cbf348c2b5833cfb31a9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309080
Commit-Queue: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-06-21 15:51:24 +00:00
Elliott Brooks 70af4a9db0 Add constructor to RPCErrorKind enum
Follow up to https://dart-review.googlesource.com/c/sdk/+/307970

Learned from Kenzie this was possible :) https://github.com/flutter/devtools/pull/5917#discussion_r1231368050

Bug: https://github.com/dart-lang/sdk/issues/52636
Change-Id: Ic244765a6258c000c4171ece35273609c7ee5929
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309831
Commit-Queue: Elliott Brooks <elliottbrooks@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-06-20 18:33:50 +00:00