[io] Move OSError::isInprogressCode to implementation patch class.

This addresses comments on https://dart-review.googlesource.com/c/sdk/+/193221.

TEST=ci

Change-Id: I0eaac9f640b172e37da6199f7353de8b066f854e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195059
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
This commit is contained in:
Alexander Aprelev 2021-04-13 13:52:06 +00:00 committed by commit-bot@chromium.org
parent 5a7fe188db
commit 8800decca4
4 changed files with 4 additions and 20 deletions

View file

@ -219,14 +219,6 @@ bool _isDirectIOCapableTypedList(List<int> buffer) {
throw UnsupportedError("_isDirectIOCapableTypedList");
}
@patch
class OSError {
@patch
static int inProgressErrorCode() {
throw new UnsupportedError("OSError.inProgressErrorCode");
}
}
@patch
class _IOCrypto {
@patch

View file

@ -227,14 +227,6 @@ class _IOCrypto {
}
}
@patch
class OSError {
@patch
static int inProgressErrorCode() {
throw new UnsupportedError("OSError.inProgressErrorCode");
}
}
@patch
class _Platform {
@patch

View file

@ -374,6 +374,9 @@ class _NetworkInterface implements NetworkInterface {
// implicit constructor.
class _NativeSocketNativeWrapper extends NativeFieldWrapperClass1 {}
/// Returns error code that corresponds to EINPROGRESS OS error.
int get _inProgressErrorCode native "OSError_inProgressErrorCode";
// The _NativeSocket class encapsulates an OS socket.
class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
// Bit flags used when communicating between the eventhandler and
@ -802,7 +805,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
try {
socket.port;
} catch (e) {
if (e is OSError && e.errorCode == OSError.inProgressErrorCode()) {
if (e is OSError && e.errorCode == _inProgressErrorCode) {
// Ignore the error, proceed with waiting for a socket to become open.
// In non-blocking mode connect might not be established away, socket
// have to be waited for.

View file

@ -48,9 +48,6 @@ class OSError implements Exception {
/// Constant used to indicate that no OS error code is available.
static const int noErrorCode = -1;
/// Returns error code that corresponds to EINPROGRESS OS error.
external static int inProgressErrorCode();
/// Error message supplied by the operating system. This will be empty if no
/// message is associated with the error.
final String message;