mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:09:48 +00:00
[dart:io] Publish implementations of the VM file callbacks.
TEST=ci Change-Id: I481b6fe3e7eae02ff7f2c94fa2f60bef0a972b3c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241685 Reviewed-by: Alexander Aprelev <aam@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
907f7dd4ae
commit
4c7840d330
|
@ -57,6 +57,19 @@ void GetIOEmbedderInformation(Dart_EmbedderInformation* info) {
|
|||
Process::GetRSSInformation(&(info->max_rss), &(info->current_rss));
|
||||
}
|
||||
|
||||
void* OpenFile(const char* name, bool write) {
|
||||
return DartUtils::OpenFile(name, write);
|
||||
}
|
||||
void ReadFile(uint8_t** data, intptr_t* file_len, void* stream) {
|
||||
DartUtils::ReadFile(data, file_len, stream);
|
||||
}
|
||||
void WriteFile(const void* buffer, intptr_t num_bytes, void* stream) {
|
||||
DartUtils::WriteFile(buffer, num_bytes, stream);
|
||||
}
|
||||
void CloseFile(void* stream) {
|
||||
DartUtils::CloseFile(stream);
|
||||
}
|
||||
|
||||
bool GetEntropy(uint8_t* buffer, intptr_t length) {
|
||||
return Crypto::GetRandomBytes(length, buffer);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,12 @@ void SetExecutableArguments(int script_index, char** argv);
|
|||
// Set dart:io implementation specific fields of Dart_EmbedderInformation.
|
||||
void GetIOEmbedderInformation(Dart_EmbedderInformation* info);
|
||||
|
||||
// Appropriate to assign to Dart_InitializeParams.file_open/read/write/close.
|
||||
void* OpenFile(const char* name, bool write);
|
||||
void ReadFile(uint8_t** data, intptr_t* file_len, void* stream);
|
||||
void WriteFile(const void* buffer, intptr_t num_bytes, void* stream);
|
||||
void CloseFile(void* stream);
|
||||
|
||||
// Generates 'length' random bytes into 'buffer'. Returns true on success
|
||||
// and false on failure. This is appropriate to assign to
|
||||
// Dart_InitializeParams.entropy_source.
|
||||
|
|
Loading…
Reference in a new issue