#include <dart_byte_data.h>
Definition at line 15 of file dart_byte_data.h.
◆ DartByteData() [1/3]
| tonic::DartByteData::DartByteData |
( |
Dart_Handle |
list | ) |
|
|
explicit |
Definition at line 57 of file dart_byte_data.cc.
58 : data_(nullptr), length_in_bytes_(0), dart_handle_(list) {
59 if (Dart_IsNull(list))
60 return;
61
62 Dart_TypedData_Type
type;
63 Dart_TypedDataAcquireData(list, &
type, &data_, &length_in_bytes_);
65 if (
type != Dart_TypedData_kByteData)
66 Dart_ThrowException(
ToDart(
"Non-genuine ByteData passed to engine."));
67}
Dart_Handle ToDart(const T &object)
bool CheckAndHandleError(Dart_Handle handle)
References tonic::CheckAndHandleError(), tonic::ToDart(), TONIC_DCHECK, and type.
◆ DartByteData() [2/3]
Definition at line 69 of file dart_byte_data.cc.
70 : data_(other.data_),
71 length_in_bytes_(other.length_in_bytes_),
72 dart_handle_(other.dart_handle_) {
73 other.data_ = nullptr;
74 other.dart_handle_ = nullptr;
75}
◆ DartByteData() [3/3]
| tonic::DartByteData::DartByteData |
( |
| ) |
|
Definition at line 39 of file dart_byte_data.cc.
40 : data_(nullptr), length_in_bytes_(0), dart_handle_(nullptr) {}
◆ ~DartByteData()
| tonic::DartByteData::~DartByteData |
( |
| ) |
|
◆ Copy()
| std::vector< char > tonic::DartByteData::Copy |
( |
| ) |
const |
Definition at line 81 of file dart_byte_data.cc.
81 {
82 const char* ptr = static_cast<const char*>(data_);
83 return std::vector<char>(ptr, ptr + length_in_bytes_);
84}
◆ Create()
| Dart_Handle tonic::DartByteData::Create |
( |
const void * |
data, |
|
|
size_t |
length |
|
) |
| |
|
static |
Definition at line 25 of file dart_byte_data.cc.
25 {
28
29 return handle;
30 } else {
31 void* buf = ::malloc(
length);
34 return Dart_NewExternalTypedDataWithFinalizer(
35 Dart_TypedData_kByteData, buf,
length, buf,
length, FreeFinalizer);
36 }
37}
static const size_t kExternalSizeThreshold
const void * data() const
References dart_handle(), data(), kExternalSizeThreshold, length, and TONIC_DCHECK.
Referenced by flutter::PlatformConfiguration::DispatchPointerDataPacket(), and flutter::PlatformConfigurationNativeApi::GetPersistentIsolateData().
◆ dart_handle()
| Dart_Handle tonic::DartByteData::dart_handle |
( |
| ) |
const |
|
inline |
◆ data() [1/2]
| void * tonic::DartByteData::data |
( |
| ) |
|
|
inline |
◆ data() [2/2]
| const void * tonic::DartByteData::data |
( |
| ) |
const |
|
inline |
◆ length_in_bytes()
| size_t tonic::DartByteData::length_in_bytes |
( |
| ) |
const |
|
inline |
◆ operator bool()
| tonic::DartByteData::operator bool |
( |
| ) |
const |
|
inlineexplicit |
◆ Release()
| void tonic::DartByteData::Release |
( |
| ) |
const |
Definition at line 86 of file dart_byte_data.cc.
86 {
87 if (data_) {
88 Dart_TypedDataReleaseData(dart_handle_);
89 data_ = nullptr;
90 }
91}
Referenced by ~DartByteData().
◆ kExternalSizeThreshold
| const size_t tonic::DartByteData::kExternalSizeThreshold = 1000 |
|
static |
The documentation for this class was generated from the following files: