Skip to content

Commit 9e11d79

Browse files
mralephCommit Queue
authored and
Commit Queue
committed
[vm] Remove dart:cli waitFor
Closes #52121 Tested: CI CoreLibraryReviewExempt: Approved breaking change to VM specific code Change-Id: Icc89017c5a7676c2ae07488692ad8b8b9e131a7f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/354880 Commit-Queue: Slava Egorov <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
1 parent 0766f7b commit 9e11d79

31 files changed

+12
-806
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919

2020
### Libraries
2121

22+
#### `dart:cli`
23+
24+
- **Breaking change** [#52121][]: `waitFor` is removed in 3.4.
25+
2226
#### `dart:io`
2327

2428
- **Breaking change** [#53863][]: `Stdout` has a new field `lineTerminator`,

runtime/bin/BUILD.gn

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import("../vm/heap/heap_sources.gni")
1212
import("../vm/vm_sources.gni")
1313
import("builtin_impl_sources.gni")
1414
import("builtin_sources.gni")
15-
import("cli_impl_sources.gni")
1615
import("cli_sources.gni")
1716
import("io_impl_sources.gni")
1817
import("io_sources.gni")
@@ -357,7 +356,7 @@ template("build_gen_snapshot_dart_io") {
357356

358357
defines = [ "DART_IO_SECURE_SOCKET_DISABLED" ]
359358

360-
sources = io_impl_sources + cli_impl_sources
359+
sources = io_impl_sources
361360
sources += [
362361
"io_natives.cc",
363362
"io_natives.h",
@@ -476,7 +475,7 @@ template("dart_io") {
476475
}
477476
}
478477

479-
sources = io_impl_sources + cli_impl_sources
478+
sources = io_impl_sources
480479
sources += [
481480
"builtin_natives.cc",
482481
"io_natives.cc",

runtime/bin/cli.cc

-27
This file was deleted.

runtime/bin/cli_impl_sources.gni

-6
This file was deleted.

runtime/bin/dartutils.cc

+1-5
Original file line numberDiff line numberDiff line change
@@ -553,11 +553,7 @@ Dart_Handle DartUtils::PrepareIsolateLibrary(Dart_Handle isolate_lib) {
553553
}
554554

555555
Dart_Handle DartUtils::PrepareCLILibrary(Dart_Handle cli_lib) {
556-
Dart_Handle wait_for_event_handle =
557-
Dart_Invoke(cli_lib, NewString("_getWaitForEvent"), 0, nullptr);
558-
RETURN_IF_ERROR(wait_for_event_handle);
559-
return Dart_SetField(cli_lib, NewString("_waitForEventClosure"),
560-
wait_for_event_handle);
556+
return Dart_Null();
561557
}
562558

563559
Dart_Handle DartUtils::SetupPackageConfig(const char* packages_config) {

runtime/bin/io_natives.cc

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ namespace bin {
2020
// Some classes, like File and Directory, list their implementations in
2121
// builtin_natives.cc instead.
2222
#define IO_NATIVE_LIST(V) \
23-
V(CLI_WaitForEvent, 1) \
2423
V(Crypto_GetRandomBytes, 1) \
2524
V(Directory_Create, 2) \
2625
V(Directory_CreateTemp, 2) \

runtime/include/dart_api.h

+2-13
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ typedef struct Dart_CodeObserver {
868868
* implement registration of kernel blobs for the subsequent Isolate.spawnUri
869869
* If no callback is provided, the registration of kernel blobs will throw
870870
* an error.
871-
*
871+
*
872872
* \param kernel_buffer A buffer which contains a kernel program. Callback
873873
* should copy the contents of `kernel_buffer` as
874874
* it may be freed immediately after registration.
@@ -888,7 +888,7 @@ typedef const char* (*Dart_RegisterKernelBlobCallback)(
888888
* unregister kernel blobs.
889889
* If no callback is provided, the unregistration of kernel blobs will throw
890890
* an error.
891-
*
891+
*
892892
* \param kernel_blob_uri URI of the kernel blob to unregister.
893893
*/
894894
typedef void (*Dart_UnregisterKernelBlobCallback)(const char* kernel_blob_uri);
@@ -1679,17 +1679,6 @@ DART_EXPORT Dart_Handle Dart_GetStickyError(void);
16791679
*/
16801680
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_HandleMessage(void);
16811681

1682-
/**
1683-
* Drains the microtask queue, then blocks the calling thread until the current
1684-
* isolate receives a message, then handles all messages.
1685-
*
1686-
* \param timeout_millis When non-zero, the call returns after the indicated
1687-
number of milliseconds even if no message was received.
1688-
* \return A valid handle if no error occurs, otherwise an error handle.
1689-
*/
1690-
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
1691-
Dart_WaitForEvent(int64_t timeout_millis);
1692-
16931682
/**
16941683
* Handles any pending messages for the vm service for the current
16951684
* isolate.

runtime/tests/vm/dart/exported_symbols_test.dart

-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ main() {
350350
"Dart_TypeToNullableType",
351351
"Dart_TypeVoid",
352352
"Dart_VersionString",
353-
"Dart_WaitForEvent",
354353
"Dart_WriteHeapSnapshot",
355354
"Dart_WriteProfileToTimeline",
356355
];

runtime/vm/dart_api_impl.cc

-62
Original file line numberDiff line numberDiff line change
@@ -2109,68 +2109,6 @@ DART_EXPORT Dart_Handle Dart_HandleMessage() {
21092109
return Api::Success();
21102110
}
21112111

2112-
DART_EXPORT Dart_Handle Dart_WaitForEvent(int64_t timeout_millis) {
2113-
if (!FLAG_enable_deprecated_wait_for) {
2114-
return Dart_NewUnhandledExceptionError(Dart_NewStringFromCString(
2115-
"Synchronous waiting using dart:cli waitFor "
2116-
"and C API Dart_WaitForEvent is deprecated and disabled by default. "
2117-
"This feature will be fully removed in Dart 3.4 release. "
2118-
"You can currently still enable it by passing "
2119-
"--enable_deprecated_wait_for "
2120-
"to the Dart VM. "
2121-
"See https://dartbug.com/52121."));
2122-
}
2123-
2124-
Thread* T = Thread::Current();
2125-
Isolate* I = T->isolate();
2126-
CHECK_API_SCOPE(T);
2127-
CHECK_CALLBACK_STATE(T);
2128-
API_TIMELINE_BEGIN_END(T);
2129-
TransitionNativeToVM transition(T);
2130-
if (I->message_notify_callback() != nullptr) {
2131-
return Api::NewError("waitForEventSync is not supported by this embedder");
2132-
}
2133-
Object& result =
2134-
Object::Handle(Z, DartLibraryCalls::EnsureScheduleImmediate());
2135-
if (result.IsError()) {
2136-
return Api::NewHandle(T, result.ptr());
2137-
}
2138-
2139-
// Drain the microtask queue. Propagate any errors to the entry frame.
2140-
result = DartLibraryCalls::DrainMicrotaskQueue();
2141-
if (result.IsError()) {
2142-
// Persist the error across unwiding scopes before propagating.
2143-
const Error* error;
2144-
{
2145-
NoSafepointScope no_safepoint;
2146-
ErrorPtr raw_error = Error::Cast(result).ptr();
2147-
T->UnwindScopes(T->top_exit_frame_info());
2148-
error = &Error::Handle(T->zone(), raw_error);
2149-
}
2150-
Exceptions::PropagateToEntry(*error);
2151-
UNREACHABLE();
2152-
return Api::NewError("Unreachable");
2153-
}
2154-
2155-
// Block to wait for messages and then handle them. Propagate any errors to
2156-
// the entry frame.
2157-
if (I->message_handler()->PauseAndHandleAllMessages(timeout_millis) !=
2158-
MessageHandler::kOK) {
2159-
// Persist the error across unwiding scopes before propagating.
2160-
const Error* error;
2161-
{
2162-
NoSafepointScope no_safepoint;
2163-
ErrorPtr raw_error = T->StealStickyError();
2164-
T->UnwindScopes(T->top_exit_frame_info());
2165-
error = &Error::Handle(T->zone(), raw_error);
2166-
}
2167-
Exceptions::PropagateToEntry(*error);
2168-
UNREACHABLE();
2169-
return Api::NewError("Unreachable");
2170-
}
2171-
return Api::Success();
2172-
}
2173-
21742112
DART_EXPORT bool Dart_HandleServiceMessages() {
21752113
#if defined(PRODUCT)
21762114
return true;

sdk/lib/_internal/vm/bin/cli_patch.dart

-9
This file was deleted.

sdk/lib/cli/cli.dart

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/// ## Deprecation notice
88
///
99
/// The functionality of this library is incomplete and may be removed in a
10-
/// later version. See [waitFor] for details.
10+
/// later version.
1111
///
1212
/// {@category VM}
1313
@Deprecated(
@@ -16,5 +16,3 @@ library dart.cli;
1616

1717
import 'dart:async';
1818
import 'dart:math';
19-
20-
part 'wait_for.dart';

sdk/lib/cli/cli_sources.gni

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,4 @@
22
# for details. All rights reserved. Use of this source code is governed by a
33
# BSD-style license that can be found in the LICENSE file.
44

5-
cli_sdk_sources = [
6-
"cli.dart",
7-
8-
# The above file needs to be first if additional parts are added to the lib.
9-
"wait_for.dart",
10-
]
5+
cli_sdk_sources = [ "cli.dart" ]

0 commit comments

Comments
 (0)