16#define BINARY_MODE _O_BINARY
33bool ReadFileDescriptor(
int fd,
T*
result) {
45 ssize_t bytes_read = 0;
50 }
while (bytes_read > 0);
64 std::pair<uint8_t*, intptr_t> failure_pair{
nullptr, -1};
66 if (fstat(fd, &st) != 0) {
69 intptr_t file_size = st.st_size;
70 uint8_t* ptr = (uint8_t*)
malloc(file_size);
72 size_t bytes_left = file_size;
74 while (bytes_left > 0) {
80 bytes_left -= bytes_read;
82 return std::pair<uint8_t*, intptr_t>(ptr, file_size);
87 return ReadFileDescriptor(fd.
get(),
result);
91 return ReadFileDescriptor(fd,
result);
95 std::pair<uint8_t*, intptr_t> failure_pair{
nullptr, -1};
static bool read(SkStream *stream, void *buffer, size_t amount)
static const size_t kBufferSize
void * malloc(size_t size)
bool ReadFileDescriptorToString(int fd, std::string *result)
bool ReadFileToString(const std::string &path, std::string *result)
std::pair< uint8_t *, intptr_t > ReadFileToBytes(const std::string &path)
std::pair< uint8_t *, intptr_t > ReadFileDescriptorToBytes(int fd)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path