Flutter Engine
The Flutter Engine
handle.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_PKG_ZIRCON_FFI_HANDLE_H_
6#define FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_PKG_ZIRCON_FFI_HANDLE_H_
7
8#include "macros.h"
9
10#include "include/dart_api_dl.h"
11
12#include <stdint.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18typedef struct zircon_dart_handle_t {
19 uint32_t handle;
21
26
28 // data is of type `std::vector<zircon_handle_t*>*`.
29 void* data;
30 uint32_t size;
32
33// Creates a list.
35
36// Appends to the list.
39 zircon_dart_handle_t* handle);
40
41// Frees the list, all the handles passed here must have been released.
44
45// Returns 1 if the handle is valid.
47 zircon_dart_handle_t* handle);
48
49// Closes the handle, but doesn't release any ffi-associated memory. Returns 1
50// on success.
52 zircon_dart_handle_t* handle);
53
54// Closes the zircon handle if valid and frees the memory.
56
57// Attach a finalizer for pointer to object, such that `finalizer(pointer)` will
58// be called when `object` is collected by the Dart garbage collector.
59//
60// The external_allocation_size is used by the Dart garbage collector as a hint
61// about the size of the external allocation.
62//
63// Returns 1 on success.
64
66 Dart_Handle object,
67 void* pointer,
68 intptr_t external_allocation_size);
69
71 Dart_Handle object,
72 void* pointer,
73 intptr_t external_allocation_size);
74
75// ZIRCON_FFI_EXPORT zircon_dart_handle_t* zircon_dart_duplicate_handle(
76// zircon_dart_handle_t* handle,
77// uint32_t rights);
78
79#ifdef __cplusplus
80}
81#endif
82
83#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_PKG_ZIRCON_FFI_HANDLE_H_
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
ZIRCON_FFI_EXPORT int zircon_dart_handle_attach_finalizer(Dart_Handle object, void *pointer, intptr_t external_allocation_size)
Definition: handle.cc:54
ZIRCON_FFI_EXPORT void zircon_dart_handle_list_free(zircon_dart_handle_list_t *list)
Definition: handle.cc:104
struct zircon_dart_handle_pair_t zircon_dart_handle_pair_t
struct zircon_dart_handle_list_t zircon_dart_handle_list_t
ZIRCON_FFI_EXPORT int zircon_dart_handle_pair_attach_finalizer(Dart_Handle object, void *pointer, intptr_t external_allocation_size)
Definition: handle.cc:68
ZIRCON_FFI_EXPORT void zircon_dart_handle_free(zircon_dart_handle_t *handle)
Definition: handle.cc:27
ZIRCON_FFI_EXPORT void zircon_dart_handle_list_append(zircon_dart_handle_list_t *list, zircon_dart_handle_t *handle)
Definition: handle.cc:95
ZIRCON_FFI_EXPORT int32_t zircon_dart_handle_close(zircon_dart_handle_t *handle)
Definition: handle.cc:35
struct zircon_dart_handle_t zircon_dart_handle_t
ZIRCON_FFI_EXPORT zircon_dart_handle_list_t * zircon_dart_handle_list_create()
Definition: handle.cc:87
ZIRCON_FFI_EXPORT int32_t zircon_dart_handle_is_valid(zircon_dart_handle_t *handle)
Definition: handle.cc:46
#define ZIRCON_FFI_EXPORT
Definition: macros.h:8
zircon_dart_handle_t * right
Definition: handle.h:24
zircon_dart_handle_t * left
Definition: handle.h:23
uint32_t handle
Definition: handle.h:19