Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化 Dart FFI 与 C++ 通信的方式 #128

Closed
andycall opened this issue Mar 30, 2021 · 1 comment
Closed

优化 Dart FFI 与 C++ 通信的方式 #128

andycall opened this issue Mar 30, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request P4

Comments

@andycall
Copy link
Member

发现 Dart 现在支持传入一个 Dart_Handler 作为 FFI 函数的参数,这意味着任何一个 Dart 对象、函数都可以直接传递到 C,然后通过 dart_api.h 里面提供的符号进行一些调用操作,包括直接获取属性,转成函数等。

看样子是可以在中间去掉 Map 有关的映射来让 C++ 对象和 Dart 对象直接对接。

dart-lang/sdk#36858
dart-lang/sdk#35770
https://github.com/google/webcrypto.dart/blob/6dd34605b16097f2845742e04cce1aa4854b07d8/src/webcrypto_dart_dl.c#L49-L72

@andycall andycall added the enhancement New feature or request label Mar 30, 2021
@andycall andycall added this to the 0.8 milestone Mar 30, 2021
@andycall andycall self-assigned this Mar 30, 2021
@andycall andycall modified the milestone: 0.8 May 7, 2021
@andycall andycall modified the milestones: 0.8, 0.9 Jun 22, 2021
@andycall
Copy link
Member Author

因为 Dart_Handler 并不是持久保存,无法使用 CommandBuffer 来实现,因此是否会带来性能优化待确定。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P4
Projects
None yet
Development

No branches or pull requests

2 participants