Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 54903e5

Browse files
dcharkescommit-bot@chromium.org
authored andcommitted
[vm/ffi] Rename members in NativeApi to not contain nativeApi
Follow up of: https://dart-review.googlesource.com/c/sdk/+/136962 Change-Id: Icdc8e7f701b0dbc7e476a140e68bcb15b3ac64ae Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-kernel-precomp-win-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138283 Commit-Queue: Daco Harkes <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
1 parent a8c7757 commit 54903e5

File tree

6 files changed

+22
-24
lines changed

6 files changed

+22
-24
lines changed

samples/ffi/async/sample_async_callback.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ main() async {
2626
print("C T2 = Some C thread executing C.");
2727
print("C = C T1 or C T2.");
2828
print("Dart: Setup.");
29-
registerDart_PostCObject(NativeApi.nativeApiPostCObject);
29+
registerDart_PostCObject(NativeApi.postCObject);
3030

3131
final interactiveCppRequests = ReceivePort()..listen(requestExecuteCallback);
3232
final int nativePort = interactiveCppRequests.sendPort.nativePort;

samples/ffi/async/sample_native_port_call.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ main() async {
3535
print("C T2 = Some C thread executing C.");
3636
print("C = C T1 or C T2.");
3737
print("Dart: Setup.");
38-
registerDart_PostCObject(NativeApi.nativeApiPostCObject);
39-
registerDart_NewNativePort(NativeApi.nativeApiNewNativePort);
40-
registerDart_CloseNativePort(NativeApi.nativeApiCloseNativePort);
38+
registerDart_PostCObject(NativeApi.postCObject);
39+
registerDart_NewNativePort(NativeApi.newNativePort);
40+
registerDart_CloseNativePort(NativeApi.closeNativePort);
4141

4242
final interactiveCppRequests = ReceivePort()..listen(handleCppRequests);
4343
final int nativePort = interactiveCppRequests.sendPort.nativePort;

sdk/lib/_internal/vm/lib/ffi_patch.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,10 @@ extension NativePort on SendPort {
456456
int _nativeApiFunctionPointer(String symbol) native "NativeApiFunctionPointer";
457457

458458
@patch
459-
class NativeApi {
459+
abstract class NativeApi {
460460
@patch
461461
static Pointer<NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>>
462-
get nativeApiPostCObject =>
462+
get postCObject =>
463463
Pointer.fromAddress(_nativeApiFunctionPointer("Dart_PostCObject"));
464464

465465
@patch
@@ -468,11 +468,10 @@ class NativeApi {
468468
Int64 Function(
469469
Pointer<Uint8>,
470470
Pointer<NativeFunction<Dart_NativeMessageHandler>>,
471-
Int8)>> get nativeApiNewNativePort =>
471+
Int8)>> get newNativePort =>
472472
Pointer.fromAddress(_nativeApiFunctionPointer("Dart_NewNativePort"));
473473

474474
@patch
475-
static Pointer<NativeFunction<Int8 Function(Int64)>>
476-
get nativeApiCloseNativePort => Pointer.fromAddress(
477-
_nativeApiFunctionPointer("Dart_CloseNativePort"));
475+
static Pointer<NativeFunction<Int8 Function(Int64)>> get closeNativePort =>
476+
Pointer.fromAddress(_nativeApiFunctionPointer("Dart_CloseNativePort"));
478477
}

sdk/lib/ffi/ffi.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,13 +629,13 @@ class Dart_CObject extends Struct {}
629629
typedef Dart_NativeMessageHandler = Void Function(Int64, Pointer<Dart_CObject>);
630630

631631
/// Exposes function pointers to functions in `dart_native_api.h`.
632-
class NativeApi {
632+
abstract class NativeApi {
633633
/// A function pointer to
634634
/// `bool Dart_PostCObject(Dart_Port port_id, Dart_CObject* message)`
635635
/// in `dart_native_api.h`.
636636
external static Pointer<
637637
NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>>
638-
get nativeApiPostCObject;
638+
get postCObject;
639639

640640
/// A function pointer to
641641
/// ```
@@ -649,11 +649,11 @@ class NativeApi {
649649
Int64 Function(
650650
Pointer<Uint8>,
651651
Pointer<NativeFunction<Dart_NativeMessageHandler>>,
652-
Int8)>> get nativeApiNewNativePort;
652+
Int8)>> get newNativePort;
653653

654654
/// A function pointer to
655655
/// `bool Dart_CloseNativePort(Dart_Port native_port_id)`
656656
/// in `dart_native_api.h`.
657657
external static Pointer<NativeFunction<Int8 Function(Int64)>>
658-
get nativeApiCloseNativePort;
658+
get closeNativePort;
659659
}

sdk_nnbd/lib/_internal/vm/lib/ffi_patch.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,10 @@ extension NativePort on SendPort {
454454
int _nativeApiFunctionPointer(String symbol) native "NativeApiFunctionPointer";
455455

456456
@patch
457-
class NativeApi {
457+
abstract class NativeApi {
458458
@patch
459459
static Pointer<NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>>
460-
get nativeApiPostCObject =>
460+
get postCObject =>
461461
Pointer.fromAddress(_nativeApiFunctionPointer("Dart_PostCObject"));
462462

463463
@patch
@@ -466,11 +466,10 @@ class NativeApi {
466466
Int64 Function(
467467
Pointer<Uint8>,
468468
Pointer<NativeFunction<Dart_NativeMessageHandler>>,
469-
Int8)>> get nativeApiNewNativePort =>
469+
Int8)>> get newNativePort =>
470470
Pointer.fromAddress(_nativeApiFunctionPointer("Dart_NewNativePort"));
471471

472472
@patch
473-
static Pointer<NativeFunction<Int8 Function(Int64)>>
474-
get nativeApiCloseNativePort => Pointer.fromAddress(
475-
_nativeApiFunctionPointer("Dart_CloseNativePort"));
473+
static Pointer<NativeFunction<Int8 Function(Int64)>> get closeNativePort =>
474+
Pointer.fromAddress(_nativeApiFunctionPointer("Dart_CloseNativePort"));
476475
}

sdk_nnbd/lib/ffi/ffi.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,13 +628,13 @@ class Dart_CObject extends Struct {}
628628
typedef Dart_NativeMessageHandler = Void Function(Int64, Pointer<Dart_CObject>);
629629

630630
/// Exposes function pointers to functions in `dart_native_api.h`.
631-
class NativeApi {
631+
abstract class NativeApi {
632632
/// A function pointer to
633633
/// `bool Dart_PostCObject(Dart_Port port_id, Dart_CObject* message)`
634634
/// in `dart_native_api.h`.
635635
external static Pointer<
636636
NativeFunction<Int8 Function(Int64, Pointer<Dart_CObject>)>>
637-
get nativeApiPostCObject;
637+
get postCObject;
638638

639639
/// A function pointer to
640640
/// ```
@@ -648,11 +648,11 @@ class NativeApi {
648648
Int64 Function(
649649
Pointer<Uint8>,
650650
Pointer<NativeFunction<Dart_NativeMessageHandler>>,
651-
Int8)>> get nativeApiNewNativePort;
651+
Int8)>> get newNativePort;
652652

653653
/// A function pointer to
654654
/// `bool Dart_CloseNativePort(Dart_Port native_port_id)`
655655
/// in `dart_native_api.h`.
656656
external static Pointer<NativeFunction<Int8 Function(Int64)>>
657-
get nativeApiCloseNativePort;
657+
get closeNativePort;
658658
}

0 commit comments

Comments
 (0)